You are on page 1of 12

 Search WordPress.

org

Codex Codex tools: Log


in

Home Page
 Interested in functions, hooks, classes, or methods? Check out the new WordPress Code Reference!
WordPress Lessons

Function Reference Getting Started

Working with
WordPress
Languages: English • Español • ‫ • ﻓﺎرﺳﯽ‬Français • Italiano • ქართული • • Português do Brasil • Русский • Türkçe • ‫• עברית‬ ( )• ( ) • (Add your language)
Design and Layout

The files of WordPress define many useful PHP functions. Some of the functions, known as Template Tags, Advanced Topics
Contents
are defined especially for use in WordPress Themes. There are also some functions related to actions and Troubleshooting
filters (the Plugin API), which are therefore used primarily for developing Plugins. The rest are used to 1 Functions by category
Developer Docs
create the core WordPress functionality. 1.1 Post, Custom Post Type, Page,
Attachment and Bookmarks Functions About WordPress

Many of the core WordPress functions are useful to Plugin and Theme developers. So, this article lists most 1.2 Category, Tag and Taxonomy
of the core functions, excluding Template Tags. At the bottom of the page, there is a section listing other Functions Codex Resource
resources for finding information about WordPress functions. In addition to this information, the WordPress 1.3 User and Author Functions Community portal
Code Reference site details all the WordPress functions by version since 2.6.1. 1.4 Feed Functions
Current events
1.5 HTTP API Functions
1.6 Comment, Ping, and Trackback Recent changes
You can help make this page more complete!
Functions Random page
1.7 Action, Filter, and Plugin Functions
Here are some things you can do to help: Help
1.8 Theme-Related Functions
1.9 Formatting Functions
Add documentation to un-documented functions, by creating sub-pages or at least by adding short
1.10 Miscellaneous Functions
comments in the lists below. If you create a subpage for a function, please include information and
1.11 Multisite functions
examples of usage of that function, if possible, per the examples found in Template Tags.
2 Official and Unofficial References
List more functions here, following the category structure.
Correct errors by moving functions to better categories where appropriate, and of course fixing typos.
Note: that it is OK for a function to appear in more than one category.

Read Contributing to WordPress to find out more about how you can contribute to the effort!

Functions by category
Post, Custom Post Type, Page, Attachment and Category, Tag and Taxonomy Functions
Bookmarks Functions
Categories
Posts
cat_is_ancestor_of
get_adjacent_post get_all_category_ids (deprecated)
get_boundary_post get_ancestors
get_children get_cat_ID
get_extended get_cat_name
get_next_post get_categories
get_next_posts_link get_category
next_posts_link get_category_by_path
get_permalink get_category_by_slug
the_permalink get_the_category_by_ID
get_the_excerpt get_the_category_list
the_excerpt get_category_link
get_the_post_thumbnail get_category_parents
get_post get_the_category
get_post_field single_cat_title
get_post_ancestors in_category
get_post_mime_type is_category
get_post_status the_category
get_post_format wp_category_checklist
set_post_format wp_dropdown_categories
get_edit_post_link wp_list_categories
get_delete_post_link
get_previous_post Category Creation
get_previous_posts_link
previous_posts_link wp_create_category
get_posts wp_delete_category
have_posts wp_insert_category
is_post (deprecated)
is_single Tags
is_sticky
get_the_ID get_tag
the_ID get_tag_link
the_post get_tags
wp_get_recent_posts get_the_tag_list
wp_get_single_post (deprecated) get_the_tags
has_post_thumbnail has_tag
has_excerpt is_tag
has_post_format the_tags
single_tag_title
Custom Post Status tag_description
wp_generate_tag_cloud
register_post_status wp_tag_cloud

Custom Post Type Taxonomy

