wordpress 常用函数参考手册

WordPress定义了许多有用的PHP函数。一些函数,称为模板标记,是指特别是用于WordPress的主题。还有一些函数相关的行动和过滤器(插件的API ) ,因而主要用于开发插件。其余的都是用来建立核心WordPress的功能。

许 多核心WordPress的功能是有用的插件和主题开发。因此,本文列出了大部分的核心函数,但不包括模板标记。在页面的底部,有一节列出其他资源的调查 了解WordPress的函数。

注:本参考适用于版本2.1和更高版本的WordPress的。

Post, Page, Attachment and Bookmarks Functions
Posts

  • get_children
  • get_extended
  • get_post
  • get_post_ancestors
  • get_post_mime_type
  • get_post_status
  • get_post_type
  • get_posts
  • is_post
  • is_single
  • is_sticky
  • wp_get_recent_posts
  • wp_get_single_post

Post insertion/removal

  • wp_delete_post
  • wp_insert_post
  • wp_publish_post
  • wp_update_post

Pages

  • get_all_page_ids
  • get_page
  • get_page_by_path
  • get_page_by_title
  • get_page_children
  • get_page_hierarchy
  • get_page_uri
  • get_pages
  • is_page
  • page_uri_index
  • wp_list_pages

Custom field (postmeta)

  • add_post_meta
  • delete_post_meta
  • get_post_custom
  • get_post_custom_keys
  • get_post_custom_values
  • get_post_meta
  • update_post_meta

Attachments

  • get_attached_file
  • is_attachment
  • is_local_attachment
  • update_attached_file
  • wp_attachment_is_image
  • wp_insert_attachment
  • wp_delete_attachment
  • wp_get_attachment_image
  • 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_mime_type_icon
  • wp_update_attachment_metadata

Bookmarks

  • get_bookmark
  • get_bookmarks
  • wp_list_bookmarks

Others

  • add_meta_box
  • get_the_ID
  • get_the_author
  • get_the_content
  • wp_get_post_categories
  • wp_set_post_categories
  • wp_trim_excerpt
Category, Tag and Taxonomy Functions
Categories

  • cat_is_ancestor_of
  • get_all_category_ids
  • get_cat_ID
  • get_cat_name
  • get_categories
  • get_category
  • get_category_by_path
  • get_category_by_slug
  • get_category_link
  • get_category_parents
  • get_the_category
  • in_category
  • is_category

Category Creation

  • wp_create_category
  • wp_insert_category

Tags

  • get_tag
  • get_tag_link
  • get_tags
  • get_the_tag_list
  • get_the_tags
  • is_tag

Taxonomy

  • get_term
  • get_the_term_list
  • get_term_by
  • get_term_children
  • get_terms
  • is_taxonomy
  • is_taxonomy_hierarchical
  • is_term
  • register_taxonomy
  • wp_get_object_terms
  • wp_insert_term
  • wp_update_term
User and Author Functions
Users and Authors

  • auth_redirect
  • email_exists
  • get_currentuserinfo
  • get_profile
  • get_userdata
  • get_userdatabylogin
  • get_usernumposts
  • set_current_user
  • user_pass_ok
  • username_exists
  • validate_username
  • wp_get_current_user
  • wp_set_current_user

User meta

  • delete_usermeta
  • get_usermeta
  • update_usermeta

User insertion/removal

  • wp_create_user
  • wp_delete_user
  • wp_insert_user
  • wp_update_user

Login / Logout

  • is_user_logged_in
  • wp_signon
Feed Functions
  • bloginfo_rss
  • comment_author_rss
  • comment_link
  • comment_text_rss
  • do_feed
  • do_feed_atom
  • do_feed_rdf
  • do_feed_rss
  • do_feed_rss2
  • fetch_rss
  • get_author_feed_link
  • get_bloginfo_rss
  • get_category_feed_link
  • get_comment_link
  • get_comment_author_rss
  • get_post_comments_feed_link
  • get_rss
  • get_search_comments_feed_link
  • get_search_feed_link
  • get_the_category_rss
  • get_the_title_rss
  • permalink_single_rss
  • post_comments_feed_link
  • rss_enclosure
  • the_title_rss
  • the_category_rss
  • the_content_rss
  • the_excerpt_rss
  • wp_rss
Comment, Ping, and Trackback Functions
  • add_ping
  • check_comment
  • discover_pingback_server_uri
  • do_all_pings
  • do_enclose
  • do_trackbacks
  • generic_ping
  • get_approved_comments
  • get_comment
  • get_comments
  • get_enclosed
  • get_lastcommentmodified
  • get_pung
  • get_to_ping
  • next_comments_link
  • paginate_comments_links
  • pingback
  • previous_comments_link
  • privacy_ping_filter
  • sanitize_comment_cookies
  • trackback
  • trackback_url_list
  • weblog_ping
  • wp_allow_comment
  • wp_delete_comment
  • wp_filter_comment
  • wp_get_comment_status
  • wp_get_current_commenter
  • wp_insert_comment
  • wp_new_comment
  • wp_set_comment_status
  • wp_throttle_comment_flood
  • wp_update_comment
  • wp_update_comment_count
Action, Filter, and Plugin Functions
Filters

  • add_filter
  • apply_filters
  • merge_filters
  • remove_filter

Actions

  • add_action
  • did_action
  • do_action
  • do_action_ref_array
  • remove_action

