The WordPress Codex The Codex is the encyclopedia of all things WordPress. It is the most comprehensive source of information for WordPress available. http://codex.wordpress.org/ http://codex.wordpress.org/es:Main_Page http://codex.wordpress.org/fr:Accueil http://www.microsoft.com/web/handlers/webpi.ashx?command=getimage&guid=f67accd3-8455-4830-b1d7-eef8959c0325 The WordPress Blog This is where you'll find the latest updates and news related to WordPress. Recent WordPress news appears in your administrative dashboard by default. http://wordpress.org/news/ http://www.microsoft.com/web/handlers/webpi.ashx?command=getimage&guid=f67accd3-8455-4830-b1d7-eef8959c0325 WordPress Support Forums If you've looked everywhere and still can't find an answer, the support forums are very active and have a large community ready to help. To help them help you be sure to use a descriptive thread title and describe your question in as much detail as possible. http://wordpress.org/support/ http://www.microsoft.com/web/handlers/webpi.ashx?command=getimage&guid=f67accd3-8455-4830-b1d7-eef8959c0325 First Steps with WordPress If you need help getting started, check out the documentation on first steps with WordPress. http://codex.wordpress.org/First_Steps_With_WordPress http://www.microsoft.com/web/handlers/webpi.ashx?command=getimage&guid=f67accd3-8455-4830-b1d7-eef8959c0325 WordPress Lessons A collection of tutorials for performing common WordPress tasks. http://codex.wordpress.org/WordPress_Lessons http://www.microsoft.com/web/handlers/webpi.ashx?command=getimage&guid=f67accd3-8455-4830-b1d7-eef8959c0325 /wp-admin/wp-admin http://www.microsoft.com/web/handlers/webpi.ashx?command=getimage&guid=f67accd3-8455-4830-b1d7-eef8959c0325 http://wordpress.org/ http://www.microsoft.com/web/handlers/webpi.ashx?command=getimage&guid=f67accd3-8455-4830-b1d7-eef8959c0325 wp-content wp-config.php * http://codex.wordpress.org/Function_Reference/{0} http://s.wordpress.org/about/images/wpmini-blue.png Retrieve adjacent post. Can either be next or previous post. get_adjacent_post( $in_same_cat, $excluded_categories, $previous ) get_adjacent_post Get the first or last post by publish date get_boundary_post( $in_same_cat, $excluded_categories, $start ); get_boundary_post Get extended entry info ( ). There should not be any space after the second dash and before the word 'more'. There can be text or space(s) after the word 'more', but won't be referenced. The returned array has 'main' and 'extended' keys. Main has the text before the . The 'extended' key has the content after the comment. get_extended( $post ) get_extended Retrieve next post that is adjacent to current post. get_next_post( $in_same_cat, $excluded_categories ) get_next_post Return a link to the set of posts of the current page. echo get_next_posts_link(); get_next_posts_link Returns the permalink to a post or page for use in PHP. It does NOT display the permalink and can be used outside of The Loop. On failure returns false. Note that when used outside The Loop on a posts page (index, archive, etc.) without the ID parameter, it will return the URL of the last post in The Loop, not the permalink for the current page. See: http://core.trac.wordpress.org/ticket/9963 get_permalink Returns the post excerpt for assignment to a variable. This tag must be within The Loop. If you only wish to print the excerpt you may prefer to use the_excerpt(). $excerpt = get_the_excerpt( $deprecated ) get_the_excerpt Gets Post Thumbnail as set in post's or page's edit screen and returns an HTML image element representing a Post Thumbnail, if there is any, otherwise an empty string. Note: To enable Post Thumbnails, the current theme must include add_theme_support( 'post-thumbnails' ); in its functions.php file. See also Post Thumbnails. $pages = get_pages(array('child_of' => 1)); get_the_post_thumbnail Takes a post ID and returns the database record for that post. You can specify, by means of the $output parameter, how you would like the results returned. get_post( $post_id, $output ); get_post Retrieve the parents of the post based on the post ID. get_post_ancestors( $post ) get_post_ancestors Retrieve the mime type of an attachment based on the ID. This function can be used with any Post Type, but it makes more sense with Attachments. get_post_mime_type( $ID ) get_post_mime_type Retrieve the post status based on the Post ID. If the post ID is of an attachment, then the parent post status will be given instead. get_post_status( $ID ) get_post_status Returns the post format of a post. This will usually be called in the the loop, but can be used anywhere if a post ID is provided. $format = get_post_format( $post_id ); get_post_format Returns URL to move a post to the trash as string value. Can be used within the WordPress loop or outside of it. Can be used with pages, posts, attachments, and revisions. get_delete_post_link Retrieve previous post that is adjacent to current post. get_previous_post( $in_same_cat, $excluded_categories ) get_previous_post Prints a link to the previous set of posts within the current query. If you need the values for use in PHP, use get_previous_posts_link(). Because post queries are usually sorted in reverse chronological order, next_posts_link() usually points to older entries (toward the end of the set) and previous_posts_link() usually points to newer entries (toward the beginning of the set). previous_posts_link(); previous_posts_link This Conditional Tag checks if any single post is being displayed. This is a boolean function, meaning it returns either TRUE or FALSE. is_single($post); is_single This Conditional Tag checks if "Stick this post to the front page" check box has been checked for the current post. This is a boolean function, meaning it returns either TRUE or FALSE. is_sticky($post_ID); is_sticky Displays the numeric ID of the current post. This tag must be within The Loop. Note: This function displays the ID of the post, to return the ID use get_the_ID(). the_ID Displays or returns the date of a post, or a set of posts if published on the same day. the_date('Y-m-d', '

', '

');
the_date
Retrieve the recent posts. wp_get_recent_posts( $args ) wp_get_recent_posts Retrieve a single post, based on post ID. wp_get_single_post( $postid, $mode ) wp_get_single_post Create or modify a post type. Do not use register_post_type before init. register_post_type( $post_type, $args ) register_post_type Is the query for a post type archive page? is_post_type_archive( $post_types ); is_post_type_archive Display or retrieve title for a post type archive. This is optimized for archive.php and archive-{posttype}.php template files for displaying the title of the post type. post_type_archive_title( $prefix, $display ); post_type_archive_title Register support of certain features for a given post type (s). All features are directly associated with a functional area of the edit screen, such as the editor or a meta box. Additionally, the 'revisions' feature dictates whether the post type will store revisions, and the 'comments' feature dictates whether the comments count will show on the edit screen. Typically add_post_type_support() should be attached to the 'init' action hook. add_post_type_support( $post_type, $supports ) add_post_type_support Remove support of certain features for a given post type (s). All features are directly associated with a functional area of the edit screen, such as the editor or a meta box. Additionally, the 'revisions' feature dictates whether the post type will store revisions, and the 'comments' feature dictates whether the comments count will show on the edit screen. Typically remove_post_type_support() should be attached to the 'init' action hook. remove_post_type_support( $post_type, $supports ) remove_post_type_support Checks a post type's support for a given feature. post_type_supports Updates the post type for the post ID. The page or post cache will be cleaned for the post ID. @uses $wpdb name a few. set_post_type( $post_id, $post_type ); set_post_type This Conditional Tag checks if a post type exists by passing a post type name an argument. This is a boolean function and uses a global $wp_post_types variable for checking the post type existence, meaning it returns either TRUE if the post type exists or FALSE if it doesn't exist. The post type must be a registered post type. post_type_exists( $post_type ); post_type_exists Retrieve the post type of the current post or of a given post. get_post_type( $post ) get_post_type Returns the registered post types as found in $wp_post_types. $post_types=get_post_types(); get_post_types Retrieve the permalink for a post type archive. get_post_type_archive_link( $post_type ); get_post_type_archive_link Retrieves an object which describes any registered post type (i.e. built-in types like 'post' and 'page', or any user-created custom post type). get_post_type_object($post_type); get_post_type_object Returns information about the post type capabilities of an post type object get_post_type_capabilities( $args ) get_post_type_capabilities Builds an object with all post type labels out of a post type object Accepted keys of the label array in the post type object: get_post_type_labels( $post_type_object ); get_post_type_labels This Conditional Tag checks if the post type is hierarchical. This is a boolean function, meaning it returns either TRUE or FALSE (A false return value might also mean that the post type does not exist). Checks to make sure that the post type exists first. Then gets the post type object, and finally returns the hierarchical value in the object. is_post_type_hierarchical( $post_type) is_post_type_hierarchical Removes a post, attachment, or page. When the post and page goes, everything that is tied to it is deleted also. This includes comments, post meta fields, and terms associated with the post. wp_delete_post This function inserts posts (and pages) in the database. It sanitizes variables, does some checks, fills in missing variables like date/time, etc. It takes an object as its argument and returns the post ID of the created post (or 0 if there is an error). wp_insert_post Publish a post by transitioning the post status. Note: This function does not do anything except transition the post status. If you want to ensure post_name is set, use wp_update_post() instead. wp_publish_post( $post_id ) wp_publish_post This function updates posts (and pages) in the database. To work as expected, it is necessary to pass the ID of the post to be updated. Note that when the post is "updated", the existing Post record is duplicated for audit/revision purposes. The primary record is then updated with the new values. Category associations, custom fields, post meta, and other related entries continue to be linked to the primary Post record. wp_update_post Get a list of page IDs. get_all_page_ids() get_all_page_ids Returns an array containing the parents of the given object. get_ancestors( 208, 'category' ); get_ancestors Retrieves page data given a page ID or page object. Pages provide a way to have static content that will not affect things like articles or archives or any other blog entry features of WordPress. Its simply a way to turn a blog entry into static content. get_page( $page_id ) get_page Retrieves the permalink for the current page (if in The Loop) or any arbitrary page ID if passed as the first argument. All arguments are optional. All arguments default to false. If $id is passed, it will be the id of the page whose link is returned. $leavename can be used to toggle off the switching out of "%pagename%" in permalinks. $sample returns a sample permalink. get_page_link($id, $leavename, $sample); get_page_link Retrieves a page given its path. get_page_by_path( $page_path, $output, $post_type ) get_page_by_path Retrieves a post given its title. If more that one post uses the same title, the post with the smallest ID will be returned. Because this function uses the MySQL '=' comparison the $page_title will usually be matched as case insensitive with default collating. $page = get_page_by_title( 'About' ); wp_list_pages( 'exclude=' . $page->ID ); get_page_by_title Retrieve child pages from list of pages matching page ID. Matches against the pages parameter against the page ID. Also matches all children for the same to retrieve all children of a page. Does not make any SQL queries to get the children. &get_page_children( $page_id, $pages ) get_page_children Builds URI for a page. Sub pages will be in the "directory" under the parent page post name. get_page_uri( $page_id ) get_page_uri This function is used to get a list of all the pages that are defined in the blog. Essentially get_pages gives you an array of the pages, and that array is not tree-like. See the wp_list_pages() Template Tag for the output of page titles in a tree-like fashion. Note that, although similar to get_posts, several of the parameter names and values differ. $mypages = get_pages( array( 'child_of' => $post->ID, 'sort_column' => 'post_date', 'sort_order' => 'desc' ) ); get_pages This Conditional Tag checks if Pages are being displayed. This is a boolean function, meaning it returns either TRUE or FALSE. This tag must be used BEFORE The Loop and does not work inside The Loop (see Notes below). is_page($page); is_page Retrieve all pages and attachments for pages URIs. The attachments are for those that have pages as parents and will be retrieved. page_uri_index() page_uri_index Displays page-links for paginated posts (i.e. includes the Quicktag one or more times). This works in much the same way as link_pages() (deprecated), the difference being that arguments are given in query string format. This tag must be within The_Loop. wp_link_pages(); wp_link_pages add_post_meta adds a custom (meta) field to the specified post, page or any other post type. If the $unique parameter is set to true and the specified meta key already exists, the function returns false and makes no changes; otherwise, it returns true. add_post_meta(68, 'my_key', 47); add_post_meta This function deletes all custom fields with the specified key, or key and value, from the specified post. See also update_post_meta(), get_post_meta() and add_post_meta(). delete_post_meta(76, 'my_key', 'Steve'); delete_post_meta Returns a multidimensional array with all custom fields of a particular post or page. See also get_post_custom_keys() and get_post_custom_values() $custom_fields = get_post_custom(); get_post_custom Returns an array containing the keys of all custom fields of a particular post or page. See also get_post_custom() and get_post_custom_values() $custom_field_keys = get_post_custom_keys(); get_post_custom_keys This function is useful if you wish to access a custom field that is not unique, i.e. has more than 1 value associated with it. Otherwise, you might wish to look at get_post_meta(). Returns an array containing all the values of the custom fields with a particular key ($key) of a post with ID $post_id (defaults to the current post if unspecified). Returns nothing if no such key exists, or none is entered. See also get_post_custom() and get_post_custom_keys(). $mykey_values = get_post_custom_values('my_key'); get_post_custom_values This function returns the values of the custom fields with the specified key from the specified post. To return all of the custom fields, see get_post_custom(). See also update_post_meta(), delete_post_meta() and add_post_meta(). $key_1_values = get_post_meta(76, 'key_1'); get_post_meta The function, update_post_meta(), updates the value of an existing meta key (custom field) for the specified post. This may be used in place of add_post_meta() function. The first thing this function will do is make sure that $meta_key already exists on $post_id. If it does not, add_post_meta($post_id, $meta_key, $meta_value) is called instead and its result is returned. Returns true on success and false on failure. Please note that if your db collation is case insensitive (has with suffix _ci) then update_post_meta and delete_post_meta and get_posts will update/delete/query the meta records with keys that are upper or lower case. However get_post_meta will apparently be case sensitive due to wordpress caching. See https://core.trac.wordpress.org/ticket/18210 for more info. update_post_meta(76, 'my_key', 'Steve'); update_post_meta Retrieve attached file path based on attachment ID. You can optionally send it through the 'get_attached_file' filter, but by default it will just return the file path unfiltered. The function works by getting the single post meta name, named '_wp_attached_file' and returning it. This is a convenience function to prevent looking up the meta name and provide a mechanism for sending the attached file name through a filter. get_attached_file( $attachment_id, $unfiltered ); get_attached_file This Conditional Tag checks if an attachment is being displayed. An attachment is an image or other file uploaded through the post editor's upload utility. Attachments can be displayed on their own 'page' or template. For more information, see Using Image and File Attachments. This is a boolean function, meaning it returns either TRUE or FALSE. is_attachment(); is_attachment Check if the attachment URI is local one and is really an attachment. is_local_attachment( $url ) is_local_attachment Update attachment file path based on attachment ID. Used to update the file path of the attachment, which uses post meta name '_wp_attached_file' to store the path of the attachment. Note: This does not move the file. This simply updates the '_wp_attached_file' post meta after a move. update_attached_file( $attachment_id, $file ) update_attached_file This function determines if a post's attachment is an image. It returns TRUE if the attachment is an image, FALSE if not. The accepted file extensions/mime types are: .jpg, .jpeg, .gif, .png. $id = 37; if ( wp_attachment_is_image( $id ) ) { echo "Post ".$id." is an image!"; } else { echo "Post ".$id." is not an image."; } wp_attachment_is_image This function inserts an attachment into the media library. The function should be used in conjunction with wp_update_attachment_metadata() and wp_generate_attachment_metadata(). Returns the ID of the entry created in the wp_posts table. $attach_id = wp_insert_attachment( $attachment, $filename, 37 ); wp_insert_attachment This function deletes an attachment wp_delete_attachment( 76 ); wp_delete_attachment Returns an HTML image element representing an attachment file, if there is any, otherwise an empty string. wp_get_attachment_image( $attachment_id, $size, $icon, $attr ); wp_get_attachment_image Returns an HTML hyperlink to an attachment file or page, containing either wp_get_attachment_link( $id, $size, $permalink, $icon, $text ); wp_get_attachment_link Returns an array with the image attributes "url", "width" and "height", of an image attachment file. Note: For just the image src, use the first element in the returned array. $attachment_id = 8; // attachment ID $image_attributes = wp_get_attachment_image_src( $attachment_id ); // returns an array wp_get_attachment_image_src Retrieve attachment meta field for attachment ID. wp_get_attachment_metadata( $post_id, $unfiltered ); wp_get_attachment_metadata Retrieve thumbnail for an attachment. wp_get_attachment_thumb_file( $post_id ); wp_get_attachment_thumb_file Retrieve URL for an attachment thumbnail. wp_get_attachment_thumb_url( $post_id ); wp_get_attachment_thumb_url Returns a full URI for an attachment file or false on failure. wp_get_attachment_url( $id ); wp_get_attachment_url Checked for changed slugs for published posts and save old slug. The function is used along with form POST data. It checks for the wp-old-slug POST field. Will only be concerned with published posts and the slug actually changing. If the slug was changed and not already part of the old slugs then it will be added to the post meta field ('_wp_old_slug') for storing old slugs for that post. The most logically usage of this function is redirecting changed posts, so that those that linked to an changed post will be redirected to the new post. wp_check_for_changed_slugs( $post_id ); wp_check_for_changed_slugs This function was introduced in WordPress Version 2.5, and outputs the number for each post status of a post type. You can also use wp_count_posts() as a template_tag with the second parameter and include the private post status. By default, or if the user isn't logged in or is a guest of your site, then private post status post count will not be included. This function will return an object with the post statuses as the properties. You should check for the property using isset() PHP function, if you are wanting the value for the private post status. Not all post statuses will be part of the object. $count_posts = wp_count_posts(); wp_count_posts Retrieve the icon for a MIME type. wp_mime_type_icon( $mime ) wp_mime_type_icon This function generates metadata for an image attachment. It also creates a thumbnail and other intermediate sizes of the image attachment based on the sizes defined on the Settings_Media_Screen. $attach_id = wp_insert_attachment( $attachment, $filename, 37 ); $attach_data = wp_generate_attachment_metadata( $attach_id, $filename ); wp_update_attachment_metadata( $attach_id, $attach_data ); wp_generate_attachment_metadata Update metadata for an attachment. wp_update_attachment_metadata( $post_id, $data ); wp_update_attachment_metadata Retrieve Bookmark data based on bookmark link ID. get_bookmark( $bookmark, $output, $filter ) get_bookmark This function returns an array of bookmarks found in the Administration > Links > Edit panel. This Template Tag allows the user to retrieve the bookmark information directly. get_bookmarks Retrieve the list of categories for a post. Compatibility layer for themes and plugins. Also an easy layer of abstraction away from the complexity of the taxonomy layer. wp_get_post_categories( $post_id, $args ) wp_get_post_categories Retrieve the list of tags for a post. wp_get_post_tags( $post_id, $args ) wp_get_post_tags Set tags for a post. Every tag that does not already exists will be automatically created. Uses wp_set_post_terms(). wp_set_post_tags( $post_ID, $tags, $append ) wp_set_post_tags Retrieve the terms for a post. There is only one default for this function, called 'fields' and by default is set to 'all'. Other values can be 'names' or 'ids'. There are other defaults that can be overridden in wp_get_object_terms(). $terms = wp_get_post_terms( $post_id, $taxonomy, $args ) wp_get_post_terms Set terms for a post. Uses wp_set_object_terms(). wp_set_post_terms( $post_ID, $terms, $taxonomy, $append ) wp_set_post_terms The add_meta_box() function was introduced in Version 2.5. It allows plugin developers to add sections to the Write Post, Write Page, and Write Link editing pages. add_meta_box( 'myplugin_sectionid', __( 'My Post Section Title', 'myplugin_textdomain' ), 'myplugin_inner_custom_box', 'post'); add_meta_box The remove_meta_box() function was introduced in WordPress 2.6. It allows plugin developers to remove sections from the Write Post, Write Page, and Write Link editing pages. remove_meta_box( 'postcustom' , 'post' , 'normal' ); remove_meta_box Returns the numeric ID of the current post. This tag must be within The Loop. $id = get_the_ID(); get_the_ID Retrieve the post author. This tag must be used within The Loop. To display a page for authors which have no posts, see this discussion. get_the_author Retrieve the post content. (Must be used in a Loop) get_the_content( $more_link_text, $stripteaser, $more_file ) get_the_content This function will return the title of a post for a given post id. If the post is protected or private, the word "Protected: " or "Private: " prepended to the title. get_the_title Generates an excerpt from the content, if needed. The excerpt word amount will be 55 words and if the amount is greater than that, then the string ' [...]' will be appended to the excerpt. If the string is less than 55 words, then the content will be returned as is. wp_trim_excerpt( $text ) wp_trim_excerpt This Conditional Tag Check if a category is an ancestor of another category. This is a boolean function, meaning it returns either TRUE or FALSE. if (cat_is_ancestor_of(4, $cat) or is_category(4)) { // if the category is music or a music SUBcategory, cat_is_ancestor_of Retrieves all category IDs. get_all_category_ids() get_all_category_ids Retrieve the ID of a category from its name. get_cat_ID( $cat_name ) get_cat_ID Retrieve the name of a category from its ID. get_cat_name( $cat_id ) get_cat_name Returns an array of category objects matching the query parameters. Arguments are pretty much the same as wp_list_categories and can be passed as either array or in query syntax. $args = array( 'type' => 'post', 'child_of' => 0, 'parent' => '', 'orderby' => 'name', 'order' => 'ASC', 'hide_empty' => 1, 'hierarchical' => 1, 'exclude' => '', 'include' => '', 'number' => '', 'taxonomy' => 'category', 'pad_counts' => false ); get_categories Retrieves category data given a category ID or category object. If you pass the $category parameter an object, which is assumed to be the category row object retrieved the database. It will cache the category data. If you pass $category an integer of the category ID, then that category will be retrieved from the database, if it isn't already cached, and pass it back. If you look at get_term(), then both types will be passed through several filters and finally sanitized based on the $filter parameter value. The category will converted to maintain backwards compatibility. Note: use get_term() to get Link Categories based on their ID's. get_category only returns Post Categories. get_category( $category, $output, $filter ) get_category Retrieve category based on URL containing the category slug. Breaks the $category_path parameter up to get the category slug. Tries to find the child path and will return it. If it doesn't find a match, then it will return the first category matching slug, if $full_match, is set to false. If it does not, then it will return null. It is also possible that it will return a WP_Error object on failure. Check for it when using this function. get_category_by_path( $category_path, $full_match, $output ) get_category_by_path Retrieve category object by category slug. Returns false if not found. get_category_by_slug( $slug ) get_category_by_slug Retrieve category name based on category ID. get_the_category_by_ID( $cat_ID ); get_the_category_by_ID Returns the correct url for a given Category ID. get_category_link( $category_id ); get_category_link Returns a list of the parents of a category, including the category, in hierarchical order. echo get_category_parents($cat, TRUE, ' » '); get_category_parents Returns an array of objects, one object for each category assigned to the post. This tag may be used outside The Loop by passing a post id as the parameter. This function only returns results from the default "category" taxonomy. For custom taxonomies use get_the_terms. get_the_category( $id ) get_the_category Displays or returns the category title for the current page. For pages displaying WordPress tags rather than categories (e.g. "/tag/geek") the name of the tag is displayed instead of the category. Can be used only outside The Loop. $current_category = single_cat_title("", false); single_cat_title Tests if the current post (or any specified post) is assigned to any of the specified categories. in_category() considers only the categories a post is directly assigned to (the checked categories in Write/Edit Post panel), not the parents of the assigned categories (but see Testing if a post is in a descendant category below). This tag can be used to test the current post within The Loop or (since Version 2.7) outside the Loop during a single post request. You can use it anywhere if you specify which post you want to test. in_category( $category, $_post ) in_category Displays a link to the category or categories a post belongs to. This tag must be used within The Loop. the_category This function adds a "simple" category by specifying a category name and (optionally) a category parent. wp_create_category( $cat_name, $parent ); wp_create_category Deletes one existing category. wp_delete_category( $cat_ID ) wp_delete_category Inserts a new category into the taxonomy system. wp_insert_category( $catarr, $wp_error ); wp_insert_category Retrieve post tag by tag ID or tag object. If you pass the $tag parameter an object, which is assumed to be the tag row object retrieved the database. It will cache the tag data. If you pass $tag an integer of the tag ID, then that tag will be retrieved from the database, if it isn't already cached, and pass it back. If you look at get_term(), then both types will be passed through several filters and finally sanitized based on the $filter parameter value. &get_tag( $tag, $output, $filter ) get_tag Returns the correct link url for a given Tag ID. get_tag_link Retrieve an array of objects for each term in post_tag taxonomy. get_tags Generates a HTML string of the tags associated with the current post. The name of each tag will be linked to the relevant 'tag' page. You can tell the function to put a string before and after all the tags, and in between each tag. Differently from get_the_category_list, this tag must be used inside The Loop. echo get_the_tag_list('