register_post_type get_object_taxonomies
is_post_type_archive get_edit_term_link
post_type_archive_title get_edit_term_link
add_post_type_support get_taxonomy
remove_post_type_support get_taxonomies
post_type_supports get_term
set_post_type get_the_term_list
post_type_exists get_term_by
get_post_type the_terms
get_post_types get_the_terms
get_post_type_archive_link get_term_children
get_post_type_object get_term_link
get_post_type_capabilities get_terms
get_post_type_labels is_taxonomy (deprecated)
is_post_type_hierarchical is_tax
is_taxonomy_hierarchical
Post insertion/removal is_term (deprecated)
taxonomy_exists
wp_delete_post term_exists
wp_insert_post register_taxonomy
wp_publish_post register_taxonomy_for_object_type
wp_trash_post wp_get_object_terms
wp_update_post wp_remove_object_terms
wp_set_object_terms
Pages wp_insert_term
wp_update_term
get_all_page_ids wp_delete_term
get_ancestors wp_terms_checklist
get_page (deprecated)
get_page_link
get_page_by_path
get_page_by_title
get_page_children
get_page_hierarchy
get_page_uri
get_pages
is_page
page_uri_index (method of class WP_Rewrite)
wp_link_pages
wp_list_pages
wp_page_menu
wp_dropdown_pages

Custom Fields (postmeta)

add_post_meta
delete_post_meta
get_post_custom
get_post_custom_keys
get_post_custom_values
get_post_meta
update_post_meta
register_meta

Attachments

get_attached_file
image_resize (deprecated)
image_edit_before_change (ported to WP_Image_Editor object)
is_attachment
is_local_attachment
set_post_thumbnail
update_attached_file
wp_attachment_is_image
wp_create_thumbnail (deprecated)
wp_insert_attachment
wp_delete_attachment
wp_get_attachment_image
wp_get_attachment_link
wp_get_attachment_image_src
wp_get_attachment_metadata
wp_get_attachment_thumb_file
wp_get_attachment_thumb_url
wp_get_attachment_url
wp_check_for_changed_slugs
wp_count_posts
wp_get_mime_types
wp_mime_type_icon
wp_generate_attachment_metadata
wp_prepare_attachment_for_js
wp_update_attachment_metadata

Bookmarks

get_bookmark
get_bookmarks
wp_list_bookmarks

Terms

wp_get_post_categories
wp_set_post_categories
wp_get_post_tags
wp_set_post_tags
wp_get_post_terms
wp_set_post_terms
wp_count_terms
has_term
is_object_in_term

Others

add_meta_box
remove_meta_box
get_the_ID
the_ID
get_the_author
the_author
get_the_author_posts
get_the_content
the_content
get_the_title
the_title
the_title_attribute
wp_trim_excerpt
wp_get_post_revision
wp_get_post_revisions
wp_is_post_revision
paginate_links

User and Author Functions Feed Functions


Admins, Roles and Capabilities bloginfo_rss
comment_author_rss
add_cap comment_link
add_role comment_text_rss
author_can do_feed
current_user_can do_feed_atom
current_user_can_for_blog do_feed_rdf
get_role do_feed_rss
get_super_admins do_feed_rss2
is_super_admin fetch_feed
map_meta_cap fetch_rss (deprecated)
remove_cap get_author_feed_link
remove_role get_bloginfo_rss
user_can get_category_feed_link
get_comment_link
Users and Authors get_comment_author_rss
get_post_comments_feed_link
auth_redirect get_rss (deprecated)
count_users get_search_comments_feed_link
count_user_posts get_search_feed_link
count_many_users_posts get_the_category_rss
email_exists get_the_title_rss
get_currentuserinfo permalink_single_rss (deprecated)
get_current_user_id post_comments_feed_link
get_profile (deprecated) rss_enclosure
get_user_by the_title_rss
get_userdata the_category_rss
get_usernumposts (deprecated) the_content_rss (deprecated)
get_users the_excerpt_rss
set_current_user (deprecated) wp_rss (deprecated)
user_pass_ok (deprecated)
wp_authenticate
username_exists
validate_username
wp_dropdown_users
wp_get_current_user
wp_set_current_user
wp_set_password
get_author_posts_url
get_the_modified_author
is_multi_author

User meta

add_user_meta
delete_user_meta
get_user_meta
update_user_meta
get_the_author_meta

User insertion/removal

