Function Reference

来自WordPress中文文档
跳转到: 导航, 搜索

wordpress.org.cn

目录

The files of WordPress define many useful PHP functions. Some of the functions, known as Template Tags, are defined especially for use in WordPress Themes. There are also some functions related to actions and filters (the Plugin API), which are therefore used primarily for developing Plugins. The rest are used to create the core WordPress functionality.

Many of the core WordPress functions are useful to Plugin and Theme developers. So, this article lists most of the core functions, excluding Template Tags. At the bottom of the page, there is a section listing other resources for finding information about WordPress functions. In addition to this information, the WordPress phpdoc site details all the WordPress functions by version since 2.6.1.

!-- remove the DIV below after there's enough example content -- div style=border:#CCCCCC 1px solid; padding:10px; background:#FAEBD7; You can help make this page more complete!

Here are some things you can do to help:

  • Add documentation to un-documented functions, by creating sub-pages or at least by adding short comments in the lists below. 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.
  • 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! /div

Functions by category

span style=color:#d7d7d7;Post, Page, Attachment and Bookmarks Functions/span

Posts


Post insertion/removal

Pages

Custom field (postmeta)

span id=AttachmentsAttachments/span

Bookmarks

Terms


Others

span style=color:#d7d7d7;Category, Tag and Taxonomy Functions/span

Categories


Category Creation

Tags

Taxonomy

span style=color:#d7d7d7;User and Author Functions/span

Users and Authors

User meta

User insertion/removal

Login / Logout

span style=color:#d7d7d7;Feed Functions/span

span style=color:#d7d7d7;Comment, Ping, and Trackback Functions/span

span style=color:#d7d7d7;Action, Filter, and Plugin Functions/span

Filters

Actions

Plugins

Shortcodes

span style=color:#d7d7d7;Theme-Related Functions/span

Include functions

Other functions

-- * tt_preview_theme_template_filter/tt --


span style=color:#d7d7d7;Formatting Functions/span

span style=color:#d7d7d7;Miscellaneous Functions/span

Time/Date Functions

Serialization

Options

XMLRPC

Localization

Cron (Scheduling)

Miscellaneous

span style=color:#d7d7d7;Geo tags/span

Geo features were moved to a plugin implementation with WordPress 1.5. Tags in parentheses are the plugin version.


span style=color:#d7d7d7;Classes/span

The following classes were created by WordPress developers, and are found in files ttcapabilities.php/tt, ttclasses.php/tt, ttclass-snoopy.php/tt, ttlocale.php/tt, ttquery.php/tt, ttrewrite.php/tt, ttscript-loader.php/tt, ttwp-db.php/tt:

  • WP - general request handling
  • ttWP_Ajax_Response/tt - AJAX handling
  • ttWP_Object_Cache/tt (formerly ttWP_Cache/tt) - Object cache (and functions ttwp_cache_add, wp_cache_close, wp_cache_delete, wp_cache_flush, wp_cache_get, wp_cache_init, wp_cache_replace, wp_cache_set/tt)
  • ttWP_Error/tt - error handling (and function ttis_wp_error/tt)
  • ttWP_Locale/tt - handles date and time locales
  • ttWP_Query/tt - Request parsing and manipulation, posts fetching (with functions ttget_query_var, query_posts, have_posts, in_the_loop, rewind_posts, the_post, wp_old_slug_redirect, setup_postdata/tt, as well as the Conditional Tags ttis_*/tt)
  • ttWP_Rewrite/tt - Rewrite rules (and functions ttadd_rewrite_rule, add_rewrite_tag, add_feed, add_rewrite_endpoint, url_to_postid/tt)
  • WP_Roles, WP_Role, WP_User - Users and capabilities - ttmap_meta_cap, current_user_can, get_role, add_role, remove_role/tt
  • ttWP_Scripts/tt - JavaScript loading (and functions ttwp_print_scripts, wp_register_script, wp_deregister_script wp_enqueue_script/tt)
  • ttWP_Styles/tt - CSS stylesheet loading (and functions tt wp_print_styles, wp_register_style, wp_deregister_style, wp_enqueue_style /tt)
  • Display tree-like data - ttWalker, Walker_Page, Walker_PageDropdown, Walker_Category, Walker_CategoryDropdown/tt
  • ttwpdb/tt - Database interface

The following classes were created by outside developers, and are found in files ttclass-IXR.php/tt, ttclass-pop3.php/tt, ttclass-snoopy.php/tt, ttgettext.php/tt, ttrss.php/tt, ttstreams.php/tt:

  • IXR - XML-RPC Classes, including ttIXR_Value, IXR_Message, IXR_Server, IXR_IntrospectionServer, IXR_Request, IXR_Client, IXR_ClientMulticall, IXR_Error, IXR_Date, IXR_Base64/tt
  • Snoopy - HTTP client
  • ttgettext_reader/tt (part of PHP-gettext) - Localization Class
  • RSS Classes (MagpieRSS and RSSCache) (and functions ttfetch_rss, is_info, is_success, is_redirect, is_error, is_client_error, is_server_error, parse_w3cdtf, wp_rss, get_rss/tt)
  • ttPOP3/tt: SquirrelMail wrapper
  • ttStreamReader, StringReader, FileReader, CachedFileReader/tt

Official and Unofficial References

  • WordPress.org PHPDoc - Nearly all the functions in WordPress have PHPDoc headers. This site shows all the PHPDoc.
  • Trac Browser - WordPress source code. Choose 'Tags' to find a specific version source code, or 'Trunk' to see the latest version source code.
  • 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

includeonlydiv style=clear:both; background-color:#FAEBD7; border:1px solid #CCCCCC; color:#000000; padding:7px; margin:0.5em auto 0.5em auto; vertical-align:middle;This page is marked as incomplete. You can help Codex by expanding it./div/includeonlynoinclude

Description

This Template is used by Codex:Template Messages.

Usage

pre 检查到模板循环:模板:Message /pre

Result

检查到模板循环:模板:Message

/noinclude

用户
名字空间
变换
操作
导航
WordPress
工具箱