Tags: ',', ','

');
get_the_tag_list
Returns an array of objects, one object for each tag assigned to the post. This tag must be used within The Loop. $posttags = get_the_tags(); if ($posttags) { foreach($posttags as $tag) { echo $tag->name . ' '; } } get_the_tags This Conditional Tag checks if a Tag archive page is being displayed. This is a boolean function, meaning it returns either TRUE or FALSE. is_tag( $slug ); is_tag This template tag displays a link to the tag or tags a post belongs to. If no tags are associated with the current entry, nothing is displayed. This tag should be used within The Loop. the_tags('Social tagging: ',' > '); the_tags Get a list of registered taxonomy objects. $taxonomies=get_taxonomies(); get_taxonomies Get all Term data from database by Term ID. To retrieve term data by name, slug or ID, use get_term_by() instead The usage of the get_term function is to apply filters to a term object. It is possible to get a term object from the database before applying the filters. $term ID must be part of $taxonomy, to get from the database. Failure, might be able to be captured by the hooks. Failure would be the same value as $wpdb returns for the get_row method. There are two hooks, one is specifically for each term, named 'get_term', and the second is for the taxonomy name, 'term_$taxonomy'. Both hooks gets the term object, and the taxonomy name as parameters. Both hooks are expected to return a Term object. 'get_term' hook - Takes two parameters the term Object and the taxonomy name. Must return term object. Used in get_term() as a catch-all filter for every $term. 'get_$taxonomy' hook - Takes two parameters the term Object and the taxonomy name. Must return term object. $taxonomy will be the taxonomy name, so for example, if 'category', it would be 'get_category' as the filter name. Useful for custom taxonomies or plugging into default taxonomies. get_term( $term, $taxonomy, $output, $filter ) get_term Returns an HTML string of taxonomy terms associated with a post and given taxonomy. Terms are linked to their respective term listing pages. get_the_term_list Get all Term data from database by Term field and data. Warning: $value is not escaped for 'name' $field. You must do it yourself, if required. The default $field is 'id', therefore it is possible to also use null for field, but not recommended that you do so. If $value does not exist, the return value will be false. If $taxonomy exists and $field and $value combinations exist, the Term will be returned. get_term_by( $field, $value, $taxonomy, $output, $filter ) get_term_by Displays the terms of a custom taxonomies. the_terms( $post->ID, 'category', 'categories: ', ' / ', '' ); the_terms Retrieve the terms of the taxonomy that are attached to the post. $terms = get_the_terms( $post->ID, 'on-draught' ); if ( $terms && ! is_wp_error( $terms ) ) : $draught_links = array(); foreach ( $terms as $term ) { $draught_links[] = $term->name; } $on_draught = join( ", ", $draught_links ); get_the_terms Merge all term children into a single array. This recursive function will merge all of the children of $term into the same array. Only useful for taxonomies which are hierarchical. Will return an empty array if $term does not exist in $taxonomy. get_term_children( $term, $taxonomy ) get_term_children Returns permalink for a taxonomy term archive. get_term_link( $term, $taxonomy ); get_term_link Retrieve the terms in taxonomy or list of taxonomies. get_terms( $taxonomies, $args ) get_terms This function is deprecated as of Version 3.0. Please use taxonomy_exists instead. This Conditional Tag checks if the taxonomy name exists by passing a taxonomy name as an argument to it. This is a boolean function uses a global $wp_taxonomies variable for checking if taxonomy name existence, meaning it returns either TRUE if the taxonomy name exist or FALSE if it doesn't exist. is_taxonomy($taxonomy); is_taxonomy This Conditional Tag checks if the taxonomy object is hierarchical. This is a boolean function uses a global, meaning it returns either TRUE or FALSE (A false return value might also mean that the taxonomy does not exist). checks to make sure that the taxonomy is an object first. Then gets the object, and finally returns the hierarchical value in the object. is_taxonomy_hierarchical( $taxonomy ) is_taxonomy_hierarchical Check if Term exists. Returns the index of a defined term, or 0 (false) if the term doesn't exist. is_term( $term, $taxonomy ) is_term This Conditional Tag checks if the taxonomy name exists by passing a taxonomy name as an argument to it. This is a boolean function uses a global $wp_taxonomies variable for checking if taxonomy name existence, meaning it returns either TRUE if the taxonomy name exist or FALSE if it doesn't exist. taxonomy_exists($taxonomy); taxonomy_exists Check if a given term exists and return the term ID, a term object, or 0 (false) if the term doesn't exist. term_exists( $term, $taxonomy, $parent ) term_exists This function adds or overwrites a taxonomy. It takes in a name, an object name that it affects, and an array of parameters. It does not return anything. Care should be used in selecting a taxonomy name so that it does not conflict with other taxonomies, post types, and reserved WordPress public and private query variables. A complete list of those is described in the Reserved Terms section. In particular, capital letters should be avoided (This was allowed in 3.0, but not enforced until 3.1 with the "Cheatin'" error). //hook into the init action and call create_book_taxonomies when it fires add_action( 'init', 'create_book_taxonomies', 0 ); //create two taxonomies, genres and writers for the post type "book" function create_book_taxonomies() { // Add new taxonomy, make it hierarchical (like categories) $labels = array( 'name' => _x( 'Genres', 'taxonomy general name' ), 'singular_name' => _x( 'Genre', 'taxonomy singular name' ), 'search_items' => __( 'Search Genres' ), 'all_items' => __( 'All Genres' ), 'parent_item' => __( 'Parent Genre' ), 'parent_item_colon' => __( 'Parent Genre:' ), 'edit_item' => __( 'Edit Genre' ), 'update_item' => __( 'Update Genre' ), 'add_new_item' => __( 'Add New Genre' ), 'new_item_name' => __( 'New Genre Name' ), 'menu_name' => __( 'Genre' ), ); register_taxonomy('genre',array('book'), array( 'hierarchical' => true, 'labels' => $labels, 'show_ui' => true, 'query_var' => true, 'rewrite' => array( 'slug' => 'genre' ), )); // Add new taxonomy, NOT hierarchical (like tags) $labels = array( 'name' => _x( 'Writers', 'taxonomy general name' ), 'singular_name' => _x( 'Writer', 'taxonomy singular name' ), 'search_items' => __( 'Search Writers' ), 'popular_items' => __( 'Popular Writers' ), 'all_items' => __( 'All Writers' ), 'parent_item' => null, 'parent_item_colon' => null, 'edit_item' => __( 'Edit Writer' ), 'update_item' => __( 'Update Writer' ), 'add_new_item' => __( 'Add New Writer' ), 'new_item_name' => __( 'New Writer Name' ), 'separate_items_with_commas' => __( 'Separate writers with commas' ), 'add_or_remove_items' => __( 'Add or remove writers' ), 'choose_from_most_used' => __( 'Choose from the most used writers' ), 'menu_name' => __( 'Writers' ), ); register_taxonomy('writer','book',array( 'hierarchical' => false, 'labels' => $labels, 'show_ui' => true, 'update_count_callback' => '_update_post_term_count', 'query_var' => true, 'rewrite' => array( 'slug' => 'writer' ), )); } register_taxonomy This function adds an already registered taxonomy to an (custom) object type. It takes in a name, an object name that it affects. It returns true on success. register_taxonomy_for_object_type('category', 'foo'); register_taxonomy_for_object_type Retrieves the terms associated with the given object(s), in the supplied taxonomies. wp_get_object_terms( $object_ids, $taxonomies, $args ) wp_get_object_terms Relates an object (post, link etc) to a term and taxonomy type (tag, category, etc). Creates the term and taxonomy relationship if it doesn't already exist. A relationship means that the term is grouped in or belongs to the taxonomy. A term has no meaning until it is given context by defining which taxonomy it exists under. $cat_ids = array( 6,8 ); //to make sure the terms IDs is integers: //$cat_ids = array_map('intval', $cat_ids); //$cat_ids = array_unique( $cat_ids ); wp_set_object_terms( '42', $cat_ids, 'category' ); wp_set_object_terms Adds a new term to the database. Optionally marks it as an alias of an existing term. Error handling is assigned for the nonexistance of the $taxonomy and $term parameters before inserting. If both the term id and taxonomy exist previously, then an array will be returned that contains the term id and the contents of what is returned. The keys of the array are 'term_id' and 'term_taxonomy_id' containing numeric values. It is assumed that the term does not yet exist or the above will apply. The term will be first added to the term table and then related to the taxonomy if everything is well. If everything is correct, then several actions will be run prior to a filter and then several actions will be run after the filter is run. The arguments decide how the term is handled based on the $args parameter. The following is a list of the available overrides and the defaults. wp_insert_term( $term, $taxonomy, $args = array() ); wp_insert_term Update term based on arguments provided. wp_update_term( $term_id, $taxonomy, $args ) wp_update_term Removes a term from the database. wp_delete_term( $term_id, $taxonomy, $args ) wp_delete_term Taxonomy independent version of wp_category_checklist wp_terms_checklist( $post_id, $args ); wp_terms_checklist Adds a capability to a role. add_cap Adds a new Role to WordPress. add_role Whether author of supplied post has capability or role. author_can Whether the current user has a certain capability or role. See: Roles and Capabilities. It will only return true if a logged in user's role or capability matches the queried role or capability. In some circumstances, the global current user is not yet defined. If you experience problems with this, try declaring the global $current_user and using user_can($current_user->ID, $capability) - this seems to work more consistently. current_user_can Whether current user has a capability or role for a given blog. current_user_can_for_blog Fetch a Role definition. get_role Retrieve a list of super admins. Uses $super_admins Super admins global variable, if set. $super_admins = get_super_admins(); echo 'List of super-admin users:
    '; foreach ($super_admins as $admin) { echo '
  • ' . $admin . '
  • '; } echo '