wp_create_user
wp_delete_user
wp_insert_user
wp_update_user

Login / Logout

is_user_logged_in
wp_login_form
wp_signon
wp_logout
wp_loginout
wp_logout_url
HTTP API Functions
wp_remote_get
wp_remote_retrieve_body
wp_get_http_headers
wp_remote_fopen

Comment, Ping, and Trackback Functions Action, Filter, and Plugin Functions
add_ping Filters (Reference)
add_comment_meta
check_comment has_filter
comment_text add_filter
comment_form apply_filters
comments_number apply_filters_ref_array
discover_pingback_server_uri current_filter
delete_comment_meta merge_filters
do_all_pings remove_filter
do_enclose remove_all_filters
do_trackbacks
generic_ping Actions (Reference)
get_approved_comments
get_avatar has_action
get_comment add_action
get_comment_text do_action
get_comment_meta do_action_ref_array
get_comments did_action
wp_list_comments remove_action
get_enclosed remove_all_actions
get_lastcommentmodified
get_pung Plugins (Reference)
get_to_ping
have_comments plugin_basename
get_comment_author plugins_url
is_trackback get_plugin_data
pingback get_admin_page_title
privacy_ping_filter plugin_dir_path
sanitize_comment_cookies register_activation_hook
trackback register_deactivation_hook
trackback_url menu_page_url
trackback_url_list is_plugin_active
update_comment_meta is_plugin_active_for_network
weblog_ping is_plugin_inactive
wp_allow_comment is_plugin_page
wp_count_comments add_contextual_help (deprecated)
wp_delete_comment get_plugins
wp_filter_comment
wp_get_comment_status Widgets (Reference)
wp_get_current_commenter
wp_insert_comment is_active_widget
wp_new_comment register_widget
wp_set_comment_status the_widget
wp_throttle_comment_flood unregister_widget
wp_update_comment wp_add_dashboard_widget
wp_update_comment_count wp_convert_widget_settings
wp_update_comment_count_now wp_get_sidebars_widgets
wp_get_widget_defaults
Comments Loop wp_register_sidebar_widget
wp_register_widget_control
comment_class wp_set_sidebars_widgets
comment_ID wp_unregister_sidebar_widget
comment_author wp_unregister_widget_control
comment_date wp_widget_description
comment_time
get_comment_date
get_comment_time Settings (Reference)
Comments Pagination register_setting
unregister_setting
paginate_comments_links settings_fields
previous_comments_link do_settings_fields
next_comments_link do_settings_sections
get_comment_pages_count add_settings_field
add_settings_section
add_settings_error
get_settings_errors
settings_errors

Shortcodes (Reference)

add_shortcode
do_shortcode
do_shortcode_tag
get_shortcode_regex
remove_shortcode
remove_all_shortcodes
shortcode_atts
shortcode_parse_atts
strip_shortcodes

Theme-Related Functions Formatting Functions


