WordPress Most Common Functions


~ apply_filters()
Calls the callback functions that have been added to a filter hook.
apply_filters( string $tag, mixed $value )

~ esc_attr()
Escaping for HTML attributes.
esc_attr( string $text )

~ esc_url()
Checks and cleans a URL.
esc_url( string $url, array $protocols = null, string $_context = ‘display’ )

Escaping for HTML blocks.
esc_html( string $text )

~ get_option()
Retrieves an option value based on an option name.
get_option( string $option, mixed $default = false )

~ absint()
Convert a value to non-negative integer.
absint( mixed $maybeint )

~ get_template_part()
Loads a template part into a template.

get_template_part( string $slug, string $name = null )

~ is_singular()
Is the query for an existing single post of any post type (post, attachment, page, custom post types)? Determines whether the query is for an existing single post of any post type (post, attachment, page, custom post types).
is_singular( string|array $post_types = ” )

~ get_post_type()
Retrieves the post type of the current post or of a given post.
get_post_type( int|WP_Post|null $post = null )

~ get_the_ID()
Retrieve the ID of the current item in the WordPress Loop.

~ the_content()
Display the post content.
the_content( string $more_link_text = null, bool $strip_teaser = false )

~ have_posts()
Whether the current WordPress query has results to loop over.

~ post_class()
Display the classes for the post div.
post_class( string|array $class = ”, int|WP_Post $post_id = null )

~ get_comments_number()
Retrieves the amount of comments a post has.
get_comments_number( int|WP_Post $post_id )

~ the_ID()
Display the ID of the current item in the WordPress Loop.

~ is_single()
Is the query for an existing single post?

~ get_permalink()
Retrieves the full permalink for the current post or post ID.

~ get_the_title()
Retrieve post title.

~ admin_url()
Retrieves the URL to the admin area for the current site.

~ add_section()
Add a customize section.

~ is_home()
Determines if the query is for the blog homepage.

~ get_sidebar()
Load sidebar template.

~ get_footer()
Load footer template.

~ is_customize_preview()
Whether the site is being previewed in the Customizer.

~ wp_nav_menu()
Displays a navigation menu.

~ the_title()
Display or retrieve the current post title with optional markup.

~ current_user_can()
Whether the current user has a specific capability.

~ is_active_sidebar()
Whether a sidebar is in use.

~ wp_link_pages()
The formatted output of a list of pages.

~ get_the_time()
Retrieve the time at which the post was written.

~ get_the_date()
Retrieve the date on which the post was written.

~ the_permalink()
Displays the permalink for the current post.

~ the_post()
Iterate the post index in the loop.

~ esc_attr_e()
Display translated text that has been escaped for safe use in an attribute.

~ is_front_page()
Is the query for the front page of the site?

~ bloginfo()
Displays information about the current site.

~ comments_open()
Whether the current post is open for comments.

~ post_password_required()
Whether the post requires password and correct password has been provided.

~ has_post_thumbnail()
Check if the post has an image attached.

~ get_bloginfo()
Retrieves information about the current site.

~ get_post_format()
Retrieve the format slug for a post

~ dynamic_sidebar()
Display dynamic sidebar.

~ is_search()
Is the query for a search?

~ home_url()
Retrieves the URL for the current site where the front end is accessible

~ comments_template()
Load the comment template specified in $file.

~ have_comments()
Whether there are comments to loop over.

~ wp_list_comments()
List comments.

~ comment_form()
Outputs a complete commenting form for use within a template.

~ get_header()
Load header template.

~ wp_die()
Kill WordPress execution and display HTML message with error message.

~ wp_reset_postdata()
After looping through a separate query, this function restores the $post global to the current post in the main query.

~ load_theme_textdomain()
Load the theme’s translated strings.

~ add_image_size()
Register a new image size.

~ is_archive()
Is the query for an existing archive page?

~ wp_enqueue_style()
Enqueue a CSS stylesheet.

~ wp_enqueue_script()
Enqueue a script.

~ get_search_form()
Display search form.

~ get_post_thumbnail_id()
Retrieve post thumbnail ID.

~ the_post_thumbnail()
Display the post thumbnail.

~ get_search_query()
Retrieves the contents of the search WordPress query variable.

~ get_author_posts_url()
Retrieve the URL to the author page for the user with the ID provided.

~ wp_footer()
Fire the wp_footer action.

~ wp_head()
Fire the wp_head action.

~ add_theme_support()
Registers theme support for a given feature.

~ add_query_arg()
Retrieves a modified URL query string.

~ has_nav_menu()
Determines whether a registered nav menu location has a menu assigned to it.

~ is_wp_error()
Check whether variable is a WordPress Error.

~ get_the_author_meta()
Retrieves the requested data of the author of the current post.

~ edit_post_link()
Displays the edit post link for post.

~ is_admin()
Whether the current request is for an administrative interface page.

~ the_excerpt()
Display the post excerpt.

~ wp_get_attachment_image_src()
Retrieve an image to represent an attachment.

~ language_attributes()
Displays the language attributes for the HTML tag.

~ body_class()
Display the classes for the body element.

~ add_filter()
Hook a function or method to a specific filter action.

~ add_action()
Hooks a function on to a specific action.

~ get_the_post_thumbnail()
Retrieve the post thumbnail.

~ get_theme_file_uri()
Retrieves the URL of a file in the theme.

~ get_stylesheet_uri()
Retrieves the URI of current theme stylesheet.

~ is_page()
Is the query for an existing single page?

~ register_sidebar()
Builds the definition for a single sidebar and returns the ID.

~ get_the_category_list()
Retrieve category list for a post in either HTML list or custom format.

~ get_the_tag_list()
Retrieve the tags for a post formatted as a string.

~ get_theme_mod()
Retrieve theme modification value for the current theme. If the modification name does not exist, then the $default will be passed through sprintf() PHP function with the template directory URI as the first string and the stylesheet directory URI as the second string.

~ add_setting()
Add a customize setting.

Leave a comment

Your email address will not be published. Required fields are marked *