WordPress.org

Codex

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

Function Reference 2.0.x


Note: This page applies to versions of WordPress prior to WordPress 2.1, and is also incomplete. The current WordPress function reference is at Function Reference.

EDITORS AND CONTRIBUTORS

The layout and structure of this page will follow Template Tags. Please create pages for these functions as subpages of this page. If you create a subpage for a function, please include information and examples of usage of that function, if possible, per the examples found in Template Tags.

For example: [[Function_Reference/wpdb_Class|wpdb_Class]].

WordPress defines many useful functions. Rather than reinventing the wheel, you should take advantage of the core functions whenever possible. Of course, if the slick new plugin you are designing needs a better wheel, you are on your own, but at least you can take inspiration from the following functions.

Please check out the wp-docs mailing list to find out how you can contribute to this section. And it needs your help!.

Functions by category

General Functions

functions.php:

  • profile
  • time/date
  • options
    • add_option
    • delete_option -- removes row of given option name from the options database table.
    • form_option -- does a get_settings on given string and returns info for an option. Before calling get_settings, the indata is passed through htmlspecialchars().
    • get_alloptions - no parameters
    • get_settings (alias: get_option)
    • update_option -- given option name and new value, it makes a safe update of given option's database row.
  • meta
  • trackpack/ping
  • xmlrpc
  • filters
  • actions
  • is_single,page,archive,time/data
  • themes/templates
  • htmlentities2
  • cookies
  • plugins
  • mail (pop) access

complete list

Formatting Functions

This list is incomplete, please contribute.

Post Functions

Comment Functions

Feed Functions

  • is_feed -- returns a Boolean, true if the current context is within a feed (wrapper for $WP_Query->is_feed)
  • fetch_rss -- retrieve an RSS feed from a URL with automatic caching (included in rss_functions.php)
  • wp_rss -- retrieve and display an RSS feed as an unordered list (included in rss_functions.php)
  • get_rss -- retrieve and display an RSS feed as a list (ordering optional) (included in rss_functions.php)

Link Functions

get_category_link

Administration Functions

  • insert_with_markers -- Writes a string (e.g. rewrite rules for the .htaccess file) to a given file namne between two markers, BEGIN and END.
  • Please Contribute more...

Classes

WordPress classes

External classes

User Functions

Functions by file

The functions are defined in several PHP files, nearly all residing in the wp-includes directory:

classes.php, class-IXR.php, class-pop3.php, class-snoopy.php, gettext.php, wp-db.php 
Classes.
comment-functions.php 
Comment functions.
feed-functions.php, rss-functions.php 
Feed functions.
functions-compat.php 
Compatibility functions for those running lower PHP versions.
functions-formatting.php 
Formatting functions.
functions.php 
Basic functions.
functions-post.php 
Post functions.
links.php 
Link functions.
pluggable-functions.php 
Pluggable functions (1.5.1+).
template-functions-*.php 
Template Tags.
registration-functions.php, wp-admin/admin-functions.php 
Administration functions.

DRAFT

The following functions are to be moved into their appropriate categories above.

  • add_action
  • add_filter
  • add_magic_quotes
  • add_post_meta
  • add_query_arg
  • apply_filters
  • auth_redirect
  • date_i18n
  • debug_fclose
  • debug_fopen
  • delete_post_meta
  • do_action
  • do_enclose
  • generic_ping
  • get_404_template
  • get_archive_template
  • get_approved_comments
  • get_author_template
  • get_category_template
  • get_catname
  • get_comments_popup_template
  • get_current_theme
  • get_date_template
  • get_home_template
  • get_lastpostdate
  • get_lastpostmodified
  • get_page_template
  • get_page_uri
  • get_paged_template
  • get_post_meta
  • get_postdata
  • get_posts
  • get_profile
  • get_query_template
  • get_query_var
  • get_search_template
  • get_single_template
  • get_stylesheet
  • get_stylesheet_directory
  • get_stylesheet_directory_uri
  • get_stylesheet_uri
  • get_template
  • get_template_directory
  • get_template_directory_uri
  • get_theme
  • get_theme_data
  • get_theme_root
  • get_theme_root_uri
  • get_themes
  • get_userdatabylogin
  • get_userid
  • get_weekstartend
  • gzip_compression
  • have_posts
  • htmlentities2
  • is_404
  • is_archive
  • is_author
  • is_category
  • is_comments_popup
  • is_date
  • is_day
  • is_home
  • is_month
  • is_new_day
  • is_page
  • is_paged
  • is_plugn_page
  • is_search
  • is_single
  • is_time
  • is_trackback
  • is_year
  • load_template
  • make_url_footnote
  • merge_filters
  • mysql2date
  • query_posts
  • remove_action
  • remove_filter
  • remove_query_arg
  • rewind_posts
  • setup_postdata
  • start_wp
  • the_post
  • timer_stop
  • trackback
  • update_category_cache
  • update_post_caches
  • update_post_meta
  • update_user_cache
  • url_to_postid
  • user_pass_ok
  • weblog_ping
  • wp_clearcookie
  • wp_head
  • wp_insert_post
  • wp_login
  • wp_mail
  • wp_setcookie
  • xmlrpc_getpostcategory
  • xmlrpc_getposttitle
  • xmlrpc_removepostdata