Include functions absint
add_magic_quotes
comments_template addslashes_gpc
get_footer antispambot
get_header attribute_escape (deprecated)
get_sidebar backslashit
get_search_form balanceTags
clean_pre
Other functions clean_url (deprecated)
convert_chars
add_custom_background (deprecated) convert_smilies
add_custom_image_header (deprecated) ent2ncr
add_image_size esc_attr
add_theme_support esc_html
body_class esc_js
current_theme_supports esc_textarea
dynamic_sidebar esc_sql
get_404_template esc_url
get_archive_template esc_url_raw
get_attachment_template force_balance_tags
get_author_template format_to_edit
get_body_class format_to_post (deprecated)
get_category_template funky_javascript_fix (deprecated)
get_comments_popup_template htmlentities2
get_current_theme is_email
get_date_template js_escape (deprecated)
get_header_image make_clickable
get_header_textcolor popuplinks
get_home_template remove_accents
get_locale_stylesheet_uri sanitize_email
get_page_template sanitize_file_name
get_paged_template sanitize_html_class
get_post_class sanitize_key
get_query_template sanitize_mime_type
get_search_template sanitize_option
get_single_template sanitize_sql_orderby
get_stylesheet sanitize_text_field
get_stylesheet_directory sanitize_title
get_stylesheet_directory_uri sanitize_title_for_query
get_stylesheet_uri sanitize_title_with_dashes
get_tag_template sanitize_user
get_taxonomy_template seems_utf8
get_template stripslashes_deep
get_template_directory trailingslashit
get_template_directory_uri untrailingslashit
get_theme_file_uri urlencode_deep
get_theme_file_path url_shorten
get_template_part utf8_uri_encode
get_theme (deprecated) wpautop
wp_get_themes wptexturize
get_theme_data (deprecated) wp_filter_kses
get_theme_support wp_filter_post_kses
get_theme_mod wp_filter_nohtml_kses
get_theme_mods wp_iso_descrambler
get_theme_root wp_kses
get_theme_roots wp_kses_array_lc
get_theme_root_uri wp_kses_attr
get_themes (deprecated) wp_kses_bad_protocol
has_header_image wp_kses_bad_protocol_once
header_image wp_kses_bad_protocol_once2
header_textcolor wp_kses_check_attr_val
in_the_loop wp_kses_decode_entities
is_child_theme wp_kses_hair
is_active_sidebar wp_kses_hook
is_admin_bar_showing wp_kses_html_error
is_customize_preview wp_kses_js_entities
is_dynamic_sidebar wp_kses_no_null
language_attributes wp_kses_normalize_entities
load_template wp_kses_normalize_entities2
locale_stylesheet wp_kses_post
locate_template wp_kses_split
post_class wp_kses_split2
preview_theme wp_kses_stripslashes
preview_theme_ob_filter wp_kses_version
preview_theme_ob_filter_callback wp_make_link_relative
register_nav_menu wp_normalize_path
register_nav_menus wp_rel_nofollow
get_registered_nav_menus wp_richedit_pre
wp_create_nav_menu wp_specialchars
register_sidebar wp_trim_words
register_sidebars zeroise
register_theme_directory
remove_theme_mod
remove_theme_mods
remove_theme_support
require_if_theme_supports
search_theme_directories
set_theme_mod
switch_theme
validate_current_theme
unregister_nav_menu
unregister_sidebar
wp_add_inline_style
wp_clean_themes_cache
wp_get_archives
wp_get_nav_menu_items
wp_get_theme
wp_nav_menu
wp_oembed_remove_provider
wp_page_menu
wp_title

Miscellaneous Functions Multisite functions


Time/Date Functions As of v3.0, WordPress includes WPMU functionality. Old WPMU functions
reference can be found at http://codex.wordpress.org/WPMU_Functions
current_time (deprecated page).
date_i18n
get_calendar Multisite administration Functions
get_date_from_gmt
get_lastpostdate confirm_delete_users
get_lastpostmodified is_user_member_of_blog
get_day_link wp_dashboard_quota
get_gmt_from_date
get_month_link These functions are found in file wp-admin/includes/ms.php (since 3.0.0).
the_date admin_notice_feed (deprecated)
get_the_date avoid_blog_page_permalink_collision
the_time check_import_new_users
get_the_time check_upload_size
the_modified_time choose_primary_blog
get_the_modified_time display_space_usage
get_weekstartend fix_import_form_size
get_year_link format_code_lang
human_time_diff get_site_allowed_themes (deprecated)
is_new_day grant_super_admin
iso8601_timezone_to_offset ms_deprecated_blogs_file (deprecated)
iso8601_to_datetime mu_dropdown_languages
mysql2date new_user_email_admin_notice
redirect_user_to_blog (deprecated)
Serialization refresh_user_details
revoke_super_admin
is_serialized secret_salt_warning
is_serialized_string send_confirmation_on_profile_email
maybe_serialize show_post_thumbnail_warning (deprecated)
maybe_unserialize site_admin_notice
sync_category_tag_slugs
Options update_option_new_admin_email
update_user_status
add_option upload_is_user_over_quote
add_site_option upload_space_setting
delete_option wpmu_delete_blog
delete_site_option wpmu_delete_user
form_option wpmu_get_blog_allowedthemes (deprecated)
get_alloptions (deprecated) _admin_notice_multisite_activate_plugins_page (deprecated)
get_site_option
get_site_url
get_admin_url Multisite Functions
get_user_option
get_option Site/blog functions that work with the blogs table and related data, found in
update_option file wp-includes/ms-blogs.php (since 3.0.0).
update_site_option
update_user_option add_blog_option
wp_load_alloptions delete_blog_option
get_blogaddress_by_domain
Transients get_blogaddress_by_id
get_blogaddress_by_name
set_transient() get_blog_details
get_transient() get_blog_option
delete_transient() get_blog_status
set_site_transient() get_id_from_blogname
get_site_transient() get_last_updated
delete_site_transient() is_archived
refresh_blog_details
Admin Menu Functions restore_current_blog
switch_to_blog
add_menu_page update_archived
remove_menu_page update_blog_details
add_submenu_page update_blog_option
remove_submenu_page update_blog_status
add_object_page wpmu_update_blogs_date
add_utility_page
add_comments_page Defines constants and global variables that can be overridden, generally in
add_dashboard_page wp-config.php, found in file wp-includes/ms-default-constants.php (since
add_links_page 3.0.0).
add_management_page
add_media_page ms_cookie_constants
add_options_page ms_file_constants
add_pages_page ms_subdomain_constants
add_plugins_page ms_upload_constants
add_posts_page
add_theme_page Multisite WordPress API, found in file wp-includes/ms-functions.php (since
add_users_page 3.0.0).

