Wordpress PHP Function Reference

Source: Internet
Author: User
WordPress defines many useful PHP functions. The well-known & nbsp; template tags in these functions are specially prepared for the WordPress topic. Some functions are also related to actions and filters (see & nbsp; plug-in API). These functions are also mainly used in plug-in development. Other functions are applied to the WordPress core.

WordPress defines many useful PHP functions. Which of these functions are well known? Template tags are specially prepared for WordPress themes. Some functions and actions and filters (see? Plug-In APIs), and these functions are mainly used in plug-in development. Other functions are applied to the core features of WordPress.

Many core functions are useful for plug-ins and theme developers. Therefore, this article lists most core functions, including Template Tags ). At the end of the article, I listed some WordPress function resources. The full version of this article? WordPress phpdoc site? All WordPress functions since 2.6.1 are described.

Note:: This reference applies to versions 2.1 and later. No function is recommended. Function Reference 2.0.x? Is an incomplete 2.0.x reference.

Function category
Articles, pages, attachments, bookmarks
Article

  • Get_adjacent_post: get the object of the adjacent article (previous or next)
  • Get_boundary_post: returns the latest or last article object based on the release date.
  • Get_children: obtains the attachments, subpages, and other information of the current article.
  • Get_extended: get the extended object information of the current article (for example )
  • Get_next_post: get the object of the next article
  • Get_next_posts_link: get the URL of the next article
  • Get_permalink: returns the URL of the current article.
  • The_permalink: displays the URL of the current article
  • Get_the_excerpt: returns the abstract of the current article.
  • The_excerpt: displays the summary of the current article
  • Get_the_post_thumbnail: returns the thumbnail of the current article.
  • Get_post: get the object of the current article
  • Get_post_ancestors
  • Get_post_mime_type
  • Get_post_status
  • Get_post_format
  • Get_edit_post_link: returns the editing link of the current article.
  • Get_delete_post_link: returns the delete link of the current article.
  • Get_previus_post: get the object of the previous article
  • Previus_posts_link: get the URL of the previous article
  • Get_posts
  • Is_post? (Obsolete)
  • Is_single
  • Is_sticky
  • The_ID: displays the ID of the current article
  • The_date: displays the publication date of the current article. if multiple articles are published on the same day, only one date is displayed.
  • Wp_get_recent_posts
  • Wp_get_single_post? (Obsolete)
  • Has_post_thumbnail: whether the current article contains thumbnails (a Boolean value is returned ).

Custom document type

  • Register_post_type
  • Is_post_type_archive
  • Post_type_archive_title
  • Add_post_type_support
  • Remove_post_type_support
  • Post_type_supports
  • Set_post_type
  • Post_type_exists
  • Get_post_type
  • Get_post_types
  • Get_post_type_archive_link
  • Get_post_type_object
  • Get_post_type_capabilities
  • Get_post_type_labels
  • Is_post_type_hierarchical

Insert/remove Article l

  • Wp_delete_post
  • Wp_insert_post
  • Wp_update_post
  • Wp_publish_post

Page

  • Get_all_page_ids
  • Get_ancestors
  • Get_page
  • 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

Custom Domain (Post meta)

  • Add_post_meta
  • Delete_post_meta
  • Update_post_meta
  • Get_post_meta
  • Get_post_custom
  • Get_post_custom_keys
  • Get_post_custom_values

Attachment

  • Get_attached_file
  • Image_resize? (Deprecated)
  • Image_edit_before_change? (Ported toWP_Image_Editor? Object)
  • Is_attachment
  • Is_local_attachment
  • 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 (links)

  • Wp_list_bookmarks
  • Get_bookmark
  • Get_bookmarks

Condition

  • Wp_get_post_categories
  • Wp_set_post_categories
  • Wp_get_post_tags
  • Wp_set_post_tags
  • Wp_get_post_terms
  • Wp_set_post_terms

Others

  • Wp_trim_excerpt
  • Add_meta_box
  • Wp_get_post_categories
  • Wp_set_post_categories
  • Get_the_ID
  • Get_the_content
  • Get_the_author
