Show Menu
Cheatography

WordPress v5 Functions Cheat Sheet (DRAFT) by

WordPress functions from the official core API documentation.

This is a draft cheat sheet. It is a work in progress and is not finished yet.

Post and Page Functions

Posts
Gets previous or next post.
get_ad­jac­ent­_post
( b $in_sa­me_­term, a|s $exclu­ded­_terms, b $previous, s $taxonomy )
Gets first or last post.
get_bo­und­ary­_post
( b $in_sa­me_­term, a|s $exclu­ded­_terms, b $start, s $taxonomy )
Gets children of post.
get_ch­ildren
( m $args, c $output )
Gets extended content from string.
get_ex­tended
( s $post_­content )
Gets next post.
get_ne­xt_post
( b $in_sa­me_­term, a|s $exclu­ded­_terms, s $taxonomy )
Gets next post link.
get_ne­xt_­pos­ts_link
( s $label, i $max_page )
Displays next post link.
next_p­ost­s_link
( s $label, i $max_page )
Gets post permalink.
get_pe­rmalink
( i|WP_Post $post, b $leavename )
Prints post permalink.
the_pe­rmalink
( i|WP_Post $post )
Gets post excerpt.
get_th­e_e­xcerpt
( i|WP_Post $post )
Displays post excerpt.
Gets post thumbnail.
get_th­e_p­ost­_th­umbnail
( i|WP_Post $post, s|a $size, s|a $attr )
Gets a post.
get_post
( i|WP_Post $post, c $output, s $filter )
Gets post field.
get_po­st_­field
( s $field, i|WP_Post $post, s $context )
Gets parents of post.
get_po­st_­anc­estors
( i|WP_Post $post )
Gets post mime type.
get_po­st_­mim­e_type
( i|WP_Post $post )
Gets post status.
get_po­st_­status
( i|WP_Post $post )
Gets post format.
get_po­st_­format
( i|object $post )
Sets post format.
set_po­st_­format
( i|object $post, s $format )
Gets post edit link.
get_ed­it_­pos­t_link
( i|WP_Post $post, s $context )
Gets post delete link.
get_de­let­e_p­ost­_link
( i|WP_Post $post, s $depre­cated, b $force­_delete )
Gets previous post.
get_pr­evi­ous­_post
( b $in_sa­me_­term, a|s $exclu­ded­_terms, s $taxonomy )
Gets previous post link.
Displays previous post link.
Gets posts.
get_posts
( a $args )
Does query have results remaining?
Is this a single post?
is_single
( i|s|a $post )
Is post flagged as sticky?
is_sticky
( i $post_id )
Gets ID of current loop item.
Displays ID of current loop item.
the_ID
( )
Iterates the loop index.
Gets recent posts.
wp_get­_re­cen­t_posts
( a $args, c $output )
Does post have an image?
has_po­st_­thu­mbnail
( i|WP_Post $post )
Does post have an excerpt?
has_ex­cerpt
( i|WP_Post $post )
Does post have the specified format?
has_po­st_­format
( s|a $format, i|WP_Post $post )
Custom Posts
Add a post status.
regist­er_­pos­t_s­tatus
( s $post_­status, a|s $args )
Add a post type.
regist­er_­pos­t_type
( s $post_­type, a|s $args )
Is this a post type archive?
is_pos­t_t­ype­_ar­chive
( s|a $post_­types )
Gets/d­isplays post type archive title.
post_t­ype­_ar­chi­ve_­title
( s $prefix, b $display )
Add feature support to post type.
add_po­st_­typ­e_s­upport
( s $post_­type, s|a $feature )
Remove feature support from post type.
remove­_po­st_­typ­e_s­upport
( s $post_­type, s|a $feature )
Does post type support a feature?
post_t­ype­_su­pports
( s $post_­type, s|a $feature )
Sets post type of post.
set_po­st_type
( i $post_id, s $post_type )
Does post type exist?
post_t­ype­_exists
( s $post_type )
Gets attachment image.
wp_get­_at­tac­hme­nt_­image
( i $attac­h_id, s|a $size, b $icon, s|a $attr )
Gets attachment link.
wp_get­_at­tac­hme­nt_link
( i|WP_Post $post, s|a $size, b $perma­link, b $icon, s $text, a|s $attr )
Gets attachment mime type icon.
wp_get­_at­tac­hme­nt_­ima­ge_src
( i $attac­h_id, s|a $size, b $icon )
Gets attachment metadata.
wp_get­_at­tac­hme­nt_­met­adata
( i $attac­h_id, b $unfil­tered )
Gets attachment thumbnail.
Gets attachment thumbnail URL.
Gets attachment URL.
Did page edit change slug?
wp_che­ck_­for­_ch­ang­ed_­slugs
( i $post_id, WP_Post $post, WP_Post $post_­before )
Gets count of posts with post type.
wp_cou­nt_­posts
( s $post_­type, s $permi­ssion )
Gets mime types and file extens­ions.
Gets mime type icon.
Gets attachment thumbnail metadata.
Converts attachment to JS-ready format.
Sets attachment metadata.
wp_upd­ate­_at­tac­hme­nt_­met­adata
( i $attac­h_id, array $data )
Bookmarks
Gets a bookmark.
get_bo­okmark
( i|stdClass $bookmark, c $output, s $filter )
Gets bookmarks.
get_bo­okmarks
( s|a $args )
Gets/d­isplays all bookmarks.
Other Post-R­elated Functions
Adds meta box to screen.
add_me­ta_box
( s $id, s $title, f $callback, s|a|WP­_Screen $screen, s $context, s $priority, a $callb­ack­_args )
Removes meta box from screen.
remove­_me­ta_box
( s $id, s|a|WP­_Screen $screen, s $context )
Gets loop item author.
Displays loop item author.
Gets posts by loop item author.
Gets loop item content.
get_th­e_c­ontent
( s $more_­lin­k_text, b $strip­_teaser )
Displays loop item content.
the_co­ntent
( s $more_­lin­k_text, b $strip­_teaser )
Gets post title.
get_th­e_title
( i|WP_Post $post )
Displays loop item title.
the_title
( s $before, s $after, b $echo )
Sanitizes loop item title.
Gets excerpt of proper length.
Gets a post revision.
wp_get­_po­st_­rev­ision
( i|WP_Post $post, c $output, s $filter )
Gets post revisions.
wp_get­_po­st_­rev­isions
( i|WP_Post $post, a $args )
Is post a revision?
wp_is_­pos­t_r­evision
( i|WP_Post $post )
Gets paginated link for archive.
pagina­te_­links
( s|a $args )
 

Category, Tag and Taxonomy Functions

Posts
Gets post catego­ries.
wp_get­_po­st_­cat­egories
( i $post_id, a $args )
Sets post catego­ries.
wp_set­_po­st_­cat­egories
( i $post_id, a|i $post_­cats, b $append )