Toolbar Functions add_existing_user_to_blog


add_new_user_to_blog
add_node add_user_to_blog
remove_node check_upload_mimes
add_group create_empty_blog
get_node domain_exists
get_nodes filter_SSL
fix_phpmailer_messageid
Form Helpers force_ssl_content
get_active_blog_for_user
checked get_admin_users_for_domain
disabled get_blogs_of_user
selected get_blog_count
submit_button get_blog_id_from_url
get_submit_button get_blog_permalink
get_blog_post
get_current_site
Nonces and Referers (Security) get_dashboard_blog
get_dirsize
check_admin_referer get_most_recent_post_of_user
check_ajax_referer get_sitestats
wp_create_nonce get_space_allowed
wp_explain_nonce (deprecated) get_space_used
wp_get_original_referer get_upload_space_available
wp_get_referer get_user_count
wp_nonce_ays get_user_id_from_string (deprecated)
wp_nonce_field global_terms
wp_nonce_url insert_blog
wp_original_referer_field install_blog
wp_referer_field install_blog_defaults
wp_send_json is_blog_user (deprecated)
wp_send_json_error is_email_address_unsafe
wp_send_json_success is_upload_space_available
wp_verify_nonce is_user_option_local
is_user_spammy
XMLRPC maybe_add_existing_user_to_blog
maybe_redirect_404
xmlrpc_getpostcategory newblog_notify_siteadmin
xmlrpc_getposttitle newuser_notify_siteadmin
xmlrpc_removepostdata recurse_dirsize
user_pass_ok (deprecated) redirect_mu_dashboard (not a function??)
redirect_this_site
Localization remove_user_from_blog
signup_nonce_check
__ signup_nonce_fields
_x update_blog_public
_n update_posts_count
_nx upload_is_file_too_big
_e upload_is_user_over_quota
_ex upload_size_limit_filter
_ngettext (deprecated) users_can_register_signup_filter
esc_attr__ welcome_user_msg_filter
esc_attr_e wordpressmu_wp_mail_from (not a function??)
esc_html__ wp_get_sites
esc_html_e wpmu_activate_signup
get_locale wpmu_admin_redirect_add_updated_param (deprecated)
load_default_textdomain wpmu_create_blog
load_plugin_textdomain wpmu_create_user
load_muplugin_textdomain wpmu_log_new_registrations
load_textdomain wpmu_signup_blog
load_theme_textdomain wpmu_signup_blog_notification
is_rtl wpmu_signup_user
wpmu_signup_user_notification
Cron (Scheduling) wpmu_validate_blog_signup
wpmu_validate_user_signup
spawn_cron wpmu_welcome_notification
wp_clear_scheduled_hook wpmu_welcome_user_notification
wp_cron
wp_get_schedule These functions are needed to load Multisite, found in file wp-includes/ms-
wp_get_schedules load.php (since 3.0.0).
wp_next_scheduled
wp_reschedule_event get_current_site_name (deprecated)
wp_schedule_event is_subdomain_install
wp_schedule_single_event ms_not_installed
wp_unschedule_event ms_site_check
wpmu_current_site (deprecated)
Conditional Tags Index