';
get_super_admins
Determine if user is a network (super) admin. is_super_admin Map meta capabilities to primitive capabilities. This does not actually compare whether the user ID has the actual capability, just what the capability or capabilities are. Meta capability list value can be 'delete_user', 'edit_user', 'remove_user', 'promote_user', 'delete_post', 'delete_page', 'edit_post', 'edit_page', 'read_post', or 'read_page'. map_meta_cap Removes a capability from a role. remove_cap Removes a user role. remove_role( 'subscriber' ); remove_role Whether a user has capability or role. Similar to current_user_can(), but this function takes a user ID or object as its first parameter. user_can auth_redirect() is a simple function that requires that the user be logged in before they can access a page. auth_redirect() auth_redirect Returns the count of users having each role, as well as the count of all users. $result = count_users(); echo 'There are ', $result['total_users'], ' total users'; foreach($result['avail_roles'] as $role => $count) echo ', ', $count, ' are ', $role, 's'; echo '.'; count_users Returns the post count for the user whose ID is passed to it. echo 'Posts made: ' . count_user_posts(1); count_user_posts Returns the post counts for a list of user IDs. This is an O(n) operation, so it is preferred over count_user_posts() any time more than a single count is needed. $users = array(1, 3, 9, 10); $counts = count_many_users_posts($users); echo 'Posts made by user 3: ' . $counts[3]; count_many_users_posts This function will check whether or not a given email address ($email) has already been registered to a username, and returns that users ID (or false if none exists). See also username_exists. Note: To execute this function you will need to add this line of code: require_once(ABSPATH . WPINC . '/registration.php'); in order to define the function. if ( email_exists($email) ) { . . . } email_exists Retrieves the information pertaining to the currently logged in user, and places it in the global variable $current_user. Properties map directly to the wp_users table in the database (see Database Description). Also places the individual attributes into the following separate global variables: get_currentuserinfo(); get_currentuserinfo Returns the ID of the current user. get_current_user_id Retrieve user data based on field. Use get_profile() will make a database query to get the value of the table column. The value might be cached using the query cache, but care should be taken when using the function to not make a lot of queries for retrieving user profile information. If the $user parameter is not used, then the user will be retrieved from a cookie of the user. Therefore, if the cookie does not exist, then no value might be returned. Sanity checking must be done to ensure that when using get_profile() that (empty|null|false) values are handled and that something is at least displayed. get_profile( $field, $user ); get_profile Get user data by field and data. get_user_by($field, $value) get_user_by Returns a WP_User object with the information pertaining to the user whose ID is passed to it. Properties map directly to wp_users and wp_usermeta tables in the database (see Database Description). If the user does not exist, the function returns false. An alias of get_user_by('id'). $user_info = get_userdata(1); echo 'Username: ' . $user_info->user_login . "\n"; echo 'User level: ' . $user_info->user_level . "\n"; echo 'User ID: ' . $user_info->ID . "\n"; get_userdata Returns the post count for the user whose ID is passed to it. Properties map directly to the wp_posts table in the database (see Database Description). echo 'Posts made: ' . get_usernumposts(1); get_usernumposts Retrieves an array of users matching the criteria given in $args. get_users This function can be replaced via plugins. If plugins do not redefine these functions, then this will be used instead. Changes the current user by ID or name. Set $id to null and specify a name if you do not know a user's ID. set_current_user( $id, $name ) set_current_user Check that the user login name and password is correct. user_pass_ok( $user_login, $user_pass ) user_pass_ok Returns the user ID if the user exists or null if the user doesn't exist. Note: To execute this function you will need to add this line of code: require_once(ABSPATH . WPINC . '/registration.php'); in order to define the function. username_exists( $username ); username_exists Checks whether username is valid. validate_username( $username ) validate_username Retrieve the current user object (WP_User). Wrapper of get_currentuserinfo() using the global variable $current_user. wp_get_current_user(); wp_get_current_user This function can be replaced via plugins. If plugins do not redefine these functions, then this will be used instead. Changes the current user by ID or name. Set $id to null and specify a name if you do not know a user's ID. Some WordPress functionality is based on the current user and not based on the signed in user. wp_set_current_user() opens the ability to edit and perform actions on users who aren't signed in. wp_set_current_user( $id, $name ); wp_set_current_user Gets the URL of the author page for the author with a given ID. get_author_posts_url( $author_id, $author_nicename ); get_author_posts_url Add metadata to a user's record. add_user_meta( $user_id, $meta_key, $meta_value, $unique ) add_user_meta Remove metadata matching criteria from a user. You can match based on the key, or key and value. Removing based on key and value, will keep from removing duplicate metadata with the same key. It also allows removing all metadata matching key, if needed. delete_user_meta( $user_id, $meta_key, $meta_value ) delete_user_meta Retrieve user meta field for a user, using get_metadata(). This function replaces the deprecated get_usermeta() function. get_user_meta($user_id, $key, $single); get_user_meta Update user meta field based on user ID. Use the $prev_value parameter to differentiate between meta fields with the same key and user ID. If the meta field for the user does not exist, it will be added. update_user_meta( $user_id, $meta_key, $meta_value, $prev_value ) update_user_meta This function returns the desired meta data for a user. If used within The Loop, the user ID need not be specified, and the displayed data is that of the current post author. A user ID must be specified if used outside The Loop. get_the_author_meta() returns the data for use in PHP. To display the information instead, use the_author_meta() If the specified meta field does not exist for this user, is returned. $user_email = get_the_author_meta('user_email'); get_the_author_meta The wp_create_user function allows you to insert a new user into the WordPress database. It uses the $wpdb class to escape the variable values, preparing it for insertion into the database. Then the PHP compact() function is used to create an array with these values. To create a user with additional parameters, use wp_insert_user(). wp_create_user Remove user and optionally reassign posts and links to another user. If the $reassign parameter is not assigned to a User ID, then all posts will be deleted of that user. The action 'delete_user' that is passed the User ID being deleted will be run after the posts are either reassigned or deleted. The user meta will also be deleted that are for that User ID. wp_delete_user( $id, $reassign ); wp_delete_user Insert a user into the database. Can update a current user or insert a new user based on whether the user's ID is present. Can be used to update the user's info (see below), set the user's role, and set the user's preference on the use of the rich editor. Note: As late as 2.7.1, if you are attempting to update the password for the user, this function will not hash the password, thus failing. Use the wp_update_user instead. wp_insert_user( $userdata ) wp_insert_user Update a user in the database. It is possible to update a user's password by specifying the 'user_pass' value in the $userdata parameter array. If $userdata does not contain an 'ID' key, then a new user will be created and the new user's ID will be returned. If current user's password is being updated, then the cookies will be cleared. Note: Use the wp_insert_user function to create a new user. wp_update_user( $userdata ) wp_update_user This Conditional Tag checks if the current visitor is logged in. This is a boolean function, meaning it returns either TRUE or FALSE. is_user_logged_in Provides a simple login form for use anywhere within WordPress. By default, it echoes the HTML immediately. Pass array('echo' => false) to return the string instead. wp_login_form(); wp_login_form Authenticates a user with option to remember credentials. Replaces deprecated function wp_login. wp_signon Log the current user out, by destroying the current user session. wp_logout Display RSS container for the bloginfo function. You can retrieve anything that you can using the get_bloginfo() function. Everything will be stripped of tags and characters converted, when the values are retrieved for use in the feeds. bloginfo_rss( $show ) bloginfo_rss Display the current comment author in the feed. comment_author_rss() comment_author_rss Display the full, anchored URL to a single comment. This function must be used within the comments loop. If you want to link to all of the comments for an entry, use the function comments_link() instead. comment_link() comment_link Display the current comment content for use in the feeds. comment_text_rss() comment_text_rss Loads the feed template from the use of an action hook. If the feed action does not have a hook, then the function will die with a message telling the visitor that the feed is not valid. It is better to only have one hook for each feed. do_feed() do_feed Load either Atom comment feed or Atom posts feed. do_feed_atom( $for_comments ) do_feed_atom Load the RDF RSS 0.91 Feed template. do_feed_rdf() do_feed_rdf Load the RDF RSS 1.0 Feed template. do_feed_rss() do_feed_rss Load either the RSS2 comment feed or the RSS2 posts feed. do_feed_rss2( $for_comments ) do_feed_rss2 Retrieves an external feed and parses it. Uses the SimplePie and FeedCache functionality for retrieval and parsing and automatic caching. $feed = fetch_feed( $uri ); fetch_feed Retrieves an RSS feed and parses it. Uses the MagpieRSS and RSSCache functions for parsing and automatic caching and the Snoopy HTTP client for the actual retrieval. Deprecated note: Switch to using fetch_feed instead. fetch_rss Retrieve the feed link for a given author. Returns a link to the feed for all posts by a given author. A specific feed can be requested or left blank to get the default feed. get_author_feed_link( $author_id, $feed ) get_author_feed_link RSS container for the bloginfo function. You can retrieve anything that you can using the get_bloginfo() function. Everything will be stripped of tags and characters converted, when the values are retrieved for use in the feeds. get_bloginfo_rss( $show ) get_bloginfo_rss This function returns a link to the feed for all posts in the specified category. A particular feed can be requested, but if the feed parameter is left blank, it returns the 'rss2' feed link. get_category_feed_link('2', ''); get_category_feed_link Retrieve the link to a given comment. get_comment_link( $comment, $args ) get_comment_link Retrieve the current comment author for use in the feeds. get_comment_author_rss() get_comment_author_rss Retrieve the permalink for the post comments feed. get_post_comments_feed_link( $post_id, $feed ) get_post_comments_feed_link Retrieves an RSS feed and parses it, then displays it as a list of links. The get_rss() function only outputs the list items, not the surrounding list tags itself. Uses the MagpieRSS and RSSCache functions for parsing and automatic caching and the Snoopy HTTP client for the actual retrieval. Deprecated note: Switch to using fetch_feed instead. require_once(ABSPATH . WPINC . '/rss-functions.php'); get_rss($uri, $num = 5); get_rss Retrieve the permalink for the comments feed of the search results. get_search_comments_feed_link( $search_query, $feed ) get_search_comments_feed_link Retrieve the permalink for the feed of the search results. echo get_search_feed_link( $search_query, $feed ) get_search_feed_link Retrieve all of the post categories, formatted for use in feeds. All of the categories for the current post in the feed loop, will be retrieved and have feed markup added, so that they can easily be added to the RSS2, Atom, or RSS1 and RSS0.91 RDF feeds. get_the_category_rss( $type ); get_the_category_rss Retrieve the current post title for the feed. get_the_title_rss() get_the_title_rss Prints out the comment feed link for a post. Link text is placed in the anchor. If no link text is specified, default text is used. If no post ID is specified, the current post is used. post_comments_feed_link Display the rss enclosure for the current post. Uses the global $post to check whether the post requires a password and if the user has the password for the post. If not then it will return before displaying. Also uses the function get_post_custom() to get the post's 'enclosure' metadata field and parses the value to display the enclosure(s). The enclosure(s) consist of enclosure HTML tag(s) with a URI and other attributes. rss_enclosure() rss_enclosure Display the post title in the feed. the_title_rss() the_title_rss Display the post categories in the feed. the_category_rss( $type ) the_category_rss Display the post content for the feed. For encoding the html or the $encode_html parameter, there are three possible values. '0' will make urls footnotes and use make_url_footnote(). '1' will encode special characters and automatically display all of the content. The value of '2' will strip all HTML tags from the content. Also note that you cannot set the amount of words and not set the html encoding. If that is the case, then the html encoding will default to 2, which will strip all HTML tags. To restrict the amount of words of the content, you can use the cut parameter. If the content is less than the amount, then there won't be any dots added to the end. If there is content left over, then dots will be added and the rest of the content will be removed. the_content_rss( $more_link_text, $stripteaser, $more_file, $cut, $encode_html ) the_content_rss Display the post excerpt for the feed. the_excerpt_rss() the_excerpt_rss Retrieves an RSS feed and parses it, then displays it as an unordered list of links. Uses the MagpieRSS and RSSCache functions for parsing and automatic caching and the Snoopy HTTP client for the actual retrieval. Deprecated note: Switch to using fetch_feed instead. include_once(ABSPATH . WPINC . '/rss.php'); wp_rss($uri, $num); wp_rss Add a URL to those already pung. add_ping( $post_id, $uri ) add_ping Add meta data field to a comment. add_comment_meta( $comment_id, $meta_key, $meta_value, $unique ); add_comment_meta check_comment() checks whether a comment passes internal checks set by WordPress Comment_Moderation. check_comment( $author, $email, $url, $comment, $user_ip, $user_agent, $comment_type ) check_comment Displays the text of a comment. Use get_comment_text to retrieve the value. comment_text This tag outputs a complete commenting form for use within a template. Most strings and form fields may be controlled through the $args array passed into the function, while you may also choose to use the comment_form_default_fields filter to modify the array of default fields if you'd just like to add a new one or remove a single field. All fields are also individually passed through a filter of the form comment_form_field_$name where $name is the key used in the array of fields. Please note, that although most parameters are marked as optional, not including them all in your code will produce errors when using define('WP_DEBUG', true); comment_form( $args, $post_id ); comment_form Displays the total number of comments, Trackbacks, and Pingbacks for the current post. This tag must be within The Loop. Use get_comments_number() to retrieve the value. comments_number Finds a pingback server URI based on the given URL. Checks the xhtml for the rel="pingback" link and x-pingback headers. It does a check for the x-pingback headers first and returns that, if available. The check for the rel="pingback" has more overhead than just the header. discover_pingback_server_uri( $url, $deprecated ) discover_pingback_server_uri delete_comment_meta() allows you to delete any meta values stored against comments, which have been set using add_comment_meta(). Similar method to delete_post_meta(). delete_comment_meta Perform all pingbacks, enclosures, trackbacks, and send to pingback services. do_all_pings() do_all_pings Check content for video and audio links to add as enclosures. Will not add enclosures that have already been added. do_enclose( $content, $post_ID ) do_enclose Perform trackbacks. do_trackbacks( $post_id ) do_trackbacks Sends pings to all of the ping site services. generic_ping( $post_id ) generic_ping Takes post ID and returns an array of objects that represent comments that have been submitted and approved. $comment_array = get_approved_comments($post_id); get_approved_comments Retrieve the avatar for a user who provided a user ID or email address. Most commonly used in the comments section. This function is pluggable, however plugin authors wishing to change the gravatar output should use the get_avatar filter instead, for compatibility purposes. echo get_avatar( $comment, 32 ); get_avatar Takes a comment ID and returns the database record for that post. You can specify, by means of the $output parameter, how you would like the results returned. get_comment( $id, $output ); get_comment Retrieve the text of the current comment. Use comment_text to display the comment text. get_comment_text( $comment_ID ) get_comment_text get_comment_meta() allows you to pull any meta values stored against comments, which have been set using add_comment_meta(). Similar method to get_post_meta(). Useful within the comments.php template when displaying comments against a post. get_comment_meta Retrieve a list of comments. get_comments( $args ); get_comments Displays all comments for a post or Page based on a variety of parameters including ones set in the administration area. See also: Migrating Plugins and Themes to 2.7 wp_list_comments Retrieve enclosures already enclosed for a post. get_enclosed( $post_id ) get_enclosed The date the last comment was modified. If $cache_lastcommentmodified is set this function returns its value from the cache without hitting the database. get_lastcommentmodified( $timezone ) get_lastcommentmodified Retrieve URLs already pinged for a post. get_pung( $post_id ) get_pung Retrieve URLs that need to be pinged. get_to_ping( $post_id ) get_to_ping Determines whether there are any Comments to loop over or not. $have_comments = have_comments(); have_comments is_trackback(); is_trackback Pings back the links found in a post. Includes wp-include/class-IXR.php file if not already included. pingback( $content, $post_ID ) pingback Check whether blog is public before returning sites. privacy_ping_filter( $sites ) privacy_ping_filter Sanitizes the cookies sent to the user already. Will only do anything if the cookies have already been created for the user. Mostly used after cookies had been sent to use elsewhere. sanitize_comment_cookies() sanitize_comment_cookies Send a trackback. Updates database when sending trackback to prevent duplicates. trackback( $trackback_url, $title, $excerpt, $ID ) trackback Displays or returns the trackback URL for the current post. This tag must be within The Loop. A trackback URL is where somebody posts a link to their site on your site. In return, they have posted a link to your site on their site and have copied an article you have written. trackback_url Do trackbacks for a list of URLs. trackback_url_list( $tb_list, $post_id ) trackback_url_list The function update_comment_meta() updates the value of an existing comment meta key for the specified comment. This may be used in place of the add_comment_meta() function. The first thing this function will do is make sure that $meta_key already exists on $comment_id. If it does not it will be added. Returns true on success and false on failure. update_comment_meta( 3416, 'my_key', 'Brad' ); update_comment_meta Send a pingback. weblog_ping( $server, $path ) weblog_ping Validates whether this comment is allowed to be made or not. wp_allow_comment( $commentdata ) wp_allow_comment Retrieve a total comment count for a site or post. $comments_count = wp_count_comments(); wp_count_comments Trashes or deletes a comment. The comment is moved to trash instead of permanently deleted unless trash is disabled, item is already in the trash, or $force_delete is true. The post comment count will be updated if the comment was approved and has a post ID available. wp_delete_comment( $comment_id ) wp_delete_comment Filters and sanitizes comment data. Sets the comment data 'filtered' field to true when finished. This can be checked as to whether the comment should be filtered and to keep from filtering the same comment more than once. wp_filter_comment( $commentdata ) wp_filter_comment The status of a comment by ID. wp_get_comment_status( $comment_id ) wp_get_comment_status Get current commenter's name, email, and URL. Expects cookies content to already be sanitized. User of this function might wish to recheck the returned array for validity. wp_get_current_commenter() wp_get_current_commenter Inserts a comment to the database. The available $commentdata key names are 'comment_author_IP', 'comment_date', 'comment_date_gmt', 'comment_parent', 'comment_approved', and 'user_id'. wp_insert_comment($data); wp_insert_comment Adds a new comment to the database. Filters new comment to ensure that the fields are sanitized and valid before inserting comment into database. Calls 'comment_post' action with comment ID and whether comment is approved by WordPress. Also has 'preprocess_comment' filter for processing the comment data before the function handles it. wp_new_comment( $commentdata ) wp_new_comment Sets the status of a comment. The 'wp_set_comment_status' action is called after the comment is handled and will only be called, if the comment status is either 'hold', 'approve', or 'spam'. If the comment status is not in the list, then false is returned and if the status is 'delete', then the comment is deleted without calling the action. wp_set_comment_status( $comment_id, $comment_status ) wp_set_comment_status Determine whether comment should be blocked because of comment flood. wp_throttle_comment_flood( $block, $time_lastcomment, $time_newcomment ) wp_throttle_comment_flood Updates an existing comment in the database. Filters the comment and makes sure certain fields are valid before updating. wp_update_comment( $commentarr ) wp_update_comment Updates the comment count for post(s). When $do_deferred is false (is by default) and the comments have been set to be deferred, $post_id will be added to a queue, which will be updated at a later date and only updated once per post ID. If the comments have not be set up to be deferred, then the post will be updated. When $do_deferred is set to true, then all previous deferred post IDs will be updated along with the current $post_id. wp_update_comment_count( $post_id, $do_deferred ) wp_update_comment_count Displays the numeric ID of the current comment. This tag must be within The Loop, or a comment loop. Use get_comment_ID to retrieve the value. comment_ID Displays the comment author name; that is, the one supplied by the commenter. If no name is provided (and "User must fill out name and email" is not enabled under Discussion Options), WordPress will assign "Anonymous" as comment author. Use get_comment_author to retrieve the value. comment_author Displays the date a comment was posted. Use get_comment_date to retrieve the value. comment_date Displays the time a comment was posted. This tag must be within The Loop, or a comment loop. Use get_comment_time to retrieve the value. comment_time Create pagination links for the comments on the current post. Basically this is a macro to paginate_links() which sets the functional options of paginate_links() to make it work for comments. But you may use all the parameters of paginate_links() to style the output of paginate_comments_links(). paginate_comments_links( $args ) paginate_comments_links Display the previous comments page link. previous_comments_link( $label ) previous_comments_link Display link to next comments pages. next_comments_link( $label, $max_page ) next_comments_link Check if any filter has been registered for a hook. has_filter Hooks a function to a specific filter action. Filters are the hooks that WordPress launches to modify text of various types before adding it to the database or sending it to the browser screen. Plugins can specify that one or more of its PHP functions is executed to modify specific types of text at these times, using the Filter API. See the Plugin_API/Filter_Reference for a list of filter hooks. add_filter Call the functions added to a filter hook. See the Plugin API for a list of filter hooks. The callback functions attached to filter hook $tag are invoked by calling this function. This function can be used to create a new filter hook by simply calling this function with the name of the new hook specified using the $tag parameter. apply_filters Retrieve the name of the current filter or action. current_filter(); current_filter Merge the filter functions of a specific filter hook with generic filter functions. It is possible to defined generic filter functions using the filter hook all. These functions are called for every filter tag. This function merges the functions attached to the all hook with the functions of a specific hoook defined by $tag. merge_filters This function removes a function attached to a specified filter hook. This method can be used to remove default functions attached to a specific filter hook and possibly replace them with a substitute. See also remove_action(), add_filter() and add_action(). Important: To remove a hook, the $function_to_remove and $priority arguments must match when the hook was added. This goes for both filters and actions. No warning will be given on removal failure. remove_filter Remove all of the hooks from a filter. remove_all_filters( $tag, $priority ); remove_all_filters Check if any action has been registered for a hook. has_action( $tag, $function_to_check ) has_action Hooks a function on to a specific action. See Plugin API/Action Reference for a list of hooks for action. Actions are (usually) triggered when the WordPress core calls do_action(). add_action Executes a hook created by add_action. do_action( 'i_am_hook', $a, $b ); do_action Execute functions hooked on a specific action hook, specifying arguments in an array. This function is identical to do_action, but the arguments passed to the functions hooked to $tag are supplied using an array. do_action_ref_array Retrieve the number times an action is fired. did_action( $tag ); did_action This function is an alias to remove_filter(). This function removes a function attached to a specified action hook. This method can be used to remove default functions attached to a specific action hook and possibly replace them with a substitute. See also remove_filter(), add_action() and add_filter(). Important: To remove a hook, the $function_to_remove and $priority arguments must match when the hook was added. This goes for both filters and actions. No warning will be given on removal failure. remove_action( $tag, $function_to_remove, $priority, $accepted_args ); remove_action Remove all of the hooks from an action. remove_all_actions( $tag, $priority ) remove_all_actions Gets the basename of a plugin (extracts the name of a plugin from its filename). plugin_basename The plugins_url template tag retrieves the url to the plugins directory or to a specific file within that directory. You can hardcode the plugin slug in $path or pass __FILE__ as a second argument to get the correct folder name. $url = plugins_url(); plugins_url Parse the plugin contents to retrieve plugin's metadata. The metadata of the plugin's data searches for the following in the plugin's header. All plugin data must be on its own line. For plugin description, it must not have any newlines or only parts of the description will be displayed and the same goes for the plugin data. Plugin data returned array contains the following: get_plugin_data( $plugin_file, $markup = true, $translate = true ) get_plugin_data The register_activation_hook function registers a plugin function to be run when the plugin is activated. This is easier than using the activate_pluginname action. register_activation_hook The function register_deactivation_hook (introduced in WordPress 2.0) registers a plugin function to be run when the plugin is deactivated. register_deactivation_hook Register a setting and its sanitization callback. This is part of the Settings API, which lets you automatically generate wp-admin settings pages by registering your settings and using a few callbacks to control the output. This function can also be used to register settings that will be shown on the default WP settings pages like media or general. Once the setting is registered you can add it to an existing section with add_settings_field() or create a new section with add_settings_section() and add it to that. register_setting( 'my_options_group', 'my_option_name', 'intval' ); register_setting Output nonce, action, and option_page fields for a settings page. Please note that this function must be called inside of the form tag for the options page. settings_fields( $option_group ) settings_fields Allows clean de-registration of registered settings. Should be used mostly in deactivation hooks. unregister_setting( $option_group, $option_name, $sanitize_callback ); unregister_setting Get the url to access a particular menu page based on the slug it was registered with. If the slug hasn't been registered properly no url will be returned menu_page_url( $menu_slug, $echo ); menu_page_url Adds a hook for a shortcode tag. add_shortcode( $tag , $func ); add_shortcode Searches content for shortcodes and filters shortcodes through their hooks. echo do_shortcode( $content ) do_shortcode Regular Expression callable for do_shortcode() for calling shortcode hook. do_shortcode_tag( $m ) do_shortcode_tag Returns regular expression used to search for shortcodes inside posts. This function combines all registered shortcode tags into a single regular expression. $pattern = get_shortcode_regex(); get_shortcode_regex Removes hook for shortcode. remove_shortcode( $tag ); remove_shortcode Clears all shortcode hooks. remove_all_shortcodes(); remove_all_shortcodes Combines user shortcode attributes with known attributes and fills in defaults when needed. The result will contain every key from the known attributes, merged with values from shortcode attributes. shortcode_atts( $pairs , $atts ); shortcode_atts The attributes list has the attribute name as the key and the value of the attribute as the value in the key/value pair. This allows for easier retrieval of the attributes, since all attributes have to be known. shortcode_parse_atts( $text ); shortcode_parse_atts Deletes all shortcode tags from the given content. strip_shortcodes( $content ); strip_shortcodes Loads the comment template. For use in single Post and Page displays. comments_template( $file, $separate_comments ); comments_template Includes the footer.php template file from your current theme's directory. if a name is specified then a specialised footer footer-{name}.php will be included. If the theme contains no footer.php file then the footer from the default theme wp-includes/theme-compat/footer.php will be included. get_footer( $name ); get_footer Includes the header.php template file from your current theme's directory. if a name is specified then a specialised header header-{name}.php will be included. If the theme contains no header.php file then the header from the default theme wp-includes/theme-compat/header.php will be included. get_header( $name ); get_header Includes the sidebar.php template file from your current theme's directory. If a name ($name) is specified then a specialized sidebar sidebar-{name}.php will be included. If the theme contains no sidebar.php file then the sidebar from the default theme wp-includes/theme-compat/sidebar.php will be included. get_sidebar( $name ); get_sidebar Display search form using searchform.php Theme file. get_search_form( $echo ); get_search_form Add callbacks for background image display. The parameter $header_callback callback will be required to display the content for the 'wp_head' action. The parameter $admin_header_callback callback will be added to Custom_Background class and that will be added to the 'admin_menu' action. add_custom_background( $header_callback, $admin_header_callback, $admin_image_div_callback ) add_custom_background Add callbacks for image header display. The parameter $header_callback callback will be required to display the content for the 'wp_head' action. The parameter $admin_header_callback callback will be added to Custom_Image_Header class and that will be added to the 'admin_menu' action. add_custom_image_header( $header_callback, $admin_header_callback, $admin_image_div_callback ) add_custom_image_header Allows a theme or plugin to register support of a certain theme feature. If called from a theme, it should be done in the theme's functions.php file to work. It can also be called from a plugin if attached to a hook. If attached to a hook, it must be after_setup_theme. The init hook may be too late for some features. add_theme_support( $feature ); add_theme_support Themes have a template tag for the body tag which will help theme authors to style more effectively with CSS. The Template Tag is called body_class. This function gives the body element different classes and can be added, typically, in the header.php's HTML body tag. body_class Checks a theme's support for a given theme feature. current_theme_supports( $feature ); current_theme_supports This function calls each of the active widget callbacks in order, which prints the markup for the sidebar. If you have more than one sidebar, you should give this function the name or number of the sidebar you want to print. This function returns true on success and false on failure. The return value should be used to determine whether to display a static sidebar. This ensures that your theme will look good even when the Widgets plug-in is not active. If your sidebars were registered by number, they should be retrieved by number. If they had names when you registered them, use their names to retrieve them. dynamic_sidebar Retrieve path of 404 template in current or parent template. get_404_template(); get_404_template Retrieve path of archive template in current or parent template. get_archive_template(); get_archive_template Retrieve path of attachment template in current or parent template. The attachment path first checks if the first part of the mime type exists. The second check is for the second part of the mime type. The last check is for both types separated by an underscore. If neither are found then the file 'attachment.php' is checked and returned. Some examples for the 'text/plain' mime type are 'text.php', 'plain.php', and finally 'text_plain.php'. get_attachment_template() get_attachment_template Retrieve path of author template in current or parent template. get_author_template() get_author_template Retrieve path of category template in current or parent template. Works by retrieving the current category ID, for example 'category-1.php' and will fallback to category.php template, if the category ID file doesn't exist. get_category_template() get_category_template Retrieve path of comment popup template in current or parent template. Checks for comment popup template in current template, if it exists or in the parent template. If it doesn't exist, then it retrieves the comment-popup.php file from the default theme. The default theme must then exist for it to work. get_comments_popup_template() get_comments_popup_template Retrieve the name of the current theme. get_current_theme() get_current_theme Retrieve path of date template in current or parent template. get_date_template() get_date_template Retrieve header image for custom header. get_header_image() get_header_image Retrieve text color for custom header. get_header_textcolor() get_header_textcolor Retrieve path of home template in current or parent template. Attempts to locate 'home.php' first before falling back to 'index.php'. get_home_template() get_home_template Retrieve localized stylesheet URI. The stylesheet directory for the localized stylesheet files are located, by default, in the base theme directory. The name of the locale file will be the locale followed by '.css'. If that does not exist, then the text direction stylesheet will be checked for existence, for example 'ltr.css'. The theme may change the location of the stylesheet directory by either using the 'stylesheet_directory_uri' filter or the 'locale_stylesheet_uri' filter. If you want to change the location of the stylesheet files for the entire WordPress workflow, then change the former. If you just have the locale in a separate folder, then change the latter. get_locale_stylesheet_uri() get_locale_stylesheet_uri Retrieve path of page template in current or parent template. First attempt is to look for the file in the '_wp_page_template' page meta data. The second attempt, if the first has a file and is not empty, is to look for 'page.php'. get_page_template() get_page_template Retrieve path to file without the use of extension. Used to quickly retrieve the path of file without including the file extension. It will also check the parent template, if the file exists, with the use of locate_template(). Allows for more generic file location without the use of the other get_*_template() functions. Can be used with include() or require() to retrieve path. get_query_template( $type, $templates ); get_query_template Retrieve path of search template in current or parent template. get_search_template() get_search_template Retrieve path of single template in current or parent template. get_single_template() get_single_template Retrieve name of the current stylesheet. The theme name that the administrator has currently set the front end theme as. For all intents and purposes, the template name and the stylesheet name are going to be the same for most cases. In the event that you use a child theme, that is the name that will be returned, rather than the parent. get_stylesheet(); get_stylesheet Retrieve stylesheet directory Path for the current theme/child theme. Note: Does not contain a trailing slash. Returns an absolute server path (eg: /home/user/public_html/wp-content/themes/my_theme), not a URI. To retrieve the URI of the stylesheet directory use get_stylesheet_directory_uri() instead. get_stylesheet_directory() get_stylesheet_directory Retrieve URI of current theme stylesheet. The stylesheet file name is 'style.css' which is appended to get_stylesheet_directory_uri() path. get_stylesheet_uri() get_stylesheet_uri Retrieve path of tag template in current or parent template. Works by first retrieving the current tag name, for example 'tag-wordpress.php' and then trying tag ID, for example 'tag-1.php' and will finally fallback to tag.php template, if those files don't exist. get_tag_template() get_tag_template Retrieve path of taxonomy template in current or parent template. Retrieves the taxonomy and term, if term is available. The template is prepended with 'taxonomy-' and followed by both the taxonomy string and the taxonomy string followed by a dash and then followed by the term. The taxonomy and term template is checked and used first, if it exists. Second, just the taxonomy template is checked, and then finally, taxonomy.php template is used. If none of the files exist, then it will fall back on to index.php. get_taxonomy_template() get_taxonomy_template Retrieve name of the current theme. get_template() get_template Retrieve template directory Path for the current theme. Note: Does not contain a trailing slash. In the event a child theme is being used, the parent theme directory Path will be returned, use get_stylesheet_directory() to get the child theme directory Path. get_template_directory(); get_template_directory Retrieve template directory URI for the current theme. Checks for SSL. Note: Does not contain a trailing slash. In the event a child theme is being used, the parent theme directory URI will be returned, use get_stylesheet_directory_uri() to get the child theme directory URI. get_template_directory_uri(); get_template_directory_uri Load a template part into a template (other than header, sidebar, footer). Makes it easy for a theme to reuse sections of code and an easy way for child themes to replace sections of their parent theme. Includes the named template part for a theme or if a name is specified then a specialized part will be included. If the theme contains no {slug}.php file then no template will be included. For the parameter, if the file is called "{slug}-{name}.php". get_template_part( 'loop', 'index' ); get_template_part Retrieve theme data. get_theme( $theme ) get_theme Returns an array of information about a theme file. $theme_data = get_theme_data( get_theme_root() . '/' . $theme_name . '/style.css' ); get_theme_data Allows a theme or plugin to get support of a certain theme feature. get_theme_support( $feature ); get_theme_support Retrieve theme modification value for the current theme. If the modification name does not exist, then the $default will be passed through sprintf() with the first string the template directory URI and the second string the stylesheet directory URI. get_theme_mod( $name, $default ) get_theme_mod Retrieve path to themes directory. Does not have trailing slash. get_theme_root() get_theme_root Retrieve URI for themes directory. Does not have trailing slash. get_theme_root_uri(); get_theme_root_uri Retrieve list of themes with theme data in theme directory. The theme is broken if it doesn't have a parent theme and is missing either style.css or index.php. If the theme has a parent theme, it is broken if it is missing style.css; index.php is optional. The broken theme list is saved in the $wp_broken_themes global, which is displayed on the theme list in the administration panels. get_themes() get_themes Display header image path. header_image() header_image Display text color for custom header. header_textcolor(); header_textcolor Whether a child theme is in use. is_child_theme(); is_child_theme Require once the template file with WordPress environment. The globals are set up for the template file to ensure that the WordPress environment is available from within the function. The query variables are also available. load_template( $_template_file ) load_template Display localized stylesheet link element. If get_locale_stylesheet_uri() returns a value, locale_stylesheet will echo a valid xhtml tag. locale_stylesheet() locale_stylesheet Retrieve the name of the highest priority template file that exists. Searches in the STYLESHEETPATH before TEMPLATEPATH so that themes which inherit from a parent theme can just overload one file. locate_template( $template_names, $load, $require_once ) locate_template WordPress theme authors, who want to have finer css control options for their post styling, have the post_class function available. When the post_class function is added to a tag within the loop. This function is typically used in the index.php, single.php, and other template files that feature hierarchical post listings. If you would prefer to have the post classes returned instead of echoed, you would want to use get_post_class(). For css classes intended to help target entire pages, see body_class(), and for classes targeting comment listings, see comment_class(). post_class('',$post_id); post_class Start preview theme output buffer. Will only preform task if the user has permissions and 'template' and 'preview' query variables exist. Will add 'stylesheet' filter if 'stylesheet' query variable exists. preview_theme() preview_theme Callback function for ob_start() to capture all links in the theme. preview_theme_ob_filter( $content ) preview_theme_ob_filter Manipulates preview theme links in order to control and maintain location. Callback function for preg_replace_callback() to accept and filter matches. preview_theme_ob_filter_callback( $matches ) preview_theme_ob_filter_callback Registers a single custom navigation menu in the new custom menu editor of WordPress 3.0. This allows for creation of custom menus in the dashboard for use in your theme. See register_nav_menus() for creating multiple menus at once. register_nav_menu Registers multiple custom navigation menus in the new custom menu editor of WordPress 3.0. This allows for the creation of custom menus in the dashboard for use in your theme. See register_nav_menu() for creating a single menu, and Navigation Menus for adding theme support. register_nav_menus Builds the definition for a single sidebar and returns the ID. Call on "widgets_init" action. register_sidebar( $args ); register_sidebar Creates multiple sidebars. Registers one or more sidebars to be used in the current theme. Most themes have only one sidebar. For this reason, the number parameter is optional and defaults to one. The args array parameter can contain a 'name' which will be prepended to the sidebar number if there is more than one sidebar. If no name is specified, 'Sidebar' is used. register_sidebars Register a directory that contains themes. register_theme_directory( $directory ) register_theme_directory Remove theme modification name from current theme list. If removing the name also removes all elements, then the entire option will be removed. remove_theme_mod( $name ) remove_theme_mod Remove all theme modification options for current theme. remove_theme_mods() remove_theme_mods Checks a theme's support for a given feature before loading the functions which implement it. require_if_theme_supports( $feature, $include ) require_if_theme_supports Search all registered theme directories for complete and valid themes. search_theme_directories() search_theme_directories Update theme modification value for the current theme. set_theme_mod( $name, $value ) set_theme_mod Switches current theme to new template and stylesheet names. switch_theme( $template, $stylesheet ) switch_theme Checks that current theme files 'index.php' and 'style.css' exists. Does not check the 'default' theme. The 'default' theme should always exist or should have another theme renamed to that template name and directory path. Will switch theme to default if current theme does not validate. You can use the 'validate_current_theme' filter to return false to disable this functionality. validate_current_theme() validate_current_theme Unregisters a custom navigation menu for a theme location. unregister_nav_menu This function displays a date-based archives list. This tag can be used anywhere within a template. wp_get_archives('type=monthly&limit=12'); wp_get_archives Returns the items from a navigation menu created in the Appearance → Menus panel. Given a menu name, id or slug, the function returns the menu items from that navigation menu. The menu items returned are in fact the actual nav_menu_item type posts which contain references to the normal posts/pages they are associated with. wp_get_nav_menu_items Displays a navigation menu created in the Appearance → Menus panel. Given a theme_location parameter, the function displays the menu assigned to that location, or nothing if no such location exists or no menu is assigned to it. If not given a theme_location parameter, the function displays wp_nav_menu( array('menu' => 'Project Nav' )); wp_nav_menu Displays a list of WordPress Pages as links, and affords the opportunity to have Home added automatically to the list of Pages displayed. This Tag is useful to customize the Sidebar or Header, but may be used in other Templates as well. wp_page_menu Displays or returns the title of the page. A separator string can be defined, and beginning with Version 2.5, that separator can be designated to print before or after the title of the page. This tag can be used anywhere within a template as long as it's outside The Loop on the main page, though is typically used in the "title" element for the head of a page. The title text depends on the query: wp_title Walks an array while sanitizing the contents. add_magic_quotes( $array ) add_magic_quotes Adds slashes to escape strings. Slashes will first be removed if magic-quotes-gpc is set, see magic_quotes for more details. addslashes_gpc( $gpc ) addslashes_gpc Converts email addresses characters to HTML entities to block spam bots. antispambot( $emailaddy, $mailto ) antispambot This function is deprecated as of WordPress 2.8.0. Please use esc_attr instead. This function escapes or encodes HTML special characters (including single and double quotes) for use in HTML attributes. It works like the standard PHP htmlspecialchars except that it doesn't double-encode HTML entities (i.e. & will remain unchanged, rather than encoded to &). attribute_escape can be found in /wp-includes/formatting.php. echo attribute_escape($text); attribute_escape Adds backslashes before letters and before a number at the start of a string. backslashit( $string ) backslashit Will balance the tags if forced to or the option is set to balance tags. The option 'use_balanceTags' is used for whether the tags will be balanced. Either the $force parameter or 'use_balanceTags' option need to be true before the tags will be balanced. balanceTags( $text, $force ); balanceTags Accepts matches array from preg_replace_callback in wpautop() or a string. Ensures that the contents of a
...
HTML block are not converted into paragraphs or line-breaks.
clean_pre( $matches ) clean_pre
Checks and cleans a URL. A number of characters are removed from the URL. If the URL is for displaying (the default behaviour) ampersands (&) are also replaced. The 'clean_url' filter is applied to the returned cleaned URL. clean_url( $url, $protocols, $context ) clean_url Converts a number of characters from a string. Metadata tags are converted into correct XHTML and Unicode characters are converted to the valid range. convert_chars( $content, $deprecated ) convert_chars Convert text equivalent of smilies to images. Will only convert smilies if the option 'use_smilies' is true and the globals used in the function aren't empty. convert_smilies( $text ) convert_smilies Converts named entities into numbered entities. ent2ncr( $text ) ent2ncr Encodes < > & " ' (less than, greater than, ampersand, double quote, single quote). Will never double encode entities. Always use when escaping user-input, in forms especially. echo esc_attr( $text ) esc_attr Encodes text for use inside a "textarea" element. esc_textarea( $text ); esc_textarea Balances tags of string using a modified stack. Ignores the 'use_balanceTags' option. force_balance_tags( $text ) force_balance_tags Acts on text which is about to be edited. Unless $richedit is set, it is simply a holder for the 'format_to_edit' filter. If $richedit is set true htmlspecialchars will be run on the content, converting special characters to HTML entities. format_to_edit( $content, $richedit ) format_to_edit Holder for the 'format_to_post' filter. format_to_post( $content ) format_to_post Fixes javascript bugs in browsers. Converts unicode characters to HTML numbered entities. funky_javascript_fix( $text ) funky_javascript_fix Convert entities, while preserving already-encoded entities. htmlentities2( $myHTML ) htmlentities2 Verifies that an email is valid. is_email( $email ) is_email Escape single quotes. Convert double quotes. Fix line endings. The filter 'js_escape' is also applied here. js_escape has been deprecated since 2.8. Use esc_js instead. js_escape( $text ) js_escape Convert plain text URI to HTML links. Converts URI, www, ftp, and email addresses. Finishes by fixing links within links. make_clickable( $ret ) make_clickable Adds target='_blank' and rel='external' to all HTML Anchor tags to open links in new windows. Comment text in popup windows should be filtered through this. Right now it's a moderately dumb function, ideally it would detect whether a target or rel attribute was already there and adjust its actions accordingly. popuplinks( $text ) popuplinks Converts all accent characters to ASCII characters. If there are no accent characters, then the string given is just returned. remove_accents( $string ) remove_accents Strips out all characters that are not allowable in an email. sanitize_email( $email ) sanitize_email Sanitizes a filename replacing whitespace with dashes Removes special characters that are illegal in filenames on certain operating systems and special characters requiring special escaping to manipulate at the command line. Replaces spaces and consecutive dashes with a single dash. Trim period, dash and underscore from beginning and end of filename. sanitize_file_name( $name ) sanitize_file_name Santizes a html classname to ensure it only contains valid characters. Strips the string down to A-Z,a-z,0-9,_,-. If this results in an empty string, then the function will return the alternative value supplied. $post_class = sanitize_html_class( $post->post_title ); sanitize_html_class Sanitize a string key. Keys are used as internal identifiers. Lowercase alphanumeric characters, dashes and underscores are allowed. sanitize_key( $key ); sanitize_key Sanitize a string from user input or from the db. Checks for invalid UTF-8, Convert single < characters to entity, strip all tags, remove line breaks, tabs and extra white space, strip octets. sanitize_text_field Sanitizes title or use fallback title. Specifically, HTML and PHP tags are stripped. Further actions can be added via the plugin API. If $title is empty and $fallback_title is set, the latter will be used. Despite the name of this function, the returned value is intended to be suitable for use in a URL, not as a human-readable title. sanitize_title( $title, $fallback_title ) sanitize_title Sanitizes title, replacing whitespace with dashes. Limits the output to alphanumeric characters, underscore (_) and dash (-). Whitespace becomes a dash. Note that it does not replace special accented characters (see plugins such as [1] to fix that). sanitize_title_with_dashes( $title ) sanitize_title_with_dashes Sanitize username stripping out unsafe characters. If $strict is true, only alphanumeric characters plus these: _, space, ., -, *, and @ are returned. Removes tags, octets, entities, and if strict is enabled, will remove all non-ASCII characters. After sanitizing, it passes the username, raw username (the username in the parameter), and the strict parameter as parameters for the filter. sanitize_user( $username, $strict ) sanitize_user Checks to see if a string is utf8 encoded. seems_utf8( $str ); seems_utf8 Navigates through an array and removes slashes from the values. If an array is passed, the array_map() function causes a callback to pass the value back to the function. The slashes from each value will be removed using the stripslashes() function. stripslashes_deep( $value ); stripslashes_deep Appends a trailing slash. Will remove trailing slash if it exists already before adding a trailing slash. This prevents double slashing a string or path. The primary use of this is for paths and thus should be used for paths. It is not restricted to paths and offers no specific path support. trailingslashit( $string ) trailingslashit Removes trailing slash if it exists. The primary use of this is for paths and thus should be used for paths. It is not restricted to paths and offers no specific path support. untrailingslashit( $string ); untrailingslashit Shortens URLs. Removes http://, www., and truncates the remaining URL to 35 characters, including '...' if the URL is longer than that. WordPress uses it to display URLs on the link management screen. url_shorten Encode the Unicode values to be used in the URI. utf8_uri_encode( $utf8_string, $length ) utf8_uri_encode Changes double line-breaks in the text into HTML paragraphs (