Classification, label, and classification
Category

  • Is_category
  • In_category
  • Cat_is_ancestor_of
  • Get_category_parents
  • Get_all_category_ids
  • Get_categories
  • Get_the_category
  • Get_category
  • Get_category_by_path
  • Get_category_by_slug
  • Get_cat_ID
  • Get_cat_name
  • Get_category_link

Create Category

  • Wp_create_category
  • Wp_insert_category

Tag

  • Is_tag
  • Get_tag
  • Get_tags
  • Get_the_tags
  • Get_the_tag_list
  • Get_tag_link

Classification (Taxonomy)

  • Is_taxonomy
  • Is_taxonomy_hierarchical
  • Register_taxonomy
  • Is_term
  • Get_term
  • Get_term_by
  • Get_term_children
  • Get_terms
  • Wp_get_object_terms
  • Wp_insert_term
  • Term_exists
User and author
User and author

  • Get_profile
  • Get_usernumposts
  • Set_current_user
  • Wp_set_current_user
  • Wp_get_current_user
  • Get_currentuserinfo
  • Get_userdata
  • Get_userdatabylogin
  • Auth_redirect
  • Username_exists
  • Email_exists
  • Validate_username
  • User_pass_ OK

User meta

  • Get_usermeta
  • Delete_usermeta
  • Update_usermeta

Add and delete users

  • Wp_insert_user
  • Wp_update_user
  • Wp_delete_user
  • Wp_create_user

Logon and logout

  • Wp_signon
  • Is_user_logged_in
Feed)
  • Fetch_rss
  • Wp_rss
  • Get_rss
  • Do_feed
  • Do_feed_rdf
  • Do_feed_rss
  • Do_feed_rss2
  • Do_feed_atom
  • Get_bloginfo_rss
  • Bloginfo_rss
  • Get_the_title_rss
  • The_title_rss
  • The_content_rss
  • The_excerpt_rss
  • Permalink_single_rss
  • Comment_link
  • Get_comment_link
  • Get_comment_author_rss
  • Comment_author_rss
  • Comment_text_rss
  • Post_comments_feed_link
  • Get_post_comments_feed_link
  • Get_author_feed_link
  • Get_category_feed_link
  • Get_the_category_rss
  • The_category_rss
  • Rss_enclosure
  • Get_search_feed_link
  • Get_search_comments_feed_link
Comments, notifications, and references (Ping, Trackback)
  • Paginate_comments_links
  • Previous_comments_link
  • Next_comments_link
  • Check_comment
  • Get_approved_comments
  • Get_comment
  • Get_comments
  • Get_lastcommentmodified
  • Sanitize_comment_cookies
  • Wp_allow_comment
  • Wp_delete_comment
  • Wp_get_comment_status
  • Wp_get_current_commenter
  • Wp_insert_comment
  • Wp_filter_comment
  • Wp_throttle_comment_flood
  • Wp_new_comment
  • Wp_set_comment_status
  • Wp_update_comment
  • Wp_update_comment_count
  • Discover_pingback_server_uri
  • Do_all_pings
  • Do_trackbacks
  • Generic_ping
  • Pingback
  • Privacy_ping_filter
  • Trackback
  • Weblog_ping
  • Do_enclose
  • Add_ping
  • Get_enclosed
  • Get_pung
  • Get_to_ping
  • Trackback_url_list
Action, Filter, and plug-in
Filters

  • Add_filter
  • Remove_filter
  • Apply_filters
  • Merge_filters

Actions

  • Add_action
  • Remove_action
  • Do_action
  • Did_action
  • Do_action_ref_array

Plugins

  • Plugin_basename
  • Register_activation_hook
  • Register_deactivation_hook
  • Register_setting
  • Unregister_setting
  • Settings_fields

Inclucodes

  • Add_postal code
  • Remove_shortcode
  • Remove_all_inclucodes
  • Do_shortcode
  • Get_javascode_regex
  • Do_shortcode_tag
  • Shortcode_parse_atts
  • Shortcode_atts
  • Strip_shortcodes