comments_open
has_nav_menu
has_tag
in_category
is_404
is_admin
is_archive
is_attachment
is_author
is_category
is_comments_popup
is_customize_preview
is_date
is_day
is_feed
is_front_page
is_home
is_month
is_page
is_page_template
is_paged
is_preview
is_search
is_single
is_singular
is_sticky
is_tag
is_tax
is_time
is_trackback
is_year
pings_open

Script and Style Registration

wp_dequeue_script
wp_dequeue_style
wp_deregister_script
wp_deregister_style
wp_enqueue_script
wp_enqueue_style
wp_localize_script
wp_register_script
wp_register_style
wp_script_is
wp_style_is

sql

get_tax_sql
get_meta_sql
get_posts_by_author_sql

Miscellaneous

add_editor_style
add_query_arg
add_rewrite_rule
admin_url
bool_from_yn
cache_javascript_headers
capital_P_dangit
clean_blog_cache
content_url
do_robots
flush_rewrite_rules
get_bloginfo
get_num_queries
get_post_stati
get_post_statuses
get_query_var
home_url
includes_url
is_blog_installed
is_main_site
is_main_query
is_multisite
is_ssl
is_wp_error
log_app
make_url_footnote (deprecated)
network_admin_url
network_home_url
network_site_url
nocache_headers
plugin_dir_url
query_posts
remove_query_arg
rewind_posts
setup_postdata
site_url
status_header
unzip_file
validate_file
validate_file_to_edit
wp
wp_cache_set
wp_cache_get
wp_cache_reset (deprecated)
wp_check_filetype
wp_clearcookie (deprecated)
wp_die
wp_editor
wp_footer
wp_get_cookie_login (deprecated)
wp_get_image_editor
wp_get_installed_translations
wp_hash
wp_handle_sideload
wp_head
wp_install_defaults
wp_is_mobile
wp_mail
wp_mkdir_p
wp_new_user_notification
wp_password_change_notification
wp_notify_moderator
wp_notify_postauthor
wp_parse_args
wp_redirect
wp_reset_postdata
wp_reset_query
wp_salt
wp_safe_redirect
wp_set_auth_cookie
wp_strip_all_tags
wp_upload_bits
wp_upload_dir
wp_list_pluck
wp_text_diff
post_submit_meta_box
wp_max_upload_size

Official and Unofficial References


Trac Browser - WordPress source code. Choose 'Tags' to find a specific version source code, or 'Trunk' to see the latest version source code.
PHPXref for WordPress - Cross reference of WordPress files, functions, and variables, which seems to point to the latest released version.
WordPress Function History Table for 3.0 and prior - List each WordPress function with including the version it was introduced in or dropped in. PlanetOzh
recommends: "see related WordPress Functions Implementation History Tool for more information (and for a more usable tool) "
WordPress Variable Report - A list of WordPress functions, listing what version of PHP every function requires (and if there's a compatible function available),
what varables/arguments in functions are unused, and what functions/variables each class contains (and their default values).
WordPress Hooks Table - A list of WordPress actions and filters, cross-referenced to the files they are in

Categories:
Advanced Topics
Functions
WordPress Development

About Support
Blog Developers
Hosting Get Involved
Donate Learn

Showcase WordCamp
Plugins WordPress.TV
Themes BuddyPress
Ideas bbPress

WordPress.com Follow

Matt Like 1.1M


Privacy
License / GPLv2

You might also like