WordPress Functions are the tools to build an amazing WordPress Site.
You can find an official list by category in the Codex and a complete alphabetical list in the WordPress Code Reference.
The following list is my personal selection of the most useful and frequently used PHP WordPress functions. It is based on my daily WordPress Development experience. The list is updated with each new version of WordPress (if needed).
Some useful remarks:
- the meaning of the
get_
prefix – There are pairs of functions whose names differ only by the get_ prefix. The function withget_
simply returns some value, while the function withoutget_
displays the value. Example: the_title() – get_the_title() - the meaning of the
_e
suffix – There are pairs of functions whose names differ only in the ending_e
(echo). The function with the_e
suffix displays the value, while the other simply returns the value. Example: esc_html() – esc_html_e()
Content management
Template functions
- the_post()
- the_ID()
- get_the_ID()
- the_title()
- get_the_title()
- the_permalink()
- get_the_permalink()
- the_content()
- get_the_content()
- the_excerpt()
- get_the_excerpt()
- the_post_thumbnail()
- get_the_post_thumbnail()
- get_post_thumbnail_id()
- the_custom_logo()
- get_custom_logo()
- the_author()
- get_the_author()
- the_author_posts_link()
- get_the_author_posts_link()
- get_the_author_meta()
Conditional statements
- have_posts()
- have_comments()
- is_page()
- is_attachment()
- is_single()
- is_singular()
- is_main_query()
- is_admin()
- is_home()
- is_front_page()
- is_search()
- is_archive()
- has_post_thumbnail()
- has_nav_menu()
- has_custom_logo()
Formatting functions
Utility functions
Sanitization
Input
- sanitize_text_field()
- sanitize_textarea_field()
- sanitize_email()
- sanitize_title()
- view all Sanitization functions
Output
- wp_kses()
- wp_kses_post()
- esc_html()
- esc_html_e()
- esc_attr()
- esc_attr_e()
- esc_textarea()
- esc_url()
- view all Escaping functions
Manage users
Localization
Actions and Filters
- get_site_url()
- get_home_path()
- get_stylesheet_directory_uri()
- get_stylesheet_directory()
- get_template_directory_uri()
- get_template_directory()
- get_theme_file_uri()
- get_theme_file_path()
- plugin_dir_url()
- plugin_dir_path()
- admin_url()
- wp_enqueue_style()
- wp_enqueue_script()
- wp_register_style()
- wp_deregister_style()
- wp_register_script()
- wp_deregister_script()
WordPress REST API
General functions
- current_time()
- number_format_i18n()
- absint()
- wp_localize_script()
- get_avatar_url()
- wp_json_encode()
- wp_json_file_decode()
Entrepreneur | Full-stack developer | Founder of MediSign Ltd. I have over 15 years of professional experience designing and developing web applications. I am also very experienced in managing (web) projects.