Topic-related
Include function

  • Get_header
  • Get_sidebar
  • Get_search_form
  • Comments_template
  • Get_footer

Other functions

  • Get_stylesheet
  • Get_stylesheet_directory
  • Get_stylesheet_directory_uri
  • Get_stylesheet_uri
  • Get_locale_stylesheet_uri
  • Get_template
  • Get_template_directory
  • Get_template_directory_uri
  • Get_theme_data
  • Get_themes
  • Get_theme
  • Get_theme_support
  • Get_current_theme
  • Get_theme_root
  • Get_theme_root_uri
  • Get_query_template
  • Get_404_template
  • Get_archive_template
  • Get_author_template
  • Get_category_template
  • Get_date_template
  • Get_home_template
  • Get_page_template
  • Get_paged_template
  • Get_search_template
  • Get_single_template
  • Get_attachment_template
  • Get_comments_popup_template
  • Load_template
  • Locale_stylesheet
  • Preview_theme
  • Preview_theme_ob_filter
  • Preview_theme_ob_filter_callback
  • Validate_current_theme
  • Switch_theme
  • Get_theme_mod
  • Set_theme_mod
  • Get_header_textcolor
  • Get_header_image
  • Header_image
  • Add_custom_image_header
Formatting)
  • Wptexturize
  • Clean_pre
  • Wpautop
  • Seems_utf8
  • Wp_specialchars
  • Utf8_uri_encode
  • Remove_accents
  • Sanitize_file_name
  • Sanitize_user
  • Sanitize_title
  • Sanitize_title_with_dashes
  • Convert_chars
  • Funky_javascript_fix
  • BalanceTags
  • Force_balance_tags
  • Format_to_edit
  • Format_to_post
  • Zeroise
  • Backslashit
  • Trailingslashit
  • Untrailingslashit
  • Addslashes_gpc
  • Stripslashes_deep
  • Antispambot
  • Make_clickable
  • Wp_rel_nofollow
  • Convert_smilies
  • Is_email
  • Wp_iso_descrambler
  • Popuplinks
  • Sanitize_email
  • Ent2ncr
  • Wp_richedit_pre
  • Clean_url
  • Htmlentities2
  • Js_escape
  • Attribute_escape
  • Wp_make_link_relative
  • Add_magic_quotes
  • Wp_kses
  • Wp_kses_hook
  • Wp_kses_version
  • Wp_kses_split
  • Wp_kses_split2
  • Wp_kses_attr
  • Wp_kses_hair
  • Wp_kses_check_attr_val
  • Wp_kses_bad_protocol
  • Wp_kses_no_null
  • Wp_kses_stripslashes
  • Wp_kses_array_lc
  • Wp_kses_js_entities
  • Wp_kses_html_error
  • Wp_kses_bad_protocol_once
  • Wp_kses_bad_protocol_once2
  • Wp_kses_normalize_entities
  • Wp_kses_normalize_entities2
  • Wp_kses_decode_entities
  • Wp_filter_kses
  • Wp_filter_post_kses
  • Wp_filter_nohtml_kses
Miscellaneous Functions
Time and date

  • Get_the_time
  • Get_day_link
  • Get_month_link
  • Get_year_link
  • Get_calendar
  • Get_gmt_from_date
  • Get_date_from_gmt
  • Iso8601_timezone_to_offset
  • Iso8601_to_datetime
  • Human_time_diff
  • Mysql2date
  • Current_time
  • Date_i18n
  • Get_weekstartend
  • Get_lastpostdate
  • Get_lastpostmodified
  • Is_new_day

Serialization

  • Maybe_serialize
  • Maybe_unserialize
  • Is_serialized
  • Is_serialized_string

Option

  • Get_option
  • Form_option
  • Get_alloptions
  • Update_option
  • Add_option
  • Delete_option
  • Get_user_option
  • Update_user_option

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.