...

). WordPress uses it to filter the content and the excerpt.
wpautop($some_long_text); wpautop
This returns given text with transformations of quotes to smart quotes, apostrophes, dashes, ellipses, the trademark symbol, and the multiplication symbol. wptexturize Sanitize content with allowed HTML Kses rules. wp_filter_kses should generally be preferred over wp_kses_data because wp_magic_quotes escapes $_GET, $_POST, $_COOKIE, $_SERVER, and $_REQUEST fairly early in the hook system, shortly after 'plugins_loaded' but earlier then 'init' or 'wp_loaded'. wp_filter_kses( $data ) wp_filter_kses Sanitize content for allowed HTML tags for post content. Post content refers to the page contents of the 'post' type and not $_POST data from forms. wp_filter_post_kses( $data ) wp_filter_post_kses Strips all of the HTML in the content. wp_filter_nohtml_kses( $data ) wp_filter_nohtml_kses Converts an email subject to ASCII. wp_iso_descrambler( $string ) wp_iso_descrambler This function makes sure that only the allowed HTML element names, attribute names and attribute values plus only sane HTML entities will occur in $string. You have to remove any slashes from PHP's magic quotes before you call this function. wp_kses Goes through an array and changes the keys to all lower case. wp_kses_array_lc( $inarray ) wp_kses_array_lc Removes all attributes, if none are allowed for this element. If some are allowed it calls wp_kses_hair() to split them further, and then it builds up new HTML code from the data that wp_kses_hair() returns. It also removes '<' and '>' characters, if there are any left. One more thing it does is to check if the tag has a closing XHTML slash, and if it does, it puts one in the returned code as well. wp_kses_attr( $element, $attr, $allowed_html, $allowed_protocols ) wp_kses_attr Sanitize string from bad protocols. This function removes all non-allowed protocols from the beginning of $string. It ignores whitespace and the case of the letters, and it does understand HTML entities. It does its work in a while loop, so it won't be fooled by a string like 'javascript:javascript:alert(57)'. wp_kses_bad_protocol( $string, $allowed_protocols ); wp_kses_bad_protocol Sanitizes content from bad protocols and other characters. This function searches for URL protocols at the beginning of $string, while handling whitespace and HTML entities. wp_kses_bad_protocol_once( $string, $allowed_protocols ) wp_kses_bad_protocol_once Callback for wp_kses_bad_protocol_once() regular expression. This function processes URL protocols, checks to see if they're in the white-list or not, and returns different data depending on the answer. wp_kses_bad_protocol_once2( $matches ) wp_kses_bad_protocol_once2 Performs different checks for attribute values. The currently implemented checks are 'maxlen', 'minlen', 'maxval', 'minval' and 'valueless' with even more checks to come soon. wp_kses_check_attr_val( $value, $vless, $checkname, $checkvalue ) wp_kses_check_attr_val Convert all entities to their character counterparts. This function decodes numeric HTML entities (like A and A). It doesn't do anything with other entities like ä, but we don't need them in the URL protocol whitelisting system anyway. wp_kses_decode_entities( $string ) wp_kses_decode_entities Builds an attribute list from string containing attributes. This function does a lot of work. It parses an attribute list into an array with attribute data, and tries to do the right thing even if it gets weird input. It will add quotes around attribute values that don't have any quotes or apostrophes around them, to make it easier to produce HTML code that will conform to W3C's HTML specification. It will also remove bad URL protocols from attribute values. It also reduces duplicate attributes by using the attribute defined first (foo='bar' foo='baz' will result in foo='bar'). wp_kses_hair( $attr, $allowed_protocols ) wp_kses_hair You add any kses hooks here. There is currently only one kses WordPress hook and it is called here. All parameters are passed to the hooks and expected to recieve a string. wp_kses_hook( $string, $allowed_html, $allowed_protocols ) wp_kses_hook Handles parsing errors in wp_kses_hair(). The general plan is to remove everything to and including some whitespace, but it deals with quotes and apostrophes as well. wp_kses_html_error( $string ) wp_kses_html_error Removes the HTML JavaScript entities found in early versions of Netscape 4. wp_kses_js_entities( $string ) wp_kses_js_entities Removes any NULL characters in $string. wp_kses_no_null( $string ) wp_kses_no_null Converts and fixes HTML entities. This function normalizes HTML entities. It will convert 'AT&T' to the correct 'AT&T', ':' to ':', '&#XYZZY;' to '&#XYZZY;' and so on. wp_kses_normalize_entities( $string ) wp_kses_normalize_entities Callback for wp_kses_normalize_entities() regular expression. This function helps wp_kses_normalize_entities() to only accept 16 bit values and nothing more for &#number; entities. wp_kses_normalize_entities2( $matches ) wp_kses_normalize_entities2 Searches for HTML tags, no matter how malformed. It also matches stray ">" characters. wp_kses_split( $string, $allowed_html, $allowed_protocols ) wp_kses_split Callback for wp_kses_split() for fixing malformed HTML tags. This function does a lot of work. It rejects some very malformed elements. It returns an empty string, if the element isn't allowed (look ma, no strip_tags()!). Otherwise it splits the tag into an element and an attribute list. After the tag is split into an element and an attribute list, it is run through another filter which will remove illegal attributes and once that is completed, will be returned. wp_kses_split2( $string, $allowed_html, $allowed_protocols ) wp_kses_split2 Strips slashes from in front of quotes. This function changes the character sequence \" to just ". It leaves all other slashes alone. It's really weird, but the quoting from preg_replace(//e) seems to require this. wp_kses_stripslashes( $string ) wp_kses_strip_slashes This function returns the kses version number. wp_kses_version() wp_kses_version Convert full URL paths to absolute paths. Removes the http or https protocols and the domain. Keeps the path '/' at the beginning, so it isn't a true relative link, but from the web root base. wp_make_link_relative( $link ) wp_make_link_relative Adds rel="nofollow" string to all HTML entities A elements in content. wp_rel_nofollow( $text ) wp_rel_nofollow Formats text for the rich text editor. The filter 'richedit_pre' is applied here. If $text is empty the filter will be applied to an empty string. wp_richedit_pre( $text ) wp_richedit_pre This function is deprecated as of WordPress 2.8.0. Please use esc_html instead. Converts a number of special characters into their HTML entities. Differs from htmlspecialchars as existing HTML entities will not be encoded. Specifically changes: & to &, < to < and > to >. $quotes can be set to 'single' to encode ' to ', 'double' to encode " to ", or '1' to do both. Default is 0 where no quotes are encoded. wp_specialchars( $text, $quotes ) wp_specialchars This function trims text to a certain number of words and returns the trimmed text. wp_trim_words( $text, $num_words = 55, $more = null ); wp_trim_words Add leading zeros when necessary. If you set the threshold to '4' and the number is '10', then you will get back '0010'. If you set the threshold to '4' and the number is '5000', then you will get back '5000'. Uses sprintf to append the amount of zeros based on the $threshold parameter and the size of the number. If the number is large enough, then no zeros will be appended. zeroise( $number, $threshold ); zeroise Returns the blog's current local time in one of two formats, either MySQL's timestamp data type format (i.e. YYYY-MM-DD HH:MM:SS) or the Unix timestamp format (i.e. epoch). The optional secondary parameter can be used to retrieve GMT time instead of the blog's local time. The local time returned is based on the timezone set on the blog's General Settings page, which is UTC by default. Contrary to the struck-out statements below, current_time() does indeed return the proper times regardless of the PHP server's date.timezone setting. This is accomplished by overriding the server's default setting by calling date_default_timezone_set('UTC') from wp-settings.php during the init phase, allowing WordPress to always return the actual UTC time and local time for the timezone declared by the blog's administrator regardless of the server's settings. In other words, current_time('timestamp') should be used in lieu of time() to return the blog's local time rather than the server's local time. WARNING: current_time('timestamp',1) returns (as a timestamp) the server time, not (as expected) GMT! Because this is exactly what PHP's time() returns, current_time('timestamp',1) is superfluous and unnecessary -- use time(). WARNING: current_time('timestamp',0) returns the timestamp GMT + gmt_offset(server) + gmt_offset(browser) -- a meaningless construct. It is difficult to imagine any use for the 'timestamp' parameter value. See bottom example on this page for a workaround to get the properly timed timestamp. $blogtime = current_time('mysql'); list( $today_year, $today_month, $today_day, $hour, $minute, $second ) = split( '([^0-9])', $blogtime ); current_time Retrieve the date in localized format, based on timestamp. If the locale specifies the locale month and weekday, then the locale will take over the format for the date. If it isn't, then the date format string will be used instead. i18n is an abbreviation for Internationalization. (There are 18 letters between the first "i" and last "n".) echo date_i18n( $dateformatstring, $unixtimestamp, $gmt ) date_i18n Displays the calendar (defaults to current month/year). Days with posts are styled as such. This tag can be used anywhere within a template. get_calendar(); get_calendar Converts a GMT date into the correct format for the blog. Requires and returns in the Y-m-d H:i:s format. Simply adds the value of the 'gmt_offset' option. get_date_from_gmt( $string, $format ) get_date_from_gmt Retrieve the date the the last post was published. The server timezone is the default and is the difference between GMT and server time. The 'blog' value is the date when the last post was posted. The 'gmt' is when the last post was posted in GMT formatted date. get_lastpostdate( $timezone ) get_lastpostdate Retrieve last post modified date depending on timezone. The server timezone is the default and is the difference between GMT and server time. The 'blog' value is just when the last post was modified. The 'gmt' is when the last post was modified in GMT time. get_lastpostmodified( $timezone ); get_lastpostmodified Returns the daily archive URL to a specific year, month and day for use in PHP. It does NOT display the URL. If year, month and day parameters are set to '', the tag returns the URL for the current day's archive. get_day_link Returns a date in the GMT equivalent. Requires and returns a date in the Y-m-d H:i:s format. Simply subtracts the value of the 'gmt_offset' option. get_gmt_from_date( $string ) get_gmt_from_date Returns the monthly archive URL to a specific year and month for use in PHP. It does NOT display the URL. If year and month parameters are set to '', the tag returns the URL for the current month's archive. $oct_04 = get_month_link('2004', '10'); get_month_link Returns the time of the current post for use in PHP. It does not display the time. To display the time of a post, use the_time(). This tag must be used within The Loop. echo get_the_time(); get_the_time Returns the time of the current post for use in PHP. It does not display the time. To display the time of a post, use the_time(). This tag must be used within The Loop. echo get_the_time(); get_the_time This tag displays the time (and date) a post was last modified and is similar to the functionality of the_time(), which displays the time (and date) a post was created. This tag must be used within The Loop. If no format parameter is specified, the Default date format (please note that says Date format) setting from Administration > Settings > General is used for the display format. If the post or page is not yet modified, the modified time is the same as the creation time. If you want to display both the modified time and the creation time, you may want to use an if statement (e.g. if (get_the_modified_time() != get_the_time())) to avoid showing the same time/date twice. Use get_the_modified_time() to retrieve the value. the_modified_time Retrieve the time at which the post was last modified. get_the_modified_time( $d ); get_the_modified_time Get the week start and end from the MySQL DATETIME or date string. get_weekstartend( $mysqlstring, $start_of_week ) get_weekstartend Returns the yearly archive URL to a specific year for use in PHP. It does NOT display the URL. If year is set to '', the tag returns the URL for the current year's archive. $year03 = get_year_link(2003); get_year_link Determines the difference between two timestamps. The difference is returned in a human readable format such as "1 hour", "5 mins", "2 days". human_time_diff( $from, $to ); human_time_diff This Conditional Tag checks if today is a new day. This is a boolean function, meaning it returns TRUE when new day or FALSE if not a new day. is_new_day(); is_new_day Computes an offset in seconds from an ISO 8601 timezone. iso8601_timezone_to_offset( $timezone ) iso8601_timezone_to_offset Converts an iso8601 date to MySQL DATETIME format used by post_date[_gmt]. iso8601_to_datetime( $date_string, $timezone ) iso8601_to_datetime Translates dates from mysql format to any format acceptable by the php date() function mysql2date Check value to find if it was serialized. If $data is not a string, then returned value will always be false. Serialized data is always a string. is_serialized( $data ) is_serialized Check whether serialized data is of string type. is_serialized_string( $data ) is_serialized_string Serialize data, if needed. maybe_serialize( $data ); maybe_serialize Unserialize value only if it was serialized. maybe_unserialize( $original ) maybe_unserialize A safe way of adding a named option/value pair to the options database table. It does nothing if the option already exists. After the option is saved, it can be accessed with get_option(), changed with update_option(), and deleted with delete_option(). You do not need to serialize values. If the value needs to be serialized, then it will be serialized before it is inserted into the database. You can create options without values and then add values later. Calling add_option first checks whether the option has already been added, and returns false if an option with the same name exists. Next, it checks to make the option name is not one of the protected names alloptions or notoptions, and dies with an error message if attempting to overwrite a protected option. If the option name is not protected, and does not already exist, the option will be created. add_option( $option, $value, $deprecated, $autoload ); add_option A safe way of removing a named option/value pair from the options database table. delete_option( $option ); delete_option Echo option value after sanitizing for forms. form_option( $option ) form_option Retrieve all autoload options or all options, if no autoloaded ones exist. This is different from wp_load_alloptions() in that this function does not cache its results and will retrieve all options from the database every time it is called. get_alloptions() get_alloptions Retrieve option value based on name of option. In multisite, return network option, blog option otherwise. get_site_option( $option, $default , $use_cache ) get_site_option The get_site_url() template tag retrieves the site url for a given site. Returns the 'siteurl' option with the appropriate protocol, 'https' if is_ssl() and 'http' otherwise. If $scheme is 'http' or 'https', is_ssl() is overridden. get_site_url( $blog_id, $path, $scheme ); get_site_url Retrieve user option that can be either global, user, or blog. If the user ID is not given, then the current user will be used instead. If the user ID is given, then the user data will be retrieved. The filter for the result will also pass the original option name and finally the user data object as the third parameter. The option will first check for the non-global name, then the global name, and if it still doesn't find it, it will try the blog option. The option can either be modified or set by a plugin. get_user_option( $option, $user ) get_user_option A safe way of getting values for a named option from the options database table. If the desired option does not exist, or no value is associated with it, FALSE will be returned. get_option Use the function update_option() to update a named option/value pair to the options database table. The option_name value is escaped with $wpdb->escape before the INSERT statement. This function may be used in place of add_option, although it is not as flexible. update_option will check to see if the option already exists. If it does not, it will be added with add_option('option_name', 'option_value'). Unless you need to specify the optional arguments of add_option(), update_option() is a useful catch-all for both adding and updating options. Note: This function cannot be used to change whether an option is to be loaded (or not loaded) by wp_load_alloptions. In that case, a delete_option() should be followed by use of the add_option() function. update_option( $option, $newvalue ); update_option Update user option with global blog capability. User options are just like user metadata except that they have support for global blog options. If the 'global' parameter is false, which it is by default, it will prepend the WordPress table prefix to the option name. update_user_option( $user_id, $option_name, $newvalue, $global ) update_user_option Add a top level menu page. Specifically, creates a new top level menu section in the admin menu sidebar and registers a hook to callback your function for outputting the page content when the linked menu page is requested. Returns the $hookname. add_menu_page( $page_title, $menu_title, $capability, $menu_slug, $function, $icon_url, $position ); add_menu_page Remove a top level admin menu. Please be aware that this would not prevent a user from accessing these screens directly. Removing a menu does not replace the need to filter a user's permissions as appropriate. remove_menu_page( $menu_slug ) remove_menu_page Add a sub menu page. This function takes a capability which will be used to determine whether or not a page is included in the menu. The function which is hooked in to handle the output of the page must check that the user has the required capability as well. This function should normally be hooked in with one of the the admin_menu actions depending on the menu where the sub menu is to appear: add_submenu_page( $parent_slug, $page_title, $menu_title, $capability, $menu_slug, $function ); add_submenu_page Remove an admin submenu. Please be aware that this would not prevent a user from accessing these screens directly. Removing a menu does not replace the need to filter a user's permissions as appropriate. remove_submenu_page( $menu_slug, $submenu_slug ) remove_submenu_page Add a top level menu page at the 'utility' level. This new menu will appear in the group including the default WordPress Appearance, Plugins, Users, Tools and Settings. Specifically, creates a new top level menu section in the admin menu sidebar and registers a hook to callback your function for outputting the page content when the linked menu page is requested. Returns the $hookname. add_utility_page( $page_title, $menu_title, $capability, $menu_slug, $function, $icon_url ); add_utility_page This function is a method of the $wp_admin_bar global object (see: WP_Admin_Bar), and can be used to add a new item to the Toolbar. You can also use it to change the properties of an item that is already in the Toolbar. The Toolbar replaces the Admin Bar since WordPress Version 3.3. Toolbar items are also called "nodes". Nodes can be parents for other nodes, which creates dropdown menus. Group nodes together with add_group() to create distinct sections in a Toolbar menu. note: This function is a method of the WP_Admin_Bar class and $wp_admin_bar global object, which may not exist except during the 'admin_bar_menu' or 'wp_before_admin_bar_render' hooks. $wp_admin_bar->add_node( $args ); add_node This function removes an item from the Toolbar. Toolbar items are also called "nodes". The Toolbar replaces the Admin Bar since WordPress Version 3.3. note: This function is a method of the WP_Admin_Bar class and $wp_admin_bar global object, which may not exist except during the 'admin_bar_menu' or 'wp_before_admin_bar_render' hooks. $wp_admin_bar->remove_node( $id ); remove_node This function adds a new group to the Toolbar. Groups allow you to group Toolbar items together into distinct sections of a toolbar menu. The Toolbar replaces the Admin Bar since WordPress Version 3.3. Toolbar items are also called "nodes". Nodes can be parents for other nodes, which creates dropdown menus. When adding a group you're actually adding a group node. Group nodes are not visible in the Toolbar, but nodes added to it are. note: This function is a method of the WP_Admin_Bar class and $wp_admin_bar global object, which may not exist except during the 'admin_bar_menu' or 'wp_before_admin_bar_render' hooks. $wp_admin_bar->add_group( $args ); add_group This function returns a Toolbar object with all the properties of a single Toolbar item. Toolbar items are also called "nodes". The Toolbar replaces the Admin Bar since WordPress Version 3.3. note: This function is a method of the WP_Admin_Bar class and $wp_admin_bar global object, which may not exist except during the 'admin_bar_menu' or 'wp_before_admin_bar_render' hooks. $wp_admin_bar->get_node( $id ); get_node This function returns an array of all the Toolbar items on the current page. Toolbar items are also called "nodes". The Toolbar replaces the Admin Bar since WordPress Version 3.3. note: This function is a method of the WP_Admin_Bar class and $wp_admin_bar global object, which may not exist except during the 'admin_bar_menu' or 'wp_before_admin_bar_render' hooks. $wp_admin_bar->get_nodes(); get_nodes Compares two given values (for example, a saved option vs. one chosen in a form) and, if the values are the same, adds the checked attribute to the current radio button or checkbox. This is essentially the same as comparing values with if(), but results in more concise code. checked Compares two given values (for example, a saved option vs. one chosen in a form) and, if the values are the same, adds the disabled attribute to a form input field. disabled For use in dropdown form fields. Compares two given values (for example, a saved option vs. one chosen in a form) and, if the values are the same, adds the selected attribute to the current option tag. selected Tests if the current request was referred from an admin page, or (given $action parameter) if the current request carries a valid nonce. Used to avoid security exploits. check_admin_referer( $action, $query_arg ); check_admin_referer This function can be replaced via plugins. If plugins do not redefine these functions, then this will be used instead. Verifies the AJAX request to prevent processing requests external of the blog. check_ajax_referer( $action, $query_arg, $die ) check_ajax_referer Creates a random, one time use token. wp_create_nonce( $action ); wp_create_nonce Retrieve nonce action 'Are you sure' message. The action is split by verb and noun. The action format is as follows: verb-action_extra. The verb is before the first dash and has the format of letters and no spaces and numbers. The noun is after the dash and before the underscore, if an underscore exists. The noun is also only letters. The filter will be called for any action, which is not defined by WordPress. You may use the filter for your plugin to explain nonce actions to the user, when they get the "Are you sure?" message. The filter is in the format of 'explain_nonce_$verb-$noun' with the $verb replaced by the found verb and the $noun replaced by the found noun. The two parameters that are given to the hook are the localized 'Are you sure you want to do this?' message with the extra text (the text after the underscore). wp_explain_nonce( $action ) wp_explain_nonce Retrieve original referer that was posted, if it exists. wp_get_original_referer() wp_get_original_referer Retrieve referer from '_wp_http_referer', HTTP referer, or current page respectively. wp_get_referer() wp_get_referer Display 'Are You Sure?' message to confirm the action being taken. If the action has the nonce explain message, then it will be displayed along with the 'Are you sure?' message. wp_nonce_ays( $action ) wp_nonce_ays Retrieve or display nonce hidden field for forms. The nonce field is used to validate that the contents of the form came from the location on the current site and not somewhere else. The nonce does not offer absolute protection, but should protect against most cases. It is very important to use nonce fields in forms. If you set $echo to false and set $referer to true, then you will need to retrieve the referer field using wp_referer_field(). If you have the $referer set to true and are echoing the nonce field, it will also echo the referer field. The $action and $name are optional, but if you want to have better security, it is strongly suggested to set those two parameters. It is easier to just call the function without any parameters, because validation of the nonce doesn't require any parameters, but since crackers know what the default is it won't be difficult for them to find a way around your nonce and cause damage. The input name will be whatever $name value you gave. The input value will be the nonce creation value. wp_nonce_field( $action, $name, $referer, $echo ) wp_nonce_field Retrieve URL with nonce added to URL query. wp_nonce_url( $actionurl, $action ); wp_nonce_url Retrieve or display original referer hidden field for forms. The input name is '_wp_original_http_referer' and will be either the same value of wp_referer_field(), if that was posted already or it will be the current page, if it doesn't exist. wp_original_referer_field( $echo, $jump_back_to ); wp_original_referer_field Retrieve or display referer hidden field for forms. The referer link is the current Request URI from the server super global. The input name is '_wp_http_referer', in case you wanted to check manually. wp_referer_field( $echo ) wp_referer_field Verify that correct nonce was used with time limit. wp_verify_nonce( $nonce, $action ); wp_verify_nonce Retrieve the post category or categories from XMLRPC XML. If the category element is not found, then the default post category will be used. The return type then would be what $post_default_category. If the category is found, then it will always be an array. xmlrpc_getpostcategory( $content ); xmlrpc_getpostcategory Retrieve post title from XMLRPC XML. If the title element is not part of the XML, then the default post title from the $post_default_title will be used instead. xmlrpc_getposttitle( $content ) xmlrpc_getposttitle XMLRPC XML content without title and category elements. xmlrpc_removepostdata( $content ) xmlrpc_removepostdata Retrieves the translated string from the translate(). $translated_text = __( $text, $domain ); _2 Retrieve translated string with gettext context Quite a few times, there will be collisions with similar translatable text found in more than two places but with different translated context. By including the context in the pot file translators can translate the two strings differently. _x( $text, $context, $domain ) _x Retrieve the plural or single form based on the amount. If the domain is not set in the $l10n list, then a comparison will be made and either $plural or $single parameters returned. If the domain does exist, then the parameters $single, $plural, and $number will first be passed to the domain's ngettext() method. Then it will be passed to the 'ngettext' filter hook along with the same parameters. The expected type will be a string. _n( $single, $plural, $number, $domain ) _n A hybrid of _n() and _x(). It supports contexts and plurals. _nx( $single, $plural, $number, $context, $domain ) _nx Displays the returned translated text from translate(). _e( $text, $domain ) _e Displays translated string with gettext context _ex( $text, $context, $domain ) _ex This function is deprecated as of WordPress 2.8.0. Please use _n() instead. Retrieve the plural or single form based on the amount. If the domain is not set in the $l10n list, then a comparsion will be made and either $plural or $single parameters returned. If the domain does exist, then the parameters $single, $plural, and $number will first be passed to the domain's ngettext method. Then it will be passed to the 'ngettext' filter hook along with the same parameters. The expected type will be a string. __ngettext( $single, $plural, $number, $domain ) _2ngettext Retrieves the translation of $text and escapes it for safe use in an attribute. If there is no translation, or the domain isn't loaded the original text is returned. esc_attr__( $text, $domain ) esc_attr_2 Displays translated text that has been escaped for safe use in an attribute. Encodes < > & " ' (less than, greater than, ampersand, double quote, single quote). Will never double encode entities. If you need the values for use in PHP, use esc_attr(). esc_attr_e( $text, $domain ) esc_attr_e Gets the current locale. If the locale is set, then it will filter the locale in the 'locale' filter hook and return the value. If the locale is not set already, then the WPLANG constant is used if it is defined. Then it is filtered through the 'locale' filter hook and the value for the locale global set and the locale is returned. The process to get the locale should only be done once but the locale will always be filtered using the 'locale' hook. get_locale() get_locale Loads default translated strings based on locale. Loads the .mo file in WP_LANG_DIR constant path from WordPress root. The translated (.mo) file is named based off of the locale. load_default_textdomain() load_default_textdomain Loads the plugin's translated strings. If the path is not given then it will be the root of the plugin directory. The .mo file should be named based on the domain followed by a dash, and then the locale exactly. The locale is the language code and/or country code you defined in the constant WPLANG in the file wp-config.php. For example, the locale for German is 'de_DE', and the locale for Danish is 'da_DK'. If your plugin's text domain is "my-plugin" the Danish .mo and.po files should be named "my-plugin-da_DK.mo" and "my-plugin-da_DK.po" Call this function in your plugin as early as the plugins_loaded action. If you call load_plugin_textdomain multiple times for the same domain, the translations will be merged. If both sets have the same string, the translation from the original value will be taken. load_plugin_textdomain( $domain, $abs_rel_path, $plugin_rel_path ) load_plugin_textdomain Loads MO file into the list of domains. If the domain already exists, the inclusion will fail. If the MO file is not readable, the inclusion will fail. On success, the mofile will be placed in the $l10n global by $domain and will be an gettext_reader object. load_textdomain( $domain, $mofile ) load_textdomain Loads the theme's translated strings. If the current locale exists as a .mo file in the theme's root directory, it will be included in the translated strings by the $domain. The .mo files must be named based on the locale exactly, sv_SE.mo for example. load_theme_textdomain( $domain, $path ) load_theme_textdomain Send request to run cron through HTTP request that doesn't halt page loading. Will not run more than once every 60 seconds. spawn_cron( $local_time ); spawn_cron Un-schedules all previously-scheduled cron jobs using a particular hook name. wp_clear_scheduled_hook Run scheduled callbacks or spawn cron for all scheduled events. wp_cron() wp_cron Retrieve Cron schedule for hook with arguments. wp_get_schedule( $hook, $args ); wp_get_schedule Retrieve supported and filtered Cron recurrences. The supported recurrences are 'hourly', 'twicedaily', and 'daily'. A plugin may add more by hooking into the 'cron_schedules' filter. The filter accepts an array of arrays. The outer array has a key that is the name of the schedule or for example 'weekly'. The value is an array with two keys, one is 'interval' and the other is 'display'. The 'interval' is a number in seconds of when the cron job should run. So for 'hourly', the time is 3600 or 60*60. For weekly, the value would be 60*60*24*7 or 604800. The value of 'interval' would then be 604800. wp_get_schedules(); wp_get_schedules Returns the next timestamp for a cron event. $timestamp = wp_next_scheduled( $hook, $args ); wp_next_scheduled This function is used internally by WordPress to reschedule a recurring event. You'll likely never need to use this function manually, it is documented here for completeness. wp_reschedule_event Schedules a hook which will be executed by the WordPress actions core on a specific interval, specified by you. The action will trigger when someone visits your WordPress site, if the scheduled time has passed. See the Plugin API for a list of hooks. wp_schedule_event Schedules a hook which will be executed once by the WordPress actions core at a time which you specify. The action will fire off when someone visits your WordPress site, if the schedule time has passed. wp_schedule_single_event Un-schedules a previously-scheduled cron job. wp_unschedule_event Retrieve a modified URL (with) query string. You can rebuild the URL and append a new query variable to the URL query by using this function. You can also retrieve the full URL with query data. Adding a single key & value or an associative array. Setting a key value to false removes it from the query. Omitting the old query or the uri (second or third parameter) uses the $_SERVER value. add_query_arg( $param1, $param2, $old_query_or_uri ); add_query_arg The admin_url template tag retrieves the url to the admin area for the current site with the appropriate protocol, 'https' if is_ssl() and 'http' otherwise. If scheme is 'http' or 'https', is_ssl() is overridden. In case of WordPress Network setup, use network_admin_url() instead. admin_url( $path, $scheme ); admin_url Whether input is yes or no. Must be 'y' to be true. bool_from_yn( $yn ) bool_from_yn Set the headers for caching for 10 days with JavaScript content type. cache_javascript_headers() cache_javascript_headers The content_url template tag retrieves the url to the content area for the current site with the appropriate protocol, 'https' if is_ssl() and 'http' otherwise. content_url( $path ); content_url The get_bloginfo() function returns information about your site which can then be used elsewhere in your PHP code. This function, as well as bloginfo(), can also be used to display your site information. get_bloginfo Retrieve the number of database queries during the WordPress execution. echo get_num_queries(); get_num_queries Retrieve variable in the WP_Query class of the global $wp_query object. get_query_var( $var ) get_query_var The home_url template tag retrieves the home url for the current site with the appropriate protocol, 'https' if is_ssl() and 'http' otherwise. If scheme is 'http' or 'https', is_ssl() is overridden. In case of WordPress Network setup, use network_home_url() instead. home_url( $path, $scheme ); home_url The includes_url template tag retrieves the url to the includes area for the current site with the appropriate protocol, 'https' if is_ssl() and 'http' otherwise. includes_url( $path ); includes_url Test whether blog is already installed. The cache will be checked first. If you have a cache plugin, which saves the cache values, then this will work. If you use the default WordPress cache, and the database goes away, then you might have problems. Checks for the option siteurl for whether WordPress is installed. is_blog_installed() is_blog_installed Test if site is main site, given site id is_main_site( $blog_id ) is_main_site This function enables someone to hook into `pre_get_posts` and modify *only* the main query. This is a boolean function, meaning it returns either TRUE or FALSE. is_main_query(); is_main_query Checks if SSL is being used. is_ssl() is_ssl Logs messages to a file. You can log all atom actions within wordpress by simply calling this function log_app( $label, $msg) log_app Strip HTML and put links at the bottom of stripped content. Searches for all of the links, strips them out of the content, and places them at the bottom of the content with numbers. make_url_footnote( $content ) make_url_footnote Sets the headers to prevent caching for the different browsers. Different browsers support different nocache headers, so several headers must be sent so that all of them get the point that no caching should occur. nocache_headers() nocache_headers Removes an item or list from the query string. remove_query_arg( $key, $query ) remove_query_arg The site_url template tag retrieves the site url for the current site (where the WordPress core files) with the appropriate protocol, 'https' if is_ssl() and 'http' otherwise. If scheme is 'http' or 'https', is_ssl() is overridden. Use this to get the "wordpress address" as defined in general settings. Use home_url() to get the "site address" as defined in general settings. In case of WordPress Network setup, use network_site_url() instead. site_url( $path, $scheme ); site_url Set HTTP status header. status_header( $header ) status_header Setup the WordPress query. wp( $query_vars ) wp Retrieve the file type from the file name. You can optionally define the mime array, if needed. wp_check_filetype( $filename, $mimes ) wp_check_filetype This function can be replaced via plugins. If plugins do not redefine these functions, then this will be used instead. Clears the authentication cookie, logging the user out. This function is deprecated. Use wp_clear_auth_cookie() instead. wp_clearcookie(); wp_clearcookie Kill WordPress execution and display HTML message with error message. A call to this function complements the die() PHP function. The difference is that HTML will be displayed to the user. It is recommended to use this function only when the execution should not continue any further. It is not recommended to call this function very often and try to handle as many errors as possible silently. wp_die( $message, $title, $args ) wp_die Fire the 'wp_footer' action. Put this template tag immediately before "body" tag in a theme template (ex. footer.php, index.php). wp_footer This function can be replaced via plugins. If plugins do not redefine these functions, then this will be used instead. Gets the user cookie login. This function is deprecated and should no longer be extended as it won't be used anywhere in WordPress. Also, plugins shouldn't use it either. wp_get_cookie_login() wp_get_cookie_login Retrieve HTTP Headers from URL. wp_get_http_headers( $url, $deprecated ) wp_get_http_headers This function can be replaced via plugins. If plugins do not redefine these functions, then this will be used instead. Get hash of given string. wp_hash( $data, $scheme ) wp_hash Fire the 'wp_head' action. Put this template tag immediately before "head" tag in a theme template (ex. header.php, index.php). wp_head Send mail, similar to PHP's mail. The default sender name is "WordPress" and the default sender email address is wordpress@yoursite.com. These may be overridden by including a header like: wp_mail('test@test.com', 'subject', 'message', $headers, $attachments); wp_mail Recursive directory creation based on full path. Will attempt to set permissions on folders. wp_mkdir_p( $target ) wp_mkdir_p Notify the blog admin of a new user, normally via email and also send an email with login/password to the new user. This function can be replaced via plugins. If plugins do not redefine these functions, then this will be used instead. wp_new_user_notification( $user_id, $plaintext_pass ) wp_new_user_notification This function can be replaced via plugins. If plugins do not redefine these functions, then this will be used instead. Notifies the moderator of the blog about a new comment that is awaiting approval. wp_notify_moderator( $comment_id ) wp_notify_moderator This function can be replaced via plugins. If plugins do not redefine these functions, then this will be used instead. Sanitizes a URL for use in a redirect. wp_notify_postauthor( $comment_id, $comment_type ) wp_notify_postauthor wp_parse_args is a generic utility for merging together an array of arguments and an array of default values. It can also be given a URL query type string which will be converted into an array (i.e. "id=5&status=draft"). It is used throughout WordPress to avoid having to worry about the logic of defaults and input, and produces a stable pattern for passing arguments around. Functions like query_posts, wp_list_comments and get_terms are common examples of the simplifying power of wp_parse_args. Functions that have an $args based setting are able to infinitely expand the number of values that can potentially be passed into them, avoiding the annoyance of super-long function calls because there are too many arguments to keep track of, many of whose only function is to override usually-good defaults on rare occasions. wp_parse_args Redirects the user to a specified absolute URI. wp_redirect( $location, $status ); exit; wp_redirect After looping through a separate query, this function restores the $post global to the current post in the main query. wp_reset_postdata(); wp_reset_postdata This function destroys the previous query used on a custom Loop. Function should be called after The Loop to ensure conditional tags work as expected. wp_reset_query(); wp_reset_query Returns the contents of a remote URI. Tries to retrieve the HTTP content with fopen first and then using cURL, if fopen can't be used. wp_remote_fopen This function can be replaced via plugins. If plugins do not redefine these functions, then this will be used instead. Get salt to add to hashes to help prevent attacks. The secret key is located in two places: the database in case the secret key isn't defined in the second place, which is in the wp-config.php file. If you are going to set the secret key, then you must do so in the wp-config.php file. The secret key in the database is randomly generated and will be appended to the secret key that is in wp-config.php file in some instances. It is important to have the secret key defined or changed in wp-config.php. If you have installed WordPress 2.5 or later, then you will have the SECRET_KEY defined in the wp-config.php already. You will want to change the value in it because hackers will know what it is. If you have upgraded to WordPress 2.5 or later version from a version before WordPress 2.5, then you should add the constant to your wp-config.php file. Salting passwords helps against tools which has stored hashed values of common dictionary strings. The added values makes it harder to crack if given salt string is not weak. wp_salt( $scheme ) wp_salt This function can be replaced via plugins. If plugins do not redefine these functions, then this will be used instead. Sets the authentication cookies based User ID. The $remember parameter increases the time that the cookie will be kept. The default the cookie is kept without remembering is two days. When $remember is set, the cookies will be kept for 14 days or two weeks. wp_set_auth_cookie( $user_id, $remember, $secure ) wp_set_auth_cookie Create a file in the upload folder with given content. If there is an error, then the key 'error' will exist with the error message. If success, then the key 'file' will have the unique file path, the 'url' key will have the link to the new file. and the 'error' key will be set to false. This function will not move an uploaded file to the upload folder. It will create a new file with the content in $bits parameter. If you move the upload file, read the content of the uploaded file, and then you can give the filename and content to this function, which will add it to the upload folder. The permissions will be set on the new file automatically by this function. wp_upload_bits( $name, $deprecated, $bits, $time ) wp_upload_bits Returns an array of key => value pairs containing path information on the currently configured uploads directory. $upload_dir = wp_upload_dir(); wp_upload_dir Displays the amount of disk space used by a site. display_space_usage(); display_space_usage Add a user to the Super admin user list in WordPress Multisite grant_super_admin Remove a user from the Super admin user list in WordPress Multisite revoke_super_admin Add an option for a particular blog. add_blog_option Delete an option for a particular blog. delete_blog_option Get a full blog URL, given a domain and a path. get_blogaddress_by_domain Get a full blog URL, given a blog id. get_blogaddress_by_id Get a full blog URL, given a blog name. get_blogaddress_by_name Gets the details of the blog. get_blog_details Retrieve option value based on setting name and blog_id. If the option does not exist or does not have a value, then the return value will be false. This is useful to check whether you need to install an option and is commonly used during installation of plugin options and to test whether upgrading is required. There is a filter called 'blog_option_$option' with the $option being replaced with the option name. The filter takes two parameters. $value and $blog_id. It returns $value. The 'option_$option' filter in get_option() is not called. Uses apply_filters() Calls 'blog_option_$optionname' with the option name value. get_blog_option( $blog_id, $setting , $default ) get_blog_option Get a blog details field. get_blog_status Given a blog's (subdomain or directory) name, retrieve it's id. get_id_from_blogname Get a list of most recently updated blogs. get_last_updated Check if a particular blog is archived. is_archived Clear the blog details cache. refresh_blog_details Restore the current blog, after calling switch_to_blog() restore_current_blog Switch the current blog to a different blog. switch_to_blog(), is useful if you need to pull posts or other information from other blogs. You can switch back afterwards using restore_current_blog(). Things that aren't switched: switch_to_blog Update the 'archived' status of a particular blog. update_archived Update the details for a blog. Updates the blogs table for a given blog id. update_blog_details Update an option for a particular blog. update_blog_option Update a blog details field. update_blog_status( $blog_id, $pref, $value, $refresh ) update_blog_status Update the last_updated field for the current blog. wpmu_update_blogs_date(); wpmu_update_blogs_date Defines Multisite upload constants. ms_upload_constants(); ms_upload_constants Associates a user to a blog, with the ability to set access permission. add_user_to_blog( $blog_id, $user_id, $role ) add_user_to_blog Creates a new, empty blog. create_empty_blog Check whether a blogname is already taken. Used during the new site registration process to ensure that each blogname is unique. domain_exists( $domain, $path, $site_id ); domain_exists Whether to force SSL on content. force_ssl_content( $force ); force_ssl_content Get one of a user's active blogs Returns the user's primary blog, if she has one and it is active. If it's inactive, function returns another active blog of the user. If none are found, the user is added as a Subscriber to the Dashboard Blog and that blog is returned. get_active_blog_for_user( $user_id ); get_active_blog_for_user Get the admin for a domain/path combination. get_admin_users_for_domain( $sitedomain, $path ); get_admin_users_for_domain Gets post information. get_blog_post Gets the current site based on the value of the $current_site global variable. get_current_site(); get_current_site Get the "dashboard blog", the blog where users without a blog edit their profile data. get_dashboard_blog(); get_dashboard_blog Get the size of a directory. A helper function that is used primarily to check whether a blog has exceeded its allowed upload space. get_dirsize( $directory ); get_dirsize Get the most recent post of a user. Walks through each of a user's blogs to find the post with the most recent post_date_gmt. get_most_recent_post_of_user( $user_id ); get_most_recent_post_of_user Get a numeric user ID from either an email address or a login. If a number is sent to the function, that number is returned as the id. get_user_id_from_string( $string ); get_user_id_from_string Maintains a canonical list of terms by syncing terms created for each blog with the global terms table. global_terms( $term_id, $deprecated ); global_terms Store basic site info in the blogs table. This function creates a row in the wp_blogs table and returns the new blog's ID. It is the first step in creating a new blog. insert_blog( $domain, $path, $site_id ); insert_blog Install an empty blog. Creates the new blog tables and options. If calling this function directly, be sure to use switch_to_blog() first, so that $wpdb points to the new blog. install_blog( $blog_id, $blog_title ); install_blog Checks if the current user belong to a given blog. is_blog_user( $blog_id ); is_blog_user Checks an email address against a list of banned domains. This function checks against the Banned Email Domains list at wp-admin/network/settings.php. The check is only run on self-registrations; user creation at wp-admin/network/users.php bypasses this check. is_email_address_unsafe( $user_email ); is_email_address_unsafe Check to see whether a user is marked as a spammer, based on username is_user_spammy( $username ); is_user_spammy Notifies the network admin that a new site has been activated. Filter 'newblog_notify_siteadmin' to change the content of the notification email. newblog_notify_siteadmin( $blog_id, $deprecated ); newblog_notify_siteadmin Ensure that the current site's domain is listed in the allowed redirect host list. redirect_this_site( $deprecated ); redirect_this_site Update this blog's 'public' setting in the global blogs table. Public blogs have a setting of 1, private blogs are 0. update_blog_public( $old_value, $value ); update_blog_public Check whether users can self-register, based on Network settings. users_can_register_signup_filter(); users_can_register_signup_filter Ensure that the welcome message is not empty. Currently unused. welcome_user_msg_filter( $text ); welcome_user_msg_filter Creates a new blog (multisite). wpmu_create_blog Create a user using strict username sanitization: only alphanumeric, _, ., -, and/or @ are allowed. This function runs when a user self-registers as well as when a Super Admin creates a new user. Hook to 'wpmu_new_user' for events that should affect all new users, but only on Multisite (otherwise use 'user_register'). wpmu_create_user( $user_name, $password, $email ); wpmu_create_user Record user signup information for future activation. This function is used when user registration is open but new site registration is not. wpmu_signup_user( $user, $user_email, $meta ); wpmu_signup_user Notify user of signup success. This is the notification function used when no new site has been requested. Filter 'wpmu_signup_user_notification' to bypass this function or replace it with your own notification behavior. Filter 'wpmu_signup_user_notification_email' and 'wpmu_signup_user_notification_subject' to change the content and subject line of the email sent to newly registered users. wpmu_signup_user_notification( $user, $user_email, $key, $meta ); wpmu_signup_user_notification Notify a user that her account activation has been successful. Filter 'wpmu_welcome_user_notification' to disable or bypass. Filter 'update_welcome_user_email' and 'update_welcome_user_subject' to modify the content and subject line of the notification email. wpmu_welcome_user_notification( $user_id, $password, $meta ); wpmu_welcome_user_notification Gets the current site name based on the value of the $current_site global variable. get_current_site_name( $current_site ); get_current_site_name Whether a sub-domain configuration is enabled. This function was added in version 3.0.0. is_subdomain_install(); is_subdomain_install Displays a failure message. Used when a blog's tables do not exist. Checks for a missing $wpdb->site table as well. ms_not_installed(); ms_not_installed