Plugins

  • plugin_basename
  • register_activation_hook
  • register_deactivation_hook
  • register_setting
  • settings_fields
  • unregister_setting

Shortcodes

  • add_shortcode
  • do_shortcode
  • get_shortcode_regex
  • do_shortcode_tag
  • remove_shortcode
  • remove_all_shortcodes
  • shortcode_atts
  • shortcode_parse_atts
  • strip_shortcodes
Theme-Related Functions
Include functions

  • comments_template
  • get_footer
  • get_header
  • get_sidebar
  • get_search_form

Other functions

  • add_custom_image_header
  • get_404_template
  • get_archive_template
  • get_attachment_template
  • get_author_template
  • get_category_template
  • get_comments_popup_template
  • get_current_theme
  • get_date_template
  • get_header_image
  • get_header_textcolor
  • get_home_template
  • get_locale_stylesheet_uri
  • get_page_template
  • get_paged_template
  • get_query_template
  • 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_mod
  • get_theme_root
  • get_theme_root_uri
  • get_themes
  • header_image
  • load_template
  • locale_stylesheet
  • preview_theme
  • preview_theme_ob_filter
  • preview_theme_ob_filter_callback
  • set_theme_mod
  • switch_theme
  • validate_current_theme
Formatting Functions
  • add_magic_quotes
  • addslashes_gpc
  • antispambot
  • attribute_escape
  • backslashit
  • balanceTags
  • clean_pre
  • clean_url
  • convert_chars
  • convert_smilies
  • ent2ncr
  • force_balance_tags
  • format_to_edit
  • format_to_post
  • funky_javascript_fix
  • htmlentities2
  • is_email
  • js_escape
  • make_clickable
  • popuplinks
  • remove_accents
  • sanitize_email
  • sanitize_file_name
  • sanitize_user
  • sanitize_title
  • sanitize_title_with_dashes
  • seems_utf8
  • stripslashes_deep
  • trailingslashit
  • untrailingslashit
  • utf8_uri_encode
  • wpautop
  • wptexturize
  • wp_filter_kses
  • wp_filter_post_kses
  • wp_filter_nohtml_kses
  • wp_iso_descrambler
  • wp_kses
  • wp_kses_array_lc
  • wp_kses_attr
  • wp_kses_bad_protocol
  • wp_kses_bad_protocol_once
  • wp_kses_bad_protocol_once2
  • wp_kses_check_attr_val
  • wp_kses_decode_entities
  • wp_kses_hair
  • wp_kses_hook
  • wp_kses_html_error
  • wp_kses_js_entities
  • wp_kses_no_null
  • wp_kses_normalize_entities
  • wp_kses_normalize_entities2
  • wp_kses_split
  • wp_kses_split2
  • wp_kses_stripslashes
  • wp_kses_version
  • wp_make_link_relative
  • wp_rel_nofollow
  • wp_richedit_pre
  • wp_specialchars
  • zeroise
Miscellaneous Functions
Time/Date Functions

  • current_time
  • date_i18n
  • get_calendar
  • get_date_from_gmt
  • get_lastpostdate
  • get_lastpostmodified
  • get_day_link
  • get_gmt_from_date
  • get_month_link
  • get_the_time
  • get_weekstartend
  • get_year_link
  • human_time_diff
  • is_new_day
  • iso8601_timezone_to_offset
  • iso8601_to_datetime
  • mysql2date

Serialization

  • is_serialized
  • is_serialized_string
  • maybe_serialize
  • maybe_unserialize

Options

  • add_option
  • delete_option
  • form_option
  • get_alloptions
  • get_user_option
  • get_option
  • update_option
  • update_user_option

XMLRPC

  • xmlrpc_getpostcategory
  • xmlrpc_getposttitle
  • xmlrpc_removepostdata
  • user_pass_ok

Localization

  • __
  • _e
  • _ngettext
  • get_locale
  • load_default_textdomain
  • load_plugin_textdomain
  • load_textdomain
  • load_theme_textdomain

Cron (Scheduling)

  • spawn_cron
  • wp_clear_scheduled_hook
  • wp_cron
  • wp_get_schedule
  • wp_get_schedules
  • wp_next_scheduled
  • wp_reschedule_event
  • wp_schedule_event
  • wp_schedule_single_event
  • wp_unschedule_event

Miscellaneous

  • add_query_arg
  • bool_from_yn
  • cache_javascript_headers
  • check_admin_referer
  • check_ajax_referer
  • do_robots
  • get_bloginfo
  • get_num_queries
  • is_blog_installed
  • make_url_footnote
  • nocache_headers
  • remove_query_arg
  • status_header
  • wp
  • wp_check_filetype
  • wp_clearcookie
  • wp_create_nonce
  • wp_die
  • wp_explain_nonce
  • wp_get_cookie_login
  • wp_get_http_headers
  • wp_get_original_referer
  • wp_get_referer
  • wp_hash
  • wp_mail
  • wp_mkdir_p
  • wp_new_user_notification
  • wp_nonce_ays
  • wp_nonce_field
  • wp_nonce_url
  • wp_notify_moderator
  • wp_notify_postauthor
  • wp_original_referer_field
  • wp_redirect
  • wp_referer_field
  • wp_remote_fopen
  • wp_salt
  • wp_setcookie
  • wp_upload_bits
  • wp_upload_dir
  • wp_verify_nonce

你可能感兴趣的:(discuz,wordpress,phpwind)