You are on page 1of 443

Template Tags/Anatomy of a Template Tag Contents

1 Introduction 2 PHP code tag 3 WordPress function 4 Optional parameters 5 Further reading

Introduction
This document provides a brief examination of the animal known as the WordPress template tag, to help those who may be new to WordPress and PHP understand what template tags are and how they're used. A WordPress template tag is made up of three components: A PHP code tag A WordPress function Optional parameters These are explained below.

PHP code tag


WordPress is built with the PHP scripting language. Though you certainly don't need to be a PHP developer to use it, knowing a little about the language can go a long way in getting the most out of WordPress. Here we provide a tiny bit of that PHP knowledge: <?php ?> The above shows the opening (<?php) and closing (?>) tag elements used to embed PHP functions and code in a HTML document, i.e. web page. There are a number of ways to embed PHP within a page, but this is the most "portable," in that it works on nearly every web serveras long as the server supports PHP (typically a document's lename also needs to end with the extension .php, so the server recognizes it as a PHP document). Anything within this tag is parsed and handled by the PHP interpreter, which runs on the web server (the interpreter is the PHP engine that gures out what the various functions and code do, and returns their output). For our purposes, the PHP tag lets you place WordPress functions in your page template, and through these generate the dynamic portions of your blog.

WordPress function
A WordPress or template function is a PHP function that performs an action or displays information specic to your blog. And like a PHP function, a WordPress function is dened by a line of text (of one or more words, no spaces), open and close brackets (parentheses), and typically a semi-colon, used to end a code statement in PHP. An example of a WordPress function is: the_ID(); the_ID() displays the ID number for a blog entry or post. To use it in a page template, you slip it into the PHP tag shown above: <?php the_ID(); ?> This is now ofcially a WordPress template tag, as it uses the PHP tag with a WordPress function.

Optional parameters
The nal item making up a template tag is one you won't necessarily make use of unless you want to customize the tag's functionality. This, or rather these, are the parameters or arguments for a function. Here is the template function bloginfo(), with the show parameter being passed the 'name' value: <?php bloginfo('name'); ?> If your blog's name is Super Weblog, the bloginfo() template tag, when using 'name' as the show parameter value, will display that name where it's embedded in your page template. Not all template tags accept parameters (the_ID() is one), and those which do accept different ones based on their intended use, so that the_content() accepts parameters separate from those which get_calendar() can be passed.

Further reading
See the following Codex pages for more information on WordPress templates and template tags: Templates

How to Pass Tag Parameters Go to Template Tag index Retrieved from "http://codex.wordpress.org/Template_Tags/Anatomy_of_a_Template_Tag" Categories: Template Tags | Design and Layout | Advanced Topics

Template Tags/How to Pass Tag Parameters Contents


1 Introduction 2 Tags without parameters 3 Tags with PHP function-style parameters 4 Tags with query-string-style parameters 5 Types of parameters 5.1 String 5.2 Integer 5.3 Boolean

Introduction
Template tags are PHP functions you can embed in your WordPress page templates to provide dynamic blog content. And like PHP functions, many template tags accept arguments, or parameters. Template tag parameters are variables you can use to change a tag's output or otherwise modify its action in some way. Think of parameters as user options or settings that allow you to customize how a template tag works. In regards to parameters, WordPress template tags come in three "avors." These are described below: 1. Tags without parameters 2. Tags with PHP function-style parameters 3. Tags with query-string-style parameters

Tags without parameters


Some template tags do not have any options, and thus have no parameters you can pass to them. The template tag the_author_rstname() is one that accepts no parameters. This tag simply displays the rst name of the author for a post. Tags without parameters should have nothing between the tag function's opening and closing brackets (parentheses): <?php the_author_firstname(); ?>

Tags with PHP function-style parameters


For template tags that can accept parameters, some require them to be in the default PHP style. For these, parameters are passed to a tag function by placing one or more values inside the function's parentheses, or brackets. The bloginfo() tag accepts one parameter (known as the show parameter) that tells it what information about your blog to display: <?php bloginfo('name'); ?> The wp_title() tag accepts two parameters: the rst is the sep or separator parameter, and the second the echo or display parameter: <?php wp_title(' - ', TRUE); ?> The rst is enclosed in single-quotes and the second is not because the rst is a string, and the second a boolean parameter. (See Types of parameters for information on parameter types and how to use them.) Important points to keep in mind for PHP function-style parameters: Some functions take multiple parameters. Multiple parameters are separated by commas. The order of parameters is important! When passing parameters to a template tag's function, make sure you specify values for all parameters up to the last one you wish to modify, or the tag may not work as expected. For example, the template tag get_archives() has six parameters: <?php get_archives('type', 'limit', 'format', 'before', 'after', show_post_count); ?> To display the archives list the way you want, let's say you only need to modify the third (format) and fth (after) parameters. To do this, you also need to make sure to enter default values for the rst, second and fourth parameters, as well:

<?php get_archives( , , 'custom', , '<br />'); ?> Notice the use of single-quotes to denote empty parameter values, which in this case forces defaults for those specic parameters. Be aware that defaults can be overwritten when passing empty parameters, as is the case of a parameter specifying a string of text, and there's no way to pass an empty boolean value. So check the documentation for a parameter's default, and when one is specied use it as your parameter value (also see Types of parameters for information on parameter types). The sixth parameter was left off; this is because WordPress uses the default for any remaining parameters left unspecied. Make sure to follow the documentation for a template tag carefully, and place your parameters in the order the template function expects. Finally, to use the defaults for all parameters in a template tag, use the tag with no parameter values specied:

<?php get_archives(); ?>

Tags with query-string-style parameters


The last type of template tag makes use of what's called a query-string style to pass parameters to the tag. These provide a convenient 'wrapper' to tags which use the PHP function parameter style and have a relatively large number of parameters. For example, the template tag wp_list_cats() is a wrapper to list_cats(), a tag with eighteen parameters! If you want to set the exclude parameter in list_cats() (seventeenth in the parameter list) and leave the rest at their defaults, you have to do this: <?php list_cats(TRUE, 'All', 'ID', 'asc', '', TRUE, FALSE, FALSE, TRUE, TRUE, FALSE, '', '', FALSE, '', '', '10,11,12'); ?> Or you can use wp_list_cats(): <?php wp_list_cats('exclude=10,11,12'); ?> So query-string style tags are useful in that they let you change the values of just those parameters you require, without needing to provide values for all or nearly all of them. However, not all PHP function-style template tags have a query-string style equivalent. (Also note that names for tags that accept query-string style parameters usually start with a 'wp_' prex, such as wp_list_cats(), but check the documentation on a tag to verify its method for accepting parameters, if any.) The tag wp_list_authors() has six parameters, of which we set three here: <?php wp_list_authors('show_fullname=1&feed=rss&optioncount=1'); ?> First, all the parameters together are enclosed by either single or double quotes. Then each parameter is entered in the parameter=value format, while these are separated with an ampersand (&). Broken down, the tag as shown above states: Parameter show_fullname (a boolean type parameter) equals 1 (true). AND Parameter feed (a string type parameter) equals rss. AND Parameter optioncount (a boolean type parameter) equals 1 (true). (See Types of parameters for information on parameter types and how to use them.) Parameters in the query-string style do not have to be entered in a specic order. The only real concern is assuring parameter names are spelled correctly. If legibility is a problem, you can separate parameters with a space: <?php wp_list_authors('show_fullname=1 & feed=rss & optioncount=1'); ?> You can also spread a query-string over several lines (note the specic format of enclosing each parameter/value pair in single quotes and a dot starting each new line): <?php wp_list_authors( 'show_fullname=1' .'&feed=rss' .'&optioncount=1' ); ?> There are a few limitations when using query-string style tags, among which you cannot pass certain characters, such as the ampersand or a quote mark (single or double). In those cases, you can use an associative array: <?php $params = array( 'type' => 'postbypost',

'limit' 'format' 'before' 'after' wp_get_archives($params); ?>

=> => => =>

5, 'custom', '<li>&bull;&nbsp;', '</li>' );

Types of parameters
There are three types of parameters you need to know about in regards to WordPress template tags: string, integer, and boolean. Each is handled a bit differently, as described below.

String
A string is a line of text, and is typically anything from a single character to several dozen words. A string parameter is often a selection from two or more valid options, as is the show parameter in bloginfo(). Otherwise, a string is intended as text to be displayed, such as the sep parameter in wp_title(). In tags which use the PHP function parameter style, string values should be enclosed in single (') or double (") quotation marks. If a single or double quote is required for part of your string, mix the marks (using double quotes to enclose the parameter if a single quote exists in your parameter value), or use the PHP escape character (a backslash: \), as the following does to assign single quotes for the before and after parameters in the_title(): <?php the_title('\'', '\''); ?>

Integer
An integer is a whole number (, -2, -1, 0, 1, 2,). Integer parameters are often used for date and archive based information, like the year and month parameters for the get_month_link() tag, or for specifying the numeric value of something on your blog, as one nds in the case of the id parameter in get_permalink(). When passed to a PHP function parameter style tag, integer values either in or out of quotes will be handled correctly. So the following examples are both valid: <?php get_permalink('100'); ?> <?php get_permalink(100); ?>

Boolean
Boolean parameters provide a simple true/false evaluation. For example, the the_date() tag has an echo parameter which takes either TRUE or FALSE as a value; setting the parameter to TRUE displays the date on the page, whereas FALSE causes the tag to "return" the date as a value that can then be used in other PHP code. A boolean parameter can be notated as a numeric value: 1 for TRUE, 0 for FALSE. For a boolean value in PHP function parameter style tags, these are all equivalent: 1 = TRUE = true 0 = FALSE = false However, do NOT enclose boolean values within quote marks. For query-string style tags, use only the numeric boolean values (1 or 0). Go to Template Tag index Retrieved from "http://codex.wordpress.org/Template_Tags/How_to_Pass_Tag_Parameters" Categories: Template Tags | Advanced Topics

Template Tags/bloginfo Contents


1 Description 2 Usage 3 Examples 3.1 Show Blog Title 3.2 Show Character Set 3.3 Show Blog Description 4 Parameters 5 Related

Description

Displays information about your blog, mostly gathered from the information you supply in your User Prole and General Options from the WordPress Administration panels (Settings General). It can be used anywhere within a page template. This always prints a result to the browser. If you need the values for use in PHP, use get_bloginfo().

Usage
<?php bloginfo('show'); ?>

Examples
Show Blog Title
Displays your blog's title in a <h1> tag. <h1><?php bloginfo('name'); ?></h1>

Show Character Set


Displays the character set your blog is using (ex: utf-8) <p>Character set: <?php bloginfo('charset'); ?> </p>

Show Blog Description


Displays Tagline for your blog as set in the Administration panel under General Options. <p><?php bloginfo('description'); ?> </p>

Parameters
See get_bloginfo()

Related
bloginfo, bloginfo_rss, get_bloginfo, get_bloginfo_rss, wp_title, wp_get_archives, get_calendar, get_posts, wp_list_pages, wp_page_menu, wp_dropdown_pages, wp_loginout, wp_register, wp_logout_url, query_posts, rss_enclosure

How to pass parameters to tags Go to Template Tag index Retrieved from "http://codex.wordpress.org/Template_Tags/bloginfo" Category: Template Tags

Template Tags/bloginfo rss Contents


1 Description 2 Usage 3 Example 3.1 Show Blog Title and Link 4 Parameters 5 Related

Description
Displays information about your blog, mostly gathered from the information you supply in Users > Your Prole and General Options from the WordPress Administration Panels. This function is identical to bloginfo() except it strips any markup from the output for use in WordPress' syndication feeds.

Usage
<?php bloginfo_rss('show'); ?>

Example
Show Blog Title and Link
Displays blog name and url in title and link tags of RSS feed. <title><?php bloginfo_rss('name'); ?></title>

<link><?php bloginfo_rss('url') ?></link>

Parameters
show (string) Informational detail about your blog. Valid values: 'name' - Weblog title; set in General Options. (Default) 'description' - Tagline for your blog; set in General Options. 'url' - URL for your blog's web site address. 'rdf_url' - URL for RDF/RSS 1.0 feed. 'rss_url' - URL for RSS 0.92 feed. 'rss2_url' - URL for RSS 2.0 feed. 'atom_url' - URL for Atom feed. 'comments_rss2_url' - URL for comments RSS 2.0 feed. 'pingback_url' - URL for Pingback (XML-RPC le). 'admin_email' - Administrator's email address; set in General Options. 'charset' - Character encoding for your blog; set in Reading Options. 'version' - Version of WordPress your blog uses. The following work in WordPress version 1.5 or after: 'html_type' - "Content-type" for your blog. 'wpurl' - URL for WordPress installation. 'template_url' - URL for template in use. 'template_directory' - URL for template's directory. 'stylesheet_url' - URL for primary CSS le. 'stylesheet_directory' - URL for stylesheet directory.

Related
bloginfo, bloginfo_rss, get_bloginfo, get_bloginfo_rss, wp_title, wp_get_archives, get_calendar, get_posts, wp_list_pages, wp_page_menu, wp_dropdown_pages, wp_loginout, wp_register, wp_logout_url, query_posts, rss_enclosure

How to pass parameters to tags Go to Template Tag index Retrieved from "http://codex.wordpress.org/Template_Tags/bloginfo_rss" Categories: Template Tags | Feeds

Template Tags/cancel comment reply link Contents


1 Description 2 Usage 3 Example 4 Parameters 5 Related

Description
Displays a link which cancels the replying to a previous comment (a nested comment) and resets the comment form back to the default state.

Usage
<?php cancel_comment_reply_link('text'); ?>

Example
<?php cancel_comment_reply_link(); ?>

Parameters
text (string) Text to display as a link. Default is 'Click here to cancel reply.'

Related
Template_Tags/comment_reply_link

Migrating_Plugins_and_Themes_to_2.7/Enhanced_Comment_Display Retrieved from "http://codex.wordpress.org/Template_Tags/cancel_comment_reply_link"

Template Tags/category description Contents


1 Description 2 Usage 3 Examples 3.1 Default Usage 3.2 Using Category Slug 3.3 With Category Title 4 Parameters 5 Related

Description
Returns the description of a category.

Usage
<?php echo category_description($category); ?>

Examples
Default Usage
Displays the description of a category, given it's id, by echoing the return value of the tag. If no category given and used on a category page, it returns the description of the current category. <p><?php echo category_description(3); ?></p> Result: WordPress is a favorite blogging tool of mine and I share tips and tricks for using WordPress here. Note: if there is no category description, the function returns a br tag

Using Category Slug


Displays the description of a category, using a category slug. <?php echo category_description(get_category_by_slug('category-slug')->term_id); ?>

With Category Title


<p><strong><?php single_cat_title('Currently browsing'); ?> </strong>: <?php echo category_description(); ?></p> Result: Currently browsing WordPress: WordPress is a favorite blogging tool of mine and I share tips and tricks for using WordPress here.

Parameters
category (integer) The numeric ID of the category for which the tag is to return the description. Defaults to the current category, if one is not set.

Related
the_category, the_category_rss, single_cat_title, category_description, wp_dropdown_categories, wp_list_categories, in_category, get_category_parents, get_the_category get_category_link,

How to pass parameters to tags Go to Template Tag index Retrieved from "http://codex.wordpress.org/Template_Tags/category_description" Category: Template Tags

Template Tags/category nicename


This page is marked as incomplete. You can help Codex by expanding it.

Description
Displays the category slug (or category nicename) a post belongs to. Must be used within The Loop. Outputs sanitized version of category name: single_cat_title.

Usage
<?php $getcategory = $wp_query->get_queried_object(); $getcategory->category_nicename; ?>

Related
the_category, the_category_rss, single_cat_title, category_description, wp_dropdown_categories, wp_list_categories, in_category, get_category_parents, get_the_category get_category_link,

How to pass parameters to tags with PHP function-style parameters Go to Template Tag index Retrieved from "http://codex.wordpress.org/Template_Tags/category_nicename" Categories: Stubs | Template Tags

Template Tags/comment ID Contents


1 Description 2 Usage 3 Examples 3.1 Default Usage 3.2 Comment ID as Anchor ID 4 Parameters 5 Related

Description
Displays the numeric ID of a comment. This tag must be within The Loop, or a comment loop.

Usage
<?php comment_ID(); ?>

Examples
Default Usage
<p>This is comment <?php comment_ID(); ?> for all comments.</p>

Comment ID as Anchor ID
Uses the comment ID as an anchor id for a comment. <div id="comment-<?php comment_ID() ?>">Comment by <?php comment_author() ?>: </div> <div class="comment-text"><?php comment_text() ?></div>

Parameters
This tag has no parameters.

Related
comments_number, comments_link, comments_rss_link, comments_popup_script, comments_popup_link, comment_ID, comment_author, comment_author_IP, comment_author_email, comment_author_url, comment_author_email_link, comment_author_url_link,

comment_author_link, comment_type, comment_text, comment_excerpt, comment_date, comment_time, comments_rss_link, comment_author_rss, comment_text_rss, comment_link_rss, permalink_comments_rss, wp_list_comments, previous_comments_link, next_comments_link Go to Template Tag index Retrieved from "http://codex.wordpress.org/Template_Tags/comment_ID" Category: Template Tags

Template Tags/comment author Contents


1 Description 2 Usage 3 Example 4 Parameters 5 Related

Description
Displays the comment author name; that is, the one supplied by the commenter. If no name is provided (and "User must ll out name and email" is not enabled under Discussion Options), WordPress will assign "Anonymous" as comment author. This tag must be within The Loop, or a comment loop.

Usage
<?php comment_author(); ?>

Example
<div>Comment by <?php comment_author(); ?>:</div>

Parameters
This tag has no parameters.

Related
comments_number, comments_link, comments_rss_link, comments_popup_script, comments_popup_link, comment_ID, comment_author, comment_author_IP, comment_author_email, comment_author_url, comment_author_email_link, comment_author_url_link, comment_author_link, comment_type, comment_text, comment_excerpt, comment_date, comment_time, comments_rss_link, comment_author_rss, comment_text_rss, comment_link_rss, permalink_comments_rss, wp_list_comments, previous_comments_link, next_comments_link Go to Template Tag index Retrieved from "http://codex.wordpress.org/Template_Tags/comment_author" Category: Template Tags

Template Tags/comment author IP Contents


1 Description 2 Usage 3 Example 4 Parameters 5 Related

Description
Displays the comment author's IP address. This tag must be within The Loop, or a comment loop.

Usage
<?php comment_author_IP(); ?>

Example
<p>Posted from: <?php comment_author_IP(); ?></p>

Parameters
This tag has no parameters.

Related
comments_number, comments_link, comments_rss_link, comments_popup_script, comments_popup_link, comment_ID, comment_author, comment_author_IP, comment_author_email, comment_author_url, comment_author_email_link, comment_author_url_link, comment_author_link, comment_type, comment_text, comment_excerpt, comment_date, comment_time, comments_rss_link, comment_author_rss, comment_text_rss, comment_link_rss, permalink_comments_rss, wp_list_comments, previous_comments_link, next_comments_link Go to Template Tag index Retrieved from "http://codex.wordpress.org/Template_Tags/comment_author_IP" Category: Template Tags

Template Tags/comment author email Contents


1 Description 2 Usage 3 Example 4 Parameters 5 Related

Description
Displays the comment author's email address, not linked. An email address must be provided if "User must ll out name and email" is enabled under Discussion Options. This tag must be within The Loop, or a comment loop.

Usage
<?php comment_author_email(); ?>

Example
<a href="mailto:<?php comment_author_email(); ?>">contact <?php comment_author(); ?></a> (Note: Displaying email addresses is not recommended, as email spammers could collect them from your site.)

Parameters
This tag has no parameters.

Related
comments_number, comments_link, comments_rss_link, comments_popup_script, comments_popup_link, comment_ID, comment_author, comment_author_IP, comment_author_email, comment_author_url, comment_author_email_link, comment_author_url_link, comment_author_link, comment_type, comment_text, comment_excerpt, comment_date, comment_time, comments_rss_link, comment_author_rss, comment_text_rss, comment_link_rss, permalink_comments_rss, wp_list_comments, previous_comments_link, next_comments_link Go to Template Tag index Retrieved from "http://codex.wordpress.org/Template_Tags/comment_author_email" Category: Template Tags

Template Tags/comment author email link Contents


1 Description 2 Usage 3 Examples 3.1 Default Usage 3.2 Link Text and Styling 4 Parameters 5 Related

Description
Displays the comment author's email address, as a mailto link. An email address must be provided if "User must ll out name and email" is enabled under Discussion Options. This tag must be within The Loop, or a comment loop. Note: Displaying email addresses is not recommended, as it provides spam collection tools the opportunity to cull them from your site.

Usage
<?php comment_author_email_link('linktext', 'before', 'after'); ?>

Examples
Default Usage
email: <?php comment_author_email_link(); ?><br />

Link Text and Styling


Displays comment author's email link as text string Email Comment Author and adds arrows before and after the link to style it. <?php comment_author_email_link('Email Comment Author', ' > ', ' < '); ?> > Email Comment Author <

Parameters
linktext (string) Link text for the email link. Default is the comment author's email address. before (string) Text to display before the link. There is no default. after (string) Text to display after the link. There is no default.

Related
comments_number, comments_link, comments_rss_link, comments_popup_script, comments_popup_link, comment_ID, comment_author, comment_author_IP, comment_author_email, comment_author_url, comment_author_email_link, comment_author_url_link, comment_author_link, comment_type, comment_text, comment_excerpt, comment_date, comment_time, comments_rss_link, comment_author_rss, comment_text_rss, comment_link_rss, permalink_comments_rss, wp_list_comments, previous_comments_link, next_comments_link

How to pass parameters to tags with PHP function-style parameters Go to Template Tag index Retrieved from "http://codex.wordpress.org/Template_Tags/comment_author_email_link" Category: Template Tags

Template Tags/comment author link Contents


1 Description 2 Usage 3 Example 4 Parameters 5 Related

Description
Displays the comment author's name linked to his/her URL, if one was provided. This tag must be within The Loop, or a comment loop.

Usage
<?php comment_author_link(); ?>

Example
<p>Comment by: <?php comment_author_link(); ?></p>

Parameters
This tag has no parameters.

Related
comments_number, comments_link, comments_rss_link, comments_popup_script, comments_popup_link, comment_ID, comment_author, comment_author_IP, comment_author_email, comment_author_url, comment_author_email_link, comment_author_url_link, comment_author_link, comment_type, comment_text, comment_excerpt, comment_date, comment_time, comments_rss_link, comment_author_rss, comment_text_rss, comment_link_rss, permalink_comments_rss, wp_list_comments, previous_comments_link, next_comments_link Go to Template Tag index Retrieved from "http://codex.wordpress.org/Template_Tags/comment_author_link" Category: Template Tags

Template Tags/comment author rss Contents


1 Description 2 Usage 3 Example 4 Parameters 5 Related

Description
Displays the comment author's name formatted for RSS. Typically used in the RSS comment feed template. This tag must be within The Loop, or a comment loop.

Usage
<?php comment_author_rss(); ?>

Example
<title>comment by: <?php comment_author_rss() ?></title>

Parameters
This tag has no parameters.

Related
comments_number, comments_link, comments_rss_link, comments_popup_script, comments_popup_link, comment_ID, comment_author, comment_author_IP, comment_author_email, comment_author_url, comment_author_email_link, comment_author_url_link, comment_author_link, comment_type, comment_text, comment_excerpt, comment_date, comment_time, comments_rss_link, comment_author_rss, comment_text_rss, comment_link_rss, permalink_comments_rss, wp_list_comments, previous_comments_link, next_comments_link Go to Template Tag index Retrieved from "http://codex.wordpress.org/Template_Tags/comment_author_rss" Categories: Template Tags | Feeds

Template Tags/comment author url Contents


1 Description 2 Usage 3 Example 4 Parameters 5 Related

Description
Displays the comment author's URL (usually their web site), not linked. This tag must be within The Loop, or a comment loop.

If the author provided no URL, this will display the URL of the current page instead. The tag get_comment_author_url returns an empty string in this case.

Usage
<?php comment_author_url(); ?>

Example
Displays comment author's URL as a link, using comment author's name as part of the link text. <a href="<?php comment_author_url(); ?>">Visit <?php comment_author(); ?>'s site</a>

Parameters
This tag has no parameters.

Related
comments_number, comments_link, comments_rss_link, comments_popup_script, comments_popup_link, comment_ID, comment_author, comment_author_IP, comment_author_email, comment_author_url, comment_author_email_link, comment_author_url_link, comment_author_link, comment_type, comment_text, comment_excerpt, comment_date, comment_time, comments_rss_link, comment_author_rss, comment_text_rss, comment_link_rss, permalink_comments_rss, wp_list_comments, previous_comments_link, next_comments_link Go to Template Tag index Retrieved from "http://codex.wordpress.org/Template_Tags/comment_author_url" Category: Template Tags

Template Tags/comment author url link Contents


1 Description 2 Usage 3 Examples 3.1 Default Usage 3.2 Link Text and Styling 4 Parameters 5 Related

Description
Displays the comment author's URL (usually their web site), linked, if one was provided. This tag must be within The Loop, or a comment loop.

Usage
<?php comment_author_url_link('linktext', 'before', 'after'); ?>

Examples
Default Usage
web site: <?php comment_author_url_link(); ?><br />

Link Text and Styling


Displays comment author's URL as text string Visit Site of Comment Author and adds bullets before and after the link to style it. <?php comment_author_url_link('Visit Site of Comment Author', ' &bull; ', ' &bull; '); ?> Visit Site of Comment Author

Parameters
linktext (string) Link text for the link. Default is the comment author's URL. before (string) Text to display before the link. There is no default.

after (string) Text to display after the link. There is no default.

Related
comments_number, comments_link, comments_rss_link, comments_popup_script, comments_popup_link, comment_ID, comment_author, comment_author_IP, comment_author_email, comment_author_url, comment_author_email_link, comment_author_url_link, comment_author_link, comment_type, comment_text, comment_excerpt, comment_date, comment_time, comments_rss_link, comment_author_rss, comment_text_rss, comment_link_rss, permalink_comments_rss, wp_list_comments, previous_comments_link, next_comments_link

How to pass parameters to tags with PHP function-style parameters Go to Template Tag index Retrieved from "http://codex.wordpress.org/Template_Tags/comment_author_url_link" Category: Template Tags

Template Tags/comment date Contents


1 Description 2 Usage 3 Example 4 Parameters 5 Related

Description
Displays the date a comment was posted. This tag must be within The Loop, or a comment loop.

Usage
<?php comment_date('d'); ?>

Example
Displays the comment date in the format "6-30-2004": Comment posted on <?php comment_date('n-j-Y'); ?>

Parameters
d (string) Formatting for the date. Defaults to the date format set in WordPress. See Formatting Date and Time.

Related
comments_number, comments_link, comments_rss_link, comments_popup_script, comments_popup_link, comment_ID, comment_author, comment_author_IP, comment_author_email, comment_author_url, comment_author_email_link, comment_author_url_link, comment_author_link, comment_type, comment_text, comment_excerpt, comment_date, comment_time, comments_rss_link, comment_author_rss, comment_text_rss, comment_link_rss, permalink_comments_rss, wp_list_comments, previous_comments_link, next_comments_link

How to pass parameters to tags Go to Template Tag index Retrieved from "http://codex.wordpress.org/Template_Tags/comment_date" Category: Template Tags

Template Tags/comment excerpt Contents


1 Description 2 Usage 3 Example

4 Parameters 5 Related

Description
Displays an excerpt (maximum of 20 words) of a comment's text. This tag must be within The Loop, or a comment loop. This tag will work within a comment loop.

Usage
<?php comment_excerpt(); ?>

Example
<p>Latest comment: <?php comment_excerpt(); ?></p>

Parameters
This tag has no parameters.

Related
comments_number, comments_link, comments_rss_link, comments_popup_script, comments_popup_link, comment_ID, comment_author, comment_author_IP, comment_author_email, comment_author_url, comment_author_email_link, comment_author_url_link, comment_author_link, comment_type, comment_text, comment_excerpt, comment_date, comment_time, comments_rss_link, comment_author_rss, comment_text_rss, comment_link_rss, permalink_comments_rss, wp_list_comments, previous_comments_link, next_comments_link Go to Template Tag index Retrieved from "http://codex.wordpress.org/Template_Tags/comment_excerpt" Category: Template Tags

Template Tags/comment form title Contents


1 Description 2 Usage 3 Example 4 Parameters 5 Related

Description
Displays text based on comment reply status. This only affects users with Javascript disabled or pages without the comment-reply.js JavaScript loaded. This tag is normally used directly below <div id="respond"> and before the comment form.

Usage
<?php comment_form_title('noreplytext', 'replytext', 'linktoparent' ); ?>

Example
<h3><?php comment_form_title(); ?></h3> <h3><?php comment_form_title( 'Leave a Reply', 'Leave a Reply to %s' ); ?></h3>

Parameters
noreplytext (string) Optional. Text to display when not replying to a comment. Default is 'Leave a Reply' replytext (string) Optional. Text to display when replying to a comment. Accepts "%s" for the author of the comment being replied to. Default is 'Leave a Reply to %s' linktoparent (boolean) Optional. Boolean to control making the author's name a link to their comment. Default is TRUE.

Related
Migrating_Plugins_and_Themes_to_2.7/Enhanced_Comment_Display

Retrieved from "http://codex.wordpress.org/Template_Tags/comment_form_title"

Template Tags/comment link rss Contents


1 Description 2 Usage 3 Example 4 Parameters 5 Related

Description
Displays the URL to an entry's comments formatted for RSS. Typically used in the RSS comment feed template. This tag must be within The Loop, or a comment loop.

Usage
<?php comment_link_rss(); ?>

Example
<link><?php comment_link_rss() ?></link>

Parameters
This tag has no parameters.

Related
comments_number, comments_link, comments_rss_link, comments_popup_script, comments_popup_link, comment_ID, comment_author, comment_author_IP, comment_author_email, comment_author_url, comment_author_email_link, comment_author_url_link, comment_author_link, comment_type, comment_text, comment_excerpt, comment_date, comment_time, comments_rss_link, comment_author_rss, comment_text_rss, comment_link_rss, permalink_comments_rss, wp_list_comments, previous_comments_link, next_comments_link Go to Template Tag index Retrieved from "http://codex.wordpress.org/Template_Tags/comment_link_rss" Categories: Template Tags | Feeds

Template Tags/comment reply link Description


Displays a link that lets users post a comment in reply to a specic comment. If JavaScript is enabled and the comment-reply.js JavaScript is loaded the link moves the comment form to just below the comment.

Usage
<?php comment_reply_link(array_merge( $args, array('reply_text' => 'Reply', 'add_below' => $add_below, 'depth' => $depth, 'max_depth' => $args['max_depth']))); ?>

Related
cancel_comment_reply_link Migrating_Plugins_and_Themes_to_2.7/Enhanced_Comment_Display Retrieved from "http://codex.wordpress.org/Template_Tags/comment_reply_link"

Template Tags/comment text Contents


1 Description 2 Usage 3 Example 4 Parameters 5 Related

Description

Displays the text of a comment. This tag must be within The Loop, or a comment loop.

Usage
<?php comment_text(); ?>

Example
Displays the comment text with the comment author in a list (<li>) tag. <li>Comment by <?php comment_author(); ?>:<br /> <?php comment_text(); ?></li>

Parameters
This tag has no parameters.

Related
comments_number, comments_link, comments_rss_link, comments_popup_script, comments_popup_link, comment_ID, comment_author, comment_author_IP, comment_author_email, comment_author_url, comment_author_email_link, comment_author_url_link, comment_author_link, comment_type, comment_text, comment_excerpt, comment_date, comment_time, comments_rss_link, comment_author_rss, comment_text_rss, comment_link_rss, permalink_comments_rss, wp_list_comments, previous_comments_link, next_comments_link Go to Template Tag index Retrieved from "http://codex.wordpress.org/Template_Tags/comment_text" Category: Template Tags

Template Tags/comment text rss Contents


1 Description 2 Usage 3 Example 4 Parameters 5 Related

Description
Displays the text of a comment formatted for RSS. Typically used in the RSS comment feed template. This tag must be within The Loop, or a comment loop.

Usage
<?php comment_text_rss(); ?>

Example
<description><?php comment_text_rss() ?></description>

Parameters
This tag has no parameters.

Related
comments_number, comments_link, comments_rss_link, comments_popup_script, comments_popup_link, comment_ID, comment_author, comment_author_IP, comment_author_email, comment_author_url, comment_author_email_link, comment_author_url_link, comment_author_link, comment_type, comment_text, comment_excerpt, comment_date, comment_time, comments_rss_link, comment_author_rss, comment_text_rss, comment_link_rss, permalink_comments_rss, wp_list_comments, previous_comments_link, next_comments_link Go to Template Tag index Retrieved from "http://codex.wordpress.org/Template_Tags/comment_text_rss" Categories: Template Tags | Feeds

Template Tags/comment time

Contents
1 Description 2 Usage 3 Example 4 Parameters 5 Related

Description
Displays the time a comment was posted. This tag must be within The Loop, or a comment loop.

Usage
<?php comment_time('d'); ?>

Example
Dsiplays the comment time in the format "22:04:11". <p>comment timestamp: <?php comment_time('H:i:s'); ?></p>

Parameters
d (string) Formatting for the time. Defaults to the time format set in WordPress. See Formatting Date and Time.

Related
comments_number, comments_link, comments_rss_link, comments_popup_script, comments_popup_link, comment_ID, comment_author, comment_author_IP, comment_author_email, comment_author_url, comment_author_email_link, comment_author_url_link, comment_author_link, comment_type, comment_text, comment_excerpt, comment_date, comment_time, comments_rss_link, comment_author_rss, comment_text_rss, comment_link_rss, permalink_comments_rss, wp_list_comments, previous_comments_link, next_comments_link

How to pass parameters to tags Go to Template Tag index Retrieved from "http://codex.wordpress.org/Template_Tags/comment_time" Category: Template Tags

Template Tags/comment type Contents


1 Description 2 Usage 3 Example 4 Parameters 5 Related

Description
Displays the type of comment (regular comment, Trackback or Pingback) a comment entry is. This tag must be within The Loop, or a comment loop.

Usage
<?php comment_type('comment', 'trackback', 'pingback'); ?>

Example
<p><?php comment_type(); ?> to <?php the_title(); ?>: </p>

Parameters
comment (string) Text to describe a comment type comment. Defaults to 'Comment'. trackback

(string) Text to describe a Trackback type comment. Defaults to 'Trackback'. pingback (string) Text to describe a Pingback type comment. Defaults to 'Pingback'.

Related
comments_number, comments_link, comments_rss_link, comments_popup_script, comments_popup_link, comment_ID, comment_author, comment_author_IP, comment_author_email, comment_author_url, comment_author_email_link, comment_author_url_link, comment_author_link, comment_type, comment_text, comment_excerpt, comment_date, comment_time, comments_rss_link, comment_author_rss, comment_text_rss, comment_link_rss, permalink_comments_rss, wp_list_comments, previous_comments_link, next_comments_link

How to pass parameters to tags with PHP function-style parameters Go to Template Tag index Retrieved from "http://codex.wordpress.org/Template_Tags/comment_type" Category: Template Tags

Template Tags/comments link Contents


1 Description 2 Usage 3 Example 4 Parameters 5 Related

Description
Displays the URL to a post's comments. This tag must be within The Loop, or the loop set up for comments.

Usage
<?php comments_link(); ?>

Example
<a href="<?php comments_link(); ?>"> Comments to this post </a>

Parameters
This tag has no parameters.

Related
comments_number, comments_link, comments_rss_link, comments_popup_script, comments_popup_link, comment_ID, comment_author, comment_author_IP, comment_author_email, comment_author_url, comment_author_email_link, comment_author_url_link, comment_author_link, comment_type, comment_text, comment_excerpt, comment_date, comment_time, comments_rss_link, comment_author_rss, comment_text_rss, comment_link_rss, permalink_comments_rss, wp_list_comments, previous_comments_link, next_comments_link

How to pass parameters to tags with PHP function-style parameters Go to Template Tag index Retrieved from "http://codex.wordpress.org/Template_Tags/comments_link" Category: Template Tags

Template Tags/comments number Contents


1 Description 2 Usage 3 Examples

3.1 Text Response to Number of Comments 4 Parameters 5 Related

Description
Displays the total number of comments, Trackbacks, and Pingbacks for a post. This tag must be within The Loop.

Usage
<?php comments_number('zero', 'one', 'more'); ?>

Examples
Text Response to Number of Comments
Displays text based upon number of comments: Comment count zero - no reponses; comment count one - one response; more than one comment (total 42) displays 42 responses. <p>This post currently has <?php comments_number('no responses','one response','% responses'); ?>.</p>

Parameters
zero (string) Text to display when there are no comments. Defaults to 'No Comments'. one (string) Text to display when there is one comment. Defaults to '1 Comment'. more (string) Text to display when there is more than one comment. % is replaced by the number of comments, so '% so far' is displayed as "5 so far" when there are ve comments. Defaults to '% Comments'.

Related
comments_number, comments_link, comments_rss_link, comments_popup_script, comments_popup_link, comment_ID, comment_author, comment_author_IP, comment_author_email, comment_author_url, comment_author_email_link, comment_author_url_link, comment_author_link, comment_type, comment_text, comment_excerpt, comment_date, comment_time, comments_rss_link, comment_author_rss, comment_text_rss, comment_link_rss, permalink_comments_rss, wp_list_comments, previous_comments_link, next_comments_link

How to pass parameters to tags with PHP function-style parameters Go to Template Tag index Retrieved from "http://codex.wordpress.org/Template_Tags/comments_number" Category: Template Tags

Template Tags/comments popup link Contents


1 Description 2 Usage 3 Examples 3.1 Text Response for Number of Comments 3.2 Hide Comment Link When Comments Are Deactivated 4 Parameters 5 Related

Description
Displays a link to the comments popup window if comments_popup_script() is used, otherwise it displays a normal link to comments. This tag must be within The Loop, or a comment loop, and it does nothing if is_single() or is_page() is true (even when within The Loop).

Usage
<?php comments_popup_link ('zero','one','more','CSSclass','none'); ?>

Examples

Text Response for Number of Comments


Displays the comments popup link, using "No comments yet" for no comments, "1 comment so far" for one, "% comments so far (is that a lot?)" for more than one (% replaced by # of comments), and "Comments are off for this post" if commenting is disabled. Additionally, 'comments-link' is a custom CSS class for the link. <p><?php comments_popup_link('No comments yet', '1 comment so far', '% comments so far (is that a lot?)', 'comments-link', 'Comments are off for this post'); ?></p>

Hide Comment Link When Comments Are Deactivated


Hides the paragraph element <p></p> that contains the comments_popup_link when comments are deactivated in the Write>Post screen. Good for those who want enable/disable comments post by post. Must be used in the loop. <?php if ( comments_open() ) : ?> <p> <?php comments_popup_link( 'No comments yet', '1 comment', '% comments so far', 'comments-link', 'Comments are off for this post'); ?> </p> <?php endif; ?>

Parameters
zero (string) Text to display when there are no comments. Defaults to 'No Comments'. one (string) Text to display when there is one comment. Defaults to '1 Comment'. more (string) Text to display when there are more than one comments. '%' is replaced by the number of comments, so '% so far' is displayed as "5 so far" when there are ve comments. Defaults to '% Comments'. CSSclass (string) CSS (stylesheet) class for the link. This has no default value. none (string) Text to display when comments are disabled. Defaults to 'Comments Off'.

Related
comments_number, comments_link, comments_rss_link, comments_popup_script, comments_popup_link, comment_ID, comment_author, comment_author_IP, comment_author_email, comment_author_url, comment_author_email_link, comment_author_url_link, comment_author_link, comment_type, comment_text, comment_excerpt, comment_date, comment_time, comments_rss_link, comment_author_rss, comment_text_rss, comment_link_rss, permalink_comments_rss, wp_list_comments, previous_comments_link, next_comments_link

How to pass parameters to tags with PHP function-style parameters Go to Template Tag index Retrieved from "http://codex.wordpress.org/Template_Tags/comments_popup_link" Category: Template Tags

Template Tags/comments popup script Contents


1 Description 2 Usage 3 Example 4 Parameters 5 Related

Description
Outputs the JavaScript code for a comments popup window. Used in tandem with comments_popup_link(), this tag can be used anywhere within a template, though is typically placed within the <head> portion of a page.

Usage
<?php comments_popup_script(width, height); ?>

Example

Sets the popup window's width to 400 pixels, and height to 500 pixels. <?php comments_popup_script(400, 500); ?>

Parameters
width (integer) The width of the popup window. Defaults to 400 (pixels). height (integer) The height of the popup window. Defaults to 400 (pixels).

Related
comments_number, comments_link, comments_rss_link, comments_popup_script, comments_popup_link, comment_ID, comment_author, comment_author_IP, comment_author_email, comment_author_url, comment_author_email_link, comment_author_url_link, comment_author_link, comment_type, comment_text, comment_excerpt, comment_date, comment_time, comments_rss_link, comment_author_rss, comment_text_rss, comment_link_rss, permalink_comments_rss, wp_list_comments, previous_comments_link, next_comments_link

How to pass parameters to tags with PHP function-style parameters Go to Template Tag index Retrieved from "http://codex.wordpress.org/Template_Tags/comments_popup_script" Category: Template Tags

Template Tags/comments rss link Contents


1 Description 2 Usage 3 Example 4 Parameters 5 Related

Description
This function has been deprecated, please use post_comments_feed_link(). Much like an RSS feed for your WordPress blog, this feature will display a link to the RSS feed for a given post's comments. By implementing the feature, your readers will be able to track the comment thread for a given post, perhaps encouraging them to stay connected to the conversation. This tag must be within The Loop, or the loop set up for comments.

Usage
<?php comments_rss_link('text', 'file'); ?>

Example
Displays the link to the comment's RSS feed, using "comment feed" as the link text. <?php comments_rss_link('comment feed'); ?>

Parameters
'text' (string) Link text for the comments RSS link. Defaults to 'Comments RSS'. 'le' (string) The le the link points to. Defaults to 'wp-commentsrss2.php'.

Related
comments_number, comments_link, comments_rss_link, comments_popup_script, comments_popup_link, comment_ID, comment_author, comment_author_IP, comment_author_email, comment_author_url, comment_author_email_link, comment_author_url_link, comment_author_link, comment_type, comment_text, comment_excerpt, comment_date, comment_time, comments_rss_link, comment_author_rss, comment_text_rss, comment_link_rss, permalink_comments_rss, wp_list_comments, previous_comments_link, next_comments_link

How to pass parameters to tags with PHP function-style parameters Go to Template Tag index Retrieved from "http://codex.wordpress.org/Template_Tags/comments_rss_link" Categories: Template Tags | Feeds

Template Tags/dropdown cats


This function has been deprecated. That means it has been replaced by a new function or is no longer supported, and may be removed from future versions. All code that uses this function should be converted to use its replacement if one exists.

Contents
1 Description 2 Replace With 3 Usage 4 Examples 4.1 Dropdown with Submit Button 4.2 Dropdown without Submit Button 5 Parameters 6 Fixes 7 Related

Description
Displays a list of categories in a select (i.e dropdown) box.

Replace With
wp_dropdown_categories().

Usage
<?php dropdown_cats(optionall, 'all', 'sort_column','sort_order', optiondates, optioncount, hide_empty, optionnone, selected, hide); ?>

Examples
Dropdown with Submit Button
Displays category select (dropdown) list in HTML form with a submit button, in a WordPress sidebar unordered list. <li id="categories"><?php _e('Categories:'); ?> <ul><li> <form action="<?php echo $PHP_SELF ?>" method="get"> <?php dropdown_cats(); ?> <input type="submit" name="submit" value="view" /> </form> </li></ul> </li>

Dropdown without Submit Button


Displays category select (dropdown) in HTML form without a submit button. Download and install the plugin Drop Down Categories found here. Add the following code to your header.php template le: <script type="text/JavaScript"> <!-- function MM_jumpMenu(targ,selObj,restore){ //v3.0 eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'"); if (restore) selObj.selectedIndex=0; } //--> </script> Then add the following code to wherever you'd like the dropdown categories to be displayed (for example, your sidebar.php le): <form action="">

<select name="menu" onchange="MM_jumpMenu('parent',this,0)"> <option>Choose one</option> <?php dropdown_cats_exclude('name', 'asc'); ?> </select> </form>

Parameters
optionall (boolean) Sets whether to have an option to display all categories. Valid values: TRUE (Default) FALSE all (string) Text to display for the option to display all categories. Defaults to 'All'. sort_column (string) Key to sort options by. Valid values: 'ID' (Default) 'name' sort_order (string) Sort order for options. Valid values: 'asc' (Default) 'desc' optiondates (boolean) Sets whether to display the date of the last post in each category. Valid values: TRUE FALSE (Default) optioncount (boolean) Sets whether to display a count of posts in each category. Valid values: TRUE FALSE (Default) hide_empty (boolean) Sets whether to hide (not display) categories with no posts. Valid values: TRUE (Default) FALSE optionnone (boolean) Sets whether to have an option to display none of the categories. Valid values: TRUE FALSE (Default) selected (integer) Sets the default selected category ID number. Defaults to current category. hide (integer) Do not display this category (specied by category ID number). There is no default.

Fixes
When you choose a category when you are not on the main page, you will not move to that category. To x this nd the following line in the template where you are using Dropdown cats. <form action="<?php echo $PHP_SELF ?>" method="get"> Replace it with : <form action="<?bloginfo('url');?>/index.php" method="get"> This is a temporary x to the problem, a real x will probably come soon. This problem is usually only found on blogs using Apache Rewrite rules. (Added by Chenu J, minor edit by Derek Scruggs)

Related
the_category, the_category_rss, single_cat_title, category_description, wp_dropdown_categories, wp_list_categories, in_category, get_category_parents, get_the_category get_category_link,

How to pass parameters to tags with PHP function-style parameters Go to Template Tag index

Retrieved from "http://codex.wordpress.org/Template_Tags/dropdown_cats" Category: Template Tags

Template Tags/edit comment link Contents


1 Description 2 Usage 3 Examples 3.1 Default Usage 3.2 Displays Edit Comment in Paragraph Tag 4 Parameters 5 Related

Description
Displays a link to edit the current comment, if the user is logged in and allowed to edit the comment. It must be within The Loop, and within a comment loop.

Usage
<?php edit_comment_link('link', 'before', 'after'); ?>

Examples
Default Usage
Displays edit comment link using defaults. <?php edit_comment_link(); ?>

Displays Edit Comment in Paragraph Tag


Displays edit comment link, with link text "edit comment", in a paragraph (<p>) tag. <?php edit_comment_link('edit comment', '<p>', '</p>'); ?>

Parameters
link (string) The link text. Defaults to 'Edit This'. before (string) Text to put before the link text. There is no default. after (string) Text to put after the link text. There is no default.

Related
edit_post_link, edit_comment_link, link_pages, wp_link_pages, get_year_link, get_month_link, get_day_link

How to pass parameters to tags with PHP function-style parameters Go to Template Tag index Retrieved from "http://codex.wordpress.org/Template_Tags/edit_comment_link" Category: Template Tags

Template Tags/edit post link Contents


1 Description 2 Usage 3 Examples 3.1 Default Usage 3.2 Display Edit in Paragraph Tag 4 Parameters 5 Related

Description

Displays a link to edit the current post, if a user is logged in and allowed to edit the post. It must be within The Loop.

Usage
<?php edit_post_link('link', 'before', 'after'); ?>

Examples
Default Usage
Displays edit post link using defaults. <?php edit_post_link(); ?>

Display Edit in Paragraph Tag


Displays edit post link, with link text "edit", in a paragraph (<p>) tag. <?php edit_post_link('edit', '<p>', '</p>'); ?>

Parameters
link (string) The link text. Defaults to 'Edit This'. before (string) Text to put before the link text. There is no default. after (string) Text to put after the link text. There is no default.

Related
edit_post_link, edit_comment_link, link_pages, wp_link_pages, get_year_link, get_month_link, get_day_link

How to pass parameters to tags with PHP function-style parameters Go to Template Tag index Retrieved from "http://codex.wordpress.org/Template_Tags/edit_post_link" Category: Template Tags

Template Tags/get archives


This function has been deprecated. That means it has been replaced by a new function or is no longer supported, and may be removed from future versions. All code that uses this function should be converted to use its replacement if one exists.

Contents
1 Description 2 Replace With 3 Usage 4 Examples 4.1 Default Usage 4.2 By Month with Post Count 4.3 Displays Last 10 Posts In A List 4.4 Using Dropdown List 4.5 List of Limited Number of Recent Posts 5 Parameters 6 Related

Description
Displays a list of links to date-based archives. This tag can be used anywhere within a template. It is similar to wp_get_archives().

Replace With
wp_get_archives().

Usage
<?php get_archives('type', 'limit', 'format', 'before', 'after', show_post_count); ?>

Examples
Default Usage
Displays archive links using defaults. <?php get_archives(); ?>

By Month with Post Count


Displays all archives by month in an unordered list, with count of posts by month. <ul> <?php get_archives('monthly', '', 'html', '', '', TRUE); ?> </ul>

Displays Last 10 Posts In A List


Displays a non-bulleted list of the last 10 posts separated by line breaks. <?php get_archives('postbypost', '10', 'custom', '', '<br />'); ?>

Using Dropdown List


Displays monthly archives in a dropdown list; the use of javascript is required to have an archive selection open on the page. <form id="archiveform" action=""> <select name="archive_chrono" onchange="window.location = (document.forms.archiveform.archive_chrono[document.forms.archiveform.archive_chrono.selectedIndex].value);"> <option value=''>Select Month</option> <?php get_archives('monthly','','option'); ?> </select> </form> You also can use piece of code below, that works better than the example above. It shows the months list, including the number of posts/month. <select name="archivemenu" onChange="document.location.href=this.options[this.selectedIndex].value;"> <option value="">Select month</option> <?php get_archives('monthly',,'option',,,'TRUE'); ?> </select>

List of Limited Number of Recent Posts


Displays a custom number of recent posts in an unordered list. <ul><?php get_archives('postbypost','10','custom','<li>','</li>'); ?></ul>

Parameters
type (string) The type of archive list to display. Defaults to WordPress setting (defaults to 'monthly' in 1.5). Valid values: 'monthly' (Default) 'daily' 'weekly' 'postbypost' limit (integer) Number of archives to get. Use '' for no limit. format (string) Format for the archive list. Valid values: 'html' - In HTML list (<li>) tags. This is the default. 'option' - In select or dropdown option (<option>) tags. 'link' - Within link (<link>) tags. 'custom' - Custom list.

before (string) Text to place before the link when using 'custom' or 'html' for format option. Defaults to ''. after (string) Text to place after the link when using 'custom' or 'html' for format option. Defaults to ''. show_post_count (boolean) Display number of posts in an archive (TRUE) or do not (FALSE). For use when type is set to 'monthly'. Defaults to FALSE.

Related
To use the query string to pass parameters to generate an archive list, see wp_get_archives() bloginfo, bloginfo_rss, get_bloginfo, get_bloginfo_rss, wp_title, wp_get_archives, get_calendar, get_posts, wp_list_pages, wp_page_menu, wp_dropdown_pages, wp_loginout, wp_register, wp_logout_url, query_posts, rss_enclosure

How to pass parameters to tags with PHP function-style parameters Go to Template Tag index Retrieved from "http://codex.wordpress.org/Template_Tags/get_archives" Category: Template Tags

Template Tags/get bloginfo Contents


1 Description 2 Usage 3 Examples 3.1 Default Usage 3.2 Blog Title 3.3 Blog Tagline 3.4 Template Directory 3.5 Example output 4 Parameters 5 Related

Description
The get_bloginfo() Template Tag returns information about your blog which can then be used elsewhere in your PHP code. This Template Tag, as well as bloginfo(), can also be used to display your blog information.

Usage
<?php get_bloginfo('show'); ?>

Examples
Default Usage
The default usage assigns your blog's title to the variable $blog_title. <?php $blog_title = get_bloginfo(); ?>

Blog Title
This example assign your blog's title to the variable $blog_title. This returns the same result as the default usage. <?php $blog_title = get_bloginfo('name'); ?>

Blog Tagline
Using this example: <?php echo 'Your Blog Tagline is: ' . get_bloginfo ( 'description' ); results in this being displayed on your blog: Your Blog Tagline is: All things WordPress ?>

Template Directory

Returns template directory URL to the active theme. This this example the information is used to include a custom template called searchform.php'. <?php include(get_bloginfo('template_directory') . '/searchform.php'); ?>

Example output
From version 2.7. On host example, the WordPress home page (Blog address) is shown at /home/, and the WordPress application (WordPress address) is installed at /home/wp/. Note that directory URLs are missing trailing slashes. admin_email = admin@example atom_url = http://example/home/feed/atom charset = UTF-8 comments_atom_url = http://example/home/comments/feed/atom comments_rss2_url = http://example/home/comments/feed description = Just another WordPress blog home = http://example/home html_type = text/html language = en-US name = Testpilot pingback_url = http://example/home/wp/xmlrpc.php rdf_url = http://example/home/feed/rdf rss2_url = http://example/home/feed rss_url = http://example/home/feed/rss siteurl = http://example/home stylesheet_directory = http://example/home/wp-content/themes/largo stylesheet_url = http://example/home/wp-content/themes/largo/style.css template_directory = http://example/home/wp-content/themes/largo template_url = http://example/home/wp-content/themes/largo text_direction = ltr url = http://example/home version = 2.7 wpurl = http://example/home/wp

Parameters
show (string) Keyword naming the information you want. Optional; default: name. If you omit this parameter or pass any value besides those below, the function returns the Weblog title. (Be careful of misspellings!) name (default) returns the Weblog title set in Administration Settings General. This data is retrieved from the blogname record in the wp_options table. description the Tagline set in Administration Settings General. This data is retrieved from the blogdescription record in the wp_options table. url home (deprecated) siteurl (deprecated) the Blog address (URI) is the URL for your blog's web site address and is set in Administration Settings General. This data is retrieved from the home record in the wp_options table. wpurl the WordPress address (URI) is the URL for your WordPress installation and is set in Administration Settings General. This data is retrieved from the siteurl record in the wp_options table. rdf_url URL for the blog's RDF/RSS 1.0 feed (/feed/rfd). rss_url URL for the blog's RSS 0.92 feed (/feed/rss). rss2_url URL for the blog's RSS 2.0 feed (/feed). atom_url URL for the blog's Atom feed (/feed/atom). comments_rss2_url URL for the blog's comments RSS 2.0 feed (/comments/feed). pingback_url URL for Pingback XML-RPC le (xmlrpc.php). stylesheet_url URL for primary CSS le (usually style.css) of the active theme.

stylesheet_directory URL of the stylesheet directory of the active theme. (Was a local path in earlier WordPress versions.) template_directory template_url URL of the active theme's directory. (template_directory was a local path before 2.6; see get_theme_root() and get_template() for hackish alternatives.) admin_email The Administrator's E-mail address set in Administration Settings General. This data is retrieved from the admin_email record in the wp_options table. charset The Encoding for pages and feeds set in Administration Settings Reading. This data is retrieved from the blog_charset record in the wp_options table. version Version of WordPress your blog uses. This data is the value of $wp_version variable set in wp-includes/version.php. html_type Content-Type of WordPress HTML pages (default: text/html); stored in the html_type record in the wp_options table. Themes and plugins can override the default value by using the pre_option_html_type lter (see this section of the Codex for more information on pre_option_ lters).

Related
bloginfo, bloginfo_rss, get_bloginfo, get_bloginfo_rss, wp_title, wp_get_archives, get_calendar, get_posts, wp_list_pages, wp_page_menu, wp_dropdown_pages, wp_loginout, wp_register, wp_logout_url, query_posts, rss_enclosure

How to pass parameters to tags Go to Template Tag index Retrieved from "http://codex.wordpress.org/Template_Tags/get_bloginfo" Category: Template Tags

Template Tags/get bloginfo rss Contents


1 Description 2 Usage 3 Example 3.1 RSS2 URL 4 Parameters 5 Related

Description
Returns information about your blog, which can then be used elsewhere in your PHP code. This function is identical to get_bloginfo() except it strips any markup from the output for use in WordPress' syndication feeds. To display this information, use bloginfo_rss().

Usage
<?php get_bloginfo_rss('show'); ?>

Example
RSS2 URL
Assigns the URL of your blog's RSS2 feed to the variable $rss2_url. <?php $rss2_url = get_bloginfo_rss('rss2_url'); ?>

Parameters
show (string) Informational detail about your blog. Valid values: 'name' - Weblog title; set in General Options. (Default) 'description' - Tagline for your blog; set in General Options. 'url' - URL for your blog's web site address. 'rdf_url' - URL for RDF/RSS 1.0 feed.

'rss_url' - URL for RSS 0.92 feed. 'rss2_url' - URL for RSS 2.0 feed. 'atom_url' - URL for Atom feed. 'comments_rss2_url' - URL for comments RSS 2.0 feed. 'pingback_url' - URL for Pingback (XML-RPC le). 'admin_email' - Administrator's email address; set in General Options. 'charset' - Character encoding for your blog; set in Reading Options. 'version' - Version of WordPress your blog uses. The following work in WordPress version 1.5 or after: 'html_type' - "Content-type" for your blog. 'wpurl' - URL for WordPress installation. 'template_url' - URL for template in use. 'template_directory' - URL for template's directory. 'stylesheet_url' - URL for primary CSS le. 'stylesheet_directory' - URL for stylesheet directory.

Related
bloginfo, bloginfo_rss, get_bloginfo, get_bloginfo_rss, wp_title, wp_get_archives, get_calendar, get_posts, wp_list_pages, wp_page_menu, wp_dropdown_pages, wp_loginout, wp_register, wp_logout_url, query_posts, rss_enclosure

How to pass parameters to tags Go to Template Tag index Retrieved from "http://codex.wordpress.org/Template_Tags/get_bloginfo_rss" Category: Template Tags

Template Tags/get bookmarks Contents


1 Description 2 Usage 3 Examples 3.1 Default Usage 4 Parameters 5 Related

Description
This function will be found in WordPress v2.1, it is NOT supported by WordPress v2.0. get_bookmarks() returns an array of bookmarks found in the Administration > Blogroll > Manage Blogroll panel. This Template Tag allows the user to retrieve the bookmark information directly.

Usage
<?php get_bookmarks('arguments'); ?>

Examples
Default Usage
'orderby' => 'name', 'order' => 'ASC', 'limit' => -1, 'category' => '', 'category_name' => '', 'hide_invisible' => 1, 'show_updated' => 0, 'include' => '', 'exclude' => '' By default, the usage gets: All bookmarks ordered by name, ascending Bookmarks marked as hidden are not returned. The link_updated_f eld (the update time in the form of a timestamp) is not returned.

Parameters
orderby (string) Value to sort bookmarks on. Defaults to 'name' unless you pass the value of '' (empty), in which case it sets to 'id'. Valid options: 'id' 'url' 'name' 'target' 'description' 'owner' - User who added bookmark through bookmarks Manager. 'rating' 'updated' 'rel' - bookmark relationship (XFN). 'notes' 'rss' 'length' - The length of the bookmark name, shortest to longest. 'rand' - Display bookmarks in random order. order (string) Sort order, ascending or descending for the orderby parameter. Valid values: ASC (Default) DESC limit (integer) Maximum number of bookmarks to display. Defaults to -1 (all bookmarks). category (string) Comma separated list of bookmark category ID's. category_name (string) Category name of a catgeory of bookmarks to retrieve. Overrides category parameter. hide_invisible (boolean) TRUE causes only bookmarks with link_visible set to 'Y' to be retrieved. 1 (True - default) 0 (False) show_updated (boolean) TRUE causes an extra column called "link_category_f" to be inserted into the results, which contains the same value as "link_updated", but in a unix timestamp format. Handy for using PHP date functions on this data. 1 (True) 0 (False - default) include (string) Comma separated list of numeric bookmark IDs to include in the output. For example, 'include=1,3,6' means to return or echo bookmark IDs 1, 3, and 6. If the include string is used, the category, category_name, and exclude parameters are ignored. Defaults to (all Bookmarks). exclude (string) Comma separated list of numeric bookmark IDs to exclude. For example, 'exclude=4,12' means that bookmark IDs 4 and 12 will NOT be returned or echoed. Defaults to (exclude nothing).

Related
wp_list_bookmarks, get_bookmarks, get_bookmark

How to pass parameters to tags with PHP function-style parameters Go to Template Tag index Retrieved from "http://codex.wordpress.org/Template_Tags/get_bookmarks" Categories: Template Tags | New page created

Template Tags/get calendar Contents


1 Description 2 Usage 3 Examples 3.1 Default Usage 3.2 Displays Weekday Abbrevations

4 Parameters 5 Related

Description
Displays the calendar (defaults to current month/year). Days with posts are styled as such. This tag can be used anywhere within a template.

Usage
<?php get_calendar(); ?>

Examples
Default Usage
Displays calendar highlighting any dates with posts. <?php get_calendar(); ?>

Displays Weekday Abbrevations


Display days using one-letter initial only; in 1.5, displays initial based on your WordPress Localization. <?php get_calendar(true); ?>

Parameters
initial (boolean) If true, the day will be displayed using a one-letter initial; if false, an abbreviation based on your localization will be used. For example: false causes "Sunday" to be displayed as "Sun" true (default) causes it to be "S"

Related
bloginfo, bloginfo_rss, get_bloginfo, get_bloginfo_rss, wp_title, wp_get_archives, get_calendar, get_posts, wp_list_pages, wp_page_menu, wp_dropdown_pages, wp_loginout, wp_register, wp_logout_url, query_posts, rss_enclosure

How to pass parameters to tags Go to Template Tag index Retrieved from "http://codex.wordpress.org/Template_Tags/get_calendar" Category: Template Tags

Template Tags/get category parents Contents


1 Description 2 Usage 3 Example 4 Parameters 5 Related

Description
Returns a list of the parents of a category, including the category, sorted by ID.

Usage
<?php echo(get_category_parents(category, display link, separator, nice name)); ?>

Example
Returns the parent categories of the current category with links separated by '' <?php echo(get_category_parents($cat, TRUE, ' &raquo; ')); ?> will output:

Internet Blogging WordPress

Parameters
category (integer) The numeric category ID for which to return the parents. Defaults to current category, if one is set. display link (boolean) Creates a link to each category displayed. separator (string) What to separate each category by. nice name (boolean) Return category nice name or not (defaults to FALSE).

Related
the_category, the_category_rss, single_cat_title, category_description, wp_dropdown_categories, wp_list_categories, in_category, get_category_parents, get_the_category get_category_link,

How to pass parameters to tags Go to Template Tag index Retrieved from "http://codex.wordpress.org/Template_Tags/get_category_parents" Category: Template Tags

Template Tags/get day link Contents


1 Description 2 Usage 3 Examples 3.1 Current Day as Link 3.2 Use With Variables 4 Parameters 5 Related

Description
Returns the daily archive URL to a specic 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.

Usage
<?php get_day_link('year', 'month', 'day'); ?>

Examples
Current Day as Link
Returns the URL to the current day's archive as a link by displaying it within an anchor tag with the PHP echo command. <a href="<?php echo get_day_link('', '', ''); ?>">Today's posts</a>

Use With Variables


PHP code block for use within The Loop: Assigns year, month and day of a post to the variables $arc_year, $arc_month and $arc_day. These are used with the get_day_link() tag, which returns the URL as a link to the daily archive for that post, displaying it within an anchor tag with the PHP echo command. See Formatting Date and Time for info on format strings used in get_the_time() tag. <?php $arc_year = get_the_time('Y'); $arc_month = get_the_time('m'); $arc_day = get_the_time('d'); ?> <a href="<?php echo get_day_link("$arc_year", "$arc_month", "$arc_day"); ?>">this day's posts</a>

Parameters
year (integer) The year for the archive. Use '' to assign current year. month (integer) The month for archive. Use '' to assign current month. day (integer) The day for archive. Use '' to assign current day.

Related
edit_post_link, edit_comment_link, link_pages, wp_link_pages, get_year_link, get_month_link, get_day_link

How to pass parameters to tags with PHP function-style parameters Go to Template Tag index Retrieved from "http://codex.wordpress.org/Template_Tags/get_day_link" Category: Template Tags

Template Tags/get links


This function has been deprecated. That means it has been replaced by a new function or is no longer supported, and may be removed from future versions. All code that uses this function should be converted to use its replacement if one exists.

Contents
1 Description 2 Replace With 3 Usage 4 Examples 4.1 Default Usage 4.2 Specic Category Sorted by URL 4.3 Shows Ratings and Timestamp 5 Parameters 6 Related

Description
Like wp_get_links(), this tag displays links from the Links Manager, but allows the user to control how they are displayed by tag parameters, rather than through the WordPress admin interface (useful when displaying links on more than one template). This tag does ignore any link where the Visible property is set to No.

Replace With
wp_list_bookmarks().

Usage
<?php get_links(category, 'before', 'after', 'between', show_images, 'order', show_description,show_rating, limit, show_updated, echo); ?>

Examples
Default Usage
By default, the usage shows: All links Line breaks after each link item An image if one is included A space between the image and the text Sorts the list by name Shows the description of the link Does not show the ratings Unless limit is set, shows all links Displays links as links not text

<?php get_links(); ?>

Specic Category Sorted by URL


Displays links for link category ID 2 in span tags, uses images for links, does not show descriptions, sorts by link URL. <?php get_links(2, '<span>', '</span>', '', TRUE, 'url', FALSE); ?>

Shows Ratings and Timestamp


Displays all links in an ordered list with descriptions on a new line, does not use images for links, sorts by link id, shows description, show rating, no limit to the number of links, shows last-updated timestamp, and echoes the results. <ol> <?php get_links('-1', '<li>', '</li>', '<br />', FALSE, 'id', TRUE, TRUE, -1, TRUE, TRUE); ?> </ol>

Parameters
category (integer) The numeric ID of the link category whose links will be displayed. Display links in multiple categories by passing a string containing comma-separated list of categories, e.g. "4,11,3". If none is specied, all links are shown. Defaults to -1 (all links). before (string) Text to place before each link. There is no default. after (string) Text to place after each link. Defaults to '<br />'. between (string) Text to place between each link/image and its description. Defaults to ' ' (space). show_images (boolean) Should images for links be shown (TRUE) or not (FALSE). Defaults to TRUE. order (string) Value to sort links on. Defaults to 'name' unless you pass the value of '' (empty), in which case it sets to 'id'. Valid options: 'id' 'url' 'name' 'target' 'category' 'description' 'owner' - User who added link through Links Manager. 'rating' 'updated' 'rel' - Link relationship (XFN). 'notes' 'rss' 'length' - The length of the link name, shortest to longest. Prexing any of the above options with an underscore (ex: '_id') sorts links in reverse order. 'rand' - Display links in random order. show_description (boolean) Should the description be displayed (TRUE) or not (FALSE). Valid when show_images is FALSE, or an image is not dened. Defaults to TRUE. show_rating (boolean) Should rating stars/characters be displayed (TRUE) or not (FALSE). Defaults to FALSE. limit (integer) Maximum number of links to display. Defaults to -1 (all links). show_updated (boolean) Should the last updated timestamp be displayed (TRUE) or not (FALSE). Defaults to FALSE. echo (boolean) Display links (TRUE) or return them for use PHP (FALSE). Defaults to TRUE.

Related
get_links_list, wp_get_links, get_links, wp_get_linksbyname, get_linksbyname, wp_list_bookmarks, get_bookmarks, get_bookmark

How to pass parameters to tags with PHP function-style parameters

Go to Template Tag index Retrieved from "http://codex.wordpress.org/Template_Tags/get_links" Category: Template Tags

Template Tags/get links list


This function has been deprecated. That means it has been replaced by a new function or is no longer supported, and may be removed from future versions. All code that uses this function should be converted to use its replacement if one exists.

Contents
1 Description 2 Replace With 3 Usage 4 Example 5 Parameters 6 Related

Description
Displays a nested HTML unordered list of all links as dened in the Links Manager, sorted under Link Category headings. Note: the Link Category headings are automatically generated inside of <h2> headings. Note: This tag does not respect the "Before Link", "Between Link and Description", and "After Link" settings dened for Link Categories in the Links Manager, Formatting (but respect Category Options, Show, Description). To get around this feature/limitation, see Example 2 from wp_get_links().

Replace With
wp_list_bookmarks().

Usage
<?php get_links_list('order'); ?>

Example
Display links sorted by Link Category ID. <?php get_links_list('id'); ?> Automatically generates the <li> with an ID of the Link Category wrapped in an <h2> heading. It looks like this (links edited for space): <li id="linkcat-1"><h2>Blogroll</h2> <ul> <li><a href="http://example1.com/">Blogroll Link 1</a></li> <li><a href="http://example2.com/">Blogroll Link 2</a></li> <li><a href="http://example3.com/">Blogroll Link 3</a></li> </ul> </li>

Parameters
order (string) Value to sort Link Categories by. Valid values: 'name' (Default) 'id' Prexing the above options with an underscore (ex: '_id') sorts links in reverse order.

Related
get_links_list, wp_get_links, get_links, wp_get_linksbyname, get_linksbyname, wp_list_bookmarks, get_bookmarks, get_bookmark

How to pass parameters to tags with PHP function-style parameters Go to Template Tag index Retrieved from "http://codex.wordpress.org/Template_Tags/get_links_list"

Category: Template Tags

Template Tags/get linksbyname


This function has been deprecated. That means it has been replaced by a new function or is no longer supported, and may be removed from future versions. All code that uses this function should be converted to use its replacement if one exists.

Contents
1 Description 2 Replace With 3 Usage 4 Examples 4.1 Default Usage 4.2 Specic Category Sorted by Name 4.3 With Images and Ratings, No Descriptions 4.4 As a Denition List with Images and Descriptions in Separate Tags 5 Parameters 6 Related

Description
Like wp_get_linksbyname(), this tag displays links from the Links Manager, but allows the user to control how they are displayed by tag parameters, rather than through the WordPress admin interface (useful when displaying links on more than one template).

Replace With
wp_list_bookmarks().

Usage
<?php get_linksbyname('cat_name', 'before', 'after', 'between', show_images, 'orderby', show_description, show_rating, limit, show_updated); ?>

Examples
Default Usage
By default, the tag shows: All categories if none are specied All category links are shown Puts a line break after the link item Puts a space between the image and link (if one is included) Shows link images if available List sorted by ID Shows the link description Does not show the rating With no limit listed, it shows all links Does not show the updated timestamp <?php get_linksbyname(); ?>

Specic Category Sorted by Name


Displays links for link category "Friends" in an unordered list with descriptions on the next line, sorts by link name. <ul> <?php get_linksbyname('Friends', '<li>', '</li>', '<br />', FALSE, 'name', TRUE); ?> </ul>

With Images and Ratings, No Descriptions


Displays all links one per line without descriptions, uses images for links, sorts by link name, and shows ratings. <?php get_linksbyname('', '', '<br />', '', TRUE, 'name', FALSE, TRUE); ?>

As a Denition List with Images and Descriptions in Separate Tags


Displays all links in a Denition List, places linked images in the <dt>, descriptions in the <dd>, and sorts by rating but doesn't show it. <dl> <?php get_linksbyname('Portfolio', '<dt>', '</dd>','</dt><dd>', TRUE, 'rating', TRUE, FALSE, -1, FALSE); ?> </dl> To see examples of styling this markup in a uid/elastic, multi-column layout with backgrounds and hover effects, please see Manipulating Denition Lists for Fun and Prot.

Parameters
cat_name (string) The name of the link category whose links will be displayed. If none is specied, all links are shown. Defaults to 'noname' (all links). before (string) Text to place before each link. There is no default. after (string) Text to place after each link. Defaults to '<br />'. between (string) Text to place between each link/image and its description. Defaults to ' ' (space). show_images (boolean) Should images for links be shown (TRUE) or not (FALSE). Defaults to TRUE. orderby (string) Value to sort links on. Defaults to 'id'. Valid options: 'id' 'url' 'name' 'target' 'category' 'description' 'owner' - User who added link through Links Manager. 'rating' 'updated' 'rel' - Link relationship (XFN). 'notes' 'rss' 'length' - The length of the link name, shortest to longest. Prexing any of the above options with an underscore (ex: '_id') sorts links in reverse order. 'rand' - Display links in random order. show_description (boolean) Display the description (TRUE) or not (FALSE). Valid if show_images is FALSE or an image is not dened. Defaults to TRUE. show_rating (boolean) Should rating stars/characters be displayed (TRUE) or not (FALSE). Defaults to FALSE. limit (integer) Maximum number of links to display. Defaults to -1 (all links). show_updated (boolean) Should the last updated timestamp be displayed (TRUE) or not (FALSE). Defaults to FALSE.

Related
get_links_list, wp_get_links, get_links, wp_get_linksbyname, get_linksbyname, wp_list_bookmarks, get_bookmarks, get_bookmark

How to pass parameters to tags with PHP function-style parameters Go to Template Tag index Retrieved from "http://codex.wordpress.org/Template_Tags/get_linksbyname" Category: Template Tags

Template Tags/get month link Contents

1 Description 2 Usage 3 Examples 3.1 Month Archive as Link 3.2 Assigning Specic Month to Variable 3.3 Use With PHP Variables 4 Parameters 5 Related

Description
Returns the monthly archive URL to a specic 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.

Usage
<?php get_month_link('year', 'month'); ?>

Examples
Month Archive as Link
Returns the URL to the current month's archive as a link by displaying it within an anchor tag with the PHP echo command. <a href="<?php echo get_month_link('', ''); ?>">All posts this month</a>

Assigning Specic Month to Variable


Returns URL to the archive for October 2004, assigning it to the variable $oct_04. The variable can then be used elsewhere in a page. <?php $oct_04 = get_month_link('2004', '10'); ?>

Use With PHP Variables


PHP code block for use within The Loop: Assigns year and month of a post to the variables $arc_year and $arc_month. These are used with the get_month_link() tag, which returns the URL as a link to the monthly archive for that post, displaying it within an anchor tag with the PHP echo command. See Formatting Date and Time for info on format strings used in get_the_time() tag. <?php $arc_year = get_the_time('Y'); $arc_month = get_the_time('m'); ?> <a href="<?php echo get_month_link("$arc_year", "$arc_month"); ?>">archive for <?php the_time('F Y') ?></a>

Parameters
year (integer) The year for the archive. Use '' to assign current year. month (integer) The month for archive. Use '' to assign current month.

Related
edit_post_link, edit_comment_link, link_pages, wp_link_pages, get_year_link, get_month_link, get_day_link

How to pass parameters to tags with PHP function-style parameters Go to Template Tag index Retrieved from "http://codex.wordpress.org/Template_Tags/get_month_link" Category: Template Tags

Template Tags/get permalink Contents


1 Description 2 Usage 3 Examples 3.1 Default Usage

3.2 Link to Specic Post 4 Parameters 5 Related

Description
Returns the permalink to a post for use in PHP. It does NOT display the permalink and can be used outside of The Loop.

Usage
<?php get_permalink(id); ?>

Examples
Default Usage
The permalink for current post (used within The Loop). As the tag does not display the permalink, the example uses the PHP echo command. Permalink for this post:<br /> <?php echo get_permalink(); ?>

Link to Specic Post


Returns the permalinks of two specic posts (post IDs 1 and 10) as hypertext links within an informational list. As above, tag uses the PHP echo command to display the permalink. <ul> <li>MyBlog info: <ul> <li><a href="<?php echo get_permalink(1); ?>">About MyBlog</a></li> <li><a href="<?php echo get_permalink(10); ?>">About the owner</a></li> </ul> </li> </ul>

Parameters
id (integer) The numeric ID for a post. When this tag is used in The Loop without an id parameter value, tag defaults to the current post ID.

Related
permalink_anchor, get_permalink, the_permalink, permalink_single_rss

How to pass parameters to tags Go to Template Tag index Retrieved from "http://codex.wordpress.org/Template_Tags/get_permalink" Category: Template Tags

Template Tags/get posts Contents


1 Description 2 Usage 3 Examples 3.1 Posts list with offset 3.2 Access all post data 3.3 Latest posts ordered by title 3.4 Random posts 3.5 Show all attachments 3.6 Show attachments for the current post 4 Parameters: WordPress 2.6+ 5 Parameters: WordPress 2.5 And Older 6 Related

Description
This is a simple tag for creating multiple loops.

Usage
<?php get_posts('arguments'); ?>

Examples
Posts list with offset
If you have your blog congured to show just one post on the front page, but also want to list links to the previous ve posts in category ID 1, you can use this: <ul> <?php global $post; $myposts = get_posts('numberposts=5&offset=1&category=1'); foreach($myposts as $post) : ?> <li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li> <?php endforeach; ?> </ul> Note: With use of the offset, the above query should be used only on a category that has more than one post in it, otherwise there'll be no output.

Access all post data


Some post-related data is not available to get_posts by default, such as post content through the_content(), or the numeric ID. This is resolved by calling an internal function setup_postdata(), with the $post array as its argument: <?php $lastposts = get_posts('numberposts=3'); foreach($lastposts as $post) : setup_postdata($post); ?> <h2><a href="<?php the_permalink(); ?>" id="post-<?php the_ID(); ?>"><?php the_title(); ?></a></h2> <?php the_content(); ?> <?php endforeach; ?> To access a post's ID or content without calling setup_postdata(), or in fact any post-specic data (data retained in the posts table), you can use $post->COLUMN, where COLUMN is the table column name for the data. So $post->ID holds the ID, $post->post_content the content, and so on. To display or print this data on your page use the PHP echo command, like so: <?php echo $post->ID; ?>

Latest posts ordered by title


To show the last ten posts sorted alphabetically in ascending order, the following will display their post date, title and excerpt: <?php $postslist = get_posts('numberposts=10&order=ASC&orderby=title'); foreach ($postslist as $post) : setup_postdata($post); ?> <div> <?php the_date(); ?> <br /> <?php the_title(); ?> <?php the_excerpt(); ?> </div> <?php endforeach; ?> Note: The orderby parameter was modied in Version 2.6. This code is using the new orderby format. See Parameters for details.

Random posts
Display a list of 5 posts selected randomly by using the MySQL RAND() function for the orderby parameter value: <ul><li><h2>A random selection of my writing</h2> <ul>

<?php $rand_posts = get_posts('numberposts=5&orderby=rand'); foreach( $rand_posts as $post ) : ?> <li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li> <?php endforeach; ?> </ul> </li></ul>

Show all attachments


Do this outside any Loops in your template. (Since Version 2.5, it may be easier to use get_children() instead.) <?php $args = array( 'post_type' => 'attachment', 'numberposts' => -1, 'post_status' => null, 'post_parent' => null, // any parent ); $attachments = get_posts($args); if ($attachments) { foreach ($attachments as $post) { setup_postdata($post); the_title(); the_attachment_link($post->ID, false); the_excerpt(); } } ?>

Show attachments for the current post


Do this inside The_Loop (where $post->ID is available). <?php $args = array( 'post_type' => 'attachment', 'numberposts' => -1, 'post_status' => null, 'post_parent' => $post->ID ); $attachments = get_posts($args); if ($attachments) { foreach ($attachments as $attachment) { echo apply_filters('the_title', $attachment->post_title); the_attachment_link($attachment->ID, false); } } ?>

Parameters: WordPress 2.6+


In addition to the parameters listed below under "WordPress 2.5 And Older", get_posts() can also take the parameters that query_posts() can since both functions now use the same database query code internally. Note: Version 2.6 changed a number of the orderby options. Table elds that begin with post_ no longer have that part of the name. For example, post_title is now title and post_date is now date.

Parameters: WordPress 2.5 And Older


$numberposts (integer) (optional) Number of posts to return. Set to 0 to use the max number of posts per page. Set to -1 to remove the limit. Default: 5

$offset (integer) (optional) Offset from latest post. Default: 0 $category (integer) (optional) Only show posts from this category ID. Making the category ID negative (-3 rather than 3) will show results not matching that category ID. Multiple category IDs can be specied by separating the category IDs with commas or by passing an array of IDs. Default: None $category_name (string) (optional) Only show posts from this category name or category slug. Default: None $tag (string) (optional) Only show posts with this tag slug. If you specify multiple tag slugs separated by commas, all results matching any tag will be returned. If you specify multiple tag slugs separated by spaces, the results will match all the specied tag slugs. Default: None $orderby (string) (optional) Sort posts by one of various values (separated by space), including: 'author' - Sort by the numeric author IDs. 'category' - Sort by the numeric category IDs. 'content' - Sort by content. 'date' - Sort by creation date. 'ID' - Sort by numeric post ID. 'menu_order' - Sort by the menu order. Only useful with pages. 'mime_type' - Sort by MIME type. Only useful with attachments. 'modified' - Sort by last modied date. 'name' - Sort by stub. 'parent' - Sort by parent ID. 'password' - Sort by password. 'rand' - Randomly sort results. 'status' - Sort by status. 'title' - Sort by title. 'type' - Sort by type. Notes: Sorting by ID and rand is only available starting with Version 2.5. Default: post_date $order (string) (optional) How to sort $orderby. Valid values: 'ASC' - Ascending (lowest to highest). 'DESC' - Descending (highest to lowest). Default: DESC $include (string) (optional) The IDs of the posts you want to show, separated by commas and/or spaces. The following value would work in showing these six posts: '45,63, 78 94 ,128 , 140' Note: Using this parameter will override the numberposts, offset, category, exclude, meta_key, meta_value, and post_parent parameters. Default: None $exclude (string) (optional) The IDs of any posts you want to exclude, separated by commas and/or spaces (see $include parameter). Default: None $meta_key and $meta_value (string) (optional) Only show posts that contain a meta (custom) eld with this key and value. Both parameters must be dened, or neither will work. Default: None $post_type (string) (optional) The type of post to show. Available options are: post - Default

page attachment any - all post types Default: post $post_status (string) (optional) Show posts with a particular status. Available options are: publish - Default private draft future inherit - Default if $post_type is set to attachment (blank) - all statuses Default: publish $post_parent (integer) (optional) Show only the children of the post with this ID Default: None $nopaging (boolean) (optional) Enable or disable paging. If paging is disabled, the $numberposts option is ignored. Default: None

Related
bloginfo, bloginfo_rss, get_bloginfo, get_bloginfo_rss, wp_title, wp_get_archives, get_calendar, get_posts, wp_list_pages, wp_page_menu, wp_dropdown_pages, wp_loginout, wp_register, wp_logout_url, query_posts, rss_enclosure

How to pass parameters to tags Go to Template Tag index Retrieved from "http://codex.wordpress.org/Template_Tags/get_posts" Category: Template Tags

Template Tags/get the category Contents


1 Description 2 Usage 3 Examples 3.1 Show Category Images 3.2 Show the First Category Name Only 4 Member Variables 5 Related

Description
Returns an array of objects, one object for each category assigned to the post. This tag must be used within The Loop.

Usage
This function does not display anything; you should access the objects and then echo or otherwise use the desired member variables. The following example displays the category name of each category assigned to the post (this is like using the_category(), but without linking each category to the category view, and using spaces instead of commas): <?php foreach((get_the_category()) as $category) { echo $category->cat_name . ' '; } ?>

Examples
Show Category Images
This outputs category images named after the cat_ID with the alt attribute set to cat_name. You can also use any of the other member variables instead.

<?php foreach((get_the_category()) as $category) { echo '<img src="http://example.com/images/' . $category->cat_ID . '.jpg" alt="' . $category->cat_name . '" />'; } ?>

Show the First Category Name Only


<?php $category = get_the_category(); echo $category[0]->cat_name; ?> (Echoes the rst array ([0]) of $category.)

Member Variables
cat_ID the category id (also stored as 'term_id') cat_name the category name (also stored as 'name') category_nicename a slug generated from the category name (also stored as 'slug') category_description the category description (also stored as 'description') category_parent the category id of the current category's parent. '0' for no parents. (also stored as 'parent') category_count the number of uses of this category (also stored as 'count')

Related
the_category, the_category_rss, single_cat_title, category_description, wp_dropdown_categories, wp_list_categories, in_category, get_category_parents, get_the_category get_category_link,

How to pass parameters to tags with query-string-style parameters Go to Template Tag index Retrieved from "http://codex.wordpress.org/Template_Tags/get_the_category" Category: Template Tags

Template Tags/get the tag list Contents


1 Description 2 Usage 3 Example 3.1 A Basic Example 3.2 A Slightly More Complex Example 4 Parameters 5 Related

Description
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. This tag must be used inside 'The Loop'.

Usage
<?php $tag_list = get_the_tag_list( $before = 'before', $sep = 'seperator', $after = 'after' ) ?> This function does not display anything - if you want to put it straight onto the page, you should use echo (get_the_tag_list()). Alternatively, you can assign it to a variable for further use by using $foo = get_the_tag_list(). The variables are all optional, and should be placed in the order 'before', 'separator', 'after'. You can use HTML inside each of the elds.

Example

A Basic Example
This outputs the list of tags inside a paragraph, with tags separated by commas. <?php echo get_the_tag_list('<p>Tags: ',', ','</p>'); ?> This would return something like. <p> Tags: <a href="tag1">Tag 1</a>, <a href="tag2">Tag 2</a>, ... </p>

A Slightly More Complex Example


This checks if the post has any tags, and if there are, outputs them to a standard unordered list. <?php if(get_the_tag_list()) { get_the_tag_list('<ul><li>','</li><li>','</li></ul>'); } ?> This will return something in the form: <ul> <li><a href="tag1">Tag 1</a></li> <li><a href="tag2">Tag 2</a></li> ... </ul> You can add classes and styles with CSS, as necessary.

Parameters
$before (string) (optional) Leading text Default: 'Tags: ' $sep (string) (optional) String to sepearte tags Default: ', ' $after (string) (optional) Trailing text Default: none

Related
the_tags, get_the_tags, get_the_tag_list, single_tag_title, get_tag_link, wp_tag_cloud, wp_generate_tag_cloud

How to pass parameters to tags with PHP function-style parameters Go to Template Tag index

This page is marked as incomplete. You can help Codex by expanding it. Retrieved from "http://codex.wordpress.org/Template_Tags/get_the_tag_list" Categories: Template Tags | New page created | Stubs

Template Tags/get the tags

Contents
1 Description 2 Usage 3 Examples 3.1 Show tag Images 3.2 Show the First tag Name Only 3.3 Display code bases on different tag values 4 Member Variables 5 Related

Description
Returns an array of objects, one object for each tag assigned to the post. This tag must be used within The Loop.

Usage
This function does not display anything; you should access the objects and then echo or otherwise use the desired member variables. The following example displays the tag name of each tag assigned to the post (this is like using the_tags(), but without linking each tag to the tag view, and using spaces instead of commas): <?php $posttags = get_the_tags(); if ($posttags) { foreach($posttags as $tag) { echo $tag->name . ' '; } } ?>

Examples
Show tag Images
This outputs tag images named after the term_id with the alt attribute set to name. You can also use any of the other member variables instead. <?php $posttags = get_the_tags(); if ($posttags) { foreach($posttags as $tag) { echo '<img src="http://example.com/images/' . $tag->term_id . '.jpg" alt="' . $tag->name . '" />'; } } ?>

Show the First tag Name Only


<?php $posttags = get_the_tags(); $count=0; if ($posttags) { foreach($posttags as $tag) { $count++; if (1 == $count) { echo $tag->name . ' '; } } } ?>

Display code bases on different tag values


This code will display HTML code depending on if this post has a certain tag or tag(s). Just add as many else if statements as you require. <?php if ($all_the_tags); $all_the_tags = get_the_tags(); foreach($all_the_tags as $this_tag) {

if ($this_tag->name == "sometag" ) { ?> <p>SOME HTML CODE <img src="someimage.jpg"></p> <?php } else if ($this_tag->name == "someothertag" ) { ?>

<p>SOME OTHER HTML CODE <img src="someotherimage.jpg"></p> <?php ?> <!-- not tagged as one or the other --> <? } } } ?> } else { // it's neither, do nothing

Member Variables
term_id the tag id name the tag name slug a slug generated from the tag name term_group the group of the tag, if any taxonomy should always be 'post_tag' for this case description the tag description count number of uses of this tag, total

Related
the_tags, get_the_tags, get_the_tag_list, single_tag_title, get_tag_link, wp_tag_cloud, wp_generate_tag_cloud

How to pass parameters to tags with query-string-style parameters Go to Template Tag index Retrieved from "http://codex.wordpress.org/Template_Tags/get_the_tags" Category: Template Tags

Template Tags/get the time Contents


1 Description 2 Usage 3 Examples 3.1 Default Usage 3.2 Assigns Time in Seconds 4 Parameters 5 Related

Description
Returns the time of the current post for use in PHP. It does not display the time. This tag must be used within The Loop. This tag is available beginning with version 1.5 of WordPress. To display the time of a post, use the_time().

Usage
<?php get_the_time('format'); ?>

Examples
Default Usage
Returns the time of the current post using the WordPress default format, and displays it using the PHP echo command. <?php echo get_the_time(); ?>

Assigns Time in Seconds


Assigns the time of the current post in seconds (since January 1 1970, known as the Unix Epoch) to the variable $u_time. <?php $u_time = get_the_time('U'); ?>

Parameters
format (string) The format the time is to display in. Defaults to the time format congured in your WordPress options. See Formatting Date and Time.

Related
See also the_time(). the_date_xml, the_date, the_time, the_modied_date, the_modied_time, get_the_time, single_month_title, get_calendar, the_weekday, the_weekday_date

How to pass parameters to tags Go to Template Tag index Retrieved from "http://codex.wordpress.org/Template_Tags/get_the_time" Category: Template Tags

Template Tags/get year link Contents


1 Description 2 Usage 3 Examples 3.1 Year as Link 3.2 Year as a variable 3.3 Using With PHP Variables 4 Parameters 5 Related

Description
Returns the yearly archive URL to a specic 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.

Usage
<?php get_year_link('year'); ?>

Examples
Year as Link
Returns the URL for the current year's archive, displaying it as a link in the anchor tag by using the PHP echo command. <a href="<?php echo get_year_link(''); ?>">Posts from this year</a>

Year as a variable
Returns URL for the archive year 2003, assigning it to the variable $year03. The variable can then be used elsewhere in a page. <?php $year03 = get_year_link(2003); ?>

Using With PHP Variables


PHP code block for use within The Loop: Assigns year to the variable $arc_year. This is used with the get_year_link() tag, which returns the URL as a link to the yearly archive for a post, displaying it within an anchor tag with the PHP echo command. See Formatting Date and Time for info on format strings used in get_the_time() tag. <?php $arc_year = get_the_time('Y'); ?> <a href="<?php echo get_year_link($arc_year); ?>"><?php the_time('Y') ?> archive</a>

Parameters
year (integer) The year for the archive. Use '' to assign current year.

Related
edit_post_link, edit_comment_link, link_pages, wp_link_pages, get_year_link, get_month_link, get_day_link

How to pass parameters to tags with PHP function-style parameters Go to Template Tag index Retrieved from "http://codex.wordpress.org/Template_Tags/get_year_link" Category: Template Tags

Template Tags/in category Contents


1 Description 2 Usage 3 Examples 3.1 Display Some Category Specic Text 3.2 Use OUTSIDE The Loop 3.2.1 Parameters 3.3 Plugin Options 3.4 Related

Description
Returns true if the current post is in the specied Category. Normally this tag is used within The Loop, but the $post variable must be set when using this tag outside of the loop.

Usage
Suppose you want to execute some specic PHP or HTML only if the current post being processed is in a category with a category ID number we'll represent here as 'category_id'. <?php if ( in_category('category_id') ): ?> // Some category specific PHP/HTML here <?php endif; ?>

Examples
Display Some Category Specic Text
Display <span class="good-cat-5">This is a nice category</span> in each post which is a member of category 5, otherwise display <span class="bad-cat">This is a BAD category</span>. <?php if ( in_category(5) ) { echo '<span class="my-cat-5">This is a nice category</span>'; } else { echo '<span class="bad-cat">This is a BAD category</span>'; } ?> Unfortunately, in_category doesn't understand category child-parent relationships. If, for example, category 11 (bananas) is a child of category 2 (fruits), in_category('2') will return FALSE when viewing post about bananas. So if you want the same text to be applied to the category AND all its sub-categories, you'll have to list them all. Syntax like in_category(2,11) is not allowed. You'll have to use PHP || (logical OR) && (logical

AND) in the expression.

<?php if ( in_category(2) || in_category (11) || in_category (12)[more categories abouth other fruits - this can get me echo '<span class="fruits">This is about different kinds of fruits</span>'; } else { echo '<span class="bad-cat">Not tasty! Not healthy!</span>'; } ?> Another way to check in child categories is to loop through the children. <?php $in_subcategory = false; foreach( (array) get_term_children( 11, 'category' ) as $child_category ) { if(in_category($child_category))$in_subcategory = true; } if ( $in_subcategory || in_category( 11 ) ) { echo '<span class="fruits">This is about different kinds of fruits</span>'; } else { echo '<span class="bad-cat">Not tasty! Not healthy!</span>'; } ?>

Use OUTSIDE The Loop


Normally, this tag must be used inside The Loop because it depends on a WordPress PHP variable ($post) that is assigned a value only when The Loop runs. However, you can manually assign this variable and then use the tag just ne. For example, suppose you want a single.php Template File in your Theme that will display a completely different page depending on what category the individual post is in. Calling in_category() from within The Loop may not be convenient for your Template. So use the following as your Theme's single.php. <?php if ( have_posts() ) { the_post(); rewind_posts(); } if ( in_category(17) ) { include(TEMPLATEPATH . '/single2.php'); } else { include(TEMPLATEPATH . '/single1.php'); } ?> This will use single2.php as the Template if the post is in category 17 and single1.php otherwise. This essentially pulls the rst post into the correct variables, then resets the main WordPress query to start from there again when the main Loop does run.

Parameters
category_id (integer) The category ID of the category for which you wish to test. The parameter may either be passed as a bare integer or as a string: in_category(5) in_category('5')

Plugin Options
Eventually, someone will make a clever plugin that will do all of this automatically. At that point this example will become obsolete. However, the Custom Post Templates Plugin allows for creation of templates for single posts. It also shows an example of how to add a template which is used for all posts in a given category, not just a single post. That example is commented out in the plugin by default but can be easily implemented by uncommenting the appropriate lines.

Related
the_category, the_category_rss, single_cat_title, category_description, wp_dropdown_categories, wp_list_categories, in_category, get_category_parents, get_the_category get_category_link,

How to pass parameters to tags with PHP function-style parameters Go to Template Tag index

Retrieved from "http://codex.wordpress.org/Template_Tags/in_category" Category: Template Tags

Template Tags/link pages


This function has been deprecated. That means it has been replaced by a new function or is no longer supported, and may be removed from future versions. All code that uses this function should be converted to use its replacement if one exists.

Contents
1 Description 2 Replace With 3 Usage 4 Examples 4.1 Default Usage 4.2 Page-links in Paragraph Tags 5 Parameters 6 Related

Description
Displays page-links for paginated posts (i.e. includes the <!--nextpage--> Quicktag one or more times). This tag works similarly to wp_link_pages(). This tag must be within The_Loop.

Replace With
wp_link_pages().

Usage
<?php link_pages('before', 'after', 'next_or_number', 'nextpagelink', 'previouspagelink', 'pagelink', 'more_file'); ?>

Examples
Default Usage
Displays page-links by default with line breaks before and after, using next page and previous page, listing them with page numbers as Page 1, Page 2 and so on. <?php link_pages(); ?>

Page-links in Paragraph Tags


Displays page-links wrapped in paragraph tags. <?php link_pages('<p>', '</p>', 'number', '', '', 'page %'); ?>

Parameters
before (string) Text to put before all the links. Defaults to '<br />'. after (string) Text to put after all the links. Defaults to '<br />'. next_or_number (string) Indicates whether page numbers should be used. Valid values are: 'number' (Default) 'next' (Valid in WordPress 1.5 or after) nextpagelink (string) Text for link to next page. Defaults to 'next page'. (Valid in WordPress 1.5 or after) previouspagelink (string) Text for link to previous page. Defaults to 'previous page'. (Valid in WordPress 1.5 or after) pagelink (string) Format string for page numbers. '%' in the string will be replaced with the number, so 'Page %' would generate "Page 1", "Page 2", etc. Defaults to '%'. more_le (string) Page the links should point to. Defaults to the current page.

Related

To use the query string to pass parameters, see wp_link_pages() edit_post_link, edit_comment_link, link_pages, wp_link_pages, get_year_link, get_month_link, get_day_link

How to pass parameters to tags with PHP function-style parameters Go to Template Tag index Retrieved from "http://codex.wordpress.org/Template_Tags/link_pages" Category: Template Tags

Template Tags/list authors


This function has been deprecated. That means it has been replaced by a new function or is no longer supported, and may be removed from future versions. All code that uses this function should be converted to use its replacement if one exists.

Contents
1 Description 2 Replace With 3 Usage 4 Examples 4.1 Default Usage 4.2 Authors with Number of Posts 4.3 Full Name and Authors With No Posts Usage 5 Parameters 6 Related

Description
Displays a list of the authors on a blog, and if desired, other information such as a link to each author's RSS feed.

Replace With
wp_list_authors().

Usage
<?php list_authors(optioncount, exclude_admin, show_fullname, hide_empty, 'feed', 'feed_image'); ?>

Examples
Default Usage
Display the list of authors using default settings. <?php list_authors(); ?>

Authors with Number of Posts


This example causes the site's authors to display with the number of posts written by each author, excludes the admin author, and displays each author's full name (rst and last name). <?php list_authors(TRUE, TRUE, TRUE); ?> Harriett Smith (42) Sally Smith (29) Andrew Anderson (48)

Full Name and Authors With No Posts Usage


Displays the site's authors without displaying the number of posts, does not exclude the admin, shows the full name of the authors, and does not hide authors with no posts. It does not display the RSS feed or image.

<?php list_authors(FALSE, FALSE, TRUE, FALSE); ?>

Parameters
optioncount (boolean) Display number of posts by each author. Options are: TRUE FALSE (Default) exclude_admin (boolean) Exclude the administrator account from authors list. Options are: TRUE (Default) FALSE show_fullname (boolean) Display the full (rst and last) name of the authors. Options are: TRUE FALSE (Default) hide_empty (boolean) Do not display authors with 0 posts. Options are: TRUE (Default) FALSE feed (string) Text to display for a link to each author's RSS feed. Default is no text, and no feed displayed. feed_image (string) Path/lename for a graphic. This acts as a link to each author's RSS feed, and overrides the feed parameter.

Related
To use the query string to pass parameters to generate a list of authors, see Template_Tags/wp_list_authors the_author, the_author_description, the_author_login, the_author_rstname, the_author_lastname, the_author_nickname, the_author_ID, the_author_email, the_author_url, the_author_link, the_author_icq, the_author_aim, the_author_yim, the_author_msn, the_modied_author, the_author_posts, the_author_posts_link, list_authors, wp_list_authors

How to pass parameters to tags with PHP function-style parameters Go to Template Tag index Retrieved from "http://codex.wordpress.org/Template_Tags/list_authors" Category: Template Tags

Template Tags/list cats


This function has been deprecated. That means it has been replaced by a new function or is no longer supported, and may be removed from future versions. All code that uses this function should be converted to use its replacement if one exists.

Contents
1 Description 2 Replace With 3 Usage 4 Examples 4.1 Default List 4.2 Sorted by Category Name 4.3 Customized List with Excluded Categories 5 Notes on use 6 Parameters 7 Related

Description
Displays a list of Categories as links. When one of those links is clicked, all the posts in that Category will display in the appropriate Category Template dicatated by the Template Hierarchy rules. This tag works like the wp_list_cats tag, except that list_cats uses a long query string of arguments while wp_list_cats uses text-based query arguments. WordPress 2.1 saw the introduction of a new and more inclusive template tag wp_list_categories, intended to replace wp_list_cats and list_cats.

Replace With
wp_list_categories().

Usage
<?php list_cats(optionall, 'all', 'sort_column', 'sort_order', 'file', list, optiondates, optioncount, hide_empty, use_desc_for_title, children, child_of, 'Categories', recurse, 'feed', 'feed_img', 'exclude', hierarchical); ?>

Examples
Default List
Displays the list of Categories using default settings: <?php list_cats(); ?>

Sorted by Category Name


Displays the list of Categories, with not all Categories linked, and sorted by Category name: <?php list_cats(FALSE, ' ', 'name'); ?>

Customized List with Excluded Categories


Sets the list to not list all the Categories (based upon further parameters), sorts by ID in ascending order and in an unordered list (<ul><li>) without dates or post counts, does not hide empty Categories, uses Category "description" for the title in the links, does not show the children of the parent Categories, and excludes Categories 1 and 33: <?php list_cats(FALSE, '', 'ID', 'asc', '', TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, '', FALSE, '', '', '1,33', TRUE); ?>

Notes on use
When the 'list' parameter is set for an unordered list, the list_cats() tag automatically begins and ends with UL and each item listed as an LI.

Parameters
optionall (boolean) Sets whether to display a link to all Categories. Note: This feature no longer works in WordPress 1.5.x and 2.0 but is slated to be added back at Version 2.1. Valid values: TRUE (Default) FALSE all (string) If optionall is set to TRUE, this denes the text to be displayed for the link to all Categories. Note: This feature no longer works in WordPress 1.5.x and 2.0 but is slated to be added back at Version 2.1. Defaults to 'All'. sort_column (string) Key to sort options by. Valid values: 'ID' (Default) 'name' sort_order (string) Sort order for options. Valid values: 'asc' (Default) 'desc' le (string) The php le a Category link is to be displayed on. Defaults to 'index.php'. list (boolean) Sets whether the Categories are enclosed in an unordered list (<ul><li>). Valid values: TRUE (Default) FALSE

optiondates (boolean) Sets whether to display the date of the last post in each Category. Valid values: TRUE FALSE (Default) optioncount (boolean) Sets whether to display a count of posts in each Category. Valid values: TRUE FALSE (Default) hide_empty (boolean) Sets whether to hide (not display) Categories with no posts. Valid values: TRUE (Default) FALSE use_desc_for_title (boolean) Sets whether the Category description is displayed as link title (i.e. <a title="Category Description" href="...). Valid values: TRUE (Default) FALSE children (boolean) Sets whether to show children (sub) Categories. Valid values: TRUE FALSE (Default) child_of (integer) Display only the Categories that are children of this Category (ID number). There is no default. Categories (integer) This parameter should be set to 0 (zero) when calling this template tag. (For the curious, other values are used only internally by the tag when generating a hierarchical list.) recurse (boolean) Display the list (FALSE) or return it for use in PHP (TRUE). Defaults to FALSE. feed (string) Text to display for the link to each Category's RSS2 feed. Default is no text, and no feed displayed. feed_image (string) Path/lename for a graphic to act as a link to each Category's RSS2 feed. Overrides the feed parameter. exclude (string) Sets the Categories to be excluded. This must be in the form of an array (ex: '1, 2, 3'). hierarchical (boolean) Sets whether to display child (sub) Categories in a hierarchical (after parent) list. Valid values: TRUE (Default) FALSE Note: The hierarchical parameter is not available in versions of WordPress prior to 1.5

Related
To use the query string to pass parameters to generate a list of Categories, see wp_list_cats() the_category, the_category_rss, single_cat_title, category_description, wp_dropdown_categories, wp_list_categories, in_category, get_category_parents, get_the_category get_category_link,

How to pass parameters to tags with PHP function-style parameters Go to Template Tag index Retrieved from "http://codex.wordpress.org/Template_Tags/list_cats" Category: Template Tags

Template Tags/next comments link Contents Description


1 Description This creates a link to the next comments page containing newer comments. 2 Usage

Usage 3 Examples Default Usage 3.1


<?php4 next_comments_link( 'Label', 'Max number of pages (default 0)' ); ?> Parameters
5 Related 3.2 Working example

Examples
Default Usage
<?php next_comments_link(); ?>

Working example
<?php next_comments_link( 'Newer Comments ', 0 ); ?>

Parameters
label (string) The link text. Default is 'Newer Comments '. max_pages (integer) Limit the number of pages on which the link is displayed.

Related
See also previous_comments_link(), paginate_comments_links()

How to pass parameters to tags with PHP function-style parameters Go to Template Tag index Retrieved from "http://codex.wordpress.org/Template_Tags/next_comments_link" Category: Template Tags

Template Tags/next post link Contents


1 Description 2 Usage 3 Examples 3.1 Default Usage 3.2 Bold Post Title As Link 3.3 Text As Link, Without Post Title, Within Same Category 3.4 Within Same Category, Excluding One 4 Parameters 5 Related

Description
Used on single post permalink pages, this template tag displays a link to the next post which exists in chronological order from the current post. This tag must be used in The Loop.

Usage
<?php next_post_link('format', 'link', 'in_same_cat', 'excluded_categories'); ?>

Examples
Default Usage
Displays link with the post title of the next post (chronological post date order), followed by a right angular quote (). By default, this tag works like next_post() Next Post Title <?php next_post_link(); ?>

Bold Post Title As Link


Displays link with next chronological post's title wrapped in 'strong' tags (typically sets text to bold).

Next Post Title <?php next_post_link('<strong>%link</strong>'); ?>

Text As Link, Without Post Title, Within Same Category


Displays custom text as link to the next post within the same category as the current post. Post title is not included here. "Next post in category" is the custom text, which can be changed to t your requirements. Next post in category <?php next_post_link('%link', 'Next post in category', TRUE); ?>

Within Same Category, Excluding One


Displays link to next post in the same category, as long as it is not in category 13 (the category ID #). You can change the number to any category you wish to exclude. Exclude multiple categories by using " and " as a delimiter. Next post in category <?php next_post_link('%link', 'Next post in category', TRUE, '13'); ?>

Parameters
format (string) Format string for the link. This is where to control what comes before and after the link. '%link' in string will be replaced with whatever is declared as 'link' (see next parameter). 'Go to %link' will generate "Go to <a href=..." Put HTML tags here to style the nal results. Defaults to '%link &raquo;'. link (string) Link text to display. Defaults to next post's title ('%title'). in_same_cat (boolean) Indicates whether next post must be within the same category as the current post. If set to TRUE, only posts from the current category will be displayed. Options are: TRUE FALSE (Default) excluded_categories (string) Numeric category ID(s) from which the next post should not be listed. Separate multiple categories with and; example: '1 and 5 and 15'. There is no default. In Wordpress 2.2 (only), apparently, concatenating multiple categories for exclusion is done with a comma, not and; example: '1, 5, 15'. Still no default.

Related
See also previous_post_link(). the_ID, the_title, the_title_attribute, single_post_title, the_title_rss, the_content, the_content_rss, the_excerpt, the_excerpt_rss, previous_post_link, next_post_link, posts_nav_link, the_meta,

How to pass parameters to tags with PHP function-style parameters Go to Template Tag index Retrieved from "http://codex.wordpress.org/Template_Tags/next_post_link" Category: Template Tags

Template Tags/next posts link Contents Description


1 Description This creates a link to the previous posts. Yes, it says "next posts," but it's named that just to confuse you. 2 Usage

Usage 3 Examples Default Usage 3.1


<?php4 next_posts_link('Label', 'Max number of pages (default 0)'); ?> Parameters
5 Related 3.2 Working example

Examples
Default Usage
<?php next_posts_link(); ?>

Working example
<?php next_posts_link('Next Entries ', 0); ?>

Parameters
label (string) The link text. Default is 'Next Page '. max_pages (integer) Limit the number of pages on which the link is displayed.

Related
See also previous_posts_link(), next_post_link(), and previous_post_link().

How to pass parameters to tags with PHP function-style parameters Go to Template Tag index Retrieved from "http://codex.wordpress.org/Template_Tags/next_posts_link" Category: Template Tags

Template Tags/paginate comments links Contents


1 Description 1.1 Example: 2 Usage 3 Parameters 4 Styling 5 Example Source Code 5.1 Working Example 6 Uses in the Default Theme 7 Related

Description
Generate a new way to list the paged comments in the comment template. Instead of using Previous or Next Comments links, it displays a full list of comment pages using numeric indexes (Only on Wordpress 2.7+). This is probably the most efcient way to paginate comments in Wordpres 2.7 since it allows the users to select wich comment page wants to visit instead of clicking trough every single page using the next/prev links.

Example:
1 2 3 ... 10 Next >>

Usage
<?php paginate_comments_links(); ?>

Parameters
Needs Further Completion 'base' => add_query_arg( 'cpage', '%#%' ), 'format' => , 'total' => $max_page, 'current' => $page, 'echo' => true,

'add_fragment' => '#comments'

Styling
The function prints several css classes for further CSS styiling: .page-numbers .current .next .prev

Example Source Code


<span class='page-numbers current'>1</span> <a class='page-numbers' href='http://www.site.com/post-slug/comment-page-2/#comments'>2</a> <a class='next page-numbers' href='http://www.site.com/post-slug/comment-page-2/#comments'>Next </a>

Working Example
http://www.lagzero.net/2008/12/descarga-el-parche-de-gta-iv-para-pc-gta-iv-pc-v1010/#comments

Uses in the Default Theme


The following code uses this function to create the Comments Pages index in the Default Theme's comments.php: <div class="navigation"> <?php paginate_comments_links(); ?> </div> <ol class="commentlist"> <?php wp_list_comments(); ?> </ol> <div class="navigation"> <?php paginate_comments_links(); ?> </div>

Related
comments_number, comments_link, comments_rss_link, comments_popup_script, comments_popup_link, comment_ID, comment_author, comment_author_IP, comment_author_email, comment_author_url, comment_author_email_link, comment_author_url_link, comment_author_link, comment_type, comment_text, comment_excerpt, comment_date, comment_time, comments_rss_link, comment_author_rss, comment_text_rss, comment_link_rss, permalink_comments_rss, wp_list_comments, previous_comments_link, next_comments_link

How to pass parameters to tags with PHP function-style parameters Go to Template Tag index Retrieved from "http://codex.wordpress.org/Template_Tags/paginate_comments_links" Category: Template Tags

Template Tags/permalink anchor Contents


1 Description 2 Usage 3 Example 4 Parameters 5 Related

Description
Outputs a permalink anchor identier or id (<a id="....) for a post. This is useful for linking to a particular post on a page displaying several posts, such as an archive page. This tag must be within The Loop.

Usage

<?php permalink_anchor('type'); ?>

Example
Inserts the permalink anchor next to a post's title. <h3><?php permalink_anchor(); ?><?php the_title(); ?></h3>

Parameters
type (string) Type of anchor to output. Valid values are: 'id' - Anchor equals numeric post ID. This is the default. 'title' - Anchor equals postname, i.e. post slug.

Related
permalink_anchor, get_permalink, the_permalink, permalink_single_rss

How to pass parameters to tags Go to Template Tag index Retrieved from "http://codex.wordpress.org/Template_Tags/permalink_anchor" Category: Template Tags

Template Tags/permalink comments rss Contents


1 Description 2 Usage 3 Example 4 Parameters 5 Related

Description
Displays the permalink to the post to which a comment belongs, formatted for RSS. Typically used in the RSS comment feed template. This tag must be within The Loop, or a comment loop.

Usage
<?php permalink_comments_rss(); ?>

Example
<link><?php permalink_comments_rss(); ?></link>

Parameters
This tag has no parameters.

Related
comments_number, comments_link, comments_rss_link, comments_popup_script, comments_popup_link, comment_ID, comment_author, comment_author_IP, comment_author_email, comment_author_url, comment_author_email_link, comment_author_url_link, comment_author_link, comment_type, comment_text, comment_excerpt, comment_date, comment_time, comments_rss_link, comment_author_rss, comment_text_rss, comment_link_rss, permalink_comments_rss, wp_list_comments, previous_comments_link, next_comments_link Go to Template Tag index Retrieved from "http://codex.wordpress.org/Template_Tags/permalink_comments_rss" Categories: Template Tags | Feeds

Template Tags/permalink single rss Contents

1 Description 2 Usage 3 Example 4 Parameters 5 Related

Description
Displays the permalink for the current post, formatted for syndication feeds such as RSS or Atom. This tag must be used within The Loop.

Usage
<?php permalink_single_rss('file'); ?>

Example
Displays the permalink in an RSS link tag. <link><?php permalink_single_rss(); ?></link>

Parameters
le (string) The page the link should point to. Defaults to the current page.

Related
For permalinks in regular page templates, it's recommended to use the_permalink() instead. permalink_anchor, get_permalink, the_permalink, permalink_single_rss

How to pass parameters to tags Go to Template Tag index Retrieved from "http://codex.wordpress.org/Template_Tags/permalink_single_rss" Categories: Template Tags | Feeds

Template Tags/posts nav link Contents


1 Description 2 Usage 3 Examples 3.1 Default Usage 3.2 In Centered DIV 3.3 Using Images 3.4 Kubrick Theme Format 3.5 Customizing the Link Text 4 Parameters 5 Related

Description
Displays links for next and previous pages. Useful for providing "paged" navigation of index, category and archive pages. For displaying next and previous post navigation on individual posts, see next_post_link() and previous_post_link().

Usage
<?php posts_nav_link('sep','prelabel','nxtlabel'); ?> Note that since weblog posts are traditionally listed in reverse chronological order (with most recent posts at the top), there is some ambiguity in the denition of "next page". WordPress denes "next page" as the "next page toward the past". In WordPress 1.5, the default Kubrick theme addresses this ambiguity by labeling the "next page" link as "previous entries". See Example: Kubrick Theme Format.

Examples
Default Usage

By default, the posts_nav_link look like this: Previous Page Next Page <?php posts_nav_link(); ?>

In Centered DIV
Displays previous and next page links ("previous page next page") centered on the page. <div style="text-align:center;"> <?php posts_nav_link(' &#183; ', 'previous page', 'next page'); ?> </div>

Using Images
<?php posts_nav_link(' ', '<img src="images/prev.jpg" />', '<img src="images/next.jpg" />'); ?>

Kubrick Theme Format


The Kubrick theme format for posts navigation. <div class="navigation"> <div class="alignleft"><?php posts_nav_link('','','&laquo; Previous Entries') ?></div> <div class="alignright"><?php posts_nav_link('','Next Entries &raquo;','') ?></div> </div>

Customizing the Link Text


You can change the text in each of the links and in the text in between the links. You can go back to the previous page or you can go forward to the next page. <p><?php posts_nav_link(' or ', 'You can go back to the previous page', 'you can go forward to the next page'); ?>.</p>

Parameters
sep (string) Text displayed between the links. Defaults to ' :: ' in 1.2.x. Defaults to ' ' in 1.5. prelabel (string) Link text for the previous page. Defaults to '<< Previous Page' in 1.2.x. Defaults to ' Previous Page' in 1.5. nxtlabel (string) Link text for the next page. Defaults to 'Next Page >>' in 1.2.x. Defaults to 'Next Page ' in 1.5

Related
the_ID, the_title, the_title_attribute, single_post_title, the_title_rss, the_content, the_content_rss, the_excerpt, the_excerpt_rss, previous_post_link, next_post_link, posts_nav_link, the_meta,

How to pass parameters to tags with PHP function-style parameters Go to Template Tag index Retrieved from "http://codex.wordpress.org/Template_Tags/posts_nav_link" Category: Template Tags

Template Tags/previous comments link Contents


1 Description 2 Usage 3 Examples 3.1 Default Usage 3.2 Working example 4 Parameters 5 Related

Description
This creates a link to the previous comments page containing older comments.

Usage
<?php previous_comments_link( 'Label' ); ?>

Examples
Default Usage
<?php previous_comments_link(); ?>

Working example
<?php previous_comments_link( ' Older Comments' ); ?>

Parameters
label (string) The link text. Default is ' Older Comments'.

Related
See also next_comments_link(), paginate_comments_links()

How to pass parameters to tags with PHP function-style parameters Go to Template Tag index Retrieved from "http://codex.wordpress.org/Template_Tags/previous_comments_link" Category: Template Tags

Template Tags/previous post link Contents


1 Description 2 Usage 3 Examples 3.1 Default Usage 3.2 Bold Post Title As Link 3.3 Text As Link, Without Post Title, Within Same Category 3.4 Within Same Category, Excluding One 4 Parameters 5 Related

Description
Used on single post permalink pages, this template tag displays a link to the previous post which exists in chronological order from the current post. This tag must be used in The Loop.

Usage
<?php previous_post_link('format', 'link', in_same_cat,

'excluded_categories'); ?>

Examples
Default Usage
Displays link with left angular quote () followed by the post title of the previous post (chronological post date order). By default, this tag works like previous_post(). Previous Post Title <?php previous_post_link(); ?>

Bold Post Title As Link


Displays link with previous chronological post's title wrapped in 'strong' tags (typically sets text to bold). Previous Post Title <?php previous_post_link('<strong>%link</strong>'); ?>

Text As Link, Without Post Title, Within Same Category


Displays custom text as link to the previous post within the same category as the current post. Post title is not included here. "Previous in category" is the custom text, which can be changed to t your requirements. Previous in category <?php previous_post_link('%link', 'Previous in category', TRUE); ?>

Within Same Category, Excluding One


Displays link to previous post in the same category, as long as it is not in category 13 (the category ID #). You can change the number to any category you wish to exclude. Exclude multiple categories by using " and " as a delimiter. Previous in category <?php previous_post_link('%link', 'Previous in category', TRUE, '13'); ?>

Parameters
format (string) Format string for the link. This is where to control what comes before and after the link. '%link' in string will be replaced with whatever is declared as 'link' (see next parameter). 'Go to %link' will generate "Go to <a href=..." Put HTML tags here to style the nal results. Defaults to '&laquo; %link'. link (string) Link text to display. Defaults to previous post's title ('%title'). in_same_cat (boolean) Indicates whether previous post must be within the same category as the current post. If set to TRUE, only posts from the current category will be displayed. Options are: TRUE FALSE (Default) excluded_categories (string) Numeric category ID(s) from which the previous post should not be listed. Separate multiple categories with and; example: '1 and 5 and 15'. There is no default.

Related
See also next_post_link(). the_ID, the_title, the_title_attribute, single_post_title, the_title_rss, the_content, the_content_rss, the_excerpt, the_excerpt_rss, previous_post_link, next_post_link, posts_nav_link, the_meta,

How to pass parameters to tags with PHP function-style parameters Go to Template Tag index Retrieved from "http://codex.wordpress.org/Template_Tags/previous_post_link" Category: Template Tags

Template Tags/previous posts link Contents


1 Description 2 Usage 3 Examples 3.1 Default Usage 3.2 Working example 4 Parameters 5 Related

Description
This creates a link to the next posts. Yes, it says "previous posts," but it's named that just to confuse you.

Usage
<?php previous_posts_link('Label', 'Max number of pages (default 0)'); ?>

Examples
Default Usage
<?php previous_posts_link(); ?>

Working example
<?php previous_posts_link(' Previous Entries', '0') ?>

Parameters
label (string) The link text. Default is ' Previous Page'. max_pages (integer) Limit the number of pages on which the link is displayed.

Related
See also next_posts_link() and previous_post_link().

How to pass parameters to tags with PHP function-style parameters Go to Template Tag index Retrieved from "http://codex.wordpress.org/Template_Tags/previous_posts_link" Category: Template Tags

Template Tags/print AcmeMap Url Contents


1 Description 2 Usage 3 Example 4 Parameters 5 Related

Description
Displays the URL to a ACME Mapper generated map for your location. If the tag is called from within The_Loop, the Latitude and Longitude entered for a post is inserted in the query string of the URL for the map. When called outside The Loop (or inside The Loop, but no Lat/Lon was

entered for a post), default Latitude and Longitude for the weblog is inserted in the query string.

Usage
<?php print_AcmeMap_Url(); ?>

Example
<a href="<?php print_AcmeMap_Url(); ?>">Locate me with ACME Mapper</a>

Parameters
This tag has no parameters.

Related
print_Lat, print_Lon, print_UrlPopNav, print_AcmeMap_Url, print_GeoURL_Url, print_GeoCache_Url, print_MapQuest_Url, print_SideBit_Url, print_DegreeConuence_Url, print_TopoZone_Url, print_FindU_Url, print_MapTech_Url Go to Template Tag index Retrieved from "http://codex.wordpress.org/Template_Tags/print_AcmeMap_Url" Category: Template Tags

Template Tags/print DegreeConuence Url Contents


1 Description 2 Usage 3 Example 4 Parameters 5 Related

Description
Displays the URL to the nearest integer degree intersection Conuence page for your location. If the tag is called from within The_Loop, the Latitude and Longitude entered for a post is inserted in the query string of the URL to the page of the nearest integer degree conuence. When called outside The Loop (or inside The Loop, but no Lat/Lon was entered for a post), default Latitude and Longitude for the weblog is inserted in the query string.

Usage
<?php print_DegreeConfluence_Url(); ?>

Example
<a href="<?php print_DegreeConfluence_Url(); ?>">What integer degree intersection am I near?</a>

Parameters
This tag has no parameters.

Related
print_Lat, print_Lon, print_UrlPopNav, print_AcmeMap_Url, print_GeoURL_Url, print_GeoCache_Url, print_MapQuest_Url, print_SideBit_Url, print_DegreeConuence_Url, print_TopoZone_Url, print_FindU_Url, print_MapTech_Url Go to Template Tag index Retrieved from "http://codex.wordpress.org/Template_Tags/print_DegreeConuence_Url" Category: Template Tags

Template Tags/print FindU Url Contents


1 Description 2 Usage 3 Example 4 Parameters

5 Related

Description
Displays the URL to a APRS FindU generated page listing HAM radio stations near your location. If the tag is called from within The_Loop, the Latitude and Longitude entered for a post is inserted in the query string of the URL used for generating the list of HAM radio stations. When called outside The Loop (or inside The Loop, but no Lat/Lon was entered for a post), default Latitude and Longitude for the weblog is inserted in the query string.

Usage
<?php print_FindU_Url(); ?>

Example
<a href="<?php print_FindU_Url(); ?>">HAM stations near me</a>

Parameters
This tag has no parameters.

Related
print_Lat, print_Lon, print_UrlPopNav, print_AcmeMap_Url, print_GeoURL_Url, print_GeoCache_Url, print_MapQuest_Url, print_SideBit_Url, print_DegreeConuence_Url, print_TopoZone_Url, print_FindU_Url, print_MapTech_Url Go to Template Tag index Retrieved from "http://codex.wordpress.org/Template_Tags/print_FindU_Url" Category: Template Tags

Template Tags/print GeoCache Url Contents


1 Description 2 Usage 3 Example 4 Parameters 5 Related

Description
Displays the URL for a Geocaching generated list of geocaches near your location. If the tag is called from within The_Loop, the Latitude and Longitude entered for a post is inserted in the query string of the URL for the geocache locations. When called outside The Loop (or inside The Loop, but no Lat/Lon was entered for a post), default Latitude and Longitude for the weblog is inserted in the query string.

Usage
<?php print_GeoCache_Url(); ?>

Example
<a href="<?php print_GeoCache_Url(); ?>">Locate geocaches near me</a>

Parameters
This tag has no parameters.

Related
print_Lat, print_Lon, print_UrlPopNav, print_AcmeMap_Url, print_GeoURL_Url, print_GeoCache_Url, print_MapQuest_Url, print_SideBit_Url, print_DegreeConuence_Url, print_TopoZone_Url, print_FindU_Url, print_MapTech_Url Go to Template Tag index Retrieved from "http://codex.wordpress.org/Template_Tags/print_GeoCache_Url" Category: Template Tags

Template Tags/print GeoURL Url

Contents
1 Description 2 Usage 3 Example 4 Parameters 5 Related

Description
Displays the URL to a GeoURL page listing websites near your location. If the tag is called from within The_Loop, the Latitude and Longitude entered for a post is inserted in the query string of the URL for the list. When called outside The Loop (or inside The Loop, but no Lat/Lon was entered for a post), default Latitude and Longitude for the weblog is inserted in the query string.

Usage
<?php print_GeoURL_Url(); ?> <meta name="robots" content="index, follow" /> <meta name="distribution" content="global" /> <meta name="revisit-after" content="2 days" /> <meta name="author" content="donkdepeggy kampanye damai" /> <meta name="language" content="ID" /> <meta name="geo.country" content="ID" /> <meta name="geo.placename" content="Indonesia" />

Example
<a href="<?php print_GeoURL_Url(); ?>">Locate sites near me with GeoURL</a>

Parameters
This tag has no parameters.

Related
print_Lat, print_Lon, print_UrlPopNav, print_AcmeMap_Url, print_GeoURL_Url, print_GeoCache_Url, print_MapQuest_Url, print_SideBit_Url, print_DegreeConuence_Url, print_TopoZone_Url, print_FindU_Url, print_MapTech_Url Go to Template Tag index Retrieved from "http://codex.wordpress.org/Template_Tags/print_GeoURL_Url" Category: Template Tags

Template Tags/print Lat Contents


1 Description 2 Usage 3 Example 4 Parameters 5 Related

Description
Displays the Geographic (geodata) Options Latitude setting. If the tag is called from within The_Loop, the Latitude entered for a post is displayed. When called outside The Loop (or inside The Loop, but no Latitude was entered for a post), the default Latitude setting for the weblog is displayed.

Usage
<?php print_Lat(); ?>

Example
<p>Trip locale: <?php print_Lat(); ?>Lat, <?php print_Lon(); ?>Lon</p>

Parameters
This tag has no parameters.

Related
print_Lat, print_Lon, print_UrlPopNav, print_AcmeMap_Url, print_GeoURL_Url, print_GeoCache_Url, print_MapQuest_Url, print_SideBit_Url, print_DegreeConuence_Url, print_TopoZone_Url, print_FindU_Url, print_MapTech_Url

Go to Template Tag index Retrieved from "http://codex.wordpress.org/Template_Tags/print_Lat" Category: Template Tags

Template Tags/print Lon Contents


1 Description 2 Usage 3 Example 4 Parameters 5 Related

Description
Displays the Geographic (geodata) Options Longitude setting. If the tag is called from within The_Loop, the Longitude entered for a post is displayed. When called outside The Loop (or inside The Loop, but no Longitude was entered for a post), the default Longitude setting for the weblog is displayed.

Usage
<?php print_Lon(); ?>

Example
<p>Trip locale: <?php print_Lat(); ?>Lat, <?php print_Lon(); ?>Lon</p>

Parameters
This tag has no parameters.

Related
print_Lat, print_Lon, print_UrlPopNav, print_AcmeMap_Url, print_GeoURL_Url, print_GeoCache_Url, print_MapQuest_Url, print_SideBit_Url, print_DegreeConuence_Url, print_TopoZone_Url, print_FindU_Url, print_MapTech_Url Go to Template Tag index Retrieved from "http://codex.wordpress.org/Template_Tags/print_Lon" Category: Template Tags

Template Tags/print MapQuest Url Contents


1 Description 2 Usage 3 Example 4 Parameters 5 Related

Description
Displays the URL for a MapQuest generated map of your location. If the tag is called from within The_Loop, the Latitude and Longitude entered for a post is inserted in the query string of the URL used for generating the map. When called outside The Loop (or inside The Loop, but no Lat/Lon was entered for a post), default Latitude and Longitude for the weblog is inserted in the query string.

Usage
<?php print_MapQuest_Url(); ?>

Example
<a href="<?php print_MapQuest_Url(); ?>">MapQuest map of my location</a>

Parameters
This tag has no parameters.

Related
print_Lat, print_Lon, print_UrlPopNav, print_AcmeMap_Url, print_GeoURL_Url, print_GeoCache_Url, print_MapQuest_Url, print_SideBit_Url, print_DegreeConuence_Url, print_TopoZone_Url, print_FindU_Url, print_MapTech_Url Go to Template Tag index Retrieved from "http://codex.wordpress.org/Template_Tags/print_MapQuest_Url" Category: Template Tags

Template Tags/print MapTech Url Contents


1 Description 2 Usage 3 Example 4 Parameters 5 Related

Description
Displays the URL to a Maptech generated geographical map for your location. If the tag is called from within The_Loop, the Latitude and Longitude entered for a post is inserted in the query string of the URL used for generating the map. When called outside The Loop (or inside The Loop, but no Lat/Lon was entered for a post), default Latitude and Longitude for the weblog is inserted in the query string.

Usage
<?php print_MapTech_Url(); ?>

Example
<a href="<?php print_MapTech_Url(); ?>">Maptech map of my location</a>

Parameters
This tag has no parameters.

Related
print_Lat, print_Lon, print_UrlPopNav, print_AcmeMap_Url, print_GeoURL_Url, print_GeoCache_Url, print_MapQuest_Url, print_SideBit_Url, print_DegreeConuence_Url, print_TopoZone_Url, print_FindU_Url, print_MapTech_Url Go to Template Tag index Retrieved from "http://codex.wordpress.org/Template_Tags/print_MapTech_Url" Category: Template Tags

Template Tags/print SideBit Url Contents


1 Description 2 Usage 3 Example 4 Parameters 5 Related

Description
Displays the URL for a SideBit generated map of sites in your location. If the tag is called from within The_Loop, the Latitude and Longitude entered for a post is inserted in the query string of the URL used for generating the map. When called outside The Loop (or inside The Loop, but no Lat/Lon was entered for a post), default Latitude and Longitude for the weblog is inserted in the query string.

Usage
<?php print_SideBit_Url(); ?>

Example
<a href="<?php print_SideBit_Url(); ?>">SideBit map of my location</a>

Parameters
This tag has no parameters.

Related
print_Lat, print_Lon, print_UrlPopNav, print_AcmeMap_Url, print_GeoURL_Url, print_GeoCache_Url, print_MapQuest_Url, print_SideBit_Url, print_DegreeConuence_Url, print_TopoZone_Url, print_FindU_Url, print_MapTech_Url Go to Template Tag index Retrieved from "http://codex.wordpress.org/Template_Tags/print_SideBit_Url" Category: Template Tags

Template Tags/print TopoZone Url Contents


1 Description 2 Usage 3 Example 4 Parameters 5 Related

Description
Displays the URL to a TopoZone generated topographic map for your location. If the tag is called from within The_Loop, the Latitude and Longitude entered for a post is inserted in the query string of the URL used for generating the map. When called outside The Loop (or inside The Loop, but no Lat/Lon was entered for a post), default Latitude and Longitude for the weblog is inserted in the query string.

Usage
<?php print_TopoZone_Url(); ?>

Example
<a href="<?php print_TopoZone_Url(); ?>">Topographic map of my location</a>

Parameters
This tag has no parameters.

Related
print_Lat, print_Lon, print_UrlPopNav, print_AcmeMap_Url, print_GeoURL_Url, print_GeoCache_Url, print_MapQuest_Url, print_SideBit_Url, print_DegreeConuence_Url, print_TopoZone_Url, print_FindU_Url, print_MapTech_Url Go to Template Tag index Retrieved from "http://codex.wordpress.org/Template_Tags/print_TopoZone_Url" Category: Template Tags

Template Tags/print UrlPopNav Contents


1 Description 2 Usage 3 Example 4 Parameters 5 Related

Description
Displays a dropdown menu, of which each option is a link opening in a new browser window the mentioned geodata-related site. If the tag is called from within The_Loop, the Latitude and Longitude entered for a post are queried at each site. When called outside The Loop (or inside The Loop, but no Lat/Lon was entered for a post), default Latitude and Longitude for the weblog are queried. Link options in the dropdown menu are: Acme Mapper

GeoURLs near here GeoCaches near here MapQuest map of this spot SideBit URL map of this spot Conuence.org near here Topozone near here FindU near here Maptech near here

Usage
<?php print_UrlPopNav(); ?>

Example
<div>Choose Geo site: <?php print_UrlPopNav(); ?></div>

Parameters
This tag has no parameters.

Related
print_Lat, print_Lon, print_UrlPopNav, print_AcmeMap_Url, print_GeoURL_Url, print_GeoCache_Url, print_MapQuest_Url, print_SideBit_Url, print_DegreeConuence_Url, print_TopoZone_Url, print_FindU_Url, print_MapTech_Url Go to Template Tag index Retrieved from "http://codex.wordpress.org/Template_Tags/print_UrlPopNav" Category: Template Tags

Template Tags/query posts Contents


1 Description 2 Important note 3 Usage 4 Examples 4.1 Exclude Categories From Your Home Page 4.2 Retrieve a Particular Post 4.3 Retrieve a Particular Page 4.4 Passing variables to query_posts 4.4.1 Example 1 4.4.2 Example 2 4.4.3 Example 3 4.4.4 Example 4 5 Parameters 5.1 Category Parameters 5.2 Tag Parameters 5.3 Author Parameters 5.4 Post & Page Parameters 5.5 Sticky Post Parameters 5.6 Time Parameters 5.7 Page Parameters 5.8 Offset Parameter 5.9 Orderby Parameters 5.10 Custom Field Parameters 5.11 Combining Parameters 6 Resources 7 Related

Description
Query_posts can be used to control which posts show up in The Loop. It accepts a variety of parameters in the same format as used in your URL (e.g. p=4 to show only post of ID number 4). Why go through all the trouble of changing the query that was meticulously created from your given URL? You can customize the presentation of your blog entries by combining it with page logic (like the Conditional Tags) -- all without changing any of the URLs. Common uses might be to: Display only a single post on your homepage (a single Page can be done via Settings -> Reading). Show all posts from a particular time period.

Show the latest post (only) on the front page. Change how posts are ordered. Show posts from only one category. Exclude one or more categories.

Important note
The query_posts function is intended to be used to modify the main page Loop only. It is not intended as a means to create secondary Loops on the page. If you want to create separate Loops outside of the main one, you should create separate WP_Query objects and use those instead. Use of query_posts on Loops other than the main one can result in your main Loop becoming incorrect and possibly displaying things that you were not expecting. The query_posts function overrides and replaces the main query for the page. To save your sanity, do not use it for any other purpose.

Usage
Place a call to query_posts() in one of your Template les before The Loop begins. The wp_query object will generate a new SQL query using your parameters. When you do this, WordPress ignores the other parameters it receives via the URL (such as page number or category). If you want to preserve that information, you can use the variable $query_string in the call to query_posts(). For example, to set the display order of the posts without affecting the rest of the query string, you could place the following before The Loop: query_posts($query_string . "&order=ASC") When using query_posts in this way, the quoted portion of the argument must begin with an ampersand (&).

Examples
Exclude Categories From Your Home Page
Placing this code in your index.php le will cause your home page to display posts from all categories except category ID 3. <?php if (is_home()) { query_posts("cat=-3"); } ?> You can also add some more categories to the exclude-list(tested with WP 2.1.2): <?php if (is_home()) { query_posts("cat=-1,-2,-3"); } ?>

Retrieve a Particular Post


To retrieve a particular post, you could use the following: <?php // retrieve one post with an ID of 5 query_posts('p=5'); ?> If you want to use the Read More functionality with this query, you will need to set the global $more variable to 0. <?php // retrieve one post with an ID of 5 query_posts('p=5'); global $more; // set $more to 0 in order to only get the first part of the post $more = 0; // the Loop while (have_posts()) : the_post(); // the content of the post the_content('Read the full post '); endwhile; ?>

Retrieve a Particular Page


To retrieve a particular page, you could use the following: <?php query_posts('page_id=7'); ?> or <?php query_posts('pagename=about'); //retrieves the about page only ?> For child pages, the slug of the parent and the child is required, separated by a slash. For example: <?php query_posts('pagename=parent/child'); // retrieve the child page of a parent ?>

//retrieves page 7 only

Passing variables to query_posts


You can pass a variable to the query with two methods, depending on your needs. As with other examples, place these above your Loop: Example 1 In this example, we concatenate the query before running it. First assign the variable, then concatenate and then run it. Here we're pulling in a category variable from elsewhere. <?php $categoryvariable=$cat; // assign the variable as current category $query= 'cat=' . $categoryvariable. '&orderby=date&order=ASC'; // concatenate the query query_posts($query); // run the query ?> Example 2 In this next example, the double " quotes " tell PHP to treat the enclosed as an expression. For this example, we are getting the current month and the current year, and telling query posts to bring us the posts for the current month/year, and in this case, listing in ascending so we get oldest post at top of page.

<?php $current_month = date('m'); ?> <?php $current_year = date('Y'); ?> <?php query_posts("cat=22&year=$current_year&monthnum=$current_month&order=ASC"); ?> <!-- put your loop here --> Example 3 This example explains how to generate a complete list of posts, dealing with pagination. We can use the default $query_string telling query posts to bring us a full posts listing. We can also modify the posts_per_page query argument from -1 to the number of posts you want to show on each page; in this last case, you'll probably want to use posts_nav_link() to navigate the generated archive. . <?php query_posts($query_string.'&posts_per_page=-1'); while(have_posts()) { the_post(); <!-- put your loop here --> } ?> Example 4 If you don't need to use the $query_string variable, then another method exists that is more clear and readable, in some more complex cases. This method puts the parameters into an array, and then passes the array. The same query as in Example 2 above could be done like this: query_posts(array( 'cat' => 22, 'year'=> $current_year, 'monthnum'=>$current_month, 'order'=>'ASC',

)); As you can see, with this approach, every variable can be put on its own line, for simpler reading.

Parameters
This is not an exhaustive list yet. It is meant to show some of the more common things possible with setting your own queries.

Category Parameters
Show posts only belonging to certain categories. cat category_name category__and category__in category__not_in Show One Category by ID Display posts from only one category ID (and any children of that category): query_posts('cat=4'); Show One Category by Name Display posts from only one category by name: query_posts('category_name=Staff Home'); Show Several Categories by ID Display posts from several specic category IDs: query_posts('cat=2,6,17,38'); Exclude Posts Belonging to Only One Category Show all posts except those from a category by prexing its ID with a '-' (minus) sign. query_posts('cat=-3'); This excludes any post that belongs to category 3. Multiple Category Handling Display posts that are in multiple categories. This shows posts that are in both categories 2 and 6: query_posts(array('category__and' => array(2,6))); To display posts from either category 2 OR 6, you could use cat as mentioned above, or by using category__in: query_posts(array('category__in' => array(2,6))); You can also exclude multiple categories this way: query_posts(array('category__not_in' => array(2,6)));

Tag Parameters
Show posts associated with certain tags. tag tag__and tag__in tag_slug__and tag_slug__in Fetch posts for one tag query_posts('tag=cooking'); Fetch posts that have either of these tags

query_posts('tag=bread,baking'); Fetch posts that have all three of these tags: query_posts('tag=bread+baking+recipe'); Multiple Tag Handling Display posts that are in multiple tags: query_posts(array('tag__and' => array('bread','baking')); This only shows posts that are in both tags 'bread' and 'baking'. To display posts from either tag, you could use tag as mentioned above, or explicitly specify by using tag__in: query_posts(array('tag__in' => array('bread','baking')); The tag_slug__in and tag_slug__and behave much the same, except match against the tag's slug instead of the tag itself. Also see Ryan's discussion of Tag intersections and unions.

Author Parameters
You can also restrict the posts by author. author_name=Harriet Note: author_name operates on the user_nicename eld, whilst author operates on the author id. author=3 Display all Pages for author=1, in title order, with no sticky posts tacked to the top: query_posts('caller_get_posts=1&author=1&post_type=page&post_status=publish&orderby=title&order=ASC');

Post & Page Parameters


Retrieve a single post or page. p=27 - use the post ID to show that post name=about-my-life - query for a particular post that has this Post Slug page_id=7 - query for just Page ID 7 pagename=about - note that this is not the page's title, but the page's path showposts=1 - use showposts=3 to show 3 posts. Use showposts=-1 to show all posts 'post__in' => array(5,12,2,14,7) - inclusion, lets you specify the post IDs to retrieve 'post__not_in' => array(6,2,8) - exclusion, lets you specify the post IDs NOT to retrieve 'post_type=page' - returns Pages; defaults to value of post; can be any, attachment, page, or post.

Sticky Post Parameters


Sticky posts rst became available with WordPress Version 2.7. Posts that are set as Sticky will be displayed before other posts in a query, unless excluded with the caller_get_posts=1 parameter. array('post__in'=>get_option('sticky_posts')) - returns array of all sticky posts caller_get_posts=1 - To exclude sticky posts be included at the beginning of posts returned, but the sticky post will still be returned in the natural order of that list of posts returned. To return just the rst sticky post: $sticky=get_option('sticky_posts') ; query_posts('p=' . $sticky[0]); To exclude all sticky posts from the query: query_posts(array("post__not_in" =>get_option("sticky_posts"))); Return ALL posts with the category, but don't show sticky posts at the top. The 'sticky posts' will still show in their natural position (e.g. by date): query_posts('caller_get_posts=1&showposts=3&cat=6'); Return posts with the category, but exclude sticky posts completely, and adhere to paging rules: <?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; $sticky=get_option('sticky_posts');

$args=array( 'cat'=>3, 'caller_get_posts'=>1, 'post__not_in' => $sticky, 'paged'=>$paged, ); query_posts($args); ?>

Time Parameters
Retrieve posts belonging to a certain time period. hour= - hour (from 0 to 23) minute= - minute (from 0 to 60) second= - second (0 to 60) day= - day of the month (from 1 to 31) monthnum= - month number (from 1 to 12) year= - 4 digit year (e.g. 2009) w= - week of the year (from 0 to 53) and uses the MySQL WEEK command Mode=1. Returns posts for just the current date: $today = getdate(); query_posts('year=' .$today["year"] .'&monthnum=' .$today["mon"] .'&day=' .$today["mday"] ); Returns posts dated December 20: query_posts(monthnum=12&day=20' );

Page Parameters
paged=2 - show the posts that would normally show up just on page 2 when using the "Older Entries" link. posts_per_page=10 - number of posts to show per page; a value of -1 will show all posts. order=ASC - show posts in chronological order, DESC to show in reverse order (the default)

Offset Parameter
You can displace or pass over one or more initial posts which would normally be collected by your query through the use of the offset parameter. The following will display the 5 posts which follow the most recent (1): query_posts('showposts=5&offset=1');

Orderby Parameters
Sort retrieved posts by this eld. orderby=author orderby=date orderby=category Note: this doesn't work and likely will be discontinued with version 2.8 orderby=title orderby=modified orderby=menu_order orderby=parent orderby=ID orderby=rand orderby=meta_value - note that a meta_key=some value clause should be present in the query parameter also Also consider order parameter of "ASC" or "DESC"

Custom Field Parameters


Retrieve posts (or Pages) based on a custom eld key or value. meta_key= meta_value= meta_compare= - operator to test the meta_value=, default is '=', with other possible values of '!=', '>', '>=', '<', or '<=' Returns posts with custom elds matching both a key of 'color' AND a value of 'blue':

query_posts('meta_key=color&meta_value=blue'); Returns posts with a custom eld key of 'color', regardless of the custom eld value: query_posts('meta_key=color'); Returns posts where the custom eld value is 'color', regardless of the custom eld key: query_posts('meta_value=color'); Returns any Page where the custom eld value is 'green', regardless of the custom eld key: query_posts('post_type=page&meta_value=green'); Returns both posts and Pages with a custom eld key of 'color' where the custom eld value IS NOT EQUAL TO 'blue': query_posts('post_type=any&meta_key=color&meta_compare=!=&meta_value=blue'); Returns posts with custom eld key of 'miles' with a custom eld value that is LESS THAN OR EQUAL TO 22. Note the value 99 will be considered greater than 100 as the data is store as strings, not numbers. query_posts('meta_key=miles&meta_compare=<=&meta_value=22');

Combining Parameters
You may have noticed from some of the examples above that you combine parameters with an ampersand (&), like so: query_posts('cat=3&year=2004'); Posts for category 13, for the current month on the main page: if (is_home()) { query_posts($query_string . '&cat=13&monthnum=' . date('n',current_time('timestamp'))); } At 2.3 this combination will return posts belong to both Category 1 AND 3, showing just two (2) posts, in descending order by the title: query_posts(array('category__and'=>array(1,3),'showposts'=>2,'orderby'=>title,'order'=>DESC)); In 2.3 and 2.5 one would expect the following to return all posts that belong to category 1 and is tagged "apples" query_posts('cat=1&tag=apples'); A bug prevents this from happening. See Ticket #5433. A workaround is to search for several tags using + query_posts('cat=1&tag=apples+apples'); This will yield the expected results of the previous query. Note that using 'cat=1&tag=apples+oranges' yields expected results.

Resources
If..Else - Query Post Redux If..Else - Make WordPress Show Only one Post on the Front Page If..Else - Query Posts Perishable Press - 6 Ways to Customize WordPress Post Order nietoperzka's Custom order of posts on the main page http://www.darrenhoyt.com/2008/06/11/displaying-related-category-and-author-content-in-wordpress/ Displaying related category and author content] Exclude posts from displaying

Related
bloginfo, bloginfo_rss, get_bloginfo, get_bloginfo_rss, wp_title, wp_get_archives, get_calendar, get_posts, wp_list_pages, wp_page_menu, wp_dropdown_pages, wp_loginout, wp_register, wp_logout_url, query_posts, rss_enclosure

How to pass parameters to tags Go to Template Tag index

This page is marked as incomplete. You can help Codex by expanding it. Retrieved from "http://codex.wordpress.org/Template_Tags/query_posts" Categories: Template Tags | Stubs

Template Tags/rss enclosure Contents


1 Description 2 Usage 3 Parameters 3.1 Related

Description
Transforms links to audio or video les in a post into RSS enclosures. Used for Podcasting.

Usage
<?php rss_enclosure(); ?>

Parameters
None.

Related
bloginfo, bloginfo_rss, get_bloginfo, get_bloginfo_rss, wp_title, wp_get_archives, get_calendar, get_posts, wp_list_pages, wp_page_menu, wp_dropdown_pages, wp_loginout, wp_register, wp_logout_url, query_posts, rss_enclosure

How to pass parameters to tags Go to Template Tag index

This page is marked as incomplete. You can help Codex by expanding it. Retrieved from "http://codex.wordpress.org/Template_Tags/rss_enclosure" Categories: Template Tags | Stubs

Template Tags/single cat title Contents


1 Description 2 Usage 3 Examples 4 Parameters 5 Related

Description
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.

Usage
<?php single_cat_title('prefix', 'display'); ?>

Examples
This example displays the text "Currently browsing " followed by the category title. <p><?php single_cat_title('Currently browsing '); ?>.</p>

Currently browsing WordPress.

This example assigns the current category title to the variable $current_category for use in PHP. <?php $current_category = single_cat_title("", false); ?>

Parameters
prex (string) Text to output before the category title. Defaults to '' (no text). display (boolean) Display the category's title (TRUE) or return it for use in PHP (FALSE). Defaults to TRUE.

Related
the_category, the_category_rss, single_cat_title, category_description, wp_dropdown_categories, wp_list_categories, in_category, get_category_parents, get_the_category get_category_link,

How to pass parameters to tags with PHP function-style parameters Go to Template Tag index Retrieved from "http://codex.wordpress.org/Template_Tags/single_cat_title" Category: Template Tags

Template Tags/single month title Contents


1 Description 2 Usage 3 Examples 3.1 Month and Year on New Lines 3.2 Using $my_month Variable 4 Parameters 5 Related

Description
Displays or returns the month and year title for the current page. This tag only works when the m or archive month argument has been passed by WordPress to the current page (this occurs when viewing a monthly archive page). Note: This tag only works on date archive pages, not on category templates or others.

Usage
<?php single_month_title('prefix', display) ?> The generated title will be: prefix + MONTH + prefix + YEAR If prex parameter is '*', an example would be: *February*2004

Examples
Month and Year on New Lines
Displays the title, placing month and year on new lines. <p><?php single_month_title('<br />') ?></p> December 2004

Using $my_month Variable


Returns the title, which is assigned to the $my_month variable. The variable's value is then displayed with the PHP echo command. <?php $my_month = single_month_title('', false); echo $my_month; ?>

Parameters
prex (string) Text to place before the title. There is no default. display (boolean) Display the title (TRUE), or return the title to be used in PHP (FALSE). Defaults to TRUE.

Related
the_date_xml, the_date, the_time, the_modied_date, the_modied_time, get_the_time, single_month_title, get_calendar, the_weekday, the_weekday_date

How to pass parameters to tags with PHP function-style parameters Go to Template Tag index Retrieved from "http://codex.wordpress.org/Template_Tags/single_month_title" Category: Template Tags

Template Tags/single post title Contents


1 Description 2 Usage 3 Example 4 Parameters 5 Related

Description
Displays or returns the title of the post when on a single post page (permalink page). This tag can be useful for displaying post titles outside The Loop.

Usage
<?php single_post_title('prefix', display); ?>

Example
<h2><?php single_post_title('Current post: '); ?></h2> Current post: Single Post Title

Parameters
prex (string) Text to place before the title. Defaults to ''. display (boolean) Should the title be displayed (TRUE) or returned for use in PHP (FALSE). Defaults to TRUE.

Related
the_ID, the_title, the_title_attribute, single_post_title, the_title_rss, the_content, the_content_rss, the_excerpt, the_excerpt_rss, previous_post_link, next_post_link, posts_nav_link, the_meta,

How to pass parameters to tags with PHP function-style parameters Go to Template Tag index

Retrieved from "http://codex.wordpress.org/Template_Tags/single_post_title" Category: Template Tags

Template Tags/single tag title Contents


1 Description 2 Usage 3 Examples 4 Parameters 5 Related

Description
Displays or returns the tag title for the current page.

Usage
<?php single_tag_title('prefix', 'display'); ?>

Examples
This example displays the text "Currently browsing " followed by the tag title. <p><?php single_tag_title('Currently browsing '); ?>.</p> Currently browsing WordPress.

This example assigns the current tag title to the variable $current_tag for use in PHP. <?php $current_tag = single_tag_title("", false); ?>

Parameters
prex (string) Text to output before the tag title. Defaults to '' (no text). display (boolean) Display the tag's title (TRUE) or return it for use in PHP (FALSE). Defaults to TRUE.

Related
the_tags, get_the_tags, get_the_tag_list, single_tag_title, get_tag_link, wp_tag_cloud, wp_generate_tag_cloud

How to pass parameters to tags with PHP function-style parameters Go to Template Tag index Retrieved from "http://codex.wordpress.org/Template_Tags/single_tag_title" Category: Template Tags

Template Tags/sticky class Contents


1 Description 2 Usage 3 Examples 3.1 Default Usage 3.2 Sticky Post Identier 4 Parameters 5 Related

Description
Displays the sticky post class on a post if applicable. This tag must be within The Loop. Requires Wordpress 2.7 or later.

Usage

<?php sticky_class(); ?>

Examples
Default Usage
<div class="post<?php sticky_class(); ?>" id="post-<?php the_ID(); ?>">

Sticky Post Identier


Provides a sticky class to each post that it applies to:

Parameters
This tag has no parameters.

Related
the_ID, the_title, the_title_attribute, single_post_title, the_title_rss, the_content, the_content_rss, the_excerpt, the_excerpt_rss, previous_post_link, next_post_link, posts_nav_link, the_meta, Go to Template Tag index Retrieved from "http://codex.wordpress.org/Template_Tags/sticky_class" Category: Template Tags

Template Tags/the ID Contents


1 Description 2 Usage 3 Examples 3.1 Default Usage 3.2 Post Anchor Identier 4 Parameters 5 Related

Description
Displays the numeric ID of the current post. This tag must be within The Loop.

Usage
<?php the_ID(); ?>

Examples
Default Usage
<p>Post Number: <?php the_ID(); ?></p>

Post Anchor Identier


Provides a unique anchor identier to each post: <h3 id="post-<?php the_ID(); ?>"><?php the_title(); ?></h3> Note: In XHTML, the id attribute must not start with a digit. Since the_ID returns the post ID as numerical data, you should include at least one alphabetical character before using it in an id attribute, as in the example above.

Parameters
This tag has no parameters.

Related
the_ID, the_title, the_title_attribute, single_post_title, the_title_rss, the_content, the_content_rss, the_excerpt, the_excerpt_rss, previous_post_link, next_post_link, posts_nav_link, the_meta, Go to Template Tag index Retrieved from "http://codex.wordpress.org/Template_Tags/the_ID"

Category: Template Tags

Template Tags/the author Contents


1 Description 2 Usage 3 Examples 3.1 Display Author's 'Public' Name 4 Parameters 5 Related

Description
The author of a post can be displayed by using this Template Tag. This tag must be used within The Loop.

Usage
<?php the_author(); ?>

Examples
Display Author's 'Public' Name
Displays the value in the user's Display name publicly as eld. <p>This post was written by <?php the_author(); ?></p>

Parameters
This function takes no arguments. (The arguments have been deprecated.)

Related
the_author, the_author_description, the_author_login, the_author_rstname, the_author_lastname, the_author_nickname, the_author_ID, the_author_email, the_author_url, the_author_link, the_author_icq, the_author_aim, the_author_yim, the_author_msn, the_modied_author, the_author_posts, the_author_posts_link, list_authors, wp_list_authors

How to pass parameters to tags with PHP function-style parameters Go to Template Tag index Retrieved from "http://codex.wordpress.org/Template_Tags/the_author" Category: Template Tags

Template Tags/the author ID Contents


1 Description 2 Usage 3 Example 4 Parameters 5 Related

Description
Displays the unique numeric user ID for the author of a post; the ID is assigned by WordPress when a user account is created. This tag must be used within The Loop.

Usage
<?php the_author_ID(); ?>

Example
Uses the author ID as a query link to all of that author's posts. <a href="/blog/index.php?author=<?php the_author_ID(); ?>">View all posts by <?php the_author_nickname(); ?></a>

Parameters
This tag does not accept any parameters.

Related
the_author, the_author_description, the_author_login, the_author_rstname, the_author_lastname, the_author_nickname, the_author_ID, the_author_email, the_author_url, the_author_link, the_author_icq, the_author_aim, the_author_yim, the_author_msn, the_modied_author, the_author_posts, the_author_posts_link, list_authors, wp_list_authors Go to Template Tag index Retrieved from "http://codex.wordpress.org/Template_Tags/the_author_ID" Category: Template Tags

Template Tags/the author aim Contents


1 Description 2 Usage 3 Example 4 Parameters 5 Related

Description
This tag displays the AOL Instant Messenger screenname for the author of a post. The AIM eld is set in the user's prole (Administration > Prole > Your Prole). This tag must be used within The Loop.

Usage
<?php the_author_aim(); ?>

Example
<p>Contact me on AOL Instant Messenger: <?php the_author_aim(); ?></p>

Parameters
This tag does not accept any parameters.

Related
the_author, the_author_description, the_author_login, the_author_rstname, the_author_lastname, the_author_nickname, the_author_ID, the_author_email, the_author_url, the_author_link, the_author_icq, the_author_aim, the_author_yim, the_author_msn, the_modied_author, the_author_posts, the_author_posts_link, list_authors, wp_list_authors Go to Template Tag index Retrieved from "http://codex.wordpress.org/Template_Tags/the_author_aim" Category: Template Tags

Template Tags/the author description Contents


1 Description 2 Usage 3 Example 4 Parameters 5 Related

Description
Displays the contents of the About yourself eld in an author's prole (Administration > Prole > Your Prole). About yourself is a block of text often used to publicly describe the user and can be quite long. This tag must be used within The Loop.

Usage
<?php the_author_description(); ?>

Example
<p>Author's About yourself biography: <?php the_author_description(); ?></p>

Parameters
This tag does not accept any parameters.

Related
the_author, the_author_description, the_author_login, the_author_rstname, the_author_lastname, the_author_nickname, the_author_ID, the_author_email, the_author_url, the_author_link, the_author_icq, the_author_aim, the_author_yim, the_author_msn, the_modied_author, the_author_posts, the_author_posts_link, list_authors, wp_list_authors Go to Template Tag index Retrieved from "http://codex.wordpress.org/Template_Tags/the_author_description" Category: Template Tags

Template Tags/the author email Contents


1 Description 2 Usage 3 Examples 3.1 Mailto Link 3.2 Secure From Spammers 4 Parameters 5 Related

Description
This tag displays the email address for the author of a post. The E-mail eld is set in the user's prole (Administration > Prole > Your Prole). This tag must be used within The Loop. Note that the address is not encoded or protected in any way from harvesting by spambots. For this, see the Secure From Spammers example.

Usage
<?php the_author_email(); ?>

Examples
Mailto Link
Displays author email address as a "mailto" link. <a href="mailto:<?php the_author_email(); ?>">Contact the author</a>

Secure From Spammers


This example partially 'obfuscates' address by using the internal function antispambot() to encode portions in HTML character entities (these are read correctly by your browser). Note the example uses get_the_author_email() function, because the_author_email() echoes the address before antispambot() can act upon it. <a href="mailto:<?php echo antispambot(get_the_author_email()); ?>">email author</a>

Parameters
This tag does not accept any parameters.

Related
the_author, the_author_description, the_author_login, the_author_rstname, the_author_lastname, the_author_nickname, the_author_ID, the_author_email, the_author_url, the_author_link, the_author_icq, the_author_aim, the_author_yim, the_author_msn, the_modied_author, the_author_posts, the_author_posts_link, list_authors, wp_list_authors Go to Template Tag index

Retrieved from "http://codex.wordpress.org/Template_Tags/the_author_email" Category: Template Tags

Template Tags/the author rstname Contents


1 Description 2 Usage 3 Example 4 Parameters 5 Related

Description
This tag displays the rst name for the author of a post. The First Name eld is set in the user's prole (Administration > Prole > Your Prole). This tag must be used within The Loop.

Usage
<?php the_author_firstname(); ?>

Example
<p>This post was written by <?php the_author_firstname(); ?></p>

Parameters
This tag does not accept any parameters.

Related
the_author, the_author_description, the_author_login, the_author_rstname, the_author_lastname, the_author_nickname, the_author_ID, the_author_email, the_author_url, the_author_link, the_author_icq, the_author_aim, the_author_yim, the_author_msn, the_modied_author, the_author_posts, the_author_posts_link, list_authors, wp_list_authors Go to Template Tag index Retrieved from "http://codex.wordpress.org/Template_Tags/the_author_rstname" Category: Template Tags

Template Tags/the author icq


This function has been deprecated. That means it has been replaced by a new function or is no longer supported, and may be removed from future versions. All code that uses this function should be converted to use its replacement if one exists.

Contents
1 Description 2 Replace With 3 Usage 4 Example 5 Parameters 6 Related

Description
Displays the ICQ number for the author of a post. Prior to WordPress 2.0, the ICQ eld was set in the user's prole, but the eld is currently not accessible in the Administration > Prole > Your Prole panel. This tag must be used within The Loop.

Replace With
No replacement exists for this template tag, as the eld was removed from the Prole panel.

Usage
<?php the_author_icq(); ?>

Example
<p>Contact me on ICQ: <?php the_author_icq(); ?></p>

Parameters
This tag does not accept any parameters.

Related
the_author, the_author_description, the_author_login, the_author_rstname, the_author_lastname, the_author_nickname, the_author_ID, the_author_email, the_author_url, the_author_link, the_author_icq, the_author_aim, the_author_yim, the_author_msn, the_modied_author, the_author_posts, the_author_posts_link, list_authors, wp_list_authors Go to Template Tag index Retrieved from "http://codex.wordpress.org/Template_Tags/the_author_icq" Category: Template Tags

Template Tags/the author lastname Contents


1 Description 2 Usage 3 Example 4 Parameters 5 Related

Description
This tag displays the last name for the author of a post. The Last Name eld is set in the user's prole (Administration > Prole > Your Prole). This tag must be used within The Loop.

Usage
<?php the_author_lastname(); ?>

Example
Displays author's rst and last name. <p>Post author: <?php the_author_firstname(); ?> <?php the_author_lastname(); ?></p>

Parameters
This tag does not accept any parameters.

Related
the_author, the_author_description, the_author_login, the_author_rstname, the_author_lastname, the_author_nickname, the_author_ID, the_author_email, the_author_url, the_author_link, the_author_icq, the_author_aim, the_author_yim, the_author_msn, the_modied_author, the_author_posts, the_author_posts_link, list_authors, wp_list_authors Go to Template Tag index Retrieved from "http://codex.wordpress.org/Template_Tags/the_author_lastname" Category: Template Tags

Template Tags/the author link Contents


1 Description 2 Usage 3 Example 4 Parameters 5 Related

Description
This tag displays a link to the Website for the author of a post. The Website eld is set in the user's prole (Administration > Prole > Your Prole). The text for the link is the author's Prole Display name publicly as eld. This tag must be used within The Loop.

Usage
<?php the_author_link(); ?>

Example
Displays the author's Website URL as a link and the text for the link is the author's Prole Display name publicly as eld. In this example, the author's Display Name is James Smith. <p>Written by: <?php the_author_link(); ?></p> Which displays as: Written by: James Smith

Parameters
This tag does not accept any parameters.

Related
the_author, the_author_description, the_author_login, the_author_rstname, the_author_lastname, the_author_nickname, the_author_ID, the_author_email, the_author_url, the_author_link, the_author_icq, the_author_aim, the_author_yim, the_author_msn, the_modied_author, the_author_posts, the_author_posts_link, list_authors, wp_list_authors Go to Template Tag index Retrieved from "http://codex.wordpress.org/Template_Tags/the_author_link" Category: Template Tags

Template Tags/the author login Contents


1 Description 2 Usage 3 Example 4 Parameters 5 Related

Description
This tag displays the login name of the author of a post. The login is also referred to as the Username an author uses to gain access to a WordPress blog. This tag must be used within The Loop. Note: It's usually not a good idea to provide login information publicly.

Usage
<?php the_author_login(); ?>

Example
<p>Author username: <?php the_author_login(); ?></p>

Parameters
This tag does not accept any parameters.

Related
the_author, the_author_description, the_author_login, the_author_rstname, the_author_lastname, the_author_nickname, the_author_ID, the_author_email, the_author_url, the_author_link, the_author_icq, the_author_aim, the_author_yim, the_author_msn, the_modied_author, the_author_posts, the_author_posts_link, list_authors, wp_list_authors Go to Template Tag index

Retrieved from "http://codex.wordpress.org/Template_Tags/the_author_login" Category: Template Tags

Template Tags/the author msn


This function has been deprecated. That means it has been replaced by a new function or is no longer supported, and may be removed from future versions. All code that uses this function should be converted to use its replacement if one exists.

Contents
1 Description 2 Replace With 3 Usage 4 Example 5 Parameters 6 Related

Description
Displays the MSN Messenger ID for the author of a post; Prior to WordPress 2.0, the MSN IM eld was set in the user's prole, but this eld has since been removed in later versions. This tag must be used within The Loop.

Replace With
No replacement exists for this template tag, as the eld was removed from the Prole panel.

Usage
<?php the_author_msn(); ?>

Example
<p>Contact me on MSN: <?php the_author_msn(); ?></p>

Parameters
This tag does not accept any parameters.

Related
the_author, the_author_description, the_author_login, the_author_rstname, the_author_lastname, the_author_nickname, the_author_ID, the_author_email, the_author_url, the_author_link, the_author_icq, the_author_aim, the_author_yim, the_author_msn, the_modied_author, the_author_posts, the_author_posts_link, list_authors, wp_list_authors Go to Template Tag index Retrieved from "http://codex.wordpress.org/Template_Tags/the_author_msn" Category: Template Tags

Template Tags/the author nickname Contents


1 Description 2 Usage 3 Example 4 Parameters 5 Related

Description
This tag displays the nickname for the author of a post. The Nickname eld is set in the user's prole (Administration > Prole > Your Prole). This tag must be used within The Loop.

Usage
<?php the_author_nickname(); ?>

Example

<p>Posted by <?php the_author_nickname(); ?></p>

Parameters
This tag does not accept any parameters.

Related
the_author, the_author_description, the_author_login, the_author_rstname, the_author_lastname, the_author_nickname, the_author_ID, the_author_email, the_author_url, the_author_link, the_author_icq, the_author_aim, the_author_yim, the_author_msn, the_modied_author, the_author_posts, the_author_posts_link, list_authors, wp_list_authors Go to Template Tag index Retrieved from "http://codex.wordpress.org/Template_Tags/the_author_nickname" Category: Template Tags

Template Tags/the author posts Contents


1 Description 2 Usage 3 Example 4 Parameters 5 Related

Description
Displays the total number of posts an author has published. Drafts and private posts aren't counted. This tag must be used within The Loop.

Usage
<?php the_author_posts(); ?>

Example
Displays the author's name and number of posts. <p><?php the_author(); ?> has blogged <?php the_author_posts(); ?> posts</p> Harriett Smith has blogged 425 posts.

Parameters
This tag does not accept any parameters.

Related
the_author, the_author_description, the_author_login, the_author_rstname, the_author_lastname, the_author_nickname, the_author_ID, the_author_email, the_author_url, the_author_link, the_author_icq, the_author_aim, the_author_yim, the_author_msn, the_modied_author, the_author_posts, the_author_posts_link, list_authors, wp_list_authors Go to Template Tag index Retrieved from "http://codex.wordpress.org/Template_Tags/the_author_posts" Category: Template Tags

Template Tags/the author posts link Contents


1 Description 2 Usage 3 Examples 3.1 Use Example 4 Parameters 5 Deprecated Parameters

6 Related

Description
Displays a link to all posts by an author. The link text is the user's Display name publicly as eld. The results of clicking on the presented link will be controlled by the Template Hierarchy of Author Templates. This tag must be used within The Loop.

Usage
<?php the_author_posts_link(); ?>

Examples
Use Example
Displays the link, where the default link text value is the user's Display name publicly as eld. <p>Other posts by <?php the_author_posts_link(); ?></p>

Parameters
This function takes no arguments.

Deprecated Parameters
idmode (string) Sets the element of the author's information to display for the link text.

Related
the_author, the_author_description, the_author_login, the_author_rstname, the_author_lastname, the_author_nickname, the_author_ID, the_author_email, the_author_url, the_author_link, the_author_icq, the_author_aim, the_author_yim, the_author_msn, the_modied_author, the_author_posts, the_author_posts_link, list_authors, wp_list_authors

How to pass parameters to tags Go to Template Tag index Retrieved from "http://codex.wordpress.org/Template_Tags/the_author_posts_link" Category: Template Tags

Template Tags/the author url Contents


1 Description 2 Usage 3 Example 4 Parameters 5 Related

Description
This tag displays the URL to the Website for the author of a post. The Website eld is set in the user's prole (Administration > Prole > Your Prole). This tag must be used within The Loop.

Usage
<?php the_author_url(); ?>

Example
Displays the author's URL as a link and the link text. <p>Author's web site: <a href="<?php the_author_url(); ?>"><?php the_author_url(); ?></a></p> Which displays as:

Author's web site: www.example.com This example displays the author's name as a link to the author's web site.

<?php if (get_the_author_url()) { ?><a href="<?php the_author_url(); ?>"><?php the_author(); ?></a><?php } else { the_a

Parameters
This tag does not accept any parameters.

Related
the_author, the_author_description, the_author_login, the_author_rstname, the_author_lastname, the_author_nickname, the_author_ID, the_author_email, the_author_url, the_author_link, the_author_icq, the_author_aim, the_author_yim, the_author_msn, the_modied_author, the_author_posts, the_author_posts_link, list_authors, wp_list_authors Go to Template Tag index Retrieved from "http://codex.wordpress.org/Template_Tags/the_author_url" Category: Template Tags

Template Tags/the author yim Contents


1 Description 2 Usage 3 Example 4 Parameters 5 Related

Description
This tag displays the Yahoo IM ID for the author of a post. The Yahoo IM eld is set in the user's prole (Administration > Prole > Your Prole). This tag must be used within The Loop.

Usage
<?php the_author_yim(); ?>

Example
<p>Contact me on Yahoo Messenger: <?php the_author_yim(); ?></p>

Parameters
This tag does not accept any parameters.

Related
the_author, the_author_description, the_author_login, the_author_rstname, the_author_lastname, the_author_nickname, the_author_ID, the_author_email, the_author_url, the_author_link, the_author_icq, the_author_aim, the_author_yim, the_author_msn, the_modied_author, the_author_posts, the_author_posts_link, list_authors, wp_list_authors Go to Template Tag index Retrieved from "http://codex.wordpress.org/Template_Tags/the_author_yim" Category: Template Tags

Template Tags/the category Contents


1 Description 2 Usage 3 Examples 3.1 Separated by Space 3.2 Separated by Comma 3.3 Separated by Arrow 3.4 Separated by a Bullet 4 Parameters

5 Related

Description
Displays a link to the category or categories a post belongs to. This tag must be used within The Loop.

Usage
<?php the_category('separator', 'parents' ); ?>

Examples
Separated by Space
This usage lists categories with a space as the separator. <p>Categories: <?php the_category(' '); ?></p> Categories: WordPress Computers Blogging

Separated by Comma
Displays links to categories, each category separated by a comma (if more than one). <p>This post is in: <?php the_category(', '); ?></p> This post is in: WordPress, Computers, Blogging

Separated by Arrow
Displays links to categories with an arrow (>) separating the categories. (Note: Take care when using this, since some viewers may interpret a category following a > as a subcategory of the one preceding it.) <p>Categories: <?php the_category(' &gt; '); ?></p> Categories: WordPress > Computers > Blogging

Separated by a Bullet
Displays links to categories with a bullet () separating the categories. <p>Post Categories: <?php the_category(' &bull; '); ?></p> Post Categories: WordPress Computers Blogging

Parameters
separator (string) Text or character to display between each category link. The default is to place the links in an unordered list. parents (string) How to display links that reside in child (sub) categories. Options are: 'multiple' - Display separate links to parent and child categories, exhibiting "parent/child" relationship. 'single' - Display link to child category only, with link text exhibiting "parent/child" relationship. Note: Default is a link to the child category, with no relationship exhibited.

Related
the_category, the_category_rss, single_cat_title, category_description, wp_dropdown_categories, wp_list_categories, in_category, get_category_parents, get_the_category get_category_link,

How to pass parameters to tags with PHP function-style parameters

Go to Template Tag index Retrieved from "http://codex.wordpress.org/Template_Tags/the_category" Category: Template Tags

Template Tags/the category ID


This function has been deprecated. That means it has been replaced by a new function or is no longer supported, and may be removed from future versions. All code that uses this function should be converted to use its replacement if one exists.

Contents
1 Description 2 Replace With 3 Usage 4 Example 5 Parameters 6 Related

Description
Displays or returns the numeric ID of the category a post belongs to. This tag must be used within The Loop.

Replace With
This tag was deprecated when multiple categories were added to WordPress, and there is no one-to-one correspondence with another tag. This PHP code block provides an example for how you can replace it: <?php foreach((get_the_category()) as $category) { echo $category->cat_ID . ' '; } ?>

Usage
<?php the_category_ID(echo); ?>

Example
Displays a corresponding image for each category. <img src="<?php the_category_ID(); ?>.gif" />

Parameters
echo (boolean) Display the category ID (TRUE) or return it for use in PHP (FALSE). Defaults to TRUE.

Related
the_category, the_category_rss, single_cat_title, category_description, wp_dropdown_categories, wp_list_categories, in_category, get_category_parents, get_the_category get_category_link,

How to pass parameters to tags Go to Template Tag index Retrieved from "http://codex.wordpress.org/Template_Tags/the_category_ID" Category: Template Tags

Template Tags/the category head


This function has been deprecated. That means it has been replaced by a new function or is no longer supported, and may be removed from future versions. All code that uses this function should be converted to use its replacement if one exists.

Contents

1 Description 2 Replace With 3 Usage 4 Example 5 Parameters 6 Related

Description
Displays the name of a category if it's different from the previous category. This tag must be used within The Loop.

Replace With
This tag was deprecated when multiple categories were added to WordPress, and there is no one-to-one correspondence with another tag. To display the name of the category when on a category page, use: <?php echo get_the_category_by_ID($cat); ?> To display category name(s) on a single post page, this code block (which would need to run in The Loop) provides an example: <?php foreach(get_the_category() as $category) { echo $category->cat_name . ' '; } ?>

Usage
<?php the_category_head('before', 'after'); ?>

Example
Displays the text "Category: " followed by the name of the category. <h2><?php the_category_head('Category: '); ?></h2>

Parameters
before (string) Text to output before the category. Defaults to '' (no text). after (string) Text to output after the category. Defaults to '' (no text).

Related
the_category, the_category_rss, single_cat_title, category_description, wp_dropdown_categories, wp_list_categories, in_category, get_category_parents, get_the_category get_category_link,

How to pass parameters to tags with PHP function-style parameters Go to Template Tag index Retrieved from "http://codex.wordpress.org/Template_Tags/the_category_head" Category: Template Tags

Template Tags/the category rss Contents


1 Description 2 Usage 3 Example 4 Parameters 5 Related

Description
Displays the name of the category or categories a post belongs to in RSS format. This tag must be used within The Loop.

Usage

<?php the_category_rss('type') ?>

Example
Fragment of an RSS2 feed page. <?php the_category_rss() ?> <guid><?php the_permalink($id); ?></guid>

Parameters
type (string) The type of feed to display to. Valid values: 'rss' (Default) 'rdf'

Related
the_category, the_category_rss, single_cat_title, category_description, wp_dropdown_categories, wp_list_categories, in_category, get_category_parents, get_the_category get_category_link,

How to pass parameters to tags with PHP function-style parameters Go to Template Tag index Retrieved from "http://codex.wordpress.org/Template_Tags/the_category_rss" Categories: Template Tags | Feeds

Template Tags/the content Contents


1 Description 2 Usage 3 Examples 3.1 Designating the "More" Text 3.2 Include Title in "More" 3.3 Overriding Archive/Single Page Behavior 4 Parameters 5 Related

Description
Displays the contents of the current post. This tag must be within The_Loop. If the quicktag <!--more--> is used in a post to designate the "cut-off" point for the post to be excerpted, the_content() tag will only show the excerpt up to the <!--more--> quicktag point on non-single/non-permalink post pages. By design, the_content() tag includes a parameter for formatting the <!--more--> content and look, which creates a link to "continue reading" the full post. Note about <!--more--> : No whitespaces are allowed before the "more" in the <!--more--> quicktag. In other words <!-- more --> will not work! The <!--more--> quicktag will not operate and is ignored in Templates, such as single.php, where just one post is displayed. Read Customizing the Read More for more details.

Usage
<?php the_content('more_link_text', strip_teaser, 'more_file'); ?> Alternatively, you may use this to return the content value instead of the normal echo: <?php $content = get_the_content(); ?> Please note! get_the_content will not have the following done to it and you are advised to add them until the core has been updated: <?php $content = apply_filters('the_content', $content); $content = str_replace(']]>', ']]&gt;', $content); ?>

Examples
Designating the "More" Text

Displays the content of the post and uses "Read more..." for the more link text when the <!--more--> Quicktag is used. <?php the_content('Read more...'); ?>

Include Title in "More"


Similar to the above example, but thanks to the_title() tag and the display parameter, it can show "Continue reading ACTUAL POST TITLE" when the <!--more--> Quicktag is used. <?php the_content("Continue reading " . the_title('', '', false)); ?>

Overriding Archive/Single Page Behavior


If the_content() isn't working as you desire (displaying the entire story when you only want the content above the <!--more--> Quicktag, for example) you can override the behavior with global $more. <?php // Declare global $more, before the loop. global $more; ?> <?php // Display content above the more tag $more = 0; the_content("More..."); ?> Alternatively, if you need to display all of the content: <?php // Declare global $more, before the loop. global $more; ?> <?php // Display all content, including text below more $more = 1; the_content(); ?> note: in my case I had to set $more=0; INSIDE the loop for it to work.

Parameters
more_link_text (string) The link text to display for the "more" link. Defaults to '(more...)'. strip_teaser (boolean) Should the text before the "more" link be hidden (TRUE) or displayed (FALSE). Defaults to FALSE. more_le (string) File the "more" link points to. Defaults to the current le. (V2.0: Currently the 'more_le' parameter doesn't work).

Related
the_ID, the_title, the_title_attribute, single_post_title, the_title_rss, the_content, the_content_rss, the_excerpt, the_excerpt_rss, previous_post_link, next_post_link, posts_nav_link, the_meta,

How to pass parameters to tags with PHP function-style parameters Go to Template Tag index Retrieved from "http://codex.wordpress.org/Template_Tags/the_content" Category: Template Tags

Template Tags/the content rss Contents


1 Description 2 Usage 3 Examples 3.1 Default Usage

3.2 Hides Teaser Link and Limits Content 4 Parameters 5 Related

Description
Displays the content of the current post formatted for RSS. This tag must be within The_Loop. This tag will display a "teaser" link to read more of a post, when on non-single/non-permalink post pages and the <!--more--> Quicktag is used.

Usage
<?php the_content_rss('more_link_text', strip_teaser, 'more_file', cut, encode_html); ?>

Examples
Default Usage
Displays the content in RSS format using defaults. <?php the_content_rss(); ?>

Hides Teaser Link and Limits Content


Displays the content in RSS format, hides the teaser link and cuts the content after 50 words. <?php the_content_rss('', TRUE, '', 50); ?>

Parameters
more_link_text (string) Link text to display for the "more" link. Defaults to '(more...)'. strip_teaser (boolean) Should the text before the "more" link be hidden (TRUE) or displayed (FALSE). Defaults to FALSE. more_le (string) File which the "more" link points to. Defaults to the current le. cut (integer) Number of words displayed before ending content. Default is 0 (display all). encode_html (integer) Denes html tag ltering and special character (e.g. '&') encoding. Options are: 0 - (Default) Parses out links for numbered "url footnotes". 1 - Filters through the PHP function htmlspecialchars(), but also sets cut to 0, so is not recommended when using the cut parameter. 2 - Strips html tags, and replaces '&' with HTML entity equivalent (&amp;). This is the default when using the cut parameter.

Related
the_ID, the_title, the_title_attribute, single_post_title, the_title_rss, the_content, the_content_rss, the_excerpt, the_excerpt_rss, previous_post_link, next_post_link, posts_nav_link, the_meta,

How to pass parameters to tags with PHP function-style parameters Go to Template Tag index Retrieved from "http://codex.wordpress.org/Template_Tags/the_content_rss" Categories: Template Tags | Feeds

Template Tags/the date Contents Description


Description Displays1or returns the date of a post, or a set of posts if published on the same day. 2 Usage 3 Examples 3.1 Default there SPECIAL NOTE: When Usage are multiple posts on a page published under the SAME DAY, the_date() only displays the date for the rst 3.2 Date as Year, Month, Date in Heading post (that is, the rst instance of Using $my_date repeat the date for posts published under the same day, you should use the Template Tag 3.3 Date in Heading the_date()). To Variable the_time() with a date-specic format string. 4 Parameters 5 Related

This tag must be used within The Loop.

Usage
<?php the_date('format', 'before', 'after', echo); ?>

Examples
Default Usage
Displays the date using defaults. <p>Date posted: <?php the_date(); ?></p>

Date as Year, Month, Date in Heading


Displays the date using the '2007-07-23' format (ex: 2004-11-30), inside an <h2> tag. <?php the_date('Y-m-d', '<h2>', '</h2>'); ?>

Date in Heading Using $my_date Variable


Returns the date in the default format inside an <h2> tag and assigns it to the $my_date variable. The variable's value is then displayed with the PHP echo command. <?php $my_date = the_date('', '', '', FALSE); echo $my_date; ?>

Parameters
format (string) The format for the date. Defaults to the date format congured in your WordPress options. See Formatting Date and Time. before (string) Text to place before the date. There is no default. after (string) Text to place after the date. There is no default. echo (boolean) Display the date (TRUE), or return the date to be used in PHP (FALSE). Defaults to TRUE.

Related
the_date_xml, the_date, the_time, the_modied_date, the_modied_time, get_the_time, single_month_title, get_calendar, the_weekday, the_weekday_date Affects the return value of the is_new_day() function.

How to pass parameters to tags with PHP function-style parameters Go to Template Tag index Retrieved from "http://codex.wordpress.org/Template_Tags/the_date" Category: Template Tags

Template Tags/the date xml Contents


1 Description 2 Usage 3 Example 4 Parameters 5 Related

Description
Displays the date of the post in YYYY-MM-DD format (ex: 2004-09-24). This tag must be used within The Loop.

Usage
<?php the_date_xml(); ?>

Example

<p>Date posted: <?php the_date_xml(); ?></p> Date posted: 2005-05-14

Parameters
This tag does not accept any parameters.

Related
the_date_xml, the_date, the_time, the_modied_date, the_modied_time, get_the_time, single_month_title, get_calendar, the_weekday, the_weekday_date Go to Template Tag index Retrieved from "http://codex.wordpress.org/Template_Tags/the_date_xml" Category: Template Tags

Template Tags/the excerpt Contents


1 Description 2 Usage 3 Examples 3.1 Default Usage 3.2 Use with Conditional Tags 4 Parameters 5 Comparison of the_excerpt() vs. the_content() 6 Related

Description
Displays the excerpt of the current post with [...] at the end, which is not a "read more" link. If you do not provide an explicit excerpt to a post (in the post editor's optional excerpt eld), it will display a teaser which refers to the rst 55 words of the post's content. Also in the latter case, HTML tags and graphics are stripped from the excerpt's content. This tag must be within The Loop. If the current post is an attachment, such as in the attachment.php and image.php template loops, then the attachment caption is displayed. Captions do not include the excerpt [...] marks.

Usage
<?php the_excerpt(); ?>

Examples
Default Usage
Displays the post excerpt. Used on non-single/non-permalink posts as a replacement for the_content() to force excerpts to show within the Loop. <?php the_excerpt(); ?>

Use with Conditional Tags


Replaces the_content() tag with the_excerpt() when on archive (tested by is_archive()) or category (is_category()) pages. Both the examples below work for versions 1.5 and above. <?php if(is_category() || is_archive()) { the_excerpt(); } else { the_content(); } ?> For versions of WordPress prior to 1.5, only the following will work : <?php if($cat || $m) { the_excerpt(); } else { the_content();

} ?>

Parameters
This tag has no parameters.

Comparison of the_excerpt() vs. the_content()


Sometimes is more meaningful to use only the_content() function. the_content() will decide what to display according to whether <!--more--> tag was used. <!--more--> tag splits post/page into two parts: only content before tag should be displayed in listing. Remember that <!--more--> is (of course) ignored when showing only post/page (singles).

Related
the_ID, the_title, the_title_attribute, single_post_title, the_title_rss, the_content, the_content_rss, the_excerpt, the_excerpt_rss, previous_post_link, next_post_link, posts_nav_link, the_meta, Go to Template Tag index Retrieved from "http://codex.wordpress.org/Template_Tags/the_excerpt" Categories: Template Tags | UI Link

Template Tags/the excerpt rss Contents


1 Description 2 Usage 3 Example 4 Parameters 4.1 Parameters for 1.2 5 Related

Description
Displays the excerpt of the current post formatted for RSS.If you do not provide an explicit excerpt to a post (in the post editor's optional excerpt eld), the rst 55 words of the post's content are used. This tag must be within The_Loop. For ner control over output, see the_content_rss().

Usage
<?php the_excerpt_rss(); ?> See Parameters for 1.2 for arguments available in that version.

Example
Displays the post's excerpt, or the rst 120 words of the post's content when no excerpt exists, formatted for RSS syndication. <description><?php the_excerpt_rss(); ?></description>

Parameters
This tag has no parameters.

Parameters for 1.2


WordPress version 1.5 does not support parameters for this tag. The following information is retained for the benet of 1.2 users. Usage: <?php the_excerpt_rss(cut, encode_html); ?> Parameters: cut (integer) Number of words to display before ending the excerpt. Can be any numeric value up to the default. encode_html (integer) Denes html tag ltering and special character (e.g. '&') encoding. Options are: 0 - (Default) Parses out links for numbered "url footnotes". 1 - Filters through the PHP function htmlspecialchars(), but also sets cut to 0, so is not recommended when using the cut

parameter. 2 - Strips html tags, and replaces '&' with HTML entity equivalent (&amp;). This is the default when using the cut parameter.

Related
the_ID, the_title, the_title_attribute, single_post_title, the_title_rss, the_content, the_content_rss, the_excerpt, the_excerpt_rss, previous_post_link, next_post_link, posts_nav_link, the_meta, Go to Template Tag index Retrieved from "http://codex.wordpress.org/Template_Tags/the_excerpt_rss" Categories: Template Tags | Feeds

Template Tags/the meta Contents


1 Description 2 Usage 3 Example 4 Parameters 5 Related

Description
Displays an unordered list of meta "key:value" pairs, or the post-meta, for the current post. Must be used from within The_Loop. For more information on this tag, see Using_Custom_Fields.

Usage
<?php the_meta(); ?>

Example
<p>Meta information for this post:</p> <?php the_meta(); ?>

Parameters
This tag has no parameters.

Related
the_ID, the_title, the_title_attribute, single_post_title, the_title_rss, the_content, the_content_rss, the_excerpt, the_excerpt_rss, previous_post_link, next_post_link, posts_nav_link, the_meta, Go to Template Tag index Retrieved from "http://codex.wordpress.org/Template_Tags/the_meta" Category: Template Tags

Template Tags/the modied author Contents


1 Description 2 Usage 3 Examples 3.1 Display Last Modied Author's 'Public' Name 4 Parameters 5 Related

Description
The author who last modied a post can be displayed by using this Template Tag. This tag must be used within The Loop. Note: the_modied_author was rst available with Version 2.8.

Usage
<?php the_modified_author(); ?>

Examples
Display Last Modied Author's 'Public' Name
Displays the value in the user's Display name publicly as eld. <p>This post was written by <?php the_modified_author(); ?></p>

Parameters
This function takes no arguments.

Related
the_author, the_author_description, the_author_login, the_author_rstname, the_author_lastname, the_author_nickname, the_author_ID, the_author_email, the_author_url, the_author_link, the_author_icq, the_author_aim, the_author_yim, the_author_msn, the_modied_author, the_author_posts, the_author_posts_link, list_authors, wp_list_authors

How to pass parameters to tags with PHP function-style parameters Go to Template Tag index Retrieved from "http://codex.wordpress.org/Template_Tags/the_modied_author" Category: Template Tags

Template Tags/the modied date Contents


1 Description 2 Usage 3 Examples 3.1 Default Usage 3.2 Date as Month Day, Year 3.3 Date and Time 4 Parameters 5 Related

Description
This tag displays the date (and time) a post was last modied. This tag works just like the_modied_time(), which also displays the time/date a post was last modied. This tag must be used within The Loop. If no format parameter is specied, 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 modied, the modied date is the same as the creation date.

Usage
<?php the_modified_date('d'); ?>

Examples
Default Usage
Displays the date the post was last modied, using the Default date format setting (e.g. F j, Y) from Administration > Settings > General. <p>Last modified: <?php the_modified_date(); ?></p> Last modied: December 2, 2006

Date as Month Day, Year


Displays the last modied date in the date format 'F j, Y' (ex: December 2, 2006). <div>Last modified: <?php the_modified_date('F j, Y'); ?></div> Last modied: December 2, 2006

Date and Time

Displays the date and time. <p>Modified: <?php the_modified_date('F j, Y'); ?> at <?php the_modified_date('g:i a'); ?></p> Modied: December 2, 2006 at 10:36 pm

Parameters
d (string) The format the date is to display in. Defaults to the date format congured in your WordPress options. See Formatting Date and Time.

Related
the_date_xml, the_date, the_time, the_modied_date, the_modied_time, get_the_time, single_month_title, get_calendar, the_weekday, the_weekday_date

How to pass parameters to tags Go to Template Tag index Retrieved from "http://codex.wordpress.org/Template_Tags/the_modied_date" Categories: Template Tags | New page created

Template Tags/the modied time Contents


1 Description 2 Usage 3 Examples 3.1 Default Usage 3.2 Time in the 12-hour format (am/pm) 3.3 Time in the 24-hour format 3.4 Date as Month Day, Year 3.5 Date and Time 4 Parameters 5 Related

Description
This tag displays the time (and date) a post was last modied 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 specied, 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 modied, the modied time is the same as the creation time. If you want to display both the modied 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.

Usage
<?php the_modified_time('d'); ?>

Examples
Default Usage
Displays the time (date) the post was last modied, using the Default date format setting (e.g. F j, Y) from Administration > Settings > General. <p>Last modified: <?php the_modified_time(); ?></p> Last modied: December 2, 2006

Time in the 12-hour format (am/pm)


If a post was modied at 10:36pm, this example displays the time the post was last modied using the 12-hour format parameter string 'g:i

a'. <p>Time last modified: <?php the_modified_time('g:i a'); ?></p> Time last modied: 10:36 pm

Time in the 24-hour format


If a post was modied at 10:36pm, this example displays the time the post was last modied using the 24-hour format parameter string 'G:i'. <p>Time last modified: <?php the_modified_time('G:i'); ?></p> Time last modied: 22:36

Date as Month Day, Year


Displays the last modied time and date in the date format 'F j, Y' (ex: December 2, 2006), which could be used to replace the tag the_modied_date(). <div>Last modified: <?php the_modified_time('F j, Y'); ?></div> Last modied: December 2, 2006

Date and Time


Displays the date and time. <p>Modified: <?php the_modified_time('F j, Y'); ?> at <?php the_modified_time('g:i a'); ?></p> Modied: December 2, 2006 at 10:36 pm

Parameters
d (string) The format the time is to display in. Defaults to the date format congured in your WordPress options. See Formatting Date and Time.

Related
the_date_xml, the_date, the_time, the_modied_date, the_modied_time, get_the_time, single_month_title, get_calendar, the_weekday, the_weekday_date

How to pass parameters to tags Go to Template Tag index Retrieved from "http://codex.wordpress.org/Template_Tags/the_modied_time" Categories: Template Tags | New page created

Template Tags/the permalink Contents


1 Description 2 Usage 3 Examples 3.1 Display Post URL as Text 3.2 As Link With Text 3.3 Used as Link With Title Tag 4 Parameters 5 Related

Description
Displays the URL for the permalink to the post currently being processed in The Loop. This tag must be within The Loop, and is generally used

to display the permalink for each post, when the posts are being displayed. Since this template tag is limited to displaying the permalink for the post that is being processed, you cannot use it to display the permalink to an arbitrary post on your weblog. Refer to get_permalink() if you want to display the permalink for a post, given its unique post id.

Usage
<?php the_permalink(); ?>

Examples
Display Post URL as Text
Displays the URL to the post, without creating a link: This address for this post is: <?php the_permalink(); ?>

As Link With Text


You can use whatever text you like as the link text, in this case, "permalink". <a href="<?php the_permalink(); ?>">permalink</a>

Used as Link With Title Tag


Creates a link for the permalink, with the post's title as the link text. This is a common way to put the post's title. <a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>

Parameters
This tag has no parameters.

Related
To generate the permalink for a single, specic post, see get_permalink. permalink_anchor, get_permalink, the_permalink, permalink_single_rss Go to Template Tag index Retrieved from "http://codex.wordpress.org/Template_Tags/the_permalink" Category: Template Tags

Template Tags/the search query Contents


1 Description 2 Usage 3 Examples 3.1 Show search query in search box 3.2 Show search query in results page 4 Related

Description
Displays the search query for the current request, if a search was made. This function can be used safely within HTML attributes (as in the "search box" example, below).

Usage
<?php the_search_query(); ?>

Examples
Show search query in search box
If you have just performed a search, you can show the last query in the search box:

<form method="get" id="searchform" action="<?php bloginfo('url'); ?>/"> <div> <input type="text" value="<?php the_search_query(); ?>" name="s" id="s" /> <input type="submit" id="searchsubmit" value="Search" /> </div> </form>

Show search query in results page


You can display the search string on search result pages <p>You searched for \" <?php the_search_query() ?> \". Here are the results:</p>

Related
get_search_query function get_search_query lter

How to pass parameters to tags with PHP function-style parameters Go to Template Tag index Retrieved from "http://codex.wordpress.org/Template_Tags/the_search_query" Categories: Template Tags | New page created

Template Tags/the tags Contents


1 Description 2 Usage 3 Examples 3.1 Default Usage 3.2 Separated by Arrow 3.3 Separated by a Bullet 3.4 A List Example 3.5 Integrating Categories and Tags 4 Parameters 5 Related

Description
First available with WordPress Version 2.3, this template tag displays a link to the tag or tags a post belongs to. If no tags are associated with the current entry, the associated category is displayed instead. This tag should be used within The Loop.

Usage
<?php the_tags('before', 'separator', 'after'); ?>

Examples
Displays a list of the tags with a linebreak after it. <?php the_tags('Tags:', ', ', '<br />'); ?>

Default Usage
The default usage lists tags with each tag (if more than one) separated by a comma (,) and preceded with the default text Tags: . <p><?php the_tags(); ?></p> Tags: WordPress, Computers, Blogging

Separated by Arrow
Displays links to tags with an arrow (>) separating the tags and preceded with the text Social tagging: <?php the_tags('Social tagging: ',' > '); ?>

Social tagging: WordPress > Computers > Blogging

Separated by a Bullet
Displays links to tags with a bullet () separating the tags and preceded with the text Tagged with: and followed by a line break. <?php the_tags('Tagged with: ',' &bull; ','<br />'); ?> Tagged with: WordPress Computers Blogging

A List Example
Displays a list of the tags as a real and simple (X)HTML list (<ul> / <ol> / <dl> ): <?php the_tags('<ul><li>','</li><li>','</li></ul>'); ?>

WordPress Computers Blogging

Integrating Categories and Tags


If you have existing posts associated with categories, and have started adding tags to posts as well, you may want to show an integrated list of categories and tags beneath each post. For example, assume you have pre-existing categories called Culture and Media, and have added tags to a post "Arts" and "Painting". To simplify the reader's experience and keep things uncluttered, you may want to display these as if they were all tags:

Tags: Culture, Media, Arts, Painting

This code will get you there, and will only render categories or tags if they're non-empty for the current post:

Tags: <?php if (the_category(', ')) the_category(); ?> <?php if (get_the_tags()) the_tags(); ?>

Parameters
before (string) Text to display before the actual tags are displayed. Defaults to Tags: separator (string) Text or character to display between each tag link. The default is a comma (,) between each tag. after (string) Text to display after the last tag. The default is to display nothing.

Related
the_tags, get_the_tags, get_the_tag_list, single_tag_title, get_tag_link, wp_tag_cloud, wp_generate_tag_cloud

How to pass parameters to tags with PHP function-style parameters Go to Template Tag index

This page is marked as incomplete. You can help Codex by expanding it. Retrieved from "http://codex.wordpress.org/Template_Tags/the_tags" Categories: Template Tags | Stubs

Template Tags/the time Contents


1 Description 2 Usage 3 Examples 3.1 Default Usage 3.2 Time as AM/PM VS. 24H format 3.3 Date as Month Day, Year 3.4 Date and Time 4 Parameters 5 Related

Description
Displays the time of the current post. This tag must be used within The Loop.

Usage
<?php the_time('d'); ?>

Examples
Default Usage
Displays the time using your WordPress defaults. Time posted: <?php the_time(); ?>

Time as AM/PM VS. 24H format


Displays the time using the format parameter string '09:18 am' (ex: 10:36 pm). <p>Time posted: <?php the_time('g:i a'); ?></p> -Displays the time using the 24 hours format parameter string 'G:i' (ex: 17:52). <p>Time posted: <?php the_time('G:i'); ?></p>

Date as Month Day, Year


Displays the time in the date format 'F j, Y' (ex: December 2, 2004), which could be used to replace the tag the_date(). <div><?php the_time('F j, Y'); ?></div>

Date and Time


Displays the date and time. <p>Posted: <?php the_time('F j, Y'); ?> at <?php the_time('g:i a'); ?></p> Posted: July 17, 2007 at 7:19 am

Parameters
d (string) The format the time is to display in. Defaults to the time format congured in your WordPress options. See Formatting Date and Time.

Related
the_date_xml, the_date, the_time, the_modied_date, the_modied_time, get_the_time, single_month_title, get_calendar, the_weekday, the_weekday_date

How to pass parameters to tags Go to Template Tag index Retrieved from "http://codex.wordpress.org/Template_Tags/the_time" Category: Template Tags

Template Tags/the title Contents


1 Description 2 Usage 3 Example 4 Parameters 5 Related

Description
Displays or returns the title of the current post. This tag must be within The Loop.

Usage
<?php the_title('before', 'after', display); ?>

Example
<?php the_title('<h3>', '</h3>'); ?>

Parameters
before (string) Text to place before the title. Defaults to ''. after (string) Text to place after the title. Defaults to ''. display (Boolean) Display the title (TRUE) or return it for use in PHP (FALSE). Defaults to TRUE.

Related
See also the_title_attribute(). the_ID, the_title, the_title_attribute, single_post_title, the_title_rss, the_content, the_content_rss, the_excerpt, the_excerpt_rss, previous_post_link, next_post_link, posts_nav_link, the_meta,

How to pass parameters to tags with PHP function-style parameters Go to Template Tag index Retrieved from "http://codex.wordpress.org/Template_Tags/the_title" Category: Template Tags

Template Tags/the title attribute Contents


1 Description 2 Usage 3 Example 4 Parameters 5 Related

Description
Displays or returns the title of the current post. It somewhat duplicates the functionality of the_title(), but provides a 'clean' version of the title by stripping HTML tags and converting certain characters (including quotes) to their character entity equivalent; it also uses query-string style parameters. This tag must be within The Loop.

Usage
<?php the_title_attribute('arguments'); ?>

Example
<?php the_title_attribute('before=<h3>&after=</h3>'); ?>

Parameters
before (string) Text to place before the title. Defaults to ''. after (string) Text to place after the title. Defaults to ''. echo (Boolean) Echo the title (1) or return it for use in PHP (0). Defaults to 1.

Related
See also the_title(). the_ID, the_title, the_title_attribute, single_post_title, the_title_rss, the_content, the_content_rss, the_excerpt, the_excerpt_rss, previous_post_link, next_post_link, posts_nav_link, the_meta,

How to pass parameters to tags with query-string-style parameters Go to Template Tag index Retrieved from "http://codex.wordpress.org/Template_Tags/the_title_attribute" Categories: Template Tags | New page created

Template Tags/the title rss Contents


1 Description 2 Usage 3 Example 4 Parameters 5 Related

Description
Displays the title of the current post, formatted for RSS. This tag must be within The Loop.

Usage
<?php the_title_rss(); ?>

Example
Displays the post title in an RSS title tag. <item> <title><?php the_title_rss(); ?></title>

Parameters
This tag has no parameters.

Related
the_ID, the_title, the_title_attribute, single_post_title, the_title_rss, the_content, the_content_rss, the_excerpt, the_excerpt_rss, previous_post_link, next_post_link, posts_nav_link, the_meta, Go to Template Tag index Retrieved from "http://codex.wordpress.org/Template_Tags/the_title_rss" Categories: Template Tags | Feeds

Template Tags/the weekday


This function has been deprecated. That means it has been replaced by a new function or is no longer supported, and may be removed from future versions. All code that uses this function should be converted to use its replacement if one exists.

Contents
1 Description 2 Replace With 3 Usage 4 Example 5 Parameters 6 Related

Description
Displays the day of the week (e.g. Friday). This tag must be used within The Loop.

Replace With
To replace this tag, use the_time() with 'l' as the format string: <?php the_time('l'); ?> See Formatting Date and Time for information on date and time format string use.

Usage
<?php the_weekday() ?>

Example
<p>This was posted on a <?php the_weekday() ?>.</p>

Parameters
This tag does not accept any parameters.

Related
the_date_xml, the_date, the_time, the_modied_date, the_modied_time, get_the_time, single_month_title, get_calendar, the_weekday, the_weekday_date Go to Template Tag index Retrieved from "http://codex.wordpress.org/Template_Tags/the_weekday" Category: Template Tags

Template Tags/the weekday date


This function has been deprecated. That means it has been replaced by a new function or is no longer supported, and may be removed from future versions. All code that uses this function should be converted to use its replacement if one exists.

Contents
1 Description 2 Replace With 3 Usage 4 Example 5 Parameters 6 Related

Description
Displays the weekday of the current post (e.g. Friday) only if it is different from the weekday of the previous post. This tag must be used within The Loop.

Replace With

There is one-to one correspondence with another template tag, so to replace, use the_date() as a trigger and the_time() with 'l' (lowercase letter L) as the format string, as shown in this PHP code block: <?php if(the_date('','','', FALSE)) the_time('l'); ?> See Formatting Date and Time for information on date and time format string use.

Usage
<?php the_weekday_date('before', 'after') ?>

Example
<p>Posts from <?php the_weekday_date('<strong>', '</strong>') ?>:</p>

Parameters
before (string) Text placed before the tag's output. There is no default. after (string) Text placed after the tag's output. There is no default.

Related
the_date_xml, the_date, the_time, the_modied_date, the_modied_time, get_the_time, single_month_title, get_calendar, the_weekday, the_weekday_date

How to pass parameters to tags with PHP function-style parameters Go to Template Tag index Retrieved from "http://codex.wordpress.org/Template_Tags/the_weekday_date" Category: Template Tags

Template Tags/trackback rdf Contents


1 Description 2 Usage 3 Example 4 Parameters 5 Related

Description
Outputs the trackback RDF information for a post. This tag must be within The Loop. This information is not displayed in a browser. Its use is partly intended for auto-detection of the trackback URI to a post, which can be "trackbacked" by some blogging and RDF tools. Include this tag in your template if you want to enable auto-discovery of the trackback URI for a post. Without it, people who wish to send a trackback to one of your posts will have to manually search for the trackback URI.

Usage
<?php trackback_rdf(); ?>

Example
Displays the RDF information before the end of The Loop. You should wrap the tag in an HTML comment tag, to avoid issues with validation. <!-<?php trackback_rdf(); ?> --> <?php endforeach; else: ?>

Parameters
This tag has no parameters.

Related

trackback_url, trackback_rdf Go to Template Tag index Retrieved from "http://codex.wordpress.org/Template_Tags/trackback_rdf" Category: Template Tags

Template Tags/trackback url Contents


1 Description 2 Usage 3 Example 4 Parameters 5 Related

Description
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.

Usage
<?php trackback_url(display); ?>

Example
<p>Trackback URL for this post: <?php trackback_url(); ?></p>

Parameters
display (boolean) Display the URL (TRUE), or to return it for use in PHP (FALSE). Defaults to TRUE.

Related
trackback_url, trackback_rdf

How to pass parameters to tags Go to Template Tag index Retrieved from "http://codex.wordpress.org/Template_Tags/trackback_url" Category: Template Tags

Template Tags/wp dropdown categories


This article is marked as in need of editing. You can help Codex by editing it.

Contents
1 Description 2 Usage 3 Examples 3.1 Default Usage 3.2 Dropdown with Submit Button 3.3 Dropdown without a Submit Button using JavaScript 3.4 Dropdown without a Submit Button using JavaScript (2) 4 Parameters 5 Related

Description
Displays a list of categories in a select (i.e dropdown) box with no submit button.

Usage

<?php wp_dropdown_categories('arguments'); ?>

Examples
Default Usage
$defaults = array('show_option_all' => '', 'show_option_none' => '', 'orderby' => 'ID', 'order' => 'ASC', 'show_last_update' => 0, 'show_count' => 0, 'hide_empty' => 1, 'child_of' => 0, 'exclude' => '', 'echo' => 1, 'selected' => 0, 'hierarchical' => 0, 'name' => 'cat', 'class' => 'postform', 'depth' => 0); By default, the usage shows: Sorts by category id in ascending order Does not show the last date updated Does not show the count of posts within a category Does not show 'empty' categories Excludes nothing Displays (echos) the categories No category is 'selected' in the form Does not display the categories in a hierarchical structure Assigns 'cat' to the form name Assigns the form to the class 'postform' No depth limit <?php wp_dropdown_categories(); ?>

Dropdown with Submit Button


Displays a hierarchical category dropdown list in HTML form with a submit button, in a WordPress sidebar unordered list, with a count of posts in each category. <li id="categories"> <h2><?php _e('Categories:'); ?></h2> <form action="<?php bloginfo('url'); ?>" method="get"> <?php wp_dropdown_categories('show_count=1&hierarchical=1'); ?> <input type="submit" name="submit" value="view" /> </form> </li>

Dropdown without a Submit Button using JavaScript


Example depicts using the show_option_none parameter and was gleaned from Moshu's forum post. <li id="categories"><h2><?php _e('Posts by Category'); ?></h2> <?php wp_dropdown_categories('show_option_none=Select category'); ?> <script type="text/javascript"><!-var dropdown = document.getElementById("cat"); function onCatChange() { if ( dropdown.options[dropdown.selectedIndex].value > 0 ) { location.href = "<?php echo get_option('home'); ?>/?cat="+dropdown.options[dropdown.selectedIndex].value; } } dropdown.onchange = onCatChange; --></script> </li>

Dropdown without a Submit Button using JavaScript (2)


In this example the echo parameter (echo=0) is used. A simple preg_replace inserts the JavaScript code. It even works without JavaScript (submit button is wrapped by noscript tags). <li id="categories"> <h2><?php _e('Posts by Category'); ?></h2> <form action="<?php bloginfo('url'); ?>/" method="get"> <?php $select = wp_dropdown_categories('show_option_none=Select category&show_count=1&orderby=name&echo=0'); $select = preg_replace("#<select([^>]*)>#", "<select$1 onchange='return this.form.submit()'>", $select); echo $select;

?> <noscript><input type="submit" value="View" /></noscript> </form> </li>

Parameters
show_option_all (string) Causes the HTML for the dropdown to allow you to select All of the categories. show_option_none (string) Causes the HTML for the dropdown to allow you to select NONE of the categories. orderby (string) Key to sort options by. Valid values: 'ID' (Default) 'name' order (string) Sort order for options. Valid values: 'ASC' (Default) 'DESC' show_last_update (boolean) Sets whether to display the date of the last post in each category. Valid values: 1 (True) 0 (False - Default) show_count (boolean) Sets whether to display a count of posts in each category. Valid values: 1 (True) 0 (False - Default) hide_empty (boolean) Sets whether to hide (not display) categories with no posts. Valid values: 1 (True - Default) 0 (False) child_of (integer) Only display categories that are children of the category identied by its ID. There is no default for this parameter. exclude (string) Comma separated list of category IDs to exclude. For example, 'exclude=4,12' means category IDs 4 and 12 will NOT be displayed/echoed or returned. Defaults to exclude nothing. echo (boolean) Display bookmarks (TRUE) or return them for use by PHP (FALSE). Defaults to TRUE. 1 (True - default) 0 (False) selected (integer) Category ID of the category to be 'selected' or presented in the display box. Defaults to no category selected. hierarchical (boolean) Display categories in hierarchical fashion (child categories show indented). Defaults to FALSE. 1 (True) 0 (False - Default) name (string) Name assigned to the dropdown form. Defaults to 'cat'. class (string) Class assinged to the dropdown form. Defaults to 'postform'. depth (integer) This parameter controls how many levels in the hierarchy of Categories are to be included in the list of Categories. The default value is 0 (display all Categories and their children). This parameter added at Version 2.5 0 - All Categories and child Categories (Default). -1 - All Categories displayed in at (no indent) form (overrides hierarchical). 1 - Show only top level Categories n - Value of n (some number) species the depth (or level) to descend in displaying Categories

Related
the_category, the_category_rss, single_cat_title, category_description, wp_dropdown_categories, wp_list_categories, in_category, get_category_parents, get_the_category get_category_link,

How to pass parameters to tags with PHP function-style parameters Go to Template Tag index Retrieved from "http://codex.wordpress.org/Template_Tags/wp_dropdown_categories" Categories: Copyedit | Template Tags | New page created

Template Tags/wp dropdown pages


This article is marked as in need of editing. You can help Codex by editing it.

Contents
1 Description 2 Usage 3 Examples 3.1 Default Usage 3.2 Dropdown with Submit Button 4 Parameters 5 Other Parameters 6 Related

Description
Displays a list of pages in a select (i.e dropdown) box with no submit button.

Usage
<?php wp_dropdown_pages('arguments'); ?>

Examples
Default Usage
$defaults = array( 'depth' 'child_of' 'selected' 'echo' 'name' 'show_option_none' By default, the usage shows: Pages and sub-pages displayed in hierarchical (indented) form Displays all pages (not restricted to child pages) No page is be 'selected' or presented in the display box The name assigned to the dropdown form is 'page_id' Allows you to select NONE of the pages (show_option_none) <?php wp_dropdown_pages(); ?> => => => => => => 0, 0, 0, 1, 'page_id', '');

Dropdown with Submit Button


Displays a hierarchical page dropdown list in HTML form with a submit button. <li id="pages"> <h2><?php _e('pages:'); ?></h2> <form action="<?php bloginfo('url'); ?>" method="get"> <?php wp_dropdown_pages(); ?> <input type="submit" name="submit" value="view" /> </form> </li>

Parameters
depth (integer) This parameter controls how many levels in the hierarchy of pages are to be included in the list generated by wp_list_pages. The default value is 0 (display all pages, including all sub-pages). 0 - Pages and sub-pages displayed in hierarchical (indented) form (Default).

-1 - Pages in sub-pages displayed in at (no indent) form. 1 - Show only top level Pages 2 - Value of 2 (or greater) species the depth (or level) to descend in displaying Pages. child_of (integer) Displays the sub-pages of a single Page only; uses the ID for a Page as the value. Defaults to 0 (displays all Pages). selected (integer) Page ID of the page to be 'selected' or presented in the display box. Defaults to no page selected. echo (boolean) Toggles the display of the generated list of links or return the list as an HTML text string to be used in PHP. The default value is 1 (display the generated list items). Valid values: 1 (true) - default 0 (false) name (string) Name assigned to the dropdown form. Defaults to 'page_id'. show_option_none (string) Causes the HTML for the dropdown to allow you to select NONE of the pages. exclude (string) Comma separated list of category IDs to exclude. For example, 'exclude=4,12' means category IDs 4 and 12 will NOT be displayed/echoed or returned. Defaults to exclude nothing. exclude_tree (string) Dene a comma-separated list of parent Page IDs to be excluded. Use this parameter to exclude a parent and all of that parent's child Pages. So 'exclude_tree=5' would exclude the parent Page 5, and its child Pages. This parameter was available at Version 2.7.

Other Parameters
It is possible, but not conrmed, some of the paramters for the function get_pages could be used for wp_dropdown_pages. Here's the default settings for the get_pages parameters $defaults = array( 'child_of' 'sort_order' 'sort_column' 'hierarchical' 'exclude' 'include' 'meta_key' 'meta_value' 'authors' 'exclude_tree

=> => => => => => => => => =>

0, 'ASC', 'post_title', 1, '', '', '', '', '' '');

Related
bloginfo, bloginfo_rss, get_bloginfo, get_bloginfo_rss, wp_title, wp_get_archives, get_calendar, get_posts, wp_list_pages, wp_page_menu, wp_dropdown_pages, wp_loginout, wp_register, wp_logout_url, query_posts, rss_enclosure

How to pass parameters to tags with query-string-style parameters Go to Template Tag index Retrieved from "http://codex.wordpress.org/Template_Tags/wp_dropdown_pages" Categories: Copyedit | Template Tags | New page created

Template Tags/wp generate tag cloud


Returns an HTML string that makes a tag cloud.

Synopsis
string $html = wp_generate_tag_cloud( array $tags, array|string $args = '' )

Default arguments

$defaults = array( 'smallest' => 8, 'largest' => 22, 'unit' => 'pt', 'number' => 45, 'format' => 'flat', 'orderby' => 'name', 'order' => 'ASC' );

Related
Called by wp_tag_cloud() and takes input from get_tags(). Retrieved from "http://codex.wordpress.org/Template_Tags/wp_generate_tag_cloud" Category: Template Tags

Template Tags/wp get archives Contents


1 Description 2 Usage 3 Examples 3.1 Default Usage 3.2 Last Twelve Months 3.3 Last Fifteen Days 3.4 Last Twenty Posts 3.5 Dropdown Box 4 Parameters 5 Related

Description
This function displays a date-based archives list in the same way as get_archives(). The only difference is that parameter arguments are given to the function in query string format. This tag can be used anywhere within a template.

Usage
<?php wp_get_archives('arguments'); ?>

Examples
Default Usage
<?php $defaults = array( 'type' => 'monthly', 'limit' => , 'format' => 'html', 'before' => , 'after' => , 'show_post_count' => false); ?> By default, the usage shows: Monthly archives links displayed Displays all archives (not limited in number) Displays archives in an <li> HTML list Nothing displayed before or after each link Does not display the count of the number of posts

Last Twelve Months


Displays archive list by month, displaying only the last twelve. <?php wp_get_archives('type=monthly&limit=12'); ?>

Last Fifteen Days


Displays archive list by date, displaying only the last fteen days. <?php wp_get_archives('type=daily&limit=15'); ?>

Last Twenty Posts


Displays archive list of the last twenty most recent posts listed by post title. <?php wp_get_archives('type=postbypost&limit=20&format=custom'); ?>

Dropdown Box
Displays a dropdown box of Monthly archives, in select tags, with the post count displayed. <select name=\"archivedropdown\" onChange='document.location.href=this.options[this.selectedIndex].value;'> <option value=\"\"><?php echo attribute_escape(__('Select Month')); ?></option> <?php wp_get_archives('type=monthly&format=option&show_post_count=1'); ?> </select>

Parameters
type (string) The type of archive list to display. Defaults to WordPress settings. Valid values: yearly monthly (Default) daily weekly postbypost limit (integer) Number of archives to get. Default is no limit. format (string) Format for the archive list. Valid values: html - In HTML list (<li>) tags and before and after strings. This is the default. option - In select (<select>) or dropdown option (<option>) tags. link - Within link (<link>) tags. custom - Custom list using the before and after strings. before (string) Text to place before the link when using the html or custom for format option. There is no default. after (string) Text to place after the link when using the html or custom for format option. There is no default. show_post_count (boolean) Display number of posts in an archive (1 - true) or do not (0 - false). For use with all type except 'postbypost'. Defaults to 0.

Related
bloginfo, bloginfo_rss, get_bloginfo, get_bloginfo_rss, wp_title, wp_get_archives, get_calendar, get_posts, wp_list_pages, wp_page_menu, wp_dropdown_pages, wp_loginout, wp_register, wp_logout_url, query_posts, rss_enclosure

How to pass parameters to tags with query-string-style parameters Go to Template Tag index Retrieved from "http://codex.wordpress.org/Template_Tags/wp_get_archives" Category: Template Tags

Template Tags/wp get links


This function has been deprecated. That means it has been replaced by a new function or is no longer supported, and may be removed from future versions. All code that uses this function should be converted to use its replacement if one exists.

Contents
1 Description 2 Replace With 3 Usage 4 Examples 4.1 Links by Category Number 4.2 Include Before and After Text 5 Parameters 6 Related

Description
Displays links associated with a numeric link category ID. This tag uses the settings you specify in the Links Manager (pre-WordPress 2.1 only). For control over the formatting and display of your links within the tag's parameters, see get_links().

Replace With
wp_list_bookmarks() accepts one or more numeric link categories through the 'category' parameter.

Usage
<?php wp_get_links(category); ?>

Examples
Links by Category Number
Show links for link category 1. <?php wp_get_links(1); ?>

Include Before and After Text


Mimic the behavior of get_links_list() but do respect the "Before Link", "Between Link and Description", and "After Link" settings dened for Link Categories in the Links Manager.

Parameters
category (integer) The numeric ID of the link category whose links will be displayed. You must select a link category, if none is selected it will generate an error.

Related
get_links_list, wp_get_links, get_links, wp_get_linksbyname, get_linksbyname, wp_list_bookmarks, get_bookmarks, get_bookmark

How to pass parameters to tags Go to Template Tag index Retrieved from "http://codex.wordpress.org/Template_Tags/wp_get_links" Category: Template Tags

Template Tags/wp get linksbyname


This function has been deprecated. That means it has been replaced by a new function or is no longer supported, and may be removed from future versions. All code that uses this function should be converted to use its replacement if one exists.

Contents
1 Description 2 Replace With 3 Usage 4 Examples 4.1 Default Usage 5 Parameters 5.1 category 5.2 arguments 6 Related

Description
Displays links associated with the named link category. This tag uses the settings you specify in the Links Manager. For control over the formatting and display of your links within the tag's parameters, see get_linksbyname().

Replace With
wp_list_bookmarks().

Usage
<?php wp_get_linksbyname('category','arguments'); ?>

Examples

Default Usage
By default, the tag shows: All categories if none are specied All category links are shown Puts a line break after the link item Puts a space between the image and link (if one is included) Shows link images if available List sorted by ID Shows the link description Does not show the rating With no limit listed, it shows all links Does not show the updated timestamp <?php wp_get_linksbyname(); ?> List all links in the Link Category called "Favorites". <?php wp_get_linksbyname('Favorites') ?> List all links in the Link Category Blogroll, order the links by name, don't show the description, and show last update timestamp. <?php wp_get_linksbyname('Blogroll','orderby=name&show_description=0&show_updated=1') ?>

Parameters
category
category (string) The name of the category whose links will be displayed. No default.

arguments
before (string) Text to place before each link. There is no default. after (string) Text to place after each link. Defaults to '<br />'. between (string) Text to place between each link/image and its description. Defaults to ' ' (space). show_images (boolean) Should images for links be shown. 1 (True - default) 0 (False) orderby (string) Value to sort links on. Valid options: 'id' (default) 'url' 'name' 'target' 'category' 'description' 'owner' - User who added link through Links Manager. 'rating' 'updated' 'rel' - Link relationship (XFN). 'notes' 'rss' 'length' - The length of the link name, shortest to longest. Prexing any of the above options with an underscore (ex: '_id') sorts links in reverse order. 'rand' - Display links in random order. show_description (boolean) Display the description. Valid if show_images is FALSE or an image is not dened. 1 (True - default) 0 (False) show_rating (boolean) Should rating stars/characters be displayed. 1 (True)

0 (False - default) limit (integer) Maximum number of links to display. Defaults to -1 (all links). show_updated (boolean) Should the last updated timestamp be displayed. 1 (True) 0 (False - default) echo (boolean) Display the Links list (1 - true) or return the list to be used in PHP (0 - false). Defaults to 1. 1 (True - default) 0 (False)

Related
get_links_list, wp_get_links, get_links, wp_get_linksbyname, get_linksbyname, wp_list_bookmarks, get_bookmarks, get_bookmark

How to pass parameters to tags Go to Template Tag index Retrieved from "http://codex.wordpress.org/Template_Tags/wp_get_linksbyname" Category: Template Tags

Template Tags/wp link pages Contents


1 Description 2 Usage 3 Examples 3.1 Default Usage 3.2 Page-links in Paragraph Tags 3.3 Page-links in DIV 4 Parameters 5 Related

Description
Displays page-links for paginated posts (i.e. includes the <!--nextpage--> Quicktag one or more times). This works in much the same way as link_pages(), the difference being that arguments are given in query string format. This tag must be within The_Loop.

Usage
<?php wp_link_pages('arguments'); ?>

Examples
Default Usage
Displays page-links by default with paragraph tags before and after, using Next page and Previous page, listing them with page numbers as Page 1, Page 2 and so on. <?php wp_link_pages(); ?>

Page-links in Paragraph Tags


Displays page-links wrapped in paragraph tags. <?php wp_link_pages('before=<p>&after=</p>&next_or_number=number&pagelink=page %'); ?>

Page-links in DIV
Displays page-links in DIV for CSS reference as <div id="page-links">. <?php wp_link_pages('before=<div id="page-links">&after=</div>'); ?>

Parameters

before (string) Text to put before all the links. Defaults to <p>Pages:. after (string) Text to put after all the links. Defaults to </p>. link_before (string) Text that goes before the text of the link. Defaults to (blank). Version 2.7 or later required. link_after (string) Text that goes after the text of the link. Defaults to (blank). Version 2.7 or later required. next_or_number (string) Indicates whether page numbers should be used. Valid values are: number (Default) next (Valid in WordPress 1.5 or after) nextpagelink (string) Text for link to next page. Defaults to Next page. (Valid in WordPress 1.5 or after) previouspagelink (string) Text for link to previous page. Defaults to Previous page. (Valid in WordPress 1.5 or after) pagelink (string) Format string for page numbers. % in the string will be replaced with the number, so Page % would generate "Page 1", "Page 2", etc. Defaults to %. more_le (string) Page the links should point to. Defaults to the current page.

Related
edit_post_link, edit_comment_link, link_pages, wp_link_pages, get_year_link, get_month_link, get_day_link

How to pass parameters to tags with query-string-style parameters Go to Template Tag index Retrieved from "http://codex.wordpress.org/Template_Tags/wp_link_pages" Category: Template Tags

Template Tags/wp list authors Contents


1 Description 2 Usage 3 Examples 3.1 Default Usage 3.2 Authors Full Names and Number of Posts 4 Parameters 5 Related

Description
Displays a list of the blog's authors (users), and if the user has authored any posts, the author name is displayed as a link to their posts. Optionally this tag displays each author's post count and RSS feed link.

Usage
<?php wp_list_authors('arguments'); ?>

Examples
Default Usage
<?php $defaults = array( 'optioncount' => false, 'exclude_admin' => true, 'show_fullname' => false, 'hide_empty' => true, 'echo' => true, 'feed' => , 'feed_image' => ); ?> By default, the usage shows:

Does not display the count of the number of posts Excludes the 'admin' author from the list Does not display the full name (rst and last) but displays the author nickname Excludes users with no posts Display the results No author feed text is displayed No author feed image is displayed <?php wp_list_authors(); ?>

Authors Full Names and Number of Posts


This example displays a list of the site's authors with the full name (rst and last name) plus the number of posts for each author. Also, and by default, it excludes the admin author, hides authors with no posts, and does not display the RSS feed or image. <?php wp_list_authors('show_fullname=1&optioncount=1'); ?> Harriett Smith (42) Sally Smith (29) Andrew Anderson (48)

Parameters
optioncount (boolean) Display number of published posts by each author. Options are: 1 (true) 0 (false - this is the default) exclude_admin (boolean) Exclude the 'admin' (login is admin) account from authors list. Options are: 1 (true - this is the default) 0 (false) show_fullname (boolean) Display the full (rst and last) name of the authors. If false, the nickname is displayed. Options are: 1 (true) 0 (false - this is the default) hide_empty (boolean) Do not display authors with 0 posts. Options are: 1 (true - this is the default) 0 (false) echo (boolean) Display the results. Options are: 1 (true - this is the default) 0 (false) feed (string) Text to display for a link to each author's RSS feed. Default is no text, and no feed displayed. feed_image (string) Path/lename for a graphic. This acts as a link to each author's RSS feed, and overrides the feed parameter. style (string) Style in which to display the author list. A value of list displays the authors as list items while none generates no special display method (the list items are separated by <br> tags). The default setting is list (creates list items for an unordered list). See the markup section for more. This option added with Version 2.8. Valid values: list - default. none html (string) Whether to list the items in html or plaintext. The default setting is html. This option added with Version 2.8. Valid values: list - default. none

Related

the_author, the_author_description, the_author_login, the_author_rstname, the_author_lastname, the_author_nickname, the_author_ID, the_author_email, the_author_url, the_author_link, the_author_icq, the_author_aim, the_author_yim, the_author_msn, the_modied_author, the_author_posts, the_author_posts_link, list_authors, wp_list_authors

How to pass parameters to tags with query-string-style parameters Go to Template Tag index Retrieved from "http://codex.wordpress.org/Template_Tags/wp_list_authors" Category: Template Tags

Template Tags/wp list bookmarks Contents


1 Description 2 Usage 3 Examples 3.1 Default Usage 3.2 Simple List 3.3 Simple List without the Heading 3.4 Specic Category Sorted by URL 3.5 Shows Ratings and Timestamp 4 Parameters 5 Related

Description
This function was introduced in WordPress v2.1 . wp_list_bookmarks(), displays bookmarks found in the Administration > Blogroll > Manage Blogroll panel. This Template Tag allows the user to control how the bookmarks are sorted and displayed and is intended to replace the Template tags 'get_links_list()' and 'get_links()'.

Usage
<?php wp_list_bookmarks('arguments'); ?>

Examples
Default Usage
By default, the function shows: Bookmarks divided into Categories with a Category name heading All bookmarks included, regardless of Category ID, Category Name, or Category ID Sorts the list by name An image if one is included A space between the image and the text Shows the description of the bookmark Does not show the ratings Unless limit is set, shows all bookmarks Displays bookmarks <?php wp_list_bookmarks(); ?>

Simple List
Displays all bookmarks with the title "Bookmarks" and with items wrapped in <li> tags. The title is wrapped in h2 tags. <?php wp_list_bookmarks('title_li=&category_before=&category_after='); ?>

Simple List without the Heading


Displays all bookmarks as above, but does not include the default heading. <?php wp_list_bookmarks('title_li=&categorize=0'); ?>

Specic Category Sorted by URL


Displays bookmarks for Category ID 2 in span tags, uses images for bookmarks, does not show descriptions, sorts by bookmark URL.

<?php wp_list_bookmarks('categorize=0&category=2&before=<span>&after=</span>&show_images=1&show_description=0&orderby=u

Shows Ratings and Timestamp


Displays all bookmarks in an ordered list with descriptions on a new line, does not use images for bookmarks, sorts by bookmark id, shows ratings and last-updated timestamp. <ol> <?php wp_list_bookmarks('between=<br />&show_images=0&orderby=id&show_rating=1&show_updated=1'); ?> </ol>

Parameters
categorize (boolean) Bookmarks should be shown within their assigned Categories (TRUE) or not (FALSE). Defaults to TRUE. 1 (True - default) 0 (False) category (string) Comma separated list of numeric Category IDs to be displayed. If none is specied, all Categories with bookmarks are shown. Defaults to (all Categories). exclude_category (string) Comma separated list of numeric Category IDs to be excluded from display. Defaults to (no categories excluded). category_name (string) The name of a Category whose bookmarks will be displayed. If none is specied, all Categories with bookmarks are shown. Defaults to (all Categories). category_before (string) Text to put before each category. Defaults to '<li id="[category id]" class="linkcat">' . category_after (string) Text to put before each category. Defaults to '<'/li>' . class (string) The class each cateogory li will have on it. Defaults to 'linkcat' . category_orderby (string) Value to sort Categories on. Defaults to 'name'. Valid options: 'name' (Default) 'id' 'slug' 'count' 'term_group' (not used yet) category_order (string) Sort order, ascending or descending for the category_orderby parameter. Valid values: ASC (Default) DESC title_li (string) Text for the heading of the links list. Defaults to '__('Bookmarks')', which displays "Bookmarks" (the __('') is used for localization purposes). Only used with categorize set to 0 (else the category names will be used instead). If passed a null (0) value, no heading is displayed, and the list will not be wrapped with <ul>, </ul> tags (be sure to pass the categorize option to 0 to this option takes effect). title_before (string) Text to place before each Category description if 'categorize' is TRUE. Defaults to '<h2>'. title_after (string) Text to place after each Category description if 'categorize' is TRUE. Defaults to '</h2>'. show_private (boolean) Should a Category be displayed even if the Category is considered private. Ignore the admin setting and show private Categories (TRUE) or do NOT show private Categories (FALSE). Defaults to FALSE. 1 (True) 0 (False - default) include (string) Comma separated list of numeric bookmark IDs to include in the output. For example, 'include=1,3,6' means to return or echo bookmark IDs 1, 3, and 6. If the include string is used, the category, category_name, and exclude parameters are ignored. Defaults to (all Bookmarks). exclude (string) Comma separated list of numeric bookmark IDs to exclude. For example, 'exclude=4,12' means that bookmark IDs 4 and 12 will NOT be returned or echoed. Defaults to (exclude nothing). orderby (string) Value to sort bookmarks on. Defaults to 'name' unless you pass the value of '' (empty), in which case it sets to 'id'. Valid options: 'id'

'url' 'name' 'target' 'description' 'owner' - User who added bookmark through bookmarks Manager. 'rating' 'updated' 'rel' - bookmark relationship (XFN). 'notes' 'rss' 'length' - The length of the bookmark name, shortest to longest. 'rand' - Display bookmarks in random order. order (string) Sort order, ascending or descending for the orderby parameter. Valid values: ASC (Default) DESC limit (integer) Maximum number of bookmarks to display. Defaults to -1 (all bookmarks). before (string) Text to place before each bookmark. Defaults to '<li>'. after (string) Text to place after each bookmark. Defaults to '</li>'. link_before (string) Text to place before the text of each bookmark, inside the hyperlink code. There is no set default. (Requires version 2.7 or later.) link_after (string) Text to place after the text of each bookmark. There is no set default. (Requires version 2.7 or later.) category_before (string) Text to place before each category. Defaults to '<li>' with an appropriate id and class. category_after (string) Text to place after each category. Defaults to '</li>'. between (string) Text to place between each bookmark/image and its description. Defaults to '\n' (newline). show_images (boolean) Should images for bookmarks be shown (TRUE) or not (FALSE). Defaults to TRUE. 1 (True - default) 0 (False) show_description (boolean) Should the description be displayed (TRUE) or not (FALSE). Valid when show_images is FALSE, or an image is not dened. Defaults to FALSE. 1 (True) 0 (False - default) show_name (2.7) (boolean) Displays the text of a link when (TRUE). Works when show_images is TRUE. Defaults to FALSE. 1 (True) 0 (False - default) show_rating (boolean) Should rating stars/characters be displayed (TRUE) or not (FALSE). Defaults to FALSE. 1 (True) 0 (False - default) show_updated (boolean) Should the last updated timestamp be displayed (TRUE) or not (FALSE). Defaults to FALSE. 1 (True) 0 (False - default) hide_invisible (boolean) Should bookmark be displayed even if it's Visible setting is No. Abides by admin setting (TRUE) or does no abide by admin setting (FALSE). Defaults to TRUE. 1 (True - default) 0 (False) echo (boolean) Display bookmarks (TRUE) or return them for use by PHP (FALSE). Defaults to TRUE. 1 (True - default)

0 (False)

Related
wp_list_bookmarks, get_bookmarks, get_bookmark

How to pass parameters to tags with PHP function-style parameters Go to Template Tag index Retrieved from "http://codex.wordpress.org/Template_Tags/wp_list_bookmarks" Categories: Template Tags | New page created

Template Tags/wp list categories Contents


1 Description 2 Usage 3 Examples 3.1 Default Usage 3.2 Include or Exclude Categories 3.3 Display or Hide the List Heading 3.4 Only Show Children of a Category 3.5 Remove Parentheses from Category Counts 3.6 Display Categories with RSS Feed Links 3.7 Markup and Styling of Category Lists 4 Parameters 5 Related

Description
The template tag, wp_list_categories, displays a list of Categories as links. When a Category link is clicked, all the posts in that Category will display on a Category Page using the appropriate Category Template dictated by the Template Hierarchy rules. wp_list_categories works in much the same way as the two template tags replaced in WordPress 2.1, list_cats()(deprecated), and wp_list_cats()(deprecated).

Usage
<?php wp_list_categories('arguments'); ?>

Examples
Default Usage
$defaults = array( 'show_option_all' => 'orderby' => 'order' => 'show_last_update' => 'style' => 'show_count' => 'hide_empty' => 'use_desc_for_title' => 'child_of' => 'feed' => '', 'feed_image' => 'exclude' => 'current_category' => 'hierarchical' => true, 'title_li' => 'echo' => 1, 'depth' => ); As well as the silent 'number' => NULL '', 'name', 'ASC', 0, 'list', 0, 1, 1, 0, '', '', 0, __('Categories'), 0

By default, the usage shows: No link to all categories

Sorts the list of Categories in by the Category name in ascending order Does not show the last update (last updated post in each Category) Displayed in an unordered list style Does not show the post count Displays only Categories with posts Sets the title attribute to the Category Description Is not restricted to the child_of any Category No feed or feed image used Does not exclude any Category and includes all Categories ('include' => is not shown above) Displays the active Category with the CSS Class-Sufx ' current-cat' Shows the Categories in hierarchical indented fashion Display Category as the heading over the list No SQL LIMIT is imposed ('number' => 0 is not shown above) Displays (echos) the categories No limit to depth All categories. wp_list_categories();

Include or Exclude Categories


To sort categories alphabetically and include only the categories with IDs of 16, 3, 9 and 5, you could write the following code: <ul> <?php wp_list_categories('orderby=name&include=3,5,9,16'); ?> </ul> The following example displays category links sorted by name, shows the number of posts for each category, and excludes the category with the ID of 10 from the list. <ul> <?php wp_list_categories('orderby=name&show_count=1&exclude=10'); ?> </ul>

Display or Hide the List Heading


The title_li parameter sets or hides a title or heading for the category list generated by wp_list_categories. It defaults to '(__('Categories')', i.e. it displays the word "Categories" as the list's heading. If the parameter is set to a null or empty value, no heading is displayed. The following example code excludes categories with IDs 4 and 7 and hides the list heading: <ul> <?php wp_list_categories('exclude=4,7&title_li='); ?> </ul> In the following example, only Cateogories with IDs 9, 5, and 23 are included in the list and the heading text has been changed to the word "Poetry", with a heading style of <h2>: <ul> <?php wp_list_categories('include=5,9,23&title_li=<h2>' . __('Poetry') . '</h2>' ); ?> </ul>

Only Show Children of a Category


The following example code generates category links, sorted by ID, only for the children of the category with ID 8; it shows the number of posts per category and hides category descriptions from the title attribute of the generated links. Note: If there are no posts in a parent Category, the parent Category will not display. <ul> <?php wp_list_categories('orderby=id&show_count=1 &use_desc_for_title=0&child_of=8'); ?> </ul>

Remove Parentheses from Category Counts


When show_count=1, each category count is surrounded by parentheses. In order to remove the parentheses without modifying core WordPress les, use the following code.

<?php $variable = wp_list_categories('echo=0&show_count=1&title_li=<h2>Categories</h2>'); $variable = str_replace(array('(',')'), '', $variable); echo $variable; ?>

Display Categories with RSS Feed Links


The following example generates Category links sorted by name, shows the number of posts per Category, and displays links to the RSS feed for each Category. <ul> <?php wp_list_categories('orderby=name&show_count=1&feed=RSS'); ?> </ul> To replace the rss link with a feed icon, you could write: <ul> <?php wp_list_categories('orderby=name&show_count=1 &feed_image=/images/rss.gif'); ?> </ul>

Markup and Styling of Category Lists


By default, wp_list_categories() generates nested unordered lists (ul) within a single list item (li) titled "Categories". You can remove the outermost item and list by setting the title_li parameter to an empty string. You'll need to wrap the output in an ordered list (ol) or unordered list yourself (see the examples below). If you don't want list output at all, set the style parameter to none. If the category list is generated on a Category Archive page, the list item for that category is marked with the HTML class current-cat. The other list items have no class. ... <li class="current-cat"> [You are on this category page] </li> <li> [Another category] </li> ... You can style that list item with a CSS selector : .categories { ... } .cat-item { ... } .current-cat { ... } .current-cat-parent { ... }

Parameters
show_option_all (string) A non-blank values causes the display of a link to all categories if the style is set to list. The default value is not to display a link to all. orderby (string) Sort categories alphabetically, by unique Category ID, or by the count of posts in that Category. The default is sort by category name. Valid values: ID name - default slug count order (string) Sort order for categories (either ascending or descending). The default is ascending. Valid values: ASC - default DESC show_last_updated (boolean) Should the last updated timestamp for posts be displayed (TRUE) or not (FALSE). Defaults to FALSE.

* 1 (true) * 0 (false) - default style (string) Style to display the categories list in. A value of list displays the categories as list items while none generates no special display method (the list items are separated by <br> tags). The default setting is list (creates list items for an unordered list). See the markup section for more. Valid values: list - default. none show_count (boolean) Toggles the display of the current count of posts in each category. The default is false (do not show post counts). Valid values: 1 (true) 0 (false) - default hide_empty (boolean) Toggles the display of categories with no posts. The default is true (hide empty categories). Valid values: 1 (true) - default 0 (false) use_desc_for_title (boolean) Sets whether a category's description is inserted into the title attribute of the links created (i.e. <a title="<em>Category Description</em>" href="...). The default is true (category descriptions will be inserted). Valid values: 1 (true) - default 0 (false) child_of (integer) Only display categories that are children of the category identied by this parameter. There is no default for this parameter. If the parameter is used, the hide_empty parameter is set to false. feed (string) Display a link to each category's rss-2 feed and set the link text to display. The default is no text and no feed displayed. feed_image (string) Set a URI for an image (usually an rss feed icon) to act as a link to each categories' rss-2 feed. This parameter overrides the feed parameter. There is no default for this parameter. exclude (string) Exclude one or more categories from the results. This parameter takes a comma-separated list of categories by unique ID, in ascending order. See the example. The child_of parameter is automatically set to false. include (string) Only include the categories detailed in a comma-separated list by unique ID, in ascending order. See the example. hierarchical (boolean) Display sub-categories as inner list items (below the parent list item) or inline. The default is true (display sub-categories below the parent list item). Valid values: 1 (true) - default 0 (false) title_li (string) Set the title and style of the outer list item. Defaults to "_Categories". If present but empty, the outer list item will not be displayed. See below for examples. number (integer) Sets the number of Categories to display. This causes the SQL LIMIT value to be dened. Default to no LIMIT. echo (boolean) Show the result or keep it in a variable. The default is true (display the categories organized). Valid values: 1 (true) - default 0 (false) depth (integer) This parameter controls how many levels in the hierarchy of Categories are to be included in the list of Categories. The default value is 0 (display all Categories and their children). This parameter added at Version 2.5 0 - All Categories and child Categories (Default). -1 - All Categories displayed in at (no indent) form (overrides hierarchical). 1 - Show only top level Categories n - Value of n (some number) species the depth (or level) to descend in displaying Categories

current_category (integer) Allows you to force the "current-cat" to appear on uses of wp_list_categories that are not on category archive pages. Normally, the current-cat is set only on category archive pages. If you have another use for it, or want to force it to highlight a different category, this overrides what the function thinks the "current" category is.

Related
the_category, the_category_rss, single_cat_title, category_description, wp_dropdown_categories, wp_list_categories, in_category, get_category_parents, get_the_category get_category_link,

How to pass parameters to tags with query-string-style parameters Go to Template Tag index

This article is marked as in need of editing. You can help Codex by editing it. Retrieved from "http://codex.wordpress.org/Template_Tags/wp_list_categories" Categories: Template Tags | Copyedit

Template Tags/wp list cats


This function has been deprecated. That means it has been replaced by a new function or is no longer supported, and may be removed from future versions. All code that uses this function should be converted to use its replacement if one exists.

Contents
1 Description 2 Replace With 3 Usage 4 Examples 4.1 Default Usage 4.2 Categories With Excludes 4.3 Show Children Only of Category 4.4 Display Categories With RSS Feed Links 5 Notes on use 6 Parameters 7 Related

Description
Displays a list of Categories as links. When one of those links is clicked, all the posts in that Category will display in the appropriate Category Template dictated by the Template Hierarchy rules. This works in much the same way as list_cats(), the difference being that arguments are given in query string format. See wp_list_categories() which replaces this in the current version.

Replace With
wp_list_categories().

Usage
<?php wp_list_cats('arguments'); ?>

Examples
Default Usage
By default, the tag: optionall - Does not display a link to all Categories all - Text to display for link to all Categories sort_column - Sorts by Category ID sort_order - Sorts in ascending order le - Displays the Categories using the index.php template list - Sets the Categories in an unordered list (<ul><li>) optioncount - Does not display the count of posts within each Category hide_empty - Does not display links to Categories which have no posts

use_desc_for_title - Uses the Category description as the link title children - Shows the children (sub-Categories) of every Category listed hierarchical - Displays the children Categories in a hierarchical order under its Category parent <?php wp_list_cats(); ?>

Categories With Excludes


Displays Category links sorted by name, shows # of posts for each Category, and excludes Category IDs 10 and 15 from the list. <ul> <?php wp_list_cats('sort_column=name&optioncount=1&exclude=10, 15'); ?> </ul>

Show Children Only of Category


Displays Category links sorted by ID (sort_column=id), without showing the number of posts per Category (optioncount=0), showing only the sub-Categories titles (use_desc_for_title=0), for just the children of Category ID 8 (child_of=8). <?php wp_list_cats('sort_column=id&optioncount=0&use_desc_for_title=0&child_of=8'); ?> Note: If there are no posts in a parent Category, that parent Category will not display.

Display Categories With RSS Feed Links


Displays Category links sorted by name, without showing the number of posts per Category, and displays links to the RSS feed for each Category. <?php wp_list_cats('sort_column=name&optioncount=0&feed=RSS'); ?>

Notes on use
When the 'list' parameter is set for an unordered list, the wp_list_cats() tag requires an opening and closing UL tag, but will automatically list each item as an LI.

Parameters
optionall (boolean) Sets whether to display a link to all Categories. Note: This feature no longer works in WordPress 1.5.x and 2.0 but is slated to be added back at Version 2.1. Valid values: 1 (True) 0 (False - default) all (string) If optionall is set to 1 (TRUE), this denes the text to be displayed for the link to all Categories. Note: This feature no longer works in WordPress 1.5.x and 2.0 but is slated to be added back at Version 2.1. Defaults to 'All'. sort_column (string) Key to sort options by. Valid values: ID (Default) name sort_order (string) Sort order for options. Valid values: asc (Default) desc le (string) The php le a Category link is to be displayed on. Defaults to index.php. list (boolean) Sets whether the Categories are enclosed in an unordered list (<ul><li>). Valid values: 1 (True - default) 0 (False) optiondates (string) Sets whether to display the date of the last post in each Category. Valid values: 1 (True, displays Y-m-d) 0 (False - default) string (Eg. Y-m-d, see all available options) optioncount (boolean) Sets whether to display a count of posts in each Category. Valid values:

1 (True) 0 (False - default) hide_empty (boolean) Sets whether to hide (not display) Categories with no posts. Valid values: 1 (True - default) 0 (False) use_desc_for_title (boolean) Sets whether the Category description is displayed as link title (i.e. <a title="Category Description" href="...). Valid values: 1 (True - default) 0 (False) children (boolean) Sets whether to show children (sub) Categories. Valid values: 1 (True - default) 0 (False) child_of (integer) Display only the Categories that are children of this Category (ID number). There is no default. If this parameter is used, hide_empty gets set to False. feed (string) Text to display for the link to each Category's RSS2 feed. Default is no text, and no feed displayed. feed_image (string) Path/lename for a graphic to act as a link to each Categories' RSS2 feed. Overrides the feed parameter. exclude (string) Sets the Categories to be excluded. This must be in the form of an array (ex: 1, 2, 3). hierarchical (boolean) Sets whether to display child (sub) Categories in a hierarchical (after parent) list. Valid values: 1 (True - default) 0 (False) Note: The hierarchical parameter is not available in versions of WordPress prior to 1.5

Related
the_category, the_category_rss, single_cat_title, category_description, wp_dropdown_categories, wp_list_categories, in_category, get_category_parents, get_the_category get_category_link,

How to pass parameters to tags with query-string-style parameters Go to Template Tag index Retrieved from "http://codex.wordpress.org/Template_Tags/wp_list_cats" Category: Template Tags

Template Tags/wp list comments


This page is marked as incomplete. You can help Codex by expanding it.

Contents
1 Description 2 Usage 3 Examples 3.1 Default Usage 3.2 Comments Only With A Custom Comment Display 4 Parameters 5 Related

Description
Introduced in Version 2.7, this function 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

Usage
<?php wp_list_comments('arguments'); ?>

Examples
Default Usage
Outputs an ordered list of the comments. Things like threading or paging being enabled or disabled are controlled via the Settings Discussion SubPanel. <ol class="commentlist"> <?php wp_list_comments(); ?> </ol>

Comments Only With A Custom Comment Display


Displays just comments (no pingbacks or trackbacks) while using a custom callback function to control the look of the comment. <ul class="commentlist"> <?php wp_list_comments('type=comment&callback=mytheme_comment'); ?> </ul> You will need to dene your custom callback function in your theme's functions.php le. Here is an example: function mytheme_comment($comment, $args, $depth) { $GLOBALS['comment'] = $comment; ?> <li <?php comment_class(); ?> id="li-comment-<?php comment_ID() ?>"> <div id="comment-<?php comment_ID(); ?>"> <div class="comment-author vcard"> <?php echo get_avatar($comment,$size='48',$default='<path_to_url>' ); ?> <?php printf(__('<cite class="fn">%s</cite> <span class="says">says:</span>'), get_comment_author_link()) ?> </div> <?php if ($comment->comment_approved == '0') : ?> <em><?php _e('Your comment is awaiting moderation.') ?></em> <br /> <?php endif; ?>

<div class="comment-meta commentmetadata"><a href="<?php echo htmlspecialchars( get_comment_link( $comment->comme <?php comment_text() ?> <div class="reply"> <?php comment_reply_link(array_merge( $args, array('depth' => $depth, 'max_depth' => $args['max_depth']))) ?> </div> </div> <?php } Note the lack of a trailing </li>. WordPress will add it itself once it's done listing any children and whatnot.

Parameters
This needs expanding / explaining. avatar_size (int) Size that the avatar should be shown as, in pixels. Default: 32. http://gravatar.com/ supports sizes between 1 and 512. style (string) Can be either 'div', 'ol', or 'ul', to display comments using divs, ordered, or unordered lists. Defaults to 'ul'. Note that there are containing tags that must be written explicitly such as <div class="commentlist"><?php wp_list_comments(array('style' => 'div')); ?></div> or <ol class="commentlist"><?php wp_list_comments(array('style' => 'ol')); ?></ol> type (string) The type of comment(s) to display. Can be 'all', 'comment', 'trackback', 'pingback', or 'pings'. 'pings' is 'trackback' and 'pingback' together. Default is 'all'.

callback (string) The name of a custom function to use to display each comment. Defaults to null. Using this will make your custom function get called to display each comment, bypassing all internal WordPress functionality in this respect. Use to customize comments display for extreme changes to the HTML layout. Not recommended.

$defaults = array('walker' => null, 'max_depth' => '', 'style' => 'ul', 'callback' => null, 'end-callback' => null, 'ty 'page' => '', 'per_page' => '', 'avatar_size' => 32, 'reverse_top_level' => null, 'reverse_children' => '');

Related
comments_number, comments_link, comments_rss_link, comments_popup_script, comments_popup_link, comment_ID, comment_author, comment_author_IP, comment_author_email, comment_author_url, comment_author_email_link, comment_author_url_link, comment_author_link, comment_type, comment_text, comment_excerpt, comment_date, comment_time, comments_rss_link, comment_author_rss, comment_text_rss, comment_link_rss, permalink_comments_rss, wp_list_comments, previous_comments_link, next_comments_link

How to pass parameters to tags with PHP function-style parameters Go to Template Tag index Retrieved from "http://codex.wordpress.org/Template_Tags/wp_list_comments" Categories: Stubs | Template Tags | New page created

Template Tags/wp list pages Contents


1 Description 2 Usage 3 Examples 3.1 Default Usage 3.2 Hiding or Changing the List Heading 3.3 List Pages by Page Order 3.4 Sort Pages by Post Date 3.5 Exclude Pages from List 3.6 Include Pages in List 3.7 List Sub-Pages 3.8 List subpages even if on a subpage 3.9 Markup and styling of page items 4 Parameters 5 Related

Description
The Template Tag, wp_list_pages(), displays a list of WordPress Pages as links. It is often used to customize the Sidebar or Header, but may be used in other Templates as well. This Template Tag is available for WordPress versions 1.5 and newer.

Usage
<?php wp_list_pages('arguments'); ?>

Examples
Default Usage
$defaults = array( 'depth' => 'show_date' => 'date_format' => 'child_of' => 'exclude' => 'title_li' => 'echo' => 'authors' => 'sort_column' => 'link_before' => 'link_after' => 'exclude_tree'=> 0, '', get_option('date_format'), 0, '', __('Pages'), 1, '', 'menu_order, post_title', '', '', '' );

By default, the usage shows: All Pages and sub-pages are displayed (no depth restriction) Date created is not displayed Is not restricted to the child_of any Page No pages are excluded The title of the pages listed is "Pages" Results are echoed (displayed) Is not restricted to any specic author Sorted by Page Order then Page Title. Sorted in ascending order (not shown in defaults above) Pages displayed in a hierarchical indented fashion (not shown in defaults above) Includes all Pages (not shown in defaults above) Not restricted to Pages with specic meta key/meta value (not shown in defaults above) No Parent/Child trees excluded wp_list_pages();

Hiding or Changing the List Heading


The default heading of the list ("Pages") of Pages generated by wp_list_pages can be hidden by passing a null or empty value to the title_li parameter. The following example displays no heading text above the list. <ul> <?php wp_list_pages('title_li='); ?> </ul> In the following example, only Pages with IDs 9, 5, and 23 are included in the list and the heading text has been changed to the word "Poetry", with a heading style of <h2>: <ul> <?php wp_list_pages('include=5,9,23&title_li=<h2>' . __('Poetry') . '</h2>' ); ?> </ul>

List Pages by Page Order


The following example lists the Pages in the order dened by the Page Order settings for each Page in the Write > Page administrative panel. <ul> <?php wp_list_pages('sort_column=menu_order'); ?> </ul> If you wanted to sort the list by Page Order and display the word "Prose" as the list heading (in h2 style) on a Sidebar, you could add the following code to the sidebar.php le: <ul> <?php wp_list_pages('sort_column=menu_order&title_li=<h2>' . __('Prose') . '</h2>' ); ?> </ul> Using the following piece of code, the Pages will display without heading and in Page Order: <ul> <?php wp_list_pages('sort_column=menu_order&title_li='); ?> </ul>

Sort Pages by Post Date


This example displays Pages sorted by (creation) date, and shows the date next to each Page list item. <ul> <?php wp_list_pages('sort_column=post_date&show_date=created'); ?> </ul>

Exclude Pages from List


Use the exclude parameter to hide certain Pages from the list to be generated by wp_list_pages. <ul> <?php wp_list_pages('exclude=17,38' ); ?> </ul>

Include Pages in List

To include only certain Pages in the list, for instance, Pages with ID numbers 35, 7, 26 and 13, use the include parameter. <ul> <?php wp_list_pages('include=7,13,26,35&title_li=<h2>' . __('Pages') . '</h2>' ); ?> </ul>

List Sub-Pages
Versions prior to Wordpress 2.0.1 : Put this inside the the_post() section of the page.php template of your WordPress theme after the_content(), or put it in a copy of the page.php template that you use for pages that have sub-pages: <ul> <?php global $id; wp_list_pages("title_li=&child_of=$id&show_date=modified &date_format=$date_format"); ?> </ul> This example does not work with Wordpress 2.0.1 or newer if placed in a page template because the global $id is not set. Use the following code instead. Wordpress 2.0.1 or newer : NOTE: Requires an HTML tag (either <ul> or <ol>) even if there are no subpages. Keep this in mind if you are using css to style the list. <ul> <?php wp_list_pages('title_li=&child_of='.$post->ID.'&show_date=modified &date_format=$date_format'); ?> </ul> The following example will generate a list only if there are child (Pages that designate the current page as a Parent) for the current Page: <?php $children = wp_list_pages('title_li=&child_of='.$post->ID.'&echo=0'); if ($children) { ?> <ul> <?php echo $children; ?> </ul> <?php } ?>

List subpages even if on a subpage


The above examples will only show the children from the parent page, but not when actually on a child page. This code will show the child pages, and only the child pages, when on a parent or on one of the children. This code will not work if placed after a widget block in the sidebar.

<?php if($post->post_parent) $children = wp_list_pages("title_li=&child_of=".$post->post_parent."&echo=0"); else $children = wp_list_pages("title_li=&child_of=".$post->ID."&echo=0"); if ($children) { ?> <ul> <?php echo $children; ?> </ul> <?php } ?>

Markup and styling of page items


By default, wp_list_pages() generates a nested, unordered list of WordPress Pages created with the Write > Page admin panel. You can remove the outermost item (li.pagenav) and list (ul) by setting the title_li parameter to an empty string. All list items (li) generated by wp_list_pages() are marked with the class page_item. When wp_list_pages() is called while displaying a Page, the list item for that Page is given the additional class current_page_item.

<li class="pagenav"> Pages <ul> <li class="page_item current_page_parent"> [parent of the current page] <ul> <li class="page_item current_page_item"> [the current page] </li> </ul> </li> <li class="page_item"> [another page] </li> </ul> </li> They can be styled with CSS selectors: .pagenav { ... } .page_item { ... } .current_page_item { ... } .current_page_parent { ... }

Parameters
sort_column (string) Sorts the list of Pages in a number of different ways. The default setting is sort alphabetically by Page title. 'post_title' - Sort Pages alphabetically (by title) - default 'menu_order' - Sort Pages by Page Order. N.B. Note the difference between Page Order and Page ID. The Page ID is a unique number assigned by WordPress to every post or page. The Page Order can be set by the user in the Write>Pages administrative panel. See the example below. 'post_date' - Sort by creation time. 'post_modified' - Sort by time last modied. 'ID' - Sort by numeric Page ID. 'post_author' - Sort by the Page author's numeric ID. 'post_name' - Sort alphabetically by Post slug. Note: The sort_column parameter can be used to sort the list of Pages by the descriptor of any eld in the wp_post table of the WordPress database. Some useful examples are listed here. sort_order (string) Change the sort order of the list of Pages (either ascending or descending). The default is ascending. Valid values: 'asc' - Sort from lowest to highest (Default). 'desc' - Sort from highest to lowest. exclude (string) Dene a comma-separated list of Page IDs to be excluded from the list (example: 'exclude=3,7,31'). There is no default value. See the Exclude Pages from List example below. exclude_tree (string) Dene a comma-separated list of parent Page IDs to be excluded. Use this parameter to exclude a parent and all of that parent's child Pages. So 'exclude_tree=5' would exclude the parent Page 5, and its child (all descendant) Pages. This parameter was available at Version 2.7. include (string) Only include certain Pages in the list generated by wp_list_pages. Like exclude, this parameter takes a comma-separated list of Page IDs. There is no default value. See the Include Pages in List example below. depth (integer) This parameter controls how many levels in the hierarchy of pages are to be included in the list generated by wp_list_pages. The default value is 0 (display all pages, including all sub-pages). 0 - Pages and sub-pages displayed in hierarchical (indented) form (Default). -1 - Pages in sub-pages displayed in at (no indent) form. 1 - Show only top level Pages 2 - Value of 2 (or greater) species the depth (or level) to descend in displaying Pages.

child_of (integer) Displays the sub-pages of a single Page only; uses the ID for a Page as the value. Note that the child_of parameter will also fetch "grandchildren" of the given ID, not just direct descendants. Defaults to 0 (displays all Pages). show_date (string) Display creation or last modied date next to each Page. The default value is the null value (do not display dates). Valid values: '' - Display no date (Default). 'modified' - Display the date last modied. 'xxx' - Any value other than modied displays the date (post_date) the Page was rst created. See the example below. date_format (string) Controls the format of the Page date set by the show_date parameter (example: "l, F j, Y"). This parameter defaults to the date format congured in your WordPress options. See Formatting Date and Time and the date format page on the php web site. title_li (string) Set the text and style of the Page list's heading. Defaults to '__('Pages')', which displays "Pages" (the __('') is used for localization purposes). If passed a null or empty value (''), no heading is displayed, and the list will not be wrapped with <ul>, </ul> tags. See the example for Headings. echo (boolean) Toggles the display of the generated list of links or return the list as an HTML text string to be used in PHP. The default value is 1 (display the generated list items). Valid values: 1 (true) - default 0 (false) hierarchical (boolean) Display sub-Pages in an indented manner below their parent or list the Pages inline. The default is true (display sub-Pages indented below the parent list item). Valid values: 1 (true) - default 0 (false) meta_key (string) Only include the Pages that have this Custom Field Key (use in conjunction with the meta_value eld). meta_value (string) Only include the Pages that have this Custom Field Value (use in conjuntion with the meta_key eld). link_before (string) Sets the text or html that proceeds the link text inside <a> tag. (Version 2.7.0 or newer.) link_after (string) Sets the text or html that follows the link text inside <a> tag. (Version 2.7.0 or newer.)

Related
bloginfo, bloginfo_rss, get_bloginfo, get_bloginfo_rss, wp_title, wp_get_archives, get_calendar, get_posts, wp_list_pages, wp_page_menu, wp_dropdown_pages, wp_loginout, wp_register, wp_logout_url, query_posts, rss_enclosure

How to pass parameters to tags with query-string-style parameters Go to Template Tag index

This article is marked as in need of editing. You can help Codex by editing it. Retrieved from "http://codex.wordpress.org/Template_Tags/wp_list_pages" Categories: Template Tags | Copyedit

Template Tags/wp loginout Contents


1 Description 2 Usage 3 Example 4 Parameters 5 Related

Description

Displays a login link, or if a user is logged in, a logout link. This tag was introduced in version 1.5 of WordPress.

Usage
<?php wp_loginout(); ?>

Example
<p><?php wp_loginout(); ?></p>

Parameters
This tag has no parameters.

Related
bloginfo, bloginfo_rss, get_bloginfo, get_bloginfo_rss, wp_title, wp_get_archives, get_calendar, get_posts, wp_list_pages, wp_page_menu, wp_dropdown_pages, wp_loginout, wp_register, wp_logout_url, query_posts, rss_enclosure Go to Template Tag index Retrieved from "http://codex.wordpress.org/Template_Tags/wp_loginout" Category: Template Tags

Template Tags/wp logout url Contents


1 Description 2 Usage 3 Examples 3.1 Default Usage 3.2 Logout link in a comment popup template 3.3 Parameters 4 Related

Description
Introduced with Version 2.7, this Template Tag returns a nonce-protected URL that can be echoed as part of an <a> tag allowing a user to logout of a site. Because wp_logout_url is protected by a nonce, this tag should be used in place of code such as /wp-login.php?action=logout. The WordPress Default and Classic themes both use this tag in the comments.php and commentspopup.php> Templates.

Usage
<?php echo wp_logout_url($redirect); ?>

Examples
Default Usage
The following example returns a URL that can be used to compose a link that allows the user to logout and be returned to the login screen. <a href="<?php echo wp_logout_url(); ?>">Logout</a>

Logout link in a comment popup template


Presents a link that when clicked logs the user out and redirects the user to the post/page from where the link was activated. <a href="<?php echo wp_logout_url(get_permalink()); ?>" title="Log out of this account">Log out </a>

Parameters
redirect (string) Text to append to after the wp-login.php?action=logout. Default is ' '.

Related
bloginfo, bloginfo_rss, get_bloginfo, get_bloginfo_rss, wp_title, wp_get_archives, get_calendar, get_posts, wp_list_pages, wp_page_menu,

wp_dropdown_pages, wp_loginout, wp_register, wp_logout_url, query_posts, rss_enclosure

How to pass parameters to tags with PHP function-style parameters Go to Template Tag index Retrieved from "http://codex.wordpress.org/Template_Tags/wp_logout_url" Category: Template Tags

Template Tags/wp page menu Contents


1 Description 2 Usage 3 Examples 3.1 Default Usage 3.2 Display Home as a Page 3.3 Display only Home 4 Parameters 5 Related

Description
The Template Tag, wp_page_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. This Template Tag is available for WordPress versions 2.7 and newer.

Usage
<?php wp_page_menu('arguments'); ?>

Examples
Default Usage
$defaults = array( 'sort_column' => 'menu_class' => 'echo' => 'link_before' => 'link_after' => 'post_title', 'menu', true, '', '');

By default, the usage shows: Sorted by title The div class is 'menu' Results are echoed (displayed) No link_before or link_after text Do not add "Home" to the list of pages (this is not shown in defaults above) Note: Output is encompassed by the <ul> and </ul> tags wp_page_menu();

Display Home as a Page


The following example causes "Home" to be added to the beginning of the list of Pages displayed. In addition, the Pages wrapped in a div element, Page IDs 5, 9, and 23, are excluded from the list of Pages displayed, and the pages are listed in Page Order. The list is prefaced with the title, "Page Menu", <h2>Page Menu</h2> <?php wp_page_menu('show_home=1&exclude=5,9,23&menu_class=page-navi&sort_column=menu_order'); ?>

Display only Home


The following example displays just a link to "Home". Note that the include=99999' references a Page ID that does not exist so only a link for Home is displayed. <?php wp_page_menu('show_home=1&include=9999); ?>

Parameters
sort_column (string) Sorts the list of Pages in a alphabetic order by title of the pages. The default setting is sort alphabetically by page title. The sort_column parameter can be used to sort the list of Pages by the descriptor of any eld in the wp_post table of the WordPress database. Some useful examples are listed here. 'post_title' - Sort Pages alphabetically (by title) - default 'menu_order' - Sort Pages by Page Order. Note the difference between Page Order and Page ID. The Page ID is a unique number assigned by WordPress to every post or page. The Page Order can be set by the user in the administrative panel (e.g. Administration > Page > Edit). 'post_date' - Sort by creation time. 'post_modified' - Sort by time last modied. 'ID' - Sort by numeric Page ID. 'post_author' - Sort by the Page author's numeric ID. 'post_name' - Sort alphabetically by Post slug. menu_class (string) The div class the list is displayed in. Defaults to menu. echo (boolean) Toggles the display of the generated list of links or return the list as an HTML text string to be used in PHP. The default value is 0 (do NOT display the generated list items). Valid values: 0 (false) - default 1 (true) show_home (boolean) Add "Home" as the rst item in the list of "Pages". The URL assigned to "Home" is pulled from the Blog address (URL) in Administration > Settings > General. The default value is 0 (do NOT display "Home" in the generated list). Valid values: 0 (false) - default 1 (true) link_before (string) Sets the text or html that proceeds the link text inside <a> tag. link_after (string) Sets the text or html that follows the link text inside <a> tag.

Related
bloginfo, bloginfo_rss, get_bloginfo, get_bloginfo_rss, wp_title, wp_get_archives, get_calendar, get_posts, wp_list_pages, wp_page_menu, wp_dropdown_pages, wp_loginout, wp_register, wp_logout_url, query_posts, rss_enclosure

How to pass parameters to tags with query-string-style parameters Go to Template Tag index

This article is marked as in need of editing. You can help Codex by editing it. Retrieved from "http://codex.wordpress.org/Template_Tags/wp_page_menu" Categories: Template Tags | Copyedit

Template Tags/wp register Contents


1 Description 2 Usage 2.1 Parameters 3 Examples 3.1 Default Usage 3.2 Display Without Text Before or After 4 WordPress 5 Related

Description
This tag displays either the "Register" link to users that are not logged in or the "Site Admin" link if a user is logged in. The "Register" link is only offered if the Administration > Settings > General > Membership: Anyone can register box is checked. The Register link causes the

/wp-register.php script to execute and Site Admin links to /wp-admin/index.php. This tag became available beginning with WordPress 1.5. This tag does not function as intended on WordPress .

Usage
<?php wp_register('before', 'after'); ?>

Parameters
before (string) Text to display before the Register or Site Admin link. Default is '<li>'. after (string) Text to display after the Register or Site Admin link. Default is '</li>'.

Examples
Default Usage
wp_register displays the link in list format <li>. <?php wp_register(); ?>

Display Without Text Before or After


The following code example displays the "Register" or "Site Admin" link with no text in before or after parameters. <?php wp_register('', ''); ?>

WordPress
On WordPress , there is no /wp-register.php le, and /wp-login.php?action=register is not a valid registration form. Thus, wp_register does not show a registration link.

Related
bloginfo, bloginfo_rss, get_bloginfo, get_bloginfo_rss, wp_title, wp_get_archives, get_calendar, get_posts, wp_list_pages, wp_page_menu, wp_dropdown_pages, wp_loginout, wp_register, wp_logout_url, query_posts, rss_enclosure

How to pass parameters to tags with PHP function-style parameters Go to Template Tag index Retrieved from "http://codex.wordpress.org/Template_Tags/wp_register" Category: Template Tags

Template Tags/wp tag cloud Contents


1 Description 2 Usage 3 Examples 3.1 Default Usage 3.2 Cloud displayed under Popular Tags title 3.3 Cloud limited in size and ordered by count rather than name 3.4 Cloud returned as array but not displayed 4 Parameters 5 Creating a Tag Archive 6 Related

Description
Available with WordPress Version 2.3, this template tag wp_tag_cloud displays a list of tags in what is called a 'tag cloud', where the size of each tag is determined by how many times that particular tag has been assigned to posts. Beginning with Version 2.8, the taxonomy parameter was added so that any taxonony could be used as the basis of generating the cloud. That means, for example, that a cloud for posts categories can be presented to visitors.

Usage

<?php wp_tag_cloud(''); ?>

Examples
Default Usage
$defaults = array('smallest' => 8, 'largest' => 22, 'unit' => 'pt', 'number' => 45, 'format' => 'flat', 'orderby' => 'name', 'order' => 'ASC','exclude' => , 'include' => ); By default, the usage shows: smallest - The smallest tag (lowest count) is shown at size 8 largest - The largest tag (highest count) is shown at size 22 unit - Describes 'pt' (point) as the font-size unit for the smallest and largest values number - Displays at most 45 tags format - Displays the tags in at (separated by whitespace) style orderby - Order the tags by name order - Sort the tags in ASCENDING fashion exclude - Exclude no tags include - Include all tags

Cloud displayed under Popular Tags title


<?php if ( function_exists('wp_tag_cloud') ) : ?> <li> <h2>Popular Tags</h2> <ul> <?php wp_tag_cloud('smallest=8&largest=22'); ?> </ul> </li> <?php endif; ?>

Cloud limited in size and ordered by count rather than name


<?php wp_tag_cloud('smallest=8&largest=22&number=30&orderby=count'); ?>

Cloud returned as array but not displayed


The variable $tag will contain the tag cloud for use in other PHP code <?php $tag = wp_tag_cloud('format=array' );?>

Parameters
smallest (integer) The text size of the tag with the smallest count value (units given by unit parameter). largest (integer) The text size of the tag with the highest count value (units given by the unit parameter). unit (string) Unit of measure as pertains to the smallest and largest values. This can be any CSS length value, e.g. pt, px, em, %; default is pt (points). number (integer) The number of actual tags to display in the cloud. (Use '0' to display all tags.) format (string) Format of the cloud display. 'flat' (Default) tags are separated by whitespace 'list' tags are in UL with a class='wp-tag-cloud' 'array' tags are in an array and function returns the tag cloud as an array for use in PHP Note: the array returned, rather than displayed, was instituted with Version 2.5. orderby (string) Order of the tags. Valid values: 'name' (Default) 'count' order (string) Sort order. Valid values - Must be Uppercase: 'ASC' (Default) 'DESC' 'RAND' tags are in a random order. Note: this parameter was introduced with Version 2.5.

exclude (string) Comma separated list of tags (term_id) to exclude. For example, 'exclude=5,27' means tags that have the term_id 5 or 27 will NOT be displayed. Defaults to exclude nothing. include (string) Comma separated list of tags (term_id) to include. For example, 'include=5,27' means tags that have the term_id 5 or 27 will be the only tags displayed. Defaults to include everything. taxonomy (string) Taxonomy to use in generating the cloud. Note: this parameter was introduced with Version 2.8. 'post_tag' - (Default) Post tags are used as source of cloud 'category' - Post categories are used to generate cloud 'link_category' - Link categories are used to generate cloud

Creating a Tag Archive


While the new tagging feature in 2.3 is a great addition, the wp_tag_cloud tag can be used to display a Tag Archive. What this means is that when a visitor clicks on any particular tag a page displaying the tag cloud and all posts tagged the same will be displayed. According to the Template_Hierarchy if a tag.php template does not exist then the archives.php template will be used. By making this tag.php template you can customize the way your Tag Archive will look, this template includes the tag cloud at the top for very easy navigation.

To do this a new template will need to be added to your theme les. These are good resources for everything pertaining to templates, Template_Hierarchy. Basic steps needed are 1. Create le with the contents below named tag.php. 2. Upload le to your themes directory. 3. This is optional only if you would like to have a link in your page navigation to the Tag archive, otherwise when clicking on a tag this template will be used. Create a new blank page using this template, give this page the title Tag Archive. To elobarate more on step three. WordPress can be congured to use different Page Templates for different Pages. Toward the bottom of the Write->Write Page administration panel (or on the sidebar, depending on which version of WordPress you are using) is a drop-down labeled "Page Template". From there you can select which Template will be used when displaying this particular Page.

<?php /* Template Name: Tag Archive */ ?> <div> <?php get_header(); ?> <h2>Tag Archive</h2> <?php wp_tag_cloud(''); ?> <div class="navigation"> <div class="alignleft"><?php next_posts_link(' Older Entries') ?></div> <div class="alignright"><?php previous_posts_link('Newer Entries ') ?></div> </div> <?php if (have_posts()) : ?> <?php while (have_posts()) : the_post(); ?> <h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>">< <div class="entry"> <?php the_content('Read the rest of this entry '); ?> </div> <?php endwhile; ?> <?php endif; ?> </div> <?php get_footer(); ?> Please Note that styling has not been added to this template. A good way to determine the structure that your theme uses is to view the single.php theme le.

Related
the_tags, get_the_tags, get_the_tag_list, single_tag_title, get_tag_link, wp_tag_cloud, wp_generate_tag_cloud

How to pass parameters to tags with PHP function-style parameters Go to Template Tag index

This page is marked as incomplete. You can help Codex by expanding it. Retrieved from "http://codex.wordpress.org/Template_Tags/wp_tag_cloud" Categories: Template Tags | Stubs

Template Tags/wp title Contents


1 Description 2 Usage 3 Examples 3.1 Default Usage 3.2 Using Separator 3.3 Separator with Blog Name and Title Reversed 4 Parameters 5 Related

Description
Displays or returns the title of the page. A separator string can be dened, 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: Single post or a Page the title of the post (or Page) Date-based archive the date (e.g., "2006", "2006 - January") Category the name of the category Author page the public name of the user

Usage
<?php wp_title('sep', echo, 'seplocation'); ?>

Examples
Default Usage
Displays the blog name (using bloginfo()) and the post title using defaults when accessing a single post page. If the blog name is "My WordPress Blog", and the title of the post is "Hello world!", then the example below will show the title as My WordPress Blog Hello world! <title><?php bloginfo('name'); ?> <?php wp_title(); ?></title> This example would the same do the same thing: <title><?php bloginfo('name'); ?> <?php wp_title('',true,''); ?></title>

Using Separator
Displays blog name (using bloginfo()) along with post title in the document's title tag, using "--" as the separator. This results in (when on a single post page) My WordPress Blog--Hello world!. <title><?php bloginfo('name'); ?> <?php wp_title('--'); ?></title> This example would do the same thing: <title><?php bloginfo('name'); ?> <?php wp_title('--',true,''); ?></title>

Separator with Blog Name and Title Reversed


For Wordpress 2.5 and newer <title> <?php wp_title('--',true,'right'); ?>

<?php bloginfo('name'); ?> </title> For previous versions This lets you reverse page title and blog name in the title tag from example above (Hello world!--My WordPress Blog) by removing the separator (using wp_title(' '), then tests if there is a post title (using if(wp_title(' ', false))), and displays the separator between it and bloginfo() if it does. <title> <?php wp_title(' '); ?> <?php if(wp_title(' ', false)) { echo '--'; } ?> <?php bloginfo('name'); ?> </title>

Parameters
sep (string) Text to display before or after of the post title (i.e. the separator). By default (if sep is blank) then the &raquo; () symbol will be placed before or after (specied by the seplocation) the post title. echo (boolean) Echo the title (True) or return the title for use as a PHP string (False). Valid values: 1 (True) - default 0: (False) seplocation (string) Introduced with Version 2.5, this parameter denes the location of where the sep string prints in relation to the title of the post. For all values except 'right', the sep value is placed in front of (to the left of) the post title. If the value of seplocation is 'right' then the sep string will be appended after the post title.

Related
bloginfo, bloginfo_rss, get_bloginfo, get_bloginfo_rss, wp_title, wp_get_archives, get_calendar, get_posts, wp_list_pages, wp_page_menu, wp_dropdown_pages, wp_loginout, wp_register, wp_logout_url, query_posts, rss_enclosure

How to pass parameters to tags with PHP function-style parameters Go to Template Tag index Retrieved from "http://codex.wordpress.org/Template_Tags/wp_title" Category: Template Tags

Template Tags/get bookmarks Contents


1 Description 2 Usage 3 Examples 3.1 Default Usage 4 Parameters 5 Related

Description
This function will be found in WordPress v2.1, it is NOT supported by WordPress v2.0. get_bookmarks() returns an array of bookmarks found in the Administration > Blogroll > Manage Blogroll panel. This Template Tag allows the user to retrieve the bookmark information directly.

Usage
<?php get_bookmarks('arguments'); ?>

Examples
Default Usage
'orderby' => 'name', 'order' => 'ASC', 'limit' => -1, 'category' => '',

'category_name' => '', 'hide_invisible' => 1, 'show_updated' => 0, 'include' => '', 'exclude' => '' By default, the usage gets: All bookmarks ordered by name, ascending Bookmarks marked as hidden are not returned. The link_updated_f eld (the update time in the form of a timestamp) is not returned.

Parameters
orderby (string) Value to sort bookmarks on. Defaults to 'name' unless you pass the value of '' (empty), in which case it sets to 'id'. Valid options: 'id' 'url' 'name' 'target' 'description' 'owner' - User who added bookmark through bookmarks Manager. 'rating' 'updated' 'rel' - bookmark relationship (XFN). 'notes' 'rss' 'length' - The length of the bookmark name, shortest to longest. 'rand' - Display bookmarks in random order. order (string) Sort order, ascending or descending for the orderby parameter. Valid values: ASC (Default) DESC limit (integer) Maximum number of bookmarks to display. Defaults to -1 (all bookmarks). category (string) Comma separated list of bookmark category ID's. category_name (string) Category name of a catgeory of bookmarks to retrieve. Overrides category parameter. hide_invisible (boolean) TRUE causes only bookmarks with link_visible set to 'Y' to be retrieved. 1 (True - default) 0 (False) show_updated (boolean) TRUE causes an extra column called "link_category_f" to be inserted into the results, which contains the same value as "link_updated", but in a unix timestamp format. Handy for using PHP date functions on this data. 1 (True) 0 (False - default) include (string) Comma separated list of numeric bookmark IDs to include in the output. For example, 'include=1,3,6' means to return or echo bookmark IDs 1, 3, and 6. If the include string is used, the category, category_name, and exclude parameters are ignored. Defaults to (all Bookmarks). exclude (string) Comma separated list of numeric bookmark IDs to exclude. For example, 'exclude=4,12' means that bookmark IDs 4 and 12 will NOT be returned or echoed. Defaults to (exclude nothing).

Related
wp_list_bookmarks, get_bookmarks, get_bookmark

How to pass parameters to tags with PHP function-style parameters Go to Template Tag index

Retrieved from "http://codex.wordpress.org/Template_Tags/get_bookmarks" Categories: Template Tags | New page created

Template Tags/get posts Contents


1 Description 2 Usage 3 Examples 3.1 Posts list with offset 3.2 Access all post data 3.3 Latest posts ordered by title 3.4 Random posts 3.5 Show all attachments 3.6 Show attachments for the current post 4 Parameters: WordPress 2.6+ 5 Parameters: WordPress 2.5 And Older 6 Related

Description
This is a simple tag for creating multiple loops.

Usage
<?php get_posts('arguments'); ?>

Examples
Posts list with offset
If you have your blog congured to show just one post on the front page, but also want to list links to the previous ve posts in category ID 1, you can use this: <ul> <?php global $post; $myposts = get_posts('numberposts=5&offset=1&category=1'); foreach($myposts as $post) : ?> <li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li> <?php endforeach; ?> </ul> Note: With use of the offset, the above query should be used only on a category that has more than one post in it, otherwise there'll be no output.

Access all post data


Some post-related data is not available to get_posts by default, such as post content through the_content(), or the numeric ID. This is resolved by calling an internal function setup_postdata(), with the $post array as its argument: <?php $lastposts = get_posts('numberposts=3'); foreach($lastposts as $post) : setup_postdata($post); ?> <h2><a href="<?php the_permalink(); ?>" id="post-<?php the_ID(); ?>"><?php the_title(); ?></a></h2> <?php the_content(); ?> <?php endforeach; ?> To access a post's ID or content without calling setup_postdata(), or in fact any post-specic data (data retained in the posts table), you can use $post->COLUMN, where COLUMN is the table column name for the data. So $post->ID holds the ID, $post->post_content the content, and so on. To display or print this data on your page use the PHP echo command, like so: <?php echo $post->ID; ?>

Latest posts ordered by title


To show the last ten posts sorted alphabetically in ascending order, the following will display their post date, title and excerpt:

<?php $postslist = get_posts('numberposts=10&order=ASC&orderby=title'); foreach ($postslist as $post) : setup_postdata($post); ?> <div> <?php the_date(); ?> <br /> <?php the_title(); ?> <?php the_excerpt(); ?> </div> <?php endforeach; ?> Note: The orderby parameter was modied in Version 2.6. This code is using the new orderby format. See Parameters for details.

Random posts
Display a list of 5 posts selected randomly by using the MySQL RAND() function for the orderby parameter value: <ul><li><h2>A random selection of my writing</h2> <ul> <?php $rand_posts = get_posts('numberposts=5&orderby=rand'); foreach( $rand_posts as $post ) : ?> <li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li> <?php endforeach; ?> </ul> </li></ul>

Show all attachments


Do this outside any Loops in your template. (Since Version 2.5, it may be easier to use get_children() instead.) <?php $args = array( 'post_type' => 'attachment', 'numberposts' => -1, 'post_status' => null, 'post_parent' => null, // any parent ); $attachments = get_posts($args); if ($attachments) { foreach ($attachments as $post) { setup_postdata($post); the_title(); the_attachment_link($post->ID, false); the_excerpt(); } } ?>

Show attachments for the current post


Do this inside The_Loop (where $post->ID is available). <?php $args = array( 'post_type' => 'attachment', 'numberposts' => -1, 'post_status' => null, 'post_parent' => $post->ID ); $attachments = get_posts($args);

if ($attachments) { foreach ($attachments as $attachment) { echo apply_filters('the_title', $attachment->post_title); the_attachment_link($attachment->ID, false); } } ?>

Parameters: WordPress 2.6+


In addition to the parameters listed below under "WordPress 2.5 And Older", get_posts() can also take the parameters that query_posts() can since both functions now use the same database query code internally. Note: Version 2.6 changed a number of the orderby options. Table elds that begin with post_ no longer have that part of the name. For example, post_title is now title and post_date is now date.

Parameters: WordPress 2.5 And Older


$numberposts (integer) (optional) Number of posts to return. Set to 0 to use the max number of posts per page. Set to -1 to remove the limit. Default: 5 $offset (integer) (optional) Offset from latest post. Default: 0 $category (integer) (optional) Only show posts from this category ID. Making the category ID negative (-3 rather than 3) will show results not matching that category ID. Multiple category IDs can be specied by separating the category IDs with commas or by passing an array of IDs. Default: None $category_name (string) (optional) Only show posts from this category name or category slug. Default: None $tag (string) (optional) Only show posts with this tag slug. If you specify multiple tag slugs separated by commas, all results matching any tag will be returned. If you specify multiple tag slugs separated by spaces, the results will match all the specied tag slugs. Default: None $orderby (string) (optional) Sort posts by one of various values (separated by space), including: 'author' - Sort by the numeric author IDs. 'category' - Sort by the numeric category IDs. 'content' - Sort by content. 'date' - Sort by creation date. 'ID' - Sort by numeric post ID. 'menu_order' - Sort by the menu order. Only useful with pages. 'mime_type' - Sort by MIME type. Only useful with attachments. 'modified' - Sort by last modied date. 'name' - Sort by stub. 'parent' - Sort by parent ID. 'password' - Sort by password. 'rand' - Randomly sort results. 'status' - Sort by status. 'title' - Sort by title. 'type' - Sort by type. Notes: Sorting by ID and rand is only available starting with Version 2.5. Default: post_date $order (string) (optional) How to sort $orderby. Valid values: 'ASC' - Ascending (lowest to highest).

'DESC' - Descending (highest to lowest). Default: DESC $include (string) (optional) The IDs of the posts you want to show, separated by commas and/or spaces. The following value would work in showing these six posts: '45,63, 78 94 ,128 , 140' Note: Using this parameter will override the numberposts, offset, category, exclude, meta_key, meta_value, and post_parent parameters. Default: None $exclude (string) (optional) The IDs of any posts you want to exclude, separated by commas and/or spaces (see $include parameter). Default: None $meta_key and $meta_value (string) (optional) Only show posts that contain a meta (custom) eld with this key and value. Both parameters must be dened, or neither will work. Default: None $post_type (string) (optional) The type of post to show. Available options are: post - Default page attachment any - all post types Default: post $post_status (string) (optional) Show posts with a particular status. Available options are: publish - Default private draft future inherit - Default if $post_type is set to attachment (blank) - all statuses Default: publish $post_parent (integer) (optional) Show only the children of the post with this ID Default: None $nopaging (boolean) (optional) Enable or disable paging. If paging is disabled, the $numberposts option is ignored. Default: None

Related
bloginfo, bloginfo_rss, get_bloginfo, get_bloginfo_rss, wp_title, wp_get_archives, get_calendar, get_posts, wp_list_pages, wp_page_menu, wp_dropdown_pages, wp_loginout, wp_register, wp_logout_url, query_posts, rss_enclosure

How to pass parameters to tags Go to Template Tag index Retrieved from "http://codex.wordpress.org/Template_Tags/get_posts" Category: Template Tags

Template Tags/permalink single rss Contents


1 Description 2 Usage 3 Example 4 Parameters 5 Related

Description
Displays the permalink for the current post, formatted for syndication feeds such as RSS or Atom. This tag must be used within The Loop.

Usage
<?php permalink_single_rss('file'); ?>

Example
Displays the permalink in an RSS link tag. <link><?php permalink_single_rss(); ?></link>

Parameters
le (string) The page the link should point to. Defaults to the current page.

Related
For permalinks in regular page templates, it's recommended to use the_permalink() instead. permalink_anchor, get_permalink, the_permalink, permalink_single_rss

How to pass parameters to tags Go to Template Tag index Retrieved from "http://codex.wordpress.org/Template_Tags/permalink_single_rss" Categories: Template Tags | Feeds

Template Tags/query posts Contents


1 Description 2 Important note 3 Usage 4 Examples 4.1 Exclude Categories From Your Home Page 4.2 Retrieve a Particular Post 4.3 Retrieve a Particular Page 4.4 Passing variables to query_posts 4.4.1 Example 1 4.4.2 Example 2 4.4.3 Example 3 4.4.4 Example 4 5 Parameters 5.1 Category Parameters 5.2 Tag Parameters 5.3 Author Parameters 5.4 Post & Page Parameters 5.5 Sticky Post Parameters 5.6 Time Parameters 5.7 Page Parameters 5.8 Offset Parameter 5.9 Orderby Parameters 5.10 Custom Field Parameters 5.11 Combining Parameters 6 Resources 7 Related

Description
Query_posts can be used to control which posts show up in The Loop. It accepts a variety of parameters in the same format as used in your URL (e.g. p=4 to show only post of ID number 4). Why go through all the trouble of changing the query that was meticulously created from your given URL? You can customize the presentation of your blog entries by combining it with page logic (like the Conditional Tags) -- all without changing any of the URLs. Common uses might be to: Display only a single post on your homepage (a single Page can be done via Settings -> Reading).

Show all posts from a particular time period. Show the latest post (only) on the front page. Change how posts are ordered. Show posts from only one category. Exclude one or more categories.

Important note
The query_posts function is intended to be used to modify the main page Loop only. It is not intended as a means to create secondary Loops on the page. If you want to create separate Loops outside of the main one, you should create separate WP_Query objects and use those instead. Use of query_posts on Loops other than the main one can result in your main Loop becoming incorrect and possibly displaying things that you were not expecting. The query_posts function overrides and replaces the main query for the page. To save your sanity, do not use it for any other purpose.

Usage
Place a call to query_posts() in one of your Template les before The Loop begins. The wp_query object will generate a new SQL query using your parameters. When you do this, WordPress ignores the other parameters it receives via the URL (such as page number or category). If you want to preserve that information, you can use the variable $query_string in the call to query_posts(). For example, to set the display order of the posts without affecting the rest of the query string, you could place the following before The Loop: query_posts($query_string . "&order=ASC") When using query_posts in this way, the quoted portion of the argument must begin with an ampersand (&).

Examples
Exclude Categories From Your Home Page
Placing this code in your index.php le will cause your home page to display posts from all categories except category ID 3. <?php if (is_home()) { query_posts("cat=-3"); } ?> You can also add some more categories to the exclude-list(tested with WP 2.1.2): <?php if (is_home()) { query_posts("cat=-1,-2,-3"); } ?>

Retrieve a Particular Post


To retrieve a particular post, you could use the following: <?php // retrieve one post with an ID of 5 query_posts('p=5'); ?> If you want to use the Read More functionality with this query, you will need to set the global $more variable to 0. <?php // retrieve one post with an ID of 5 query_posts('p=5'); global $more; // set $more to 0 in order to only get the first part of the post $more = 0; // the Loop while (have_posts()) : the_post(); // the content of the post the_content('Read the full post '); endwhile;

?>

Retrieve a Particular Page


To retrieve a particular page, you could use the following: <?php query_posts('page_id=7'); ?> or <?php query_posts('pagename=about'); //retrieves the about page only ?> For child pages, the slug of the parent and the child is required, separated by a slash. For example: <?php query_posts('pagename=parent/child'); // retrieve the child page of a parent ?>

//retrieves page 7 only

Passing variables to query_posts


You can pass a variable to the query with two methods, depending on your needs. As with other examples, place these above your Loop: Example 1 In this example, we concatenate the query before running it. First assign the variable, then concatenate and then run it. Here we're pulling in a category variable from elsewhere. <?php $categoryvariable=$cat; // assign the variable as current category $query= 'cat=' . $categoryvariable. '&orderby=date&order=ASC'; // concatenate the query query_posts($query); // run the query ?> Example 2 In this next example, the double " quotes " tell PHP to treat the enclosed as an expression. For this example, we are getting the current month and the current year, and telling query posts to bring us the posts for the current month/year, and in this case, listing in ascending so we get oldest post at top of page.

<?php $current_month = date('m'); ?> <?php $current_year = date('Y'); ?> <?php query_posts("cat=22&year=$current_year&monthnum=$current_month&order=ASC"); ?> <!-- put your loop here --> Example 3 This example explains how to generate a complete list of posts, dealing with pagination. We can use the default $query_string telling query posts to bring us a full posts listing. We can also modify the posts_per_page query argument from -1 to the number of posts you want to show on each page; in this last case, you'll probably want to use posts_nav_link() to navigate the generated archive. . <?php query_posts($query_string.'&posts_per_page=-1'); while(have_posts()) { the_post(); <!-- put your loop here --> } ?> Example 4 If you don't need to use the $query_string variable, then another method exists that is more clear and readable, in some more complex cases. This method puts the parameters into an array, and then passes the array. The same query as in Example 2 above could be done like this: query_posts(array( 'cat' => 22, 'year'=> $current_year, 'monthnum'=>$current_month,

'order'=>'ASC', )); As you can see, with this approach, every variable can be put on its own line, for simpler reading.

Parameters
This is not an exhaustive list yet. It is meant to show some of the more common things possible with setting your own queries.

Category Parameters
Show posts only belonging to certain categories. cat category_name category__and category__in category__not_in Show One Category by ID Display posts from only one category ID (and any children of that category): query_posts('cat=4'); Show One Category by Name Display posts from only one category by name: query_posts('category_name=Staff Home'); Show Several Categories by ID Display posts from several specic category IDs: query_posts('cat=2,6,17,38'); Exclude Posts Belonging to Only One Category Show all posts except those from a category by prexing its ID with a '-' (minus) sign. query_posts('cat=-3'); This excludes any post that belongs to category 3. Multiple Category Handling Display posts that are in multiple categories. This shows posts that are in both categories 2 and 6: query_posts(array('category__and' => array(2,6))); To display posts from either category 2 OR 6, you could use cat as mentioned above, or by using category__in: query_posts(array('category__in' => array(2,6))); You can also exclude multiple categories this way: query_posts(array('category__not_in' => array(2,6)));

Tag Parameters
Show posts associated with certain tags. tag tag__and tag__in tag_slug__and tag_slug__in Fetch posts for one tag query_posts('tag=cooking'); Fetch posts that have either of these tags

query_posts('tag=bread,baking'); Fetch posts that have all three of these tags: query_posts('tag=bread+baking+recipe'); Multiple Tag Handling Display posts that are in multiple tags: query_posts(array('tag__and' => array('bread','baking')); This only shows posts that are in both tags 'bread' and 'baking'. To display posts from either tag, you could use tag as mentioned above, or explicitly specify by using tag__in: query_posts(array('tag__in' => array('bread','baking')); The tag_slug__in and tag_slug__and behave much the same, except match against the tag's slug instead of the tag itself. Also see Ryan's discussion of Tag intersections and unions.

Author Parameters
You can also restrict the posts by author. author_name=Harriet Note: author_name operates on the user_nicename eld, whilst author operates on the author id. author=3 Display all Pages for author=1, in title order, with no sticky posts tacked to the top: query_posts('caller_get_posts=1&author=1&post_type=page&post_status=publish&orderby=title&order=ASC');

Post & Page Parameters


Retrieve a single post or page. p=27 - use the post ID to show that post name=about-my-life - query for a particular post that has this Post Slug page_id=7 - query for just Page ID 7 pagename=about - note that this is not the page's title, but the page's path showposts=1 - use showposts=3 to show 3 posts. Use showposts=-1 to show all posts 'post__in' => array(5,12,2,14,7) - inclusion, lets you specify the post IDs to retrieve 'post__not_in' => array(6,2,8) - exclusion, lets you specify the post IDs NOT to retrieve 'post_type=page' - returns Pages; defaults to value of post; can be any, attachment, page, or post.

Sticky Post Parameters


Sticky posts rst became available with WordPress Version 2.7. Posts that are set as Sticky will be displayed before other posts in a query, unless excluded with the caller_get_posts=1 parameter. array('post__in'=>get_option('sticky_posts')) - returns array of all sticky posts caller_get_posts=1 - To exclude sticky posts be included at the beginning of posts returned, but the sticky post will still be returned in the natural order of that list of posts returned. To return just the rst sticky post: $sticky=get_option('sticky_posts') ; query_posts('p=' . $sticky[0]); To exclude all sticky posts from the query: query_posts(array("post__not_in" =>get_option("sticky_posts"))); Return ALL posts with the category, but don't show sticky posts at the top. The 'sticky posts' will still show in their natural position (e.g. by date): query_posts('caller_get_posts=1&showposts=3&cat=6'); Return posts with the category, but exclude sticky posts completely, and adhere to paging rules: <?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; $sticky=get_option('sticky_posts');

$args=array( 'cat'=>3, 'caller_get_posts'=>1, 'post__not_in' => $sticky, 'paged'=>$paged, ); query_posts($args); ?>

Time Parameters
Retrieve posts belonging to a certain time period. hour= - hour (from 0 to 23) minute= - minute (from 0 to 60) second= - second (0 to 60) day= - day of the month (from 1 to 31) monthnum= - month number (from 1 to 12) year= - 4 digit year (e.g. 2009) w= - week of the year (from 0 to 53) and uses the MySQL WEEK command Mode=1. Returns posts for just the current date: $today = getdate(); query_posts('year=' .$today["year"] .'&monthnum=' .$today["mon"] .'&day=' .$today["mday"] ); Returns posts dated December 20: query_posts(monthnum=12&day=20' );

Page Parameters
paged=2 - show the posts that would normally show up just on page 2 when using the "Older Entries" link. posts_per_page=10 - number of posts to show per page; a value of -1 will show all posts. order=ASC - show posts in chronological order, DESC to show in reverse order (the default)

Offset Parameter
You can displace or pass over one or more initial posts which would normally be collected by your query through the use of the offset parameter. The following will display the 5 posts which follow the most recent (1): query_posts('showposts=5&offset=1');

Orderby Parameters
Sort retrieved posts by this eld. orderby=author orderby=date orderby=category Note: this doesn't work and likely will be discontinued with version 2.8 orderby=title orderby=modified orderby=menu_order orderby=parent orderby=ID orderby=rand orderby=meta_value - note that a meta_key=some value clause should be present in the query parameter also Also consider order parameter of "ASC" or "DESC"

Custom Field Parameters


Retrieve posts (or Pages) based on a custom eld key or value. meta_key= meta_value= meta_compare= - operator to test the meta_value=, default is '=', with other possible values of '!=', '>', '>=', '<', or '<=' Returns posts with custom elds matching both a key of 'color' AND a value of 'blue':

query_posts('meta_key=color&meta_value=blue'); Returns posts with a custom eld key of 'color', regardless of the custom eld value: query_posts('meta_key=color'); Returns posts where the custom eld value is 'color', regardless of the custom eld key: query_posts('meta_value=color'); Returns any Page where the custom eld value is 'green', regardless of the custom eld key: query_posts('post_type=page&meta_value=green'); Returns both posts and Pages with a custom eld key of 'color' where the custom eld value IS NOT EQUAL TO 'blue': query_posts('post_type=any&meta_key=color&meta_compare=!=&meta_value=blue'); Returns posts with custom eld key of 'miles' with a custom eld value that is LESS THAN OR EQUAL TO 22. Note the value 99 will be considered greater than 100 as the data is store as strings, not numbers. query_posts('meta_key=miles&meta_compare=<=&meta_value=22');

Combining Parameters
You may have noticed from some of the examples above that you combine parameters with an ampersand (&), like so: query_posts('cat=3&year=2004'); Posts for category 13, for the current month on the main page: if (is_home()) { query_posts($query_string . '&cat=13&monthnum=' . date('n',current_time('timestamp'))); } At 2.3 this combination will return posts belong to both Category 1 AND 3, showing just two (2) posts, in descending order by the title: query_posts(array('category__and'=>array(1,3),'showposts'=>2,'orderby'=>title,'order'=>DESC)); In 2.3 and 2.5 one would expect the following to return all posts that belong to category 1 and is tagged "apples" query_posts('cat=1&tag=apples'); A bug prevents this from happening. See Ticket #5433. A workaround is to search for several tags using + query_posts('cat=1&tag=apples+apples'); This will yield the expected results of the previous query. Note that using 'cat=1&tag=apples+oranges' yields expected results.

Resources
If..Else - Query Post Redux If..Else - Make WordPress Show Only one Post on the Front Page If..Else - Query Posts Perishable Press - 6 Ways to Customize WordPress Post Order nietoperzka's Custom order of posts on the main page http://www.darrenhoyt.com/2008/06/11/displaying-related-category-and-author-content-in-wordpress/ Displaying related category and author content] Exclude posts from displaying

Related
bloginfo, bloginfo_rss, get_bloginfo, get_bloginfo_rss, wp_title, wp_get_archives, get_calendar, get_posts, wp_list_pages, wp_page_menu, wp_dropdown_pages, wp_loginout, wp_register, wp_logout_url, query_posts, rss_enclosure

How to pass parameters to tags Go to Template Tag index

This page is marked as incomplete. You can help Codex by expanding it. Retrieved from "http://codex.wordpress.org/Template_Tags/query_posts" Categories: Template Tags | Stubs

Template Tags/wp list pages Contents


1 Description 2 Usage 3 Examples 3.1 Default Usage 3.2 Hiding or Changing the List Heading 3.3 List Pages by Page Order 3.4 Sort Pages by Post Date 3.5 Exclude Pages from List 3.6 Include Pages in List 3.7 List Sub-Pages 3.8 List subpages even if on a subpage 3.9 Markup and styling of page items 4 Parameters 5 Related

Description
The Template Tag, wp_list_pages(), displays a list of WordPress Pages as links. It is often used to customize the Sidebar or Header, but may be used in other Templates as well. This Template Tag is available for WordPress versions 1.5 and newer.

Usage
<?php wp_list_pages('arguments'); ?>

Examples
Default Usage
$defaults = array( 'depth' => 'show_date' => 'date_format' => 'child_of' => 'exclude' => 'title_li' => 'echo' => 'authors' => 'sort_column' => 'link_before' => 'link_after' => 'exclude_tree'=> 0, '', get_option('date_format'), 0, '', __('Pages'), 1, '', 'menu_order, post_title', '', '', '' );

By default, the usage shows: All Pages and sub-pages are displayed (no depth restriction) Date created is not displayed Is not restricted to the child_of any Page No pages are excluded The title of the pages listed is "Pages" Results are echoed (displayed) Is not restricted to any specic author Sorted by Page Order then Page Title. Sorted in ascending order (not shown in defaults above) Pages displayed in a hierarchical indented fashion (not shown in defaults above) Includes all Pages (not shown in defaults above) Not restricted to Pages with specic meta key/meta value (not shown in defaults above) No Parent/Child trees excluded wp_list_pages();

Hiding or Changing the List Heading


The default heading of the list ("Pages") of Pages generated by wp_list_pages can be hidden by passing a null or empty value to the title_li parameter. The following example displays no heading text above the list. <ul> <?php wp_list_pages('title_li='); ?> </ul> In the following example, only Pages with IDs 9, 5, and 23 are included in the list and the heading text has been changed to the word "Poetry", with a heading style of <h2>: <ul> <?php wp_list_pages('include=5,9,23&title_li=<h2>' . __('Poetry') . '</h2>' ); ?> </ul>

List Pages by Page Order


The following example lists the Pages in the order dened by the Page Order settings for each Page in the Write > Page administrative panel. <ul> <?php wp_list_pages('sort_column=menu_order'); ?> </ul> If you wanted to sort the list by Page Order and display the word "Prose" as the list heading (in h2 style) on a Sidebar, you could add the following code to the sidebar.php le: <ul> <?php wp_list_pages('sort_column=menu_order&title_li=<h2>' . __('Prose') . '</h2>' ); ?> </ul> Using the following piece of code, the Pages will display without heading and in Page Order: <ul> <?php wp_list_pages('sort_column=menu_order&title_li='); ?> </ul>

Sort Pages by Post Date


This example displays Pages sorted by (creation) date, and shows the date next to each Page list item. <ul> <?php wp_list_pages('sort_column=post_date&show_date=created'); ?> </ul>

Exclude Pages from List


Use the exclude parameter to hide certain Pages from the list to be generated by wp_list_pages. <ul> <?php wp_list_pages('exclude=17,38' ); ?> </ul>

Include Pages in List


To include only certain Pages in the list, for instance, Pages with ID numbers 35, 7, 26 and 13, use the include parameter. <ul> <?php wp_list_pages('include=7,13,26,35&title_li=<h2>' . __('Pages') . '</h2>' ); ?> </ul>

List Sub-Pages
Versions prior to Wordpress 2.0.1 : Put this inside the the_post() section of the page.php template of your WordPress theme after the_content(), or put it in a copy of the page.php template that you use for pages that have sub-pages: <ul> <?php global $id; wp_list_pages("title_li=&child_of=$id&show_date=modified

&date_format=$date_format"); ?> </ul> This example does not work with Wordpress 2.0.1 or newer if placed in a page template because the global $id is not set. Use the following code instead. Wordpress 2.0.1 or newer : NOTE: Requires an HTML tag (either <ul> or <ol>) even if there are no subpages. Keep this in mind if you are using css to style the list. <ul> <?php wp_list_pages('title_li=&child_of='.$post->ID.'&show_date=modified &date_format=$date_format'); ?> </ul> The following example will generate a list only if there are child (Pages that designate the current page as a Parent) for the current Page: <?php $children = wp_list_pages('title_li=&child_of='.$post->ID.'&echo=0'); if ($children) { ?> <ul> <?php echo $children; ?> </ul> <?php } ?>

List subpages even if on a subpage


The above examples will only show the children from the parent page, but not when actually on a child page. This code will show the child pages, and only the child pages, when on a parent or on one of the children. This code will not work if placed after a widget block in the sidebar.

<?php if($post->post_parent) $children = wp_list_pages("title_li=&child_of=".$post->post_parent."&echo=0"); else $children = wp_list_pages("title_li=&child_of=".$post->ID."&echo=0"); if ($children) { ?> <ul> <?php echo $children; ?> </ul> <?php } ?>

Markup and styling of page items


By default, wp_list_pages() generates a nested, unordered list of WordPress Pages created with the Write > Page admin panel. You can remove the outermost item (li.pagenav) and list (ul) by setting the title_li parameter to an empty string. All list items (li) generated by wp_list_pages() are marked with the class page_item. When wp_list_pages() is called while displaying a Page, the list item for that Page is given the additional class current_page_item. <li class="pagenav"> Pages <ul> <li class="page_item current_page_parent"> [parent of the current page] <ul> <li class="page_item current_page_item"> [the current page] </li> </ul> </li> <li class="page_item"> [another page] </li> </ul> </li>

They can be styled with CSS selectors: .pagenav { ... } .page_item { ... } .current_page_item { ... } .current_page_parent { ... }

Parameters
sort_column (string) Sorts the list of Pages in a number of different ways. The default setting is sort alphabetically by Page title. 'post_title' - Sort Pages alphabetically (by title) - default 'menu_order' - Sort Pages by Page Order. N.B. Note the difference between Page Order and Page ID. The Page ID is a unique number assigned by WordPress to every post or page. The Page Order can be set by the user in the Write>Pages administrative panel. See the example below. 'post_date' - Sort by creation time. 'post_modied' - Sort by time last modied. 'ID' - Sort by numeric Page ID. 'post_author' - Sort by the Page author's numeric ID. 'post_name' - Sort alphabetically by Post slug. Note: The sort_column parameter can be used to sort the list of Pages by the descriptor of any eld in the wp_post table of the WordPress database. Some useful examples are listed here. sort_order (string) Change the sort order of the list of Pages (either ascending or descending). The default is ascending. Valid values: 'asc' - Sort from lowest to highest (Default). 'desc' - Sort from highest to lowest. exclude (string) Dene a comma-separated list of Page IDs to be excluded from the list (example: 'exclude=3,7,31'). There is no default value. See the Exclude Pages from List example below. exclude_tree (string) Dene a comma-separated list of parent Page IDs to be excluded. Use this parameter to exclude a parent and all of that parent's child Pages. So 'exclude_tree=5' would exclude the parent Page 5, and its child (all descendant) Pages. This parameter was available at Version 2.7. include (string) Only include certain Pages in the list generated by wp_list_pages. Like exclude, this parameter takes a comma-separated list of Page IDs. There is no default value. See the Include Pages in List example below. depth (integer) This parameter controls how many levels in the hierarchy of pages are to be included in the list generated by wp_list_pages. The default value is 0 (display all pages, including all sub-pages). 0 - Pages and sub-pages displayed in hierarchical (indented) form (Default). -1 - Pages in sub-pages displayed in at (no indent) form. 1 - Show only top level Pages 2 - Value of 2 (or greater) species the depth (or level) to descend in displaying Pages. child_of (integer) Displays the sub-pages of a single Page only; uses the ID for a Page as the value. Note that the child_of parameter will also fetch "grandchildren" of the given ID, not just direct descendants. Defaults to 0 (displays all Pages). show_date (string) Display creation or last modied date next to each Page. The default value is the null value (do not display dates). Valid values: '' - Display no date (Default). 'modied' - Display the date last modied. 'xxx' - Any value other than modied displays the date (post_date) the Page was rst created. See the example below. date_format (string) Controls the format of the Page date set by the show_date parameter (example: "l, F j, Y"). This parameter defaults to the date format congured in your WordPress options. See Formatting Date and Time and the date format page on the php web site. title_li (string) Set the text and style of the Page list's heading. Defaults to '__('Pages')', which displays "Pages" (the __('') is used for localization purposes). If passed a null or empty value (''), no heading is displayed, and the list will not be wrapped with <ul>, </ul> tags. See the

example for Headings. echo (boolean) Toggles the display of the generated list of links or return the list as an HTML text string to be used in PHP. The default value is 1 (display the generated list items). Valid values: 1 (true) - default 0 (false) hierarchical (boolean) Display sub-Pages in an indented manner below their parent or list the Pages inline. The default is true (display sub-Pages indented below the parent list item). Valid values: 1 (true) - default 0 (false) meta_key (string) Only include the Pages that have this Custom Field Key (use in conjunction with the meta_value eld). meta_value (string) Only include the Pages that have this Custom Field Value (use in conjuntion with the meta_key eld). link_before (string) Sets the text or html that proceeds the link text inside <a> tag. (Version 2.7.0 or newer.) link_after (string) Sets the text or html that follows the link text inside <a> tag. (Version 2.7.0 or newer.)

Related
bloginfo, bloginfo_rss, get_bloginfo, get_bloginfo_rss, wp_title, wp_get_archives, get_calendar, get_posts, wp_list_pages, wp_page_menu, wp_dropdown_pages, wp_loginout, wp_register, wp_logout_url, query_posts, rss_enclosure

How to pass parameters to tags with query-string-style parameters Go to Template Tag index

This article is marked as in need of editing. You can help Codex by editing it. Retrieved from "http://codex.wordpress.org/Template_Tags/wp_list_pages" Categories: Template Tags | Copyedit

Function Reference/WP Cache Contents


1 Role of WP_Cache 2 wp_cache functions 3 Examples 4 Additional Resources

Role of WP_Cache
WP_Object_Cache is WordPress' class for caching data which may be computationally intensive to regenerate dynamically on every page load. It's dened in wp-includes/cache.php. Do not use the class directly in your code when writing plugins, but use the wp_cache functions listed here. Caching to le to store the information across page loads is not enabled by default - this can be enabled by adding dene('WP_CACHE', true); to your wp-cong.php le. Tip: Make sure dene('WP_CACHE', true); is above this block: /* That's all, stop editing! Happy blogging. */ if ( !defined('ABSPATH') ) define('ABSPATH', dirname(__FILE__) . '/'); require_once(ABSPATH . 'wp-settings.php'); Within a single page loading caching does still occur so as to reduce the number of database queries as much as possible

wp_cache functions

Almost all of these functions take a: key: the key to indicate the value $data: the value you want to store ag: optional: this is a way of grouping your cache data. If you use a ag, your data will be stored in a subdirectory of your cache directory expire: number of seconds (by default 900) wp_cache_add($key, $data, $flag = '', $expire = 0) This function rst checks if there is a cached object on the given $key. If not, then it is saved, otherwise returns false. wp_cache_delete($id, $flag = '') Clears a given le. wp_cache_get($id, $flag = '') Gives back the value of the cached object if it did not expired. Otherwise gives back false. wp_cache_replace($key, $data, $flag = '', $expire = 0) Replaces the given cache if it exists, returns false otherwise. wp_cache_set($key, $data, $flag = '', $expire = 0) Sets the value of the cache object. If the object already exists, then it will be overwritten, if the object does not exists it will be created. wp_cache_init() Initializes a new cache object. This function is called by Wordpress at initialization if cacheing is enabled. wp_cache_flush() Clears all the cache les. wp_cache_close() Saves the cached object. This function is called by Wordpress at the shutdown action hook.

Examples
You can use WP_Object_Cache and Snoopy to cache offsite includes: $news = wp_cache_get('news'); if($news == false) { $snoopy = new Snoopy; $snoopy->fetch('http://example.com/news/'); $news = $snoopy->results; wp_cache_set('news', $news); } echo $news;

Additional Resources
Dougal Campbell wrote a short guide on how to use the Wordpress Cache object from within your own plugins : Using the Wordpress Object Cache Jeff Starr discusses different caching options and explains how to enable the default WordPress Object Cache : How to Enable the Default WordPress Object Cache Peter Westwood has a plugin to help people analyse the behaviour of the cache, provides the administrator with a quick overview of how the cache is performming and what queries are cached : WP Cache Inspect This page is marked as incomplete. You can help Codex by expanding it. Retrieved from "http://codex.wordpress.org/Function_Reference/WP_Cache" Categories: Stubs | Functions

Function Reference/WP Query

Contents
1 Role of WP_Query 2 Methods and Properties 2.1 Properties 2.2 Methods 3 Interacting with WP_Query

Role of WP_Query
WP_Query is a class dened in wp-includes/query.php that deals with the intricacies of a request to a WordPress blog. The wp-blogheader.php (or the WP class in Version 2.0) gives the $wp_query object information dening the current request, and then $wp_query determines what type of query it's dealing with (category archive? dated archive? feed? search?), and fetches the requested posts. It retains a lot of information on the request, which can be pulled at a later date.

Methods and Properties


This is the formal documentation of WP_Query. You shouldn't alter the properties directly, but instead use the methods to interact with them. Also see Interacting with WP_Query for some useful functions that avoid the need to mess around with class internals and global variables.

Properties
$query Holds the query string that was passed to the $wp_query object by wp-blog-header.php (or the WP class in Version 2.0). For information on the construction of this query string (in WP1.5 with wp-blog-header.php - the following link is fairly outdated now), see WordPress Code Flow. $query_vars An associative array containing the dissected $query: an array of the query variables and their respective values. $queried_object Applicable if the request is a category, author, permalink or Page. Holds information on the requested category, author, post or Page. $queried_object_id Simply holds the ID of the above property. $posts Gets lled with the requested posts from the database. $post_count The number of posts being displayed. $current_post (available during The Loop) Index of the post currently being displayed. $post (available during The Loop) The post currently being displayed. $is_single, $is_page, $is_archive, $is_preview, $is_date, $is_year, $is_month, $is_time, $is_author, $is_category, $is_tag, $is_tax, $is_search, $is_feed, $is_comment_feed, $is_trackback, $is_home, $is_404, $is_comments_popup, $is_admin, $is_attachment, $is_singular, $is_robots, $is_posts_page, $is_paged Booleans dictating what type of request this is. For example, the rst three represent 'is it a permalink?', 'is it a Page?', 'is it any type of archive page?', respectively.

Methods
(An ampersand (&) before a method name indicates it returns by reference.) init() Initialise the object, set all properties to null, zero or false. parse_query($query) Takes a query string dening the request, parses it and populates all properties apart from $posts, $post_count, $post and $current_post. parse_query_vars() Reparse the old query string. get($query_var) Get a named query variable. set($query_var, $value) Set a named query variable to a specic value. &get_posts() Fetch and return the requested posts from the database. Also populate $posts and $post_count. next_post() (to be used when in The Loop) Advance onto the next post in $posts. Increment $current_post and set $post. the_post() (to be used when in The Loop) Advance onto the next post, and set the global $post variable. have_posts() (to be used when in The Loop, or just before The Loop) Determine if we have posts remaining to be displayed.

rewind_posts() Reset $current_post and $post. &query($query) Call parse_query() and get_posts(). Return the results of get_posts(). get_queried_object() Set $queried_object if it's not already set and return it. get_queried_object_id() Set $queried_object_id if it's not already set and return it. WP_Query($query = '') (constructor) If you provide a query string, call query() with it.

Interacting with WP_Query


Most of the time you can nd the information you want without actually dealing with the class internals and globals variables. There are a whole bunch of functions that you can call from anywhere that will enable you to get the information you need. There are two main scenarios you might want to use WP_Query in. The rst is to nd out what type of request WordPress is currently dealing with. The $is_* properties are designed to hold this information: use the Conditional Tags to interact here. This is the more common scenario to plugin writers (the second normally applies to theme writers). The second is during The Loop. WP_Query provides numerous functions for common tasks within The Loop. To begin with, have_posts(), which calls $wp_query->have_posts(), is called to see if there are any posts to show. If there are, a while loop is begun, using have_posts() as the condition. This will iterate around as long as there are posts to show. In each iteration, the_post(), which calls $wp_query->the_post() is called, setting up internal variables within $wp_query and the global $post variable (which the Template Tags rely on), as above. These are the functions you should use when writing a theme le that needs a loop. See also The Loop and The Loop in Action for more information. Retrieved from "http://codex.wordpress.org/Function_Reference/WP_Query" Category: Functions

Function Reference/WP Rewrite


This document assumes familiarity with Apache's mod_rewrite. If you've never heard of this before, try reading Sitepoint's Beginner's Guide to URL Rewriting. Also see Otto's explanation of hierarchy of rewrite rules in the wp-hackers email list.

Contents
1 Role of WP_Rewrite 2 Methods and Properties 2.1 Properties 2.2 Methods 3 Plugin Hooks 3.1 Examples 4 Non-Wordpress rewrite rules

Role of WP_Rewrite
WP_Rewrite is WordPress' class for managing the rewrite rules that allow you to use Pretty Permalinks feature. It has several methods that generate the rewrite rules from values in the database. It is used internally when updating the rewrite rules, and also to nd the URL of a specic post, Page, category archive, etc.. It's dened in wp-includes/rewrite.php as a single instance global variable, $wp_rewrite, is initialised in wp-settings.php.

Methods and Properties


This is the formal documentation of WP_Rewrite. Try not to access or set the properties directly, instead use the methods to interact with the $wp_rewrite object.

Properties
$permalink_structure The permalink structure as in the database. This is what you set on the Permalink Options page, and includes 'tags' like %year%, %month% and %post_id%. $category_base Anything to be inserted before category archive URLs. Defaults to 'category/'. $category_structure Structure for category archive URLs. This is just the $category_base plus '%category%'. $author_base Anything to be inserted before author archive URLs. Defaults to 'author/'. $author_structure Structure for author archive URLs. This is just the $author_base plus '%author%'. $feed_base

Anything to be inserted before feed URLs. Defaults to 'feed/'. $feed_structure Structure for feed URLs. This is just the $feed_base plus '%feed%'. $search_base Anything to be inserted before searchs. Defaults to 'search/'. $search_structure Structure for search URLs. This is just the $search_base plus '%search%'. $comments_base Anything to be inserted just before the $feed_structure to get the latest comments feed. Defaults to 'comments'. $comments_feed_structure The structure for the latest comments feed. This is just $comments_base plus $feed_base plus '%feed%'. $date_structure Structure for dated archive URLs. Tries to be '%year%/%monthnum%/%day%', '%day%/%monthnum%/%year%' or '%monthnum%/%day%/%year%', but if none of these are detected in your $permalink_structure, defaults to '%year%/%monthnum% /%day%'. Various functions use this structure to obtain less specic structures: for example, get_year_permastruct() simply removes the '%monthnum%' and '%day%' tags from $date_structure. $page_structure Structure for Pages. Just '%pagename%'. $front Anything up to the start of the rst tag in your $permalink_structure. $root The root of your WordPress install. Prepended to all structures. $matches Used internally when calculating back references for the redirect part of the rewrite rules. $rules The rewrite rules. Set when rewrite_rules() is called. $non_wp_rules Associative array of "rules that don't redirect to WP's index.php (and thus shouldn't be handled by WP at all)" roughly in the form 'Pattern' => 'Substitution' (see below). $rewritecode An array of all the tags available for the permalink structure. See Using Permalinks for a list. $rewritereplace What each tag will be replaced with for the regex part of the rewrite rule. The rst element in $rewritereplace is the regex for the rst element in $rewritecode, the second corresponds to the second, and so on. $queryreplace What each tag will be replaced with in the rewrite part of the rewrite rule. The same correspondance applies here as with $rewritereplace.

Methods
add_rewrite_tag($tag, $pattern, $query) add an element to the $rewritecode, $rewritereplace and $queryreplace arrays using each parameter respectively. If $tag already exists in $rewritecode, the existing value will be overwritten. ush_rules() Regenerate the rewrite rules and save them to the database generate_rewrite_rule($permalink_structure, $walk_dirs = false) Generates a no-frills rewrite rule from the permalink structure. No rules for extra pages or feeds will be created. generate_rewrite_rules($permalink_structure, $ep_mask = EP_NONE, $page = true, $feed = true, $forcomments = false, $walk_dirs = true) A large function that generates the rewrite rules for a given structure, $permalink_structure. If $page is true, an extra rewrite rule will be generated for accessing different pages (e.g. /category/tech/page/2 points to the second page of the 'tech' category archive). If $feed is true, extra rewrite rules will be generated for obtaining a feed of the current page, and if $forcomments is true, this will be a comment feed. If $walk_dirs is true, then a rewrite rule will be generated for each directory of the structure provided, e.g. if you provide it with '/%year%/%month%/%day/', rewrite rules will be generated for '/%year%/', /%year%/%month%/' and '/%year%/%month%/%day%/'. This returns an associative array using the regex part of the rewrite rule as the keys and redirect part of the rewrite rule as the value. get_date_permastruct(), get_category_permastruct(), get_date_permastruct() etc. Populates the corresponding property (e.g., $date_structure for get_date_permastruct()) if it's not already set and returns it. The functions get_month_permastruct() and get_year_permastruct() don't have a corresponding property: they work out the structure by taking the $date_structure and removing tags that are more specic than they need (i.e., get_month_permastruct() removes the '%day%' tag, as it only needs to specify the year and month). init() Set up the object, set $permalink_structure and $category_base from the database. Set $root to $index plus '/'. Set $front to everything up to the start of the rst tag in the permalink structure. Unset all other properties. mod_rewrite_rules() returns a string (not an array) of all the rules. They are wrapped in an Apache <IfModule> block, to ensure mod_rewrite is enabled. page_rewrite_rules() Returns the set of rules for any Pages you have created. rewrite_rules() populate and return the $rules variable with an associative array as in generate_rewrite_rules(). This is generated from the post, date,

comment, search, category, authors and page structures. set_category_base($category_base) Change the category base. set_permalink_structure($permalink_structure) Change the permalink structure. using_index_permalinks() Returns true if your blog is using PATHINFO permalinks. using_mod_rewrite_permalinks Returns true your blog is using "pretty" permalinks via mod_rewrite. using_permalinks() Returns true if your blog is using any permalink structure (i.e. not the default query URIs ?p=n, ?cat=n). WP_Rewrite (constructor) Call init(). wp_rewrite_rules() returns the array of rewrite rules as in rewrite_rules(), but using $matches[xxx] in the (where xxx is a number) instead of the normal mod_rewrite backreferences, $xxx (where xxx is a number). This is useful when you're going to be using the rules inside PHP, rather than writing them out to a .htaccess le.

Plugin Hooks
As the rewrite rules are a crucial part of your weblog functionality, WordPress allows plugins to hook into the generation process at several points. rewrite_rules(), specically, contains nine lters and one hook for really precise control over the rewrite rules process. Here's what you can lter in rewrite_rules(): To lter the rewrite rules generated for permalink URLs, use post_rewrite_rules. To lter the rewrite rules generated for dated archive URLs, use date_rewrite_rules. To lter the rewrite rules generated for category archive URLs, use category_rewrite_rules. To lter the rewrite rules generated for search URLs, use search_rewrite_rules. To lter the rewrite rules generated for the latest comment feed URLs, use comments_rewrite_rules. To lter the rewrite rules generated for author archive URLs, use author_rewrite_rules. To lter the rewrite rules generated for your Pages, use page_rewrite_rules. To lter the rewrite rules generated for the root of your weblog, use root_rewrite_rules. To lter the whole lot, use rewrite_rules_array. The action hook generate_rewrite_rules runs after all the rules have been created. If your function takes a parameter, it will be passed a reference to the entire $wp_rewrite object. mod_rewrite_rules() is the function that takes the array generated by rewrite_rules() and actually turns it into a set of rewrite rules for the .htaccess le. This function also has a lter, mod_rewrite_rules, which will pass functions the string of all the rules to be written out to .htaccess, including the <IfModule> surrounding section. (Note: you may also see plugins using the rewrite_rules hook, but this is deprecated).

Examples
(See also: Permalinks for Custom Archives) The most obvious thing a plugin would do with the $wp_rewrite object is add its own rewrite rules. This is remarkably simple. Filter the generic rewrite_rules_array. The Jerome's Keywords plugin does this to enable URLs like http://example.com/tag/sausages. function keywords_createRewriteRules($rewrite) { global $wp_rewrite; // add rewrite tokens $keytag_token = '%tag%'; $wp_rewrite->add_rewrite_tag($keytag_token, '(.+)', 'tag='); $keywords_structure = $wp_rewrite->root . "tag/$keytag_token"; $keywords_rewrite = $wp_rewrite->generate_rewrite_rules($keywords_structure); return ( $rewrite + $keywords_rewrite ); } Instead of inserting the rewrite rules into the $rewrite array itself, Jerome chose to create a second array, $keywords_rewrite, using the WP_Rewrite function generate_rewrite_rules(). Using that function means that the plugin doesn't have to create rewrite rules for extra pages (like page/2), or feeds (like feed/atom), etc. This array is then appended onto the $rewrite array and returned. A simpler example of this is Ryan Boren's Feed Director plugin. This simply redirects URLs like http://example.com/feed.xml to http://example.com/feed/rss2: function feed_dir_rewrite($wp_rewrite) { $feed_rules = array( 'index.rdf' => 'index.php?feed=rdf',

'index.xml' => 'index.php?feed=rss2', '(.+).xml' => 'index.php?feed=' . $wp_rewrite->preg_index(1) ); $wp_rewrite->rules = $feed_rules + $wp_rewrite->rules; } // Hook in. add_filter('generate_rewrite_rules', 'feed_dir_rewrite'); As the array is so simple here, there is no need to call generate_rewrite_rules(). Again, the plugin's rules are added to WordPress'. Notice that as this function lters generate_rewrite_rules, it accepts a reference to the entire $wp_rewrite object as a parameter, not just the rewrite rules. Of course, as you're adding your rewrite rules to the array before WordPress does anything with them, your plugins rewrite rules will be included in anything WordPress does with the rewrite rules, like write them to the .htaccess le.

Non-Wordpress rewrite rules


<?php $wp_rewrite->non_wp_rules = array( 'Pattern' => 'Substitution' ); print_r($wp_rewrite->mod_rewrite_rules()); ?> prints <IfModule mod_rewrite.c> RewriteEngine On RewriteBase /wp_home/ RewriteRule ^Pattern /wp_home/Substitution [QSA,L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /wp_home/index.php [L] </IfModule> where /wp_home/ is Wordpress's home directory (or the root URL / if Wordpress is installed in your web root.) Retrieved from "http://codex.wordpress.org/Function_Reference/WP_Rewrite" Category: Functions

Function Reference/Walker Class Contents


1 Role of Walker 2 Methods and Properties 2.1 Properties 2.1.1 Example 2.2 Methods 3 Examples

Role of Walker
The walker class encapsulates the basic functionality necessary to output HTML representing WordPress objects with a tree structure. For instance pages and categories are the two types of objects that the WordPress 2.2 code uses the walker class to enumerate. While one could always display categories as you wished by using right func and looping through them using it takes a great deal of work to arrange subcategories below their parents with proper formatting. The walker class takes care of most of this work for you.

Methods and Properties


Note that the properties of the Walker class are intended to be set by the extending class and probably should not vary over the lifetime of an instance. Also the method denitions of start_el, end_el, start_lvl, end_lvl only list one argument but are called using call_user_func_array and it is these arguments that are listed.

Properties
$tree_type The classes extending Walker in the WordPress 2.2 distribution set this either to 'category' or 'page'. The code makes no use of this value.

$db_elds An array with keys: parent and id. The value for these keys should be the name of the property in the objects walker will be applied to holding the id of the current object and parent object respectively. Example class Walker_Page extends Walker { var $tree_type = 'page'; var $db_fields = array ('parent' => 'post_parent', 'id' => 'ID'); Thus the Walker_Page class (part of wordpress 2.2) expects that if page is a page object then page->post_parent will give the id of that page's parent and page->ID will give the id of that page.

Methods
walk($elements, $to_depth) Takes an array of elements ordered so that children occur below their parents and an integer $to_depth. A non-zero $to_depth caps the maximum depth to which the method will descend. If $to_depth is -1 the array is processed as if it was at (no element is the child of another). Any additional arguments passed to walk will be passed unchanged to the other methods walk calls. walk steps through the array $elements one by one. Each time an element is the child of the prior element walk calls start_lvl. Every time an element is processed walk calls start_el and then end_el. Each time an element is no longer below one of the current parents walk calls end_lvl.

start_el($output, $element, $depth, \[optional args\]) Classes extending Walker should dene this function to return $output concatenated with the markup starting an element. end_el($output, $element, $depth, \[optional args\]) Classes extending Walker should dene this function to return $output concatenated with the markup ending an element. Note that elements are not ended until after all of their children have been added.

start_lvl($output, $depth, \[optional args\]) Classes extending Walker should dene this function to return $output concatenated with the markup that should precede any of the child elements. For instance this often outputs a ul or ol tag. end_lvl($output, $depth, \[optional args\]) Classes extending Walker should dene this function to return $output concatenated with the markup that should end any of the child elements. For instance this often ends a ul or ol tag.

Examples
See Function_Reference/Walker_Page, Function_Reference/Walker_PageDropDown, Function_Reference/Walker_Category, Function_Reference/Walker_CategoryDropdown This article is marked as in need of editing. You can help Codex by editing it. Retrieved from "http://codex.wordpress.org/Function_Reference/Walker_Class" Categories: Functions | New page created | Copyedit

Function Reference/ 2
This page is named incorrectly due to a limitation of Mediawiki page naming. The function name is __ not _2.

Contents
1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description

Retrieves the translated string from the translate().

Usage
<?php __( $text, $domain ) ?>

Parameters
$text (string) (required) Text to translate Default: None $domain (string) (optional) Domain to retrieve the translated text Default: 'default'

Return Values
(string) Translated text

Examples Notes
See translate() An alias of translate() l10n is an abbreviation for localization. The function name is two underscores in a row. In some fonts it looks like one long underscore. (Who says programmers don't have a sense of humor.)

Change Log
Since: 2.1.0

Source File
__() is located in wp-includes/l10n.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/_2" Categories: Functions | New page created

Function Reference/ e Contents


1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
Displays the returned translated text from translate().

Usage
<?php _e( $text, $domain ) ?>

Parameters
$text (string) (required) Text to translate Default: None $domain (string) (optional) Domain to retrieve the translated text Default: 'default'

Return Values
(void) This function does not return a value.

Examples Notes
Echos returned translate() string. l10n is an abbreviation for localization.

Change Log
Since: 1.2.0

Source File
_e() is located in wp-includes/l10n.php.

Related
__() Retrieved from "http://codex.wordpress.org/Function_Reference/_e" Categories: Functions | New page created

Function Reference/ get category link Contents


1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 5.1 Category Link 6 Notes 7 Change Log 8 Source File 9 Related

Description
Retrieve category link URL.

Usage
<?php get_category_link( $category_id ) ?>

Parameters
$category_id (integer) (required) Category ID. Default: None

Return Values
(string) Category URI.

Examples
Category Link
<?php // Get the ID of a given category $category_id = get_cat_ID( 'Category Name' ); // Get the URI of this category $category_link = get_category_link( $category_id ); ?> <!-- Print a link to this category -->

<a href="<?php echo $category_link; ?>" title="Category Name">Category Name</a>

Notes
Uses: apply_lters() Calls 'category_link' lter on category link and category ID. Uses global: (unknown) $wp_rewrite

Change Log
Since: 1.0.0

Source File
get_category_link() is located in wp-includes/category-template.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/_get_category_link" Categories: Functions | New page created

Function Reference/ ngettext


This page is named incorrectly due to a limitation of Mediawiki page naming. The function name is __ngettext not _ngettext.

Contents
1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
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 rst be passed to the domain's ngettext method. Then it will be passed to the 'ngettext' lter hook along with the same parameters. The expected type will be a string.

Usage
<?php __ngettext( $single, $plural, $number, $domain ) ?>

Parameters
$single (string) (required) The text that will be used if $number is 1 Default: None $plural (string) (required) The text that will be used if $number is not 1 Default: None $number (integer) (required) The number to compare against to use either $single or $plural Default: None $domain (string) (optional) The domain identier the text should be retrieved in Default: 'default'

Return Values
(string) Either $single or $plural translated text

Examples

Notes
Uses: apply_lters() Calls 'ngettext' hook on domains text returned, along with $single, $plural, and $number parameters. Expected to return string. Uses global: (array) $l10n Gets list of domain translated string (gettext_reader) objects. l10n is an abbreviation for localization. This function name has two leading underscores in a row. In some fonts it looks like one long underscore.

Change Log
Since: 1.2.0

Source File
__ngettext() is located in wp-includes/l10n.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/_ngettext" Categories: Functions | New page created

Function Reference/add action Contents


1 Description 2 Usage 3 Examples 4 Parameters

Description
Hooks a function on to a specic action. See Plugin API/Action Reference for a list of hooks for action. Actions are (usually) triggered when the Wordpress core calls do_action().

Usage
<?php add_action($tag, $function_to_add, $priority = 10, $accepted_args = 1); ?>

Examples
To email some friends whenever an entry is posted on your blog: function email_friends($post_ID) { $friends = 'bob@example.org, susie@example.org'; mail($friends, "sally's blog updated" , 'I just put something on my blog: http://blog.example.com'); return $post_ID; } add_action('publish_post', 'email_friends');

Parameters
$tag (string) The name of the action you wish to hook onto. (See Plugin API/Action Reference for a list of action hooks) $function_to_add (callback) The name of the function you wish to be called. Note: any of the syntaxes explained in the PHP documentation for the 'callback' type are valid. $priority How important your function is. Alter this to make your function be called before or after other functions. The default is 10, so (for example) setting it to 5 would make it run earlier and setting it to 12 would make it run later. $accepted_args How many arguments your function takes. In WordPress 1.5.1+, hooked functions can take extra arguments that are set when the matching do_action() or apply_lters() call is run. For example, the action comment_id_not_found will pass any functions that hook onto it the ID of the requested comment. This article is marked as in need of editing. You can help Codex by editing it. Retrieved from "http://codex.wordpress.org/Function_Reference/add_action" Categories: Functions | Copyedit

Function Reference/add custom image header Contents


1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
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.

Usage
<?php add_custom_image_header( $header_callback, $admin_header_callback ) ?>

Parameters
$header_callback (callback) (required) Call on 'wp_head' action. Default: None $admin_header_callback (callback) (required) Call on administration panels. Default: None

Return Values
(void) This function does not return a value.

Examples Notes
Uses: Custom_Image_Header. Sets up for $admin_header_callback for administration panel display.

Change Log
Since: 2.1.0

Source File
add_custom_image_header() is located in wp-includes/theme.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/add_custom_image_header" Categories: Functions | New page created

Function Reference/add lter Contents


1 Description 2 Usage 3 Parameters 4 Return

Description
Hooks a function to a specic lter 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 specic types of text at these times, using the Filter

API. See the Plugin API for a list of lter hooks.

Usage
<?php add_filter($tag, $function_to_add, $priority = 10, $accepted_args = 1); ?>

Parameters
$tag (string) (required) The name of the lter to hook the $function_to_add to. Default: None $function_to_add (callback) (required) The name of the function to be called when the lter is applied. Default: None $priority (integer) (option) Used to specify the order in which the functions associated with a particular action are executed. Lower numbers correspond with earlier execution, and functions with the same priority are executed in the order in which they were added to the action. Default: 10 $accepted_args (integer) (required) The number of arguments the function(s) accept(s). In WordPress 1.5.1 and newer. hooked functions can take extra arguments that are set when the matching do_action() or apply_lters() call is run. Default: None You may need to supply a pointer to the function's namespace for some lter callbacks, e.g. <?php add_filter('media_upload_newtab', array(&$this, 'media_upload_mycallback')); ?> Otherwise WordPress looks in its own namespace for the function, which can cause abnormal behaviour.

Return
true if the $function_to_add is added successfully to lter $tag. How many arguments your function takes. In WordPress 1.5.1+, hooked functions can take extra arguments that are set when the matching do_action() or apply_lters() call is run. For example, the action comment_id_not_found will pass any functions that hook onto it the ID of the requested comment. This article is marked as in need of editing. You can help Codex by editing it. Retrieved from "http://codex.wordpress.org/Function_Reference/add_lter" Categories: Functions | New page created | Copyedit

Function Reference/add magic quotes Contents


1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
Walks an array while sanitizing the contents.

Usage
<?php add_magic_quotes( $array ) ?>

Parameters
$array (array) (required) Array to used to walk while sanitizing contents. Default: None

Return Values

(array) Sanitized $array.

Examples Notes
Uses global: (object) $wpdb to sanitize values

Change Log
Since: 0.71

Source File
add_magic_quotes() is located in wp-includes/functions.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/add_magic_quotes" Categories: Functions | New page created

Function Reference/add meta box Contents


1 Description 2 Usage 3 Example 4 Parameters 5 Further Reading

Description
The add_meta_box() function was introduced in WordPress 2.5. It allows plugin developers to add sections to the Write Post, Write Page, and Write Link editing pages.

Usage
<?php add_meta_box('id', 'title', 'callback', 'page', 'context', 'priority'); ?>

Example
Here is an example that adds a custom section to the post and page editing screens. It will will work with WordPress 2.5 and also with earlier versions of WordPress (when the add_meta_box function did not exist). <?php /* Use the admin_menu action to define the custom boxes */ add_action('admin_menu', 'myplugin_add_custom_box'); /* Use the save_post action to do something with the data entered */ add_action('save_post', 'myplugin_save_postdata'); /* Adds a custom section to the "advanced" Post and Page edit screens */ function myplugin_add_custom_box() { if( function_exists( 'add_meta_box' )) { add_meta_box( 'myplugin_sectionid', __( 'My Post Section Title', 'myplugin_textdomain' ), 'myplugin_inner_custom_box', 'post', 'advanced' ); add_meta_box( 'myplugin_sectionid', __( 'My Post Section Title', 'myplugin_textdomain' ), 'myplugin_inner_custom_box', 'page', 'advanced' ); } else { add_action('dbx_post_advanced', 'myplugin_old_custom_box' ); add_action('dbx_page_advanced', 'myplugin_old_custom_box' ); } } /* Prints the inner fields for the custom post/page section */ function myplugin_inner_custom_box() { // Use nonce for verification

echo '<input type="hidden" name="myplugin_noncename" id="myplugin_noncename" value="' . wp_create_nonce( plugin_basename(__FILE__) ) . '" />'; // The actual fields for data entry echo '<label for="myplugin_new_field">' . __("Description for this field", 'myplugin_textdomain' ) . '</label> '; echo '<input type="text" name="myplugin_new_field" value="whatever" size="25" />'; } /* Prints the edit form for pre-WordPress 2.5 post/page */ function myplugin_old_custom_box() { echo '<div class="dbx-b-ox-wrapper">' . "\n"; echo '<fieldset id="myplugin_fieldsetid" class="dbx-box">' . "\n"; echo '<div class="dbx-h-andle-wrapper"><h3 class="dbx-handle">' . __( 'My Post Section Title', 'myplugin_textdomain' ) . "</h3></div>"; echo '<div class="dbx-c-ontent-wrapper"><div class="dbx-content">'; // output editing form myplugin_inner_custom_box(); // end wrapper echo "</div></div></fieldset></div>\n"; } /* When the post is saved, saves our custom data */ function myplugin_save_postdata( $post_id ) { // verify this came from the our screen and with proper authorization, // because save_post can be triggered at other times if ( !wp_verify_nonce( $_POST['myplugin_noncename'], plugin_basename(__FILE__) )) { return $post_id; } if ( 'page' == $_POST['post_type'] ) { if ( !current_user_can( 'edit_page', $post_id )) return $post_id; } else { if ( !current_user_can( 'edit_post', $post_id )) return $post_id; } // OK, we're authenticated: we need to find and save the data $mydata = $_POST['myplugin_new_field']; // TODO: Do something with $mydata // probably using add_post_meta(), update_post_meta(), or // a custom table (see Further Reading section below) return $mydata; } ?>

Parameters
$id (string) HTML 'id' attribute of the edit screen section title (string) Title of the edit screen section, visible to user callback (string) Function that prints out the HTML for the edit screen section. page (string) The type of Write screen on which to show the edit screen section ('post', 'page', or 'link')

context (string) The part of the page where the edit screen section should be shown ('normal', 'advanced' or (since 2.7) 'side') priority (string) The priority within the context where the boxes should show ('high' or 'low')

Further Reading
Migrating Plugins and Themes Function Reference Creating Tables with Plugins update_post_meta() function add_post_meta() function Retrieved from "http://codex.wordpress.org/Function_Reference/add_meta_box" Category: Functions

Function Reference/add option Contents


1 Description 2 Usage for wp 2.3.X or newer 3 Example for wp 2.3.X or newer 4 Parameters for wp 2.3.X or newer 5 Usage before $description deprecated 6 Example 7 Parameters before $description deprecated

Description
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(). The data is escaped with $wpdb->escape before the INSERT statement.

Usage for wp 2.3.X or newer


In the lasts versions of WordPress (2.3.X) the parameter $description is deprecated and remove the values from the wp_options table. The usage is the same but the second parameter its unused. See below for older version of this reference <?php add_option($name, $value = '', $deprecated = '', $autoload = 'yes'); ?>

Example for wp 2.3.X or newer


<?php add_option("myhack_extraction_length", '255', '', 'yes'); ?>

Parameters for wp 2.3.X or newer


$name (string) (required) Name of the option to be added. Use underscores to separate words, and do not use uppercasethis is going to be placed into the database. Default: None $value (string) (optional) Value for this option name. Default: Empty $deprecated (string) (optional) Unused. Default: Empty $autoload (string) (optional) Should this option be automatically loaded by the function wp_load_alloptions (puts options into object cache on each page load)? Valid values: yes or no. Default: yes

Usage before $description deprecated

In the last versions of wordpress (2.3.X) the parameter $description is deprecated and remove the values from the wp_op The usage its the same but the seccond parameter its unused.

WP 2.3.X or newer <?php add_option($name, $value = '', $deprecated = '', $autoload = 'yes'); ?>

<?php add_option($name, $value = '', $description = '', $autoload = 'yes'); ?>

Example
<?php add_option("myhack_extraction_length", '255', 'Max length of extracted text in characters.', 'yes'); ?>

Parameters before $description deprecated


$name (string) (required) Name of the option to be added. Use underscores to separate words, and do not use uppercasethis is going to be placed into the database. Default: None $value (string) (optional) Value for this option name. Default: Empty $description (string) (optional) Descriptive text for the option. The description can be used in backend labels. Default: Empty $autoload (string) (optional) Should this option be automatically loaded? Valid values: yes or no. Default: yes This article is marked as in need of editing. You can help Codex by editing it. Retrieved from "http://codex.wordpress.org/Function_Reference/add_option" Categories: Functions | Copyedit

Function Reference/add ping Contents


1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
Add a URL to those already pung.

Usage
<?php add_ping( $post_id, $uri ) ?>

Parameters
$post_id (integer) (required) Post ID. Default: None $uri (string) (required) Ping URI. Default: None

Return Values
(integer) Count of updated rows.

Examples

Notes
Uses global: (object) $wpdb to read and to update the _posts table in database. Uses: apply_lters() on 'add_ping'

Change Log
Since: 1.5.0

Source File
add_ping() is located in wp-includes/post.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/add_ping" Categories: Functions | New page created

Function Reference/add post meta Contents


1 Description 2 Usage 3 Examples 3.1 Default Usage 3.2 Adding or updating a unique eld 3.3 Other Examples 3.4 Making a "Hidden" Custom Field 4 Parameters 5 Related

Description
add_post_meta adds a custom (meta) eld to the specied post. If the $unique parameter is set to true and the specied meta key already exists, the function returns false and makes no changes; otherwise, it returns true.

Usage
<?php add_post_meta($post_id, $meta_key, $meta_value, $unique); ?>

Examples
Default Usage
<?php add_post_meta(68, 'my_key', 47); ?>

Adding or updating a unique eld


Adds a new eld if the key doesn't exist, or updates the existing eld. (UPDATE: If the forth parameter of add_post_meta is set to true, the eld will not be update if it already exists (tested on WP 2.6.2). Use if (!update_post_meta(...)) add_post_meta(...)) <?php add_post_meta(7, 'fruit', 'banana', true) or update_post_meta(7, 'fruit', 'banana'); ?>

Other Examples
If you wanted to make sure that there were no elds with the key "my_key", before adding it: <?php add_post_meta(68, 'my_key', '47', true); ?> To add several values to the key "my_key": <?php add_post_meta(68, 'my_key', '47'); ?> <?php add_post_meta(68, 'my_key', '682'); ?> <?php add_post_meta(68, 'my_key', 'The quick, brown fox jumped over the lazy dog.'); ?> ... For a more detailed example, go to the post_meta Functions Examples page.

Making a "Hidden" Custom Field


If you are a plugin / theme developer and you are planning to use custom elds to store parameters related to your plugin or template, it is interesting to note that WordPress wont show keys starting with an "_" (underscore) in the custom elds list at the page / post editing page.

That being said, it is a good practice to use an underscore as the rst character in your custom parameters, that way your settings are stored as custom elds, but they won't display in the custom elds list in the admin UI. The following example: <?php add_post_meta(68, '_color', 'red', true); ?> will add a unique custom eld with the key name "_color" and the value "red" but this custom eld will not display in the page / post editing page.

Parameters
$post_id (integer) (required) The ID of the post to which you will add a custom eld. Default: None $meta_key (string) (required) The key of the custom eld you will add. Default: None $meta_value (string) (required) The value of the custom eld you will add. Default: None $unique (boolean) (optional) Whether or not you want the key to be unique. When set to true, this will ensure that there is not already a custom eld attached to the post with $meta_key as it's key, and, if such a eld already exists, the key will not be added. Default: false

Related
delete_post_meta(), get_post_meta(), update_post_meta(), get_post_custom(), get_post_custom_values(), get_post_custom_keys() Retrieved from "http://codex.wordpress.org/Function_Reference/add_post_meta" Categories: Functions | New page created | Needs Review

Function Reference/add query arg


This is the information found in the source about this function. Retrieve a modified URL 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 emptystring removes the key. Omitting oldquery_or_uri uses the $_SERVER value. @since 1.5.0 @param mixed $param1 Either newkey or an associative_array @param mixed $param2 Either newvalue or oldquery or uri @param mixed $param3 Optional. Old query or uri @return string New URL query string. Retrieved from "http://codex.wordpress.org/Function_Reference/add_query_arg"

Function Reference/addslashes gpc Contents


1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
Adds slashes to escape strings. Slashes will rst be removed if magic-quotes-gpc is set, see magic_quotes for more details.

Usage
<?php addslashes_gpc( $gpc ) ?>

Parameters
$gpc (string) (required) The string returned from HTTP request data. Default: None

Return Values
(string) Returns a string escaped with slashes.

Examples Notes
Uses global: (object) $wpdb In this context, this: '\' is a slash.

Change Log
Since: 0.71

Source File
addslashes_gpc() is located in wp-includes/formatting.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/addslashes_gpc" Categories: Functions | New page created

Function Reference/antispambot Contents


1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
Converts email addresses characters to HTML entities to block spam bots.

Usage
<?php antispambot( $emailaddy, $mailto ) ?>

Parameters
$emailaddy (string) (required) Email address. Default: None $mailto (integer) (optional) 0 or 1. Used for encoding. Default: 0

Return Values

(string) Converted email address.

Examples Notes Change Log


Since: 0.71

Source File
antispambot() is located in wp-includes/formatting.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/antispambot" Categories: Functions | New page created

Function Reference/apply lters Contents


1 Description 2 Usage 3 Parameters 4 Return

Description
Call the functions added to a lter hook. See the Plugin API for a list of lter hooks. The callback functions attached to lter hook $tag are invoked by calling this function. This function can be used to create a new lter hook by simply calling this function with the name of the new hook specied using the $tag parameter.

Usage
<?php apply_filters($tag, $value); ?>

Parameters
$tag (string) (required) The name of the lter hook. Default: None $value (mixed) (required) The value which the lters hooked to $tag may modify. Default: None

Return
(mixed) The result of $value after all hooked functions are applied to it. Note: The type of return should be the same as the type of $value: a string or an array, for example. Retrieved from "http://codex.wordpress.org/Function_Reference/apply_lters" Categories: Functions | New page created

Function Reference/attribute escape


Return to function reference.

Description
This function escapes or encodes HTML special characters (including single and double quotes) for use in HTML attriutes. It works like the standard PHP htmlspecialchars except that it doesn't double-encode HTML entities (i.e. it replaces &&, for example, with &#038;&). attribute_escape can be found in /wp-includes/formatting.php.

Usage
<?php echo attribute_escape($text); ?>

Parameters
$text (string) Text to be escaped. Retrieved from "http://codex.wordpress.org/Function_Reference/attribute_escape" Category: Functions

Function Reference/auth redirect Description


auth_redirect() is a simple function that requires that the user be logged in before they can access a page.

Default Usage
<?php auth_redirect() ?> When this code is called from a page, it checks to see if the user viewing the page is logged in. If the user is not logged in, they are redirected to the login page. The user is redirected in such a way that, upon logging in, they will be sent directly to the page they were originally trying to access.

Parameters
This function accepts no parameters.

Related
is_user_logged_in(), wp_redirect() Retrieved from "http://codex.wordpress.org/Function_Reference/auth_redirect" Categories: Needs Review | Functions | New page created

Function Reference/backslashit Contents


1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
Adds backslashes before letters and before a number at the start of a string.

Usage
<?php backslashit( $string ) ?>

Parameters
$string (string) (required) Value to which backslashes will be added. Default: None

Return Values
(string) String with backslashes inserted.

Examples Notes
This: '\' is a backslash.

Change Log
Since: 0.71

Source File
backslashit() is located in wp-includes/formatting.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/backslashit" Categories: Functions | New page created

Function Reference/balanceTags Contents


1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
Will only balance the tags if forced to and the option is set to balance tags. The option 'use_balanceTags' is used for whether the tags will be balanced. Both the $force parameter and 'use_balanceTags' option will have to be true before the tags will be balanced.

Usage
<?php balanceTags( $text, $force ) ?>

Parameters
$text (string) (required) Text to be balanced Default: None $force (boolean) (optional) Forces balancing, ignoring the value of the option. Default: false

Return Values
(string) Balanced text

Examples Notes Change Log


Since: 0.71

Source File
balanceTags() is located in wp-includes/formatting.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/balanceTags" Categories: Functions | New page created

Function Reference/bloginfo rss Contents


1 Description

2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
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.

Usage
<?php bloginfo_rss( $show ) ?>

Parameters
$show (string) (optional) See get_bloginfo() for possible values. Default: ''

Return Values
(void) This function does not return a value.

Examples Notes
See get_bloginfo() For the list of possible values to display. Uses: apply_lters() Calls 'bloginfo_rss' hook with two parameters.

Change Log
Since: 0.71

Source File
bloginfo_rss() is located in wp-includes/feed.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/bloginfo_rss" Categories: Functions | New page created

Function Reference/bool from yn Contents


1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
Whether input is yes or no. Must be 'y' to be true.

Usage
<?php bool_from_yn( $yn ) ?>

Parameters

$yn (string) (required) Character string containing either 'y' or 'n' Default: None

Return Values
(boolean) True if yes, false on anything else

Examples Notes
'y' returns true, 'Y' returns true, Everything else returns false.

Change Log
Since: 1.0.0

Source File
bool_from_yn() is located in wp-includes/functions.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/bool_from_yn" Categories: Functions | New page created

Function Reference/cache javascript headers Contents


1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
Set the headers for caching for 10 days with JavaScript content type.

Usage
<?php cache_javascript_headers() ?>

Parameters
None.

Return Values
(void) This function does not return a value.

Examples Notes Change Log


Since: 2.1.0

Source File
cache_javascript_headers() is located in wp-includes/functions.php.

Related

Retrieved from "http://codex.wordpress.org/Function_Reference/cache_javascript_headers" Categories: Functions | New page created

Function Reference/cat is ancestor of Contents


1 Description 2 Usage 3 Notes 4 Further Reading

Description
This is a simple function for evaluating if the second category is a child of another category.

Usage
<?php cat_is_ancestor_of(cat1, cat2); ?> Returns true if cat1 is an ancestor of cat2. Any level of ancestry will return true. Arguments should be either integer category IDs or category objects.

Notes
If arguments are string representations of integers and not true integers cat_is_ancestor_of will return false.

Further Reading
Function_Reference Retrieved from "http://codex.wordpress.org/Function_Reference/cat_is_ancestor_of" Categories: Functions | Conditional Tags

Function Reference/check admin referer Contents


1 Description 2 Parameters 3 Usage 4 See also

Description
Makes sure that a user was referred from another admin page, to avoid security exploits. Nonces related.

Parameters
$action (string) (defaults to int -1) Action nonce Default: -1 $query_arg (string) (optional) where to look for nonce in $_REQUEST (since 2.5) Default: '_wpnonce'

Usage
<?php check_admin_referer('bcn_admin_options'); ?>

See also
wp_verify_nonce do_action Wordpress Nonce Implementation Function Reference This page is marked as incomplete. You can help Codex by expanding it.

Retrieved from "http://codex.wordpress.org/Function_Reference/check_admin_referer" Categories: Stubs | Functions

Function Reference/check ajax referer Contents


1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
This function can be replaced via plugins. If plugins do not redene these functions, then this will be used instead. Veries the AJAX request to prevent processing requests external of the blog.

Usage
<?php check_ajax_referer( $action, $query_arg, $die ) ?>

Parameters
$action (string) (optional) Action nonce Default: -1 $query_arg (string) (optional) where to look for nonce in $_REQUEST (since 2.5) Default: false $die (unknown) (optional) Default: true

Return Values
(void) This function does not return a value.

Examples Notes
This function can be replaced via plugins. If plugins do not redene these functions, then this will be used instead.

Change Log
Since: 2.0.4

Source File
check_ajax_referer() is located in wp-includes/pluggable.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/check_ajax_referer" Categories: Functions | New page created

Function Reference/check comment


This article is marked as in need of editing. You can help Codex by editing it.

Contents
1 Description 2 Usage 3 Parameters

4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
check_comment() checks whether a comment passes internal checks set by WordPress Comment_Moderation.

Usage
<?php check_comment( $author, $email, $url, $comment, $user_ip, $user_agent, $comment_type ) ?>

Parameters
$author (string) (required) Comment author name. Default: None $email (string) (required) Comment author email. Default: None $url (string) (required) Comment author URL. Default: None $comment (string) (required) Comment contents. Default: None $user_ip (string) (required) Comment author IP address. Default: None $user_agent (string) (required) Comment author user agent. Default: None $comment_type (string) (required) Comment type (comment, trackback, or pingback). Default: None

Return Values
(boolean) This function returns a single boolean value of either true or false. Returns false if in Comment_Moderation: The Administrator must approve all messages, The number of external links is too high, or Any banned word, name, URL, e-mail, or IP is found in any parameter except $comment_type. Returns true if the Administrator does not have to approve all messages and: $comment_type parameter is a trackback or pingback and part of the blogroll, or $author and $email parameters have been approved previously. Returns true in all other cases.

Examples Notes
Uses: $wpdb Uses: get_option()

Change Log
Since: WordPress Version 1.2

Source File
check_comment() is located in wp-includes/comment.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/check_comment" Categories: Copyedit | Functions | New page created

Function Reference/clean pre Contents


1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
Accepts matches array from preg_replace_callback in wpautop() or a string. Ensures that the contents of a <pre>...</pre> HTML block are not converted into paragraphs or line-breaks.

Usage
<?php clean_pre( $matches ) ?>

Parameters
$matches (array|string) (required) The array or string Default: None

Return Values
(string) The pre block without paragraph/line-break conversion.

Examples Notes
Note: If $matches is an array the array values are concatenated into a string.

Change Log
Since: 1.2.0

Source File
clean_pre() is located in wp-includes/formatting.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/clean_pre" Categories: Functions | New page created

Function Reference/clean url Contents Description


Checks 1 Description URL. and cleans a
2 Usage 3 of characters are removed from the URL. If the URL is for displaying (the default behaviour) ampersands (&) are also replaced. The A number Parameters 4 Return Values 'clean_url'Examples 5 lter is applied to the returned cleaned URL.

Usage 7 Change Log


8 Source File

6 Notes

<?php 9 Related clean_url( $url, $protocols, $context ) ?>

Parameters
$url (string) (required) The URL to be cleaned. Default: None $protocols (array) (optional) An array of acceptable protocols. Defaults to 'http', 'https', 'ftp', 'ftps', 'mailto', 'news', 'irc', 'gopher', 'nntp', 'feed', 'telnet' if not set. Default: null $context (string) (optional) How the URL will be used. Default is 'display'. Default: 'display'

Return Values
(string) The cleaned $url after the 'cleaned_url' lter is applied.

Examples Notes
Uses: wp_kses_bad_protocol() to only permit protocols in the URL set via $protocols or the common ones set in the function.

Change Log
Since: 1.2.0

Source File
clean_url() is located in wp-includes/formatting.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/clean_url" Categories: Functions | New page created

Function Reference/comment author rss Contents


1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
Display the current comment author in the feed.

Usage
<?php comment_author_rss() ?>

Parameters
None.

Return Values
(void) This function does not return a value.

Examples Notes

Echos the return from get_comment_author_rss().

Change Log
Since: 1.0.0

Source File
comment_author_rss() is located in wp-includes/feed.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/comment_author_rss" Categories: Functions | New page created

Function Reference/comment link Contents


1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
Display the link to the comments.

Usage
<?php comment_link() ?>

Parameters
None.

Return Values
(void) This function does not return a value.

Examples Notes
Echos the return value of get_comment_link().

Change Log
Since: 1.5.0

Source File
comment_link() is located in wp-includes/feed.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/comment_link" Categories: Functions | New page created

Function Reference/comment text rss Contents


1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log

8 Source File 9 Related

Description
Display the current comment content for use in the feeds.

Usage
<?php comment_text_rss() ?>

Parameters
None.

Return Values
(void) This function does not return a value.

Examples Notes
Uses: apply_lters() Calls 'comment_text_rss' lter on comment content. Uses: get_comment_text()

Change Log
Since: 1.0.0

Source File
comment_text_rss() is located in wp-includes/feed.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/comment_text_rss" Categories: Functions | New page created

Function Reference/convert chars Contents


1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
Converts a number of characters from a string. Metadata tags <title> and <category> are removed, <br> and <hr> are converted into correct XHTML and Unicode characters are converted to the valid range.

Usage
<?php convert_chars( $content, $deprecated ) ?>

Parameters
$content (string) (required) String of characters to be converted. Default: None $deprecated (string) (optional) Not used. Default: ''

Return Values
(string) Converted string.

Examples Notes Change Log


Since: 0.71

Source File
convert_chars() is located in wp-includes/formatting.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/convert_chars" Categories: Functions | New page created

Function Reference/convert smilies Contents


1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
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.

Usage
<?php convert_smilies( $text ) ?>

Parameters
$text (string) (required) Content to convert smilies from text. Default: None

Return Values
(string) Converted content with text smilies replaced with images.

Examples Notes
Uses: $wp_smiliessearch, $wp_smiliesreplace Smiley replacement arrays. Uses global: (array) $wp_smiliessearch Uses global: (array) $wp_smiliesreplace

Change Log
Since: 0.71

Source File
convert_smilies() is located in wp-includes/formatting.php.

Related

Using_Smilies Glossary: Smileys Retrieved from "http://codex.wordpress.org/Function_Reference/convert_smilies" Categories: Functions | New page created

Function Reference/current time Contents


1 Description 2 Usage 3 Example 3.1 Usage 4 Parameters

Description
Returns the current time or timestamp. The time returned will be the server time + the offset in the options page, and it will be equivalent to the time displayed on the options page itself.

Usage
<?php echo current_time($type, $gmt = 0); ?>

Example
This example gets the current time and assigns the parameters to variables. <?php $blogtime = current_time('mysql'); list( $today_year, $today_month, $today_day, $hour, $minute, $second ) = split( '([^0-9])', $blogtime ); ?>

Usage
Get the current system time in two formats. <?php echo('Current time: ' . current_time('mysql') . '<br />'); ?> <?php echo('Current timestamp: ' . current_time('timestamp')); ?> Current time: 2005-08-05 10:41:13 Current timestamp: 1123238473

Parameters
$type (string) (required) The time format to return. Possible values: mysql timestamp Default: None This article is marked as in need of editing. You can help Codex by editing it. Retrieved from "http://codex.wordpress.org/Function_Reference/current_time" Categories: Functions | Copyedit

Function Reference/date i18n Contents


1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
Retrieve the date in localized format, based on timestamp. If the locale species 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 rst "i" and last "n".)

Usage
<?php date_i18n( $dateformatstring, $unixtimestamp, $gmt ) ?>

Parameters
$dateformatstring (string) (required) Format to display the date Default: None $unixtimestamp (integer) (optional) Unix timestamp Default: false $gmt (unknown) (optional) Default: false

Return Values
(string) The date, translated if locale species it.

Examples Notes
See Also: i18n Uses global: (object) $wp_locale handles the date and time locales.

Change Log
Since: 0.71

Source File
date_i18n() is located in wp-includes/functions.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/date_i18n" Categories: Functions | New page created

Function Reference/delete option Contents


1 Description 2 Usage 3 Example 3.1 Usage 4 Parameters

Description
A safe way of removing a named option/value pair from the options database table.

Usage
<?php delete_option($name); ?>

Example
Usage

<?php delete_option("myhack_extraction_length"); ?>

Parameters
$name (string) (required) Name of the option to be deleted. A list of valid default options can be found at the Option Reference. Default: None This article is marked as in need of editing. You can help Codex by editing it. Retrieved from "http://codex.wordpress.org/Function_Reference/delete_option" Categories: Functions | Copyedit

Function Reference/delete post meta Contents


1 Description 2 Usage 3 Examples 3.1 Default Usage 3.2 Other Examples 4 Parameters 5 Related

Description
This function deletes all custom elds with the specied key from the specied post. See also update_post_meta(), get_post_meta() and add_post_meta().

Usage
<?php delete_post_meta($post_id, $key, $value); ?>

Examples
Default Usage
<?php delete_post_meta(76, 'my_key', 'Steve'); ?>

Other Examples
Let's assume we had a plugin that added some meta values to posts, but now when we are uninstalling the plugin, we want to delete all the post meta keys that the plugin added. Assuming the plugin added the keys related_posts and post_inspiration. To delete all the keys, this would be added to the "uninstall" function: <?php $allposts = get_posts('numberposts=0&post_type=post&post_status='); foreach( $allposts as $postinfo) { delete_post_meta($postinfo->ID, 'related_posts'); delete_post_meta($postinfo->ID, 'post_inspiration'); } ?> Or, if you wanted to delete all the keys except where post_inspiration was "Sherlock Holmes": <?php $allposts = get_posts('numberposts=0&post_type=post&post_status='); foreach( $allposts as $postinfo) { delete_post_meta($postinfo->ID, 'related_posts'); $inspiration = get_post_meta( $postinfo->ID, 'post_inspiration ); foreach( $inspiration as $value ) { if( $value != "Sherlock Holmes" ) delete_post_meta($postinfo->ID, 'post_inspiration', $value); } } ?> Or maybe post number 185 was just deleted, and you want to remove all related_posts keys that reference it:

<?php $allposts = get_posts('numberposts=0&post_type=post&post_status='); foreach( $allposts as $postinfo) { delete_post_meta($postinfo->ID, 'related_posts', '185'); } ?> For a more detailed example, go to the post_meta Functions Examples page. Note: Unlike update_post_meta(), This function will delete all elds that match the criteria.

Parameters
$post_id (integer) (required) The ID of the post from which you will delete a eld. Default: None $key (string) (required) The key of the eld you will delete. Default: None $value (string) (optional) The value of the eld you will delete. This is used to differentiate between several elds with the same key. If left blank, all elds with the given key will be deleted. Default: None

Related
update_post_meta(), get_post_meta(), add_post_meta(), get_post_custom(), get_post_custom_values(), get_post_custom_keys() Retrieved from "http://codex.wordpress.org/Function_Reference/delete_post_meta" Categories: Functions | New page created | Needs Review

Function Reference/delete usermeta Contents


1 Description 2 Usage 3 Example 4 Parameters

Description
Removes a user meta record from the wp_usermeta database table for a specic user ID.

Usage
<?php delete_usermeta($user_id, $meta_key, $meta_value); ?>

Example
<?php if (delete_usermeta(7, 'first_name')) { echo 'User meta key successfully removed!'; } else { echo 'User meta record could not be removed!'; } ?>

Parameters
$user_id (integer) (required) The ID of the WordPress user Default: None $meta_key (string) (required) The meta_key eld value Default: None $meta_value (string) (required) The meta_value eld value Default: None

This article is marked as in need of editing. You can help Codex by editing it. Retrieved from "http://codex.wordpress.org/Function_Reference/delete_usermeta" Categories: Functions | New page created | Copyedit

Function Reference/did action Description


Returns the number times an action is red.

Parameters
$tag (string) The name of the action hook to check.

Return
(int) The number of times the given action hook, $tag, is red. This page is marked as incomplete. You can help Codex by expanding it. Retrieved from "http://codex.wordpress.org/Function_Reference/did_action" Categories: Stubs | Functions | New page created

Function Reference/discover pingback server uri Contents


1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
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 rst and returns that, if available. The check for the rel="pingback" has more overhead than just the header.

Usage
<?php discover_pingback_server_uri( $url, $deprecated ) ?>

Parameters
$url (string) (required) URL to ping. Default: None $deprecated (integer) (Not Used.) Default: None

Return Values
(boolean|string) False on failure, string containing URI on success.

Examples Notes
Uses: wp_remote_get() Uses: is_wp_error()

Change Log
Since: 1.5.0

Source File
discover_pingback_server_uri() is located in wp-includes/comment.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/discover_pingback_server_uri" Categories: Functions | New page created

Function Reference/do action Description


Creates a hook for attaching actions via add_action.

Usage
<?php do_action($tag, $arg = ); ?>

Parameters
$tag (string) The name of the hook you wish to create. $arg (string) The list of arguments this hook accepts. This page is marked as incomplete. You can help Codex by expanding it. Retrieved from "http://codex.wordpress.org/Function_Reference/do_action" Categories: Stubs | Functions

Function Reference/do action ref array Description


Execute functions hooked on a specic action hook, specifying arguments in a array. This function is identical to do_action, but the arguments passed to the functions hooked to $tag are supplied using an array.

Parameters
$tag (string) The name of the action to be executed. $args (array) The arguments supplied to the functions hooked to $tag This page is marked as incomplete. You can help Codex by expanding it. Retrieved from "http://codex.wordpress.org/Function_Reference/do_action_ref_array" Categories: Stubs | Functions

Function Reference/do all pings Contents


1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description

Perform all pingbacks, enclosures, trackbacks, and send to pingback services.

Usage
<?php do_all_pings() ?>

Parameters Return Values


(void) This function does not return a value.

Examples Notes
See Reads from the _posts table from the database. Uses: $wpdb Uses: pingback() Uses: do_enclose() Uses: do_trackbacks() Uses: generic_ping() Uses global: (object) $wpdb

Change Log
Since: 2.1.0

Source File
do_all_pings() is located in wp-includes/comment.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/do_all_pings" Categories: Functions | New page created

Function Reference/do enclose Contents


1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
Check content for video and audio links to add as enclosures. Will not add enclosures that have already been added.

Usage
<?php do_enclose( $content, $post_ID ) ?>

Parameters
$content (string) (required) Post Content Default: None $post_ID (integer) (required) Post ID Default: None

Return Values

(void) This function does not return a value.

Examples Notes
Uses global: (object) $wpdb to read and condtionally insert records on _postmeta table in the database. Uses: debug_fopen() to open 'enclosures.log' le. Uses: debug_fwrite() to write to 'enclosures.log' le. Uses: get_enclosed() Uses: wp_get_http_headers()

Change Log
Since: 1.5.0

Source File
do_enclose() is located in wp-includes/functions.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/do_enclose" Categories: Functions | New page created

Function Reference/do feed Contents


1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
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.

Usage
<?php do_feed() ?>

Parameters
None.

Return Values
(void) This function does not return a value.

Examples Notes
Uses: get_query_var() to get 'feed' from $wp_query. Uses: do_action() Calls 'do_feed_$feed' hook, if a hook exists for the feed where $feed is the 'feed' property from $wp_query. Uses global: (object) $wp_query Used to tell if the use a comment feed.

Change Log
Since: 2.1.0

Source File
do_feed() is located in wp-includes/functions.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/do_feed" Categories: Functions | New page created

Function Reference/do feed atom Contents


1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
Load either Atom comment feed or Atom posts feed.

Usage
<?php do_feed_atom( $for_comments ) ?>

Parameters
$for_comments (boolean) (required) true for the comment feed, false for normal feed. Default: None

Return Values
(void) This function does not return a value.

Examples Notes
Uses: load_template() to load feed templates.

Change Log
Since: 2.1.0

Source File
do_feed_atom() is located in wp-includes/functions.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/do_feed_atom" Categories: Functions | New page created

Function Reference/do feed rdf Contents


1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
Load the RDF RSS 0.91 Feed template.

Usage
<?php do_feed_rdf() ?>

Parameters
None.

Return Values
(void) This function does not return a value.

Examples Notes
Uses: load_template() to load feed template.

Change Log
Since: 2.1.0

Source File
do_feed_rdf() is located in wp-includes/functions.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/do_feed_rdf" Categories: Functions | New page created

Function Reference/do feed rss Contents


1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
Load the RDF RSS 1.0 Feed template.

Usage
<?php do_feed_rss() ?>

Parameters
None.

Return Values
(void) This function does not return a value.

Examples Notes
Uses: load_template() to load feed template.

Change Log

Since: 2.1.0

Source File
do_feed_rss() is located in wp-includes/functions.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/do_feed_rss" Categories: Functions | New page created

Function Reference/do feed rss2 Contents


1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
Load either the RSS2 comment feed or the RSS2 posts feed.

Usage
<?php do_feed_rss2( $for_comments ) ?>

Parameters
$for_comments (boolean) (required) true for the comment feed, false for normal feed. Default: None

Return Values
(void) This function does not return a value.

Examples Notes
Uses: load_template() to load feed template.

Change Log
Since: 2.1.0

Source File
do_feed_rss2() is located in wp-includes/functions.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/do_feed_rss2" Categories: Functions | New page created

Function Reference/do robots Contents Description


1 Description Display the robot.txt le content. 2 Usage 3 content should be with usage of the permalinks or for creating the robot.txt le. The echo Parameters 4 Return Values 5 Examples 7 Change Log 9 Related

Usage 6 Notes

<?php 8 Source File do_robots() ?>

Parameters
None.

Return Values
(void) This function does not return a value.

Examples Notes
Uses: do_action() Calls 'do_robotstxt' hook for displaying robot.txt rules.

Change Log
Since: 2.1.0

Source File
do_robots() is located in wp-includes/functions.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/do_robots" Categories: Functions | New page created

Function Reference/do trackbacks Contents


1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
Perform trackbacks.

Usage
<?php do_trackbacks( $post_id ) ?>

Parameters
$post_id (integer) (required) Post ID to do trackbacks on. Default: None

Return Values
(void) This function does not return a value.

Examples Notes
See Reads from and may update the _posts table from the database. Uses global: (object) $wpdb Uses: get_to_ping() Uses: get_pung() Uses: wp_html_excerpt() Uses: apply_lters() on 'the_content' on 'post_content' Uses: apply_lters() on 'the_excerpt' on 'post_excerpt' Uses: apply_lters() on 'the_title' on 'post_title' Uses: trackback()

Change Log
Since: 1.5.0

Source File
do_trackbacks() is located in wp-includes/comment.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/do_trackbacks" Categories: Functions | New page created

Function Reference/email exists Contents


1 Description 2 Examples 2.1 Default Usage 2.2 Detailed Example 3 Parameter 4 Return

Description
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.

Examples
Default Usage
This function is normally used when a user is registering, to ensure that the E-mail address the user is attempting to register with has not already been registered. <?php if ( email_exists($email) ) { . . . } ?>

Detailed Example
If the E-mail exists, echo the ID number to which the E-mail is registered. Otherwise, tell the viewer that it does not exist. <?php $email = 'myemail@example.com'; if ( email_exists($email) ) echo "That E-mail is registered to user number " . email_exists($email); else echo "That E-mail doesn't belong to any registered users on this site"; ?>

Parameter
$email (string) (required) The E-mail address to check Default: None

Return
If the E-mail exists, function returns the ID of the user to whom the E-mail is registered. If the E-mail does not exist, function returns false. Retrieved from "http://codex.wordpress.org/Function_Reference/email_exists" Categories: Functions | New page created | Needs Review

Function Reference/ent2ncr Contents


1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes

7 Change Log 8 Source File 9 Related

Description
Converts named entities into numbered entities.

Usage
<?php ent2ncr( $text ) ?>

Parameters
$text (string) (required) The text within which entities will be converted. Default: None

Return Values
(string) Text with converted entities.

Examples Notes Change Log


Since: 1.5.1

Source File
ent2ncr() is located in wp-includes/formatting.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/ent2ncr" Categories: Functions | New page created

Function Reference/fetch rss Contents


1 Description 2 Usage 3 Example 4 Parameters 5 Related

Description
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.

Usage
<?php include_once(ABSPATH . WPINC . '/rss.php'); $rss = fetch_rss($uri); ?>

Example
To get and display a list of links for an existing RSS feed, limiting the selection to the most recent 5 items:

<h2><?php _e('Headlines from AP News'); ?></h2> <?php // Get RSS Feed(s) include_once(ABSPATH . WPINC . '/rss.php'); $rss = fetch_rss('http://example.com/rss/feed/goes/here'); $maxitems = 5; $items = array_slice($rss->items, 0, $maxitems);

?> <ul> <?php if (empty($items)) echo '<li>No items</li>'; else foreach ( $items as $item ) : ?> <li><a href='<?php echo $item['link']; ?>' title='<?php echo $item['title']; ?>'> <?php echo $item['title']; ?> </a></li> <?php endforeach; ?> </ul>

Parameters
$uri (URI) (required) The URI of the RSS feed you want to retrieve. The resulting parsed feed is returned, with the more interesting and useful bits in the items array. Default: Nonerray.

Related
wp_rss Retrieved from "http://codex.wordpress.org/Function_Reference/fetch_rss" Category: Functions

Function Reference/force balance tags Description


Balances tags of string using a modied stack.

Usage
<?php force_balance_tags($text); ?>

Parameters
$text (string) Text to be balanced This page is marked as incomplete. You can help Codex by expanding it. Retrieved from "http://codex.wordpress.org/Function_Reference/force_balance_tags" Categories: Stubs | Functions

Function Reference/form option


Similar to get_option, but removes attributes from result This page is marked as incomplete. You can help Codex by expanding it. Retrieved from "http://codex.wordpress.org/Function_Reference/form_option" Categories: New page created | Functions | Stubs

Function Reference/format to edit Contents


1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
Acts on text which is about to be edited. Unless $richedit is set, it is simply a holder for the 'format_to_edit' lter. If $richedit is set true htmlspecialchars will be run on the content, converting special characters to HTML entities.

Usage
<?php format_to_edit( $content, $richedit ) ?>

Parameters
$content (string) (required) The text about to be edited. Default: None $richedit (boolean) (optional) Whether or not the $content should pass through htmlspecialchars. Default: false

Return Values
(string) The text after the lter (and possibly htmlspecialchars.) has been run.

Examples Notes Change Log


Since: 0.71

Source File
format_to_edit() is located in wp-includes/formatting.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/format_to_edit" Categories: Functions | New page created

Function Reference/format to post Contents


1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
Holder for the 'format_to_post' lter.

Usage
<?php format_to_post( $content ) ?>

Parameters
$content (string) (required) The text to pass through the lter. Default: None

Return Values
(string)

Text returned from the 'format_to_post' lter.

Examples Notes Change Log


Since: 0.71

Source File
format_to_post() is located in wp-includes/formatting.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/format_to_post" Categories: Functions | New page created

Function Reference/funky javascript x


funky_javascript_x (line 626) Fixes javascript bugs in browsers. Converts unicode characters to HTML numbered entities. * * * * return: Fixed text. since: 1.5.0 uses: $is_winIE uses: $is_macIE

string funky_javascript_x (string $text) * string $text: Text to be made safe. http://phpdoc.ftwr.co.uk/wordpress/WordPress/_wp-includes---formatting.php.html Retrieved from "http://codex.wordpress.org/Function_Reference/funky_javascript_x"

Function Reference/generic ping Contents


1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
Sends pings to all of the ping site services.

Usage
<?php generic_ping( $post_id ) ?>

Parameters
$post_id (integer) (optional) Post ID. Only used as a return velue. Default: 0

Return Values
(integer) Returns $post_id unaltered.

Examples

Notes
The $post_id and return values do not have to be an integer data types, but in WordPress $post_id is always an integer data type. Uses: get_option() to get all ping sites. Uses: weblog_ping() for each ping site.

Change Log
Since: 1.2.0

Source File
generic_ping() is located in wp-includes/comment.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/generic_ping" Categories: Functions | New page created

Function Reference/get 404 template Contents


1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
Retrieve path of 404 template in current or parent template.

Usage
<?php get_404_template() ?>

Parameters
None.

Return Values
(string) Returns result from get_query_template('404').

Examples Notes
Uses: get_query_template()

Change Log
Since: 1.5.0

Source File
get_404_template() is located in wp-includes/theme.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/get_404_template" Categories: Functions | New page created

Function Reference/get all category ids Contents


1 Description 2 Usage

3 Examples 3.1 Default Usage 4 Parameters

Description
Returns an array containing IDs for all categories.

Usage
<?php $category_ids = get_all_category_ids(); ?>

Examples
Default Usage

Parameters
This page is marked as incomplete. You can help Codex by expanding it. Retrieved from "http://codex.wordpress.org/Function_Reference/get_all_category_ids" Categories: Stubs | Functions

Function Reference/get all page ids Contents


1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
Get a list of page IDs.

Usage
<?php get_all_page_ids() ?>

Parameters
None

Return Values
(array) List of page IDs.

Examples Notes
Uses: $wpdb

Change Log
Since: 2.0.0

Source File
get_all_page_ids() is located in wp-includes/post.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/get_all_page_ids" Categories: Functions | New page created

Function Reference/get alloptions Contents


1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
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.

Usage
<?php get_alloptions() ?>

Parameters
None.

Return Values
(array) List of all options.

Examples Notes
Uses: apply_lters() Calls 'pre_option_$optionname' hook with option value as parameter. Uses: apply_lters() Calls 'all_options' on options list. Uses global: (object) $wpdb

Change Log
Since: 1.0.0

Source File
get_alloptions() is located in wp-includes/functions.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/get_alloptions" Categories: Functions | New page created

Function Reference/get approved comments Contents


1 Description 1.1 Usage 2 Example 3 Parameters

Description
Takes post ID and returns an array of objects that represent comments that have been submitted and approved.

Usage
<?php $comment_array = get_approved_comments($post_id); ?>

Example
In this example we will output a simple list of comment IDs and corresponding post IDs. <?php $postID = 1; $comment_array = get_approved_comments(1); foreach($comment_array as $comment){ echo $comment->comment_ID." => ".$comment->comment_post_ID."\n"; } ?>

Parameters
$post_id (integer) (required) The ID of the post to retrieve comments from. Default: None This article is marked as in need of editing. You can help Codex by editing it. Retrieved from "http://codex.wordpress.org/Function_Reference/get_approved_comments" Categories: Functions | Copyedit

Function Reference/get archive template Contents


1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
Retrieve path of archive template in current or parent template.

Usage
<?php get_archive_template() ?>

Parameters
None.

Return Values
(string) Returns result from get_query_template('archive')

Examples Notes
Uses: get_query_template()

Change Log
Since: 1.5.0

Source File
get_archive_template() is located in wp-includes/theme.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/get_archive_template" Categories: Functions | New page created

Function Reference/get attached le Contents


1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
Retrieve attached le path based on attachment ID. You can optionally send it through the 'get_attached_le' lter, but by default it will just return the le path unltered. The function works by getting the single post meta name, named '_wp_attached_le' and returning it. This is a convenience function to prevent looking up the meta name and provide a mechanism for sending the attached le name through a lter.

Usage
<?php get_attached_file( $attachment_id, $unfiltered ) ?>

Parameters
$attachment_id (integer) (required) Attachment ID. Default: None $unltered (boolean) (optional) Whether to apply lters or not. Default: false

Return Values
(string) The le path to the attached le.

Examples Notes
Uses: apply_lters() to call get_attached_le() on le path and $attachment_id. Uses: get_post_meta() on $attachment_id, the '_wp_attached_le' meta name.

Change Log
Since: 2.0.0

Source File
get_attached_le() is located in wp-includes/post.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/get_attached_le" Categories: Functions | New page created

Function Reference/get attachment template Contents Description


Description Retrieve1path of attachment template in current or parent template. 2 Usage 3 Parameters The attachment path rst checks if the rst part of the mime type exists. The second check is for the second part of the mime type. The last 4 Return Values check is5 Examples for both types separated by an underscore. If neither are found then the le 'attachment.php' is checked and returned.

Some examples for the 'text/plain' mime type are 'text.php', 'plain.php', and nally 'text_plain.php'. 7 Change Log
8 Source File

6 Notes

Usage 9 Related

<?php get_attachment_template() ?>

Parameters
None.

Return Values
(string) Returns path of attachment template in current or parent template.

Examples Notes
Uses: get_query_template() Uses global: (object) $posts a property of the WP_Query object.

Change Log
Since: 2.0.0

Source File
get_attachment_template() is located in wp-includes/theme.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/get_attachment_template" Categories: Functions | New page created

Function Reference/get author feed link Contents


1 Description 2 Usage 3 Examples 3.1 Default Usage 4 Parameters 5 Note

Description
Returns a link to the feed for all posts by the specied author. A particular feed can be requested, but if the feed parameter is left blank, it returns the 'rss2' feed link.

Usage
<?php get_author_feed_link('author_id', 'feed'); ?>

Examples
Default Usage
Returns the rss2 feed link for post by author 2 <?php get_author_feed_link('2', ''); ?>

Parameters
author_id (string) Author ID of feed link to return. feed (string) Type of feed; possible values: rss, atom, rdf. Default: blank (returns rss2)

Note
Currently the parameter 'feed' is not evaluted by the function. Retrieved from "http://codex.wordpress.org/Function_Reference/get_author_feed_link"

Function Reference/get author template

Contents
1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
Retrieve path of author template in current or parent template.

Usage
<?php get_author_template() ?>

Parameters
None.

Return Values
(string) Returns result from get_query_template('author')

Examples Notes
Uses: get_query_template();

Change Log
Since: 1.5.0

Source File
get_author_template() is located in wp-includes/theme.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/get_author_template" Categories: Functions | New page created

Function Reference/get bloginfo rss Contents


1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
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.

Usage
<?php get_bloginfo_rss( $show ) ?>

Parameters
$show (string) (optional) See get_bloginfo() for possible values. Default: ''

Return Values
(string)

Examples Notes
See get_bloginfo() for the list of possible values to display. Uses: apply_lters() Calls 'get_bloginfo_rss' hook with two parameters.

Change Log
Since: 1.5.1

Source File
get_bloginfo_rss() is located in wp-includes/feed.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/get_bloginfo_rss" Categories: Functions | New page created

Function Reference/get bookmark Contents


1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
Retrieve Bookmark data based on bookmark link ID.

Usage
<?php get_bookmark( $bookmark, $output, $filter ) ?>

Parameters
$output (string) (optional) Either OBJECT, ARRAY_N, or ARRAY_A constant Default: OBJECT $lter (string) (optional) default is 'raw'. Default: 'raw'

Return Values
(array|object) Type returned depends on $output value.

Examples Notes
Uses global: (object) $wpdb Database Object

Change Log

Since: 2.1.0

Source File
get_bookmark() is located in wp-includes/bookmark.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/get_bookmark" Category: Functions

Function Reference/get cat ID


The get_cat_id() function is used to retrieve the ID of a category from its associated name (not the slug). This function accepts the category name (in string format) and returns the corresponding numerical ID. This is a very basic example of how to use the function. <?php $id = get_cat_id('Category Name'); $q = "cat=" . $id; query_posts($q); if (have_posts()) : while (have_posts()) : the_post(); the_content(); endwhile; endif; ?> Code example taken from an article from Curtis henson Retrieved from "http://codex.wordpress.org/Function_Reference/get_cat_ID"

Function Reference/get cat name Contents


1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
Retrieve the name of a category from its ID.

Usage
<?php get_cat_name( $cat_id ) ?>

Parameters
$cat_id (integer) (required) Category ID Default: None

Return Values
(string) Category name

Examples Notes Change Log


Since: 1.0.0

Source File
get_cat_name() is located in wp-includes/category.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/get_cat_name" Categories: Functions | New page created

Function Reference/get categories Contents


1 Description 2 Usage 3 Examples 3.1 Default Usage 3.2 Dropdown Box 4 Parameters

Description
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.

Usage
<?php $categories = get_categories(parameters); ?>

Examples
Default Usage
<?php $defaults = array('type' => 'post', 'child_of' => 0, 'orderby' => 'name', 'order' => 'ASC', 'hide_empty' => true, 'include_last_update_time' => false, 'hierarchical' => 1, 'exclude' => , 'include' => , 'number' => , 'pad_counts' => false);?>

Dropdown Box
Here's how to create a dropdown box of the subcategories of, say, a category that archives information on past events. This mirrors the example of the dropdown example of wp_get_archives which shows how to create a dropdown box for monthly archives. Suppose the category whose subcategories you want to show is category 10, and that its category "nicename" is "archives". <select name="event-dropdown" onchange='document.location.href=this.options[this.selectedIndex].value;'> <option value=""><?php echo attribute_escape(__('Select Event')); ?></option> <?php $categories= get_categories('child_of=10'); foreach ($categories as $cat) { $option = '<option value="/category/archives/'.$cat->category_nicename.'">'; $option .= $cat->cat_name; $option .= ' ('.$cat->category_count.')'; $option .= '</option>'; echo $option; } ?> </select>

Parameters
type (string) Type of category to retreive post - default

link child_of (integer) Only display categories that are children of the category identied by its ID. There is no default for this parameter. If the parameter is used, the hide_empty parameter is set to false. orderby (string) Sort categories alphabetically or by unique category ID. The default is sort by Category ID. Valid values: ID - default name order (string) Sort order for categories (either ascending or descending). The default is ascending. Valid values: asc - default desc hide_empty (boolean) Toggles the display of categories with no posts. The default is true (hide empty categories). Valid values: 1 (true) - default 0 (false) include_last_update_time (boolean) Uncertain what this doesies|the example]]. 1 (true) 0 (false) -- default hierarchical (boolean) Display sub-categories as inner list items (below the parent list item) or inline. The default is true (display sub-categories below the parent list item). Valid values: 1 (true) - default 0 (false) exclude (string) Excludes one or more categories from the list generated by wp_list_categories. This parameter takes a comma-separated list of categories by unique ID, in ascending order. See the example. include (string) Only include certain categories in the list generated by wp_list_categories. This parameter takes a comma-separated list of categories by unique ID, in ascending order. See the example. list - default. none number (string) The number of categories to return pad_counts (boolean) Calculates link or post counts by including items from child categories. Valid values: 1 (true) 0 (false) - default Retrieved from "http://codex.wordpress.org/Function_Reference/get_categories" Category: Functions

Function Reference/get category Contents


1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
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 lters and nally sanitized based on the $lter parameter value. The category will converted to maintain backwards compatibility.

Usage
<?php &get_category( $category, $output, $filter ) ?>

Parameters
$category (integer|object) (required) Category ID or Category row object Default: None $output (string) (optional) Constant OBJECT, ARRAY_A, or ARRAY_N Default: OBJECT $lter (string) (optional) Default is raw or no WordPress dened lter will applied. Default: 'raw'

Return Values
(mixed) Category data in type dened by $output parameter.

Examples Notes
Uses: get_term() Used to get the category data from the taxonomy.

Change Log
Since: 1.5.1

Source File
&get_category() is located in wp-includes/category.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/get_category" Categories: Functions | New page created

Function Reference/get category by path Contents


1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
Retrieve category based on URL containing the category slug. Breaks the $category_path parameter up to get the category slug. Tries to nd the child path and will return it. If it doesn't nd a match, then it will return the rst 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.

Usage
<?php get_category_by_path( $category_path, $full_match, $output ) ?>

Parameters
$category_path (string) (required) URL containing category slugs. Default: None $full_match (boolean) (optional) Whether should match full path or not. Default: true $output (string) (optional) Constant OBJECT, ARRAY_A, or ARRAY_N Default: OBJECT

Return Values
(null|object|array) Null on failure. Type is based on $output value.

Examples Notes Change Log


Since: 2.1.0

Source File
get_category_by_path() is located in wp-includes/category.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/get_category_by_path" Categories: Functions | New page created

Function Reference/get category by slug


This page is marked as incomplete. You can help Codex by expanding it. The get_category_by_slug() function is used to retrieve the ID of a category from its associated slug. This function accepts the category slug (in string format) and returns the corresponding numerical ID in the term_id property. <?php $idObj = get_category_by_slug('category-name'); $id = $idObj->term_id; ?> Practical Use: <?php echo category_description(get_category_by_slug('category-slug')->term_id); ?> Retrieved from "http://codex.wordpress.org/Function_Reference/get_category_by_slug" Categories: Stubs | Functions | New page created

Function Reference/get category feed link Contents


1 Description 2 Usage 3 Examples 3.1 Default Usage 3.2 Parameters 4 Deprecated Function

Description

Released with Version 2.5, this function returns a link to the feed for all posts in the specied category. A particular feed can be requested, but if the feed parameter is left blank, it returns the 'rss2' feed link. This function replaces the deprecated get_category_rss_link function.

Usage
<?php get_category_feed_link('cat_id', 'feed'); ?>

Examples
Default Usage
Return the rss2 feed link for post in category 2 <?php get_category_feed_link('2', ''); ?>

Parameters
cat_id (string) Category ID of feed link to return. feed (string) Type of feed, if left blank uses, by default, the 'rss2' feed.

Deprecated Function
get_category_rss_link Retrieved from "http://codex.wordpress.org/Function_Reference/get_category_feed_link" Categories: Functions | New page created

Function Reference/get category template Contents


1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
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 le doesn't exist.

Usage
<?php get_category_template() ?>

Parameters
None.

Return Values
(string) Returns path of category template in current or parent template.

Examples Notes
Uses: apply_lters() Calls 'category_template' on le path of category template. Uses: locate_template() Uses: get_query_var() on 'cat'.

Change Log

Since: 1.5.0

Source File
get_category_template() is located in wp-includes/theme.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/get_category_template" Categories: Functions | New page created

Function Reference/get children


get_children() retrieves attachments, revisions, or sub-Pages, possibly by post parent. It works similarly to get_posts().

Contents
1 Synopsis 2 Return values 3 Examples 4 Default parameters (Version 2.7) 5 Parameters 6 Related

Synopsis
array|false $children =& get_children( mixed $args = "", constant $output = OBJECT);

Return values
Returns an associative array of posts (of variable type set by `$output` parameter) with post IDs as array keys, or false if no posts are found.

Examples
$images =& get_children( 'post_type=attachment&post_mime_type=image' ); $videos =& get_children( 'post_type=attachment&post_mime_type=video/mp4' ); if ( empty($images) ) { // no attachments here } else { foreach ( $images as $attachment_id => $attachment ) { echo wp_get_attachment_image( $attachment_id, 'full' ); } } // If you don't need to handle an empty result:

foreach ( (array) $videos as $attachment_id => $attachment ) { echo wp_get_attachment_link( $attachment_id ); }

Default parameters (Version 2.7)


$defaults = array( 'post_parent' => 0, 'post_type' => 'any', 'numberposts' => -1, 'post_status' => 'any', );

Parameters
See get_posts() for a full list of parameters. As of Version 2.6, you must pass a non-empty post_type parameter (either attachment or page). $args (mixed) Passing a query-style string or array sets several parameters (below). Passing an integer post ID or a post object will retrieve children of that post; passing an empty value will retrieve children of the current post or Page.

$args['numberposts'] (integer) Number of child posts to retrieve. Optional; default: -1 (unlimited) $args['post_parent'] (integer) Pass the ID of a post or Page to get its children. Pass null to get any child regardless of parent. Optional; default: 0 (any parent?) $args['post_type'] (string) Any value from post_type column of the posts table, such as attachment, page, or revision; or the keyword any. Default: any $args['post_status'] (string) Any value from the post_status column of the wp_posts table, such as publish, draft, or inherit; or the keyword any. Default: any $args['post_mime_type'] (string) A full or partial mime-type, e.g. image, video, video/mp4, which is matched against a post's post_mime_type eld $output (constant) Variable type of the array items returned by the function: one of OBJECT, ARRAY_A, ARRAY_N. Optional; default: OBJECT

Related
get_children() calls get_posts(), which calls $WP_Query->get_posts(). wp_get_attachment_link() Retrieved from "http://codex.wordpress.org/Function_Reference/get_children" Categories: Functions | Attachments

Function Reference/get comment Contents


1 Description 2 Usage 3 Example 4 Parameters 5 Return 6 References

Description
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.

Usage
<?php get_comment($id, $output); ?>

Example
To get the author's name of a comment with ID 7: <?php $my_id = 7; $comment_id_7 = get_comment($my_id); $name = $comment_id_7->comment_author; ?> Alternatively, specify the $output parameter: <?php $my_id = 7; $comment_id_7 = get_comment($my_id, ARRAY_A); $name = $comment_id_7['comment_author']; ?> <?php ## Correct: pass a dummy variable as post_id $the_comment = & get_comment( $dummy_id = 7 ); ## Incorrect: literal integer as post_id $the_comment = & get_comment( 7 ); // Fatal error: 'Only variables can be passed for reference' or 'Cannot pass parameter 1 by reference' ?>

Parameters

$comment (integer) (required) The ID of the comment you'd like to fetch. You must pass a variable containing an integer (e.g. $id). A literal integer (e.g. 7) will cause a fatal error (Only variables can be passed for reference or Cannot pass parameter 1 by reference). Default: None $output (string) (required) How you'd like the result. OBJECT = as an object, ARRAY_A = as an associative array of eld names to values, and ARRAY_N = a scalar array of eld values. Default: None

Return
The elds returned are: comment_ID (integer) The comment ID comment_post_ID (integer) The post ID of the associated post comment_author (string) The comment author's name comment_author_email (string) The comment author's email comment_author_url (string) The comment author's webpage comment_author_IP (string) The comment author's IP comment_date (string) The datetime of the comment (YYYY-MM-DD HH:MM:SS) comment_date_gmt (string) The GMT datetime of the comment (YYYY-MM-DD HH:MM:SS) comment_content (string) The comment's contents comment_karma (integer) The comment's karma comment_approved (string) The comment approbation (0, 1 or 'spam') comment_agent (string) The comment's agent (browser, Operating System, etc.) comment_type (string) The comment's type if meaningfull (pingback|trackback), and empty for normal comments comment_parent (string) The parent comment's ID user_id (integer) The comment author's ID if he is registered (0 otherwise)

References
This article is marked as in need of editing. You can help Codex by editing it. Retrieved from "http://codex.wordpress.org/Function_Reference/get_comment" Categories: Copyedit | Functions

Function Reference/get comment author rss Contents


1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
Retrieve the current comment author for use in the feeds.

Usage

<?php get_comment_author_rss() ?>

Parameters
None.

Return Values
(string) Comment Author

Examples Notes
Uses: apply_lters() Calls 'comment_author_rss' hook on comment author. Uses: get_comment_author()

Change Log
Since: 2.0.0

Source File
get_comment_author_rss() is located in wp-includes/feed.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/get_comment_author_rss" Categories: Functions | New page created

Function Reference/get comment link Contents


1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
Retrieve the link to a given comment.

Usage
<?php get_comment_link( $comment, $args ) ?>

Parameters
$comment (object|string|integer) (optional) Comment to retrieve. Default: null $args (array) (optional) Optional args. Default: array

Return Values
(string) The permalink to the current comment

Examples Notes
Uses: get_comment() to retrieve $comment. Uses global: (unknown) $wp_rewrite

Uses global: (unknown) $in_comment_loop

Change Log
Since: 1.5.0

Source File
get_comment_link() is located in wp-includes/comment-template.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/get_comment_link" Categories: Functions | New page created

Function Reference/get comments popup template Contents


1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
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 commentpopup.php le from the default theme. The default theme must then exist for it to work.

Usage
<?php get_comments_popup_template() ?>

Parameters
None.

Return Values
(string) Returns the template path.

Examples Notes
Uses: apply_lters() Calls 'comments_popup_template' lter on path. Uses: locate_template() to locate 'comments-popup.php' le. Uses: get_theme_root()

Change Log
Since: 1.5.0

Source File
get_comments_popup_template() is located in wp-includes/theme.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/get_comments_popup_template" Categories: Functions | New page created

Function Reference/get current theme Contents


1 Description

2 Usage 3 Example 3.1 Usage

Description
Returns the name of the current theme.

Usage
<?php $theme_name = get_current_theme(); ?>

Example
Usage
Get the name of the current theme. <?php $theme_name = get_current_theme(); echo $theme_name; ?> This article is marked as in need of editing. You can help Codex by editing it. Retrieved from "http://codex.wordpress.org/Function_Reference/get_current_theme" Categories: Functions | Copyedit

Function Reference/get currentuserinfo Contents


1 Description 2 Usage 3 Examples 3.1 Default Usage 3.2 Using Separate Globals 4 Parameters

Description
Retrieves the information pertaining to the currently logged in user, and places it in the global variable $userdata. 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: $user_login $user_level $user_ID $user_email $user_url (User's website, as entered in the user's Prole) $user_pass_md5 (A md5 hash of the user password -- a type of encoding that is very nearly, if not entirely, impossible to decode, but useful for comparing input at a password prompt with the actual user password.) $display_name (User's name, displayed according to the 'How to display name' User option)

Usage
<?php get_currentuserinfo(); ?>

Examples
Default Usage
The call to get_currentuserinfo() places the current user's info into $userdata, where it can be retrieved using member variables. <?php global $current_user; get_currentuserinfo(); echo('Username: ' . $current_user->user_login . "\n"); echo('User email: ' . $current_user->user_email . "\n"); echo('User level: ' . $current_user->user_level . "\n"); echo('User first name: ' . $current_user->user_firstname . "\n");

echo('User last name: ' . $current_user->user_lastname . "\n"); echo('User display name: ' . $current_user->display_name . "\n"); echo('User ID: ' . $current_user->ID . "\n"); ?> Username: Zedd User email: my@email.com User level: 10 User rst name: John User last name: Doe User display name: John Doe User ID: 1

Using Separate Globals


Much of the user data is placed in separate global variables, which can be accessed directly. <?php global $display_name , $user_email; get_currentuserinfo(); echo($display_name . "'s email address is: " . $user_email); ?> Zedd's email address is: fake@email.com

: NOTE: $display_name does not appear to work in 2.5+? $user_login works ne.

<?php global $user_login , $user_email; get_currentuserinfo(); echo($user_login . "'s email address is: " . $user_email); ?>

Parameters
This function does not accept any parameters. To determine if there is a user currently logged in, do this: <?php global $user_ID; get_currentuserinfo(); if ('' == $user_ID) { //no user logged in } ?> Here is another IF STATEMENT Example. It was used in the sidebar, in reference to the "My Fav" plugin at http://www.kriesi.at/archives /wordpress-plugin-my-favorite-posts <?php if ( $user_ID ) { ?> <!-- enter info that logged in users will see --> <!-- in this case im running a bit of php to a plugin --> <?php mfp_display(); ?> <?php } else { ?> <!-- here is a paragraph that is shown to anyone not logged in --> <p>By <a href="<?php bloginfo('url'); ?>/wp-register.php">registering</a>, you can save your favorite posts for future <?php } ?>

This article is marked as in need of editing. You can help Codex by editing it. Retrieved from "http://codex.wordpress.org/Function_Reference/get_currentuserinfo" Categories: Functions | Copyedit

Function Reference/get date from gmt Contents


1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
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.

Usage
<?php get_date_from_gmt( $string ) ?>

Parameters
$string (string) (required) The date to be converted. Default: None

Return Values
(string) Formatted date relative to the GMT offset.

Examples Notes
Uses: get_option() to retrieve the value of 'gmt_offset'.

Change Log
Since: 1.2.0

Source File
get_date_from_gmt() is located in wp-includes/formatting.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/get_date_from_gmt" Categories: Functions | New page created

Function Reference/get date template Contents


1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description

Retrieve path of date template in current or parent template.

Usage
<?php get_date_template() ?>

Parameters
None.

Return Values
(string) Result of get_query_template('date').

Examples Notes
Uses: get_query_template()

Change Log
Since: 1.5.0

Source File
get_date_template() is located in wp-includes/theme.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/get_date_template" Categories: Functions | New page created

Function Reference/get enclosed Contents


1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
Retrieve enclosures already enclosed for a post.

Usage
<?php get_enclosed( $post_id ) ?>

Parameters
$post_id (integer) (required) Post ID. Default: None

Return Values
(array) List of enclosures.

Examples Notes
Uses: get_post_custom() on $post_id. Uses: apply_lters() on 'get_enclosed' on enclosures.

Change Log

Since: 1.5.0

Source File
get_enclosed() is located in wp-includes/post.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/get_enclosed" Categories: Functions | New page created

Function Reference/get extended Contents


1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
Get extended entry info ( <!--more--> ). 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 <code><!--more--></code> . The 'extended' key has the content after the <code><!--more--></code> comment.

Usage
<?php get_extended( $post ) ?>

Parameters
$post (string) (required) Post content. Default: None

Return Values
(array) Post before ('main') and after ('extended').

Examples Notes Change Log


Since: 1.0.0

Source File
get_extended() is located in wp-includes/post.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/get_extended" Categories: Functions | New page created

Function Reference/get gmt from date Contents


1 Description 2 Usage 3 Parameters 4 Return Values

5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
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.

Usage
<?php get_gmt_from_date( $string ) ?>

Parameters
$string (string) (required) The date to be converted. Default: None

Return Values
(string) GMT version of the date provided.

Examples Notes
Uses: get_option() to retrieve the value of the 'gmt_offset' option.

Change Log
Since: 1.2.0

Source File
get_gmt_from_date() is located in wp-includes/formatting.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/get_gmt_from_date" Categories: Functions | New page created

Function Reference/get header image Contents


1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
Retrieve header image for custom header.

Usage
<?php get_header_image() ?>

Parameters
None.

Return Values
(string)

Returns header image path.

Examples Notes
Uses: HEADER_IMAGE

Change Log
Since: 2.1.0

Source File
get_header_image() is located in wp-includes/theme.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/get_header_image" Categories: Functions | New page created

Function Reference/get header textcolor Contents


1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
Retrieve text color for custom header.

Usage
<?php get_header_textcolor() ?>

Parameters
None.

Return Values
(string)

Examples Notes
Uses: HEADER_TEXTCOLOR

Change Log
Since: 2.1.0

Source File
get_header_textcolor() is located in wp-includes/theme.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/get_header_textcolor" Categories: Functions | New page created

Function Reference/get home template Contents


1 Description 2 Usage

3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
Retrieve path of home template in current or parent template. Attempts to locate 'home.php' rst before falling back to 'index.php'.

Usage
<?php get_home_template() ?>

Parameters
None.

Return Values
(string) Returns path of home template in current or parent template.

Examples Notes
Uses: apply_lters() Calls 'home_template' on le path of home template. Uses: locate_template() on 'home.php' and 'index.php'.

Change Log
Since: 1.5.0

Source File
get_home_template() is located in wp-includes/theme.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/get_home_template" Categories: Functions | New page created

Function Reference/get lastcommentmodied Contents


1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
The date the last comment was modied. If $cache_lastcommentmodied is set this function returns its value from the cache without hitting the database.

Usage
<?php get_lastcommentmodified( $timezone ) ?>

Parameters
$timezone (string) (optional) Which timezone to use in reference to 'gmt', 'blog', or 'server' locations. Default: 'server'

Return Values
(string) Last comment modied date as a MySQL DATETIME.

Examples Notes
Uses: $wpdb to read from the comments table. Uses global: array $cache_lastcommentmodied

Change Log
Since: 1.5.0

Source File
get_lastcommentmodied() is located in wp-includes/comment.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/get_lastcommentmodied" Categories: Functions | New page created

Function Reference/get lastpostdate Contents


1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
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.

Usage
<?php get_lastpostdate( $timezone ) ?>

Parameters
$timezone (string) (optional) The location to get the time. Can be 'gmt', 'blog', or 'server'. Default: 'server'

Return Values
(string) The date of the last post.

Examples Notes
Uses: apply_lters() Calls 'get_lastpostdate' lter Uses global: (mixed) $cache_lastpostdate Stores the date the last post. Uses global: (object) $wpdb Uses global: (integer) $blog_id The Blog ID.

Change Log
Since: 0.71

Source File
get_lastpostdate() is located in wp-includes/post.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/get_lastpostdate" Categories: Functions | New page created

Function Reference/get lastpostmodied Contents


1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
Retrieve last post modied 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 modied. The 'gmt' is when the last post was modied in GMT time.

Usage
<?php get_lastpostmodified( $timezone ) ?>

Parameters
$timezone (string) (optional) The location to get the time. Can be 'gmt', 'blog', or 'server'. Default: 'server'

Return Values
(string) The date the post was last modied.

Examples Notes
Uses: apply_lters() Calls 'get_lastpostmodied' lter Uses global: (mixed) $cache_lastpostmodied Stores the date the last post was last modied. Uses global: (object) $wpdb Uses global: (integer) $blog_id The Blog ID.

Change Log
Since: 1.2.0

Source File
get_lastpostmodied() is located in wp-includes/post.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/get_lastpostmodied" Categories: Functions | New page created

Function Reference/get locale Contents


1 Description 2 Usage 3 Parameters 4 Return Values

5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
Gets the current locale. If the locale is set, then it will lter the locale in the 'locale' lter hook and return the value. If the locale is not set already, then the WPLANG constant is used if it is dened. Then it is ltered through the 'locale' lter 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 ltered using the 'locale' hook.

Usage
<?php get_locale() ?>

Parameters
None.

Return Values
(string) The locale of the blog or from the 'locale' hook.

Examples Notes
Uses: apply_lters() Calls 'locale' hook on locale value. Uses: $locale Gets the locale stored in the global. Uses global: (unknown) $locale l10n is an abbreviation for localization.

Change Log
Since: 1.5.0

Source File
get_locale() is located in wp-includes/l10n.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/get_locale" Categories: Functions | New page created

Function Reference/get locale stylesheet uri Contents


1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
Retrieve localized stylesheet URI. The stylesheet directory for the localized stylesheet les are located, by default, in the base theme directory. The name of the locale le 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' lter or the 'locale_stylesheet_uri'

lter. If you want to change the location of the stylesheet les for the entire WordPress workow, then change the former. If you just have the locale in a separate folder, then change the latter.

Usage
<?php get_locale_stylesheet_uri() ?>

Parameters
None.

Return Values
(string) Returns localized stylesheet URI.

Examples Notes
Uses global: (object) $wp_locale handles the date and time locales. Uses: apply_lters() Calls 'locale_stylesheet_uri' lter on stylesheet URI path and stylesheet directory URI. Uses: get_stylesheet_directory_uri() Uses: get_stylesheet_directory() Uses: get_locale()

Change Log
Since: 2.1.0

Source File
get_locale_stylesheet_uri() is located in wp-includes/theme.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/get_locale_stylesheet_uri" Categories: Functions | New page created

Function Reference/get num queries Contents


1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
Retrieve the number of database queries during the WordPress execution.

Usage
<?php get_num_queries() ?>

Parameters
None.

Return Values
(integer) Number of database queries

Examples Notes
Uses global: (object) $wpdb

Change Log
Since: 2.0.0

Source File
get_num_queries() is located in wp-includes/functions.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/get_num_queries" Categories: Functions | New page created

Function Reference/get option Contents


1 Description 2 Usage 3 Examples 3.1 Show Blog Title 3.2 Show Character Set 3.3 Retrieve Administrator E-mail 4 Parameters 5 Related

Description
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.

Usage
<?php echo get_option('show'); ?>

Examples
Show Blog Title
Displays your blog's title in a <h1> tag. <h1><?php echo get_option('blogname'); ?></h1>

Show Character Set


Displays the character set your blog is using (ex: UTF-8) <p>Character set: <?php echo get_option('blog_charset'); ?> </p>

Retrieve Administrator E-mail


Retrieve the e-mail of the blog administrator, storing it in a variable. <?php $admin_email = get_option('admin_email'); ?>

Parameters
$show (string) (required) Name of the option to retrieve. A list of valid default options can be found at the Option Reference. Default: None

Related
add_option, update_option bloginfo, bloginfo_rss, get_bloginfo, get_bloginfo_rss, wp_title, wp_get_archives, get_calendar, get_posts, wp_list_pages, wp_page_menu, wp_dropdown_pages, wp_loginout, wp_register, wp_logout_url, query_posts, rss_enclosure

How to pass parameters to tags Go to Template Tag index

Retrieved from "http://codex.wordpress.org/Function_Reference/get_option" Categories: Template Tags | Functions

Function Reference/get page


This page is marked as incomplete. You can help Codex by expanding it.

Description
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. Wrong way: $p = get_page(2); // Error: Only variables can be passed by reference Right Way: $n = 2; $p = get_page($n); Why? I think it's a PHP bug Get title: $p->post_title Get Content $p->post_content Retrieved from "http://codex.wordpress.org/Function_Reference/get_page" Categories: Stubs | Functions

Function Reference/get page by path


This page is marked as incomplete. You can help Codex by expanding it.

Description
This is the equivalent of the "pagename" query, as in: "index.php?pagename=parent-page/sub-page".

Example for wp 2.3.X or newer


Code for the above would be: get_page_by_path('parent-page/sub-page'); Retrieved from "http://codex.wordpress.org/Function_Reference/get_page_by_path" Categories: Stubs | Functions

Function Reference/get page by title Description


The Function, get_page_by_title(), returns a page object when given a string parameter containing the page name. The page name correlates to the Title text eld when creating or editing a page in the administration panel. Retrieved from "http://codex.wordpress.org/Function_Reference/get_page_by_title" Categories: Functions | New page created

Function Reference/get page children Contents


1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
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.

Usage
<?php &get_page_children( $page_id, $pages ) ?> <?php get_page_children( $page_id, $pages ) ?>

Parameters
$page_id (integer) (required) Page ID. Default: None $pages (array) (required) List of pages' objects. Default: None

Return Values
(array)

Examples Notes
This function calls itself recursively.

Change Log
Since: 1.5.1

Source File
&get_page_children() is located in wp-includes/post.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/get_page_children" Categories: Functions | New page created

Function Reference/get page hierarchy Description


This function, get_page_hierarchy(), returns an array sorted by the page sort order. It takes two parameters, a page listing object and a parent id (optional) It is dened in the wp-includes/post.php le. Retrieved from "http://codex.wordpress.org/Function_Reference/get_page_hierarchy"

Function Reference/get page template Contents


1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
Retrieve path of page template in current or parent template. First attempt is to look for the le in the '_wp_page_template' page meta data. The second attempt, if the rst has a le and is not empty, is to look for 'page.php'.

Usage
<?php get_page_template() ?>

Parameters
None.

Return Values
(string) Returns path of page template in current or parent template.

Examples Notes
Uses: get_post_meta() Uses: validate_le() Uses: apply_lters() on 'page_template' on result of locate_template(). Uses: locate_template() Uses global: (object) $wp_query

Change Log
Since: 1.5.0

Source File
get_page_template() is located in wp-includes/theme.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/get_page_template" Categories: Functions | New page created

Function Reference/get page uri Contents


1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
Builds URI for a page. Sub pages will be in the "directory" under the parent page post name.

Usage
<?php get_page_uri( $page_id ) ?>

Parameters
$page_id (integer) (required) Page ID. Default: None

Return Values
(string) Page URI.

Examples Notes Change Log


Since: 1.5.0

Source File
get_page_uri() is located in wp-includes/post.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/get_page_uri" Categories: Functions | New page created

Function Reference/get paged template Contents


1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
Retrieve path of paged template in current or parent template.

Usage
<?php get_paged_template() ?>

Parameters
None.

Return Values
(string) Result of get_query_template('paged').

Examples Notes
Uses: get_query_template()

Change Log
Since: 1.5.0

Source File
get_paged_template() is located in wp-includes/theme.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/get_paged_template" Categories: Functions | New page created

Function Reference/get pages Contents


1 Description 2 Usage 3 Example 3.1 Displaying pages in dropdown list 3.2 Displaying Child pages of the current page in post format 4 Parameters 5 Return 6 Related

Description
Function get_pages() is used to get a list of all the pages that are dened in the blog. Here is a typical usage.

Usage
<?php get_pages('arguments'); ?>

Example
Displaying pages in dropdown list
In this example a dropdown list with all the pages. Note how you can grab the link for the page with a simple call to the function get_page_link passing the ID of the page.

<select name=\"page-dropdown\" onchange='document.location.href=this.options[this.selectedIndex].value;'> <option value=\"\"> <?php echo attribute_escape(__('Select page')); ?></option> <?php $pages = get_pages(); foreach ($pages as $pagg) { $option = '<option value=\"'.get_page_link($pagg->ID).'\">'; $option .= $pagg->post_title; $option .= '</option>'; echo $option; } ?> </select>

Displaying Child pages of the current page in post format


<?php $pages = get_pages('child_of='.$post->ID.'&sort_column=post_date&sort_order=desc'); $count = 0; foreach($pages as $page) { $content = $page->post_content; if(!$content) continue; if($count >= 2) break; $count++; $content = apply_filters('the_content', $content); ?> <h2><a href=\"<?php echo get_page_link($page->ID) ?>\"><?php echo $page->post_title ?></a></h2> <div class=\"entry\"><?php echo $content ?></div> <?php } ?>

Parameters
sort_column (string) Sorts the list of Pages in a number of different ways. The default setting is sort alphabetically by Page title. 'post_title' - Sort Pages alphabetically (by title) - default 'menu_order' - Sort Pages by Page Order. N.B. Note the difference between Page Order and Page ID. The Page ID is a unique number assigned by WordPress to every post or page. The Page Order can be set by the user in the Write>Pages administrative panel. 'post_date' - Sort by creation time. 'post_modied' - Sort by time last modied. 'ID' - Sort by numeric Page ID. 'post_author' - Sort by the Page author's numeric ID. 'post_name' - Sort alphabetically by Post slug. Note: The sort_column parameter can be used to sort the list of Pages by the descriptor of any eld in the wp_post table of the WordPress database. Some useful examples are listed here.

sort_order (string) Change the sort order of the list of Pages (either ascending or descending). The default is ascending. Valid values: 'asc' - Sort from lowest to highest (Default). 'desc' - Sort from highest to lowest. exclude (string) Dene a comma-separated list of Page IDs to be excluded from the list (example: 'exclude=3,7,31'). There is no default value. include (string) Only include certain Pages in the list generated by get_pages. Like exclude, this parameter takes a comma-separated list of Page IDs. There is no default value. child_of (integer) Displays the sub-pages of a single Page only; uses the ID for a Page as the value. Defaults to 0 (displays all Pages). Note that the child_of parameter will also fetch "grandchildren" of the given ID, not just direct descendants. 0 - default, no child of restriction parent (integer) Displays those pages that have this ID as a parent. Defaults to -1 (displays all Pages regardless of parent). Note that this can be used to limit the 'depth' of the child_of parameter, so only one generation of descendants might be retrieved. -1 - default, no parent restriction exclude_tree (integer) The opposite of 'child_of', 'exclude_tree' will remove all children of a given ID from the results. Useful for hiding all children of a given page. Can also be used to hide grandchildren in conjunction with a 'child_of' value. This parameter was available at Version 2.7. hierarchical (boolean) Display sub-Pages in an indented manner below their parent or list the Pages inline. The default is true (display sub-Pages indented below the parent list item). Valid values: 1 (true) - default 0 (false) meta_key (string) Only include the Pages that have this Custom Field Key (use in conjunction with the meta_value eld). meta_value (string) Only include the Pages that have this Custom Field Value (use in conjuntion with the meta_key eld). authors (string) Only include the Pages written by the given author(s)

Return
An array containing all the Pages matching the request

Related
Function Reference This article is marked as in need of editing. You can help Codex by editing it. Retrieved from "http://codex.wordpress.org/Function_Reference/get_pages" Categories: Copyedit | Functions | New page created

Function Reference/get post Contents


1 Description 2 Usage 3 Example 4 Parameters 5 Return 6 References

Description
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.

Usage
<?php get_post($post, $output); ?>

Example
To get the title for a post with ID 7: <?php $my_id = 7; $post_id_7 = get_post($my_id); $title = $post_id_7->post_title; ?> Alternatively, specify the $output parameter: <?php $my_id = 7; $post_id_7 = get_post($my_id, ARRAY_A); $title = $post_id_7['post_title']; ?> <?php ## Correct: pass a dummy variable as post_id $the_post = & get_post( $dummy_id = 7 ); ## Incorrect: literal integer as post_id $the_post = & get_post( 7 ); // Fatal error: 'Only variables can be passed for reference' or 'Cannot pass parameter 1 by reference' ?>

Parameters
$post (integer) (required) The ID of the post you'd like to fetch. You must pass a variable containing an integer (e.g. $id). A literal integer (e.g. 7) will cause a fatal error (Only variables can be passed for reference or Cannot pass parameter 1 by reference). Default: None $output (string) (optional) How you'd like the result. OBJECT - returns an object ARRAY_A - Returns an associative array of eld names to values ARRAY_N - returns a numeric array of eld values Default: OBJECT

Return
The elds returned are: ID (integer) The post ID post_author (integer) The post author's ID post_date (string) The datetime of the post (YYYY-MM-DD HH:MM:SS) post_date_gmt (string) The GMT datetime of the post (YYYY-MM-DD HH:MM:SS) post_content (string) The post's contents post_title (string) The post's title post_category (integer) The post category's ID. Note that this will always be 0 (zero) from wordpress 2.1 onwards. To determine a post's category or categories, use get_the_category(). post_excerpt (string) The post excerpt post_status (string) The post status (publish|pending|draft|private|static|object|attachment|inherit|future) comment_status (string) The comment status (open|closed|registered_only) ping_status (string) The pingback/trackback status (open|closed) post_password (string) The post password

post_name (string) The post's URL slug to_ping (string) URLs to be pinged pinged (string) URLs already pinged post_modied (string) The last modied datetime of the post (YYYY-MM-DD HH:MM:SS) post_modied_gmt (string) The last modied GMT datetime of the post (YYYY-MM-DD HH:MM:SS) post_content_ltered (string) post_parent (integer) The parent post's ID (for attachments, etc) guid (string) A link to the post. Note: One cannot rely upon the GUID to be the permalink (as it previously was in pre-2.5), Nor can you expect it to be a valid link to the post. It's mearly a unique identier, which so happens to be a link to the post at present. menu_order (integer) post_type (string) (post|page|attachment) post_mime_type (string) Mime Type (for attachments, etc) comment_count (integer) Number of comments

References
get_post method not working NB: "This topic has been closed to new replies." This article is marked as in need of editing. You can help Codex by editing it. Retrieved from "http://codex.wordpress.org/Function_Reference/get_post" Categories: Copyedit | Functions

Function Reference/get post comments feed link Contents


1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
Retrieve the permalink for the post comments feed.

Usage
<?php get_post_comments_feed_link( $post_id, $feed ) ?>

Parameters
$post_id (integer) (optional) Post ID. Default: '' $feed (string) (optional) Feed type. Default: ''

Return Values
(string)

Examples

Notes
Uses global: (integer) $id

Change Log
Since: 2.2.0

Source File
get_post_comments_feed_link() is located in wp-includes/link-template.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/get_post_comments_feed_link" Categories: Functions | New page created

Function Reference/get post custom Contents


1 Description 2 Usage 3 Examples 3.1 Default Usage 3.2 Retrieving data from the array 4 Parameters 5 Related

Description
Returns a multidimensional array with all custom elds of a particular post or page. See also get_post_custom_keys() and get_post_custom_values()

Usage
<?php get_post_custom($post_id); ?>

Examples
Default Usage
Use the following example to set a variable ($custom_elds) as a multidimensional array containing all custom elds of the current post. <?php $custom_fields = get_post_custom(); ?>

Retrieving data from the array


The following example will retrieve all custom eld values with the key my_custom_eld from the post with the ID 72 (assuming there are three custom elds with this key, and the values are "dogs", "47" and "This is another value"). <?php $custom_fields = get_post_custom('72'); $my_custom_field = $custom_fields['my_custom_field']; foreach ( $my_custom_field as $key => $value ) echo $key . " => " . $value . "<br />"; ?>

0 => dogs 1 => 47 2 => This is another value

Parameters
$post_id (integer) (optional) The post ID whose custom elds will be retrieved.

Default: Current post

Related
add_post_meta(), delete_post_meta(), get_post_meta(), update_post_meta(), get_post_custom_values(), get_post_custom_keys() Retrieved from "http://codex.wordpress.org/Function_Reference/get_post_custom" Categories: Functions | Needs Review

Function Reference/get post custom keys Contents


1 Description 2 Usage 3 Examples 3.1 Default Usage 4 Parameters 5 Related

Description
Returns an array containing the keys of all custom elds of a particular post or page. See also get_post_custom() and get_post_custom_values()

Usage
<?php get_post_custom_keys($post_id); ?>

Examples
Default Usage
The following example will set a variable ($custom_eld_keys) as an array containing the keys of all custom elds in the current post, and then print it. Note: the if test excludes values for WordPress internally maintained custom keys such as _edit_last and _edit_lock. <?php $custom_field_keys = get_post_custom_keys(); foreach ( $custom_field_keys as $key => $value ) { $valuet = trim($value); if ( '_' == $valuet{0} ) continue; echo $key . " => " . $value . "<br />"; } ?> If the post contains custom elds with the keys mykey and yourkey, the output would be something like:

0 => mykey 1 => yourkey

Note: Regardless of how many values (custom elds) are assigned to one key, that key will only appear once in this array.

Parameters
$post_id (integer) (optional) The post ID whose custom eld keys will be retrieved. Default: Current post

Related
add_post_meta(), delete_post_meta(), get_post_meta(), update_post_meta(), get_post_custom(), get_post_custom_values() Retrieved from "http://codex.wordpress.org/Function_Reference/get_post_custom_keys" Categories: Functions | Needs Review

Function Reference/get post custom values Contents


1 Description 2 Usage 3 Examples 3.1 Default Usage 4 Parameters 5 Related

Description
This function is useful if you wish to access a custom eld that is not unique, ie. 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 elds with a particular key ($key) of a post with ID $post_id (defaults to the current post if unspecied). Returns nothing if no such key exists, or none is entered. See also get_post_custom() and get_post_custom_keys().

Usage
<?php get_post_custom_values($key, $post_id); ?>

Examples
Default Usage
Let's assume the current post has 3 values associated with the (custom) eld my_key. You could show them through: <?php $mykey_values = get_post_custom_values('my_key'); foreach ( $mykey_values as $key => $value ) { echo "$key => $value ('my_key')<br />"; } ?> 0 => First value ('my_key') 1 => Second value ('my_key') 2 => Third value ('my_key')

Parameters
$key (string) (required) The key whose values you want returned. Default: None $post_id (integer) (optional) The post ID whose custom elds will be retrieved. Default: Current post

Related
add_post_meta(), delete_post_meta(), get_post_meta(), update_post_meta(), get_post_custom(), get_post_custom_keys() Retrieved from "http://codex.wordpress.org/Function_Reference/get_post_custom_values" Categories: Functions | Needs Review

Function Reference/get post meta Contents


1 Description 2 Usage 3 Examples 3.1 Default Usage

3.2 Other Example 4 Parameters 5 Return 6 Related

Description
This function returns the values of the custom elds with the specied key from the specied post. See also update_post_meta(), delete_post_meta() and add_post_meta().

Usage
<?php $meta_values = get_post_meta($post_id, $key, $single); ?>

Examples
Default Usage
<?php $key_1_values = get_post_meta(76, 'key_1'); ?>

Other Example
To retrieve only the rst value of a given key: <?php $key_1_value = get_post_meta(76, 'key_1', true); ?> For a more detailed example, go to the post_meta Functions Examples page.

Parameters
$post_id (integer) (required) The ID of the post from which you want the data. Use $post->ID to get a post's ID. Default: None $key (string) (required) A string containing the name of the meta value you want. Default: None $single (boolean) (optional) If set to true then the function will return a single result, as a string. If false, or not set, then the function returns an array of the custom elds. Default: false

Return
If $single is set to false, or left blank, the function returns an array containing all values of the specied key. If $single is set to true, the function returns the rst value of the specied key (not in an array) The function returns an empty string if the key has not yet been set, regardless of the value of $single.

Related
update_post_meta(), delete_post_meta(), add_post_meta(), get_post_custom(), get_post_custom_values(), get_post_custom_keys() Retrieved from "http://codex.wordpress.org/Function_Reference/get_post_meta" Categories: Functions | New page created | Needs Review

Function Reference/get post mime type Contents


1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description

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.

Usage
<?php get_post_mime_type( $ID ) ?>

Parameters
$ID (integer) (optional) Post ID. Default: ''

Return Values
(boolean|string) False on failure or returns the mime type

Examples Notes Change Log


Since: 2.0.0

Source File
get_post_mime_type() is located in wp-includes/post.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/get_post_mime_type" Categories: Functions | New page created

Function Reference/get post status Contents


1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
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.

Usage
<?php get_post_status( $ID ) ?>

Parameters
$ID (integer) (optional) Post ID. This function will will return false if $ID is not provided. Default: ''

Return Values
(string|boolean) Post status or false on failure.

Examples Notes

Change Log
Since: 2.0.0

Source File
get_post_status() is located in wp-includes/post.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/get_post_status" Categories: Functions | New page created

Function Reference/get post type Contents


1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
Retrieve the post type of the current post or of a given post.

Usage
<?php get_post_type( $post ) ?>

Parameters
$post (mixed) (optional) Post object or post ID. Default: false

Return Values
(boolean|string) post type or false on failure.

Examples Notes
Uses: $wpdb Uses: $posts The Loop post global

Change Log
Since: 2.1.0

Source File
get_post_type() is located in wp-includes/post.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/get_post_type" Categories: Functions | New page created

Function Reference/get prole Contents


1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes

7 Change Log 8 Source File 9 Related

Description
Retrieve user data based on eld. Use get_prole() 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 prole 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_prole() that (empty|null|false) values are handled and that something is at least displayed.

Usage
<?php get_profile( $field, $user ) ?>

Parameters
$eld (string) (required) User eld to retrieve. See users table for possible $eld values. Default: None $user (string) (optional) User username. Uses user cookie to determine user if this is false or omitted. Default: false

Return Values
(string) The value in the eld.

Examples Notes
Uses: $wpdb Reads from the users table.

Change Log
Since: 1.5.0

Source File
get_prole() is located in wp-includes/user.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/get_prole" Categories: Functions | New page created

Function Reference/get pung Contents


1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
Retrieve URLs already pinged for a post.

Usage
<?php get_pung( $post_id ) ?>

Parameters
$post_id (integer) (required) Post ID. Default: None

Return Values
(array) Returns array of pinged URLs.

Examples Notes
Uses global: (object) $wpdb to retrieve pinged URLs from the _posts table in the database. Uses: apply_lters() on 'get_pung' on pinged URLs.

Change Log
Since: 1.5.0

Source File
get_pung() is located in wp-includes/post.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/get_pung" Categories: Functions | New page created

Function Reference/get query template Contents


1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
Retrieve path to le without the use of extension. Used to quickly retrieve the path of le without including the le extension. It will also check the parent template, if the le exists, with the use of locate_template(). Allows for more generic le location without the use of the other get_*_template() functions. Can be used with include() or require() to retrieve path. if ( '' != get_query_template( '404' ) ) include( get_query_template( '404' ) ); or the same can be accomplished with if ( '' != get_404_template() ) include( get_404_template() );

Usage
<?php get_query_template( $type ) ?>

Parameters
$type (string) (required) Filename without extension. Default: None

Return Values

(string) Full path to le.

Examples Notes
Uses: apply_lters() on "{$type}_template" on result from locate_template(). Uses: locate_template() on "{$type}.php".

Change Log
Since: 1.5.0

Source File
get_query_template() is located in wp-includes/theme.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/get_query_template" Categories: Functions | New page created

Function Reference/get rss Contents


1 Description 2 Usage 3 Example 4 Parameters 5 Output 6 Further reading

Description
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.

Usage
<?php require_once(ABSPATH . WPINC . '/rss-functions.php'); get_rss($uri, $num = 5); ?>

Example
The get_rss() function only outputs the list items, not the surrounding list tags itself. So, to get and display an ordered list of 5 links from an existing RSS feed: <?php require_once(ABSPATH . WPINC . '/rss-functions.php'); echo '<ol>'; get_rss('http://example.com/rss/feed/goes/here'); echo '</ol>'; ?>

Parameters
$uri (URI) (required) The URI of the RSS feed you want to retrieve. The resulting parsed feed is returned, with the more interesting and useful bits in the items array. Default: None $num (integer) (optional) The number of items to display. Default: 5

Output
The output from the above example will look like the following: <ol> <li> <a href='LINK FROM FEED' title='DESCRIPTION FROM FEED'>TITLE FROM FEED</a><br /> </li> (repeat for number of links specified) </ol>

Further reading
Function_Reference Retrieved from "http://codex.wordpress.org/Function_Reference/get_rss" Category: Functions

Function Reference/get search comments feed link Contents


1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
Retrieve the permalink for the comments feed of the search results.

Usage
<?php get_search_comments_feed_link( $search_query, $feed ) ?>

Parameters
$search_query (string) (optional) Url search query. Default: '' $feed (string) (optional) Feed type. Default: ''

Return Values
(string)

Examples Notes
Uses: get_search_query() if no query supplied.

Change Log
Since: 2.5.0

Source File
get_search_comments_feed_link() is located in wp-includes/link-template.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/get_search_comments_feed_link" Categories: Functions | New page created

Function Reference/get search feed link

Contents
1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
Retrieve the permalink for the feed of the search results.

Usage
<?php get_search_feed_link( $search_query, $feed ) ?>

Parameters
$search_query (string) (optional) URL search query. Default: '' $feed (string) (optional) Feed type. Default: ''

Return Values
(string) Returns a url after the 'search_feed_link' lters have been applied.

Examples Notes
Uses: get_search_query() if no query supplied.

Change Log
Since: 2.5.0

Source File
get_search_feed_link() is located in wp-includes/link-template.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/get_search_feed_link" Categories: Functions | New page created

Function Reference/get search template Contents


1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
Retrieve path of search template in current or parent template.

Usage

<?php get_search_template() ?>

Parameters
None.

Return Values
(string) Result of get_query_template('search').

Examples Notes
Uses: get_query_template()

Change Log
Since: 1.5.0

Source File
get_search_template() is located in wp-includes/theme.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/get_search_template" Categories: Functions | New page created

Function Reference/get single template Contents


1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
Retrieve path of single template in current or parent template.

Usage
<?php get_single_template() ?>

Parameters
None.

Return Values
(string) Result of get_query_template('single').

Examples Notes
Uses: get_query_template()

Change Log
Since: 1.5.0

Source File
get_single_template() is located in wp-includes/theme.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/get_single_template" Categories: Functions | New page created

Function Reference/get stylesheet Contents


1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
Retrieve name of the current stylesheet. The theme name that the administrator has currently set the front end theme as. For all extensive purposes, the template name and the stylesheet name are going to be the same for most cases.

Usage
<?php get_stylesheet() ?>

Parameters
None.

Return Values
(string) Stylesheet name.

Examples Notes
Uses: apply_lters() Calls 'stylesheet' lter on stylesheet name. Uses: get_option() to retrieve the 'stylesheet' option.

Change Log
Since: 1.5.0

Source File
get_stylesheet() is located in wp-includes/theme.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/get_stylesheet" Categories: Functions | New page created

Function Reference/get stylesheet directory Contents


1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description

Retrieve stylesheet directory path for current theme.

Usage
<?php get_stylesheet_directory() ?>

Parameters
None.

Return Values
(string) Path to current theme directory.

Examples Notes
Uses: apply_lters() Calls 'stylesheet_directory' lter on stylesheet path and name. Uses: get_stylesheet() Uses: get_theme_root()

Change Log
Since: 1.5.0

Source File
get_stylesheet_directory() is located in wp-includes/theme.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/get_stylesheet_directory" Categories: Functions | New page created

Function Reference/get stylesheet directory uri Contents


1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
Retrieve stylesheet directory URI.

Usage
<?php get_stylesheet_directory_uri() ?>

Parameters
None.

Return Values
(string) Returns stylesheet directory URI.

Examples Notes
Uses: apply_lters() Calls 'stylesheet_directory_uri' lter on stylesheet path and name. Uses: get_stylesheet() Uses: get_theme_root()

Change Log
Since: 1.5.0

Source File
get_stylesheet_directory_uri() is located in wp-includes/theme.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/get_stylesheet_directory_uri" Categories: Functions | New page created

Function Reference/get stylesheet uri Contents


1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
Retrieve URI of current theme stylesheet. The stylesheet le name is 'style.css' which is appended to get_stylesheet_directory_uri() path.

Usage
<?php get_stylesheet_uri() ?>

Parameters
None.

Return Values
(string) Returns URI of current theme stylesheet.

Examples Notes
Uses: apply_lters() Calls 'stylesheet_uri' lter on stylesheet URI path and stylesheet directory URI. Uses: get_stylesheet_directory_uri()

Change Log
Since: 1.5.0

Source File
get_stylesheet_uri() is located in wp-includes/theme.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/get_stylesheet_uri" Categories: Functions | New page created

Function Reference/get tag Contents


1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes

7 Change Log 8 Source File 9 Related

Description
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 lters and nally sanitized based on the $lter parameter value.

Usage
<?php &get_tag( $tag, $output, $filter ) ?>

Parameters
$tag (integer|object) (required) Default: None $output (string) (optional) Constant OBJECT, ARRAY_A, or ARRAY_N Default: OBJECT $lter (string) (optional) Default is raw or no WordPress dened lter will applied. Default: 'raw'

Return Values
(object|array) Return type based on $output value.

Examples Notes Change Log


Since: 2.3.0

Source File
&get_tag() is located in wp-includes/category.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/get_tag" Categories: Functions | New page created

Function Reference/get tags


Taken and slightly altered from the notes in the taxonomy.php le for get_terms, on which this function relies: Retrieves a list of post tags based on the criteria provided in $args. The list of arguments that $args can contain, which will overwrite the defaults: orderby - Default is 'name'. Can be name, count, or nothing (will use term_id). order - Default is ASC. Can use DESC. hide_empty - Default is true. Will not return empty terms, which means terms whose count is 0 according to the given taxonomy. exclude - Default is an empty string. A comma- or space-delimited string of term ids to exclude from the return array. If 'include' is non-empty, 'exclude' is ignored. include - Default is an empty string. A comma- or space-delimited string of term ids to include in the return array. number - The maximum number of terms to return. Default is empty.

offset - The number by which to offset the terms query. elds - Default is 'all', which returns an array of term objects. If 'elds' is 'ids' or 'names', returns an array of integers or strings, respectively. slug - Returns terms whose "slug" matches this value. Default is empty string. hierarchical - Whether to include terms that have non-empty descendants (even if 'hide_empty' is set to true). search - Returned terms' names will contain the value of 'search', case-insensitive. Default is an empty string. name__like - Returned terms' names will begin with the value of 'name__like', case-insensitive. Default is empty string. The argument 'pad_counts', if set to true will include the quantity of a term's children in the quantity of each term's "count" object variable. The 'get' argument, if set to 'all' instead of its default empty string, returns terms regardless of ancestry or whether the terms are empty. The 'child_of' argument, when used, should be set to the integer of a term ID. Its default is 0. If set to a non-zero value, all returned terms will be descendants of that term according to the given taxonomy. Hence 'child_of' is set to 0 if more than one taxonomy is passed in $taxonomies, because multiple taxonomies make term ancestry ambiguous. The 'parent' argument, when used, should be set to the integer of a term ID. Its default is the empty string, which has a different meaning from the integer 0. If set to an integer value, all returned terms will have as an immediate ancestor the term whose ID is specied by that integer according to the given taxonomy. The 'parent' argument is different from 'child_of' in that a term X is considered a 'parent' of term Y only if term X is the father of term Y, not its grandfather or great-grandfather, etc.

Related
the_tags get_the_tags get_the_tag_list This article is marked as in need of editing. You can help Codex by editing it. Retrieved from "http://codex.wordpress.org/Function_Reference/get_tags" Categories: Functions | Copyedit

Function Reference/get template Contents


1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
Retrieve name of the current theme.

Usage
<?php get_template() ?>

Parameters
None.

Return Values
(string) Template name.

Examples Notes
Uses: apply_lters() Calls 'template' lter on template option. Uses: get_option() to retrieve 'template' option.

Change Log
Since: 1.5.0

Source File
get_template() is located in wp-includes/theme.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/get_template" Categories: Functions | New page created

Function Reference/get template directory Contents


1 Description 2 Usage 3 Possible Arguments 4 Returns

Description
Retrieves the absolute path to the template directory.

Usage
echo get_template_directory();

Possible Arguments
None

Returns
The path to the template directory e.g. /yourpathhere/wp-content/themes/theme_name This article is marked as in need of editing. You can help Codex by editing it. Retrieved from "http://codex.wordpress.org/Function_Reference/get_template_directory" Categories: Functions | New page created | Copyedit

Function Reference/get template directory uri Contents


1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
Retrieve template directory URI.

Usage
<?php get_template_directory_uri() ?>

Parameters
None.

Return Values
(string) Template directory URI.

Examples Notes
Uses: apply_lters() Calls 'template_directory_uri' lter on template directory URI path and template name. Uses: get_template() Uses: get_theme_root_uri()

Change Log
Since: 1.5.0

Source File
get_template_directory_uri() is located in wp-includes/theme.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/get_template_directory_uri" Categories: Functions | New page created

Function Reference/get term by Contents


1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
Get all Term data from database by Term eld and data. Warning: $value is not escaped for 'name' $eld. You must do it yourself, if required. The default $eld is 'id', therefore it is possible to also use null for eld, but not recommended that you do so. If $value does not exist, the return value will be false. If $taxonomy exists and $eld and $value combinations exist, the Term will be returned.

Usage
<?php get_term_by( $field, $value, $taxonomy, $output, $filter ) ?>

Parameters
$eld (string) (required) Either 'slug', 'name', or 'id' Default: None $value (string|integer) (required) Search for this term value Default: None $taxonomy (string) (required) Taxonomy Name Default: None $output (string) (optional) Constant OBJECT, ARRAY_A, or ARRAY_N Default: OBJECT $lter (string) (optional) default is raw or no WordPress dened lter will applied. Default: 'raw'

Return Values
(mixed)

Term Row from database. Will return false if $taxonomy does not exist or $term was not found.

Examples Notes
Warning: $value is not escaped for 'name' $eld. You must do it yourself, if required. See sanitize_term_eld() The $context param lists the available values for 'get_term_by' $lter param. Uses: sanitize_term() Cleanses the term based on $lter context before returning. Uses global: (object) $wpdb

Change Log
Since: 2.3.0

Source File
get_term_by() is located in wp-includes/taxonomy.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/get_term_by" Categories: Functions | New page created

Function Reference/get term children Contents


1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
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.

Usage
<?php get_term_children( $term, $taxonomy ) ?>

Parameters
$term (string) (required) Name of Term to get children Default: None $taxonomy (string) (required) Taxonomy Name Default: None

Return Values
(array|WP_Error) List of Term Objects. WP_Error returned if $taxonomy does not exist

Examples Notes
Uses: $wpdb Uses: _get_term_hierarchy() Uses: get_term_children Used to get the children of both $taxonomy and the parent $term

Change Log

Since: 2.3.0

Source File
get_term_children() is located in wp-includes/taxonomy.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/get_term_children" Categories: Functions | New page created

Function Reference/get terms Contents


1 WARNING 2 Description 3 Usage 4 Possible Arguments 5 Details

WARNING
This is a new article, there may be problems. Please consult the function itself in /wp-includes/taxonomy.php if you are having problems.

Description
Retrieve the terms in taxonomy or list of taxonomies.

Usage
get_terms($taxonomies, $args = )

Possible Arguments
Arguments are passed in the format used by wp_parse_args(). e.g. $myterms = get_terms("orderby=count&hide_empty=false"); Any arguments you don't specify will use the default (specied below). The list that $args can contain, which will overwrite the defaults. orderby - Default is 'name'. Can be name, count, or nothing (will use term_id). order - Default is ASC. Can use DESC. hide_empty - Default is true. Will not return empty $terms. elds - Default is all. slug - Any terms that has this value. Default is empty string. hierarchical - Whether to return hierarchical taxonomy. Default is true. name__like - Default is empty string. pad_counts - Default is FALSE. If true, count all of the children along with the $terms. get - Default is nothing . Allow for overwriting 'hide_empty' and 'child_of', which can be done by setting the value to 'all'. child_of - Default is 0. Get all descendents of this term. parent - Default is 0. Get direct children of this term (only terms who's explicit parent is this value)

Details
You can fully inject any customizations to the query before it is sent, as well as control the output with a lter. The 'get_terms' lter will be called when the cache has the term and will pass the found term along with the array of $taxonomies and array of $args. This lter is also called before the array of terms is passed and will pass the array of terms, along with the $taxonomies and $args. The 'list_terms_exclusions' lter passes the compiled exclusions along with the $args. Retrieved from "http://codex.wordpress.org/Function_Reference/get_terms" Categories: Functions | New page created

Function Reference/get the category rss Contents

1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
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.

Usage
<?php get_the_category_rss( $type ) ?>

Parameters
$type (string) (optional) default is 'rss'. Either 'rss', 'atom', or 'rdf'. Default: 'rss'

Return Values
(string) All of the post categories for displaying in the feed.

Examples Notes
Uses: apply_lters()

Change Log
Since: 2.1.0

Source File
get_the_category_rss() is located in wp-includes/feed.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/get_the_category_rss" Categories: Functions | New page created

Function Reference/get the content Contents


1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
Retrieve the post content.

Usage
<?php get_the_content( $more_link_text, $stripteaser, $more_file ) ?>

Parameters

$more_link_text (string) (optional) Content for when there is more text. Default: null $stripteaser (string) (optional) Teaser content before the more text. Default: 0 $more_le (string) (optional) Not used. Default: ''

Return Values
(string)

Examples Notes
Uses: post_password_required() Uses: get_the_password_form() if post_password_required() fails Uses: wp_kses_no_null() while processing the tag. Uses: balanceTags() Uses: get_permalink() Uses global: $id Uses global: $post Uses global: $more Uses global: $page Uses global: $pages Uses global: $multipage Uses global: $preview Uses global: $pagenow

Change Log
Since: 0.71

Source File
get_the_content() is located in wp-includes/post-template.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/get_the_content" Categories: Functions | New page created

Function Reference/get the title rss Contents


1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
Retrieve the current post title for the feed.

Usage
<?php get_the_title_rss() ?>

Parameters
None.

Return Values
(string) Current post title.

Examples Notes
Uses: apply_lters() Calls 'the_title_rss' on the post title. Uses: get_the_title() to get the post title.

Change Log
Since: 2.0.0

Source File
get_the_title_rss() is located in wp-includes/feed.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/get_the_title_rss" Categories: Functions | New page created

Function Reference/get theme Contents


1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
Retrieve theme data.

Usage
<?php get_theme( $theme ) ?>

Parameters
$theme (string) (required) Theme name. Default: None

Return Values
(array|null) Null, if theme name does not exist. Theme data, if exists.

Examples Notes
Uses: get_themes()

Change Log
Since: 1.5.0

Source File
get_theme() is located in wp-includes/theme.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/get_theme"

Categories: Functions | New page created

Function Reference/get theme data Contents


1 Description 2 Usage 3 Example 3.1 Usage 4 Parameters 5 Return values

Description
Returns an array of information about a theme le.

Usage
<?php $theme_data = get_theme_data($theme_filename); ?>

Example
Usage
Get the information from the default themes style.css and display the Name and author linked with there respective URIs if they exist. <?php $theme_data = get_theme_data(ABSPATH . 'wp-content/themes/default/style.css'); echo $theme_data['Title']; echo $theme_data['Author']; ?>

Parameters
$theme_lename (string) (required) Path and lename of the theme's style.css. Default: None

Return values
The function returns an array containing the following keyed information. 'Name' (string) The Themes name. 'Title' (string) Either the Theme's name or a HTML fragment containg the Theme's name linked to the Theme's URI if the Theme's URI is dened. 'Description' (string) A HTML fragment containg the Themes description after it has passed through wptexturize. 'Author' (string) Either the Author's name or a HTML fragment containg the Author's name linked to the Author's URI if the Author's URI is dened. 'Version' (string) The Theme's version number. 'Template' (string) The name of the parent Theme if one exists. 'Status' (string) defaults to 'publish' This article is marked as in need of editing. You can help Codex by editing it. Retrieved from "http://codex.wordpress.org/Function_Reference/get_theme_data" Categories: Functions | Copyedit

Function Reference/get theme mod Contents


1 Description 2 Usage 3 Parameters

4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
Retrieve theme modication value for the current theme. If the modication name does not exist, then the $default will be passed through sprintf() with the rst string the template directory URI and the second string the stylesheet directory URI.

Usage
<?php get_theme_mod( $name, $default ) ?>

Parameters
$name (string) (required) Theme modication name. Default: None $default (boolean|string) (optional) Default: false

Return Values
(string)

Examples Notes
Uses: apply_lters() Calls 'theme_mod_$name' lter on the value.

Change Log
Since: 2.1.0

Source File
get_theme_mod() is located in wp-includes/theme.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/get_theme_mod" Categories: Functions | New page created

Function Reference/get theme root Contents


1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
Retrieve path to themes directory. Does not have trailing slash.

Usage
<?php get_theme_root() ?>

Parameters
None.

Return Values
(string) Theme path.

Examples Notes
Uses: apply_lters() Calls 'theme_root' lter on path.

Change Log
Since: 1.5.0

Source File
get_theme_root() is located in wp-includes/theme.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/get_theme_root" Categories: Functions | New page created

Function Reference/get theme root uri Contents


1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
Retrieve URI for themes directory. Does not have trailing slash.

Usage
<?php get_theme_root_uri() ?>

Parameters
None.

Return Values
(string) Themes URI.

Examples Notes
Uses: apply_lters() Calls 'theme_root_uri' lter on uri. Uses: content_url() to retrieve the 'themes' uri. Uses: get_option() to retrieve 'siteurl' option.

Change Log
Since: 1.5.0

Source File

get_theme_root_uri() is located in wp-includes/theme.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/get_theme_root_uri" Categories: Functions | New page created

Function Reference/get themes Contents


1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
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 then 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.

Usage
<?php get_themes() ?>

Parameters
None.

Return Values
(array) Theme list with theme data.

Examples Notes
Uses: get_theme_root() Uses: get_theme_data() Uses: wptexturize() Uses global: (array) $wp_themes holds working themes list. Uses global: (array) $wp_broken_themes holds broken themes list.

Change Log
Since: 1.5.0

Source File
get_themes() is located in wp-includes/theme.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/get_themes" Categories: Functions | New page created

Function Reference/get to ping Contents


1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes

7 Change Log 8 Source File 9 Related

Description
Retrieve URLs that need to be pinged.

Usage
<?php get_to_ping( $post_id ) ?>

Parameters
$post_id (integer) (required) Post ID Default: None

Return Values
(array) Returns array of URLs that need to be pinged.

Examples Notes
Uses global: (object) $wpdb to read 'to_ping' eld from _posts table from database. Uses: apply_lters() on 'get_to_ping' on the URLs that need to be pinged.

Change Log
Since: 1.5.0

Source File
get_to_ping() is located in wp-includes/post.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/get_to_ping" Categories: Functions | New page created

Function Reference/get user option Contents


1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
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 lter for the result will also pass the original option name and nally the user data object as the third parameter. The option will rst check for the non-global name, then the global name, and if it still doesn't nd it, it will try the blog option. The option can either be modied or set by a plugin.

Usage
<?php get_user_option( $option, $user, $check_blog_options ) ?>

Parameters
$option

(string) (required) User option name. Default: None $user (integer) (optional) User ID. Default: 0 $check_blog_options (boolean) (optional) Whether to check for an option in the options table if a per-user option does not exist. Default: true

Return Values
(mixed)

Examples Notes
Uses: apply_lters() Calls 'get_user_option_$option' hook with result, option parameter, and user data object. Uses global: (object) $wpdb WordPress database object for queries.

Change Log
Since: 2.0.0

Source File
get_user_option() is located in wp-includes/user.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/get_user_option" Categories: Functions | New page created

Function Reference/get userdata Contents


1 Description 2 Usage 3 Examples 3.1 Default Usage 3.2 Accessing Usermeta Data 4 Parameters 5 Values in users & user_meta table 5.1 users 5.2 useful in user_meta 6 See Also

Description
Returns an object with the information pertaining to the user whose ID is passed to it. Properties map directly to wp_users table in the database (see Database Description).

Usage
<?php get_userdata(userid); ?>

Examples
Default Usage
The call to get_userdata() returns the user's data, where it can be retrieved using member variables. <?php $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"); ?> Username: admin

User level: 10 User ID: 1

Accessing Usermeta Data


<?php $user_info = get_userdata(1); echo($user_info->last_name . ?> ", " . $user_info->first_name . "\n");

Blow, Joe

Parameters
$userid (integer) (required) The ID of the user whose data should be retrieved. Default: None

Values in users & user_meta table


Here are the values in the users table you can access via this function:

users
ID user_login user_pass user_nicename user_email user_url user_registered user_activation_key user_status display_name

useful in user_meta
rst_name last_name nickname user_level admin_color (Theme of your admin page. Default is fresh.) closedpostboxes_page nickname primary_blog rich_editing source_domain

See Also
Function_Reference/get_currentuserinfo, Author_Templates This article is marked as in need of editing. You can help Codex by editing it. Retrieved from "http://codex.wordpress.org/Function_Reference/get_userdata" Categories: Functions | Copyedit

Function Reference/get userdatabylogin Contents


1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File

9 Related

Description
This function can be replaced via plugins. If plugins do not redene these functions, then this will be used instead. Retrieve user info by login name.

Usage
<?php get_userdatabylogin( $user_login ) ?>

Parameters
$user_login (string) (required) User's username Default: None

Return Values
(boolean|object) False on failure. User DB row object on success.

Examples Notes
This function can be replaced via plugins. If plugins do not redene these functions, then this will be used instead.

Change Log
Since: 0.71

Source File
get_userdatabylogin() is located in wp-includes/pluggable.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/get_userdatabylogin" Categories: Functions | New page created

Function Reference/get usermeta Contents


1 Description 2 Usage 3 Example 4 Parameters

Description
This function returns the value of a specic metakey pertaining to the user whose ID is passed via the userid parameter.

Usage
<?php get_usermeta(userid,'metakey'); ?>

Example
This example returns and then displays the last name for user id 9. <?php $user_last = get_usermeta(9,'last_name'); ?> <?php echo('User ID 9's last name: ' . $user_last . '\n'); ?> User ID 9's last name: Jones

Parameters
$userid (integer) (required) The ID of the user whose data should be retrieved.

Default: None $metakey (string) (required) The metakey value to be returned. 'metakey' The meta_key in the wp_usermeta table for the meta_value to be returned. Default: None Retrieved from "http://codex.wordpress.org/Function_Reference/get_usermeta" Category: Functions

Function Reference/get usernumposts Contents


1 Description 2 Usage 3 Example 3.1 Default Usage 4 Parameters

Description
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).

Usage
<?php get_usernumposts(userid); ?>

Example
Default Usage
The call to get_usernumposts returns the number of posts made by the user. <?php echo('Posts made: ' . get_usernumposts(1)); ?>

Posts made: 143

Parameters
$userid (integer) (required) The ID of the user whose post count should be retrieved. Default: None Retrieved from "http://codex.wordpress.org/Function_Reference/get_usernumposts" Category: Functions

Function Reference/get weekstartend Contents


1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
Get the week start and end from the MySQL DATETIME or date string.

Usage
<?php get_weekstartend( $mysqlstring, $start_of_week ) ?>

Parameters

$mysqlstring (string) (required) Date or MySQL DATETIME eld type. Default: None $start_of_week (integer) (optional) Start of the week as an integer. Default: ''

Return Values
(array) Keys are 'start' and 'end'.

Examples Notes
Uses: get_option() to retrieve the 'start_of_week' option if $start_of_week is not numeric.

Change Log
Since: 0.71

Source File
get_weekstartend() is located in wp-includes/functions.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/get_weekstartend" Categories: Functions | New page created

Function Reference/header image Contents


1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
Display header image path.

Usage
<?php header_image() ?>

Parameters
None.

Return Values
(void) This function does not return a value.

Examples Notes Change Log


Since: 2.1.0

Source File
header_image() is located in wp-includes/theme.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/header_image" Categories: Functions | New page created

Function Reference/htmlentities2 Contents


1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
Convert entities, while preserving already-encoded entities.

Usage
<?php htmlentities2( $myHTML ) ?>

Parameters
$myHTML (string) (required) The text to be converted. Default: None

Return Values
(string) Converted text.

Examples Notes
See Also: Borrowed from the PHP Manual user notes.

Change Log
Since: 1.2.2

Source File
htmlentities2() is located in wp-includes/formatting.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/htmlentities2" Categories: Functions | New page created

Function Reference/human time diff Contents


1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
Determines the difference between two timestamps.

The difference is returned in a human readable format such as "1 hour", "5 mins", "2 days".

Usage
<?php human_time_diff( $from, $to ) ?>

Parameters
$from (integer) (required) Unix timestamp from which the difference begins. Default: None $to (integer) (optional) Unix timestamp to end the time difference. Default becomes time() if not set. Default: ''

Return Values
(string) Human readable time difference.

Examples
To print an entry's time ("2 days ago"): <?php echo human_time_diff(get_the_time('U'), current_time('timestamp')) . ' ago'; ?> For comments: <?php echo human_time_diff(get_comment_time('U'), current_time('timestamp')) . ' ago'; ?>

Notes Change Log


Since: 1.5.0

Source File
human_time_diff() is located in wp-includes/formatting.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/human_time_diff" Categories: Functions | New page created

Function Reference/is blog installed Contents


1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
Test whether blog is already installed. The cache will be checked rst. 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.

Usage
<?php is_blog_installed() ?>

Parameters
None.

Return Values

(boolean) Whether blog is already installed.

Examples Notes
Uses global: (object) $wpdb

Change Log
Since: 2.1.0

Source File
is_blog_installed() is located in wp-includes/functions.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/is_blog_installed" Categories: Functions | New page created

Function Reference/is email Description


Validates an e-mail address

Usage
<?php if (is_email($address)) // do something ?>

Parameters
$user_email (string) Address to check This page is marked as incomplete. You can help Codex by expanding it. Retrieved from "http://codex.wordpress.org/Function_Reference/is_email" Categories: Stubs | Functions | Conditional Tags

Function Reference/is local attachment Contents


1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
Check if the attachment URI is local one and is really an attachment.

Usage
<?php is_local_attachment( $url ) ?>

Parameters
$url (string) (required) URL to check Default: None

Return Values
(boolean)

True on success, false on failure.

Examples Notes Change Log


Since: 2.0.0

Source File
is_local_attachment() is located in wp-includes/post.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/is_local_attachment" Categories: Functions | Conditional Tags | New page created

Function Reference/is new day Contents


1 Description 2 Usage 3 Examples 4 Parameters 5 Return Values 6 Notes 7 Change Log 8 Source File 9 Related

Description
This Conditional Tag checks if today is a new day. This is a boolean function, meaning it returns TRUE (1) when new day or FALSE (0) if not a new day.

Usage
<?php is_new_day(); ?>

Examples Parameters
This tag does not accept any parameters.

Return Values
(boolean) TRUE (1) when new day, FALSE (0) if not a new day.

Notes
Uses global: (string) $day Holds the date of the day of the current post during The_Loop. Uses global: (string) $previousday Holds the date of the day of the previous post (if any) during The_Loop.

Change Log
Since: 0.71

Source File
is_new_day() is located in wp-includes/functions.php.

Related
is_home(), is_front_page(), is_search(), is_404(), is_singular(), is_page(), is_attachment(), is_local_attachment(), is_single(), is_sticky(), is_archive(), is_category(), is_tag(), is_author(), is_date(), is_year(), is_month(), is_day(), is_time(), is_admin(), is_preview(), is_paged(), is_page_template(), is_plugin_page(), is_new_day(), is_feed(), is_trackback(), is_comments_popup(), comments_open(), pings_open(), is_taxonomy(), is_taxonomy_hierarchical() Retrieved from "http://codex.wordpress.org/Function_Reference/is_new_day" Categories: Conditional Tags | Functions

Function Reference/is serialized Contents


1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
Check value to nd if it was serialized. If $data is not an string, then returned value will always be false. Serialized data is always a string.

Usage
<?php is_serialized( $data ) ?>

Parameters
$data (mixed) (required) Value to check to see if was serialized. Default: None

Return Values
(boolean) False if not serialized and true if it was.

Examples Notes
Data might need to be serialized to allow it to be successfully stored and retrieved from a database in a form that PHP can understand.

Change Log
Since: 2.0.5

Source File
is_serialized() is located in wp-includes/functions.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/is_serialized" Categories: Functions | Conditional Tags | New page created

Function Reference/is serialized string Contents


1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
Check whether serialized data is of string type.

Usage
<?php is_serialized_string( $data ) ?>

Parameters
$data (mixed) (required) Serialized data Default: None

Return Values
(boolean) False if not a serialized string, true if it is.

Examples Notes
Data might need to be serialized to allow it to be successfully stored and retrieved from a database in a form that PHP can understand.

Change Log
Since: 2.0.5

Source File
is_serialized_string() is located in wp-includes/functions.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/is_serialized_string" Categories: Functions | Conditional Tags | New page created

Function Reference/is taxonomy Contents


1 Description 2 Usage 3 Example 4 Parameters 5 Related

Description
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.

Usage
<?php is_taxonomy($taxonomy); ?>

Example
$taxonomy_exist = is_taxonomy('category'); //returns true $taxonomy_exist = is_taxonomy('post_tag'); //returns true $taxonomy_exist = is_taxonomy('link_category'); //returns true $taxonomy_exist = is_taxonomy('my_taxonomy'); //returns false if global $wp_taxonomies['my_taxonomy'] is not set

Parameters
$taxonomy (string) (required) The name of the taxonomy Default: None

Related
is_home(), is_front_page(), is_search(), is_404(), is_singular(), is_page(), is_attachment(), is_local_attachment(), is_single(), is_sticky(),

is_archive(), is_category(), is_tag(), is_author(), is_date(), is_year(), is_month(), is_day(), is_time(), is_admin(), is_preview(), is_paged(), is_page_template(), is_plugin_page(), is_new_day(), is_feed(), is_trackback(), is_comments_popup(), comments_open(), pings_open(), is_taxonomy(), is_taxonomy_hierarchical() Retrieved from "http://codex.wordpress.org/Function_Reference/is_taxonomy" Categories: Conditional Tags | Functions

Function Reference/is taxonomy hierarchical Contents


1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
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 rst. Then gets the object, and nally returns the hierarchical value in the object.

Usage
<?php is_taxonomy_hierarchical( $taxonomy ) ?>

Parameters
$taxonomy (string) (required) Name of taxonomy object Default: None

Return Values
(boolean) Whether the taxonomy is hierarchical

Examples Notes
See Also: WordPress Taxonomy. Uses: is_taxonomy() Checks whether taxonomy exists. Uses: get_taxonomy() Used to get the taxonomy object.

Change Log
Since: 2.3.0

Source File
is_taxonomy_hierarchical() is located in wp-includes/taxonomy.php.

Related
is_home(), is_front_page(), is_search(), is_404(), is_singular(), is_page(), is_attachment(), is_local_attachment(), is_single(), is_sticky(), is_archive(), is_category(), is_tag(), is_author(), is_date(), is_year(), is_month(), is_day(), is_time(), is_admin(), is_preview(), is_paged(), is_page_template(), is_plugin_page(), is_new_day(), is_feed(), is_trackback(), is_comments_popup(), comments_open(), pings_open(), is_taxonomy(), is_taxonomy_hierarchical() Retrieved from "http://codex.wordpress.org/Function_Reference/is_taxonomy_hierarchical" Categories: Conditional Tags | Functions

Function Reference/is term Contents

1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
Check if Term exists. Returns the index of a dened term, or 0 (false) if the term doesn't exist.

Usage
<?php is_term( $term, $taxonomy ) ?>

Parameters
$term (integer|string) (required) The term to check Default: None $taxonomy (string) (optional) The taxonomy name to use Default: ''

Return Values
(mixed) Get the term id or Term Object, if exists.

Examples Notes
Uses global: (object) $wpdb Uses global: (object) $term

Change Log
Since: 2.3.0

Source File
is_term() is located in wp-includes/taxonomy.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/is_term" Categories: Functions | Conditional Tags | New page created

Function Reference/is user logged in Contents


1 Description 2 Usage 3 Examples 4 Parameters 5 Further Reading

Description
Returns boolean true or false depending on whether the current visitor is logged in.

Usage
<?php if (is_user_logged_in()){ ... } ?>

Examples
Use is_user_logged_in() in your theme les to display different output depending on whether the user is logged in. <?php if (is_user_logged_in()){ echo "Welcome, registered user!"; } else { echo "Welcome, visitor!"; };

?>

Parameters
This function does not accept any parameters.

Further Reading
Function_Reference Retrieved from "http://codex.wordpress.org/Function_Reference/is_user_logged_in" Categories: Functions | Conditional Tags | New page created

Function Reference/iso8601 timezone to offset Contents


1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
Computes an offset in seconds from an ISO 8601 timezone.

Usage
<?php iso8601_timezone_to_offset( $timezone ) ?>

Parameters
$timezone (string) (required) Either 'Z' for 0 offset or 'hhmm'. Default: None

Return Values
(integer|oat) The offset in seconds.

Examples Notes
See Also: ISO 8601

Change Log
Since: 1.5.0

Source File
iso8601_timezone_to_offset() is located in wp-includes/formatting.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/iso8601_timezone_to_offset" Categories: Functions | New page created

Function Reference/iso8601 to datetime Contents


1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
Converts an iso8601 date to MySQL DATETIME format used by post_date[_gmt].

Usage
<?php iso8601_to_datetime( $date_string, $timezone ) ?>

Parameters
$date_string (string) (required) Date and time in ISO 8601 format. Default: None $timezone (string) (optional) If set to GMT returns the time minus gmt_offset. Default is 'user'. Default: 'user'

Return Values
(string) The date and time in MySQL DATETIME format - Y-m-d H:i:s.

Examples Notes
See Also: ISO 8601

Change Log
Since: 1.5.0

Source File
iso8601_to_datetime() is located in wp-includes/formatting.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/iso8601_to_datetime" Categories: Functions | New page created

Function Reference/js escape Contents


1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
Escape single quotes. Convert double quotes. Fix line endings. The lter 'js_escape' is also applied here.

Usage
<?php js_escape( $text ) ?>

Parameters
$text (string) (required) The text to be escaped. Default: None

Return Values
(string) Escaped text.

Examples Notes
Uses: wp_specialchars() for double quote conversion.

Change Log
Since: 2.0.4

Source File
js_escape() is located in wp-includes/formatting.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/js_escape" Categories: Functions | New page created

Function Reference/load default textdomain Contents


1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
Loads default translated strings based on locale. Loads the .mo le in WP_LANG_DIR constant path from WordPress root. The translated (.mo) le is named based off of the locale.

Usage
<?php load_default_textdomain() ?>

Parameters
None.

Return Values
(void) This function does not return a value.

Examples Notes
l10n is an abbreviation for localization.

Change Log

Since: 1.5.0

Source File
load_default_textdomain() is located in wp-includes/l10n.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/load_default_textdomain" Categories: Functions | New page created

Function Reference/load plugin textdomain Contents


1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
Loads the plugin's translated strings. If the path is not given then it will be the root of the plugin directory. The .mo le should be named based on the domain with a dash followed by a dash, and then the locale exactly.

Usage
<?php load_plugin_textdomain( $domain, $abs_rel_path, $plugin_rel_path ) ?>

Parameters
$domain (string) (required) Unique identier for retrieving translated strings. Default: None $abs_rel_path (string) (optional) Relative path to ABSPATH of a folder, where the .mo le resides. Deprecated, but still functional until 2.7 Default: false $plugin_rel_path (string) (optional) Relative path to WP_PLUGIN_DIR. This is the preferred argument to use. It takes precendence over $abs_rel_path Default: false

Return Values
(void) This function does not return a value.

Examples Notes
l10n is an abbreviation for localization.

Change Log
Since: 1.5.0

Source File
load_plugin_textdomain() is located in wp-includes/l10n.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/load_plugin_textdomain" Categories: Functions | New page created

Function Reference/load template

Contents
1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
Require once the template le with WordPress environment. The globals are set up for the template le to ensure that the WordPress environment is available from within the function. The query variables are also available.

Usage
<?php load_template( $_template_file ) ?>

Parameters
$_template_le (string) (required) Path to template le. Default: None

Return Values
(void) This function does not return a value.

Examples Notes
Uses global: (object) $wp_query to extract extract() global variables returned by the query_vars method while protecting the current values in these global variables: (unknown type) $posts (unknown type) $post (boolean) $wp_did_header Returns true if the WordPress header was already loaded. See the /wp-blog-header.php le for details. (boolean) $wp_did_template_redirect (object) $wp_rewrite (object) $wpdb (string) $wp_version holds the installed WordPress version number. (string) $wp (string) $id (string) $comment (string) $user_ID

Change Log
Since: 1.5.0

Source File
load_template() is located in wp-includes/theme.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/load_template" Categories: Functions | New page created

Function Reference/load textdomain Contents


1 Description 2 Usage 3 Parameters

4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
Loads MO le into the list of domains. If the domain already exists, the inclusion will fail. If the MO le is not readable, the inclusion will fail. On success, the mole will be placed in the $l10n global by $domain and will be an gettext_reader object.

Usage
<?php load_textdomain( $domain, $mofile ) ?>

Parameters
$domain (string) (required) Unique identier for retrieving translated strings Default: None $mole (string) (required) Path to the .mo le Default: None

Return Values
(null) On failure returns null and also on success returns nothing.

Examples Notes
Uses global: (array) $l10n Gets list of domain translated string gettext_reader objects. Uses: CacheFileReader() Reads the MO le. Uses: gettext_reader obect. Allows for retrieving translated strings. l10n is an abbreviation for localization.

Change Log
Since: 1.5.0

Source File
load_textdomain() is located in wp-includes/l10n.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/load_textdomain" Categories: Functions | New page created

Function Reference/load theme textdomain Contents


1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
Loads the theme's translated strings.

If the current locale exists as a .mo le in the theme's root directory, it will be included in the translated strings by the $domain. The .mo les must be named based on the locale exactly.

Usage
<?php load_theme_textdomain( $domain, $path ) ?>

Parameters
$domain (string) (required) Unique identier for retrieving translated strings. Default: None $path (unknown) (optional) Default: false

Return Values
(void) This function does not return a value.

Examples Notes
l10n is an abbreviation for localization.

Change Log
Since: 1.5.0

Source File
load_theme_textdomain() is located in wp-includes/l10n.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/load_theme_textdomain" Categories: Functions | New page created

Function Reference/locale stylesheet Contents


1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
Display localized stylesheet link element. If get_locale_stylesheet_uri() returns a value, locale_stylesheet will echo a valid xhtml <link> tag like this: <link rel="stylesheet" href="path_to_stylesheet" type="text/css" media="screen" /> If get_locale_stylesheet_uri() does not return a value then the function exits immediately.

Usage
<?php locale_stylesheet() ?>

Parameters
None.

Return Values

(void) This function does not return a value.

Examples Notes
Uses get_locale_stylesheet_uri().

Change Log
Since: 2.1.0

Source File
locale_stylesheet() is located in wp-includes/theme.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/locale_stylesheet" Categories: Functions | New page created

Function Reference/make clickable Contents


1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
Convert plain text URI to HTML links. Converts URI, www, ftp, and email addresses. Finishes by xing links within links.

Usage
<?php make_clickable( $ret ) ?>

Parameters
$ret (string) (required) Content to convert URIs. Default: None

Return Values
(string) Content with converted URIs.

Examples Notes Change Log


Since: 0.71

Source File
make_clickable() is located in wp-includes/formatting.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/make_clickable" Categories: Functions | New page created

Function Reference/make url footnote

Contents
1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
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.

Usage
<?php make_url_footnote( $content ) ?>

Parameters
$content (string) (required) Content to get links Default: None

Return Values
(string) HTML stripped out of content with links at the bottom.

Examples Notes Change Log


Since: 0.71

Source File
make_url_footnote() is located in wp-includes/functions.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/make_url_footnote" Categories: Functions | New page created

Function Reference/maybe serialize Contents


1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
Serialize data, if needed.

Usage
<?php maybe_serialize( $data ) ?>

Parameters

$data (mixed) (required) Data that might be serialized. Default: None

Return Values
(mixed) A scalar data

Examples Notes
Data might need to be serialized to allow it to be successfully stored and retrieved from a database in a form that PHP can understand.

Change Log
Since: 2.0.5

Source File
maybe_serialize() is located in wp-includes/functions.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/maybe_serialize" Categories: Functions | New page created

Function Reference/maybe unserialize Contents


1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
Unserialize value only if it was serialized.

Usage
<?php maybe_unserialize( $original ) ?>

Parameters
$original (string) (required) Maybe unserialized original, if is needed. Default: None

Return Values
(mixed) Unserialized data can be any type.

Examples Notes
Data might need to be serialized to allow it to be successfully stored and retrieved from a database in a form that PHP can understand.

Change Log
Since: 2.0.0

Source File
maybe_unserialize() is located in wp-includes/functions.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/maybe_unserialize" Categories: Functions | New page created

Function Reference/merge lters Description


Merge the lter functions of a specic lter hook with generic lter functions. It is possible to dened generic lter functions using the lter hook all. These functions are called for every lter tag. This function merges the functions attached to the all hook with the functions of a specic hoook dened by $tag.

Parameters
$tag (string) (required) The lter hook of which the functions should be merged. Default: None This page is marked as incomplete. You can help Codex by expanding it. Retrieved from "http://codex.wordpress.org/Function_Reference/merge_lters" Categories: Stubs | Functions

Function Reference/mysql2date Description


Translates dates from mysql format to any format acceptable by the php date() function

Usage
mysql2date($dateformatstring, $mysqlstring, $translate = true) $dateformatstring The requested output format. any format acceptable by the php date() function. $mysqlstring the input string, probably mysql database output. $translate not sure what this does. Retrieved from "http://codex.wordpress.org/Function_Reference/mysql2date" Category: Functions

Function Reference/next comments link Contents


1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
Display link to next comments pages.

Usage
<?php next_comments_link( $label, $max_page ) ?>

Parameters
$label (string) (optional) Label for link text. Default: '' $max_page

(integer) (optional) Max page. Default: 0

Return Values
(void) This function does not return a value.

Examples Notes
Uses global: (object) $wp_query

Change Log
Since: 2.7.0

Source File
next_comments_link() is located in wp-includes/link-template.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/next_comments_link" Categories: Functions | New page created

Function Reference/nocache headers Contents


1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
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.

Usage
<?php nocache_headers() ?>

Parameters
None.

Return Values
(void) This function does not return a value.

Examples Notes Change Log


Since: 2.0.0

Source File
nocache_headers() is located in wp-includes/functions.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/nocache_headers"

Categories: Functions | New page created

Function Reference/page uri index Contents


1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
Retrieve all pages and attachments for pages URIs. The attachments are for those that have pages as parents and will be retrieved.

Usage
<?php page_uri_index() ?>

Parameters
None

Return Values
(array) Array of page URIs as rst element and attachment URIs as second element.

Examples Notes
Uses: $wpdb Uses: get_page_hierarchy() on db query result in posts table. Uses: get_page_uri() on each page ID.

Change Log
Since: 2.5.0

Source File
page_uri_index() is located in wp-includes/rewrite.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/page_uri_index" Categories: Functions | New page created

Function Reference/paginate comments links


In version 2.7 WordPress added the Enhanced Comment Display system to make comments.php les much simpler to write and edit. One is the ability to easily break comments into pages so that you dont' end up with hundreds of comments all loading on every pageview. You will need to set up the options in SETTINGS > DISCUSSION for paging to work. The easiest way to do so is with the following function, which prints out a link to the next and previous comment pages, as well as a numbered list of all the comment pages. paginate_comments_links($args); It accepts a query-style list of arguments similar to get_posts() or get_terms(). Here are the defaults: 'base' => add_query_arg( 'cpage', '%#%' ), 'format' => , 'total' => $max_page, 'current' => $page,

'echo' => true, 'add_fragment' => '#comments' These arguments are mostly to make it work though, so be careful if you change them. If you want more control, you can also use the simpler next and previous functions: next_comments_link($label=, $max_page = 0) and previous_comments_link($label=) Retrieved from "http://codex.wordpress.org/Function_Reference/paginate_comments_links"

Function Reference/pingback Contents


1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
Pings back the links found in a post. Includes wp-include/class-IXR.php le if not already included.

Usage
<?php pingback( $content, $post_ID ) ?>

Parameters
$content (string) (required) Post content to check for links. Default: None $post_ID (integer) (required) Post ID. Default: None

Return Values
(void) This function does not return a value.

Examples Notes
Uses global: (string) $wp_version holds the installed WordPress version number. Uses: IXR_Client WordPress class. Uses: discover_pingback_server_uri() Uses: get_pung() Uses: url_to_postid() Uses: is_local_attachment() Uses: do_action_ref_array() on 'pre_ping' on 'post_links' and on pung() result. Uses: get_permalink() Uses: add_ping()

Change Log
Since: 0.71

Source File

pingback() is located in wp-includes/comment.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/pingback" Categories: Functions | New page created

Function Reference/pings open Contents


1 Description 2 Usage 3 Examples 4 Parameters 5 Related

Description Usage
<?php pings_open(); ?>

Examples Parameters Related


is_home(), is_front_page(), is_search(), is_404(), is_singular(), is_page(), is_attachment(), is_local_attachment(), is_single(), is_sticky(), is_archive(), is_category(), is_tag(), is_author(), is_date(), is_year(), is_month(), is_day(), is_time(), is_admin(), is_preview(), is_paged(), is_page_template(), is_plugin_page(), is_new_day(), is_feed(), is_trackback(), is_comments_popup(), comments_open(), pings_open(), is_taxonomy(), is_taxonomy_hierarchical() Retrieved from "http://codex.wordpress.org/Function_Reference/pings_open" Categories: Conditional Tags | Functions

Function Reference/plugin basename Contents


1 Description 2 Usage 3 Parameters 4 Return 5 Example

Description
Gets the basename of a plugin (extracts the name of a plugin from its lename).

Usage
<?php plugin_basename($file); ?>

Parameters
$le (string) The lename of a plugin.

Return
The basename of a plugin.

Example
If your plugin le is located at /home/www/wp-content/plugins/myplugin/myplugin.php, and you call: $x = plugin_basename(__FILE__); $x will equal "myplugin/myplugin.php". If you would like to know the full url path to your plugin's directory, you can call:

$x = WP_PLUGIN_URL.'/'.str_replace(basename( __FILE__),"",plugin_basename(__FILE__)); $x will equal "http://[url-path-to-plugins]/[myplugin]/"

function writeCSS() { echo ( '<link rel=\"stylesheet\" type=\"text/css\" href=\"'. $x . 'myplugin.css\">' ); } add_action('wp_head', 'writeCSS'); This page is marked as incomplete. You can help Codex by expanding it. Retrieved from "http://codex.wordpress.org/Function_Reference/plugin_basename" Categories: Stubs | Functions

Function Reference/popuplinks Contents


1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
Adds target='_blank' and rel='external' to all HTML Anchor tags to open links in new windows. Comment text in popup windows should be ltered 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.

Usage
<?php popuplinks( $text ) ?>

Parameters
$text (string) (required) Content to replace links to open in a new window. Default: None

Return Values
(string) Content that has ltered links.

Examples Notes Change Log


Since: 0.71

Source File
popuplinks() is located in wp-includes/formatting.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/popuplinks" Categories: Functions | New page created

Function Reference/post comments feed link Contents

1 Description 2 Usage 3 Parameters 4 Related

Description
Prints out the comment feed link for a post. Link text is placed in the anchor. If no link text is specied, default text is used. If no post ID is specied, the current post is used.

Usage
<?php post_comments_feed_link( $link_text = 'link_text', $post_id = 'post_id', $feed = 'feed_type' ) ?>

Parameters
$link_text (string) (optional) Descriptive text. Default: none $post_id (string) (optional) Post ID. Default: Current post $feed (string) (optional) Type of feed. Possible values: atom, rdf, rss, rss2. Default: rss2

Related
get_post_comments_feed_link

How to pass parameters to tags Go to Template Tag index Retrieved from "http://codex.wordpress.org/Function_Reference/post_comments_feed_link" Category: Template Tags

Function Reference/preview theme Contents


1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
Start preview theme output buffer. Will only preform task if the user has permissions and 'template' and 'preview' query variables exist. Will add 'stylesheet' lter if 'stylesheet' query variable exists.

Usage
<?php preview_theme() ?>

Parameters
None.

Return Values

(void) This function does not return a value.

Examples Notes Change Log


Since: 2.5.0

Source File
preview_theme() is located in wp-includes/theme.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/preview_theme" Categories: Functions | New page created

Function Reference/preview theme ob lter Contents


1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
Callback function for ob_start() to capture all links in the theme.

Usage
<?php preview_theme_ob_filter( $content ) ?>

Parameters
$content (string) (required) Default: None

Return Values
(string)

Examples Notes
This is a private function. It should not be called directly. It is listed in the Codex for completeness.

Change Log
Since: unknown

Source File
preview_theme_ob_lter() is located in wp-includes/theme.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/preview_theme_ob_lter" Categories: Functions | New page created

Function Reference/preview theme ob lter callback Contents

1 Description 2 Usage 3 Parameters 4 Return Values 5 Notes 6 Change Log 7 Source File 8 Related

Description
Manipulates preview theme links in order to control and maintain location. Callback function for preg_replace_callback() to accept and lter matches.

Usage
<?php preview_theme_ob_filter_callback( $matches ) ?>

Parameters
$matches (array) (required) Default: None

Return Values
(string)

Notes
This is a private function. It should not be called directly. It is listed in the Codex for completeness.

Change Log
Since: unknown

Source File
preview_theme_ob_lter_callback() is located in wp-includes/theme.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/preview_theme_ob_lter_callback" Categories: Functions | New page created

Function Reference/previous comments link Contents


1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
Display the previous comments page link.

Usage
<?php previous_comments_link( $label ) ?>

Parameters
$label (string) (optional) Label for comments link text. Default: ''

Return Values
(void) This function does not return a value.

Examples Notes Change Log


Since: 2.7.0

Source File
previous_comments_link() is located in wp-includes/link-template.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/previous_comments_link" Categories: Functions | New page created

Function Reference/privacy ping lter Contents


1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
Check whether blog is public before returning sites.

Usage
<?php privacy_ping_filter( $sites ) ?>

Parameters
$sites (mixed) (required) Will return if blog is public, will not return if not public. Default: None

Return Values
(mixed) Returns empty string ('') if blog is not public. Returns value in $sites if site is public.

Examples Notes
Uses: get_option() to check 'blog_public' option.

Change Log
Since: 2.1.0

Source File
privacy_ping_lter() is located in wp-includes/comment.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/privacy_ping_lter" Categories: Functions | New page created

Function Reference/register activation hook

The function register_activation_hook (introduced in WordPress 2.0) registers a plugin function to be run when the plugin is activated. This is easier than using the activate_pluginname action.

Usage and parameters


<?php register_activation_hook($file, $function); ?> $le (string) Path to the main plugin le inside the wp-content/plugins directory. A full path will work. $function (callback) The function to be run when the plugin is activated. Any of PHP's callback pseudo-types will work.

Examples
If you have a function called myplugin_activate() in the main plugin le at either wp-content/plugins/myplugin.php or wp-content/plugins/myplugin/myplugin.php use this code: register_activation_hook( __FILE__, 'myplugin_activate' ); This will call the myplugin_activate() function on activation of the plugin. This is a more reliable method than using the activate_pluginname action.

A Note on Variable Scope


If you're using global variables, you may nd that the function you pass to register_activation_hook() does not have access to global variables at the point when it is called, even though you state their global scope within the function like this: $myvar='whatever'; function myplugin_activate() { global $myvar; echo $myvar; // this will NOT be 'whatever' } register_activation_hook( __FILE__, 'myplugin_activate' ); This is because on that very rst include, your plugin is NOT included within the global scope. It's included in the activate_plugin function, and so its "main body" is not automatically in the global scope. This is why you should *always* be explicit. If you want a variable to be global, then you need to declare it as such, and that means anywhere and everywhere you use it. If you use it in the main body of the plugin, then you need to declare it global there too. When activation occurs, your plugin is included from another function and then your myplugin_activate() is called from within that function (specically, within the activate_plugin() function) at the point where your plugin is activated. The main body variables are therefore in the scope of the activate_plugin() function and are not global, unless you explicitly declare their global scope: global $myvar; $myvar='whatever'; function myplugin_activate() { global $myvar; echo $myvar; // this will be 'whatever' } register_activation_hook( __FILE__, 'myplugin_activate' ); More information on this is available here: http://wordpress.org/support/topic/201309 See also register_deactivation_hook Retrieved from "http://codex.wordpress.org/Function_Reference/register_activation_hook" Categories: Functions | New page created

Function Reference/register deactivation hook


The function register_deactivation_hook (introduced in WordPress 2.0) registers a plugin function to be run when the plugin is deactivated.

Usage and parameters


<?php register_deactivation_hook($file, $function); ?> $le (string) Path to the main plugin le inside the wp-content/plugins directory. A full path will work. $function (callback) The function to be run when the plugin is deactivated. Any of PHP's callback pseudo-types will work.

Examples
If you have a function called myplugin_deactivate() in the main plugin le at either wp-content/plugins/myplugin.php or wp-content/plugins/myplugin/myplugin.php use this code: register_deactivation_hook( __FILE__, 'myplugin_deactivate' ); This will call the myplugin_deactivate() function on deactivation of the plugin. Retrieved from "http://codex.wordpress.org/Function_Reference/register_deactivation_hook" Categories: Functions | New page created

Function Reference/register taxonomy Contents


1 WARNING 2 Description 3 Usage 4 Example 5 Parameters 6 Arguments

WARNING
This is a new article, there may be problems. Please consult the function itself in /wp-includes/taxonomy.php if you are having problems.

Description
The register_taxonomy() 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.

Usage
<?php register_taxonomy($taxonomy, $object_type); ?> <?php register_taxonomy($taxonomy, $object_type, $args); ?>

Example
<?php register_taxonomy('foo', 'post', array('hierarchical' => true)); ?>

Parameters
taxonomy (string) The name of the taxonomy. object_type (array|string) A name or array of names of the object type(s) for the taxonomy object. args (optional) (array) An array of arguements

Arguments
hierarachical (boolean) Has some dened purpose at other parts of the API. update_count_callback (string) A function name that will be called when the count is updated. rewrite (array|false) False to prevent rewrite, or array('slug'=>$slug) to customize permastruct; default will use $taxonomy as slug.

query_var (string|false) False to prevent queries, or string to customize query var (?$query_var=$term); default will use $taxonomy as query var. Retrieved from "http://codex.wordpress.org/Function_Reference/register_taxonomy" Categories: Functions | New page created

Function Reference/remove accents Contents


1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
Converts all accent characters to ASCII characters. If there are no accent characters, then the string given is just returned.

Usage
<?php remove_accents( $string ) ?>

Parameters
$string (string) (required) Text that might have accent characters Default: None

Return Values
(string) Filtered string with replaced "nice" characters.

Examples Notes Change Log


Since: 1.2.1

Source File
remove_accents() is located in wp-includes/formatting.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/remove_accents" Categories: Functions | New page created

Function Reference/remove action Contents


1 Description 2 Example 3 Parameters 4 Return

Description
This function removes a function attached to a specied action hook. This method can be used to remove default functions attached to a specic action hook and possibly replace them with a substitute. See also remove_lter(), add_action() and add_lter(). Important: To remove a hook, the $function_to_remove and $priority arguments must match when the hook was added. This goes for both lters and actions. No warning will be given on removal failure.

Example
This function is identical to the remove_lter() function. <?php remove_action($tag, $function_to_remove, $priority, $accepted_args); ?>

Parameters
$tag (string) (required) The action hook to which the function to be removed is hooked. Default: None $function_to_remove (string) (required) The name of the function which should be removed. Default: None $priority (int) (optional) The priority of the function (as dened when the function was originally hooked). Default: 10 $accepted_args (int) (optional) The number of arguments the function accepts. Default: 1

Return
(boolean) Whether the function is removed. True The function was successfully removed. False The function could not be removed. Retrieved from "http://codex.wordpress.org/Function_Reference/remove_action" Categories: Functions | New page created

Function Reference/remove lter Contents


1 Description 2 Example 3 Parameters 4 Return

Description
This function removes a function attached to a specied lter hook. This method can be used to remove default functions attached to a specic lter hook and possibly replace them with a substitute. See also remove_action(), add_lter() 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 lters and actions. No warning will be given on removal failure.

Example
This function is identical to the remove_action() function. <?php remove_filter($tag, $function_to_remove, $priority, $accepted_args); ?>

Parameters
$tag (string) (required) The action hook to which the function to be removed is hooked. Default: None $function_to_remove (string) (required) The name of the function which should be removed. Default: None $priority (int) (optional) The priority of the function (as dened when the function was originally hooked). Default: 10

$accepted_args (int) (optional) The number of arguments the function accepts. Default: 1

Return
(boolean) Whether the function is removed. True The function was successfully removed. False The function could not be removed. Retrieved from "http://codex.wordpress.org/Function_Reference/remove_lter" Category: Functions

Function Reference/remove query arg Contents


1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
Removes an item or list from the query string.

Usage
<?php remove_query_arg( $key, $query ) ?>

Parameters
$key (string|array) (required) Query key or keys to remove. Default: None $query (boolean) (optional) When false uses the $_SERVER value. Default: false

Return Values
(string) New URL query string.

Examples Notes Change Log


Since: 1.5.0

Source File
remove_query_arg() is located in wp-includes/functions.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/remove_query_arg" Categories: Functions | New page created

Function Reference/rss enclosure Contents

1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
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 eld and parses the value to display the enclosure(s). The enclosure(s) consist of enclosure HTML tag(s) with a URI and other attributes.

Usage
<?php rss_enclosure() ?>

Parameters
None.

Return Values
(void) This function does not return a value.

Examples Notes
Uses: apply_lters() Calls 'rss_enclosure' hook on rss enclosure. Uses: get_post_custom() To get the current post enclosure metadata.

Change Log
Since: 1.5.0

Source File
rss_enclosure() is located in wp-includes/feed.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/rss_enclosure" Categories: Functions | New page created

Function Reference/sanitize comment cookies Contents


1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
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.

Usage

<?php sanitize_comment_cookies() ?>

Parameters
None

Return Values
(void) This function does not return a value.

Examples Notes
Uses: apply_lters() with 'pre_comment_author_name' on 'comment_author' cookie Uses: apply_lters() with 'pre_comment_author_email' on 'comment_author_email' cookie Uses: apply_lters() with 'pre_comment_author_url' on 'comment_author_url' cookie

Change Log
Since: 2.0.4

Source File
sanitize_comment_cookies() is located in wp-includes/comment.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/sanitize_comment_cookies" Categories: Functions | New page created

Function Reference/sanitize email Contents


1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
Strips out all characters that are not allowable in an email.

Usage
<?php sanitize_email( $email ) ?>

Parameters
$email (string) (required) Email address to lter. Default: None

Return Values
(string) Filtered email address.

Examples Notes
This function uses a smaller allowable character set than the set dened by RFC 5322. Some legal email addresses may be changed. Allowed character regular expression: /[^a-z0-9+_.@-]/i.

Change Log
Since: 1.5.0

Source File
sanitize_email() is located in wp-includes/formatting.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/sanitize_email" Categories: Functions | New page created

Function Reference/sanitize le name Contents


1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
Filters certain characters from the le name. Turns all strings to lowercase removing most characters except alphanumeric with spaces, dashes and periods. All spaces and underscores are converted to dashes. Multiple dashes are converted to a single dash. Finally, if the le name ends with a dash, it is removed.

Usage
<?php sanitize_file_name( $name ) ?>

Parameters
$name (string) (required) The le name Default: None

Return Values
(string) Sanitized le name

Examples Notes Change Log


Since: 2.1.0

Source File
sanitize_le_name() is located in wp-includes/formatting.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/sanitize_le_name" Categories: Functions | New page created

Function Reference/sanitize title


Please contribute to this page. To create URLs the same way that WordPress creates URLs, simply use: $new_url = sanitize_title('This Long Title is what My Post or Page might be'); print $new_url; and that will return a formatted value, the output would be this: this-long-title-is-what-my-post-or-page-might-be Retrieved from "http://codex.wordpress.org/Function_Reference/sanitize_title"

Function Reference/sanitize title with dashes Contents


1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
Sanitizes title, replacing whitespace with dashes. Limits the output to alphanumeric characters, underscore (_) and dash (-). Whitespace becomes a dash.

Usage
<?php sanitize_title_with_dashes( $title ) ?>

Parameters
$title (string) (required) The title to be sanitized. Default: None

Return Values
(string) The sanitized title.

Examples Notes Change Log


Since: 1.2.0

Source File
sanitize_title_with_dashes() is located in wp-includes/formatting.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/sanitize_title_with_dashes" Categories: Functions | New page created

Function Reference/sanitize user Contents


1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
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 lter.

Usage
<?php sanitize_user( $username, $strict ) ?>

Parameters
$username (string) (required) The username to be sanitized. Default: None $strict (boolean) (optional) If set limits $username to specic characters. Default: false

Return Values
(string) The sanitized username, after passing through lters.

Examples Notes
Uses: apply_lters() Calls 'sanitize_user' hook on username, raw username, and $strict parameter.

Change Log
Since: 2.0.0

Source File
sanitize_user() is located in wp-includes/formatting.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/sanitize_user" Categories: Functions | New page created

Function Reference/seems utf8 Contents


1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
Checks to see if a string is utf8 encoded.

Usage
<?php seems_utf8( $Str ) ?>

Parameters
$Str (string) (required) The string to be checked Default: None

Return Values
(boolean) True if $Str ts a UTF-8 model, false otherwise.

Examples Notes

Change Log
Since: 1.2.1

Source File
seems_utf8() is located in wp-includes/formatting.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/seems_utf8" Categories: Functions | New page created

Function Reference/set current user Contents


1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
This function can be replaced via plugins. If plugins do not redene 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.

Usage
<?php set_current_user( $id, $name ) ?>

Parameters
$id (integer|null) (required) User ID. Default: None $name (string) (optional) The user's username Default: ''

Return Values
(object) returns values returned by wp_set_current_user()

Examples Notes
This function can be replaced via plugins. If plugins do not redene these functions, then this will be used instead. Uses: wp_set_current_user()

Change Log
Since: 2.0.1

Source File
set_current_user() is located in wp-includes/pluggable.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/set_current_user" Categories: Functions | New page created

Function Reference/set theme mod

Contents
1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
Update theme modication value for the current theme.

Usage
<?php set_theme_mod( $name, $value ) ?>

Parameters
$name (string) (required) Theme modication name. Default: None $value (string) (required) Theme modication value. Default: None

Return Values
(void) This function does not return a value.

Examples Notes Change Log


Since: 2.1.0

Source File
set_theme_mod() is located in wp-includes/theme.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/set_theme_mod" Categories: Functions | New page created

Function Reference/spawn cron Contents


1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
Send request to run cron through HTTP request that doesn't halt page loading.

Usage
<?php spawn_cron( $local_time ) ?>

Parameters Return Values


(null) Cron could not be spawned, because it is not needed to run.

Examples Notes
Cron is named after a unix program which runs unattended scheduled tasks.

Change Log
Since: 2.1.0

Source File
spawn_cron() is located in wp-includes/cron.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/spawn_cron" Categories: Functions | New page created

Function Reference/status header Contents


1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
Set HTTP status header.

Usage
<?php status_header( $header ) ?>

Parameters
$header (integer) (required) HTTP status code Default: None

Return Values
(null) Does not return anything.

Examples Notes
Uses: apply_lters() Calls 'status_header' on status header string, HTTP HTTP code, HTTP code description, and protocol string as separate parameters.

Change Log
Since: 2.0.0

Source File
status_header() is located in wp-includes/functions.php.

Related

Retrieved from "http://codex.wordpress.org/Function_Reference/status_header" Categories: Functions | New page created

Function Reference/stripslashes deep


The function stripslashes_deep() removes slashes that result from PHP magic quotes being enabled. This function is taken verbatim, directly from the PHP manual, and is documented at http://www.php.net/manual/en/security.magicquotes.disabling.php You may want this function when developing your own PHP application intended to run within the WordPress environment. Specically, your program needs to strip slashes when data arrives via $_POST, $_GET, $_COOKIE, and $_REQUEST arrays. An example would be a "Contact Me" page and the ancillary program that sanitizes the user-supplied text. Such user inputs typically travel from an HTML <form method="post" ... > to your program by way of the $_POST array. stripslashes_deep(), in that case, could be used thus: $_POST = array_map( 'stripslashes_deep', $_POST ); This example of stripslashes_deep() is recursive and will walk through the $_POST array even when some of the elements are themselves an array. When you write program code for public distribution, you do not know ahead of time if the target server has magic quotes enabled. It is, therefore, best coding practice for your program to check for magic quotes and strip slashes if need be. It is worth knowing that stripalshes_deep() does not check for the presence of slashes. Your program would, most properly, test for and remove magic quote slashes. One possible way to use stripslashes_deep() is this: if( get_magic_quotes_gpc() ) { $_POST = array_map( 'stripslashes_deep', $_POST ); $_GET = array_map( 'stripslashes_deep', $_GET ); $_COOKIE = array_map( 'stripslashes_deep', $_COOKIE ); $_REQUEST = array_map( 'stripslashes_deep', $_REQUEST ); } The existence of magic quotes has been a headache for many PHP composers. Future versions of PHP may very likely deprecate them. Code will, however, need to continue to work around them as long as PHP4 and PHP5 remain in use. Retrieved from "http://codex.wordpress.org/Function_Reference/stripslashes_deep"

Function Reference/switch theme Contents


1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
Switches current theme to new template and stylesheet names.

Usage
<?php switch_theme( $template, $stylesheet ) ?>

Parameters
$template (string) (required) Template name. Default: None $stylesheet (string) (required) Stylesheet name. Default: None

Return Values
(void)

This function does not return a value.

Examples Notes
Uses: do_action() Calls 'switch_theme' action on updated theme display name.

Change Log
Since: unknown

Source File
switch_theme() is located in wp-includes/theme.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/switch_theme" Categories: Functions | New page created

Function Reference/the category rss Contents


1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
Display the post categories in the feed.

Usage
<?php the_category_rss( $type ) ?>

Parameters
$type (string) (optional) default is 'rss'. Either 'rss', 'atom', or 'rdf'. Default: 'rss'

Return Values
(void) This function does not return a value.

Examples Notes
See get_the_category_rss() for better explanation. Echos the return from get_the_category_rss().

Change Log
Since: 0.71

Source File
the_category_rss() is located in wp-includes/feed.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/the_category_rss" Categories: Functions | New page created

Function Reference/the content rss

Contents
1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
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.

Usage
<?php the_content_rss( $more_link_text, $stripteaser, $more_file, $cut, $encode_html ) ?>

Parameters
$more_link_text (string) (optional) Text to display when more content is available but not displayed. Default: 'more...' $stripteaser (integer|boolean) (optional) Default is 0. Default: 0 $more_le (string) (optional) Optional. Default: '' $cut (integer) (optional) Amount of words to keep for the content. Default: 0 $encode_html (integer) (optional) How to encode the content. Default: 0

Return Values
(void) This function does not return a value.

Examples Notes
See get_the_content() For the $more_link_text, $stripteaser, and $more_le parameters. Uses: apply_lters() Calls 'the_content_rss' on the content before processing.

Change Log
Since: 0.71

Source File
the_content_rss() is located in wp-includes/feed.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/the_content_rss" Categories: Functions | New page created

Function Reference/the excerpt rss Contents


1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
Display the post excerpt for the feed.

Usage
<?php the_excerpt_rss() ?>

Parameters
None.

Return Values
(void) This function does not return a value.

Examples Notes
Uses: apply_lters() Calls 'the_excerpt_rss' hook on the excerpt.

Change Log
Since: 0.71

Source File
the_excerpt_rss() is located in wp-includes/feed.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/the_excerpt_rss" Categories: Functions | New page created

Function Reference/the title rss Contents


1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
Display the post title in the feed.

Usage
<?php the_title_rss() ?>

Parameters
None.

Return Values
(void) This function does not return a value.

Examples Notes
Uses: get_the_title_rss() Used to retrieve current post title.

Change Log
Since: 0.71

Source File
the_title_rss() is located in wp-includes/feed.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/the_title_rss" Categories: Functions | New page created

Function Reference/trackback Contents


1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
Send a trackback. Updates database when sending trackback to prevent duplicates.

Usage
<?php trackback( $trackback_url, $title, $excerpt, $ID ) ?>

Parameters
$trackback_url (string) (required) URL to send trackbacks. Default: None $title (string) (required) Title of post. Default: None $excerpt (string) (required) Excerpt of post. Default: None $ID (integer) (required) Post ID. Default: None

Return Values
(mixed) Database query from update.

Examples Notes
Uses global: (object) $wpdb to update the _posts table from the database. Uses: get_permalink() on $ID. Uses: get_option() to retrieve the 'blogname' option. Uses: wp_remote_post() on $trackback_url. Uses: is_wp_error()

Change Log
Since: 0.71

Source File
trackback() is located in wp-includes/comment.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/trackback" Categories: Functions | New page created

Function Reference/trackback url list Contents


1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
Do trackbacks for a list of URLs.

Usage
<?php trackback_url_list( $tb_list, $post_id ) ?>

Parameters
$tb_list (string) (required) Comma separated list of URLs Default: None $post_id (integer) (required) Post ID Default: None

Return Values
(void) This function does not return a value.

Examples Notes
Uses: wp_get_single_post() on $post_id. Uses: trackback() on each trackback url.

Change Log
Since: 1.0.0

Source File
trackback_url_list() is located in wp-includes/post.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/trackback_url_list" Categories: Functions | New page created

Function Reference/trailingslashit Contents


1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
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 specic path support.

Usage
<?php trailingslashit( $string ) ?>

Parameters
$string (string) (required) What to add the trailing slash to. Default: None

Return Values
(string) String with trailing slash added.

Examples Notes
Uses: untrailingslashit() Unslashes string if it was slashed already. This: '/' is a slash.

Change Log
Since: 1.2.0

Source File
trailingslashit() is located in wp-includes/formatting.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/trailingslashit" Categories: Functions | New page created

Function Reference/untrailingslashit Contents


1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
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 specic path support.

Usage
<?php untrailingslashit( $string ) ?>

Parameters
$string (string) (required) What to remove the trailing slash from. Default: None

Return Values
(string) String without the trailing slash.

Examples Notes
This: '/' is a slash.

Change Log
Since: 2.2.0

Source File
untrailingslashit() is located in wp-includes/formatting.php.

Related
trailingslashit() Retrieved from "http://codex.wordpress.org/Function_Reference/untrailingslashit" Categories: Functions | New page created

Function Reference/update attached le Contents


1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
Update attachment le path based on attachment ID. Used to update the le path of the attachment, which uses post meta name '_wp_attached_le' to store the path of the attachment.

Usage
<?php update_attached_file( $attachment_id, $file ) ?>

Parameters
$attachment_id (integer) (required) Attachment ID Default: None $le (string) (required) File path for the attachment

Default: None

Return Values
(boolean) False on failure, true on success.

Examples Notes
Uses: apply_lters() to add update_attached_le() on $le and $attachment_id.

Change Log
Since: 2.1.0

Source File
update_attached_le() is located in wp-includes/post.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/update_attached_le" Categories: Functions | New page created

Function Reference/update option Contents


1 Description 2 Usage 3 Example 4 Parameters

Description
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. Proper use of this function suggests using get_option to retrieve the option and if tested for true, then use update_option. If get_option returns false, then add_option should be used instead. Note that update_option 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 update_option function.

Usage
<?php update_option('option_name', 'newvalue'); ?>

Example
Update the option name myhack_extraction_length with the value 255. If the option does not exist then use add_option and set autoload to no. <?php $option_name = 'myhack_extraction_length' ; $newvalue = '255' ; if ( get_option($option_name) ) { update_option($option_name, $newvalue); } else { $deprecated=' '; $autoload='no'; add_option($option_name, $newvalue, $deprecated, $autoload); } ?>

Parameters
option_name (string) (required) Name of the option to update. A list of valid default options to update can be found at the Option Reference. Default: None newvalue

(string) (required) The NEW value for this option name. This value can be a string, an array, an object or a serialized value. Default: None This article is marked as in need of editing. You can help Codex by editing it. Retrieved from "http://codex.wordpress.org/Function_Reference/update_option" Categories: Functions | Copyedit

Function Reference/update post meta Contents


1 Description 2 Usage 3 Examples 3.1 Default Usage 3.2 Other Examples 4 Parameters 5 Related

Description
The function, update post meta(), updates the value of an existing meta key (custom eld) for the specied post. The function returns true upon successful updating, and returns false if the post does not have the meta key specied. If you want to add a new meta key and value, use the add_post_meta() function instead.

Usage
<?php update_post_meta($post_id, $meta_key, $meta_value, $prev_value); ?>

Examples
Default Usage
<?php update_post_meta(76, 'my_key', 'Steve'); ?>

Other Examples
Assuming a post has an ID of 76, and the following 4 custom elds:

[key_1] => 'Happy' [key_1] => 'Sad' [key_2] => 'Gregory' [my_key] => 'Steve'

To change key_2's value to Hans: <?php update_post_meta(76, 'key_2', 'Hans'); ?> To change key_1's value from Sad to Happy: <?php update_post_meta(76, 'key_1', 'Happy', 'Sad'); ?> The elds would now look like this:

[key_1] => 'Happy' [key_1] => 'Happy' [key_2] => 'Hans' [my_key] => 'Steve'

Note: This function will update only the rst eld that matches the criteria. To change the rst key_1's value from Happy to Excited: <?php update_post_meta(76, 'key_1', 'Excited', 'Happy'); //Or update_post_meta(76, 'key_1', 'Excited'); //To change all fields with the key "key_1": $key1_values = get_post_custom_values('key_1', 76); foreach ( $key1_values as $value ) update_post_meta(76, 'key_1', 'Excited', $value); ?> For a more detailed example, go to the post_meta Functions Examples page.

Parameters
$post_id (integer) (required) The ID of the post which contains the eld you will edit. Default: None $meta_key (string) (required) The key of the custom eld you will edit. Default: None $meta_value (string) (required) The new value of the custom eld. Default: None $prev_value (string) (optional) The old value of the custom eld you wish to change. This is to differentiate between several elds with the same key. Default: None

Related
delete_post_meta(), get_post_meta(), add_post_meta(), get_post_custom(), get_post_custom_values(), get_post_custom_keys() Retrieved from "http://codex.wordpress.org/Function_Reference/update_post_meta" Categories: Functions | New page created | Needs Review

Function Reference/update user option Contents


1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
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 false it will prepend the WordPress table prex to the option name.

Usage
<?php update_user_option( $user_id, $option_name, $newvalue, $global ) ?>

Parameters

$user_id (integer) (required) User ID Default: None $option_name (string) (required) User option name. Default: None $newvalue (mixed) (required) User option value. Default: None $global (boolean) (optional) Whether option name is blog specic or not. Default: false

Return Values
(unknown)

Examples Notes
Uses global: (object) $wpdb WordPress database object for queries.

Change Log
Since: 2.0.0

Source File
update_user_option() is located in wp-includes/user.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/update_user_option" Categories: Functions | New page created

Function Reference/update usermeta Contents


1 Description 2 Gotchas 3 Usage 4 Parameters

Description
This function updates the value of a specic metakey pertaining to the user whose ID is passed via the userid parameter. It returns true if the update was successful and false if it was unsuccessful.

Gotchas
If the meta_key contains a hyphen, it is automatically stripped and inserted without, e.g. "opt-in" becomes "optin". Underscores, however, will work as expected.

Usage
<?php update_usermeta(userid,'metakey','metavalue'); ?>

Parameters
$userid (integer) (required) The ID of the user whose data should be updated. Default: None $metakey (string) (required) The metakey to be updated. 'metakey' The meta_key in the wp_usermeta table for the meta_value to be updated. Default: None

$metavalue (string) (required) The new desired value of the metakey. Default: None This article is marked as in need of editing. You can help Codex by editing it. Retrieved from "http://codex.wordpress.org/Function_Reference/update_usermeta" Categories: Functions | Copyedit

Function Reference/user pass ok Contents


1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
Check that the user login name and password is correct.

Usage
<?php user_pass_ok( $user_login, $user_pass ) ?>

Parameters
$user_login (string) (required) User name. Default: None $user_pass (string) (required) User password. Default: None

Return Values
(boolean) False if does not authenticate, true if username and password authenticates.

Examples Notes Change Log


Since: 0.71

Source File
user_pass_ok() is located in wp-includes/user.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/user_pass_ok" Categories: Functions | New page created

Function Reference/username exists Contents


1 Description 2 Usage 3 Examples 4 Paramaters 5 Returns 6 Further Reading

Description
Returns the user ID if the user exists or null if the user doesn't exist.

Usage
<?php require ( ABSPATH . WPINC . '/registration.php' ); if (username_exists($username)){ } ?>

Examples
Use username_exists() in your scripts to decide whether the given username exists. <?php $username = $_POST['username']; if (username_exists($username)) echo "Username In Use!"; else echo "Username Not In Use!"; ?>

Paramaters
$username a string representing the username to check for existence

Returns
This function returns the user ID if the user exists or null if the user does not exist

Further Reading
For a comprehensive list of functions, take a look at the category Functions Also, see Function_Reference Retrieved from "http://codex.wordpress.org/Function_Reference/username_exists" Categories: Functions | New page created

Function Reference/utf8 uri encode Contents


1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
Encode the Unicode values to be used in the URI.

Usage
<?php utf8_uri_encode( $utf8_string, $length ) ?>

Parameters
$utf8_string (string) (required) Default: None $length (integer) (optional) Max length of the string Default: 0

Return Values
(string) String with Unicode encoded for URI.

Examples Notes Change Log


Since: 1.5.0

Source File
utf8_uri_encode() is located in wp-includes/formatting.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/utf8_uri_encode" Categories: Functions | New page created

Function Reference/validate current theme Contents


1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
Checks that current theme les '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' lter to return false to disable this functionality.

Usage
<?php validate_current_theme() ?>

Parameters
None.

Return Values
(boolean)

Examples Notes Change Log


Since: 1.5.0

Source File
validate_current_theme() is located in wp-includes/theme.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/validate_current_theme" Categories: Functions | New page created

Function Reference/validate username

Contents
1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
Checks whether username is valid.

Usage
<?php validate_username( $username ) ?>

Parameters
$username (string) (required) Username. Default: None

Return Values
(boolean) Returns true if $username is valid, false if $username is invalid.

Examples Notes
Uses: apply_lters() Calls validate_username hook on $valid check and $username as parameters. Uses: sanitize_user()

Change Log
Since: 2.0.1

Source File
validate_username() is located in wp-includes/registration.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/validate_username" Categories: Functions | New page created

Function Reference/weblog ping Contents


1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
Send a pingback.

Usage
<?php weblog_ping( $server, $path ) ?>

Parameters

$server (string) (optional) Host of blog to connect to. Default: '' $path (string) (optional) Path to send the ping. Default: ''

Return Values
(void) This function does not return a value.

Examples Notes
Uses global: (string) $wp_version holds the installed WordPress version number. Uses: IXR_Client WordPress class. Uses: get_option() to retrieve the 'home' option. Uses: get_option() to retrieve the 'blogname' option. Uses: get_bloginfo() to retrieve the 'rss2_url'.

Change Log
Since: 1.2.0

Source File
weblog_ping() is located in wp-includes/comment.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/weblog_ping" Categories: Functions | New page created

Function Reference/wp Contents


1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
Setup the WordPress query.

Usage
<?php wp( $query_vars ) ?>

Parameters
$query_vars (string) (optional) Default WP_Query arguments. Default: ''

Return Values
(void) This function does not return a value.

Examples Notes
Uses global: (object) $wp

Uses global: (object) $wp_query Uses global: (object) $wp_the_query

Change Log
Since: 2.0.0

Source File
wp() is located in wp-includes/functions.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/wp" Categories: Functions | New page created

Function Reference/wp allow comment Contents


1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
Validates whether this comment is allowed to be made or not.

Usage
<?php wp_allow_comment( $commentdata ) ?>

Parameters
$commentdata (array) (required) Contains information on the comment Default: None

Return Values
(mixed) Signies the approval status (0|1|'spam')

Examples Notes
Uses: $wpdb Uses: apply_lters() Calls 'pre_comment_approved' hook on the type of comment Uses: do_action() Calls 'check_comment_ood' hook on $comment_author_IP, $comment_author_email, and $comment_date_gmt Uses: The WP_User object. Uses: get_userdata() Uses: check_comment() Uses: wp_blacklist_check() to nd spam.

Change Log
Since: 2.0.0

Source File
wp_allow_comment() is located in wp-includes/comment.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/wp_allow_comment" Categories: Functions | New page created

Function Reference/wp attachment is image

Contents
1 Description 2 Usage 3 Example 4 Parameters

Description
This function determines if a post is an image

Usage
<?php wp_attachment_is_image( $post_id ); ?>

Example
To check if post ID 37 is an image: <?php $id = 37 if ( wp_attachment_is_image( $id ) ) echo "Post ".$id." is an image!"; else echo "Post ".$id." is not an image."; ?>

Parameters
$post_id (int) (optional) Integer ID of the post. Default: 0 Retrieved from "http://codex.wordpress.org/Function_Reference/wp_attachment_is_image" Categories: Functions | New page created

Function Reference/wp check letype Contents


1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
Retrieve the le type from the le name. You can optionally dene the mime array, if needed.

Usage
<?php wp_check_filetype( $filename, $mimes ) ?>

Parameters
$lename (string) (required) File name or path. Default: None $mimes (array) (optional) Key is the le extension with value as the mime type. Default: null

Return Values

(array) Values with extension rst and mime type.

Examples Notes Change Log


Since: 2.0.4

Source File
wp_check_letype() is located in wp-includes/functions.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/wp_check_letype" Categories: Functions | New page created

Function Reference/wp check for changed slugs Contents


1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
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 eld. 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 eld ('_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.

Usage
<?php wp_check_for_changed_slugs( $post_id ) ?>

Parameters
$post_id (integer) (required) Post ID. Default: None

Return Values
(integer) Same as $post_id

Examples Notes
Uses: May use add_post_meta() or delete_post_meta() depending on current post data (get_post_meta()).

Change Log
Since: 2.1.0

Source File
wp_check_for_changed_slugs() is located in wp-includes/post.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/wp_check_for_changed_slugs" Categories: Functions | New page created

Function Reference/wp clear scheduled hook Description


Un-schedules all previously-scheduled cron jobs using a particular hook name.

Usage
<?php wp_clear_scheduled_hook('my_schedule_hook'); ?> See: wp_schedule_event wp_schedule_single_event wp_unschedule_event This page is marked as incomplete. You can help Codex by expanding it. Retrieved from "http://codex.wordpress.org/Function_Reference/wp_clear_scheduled_hook" Categories: Stubs | Functions | New page created | WP-Cron Functions

Function Reference/wp clearcookie Contents


1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
This function can be replaced via plugins. If plugins do not redene these functions, then this will be used instead. Clears the authentication cookie, logging the user out. This function is deprecated. Use wp_set_auth_cookie() instead.

Usage
<?php wp_clearcookie() ?>

Parameters
None.

Return Values
(void) This function does not return a value.

Examples Notes
This function can be replaced via plugins. If plugins do not redene these functions, then this will be used instead. This function is deprecated. Use wp_set_auth_cookie() instead.

Change Log
Since: 1.5 Deprecated: 2.5.0

Source File
wp_clearcookie() is located in wp-includes/pluggable.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/wp_clearcookie" Categories: Functions | New page created

Function Reference/wp count posts Contents


1 Description 2 Usage 3 Examples 3.1 Default Usage 3.2 Get the Publish Status Post Count 3.3 Count Drafts 3.4 Count Pages 3.5 Other Uses 4 Parameters

Description
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.

Usage
<?php wp_count_posts('type'); ?> <?php wp_count_posts('type', 'readable'); ?>

Examples
Default Usage
The default usage returns a count of the posts that are published. This will be an object, you can var_dump() the contents to debug the output. <?php $count_posts = wp_count_posts(); ?>

Get the Publish Status Post Count


To get the published status type, you would call the wp_count_posts() function and then access the 'publish' property. <?php $count_posts = wp_count_posts(); $published_posts = $count_posts->publish; ?> If you are developing for PHP5 only, then you can use shorthand, if you only want to get one status. This will not work in PHP4 and if you want to maintain backwards compatibility, then you must use the above code. <?php $published_posts = wp_count_posts()->publish; ?>

Count Drafts
Counting drafts is handled the same way as the publish status. <?php $count_posts = wp_count_posts(); $draft_posts = $count_posts->draft;

?>

Count Pages
Counting pages status types are done in the same way as posts and make use of the rst parameter. Finding the number of posts for the post status is done the same way as for posts. <?php $count_pages = wp_count_posts('page'); ?>

Other Uses
The wp_count_posts() can be used to nd the number for post statuses of any post type. This includes attachments or any post type added in the future, either by a plugin or part of the WordPress Core.

Parameters
type (string) Type of row in wp_posts to count where type is equal to post_type. Defaults to post perm (string) To include private post status, use 'readable' and requires that the user be logged in. Default to empty string Retrieved from "http://codex.wordpress.org/Function_Reference/wp_count_posts" Category: Functions

Function Reference/wp create nonce Contents


1 Description 2 Parameters 3 Returns 4 Example 5 See also

Description
Creates a random, one time use token.

Parameters
$action (string) (int) Scalar value to add context to the nonce. Default: -1

Returns
@return string The one use form token.

Example
<?php $nonce= wp_create_nonce ('my-nonce'); ?> <a href='myplugin.php?_wpnonce=<?php echo $nonce ?>'> ... <?php $nonce=$_REQUEST['_wpnonce']; if (! wp_verify_nonce($nonce, 'my-nonce') ) die('Security check'); ?>

See also
Wordpress Nonce Implementation wp_verify_nonce check_admin_referer

This page is marked as incomplete. You can help Codex by expanding it. Retrieved from "http://codex.wordpress.org/Function_Reference/wp_create_nonce" Categories: Stubs | Functions

Function Reference/wp create user Contents


1 Description 2 Usage 3 Example 4 Parameters 5 Returns

Description
The wp_create_user function allows you to insert a new user into the WordPress database by parsing 3 (three) parameters through to the function itself. 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.

Usage
<?php wp_create_user($username, $password, $email ); ?>

Example
As used in wp-admin/upgrade-functions.php: $user_id = username_exists($user_name); if ( !$user_id ) { $random_password = substr(md5(uniqid(microtime())), 0, 6); $user_id = wp_create_user($user_name, $random_password, $user_email); } else { $random_password = __('User already exists. Password inherited.'); }

Parameters
$username (string) (required) The username of the user to be created. Default: None $password (string) (required) The password of the user to be created. Default: None $email (string) (optional) The email address of the user to be created. Default: None

Returns
This function returns the user ID of the created user. This article is marked as in need of editing. You can help Codex by editing it. Retrieved from "http://codex.wordpress.org/Function_Reference/wp_create_user" Categories: Functions | Copyedit

Function Reference/wp cron Contents


1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log

8 Source File 9 Related

Description
Run scheduled callbacks or spawn cron for all scheduled events.

Usage
<?php wp_cron() ?>

Parameters
None.

Return Values
(null) When doesn't need to run Cron.

Examples Notes
Cron is named after a unix program which runs unattended scheduled tasks.

Change Log
Since: 2.1.0

Source File
wp_cron() is located in wp-includes/cron.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/wp_cron" Categories: Functions | New page created

Function Reference/wp delete attachment Contents


1 Description 2 Usage 3 Example 4 Parameters 5 Hooks 6 Related

Description
This function deletes an attachment

Usage
<?php wp_delete_attachment( $postid ); ?>

Example
To delete an attachment with an ID of '76': <?php delete_post_meta( 76 ); ?>

Parameters
$postid (integer) (required) The ID of the attachment you would like to delete. Default: None

Hooks
This function res the delete_attachment action hook, passing the attachment's ID ($postid).

Related
wp_get_attachment_url() delete_attachment This page is marked as incomplete. You can help Codex by expanding it. Retrieved from "http://codex.wordpress.org/Function_Reference/wp_delete_attachment" Categories: Functions | New page created | Stubs

Function Reference/wp delete comment Contents


1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
Removes comment ID and maybe updates post comment count. The post comment count will be updated if the comment was approved and has a post ID available.

Usage
<?php wp_delete_comment( $comment_id ) ?>

Parameters
$comment_id (integer) (required) Comment ID Default: None

Return Values
(boolean) False if delete comment query failure, true on success.

Examples Notes
Uses: $wpdb Uses: do_action() Calls 'delete_comment' hook on comment ID Uses: do_action() Calls 'wp_set_comment_status' hook on comment ID with 'delete' set for the second parameter Uses: wp_transition_comment_status() Passes new and old comment status along with $comment object Uses: get_comment() Uses: wp_update_comment_count() to decrease count on success. Uses: clean_comment_cache() to remove comment form cache on success.

Change Log
Since: 2.0.0

Source File
wp_delete_comment() is located in wp-includes/comment.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/wp_delete_comment" Categories: Functions | New page created

Function Reference/wp delete post

Contents
1 Description 2 Usage 3 Examples 3.1 Default Usage 4 Parameters

Description
Deleting a post by post ID.

Usage
<?php wp_delete_post($post_id); ?>

Examples
Deleting WP default post "Hello World" which ID is '1'. <?php wp_delete_post(1); ?>

Default Usage

Parameters
post_id Retrieved from "http://codex.wordpress.org/Function_Reference/wp_delete_post" Category: Functions

Function Reference/wp delete user Description


The wp_delete_user function allows you to delete a user from the WordPress database by parsing 2 (two) parameters through to the function itself.

Usage
<?php wp_delete_user($id, $reassign = 'novalue') ?> Function_Reference Retrieved from "http://codex.wordpress.org/Function_Reference/wp_delete_user"

Function Reference/wp die Contents


1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
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 siliently.

Usage
<?php wp_die( $message, $title, $args ) ?>

Parameters

$message (string) (required) Error message. Default: None $title (string) (optional) Error title. Default: '' $args (string|array) (optional) Optional arguements to control behaviour. Default: array

Return Values
(void) This function does not return a value.

Examples Notes
Uses global: (object) $wp_locale Handles the date and time locales.

Change Log
Since: 2.0.4

Source File
wp_die() is located in wp-includes/functions.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/wp_die" Categories: Functions | New page created

Function Reference/wp enqueue script Contents


1 Description 2 Usage 3 Example 3.1 Usage 4 Parameters 5 Resources

Description
A safe way of adding javascripts to a WordPress generated page.

Usage
<?php wp_enqueue_script( 'handle', 'src', 'deps', 'ver'); ?>

Example
Usage
Load the scriptaculous script: <?php wp_enqueue_script('scriptaculous'); ?> Add and load a new script that depends on scriptaculous (this will also cause it to load scriptaculous into the page as well): <?php wp_enqueue_script('newscript', '/wp-content/plugins/someplugin/js/newscript.js', array('scriptaculous'), '1.0' ); ?> Note: This function will not work if it is called from a wp_head action, as the <script> tags are output before wp_head runs. Instead, call wp_enqueue_script from an init action function.

Parameters

handle (string) Name of the script. Lowercase string. src (string) (Optional) Path to the script from the root directory of WordPress. Example: "/wp-includes/js/scriptaculous/scriptaculous.js". This parameter is only required when WordPress does not already know about this script. Defaults to false. deps (array) (Optional) Array of handles of any script that this script depends on; scripts that must be loaded before this script. false if there are no dependencies. This parameter is only required when WordPress does not already know about this script. Defaults to false. ver (string) (Optional) String specifying the script version number, if it has one. Defaults to false. This parameter is used to ensure that the correct version is sent to the client regardless of caching, and so should be included if a version number is available and makes sense for the script. Default scripts included with WordPress:

Script Name
Scriptaculous Root Scriptaculous Builder Scriptaculous Drag & Drop Scriptaculous Effects Scriptaculous Slider Scriptaculous Sound Scriptaculous Controls Scriptaculous Image Cropper SWFUpload SWFUpload Degarade SWFUpload Queue SWFUpload Handlers jQuery jQuery Form jQuery Color jQuery UI Core jQuery UI Tabs jQuery UI Sortable jQuery Interface jQuery Schedule jQuery Suggest ThickBox Simple AJAX Code-Kit QuickTags ColorPicker Tiny MCE Prototype Framework Autosave WordPress AJAX Response List Manipulation WP Common WP Editor WP Editor Functions AJAX Cat Admin Categories Admin Tags Admin custom elds PAssword Strength Meter Admin Comments Admin Users Admin Forms XFN Upload PostBox Slug

Handle
scriptaculous-root scriptaculous-builder scriptaculous-dragdrop scriptaculous-effects scriptaculous-slider scriptaculous-sound scriptaculous-controls scriptaculous cropper swfupload swfupload-degrade swfupload-queue swfupload-handlers jquery jquery-form jquery-color jquery-ui-core jquery-ui-tabs jquery-ui-sortable interface schedule suggest thickbox sack quicktags colorpicker tiny_mce prototype autosave wp-ajax-response wp-lists common editor editor-functions ajaxcat admin-categories admin-tags admin-custom-elds password-strength-meter admin-comments admin-users admin-forms xfn upload postbox slug

Post Page Link Comment Admin Gallery Media Upload Admin widgets Word Count WP Gears Theme Preview

post page link comment admin-gallery media-upload admin-widgets word-count wp-gears theme-preview

Resources
Best practice for adding JavaScript code to WordPress plugins Loading Javascript Libraries in Wordpress Plugins with wp_enqueue_script() How To: Load Javascript With Your WordPress Plugin How to load JavaScript in WordPress plugins wp_enqueue_script question on wp-hackers Using JavaScript and CSS with your WordPress Plugin Using Javascript libraries with your Wordpress plugin or theme This article is marked as in need of editing. You can help Codex by editing it. Retrieved from "http://codex.wordpress.org/Function_Reference/wp_enqueue_script" Categories: New page created | Functions | Copyedit

Function Reference/wp enqueue style Contents


1 Description 2 Usage 3 Example 4 Parameters

Description
A safe way of adding cascading style sheets to a WordPress generated page.

Usage
<?php wp_enqueue_style( $handle, $src = false, $deps = array(), $ver = false, $media = false ); ?>

Example
<?php /* * This example will work with WordPress 2.7 */ /* * register with hook 'wp_print_styles' */ add_action('wp_print_styles', 'add_my_stylesheet'); /* * Enqueue style-file, if it exists. */ function add_my_stylesheet(){ $myStyleFile = WP_PLUGIN_URL.'/myPlugin/style.css'; if (file_exists($myStyleFile)){ wp_register_style('myStyleSheets', $myStyleFile); wp_enqueue_style( 'myStyleSheets');

} } ?> Note: This function will not work if it is called from a wp_head action, as the <style> tags are output before wp_head runs. Instead, call wp_enqueue_style from an init or the wp_print_styles action function.

Parameters
handle (string) Name of the stylesheet. src (string) Path to the script from the root directory of WordPress. Example: "/css/mystyle.css". deps (array) (Optional) Array of handles of any stylesheet that this stylesheet depends on; stylesheets that must be loaded before this stylesheet. false if there are no dependencies. Defaults to false. ver (string) (Optional) String specifying the stylesheet version number, if it has one. Defaults to false. This parameter is used to ensure that the correct version is sent to the client regardless of caching, and so should be included if a version number is available and makes sense for the stylesheet. media (string) (Optional) String specifying the media for which this stylesheet has been dened. Examples: "all", "screen", "handheld", "print". See this list for the full range of valid CSS-media-types. Retrieved from "http://codex.wordpress.org/Function_Reference/wp_enqueue_style"

Function Reference/wp explain nonce Contents


1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
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 rst 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 lter will be called for any action, which is not dened by WordPress. You may use the lter for your plugin to explain nonce actions to the user, when they get the "Are you sure?" message. The lter 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).

Usage
<?php wp_explain_nonce( $action ) ?>

Parameters
$action (string) (required) Nonce action. Default: None

Return Values
(string) Are you sure message.

Examples

Notes Change Log


Since: 2.0.4

Source File
wp_explain_nonce() is located in wp-includes/functions.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/wp_explain_nonce" Categories: Functions | New page created

Function Reference/wp lter comment Contents


1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
Filters and sanitizes comment data. Sets the comment data 'ltered' eld to true when nished. This can be checked as to whether the comment should be ltered and to keep from ltering the same comment more than once.

Usage
<?php wp_filter_comment( $commentdata ) ?>

Parameters
$commentdata (array) (required) Contains information on the comment. Default: None

Return Values
(array) Parsed comment information.

Examples Notes
Uses: apply_lters() Calls 'pre_user_id' hook on comment author's user ID Uses: apply_lters() Calls 'pre_comment_user_agent' hook on comment author's user agent Uses: apply_lters() Calls 'pre_comment_author_name' hook on comment author's name Uses: apply_lters() Calls 'pre_comment_content' hook on the comment's content Uses: apply_lters() Calls 'pre_comment_user_ip' hook on comment author's IP Uses: apply_lters() Calls 'pre_comment_author_url' hook on comment author's URL Uses: apply_lters() Calls 'pre_comment_author_email' hook on comment author's email address

Change Log
Since: 2.0.0

Source File
wp_lter_comment() is located in wp-includes/comment.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/wp_lter_comment" Categories: Functions | New page created

Function Reference/wp lter kses Contents


1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
Sanitize content with allowed HTML Kses rules.

Usage
<?php wp_filter_kses( $data ) ?>

Parameters
$data (string) (required) Content to lter Default: None

Return Values
(string) Filtered content

Examples Notes
Uses global: (unknown) $allowedtags

Change Log
Since: 1.0.0

Source File
wp_lter_kses() is located in wp-includes/kses.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/wp_lter_kses" Categories: Functions | New page created

Function Reference/wp lter nohtml kses Contents


1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
Strips all of the HTML in the content.

Usage
<?php wp_filter_nohtml_kses( $data ) ?>

Parameters

$data (string) (required) Content to strip all HTML from Default: None

Return Values
(string) Filtered content without any HTML

Examples Notes Change Log


Since: 2.1.0

Source File
wp_lter_nohtml_kses() is located in wp-includes/kses.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/wp_lter_nohtml_kses" Categories: Functions | New page created

Function Reference/wp lter post kses Contents


1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
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.

Usage
<?php wp_filter_post_kses( $data ) ?>

Parameters
$data (string) (required) Post content to lter Default: None

Return Values
(string) Filtered post content with allowed HTML tags and attributes intact.

Examples Notes
Uses global: (unknown) $allowedposttags

Change Log
Since: 2.0.0

Source File
wp_lter_post_kses() is located in wp-includes/kses.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/wp_lter_post_kses" Categories: Functions | New page created

Function Reference/wp get attachment image Contents


1 Description 2 Synopsis 3 Usage 4 Parameters 5 Related

Description
Returns an HTML Image tag representing an attachment le, if there is any. Else returns an empty string.

Synopsis
(string) $image = function wp_get_attachment_image($attachment_id, $size='thumbnail', $icon = false);

Usage
<?php echo wp_get_attachment_image( 1 ); ?> If the attachment is an image it will try to return the thumbnail or the medium sized version, else if it's a non-image le it will return the mime icon.

Parameters
$attachment_id (integer) ID of the desired attachment. Required. $size (string|array) Size of the image shown for an image attachment: either a string keyword (thumbnail, medium, or full) or a 2-item array representing width and height in pixels, e.g. array(32,32). As of Version 2.5, this parameter does not affect the size of media icons, which are always shown at their original size. Optional; default thumbnail $icon (bool) Use a media icon to represent the attachment. Optional; default false.

Related
Use Function_Reference/wp_get_attachment_image_src Retrieved from "http://codex.wordpress.org/Function_Reference/wp_get_attachment_image" Categories: Functions | New page created

Function Reference/wp get attachment image src Contents


1 Description 2 Synopsis 3 Usage 4 Return Values 5 Parameters

Description
Returns an Image representing an attachment le, if there is any. Else returns false.

Synopsis
(array) $image = function wp_get_attachment_image_src($attachment_id, $size='thumbnail', $icon = false);

Usage
<?php $image = wp_get_attachment_image_src( 1 ); ?> If the attachment is an image it will try to return the thumbnail, else if it's a non-image le it will return the mime icon, else will return false.

Return Values
An array containing: $image[0] => url $image[1] => width $image[2] => height

Parameters
$attachment_id (integer) ID of the desired attachment. Required. $size (string|array) Size of the image shown for an image attachment: either a string keyword (thumbnail, medium, or full) or a 2-item array representing width and height in pixels, e.g. array(32,32). As of Version 2.5, this parameter does not affect the size of media icons, which are always shown at their original size. Optional; default thumbnail $icon (bool) Use a media icon to represent the attachment. Optional; default false. Retrieved from "http://codex.wordpress.org/Function_Reference/wp_get_attachment_image_src" Categories: Functions | New page created

Function Reference/wp get attachment metadata Contents


1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
Retrieve attachment meta eld for attachment ID.

Usage
<?php wp_get_attachment_metadata( $post_id, $unfiltered ) ?>

Parameters
$post_id (integer) (required) Attachment ID Default: None $unltered (boolean) (optional) If true, lters are not run. Default: false

Return Values
(string|boolean) Attachment meta eld. False on failure.

Examples Notes Change Log


Since: 2.1.0

Source File
wp_get_attachment_metadata() is located in wp-includes/post.php.

Related

Retrieved from "http://codex.wordpress.org/Function_Reference/wp_get_attachment_metadata" Categories: Functions | New page created

Function Reference/wp get attachment thumb le Contents


1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
Retrieve thumbnail for an attachment.

Usage
<?php wp_get_attachment_thumb_file( $post_id ) ?>

Parameters
$post_id (integer) (optional) Attachment ID. Default: 0

Return Values
(mixed) False on failure. Thumbnail le path on success.

Examples Notes Change Log


Since: 2.1.0

Source File
wp_get_attachment_thumb_le() is located in wp-includes/post.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/wp_get_attachment_thumb_le" Categories: Functions | New page created

Function Reference/wp get attachment thumb url Contents


1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
Retrieve URL for an attachment thumbnail.

Usage
<?php wp_get_attachment_thumb_url( $post_id ) ?>

Parameters
$post_id (integer) (optional) Attachment ID Default: 0

Return Values
(string|boolean) False on failure. Thumbnail URL on success.

Examples Notes Change Log


Since: 2.1.0

Source File
wp_get_attachment_thumb_url() is located in wp-includes/post.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/wp_get_attachment_thumb_url" Categories: Functions | New page created

Function Reference/wp get attachment url Contents


1 Description 2 Example usage & output 3 Parameters 4 Related

Description
Returns a full URI for an attachment le or false on failure.

Example usage & output


<?php echo wp_get_attachment_url(12); ?> outputs something like http://wp.example.net/wp-content/uploads/lename

Parameters
id (integer) (required) The ID of the desired attachment Default: None

Related
You can change the output of this function through the wp_get_attachment_url lter. If you want a URI for the attachment page, not the attachment le itself, you can use get_attachment_link. Retrieved from "http://codex.wordpress.org/Function_Reference/wp_get_attachment_url" Categories: Functions | New page created | Attachments

Function Reference/wp get comment status Contents Description


1 Description The status of a comment by ID. 2 Usage

Usage 3 Parameters 4 Return Values


<?php 6 Notes wp_get_comment_status( $comment_id ) ?>
8 Source Parameters File 9 Related 7 Change Log 5 Examples

$comment_id (integer) (required) Comment ID Default: None

Return Values
(string|boolean) Status might be 'deleted', 'approved', 'unapproved', 'spam' or false on failure.

Examples Notes
Uses: get_comment()

Change Log
Since: 1.0.0

Source File
wp_get_comment_status() is located in wp-includes/comment.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/wp_get_comment_status" Categories: Functions | New page created

Function Reference/wp get cookie login Contents


1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
This function can be replaced via plugins. If plugins do not redene 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.

Usage
<?php wp_get_cookie_login() ?>

Parameters
None.

Return Values
(boolean) Always returns false

Examples Notes
This function can be replaced via plugins. If plugins do not redene these functions, then this will be used instead. 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.

Change Log
Since: 2.0.4

Deprecated: 2.5.0

Source File
wp_get_cookie_login() is located in wp-includes/pluggable.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/wp_get_cookie_login" Categories: Functions | New page created

Function Reference/wp get current commenter Contents


1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
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.

Usage
<?php wp_get_current_commenter() ?>

Parameters Return Values


(array) Comment author, email, url respectively.

Examples Notes
Return array is mapped like this: Array ( ['comment_author'] => 'Harriet Smith, ['comment_author_email'] => 'hsmith@,example.com', ['comment_author_url'] => 'http://example.com/' )

Change Log
Since: 2.0.4

Source File
wp_get_current_commenter() is located in wp-includes/comment.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/wp_get_current_commenter" Categories: Functions | New page created

Function Reference/get currentuserinfo Contents


1 Description 2 Usage 3 Examples 3.1 Default Usage

3.2 Using Separate Globals 4 Parameters

Description
Retrieves the information pertaining to the currently logged in user, and places it in the global variable $userdata. 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: $user_login $user_level $user_ID $user_email $user_url (User's website, as entered in the user's Prole) $user_pass_md5 (A md5 hash of the user password -- a type of encoding that is very nearly, if not entirely, impossible to decode, but useful for comparing input at a password prompt with the actual user password.) $display_name (User's name, displayed according to the 'How to display name' User option)

Usage
<?php get_currentuserinfo(); ?>

Examples
Default Usage
The call to get_currentuserinfo() places the current user's info into $userdata, where it can be retrieved using member variables. <?php global $current_user; get_currentuserinfo(); echo('Username: ' . $current_user->user_login . "\n"); echo('User email: ' . $current_user->user_email . "\n"); echo('User level: ' . $current_user->user_level . "\n"); echo('User first name: ' . $current_user->user_firstname . "\n"); echo('User last name: ' . $current_user->user_lastname . "\n"); echo('User display name: ' . $current_user->display_name . "\n"); echo('User ID: ' . $current_user->ID . "\n"); ?> Username: Zedd User email: my@email.com User level: 10 User rst name: John User last name: Doe User display name: John Doe User ID: 1

Using Separate Globals


Much of the user data is placed in separate global variables, which can be accessed directly. <?php global $display_name , $user_email; get_currentuserinfo(); echo($display_name . "'s email address is: " . $user_email); ?> Zedd's email address is: fake@email.com

: NOTE: $display_name does not appear to work in 2.5+? $user_login works ne.

<?php global $user_login , $user_email; get_currentuserinfo(); echo($user_login . "'s email address is: " . $user_email); ?>

Parameters
This function does not accept any parameters. To determine if there is a user currently logged in, do this: <?php global $user_ID; get_currentuserinfo(); if ('' == $user_ID) { //no user logged in } ?> Here is another IF STATEMENT Example. It was used in the sidebar, in reference to the "My Fav" plugin at http://www.kriesi.at/archives /wordpress-plugin-my-favorite-posts <?php if ( $user_ID ) { ?> <!-- enter info that logged in users will see --> <!-- in this case im running a bit of php to a plugin --> <?php mfp_display(); ?> <?php } else { ?> <!-- here is a paragraph that is shown to anyone not logged in --> <p>By <a href="<?php bloginfo('url'); ?>/wp-register.php">registering</a>, you can save your favorite posts for future <?php } ?> This article is marked as in need of editing. You can help Codex by editing it. Retrieved from "http://codex.wordpress.org/Function_Reference/get_currentuserinfo" Categories: Functions | Copyedit

Function Reference/wp get http headers Contents


1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
Retrieve HTTP Headers from URL.

Usage
<?php wp_get_http_headers( $url, $deprecated ) ?>

Parameters
$url (string) (required) Default: None $deprecated (boolean) (optional) Not Used. Default: false

Return Values
(boolean|string) False on failure, headers on success.

Examples Notes Change Log


Since: 1.5.1

Source File
wp_get_http_headers() is located in wp-includes/functions.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/wp_get_http_headers" Categories: Functions | New page created

Function Reference/wp get object terms Contents


1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
Retrieves the terms associated with the given object(s), in the supplied taxonomies. The following information has to do the $args parameter and for what can be contained in the string or array of that parameter, if it exists. The rst argument is called, 'orderby' and has the default value of 'name'. The other value that is supported is 'count'. The second argument is called, 'order' and has the default value of 'ASC'. The only other value that will be acceptable is 'DESC'. The nal argument supported is called, 'elds' and has the default value of 'all'. There are multiple other options that can be used instead. Supported values are as follows: 'all', 'ids', 'names', and nally 'all_with_object_id'. The elds argument also decides what will be returned. If 'all' or 'all_with_object_id' is choosen or the default kept intact, then all matching terms objects will be returned. If either 'ids' or 'names' is used, then an array of all matching term ids or term names will be returned respectively.

Usage
<?php wp_get_object_terms( $object_ids, $taxonomies, $args ) ?>

Parameters
$taxonomies (string|array) (required) The taxonomies to retrieve terms from. Default: None $args (array|string) (optional) Change what is returned Default: array

Return Values
(array|WP_Error) The requested term data or empty array if no terms found. WP_Error if $taxonomy does not exist.

Examples Notes

Uses global: (object) $wpdb May return WP_Error object.

Change Log
Since: 2.3.0

Source File
wp_get_object_terms() is located in wp-includes/taxonomy.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/wp_get_object_terms" Categories: Functions | New page created

Function Reference/wp get original referer Contents


1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
Retrieve original referer that was posted, if it exists.

Usage
<?php wp_get_original_referer() ?>

Parameters
None.

Return Values
(string|boolean) False if no original referer or original referer if set.

Examples Notes
HTTP referer is an server variable. 'referer' is deliberately miss-spelled.

Change Log
Since: 2.0.4

Source File
wp_get_original_referer() is located in wp-includes/functions.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/wp_get_original_referer" Categories: Functions | New page created

Function Reference/wp get post categories Contents


1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes

7 Change Log 8 Source File 9 Related

Description
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.

Usage
<?php wp_get_post_categories( $post_id, $args ) ?>

Parameters
$post_id (integer) (optional) The Post ID. Default: 0 $args (array) (optional) Overwrite the defaults. Default: array

Return Values
(array)

Examples Notes
Uses: wp_get_object_terms() Retrieves the categories.

Change Log
Since: 2.1.0

Source File
wp_get_post_categories() is located in wp-includes/post.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/wp_get_post_categories" Categories: Functions | New page created

Function Reference/wp get recent posts Contents


1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
Retrieve the $num most recent posts from the database in order of the post date. Defaults to retrieving the 10 most recent posts.

Usage
<?php wp_get_recent_posts( $num ) ?>

Parameters
$num (integer) (optional) Number of posts to get. Default: 10

Return Values
(array) List of posts.

Examples Notes
Uses: $wpdb to query the posts table.

Change Log
Since: 1.0.0

Source File
wp_get_recent_posts() is located in wp-includes/post.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/wp_get_recent_posts" Categories: Functions | New page created

Function Reference/wp get referer Contents


1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
Retrieve referer from '_wp_http_referer', HTTP referer, or current page respectively.

Usage
<?php wp_get_referer() ?>

Parameters
None.

Return Values
(string|boolean) False on failure. Referer URL on success.

Examples Notes
HTTP referer is a server variable. 'referer' is deliberately miss-spelled.

Change Log
Since: 2.0.4

Source File
wp_get_referer() is located in wp-includes/functions.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/wp_get_referer" Categories: Functions | New page created

Function Reference/wp get schedule

Contents
1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
Retrieve Cron schedule for hook with arguments.

Usage
<?php wp_get_schedule( $hook, $args ) ?>

Parameters
$hook (callback) (required) Function or method to call, when cron is run. Default: None $args (array) (optional) Arguments to pass to the hook function. Default: array

Return Values
(string|boolean) False, if no schedule. Schedule on success.

Examples Notes
Cron is named after a unix program which runs unattended scheduled tasks.

Change Log
Since: 2.1.0

Source File
wp_get_schedule() is located in wp-includes/cron.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/wp_get_schedule" Categories: Functions | New page created

Function Reference/wp get schedules Contents


1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 5.1 display 6 Notes 7 Change Log 8 Source File 9 Related

Description
Retrieve supported and ltered Cron recurrences. The supported recurrences are 'hourly' and 'daily'. A plugin may add more by hooking into the 'cron_schedules' lter. The lter 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.

Usage
<?php wp_get_schedules() ?>

Parameters
None.

Return Values
(array)

Examples
display
The 'display' is the description. For the 'weekly' key, the 'display' would be __('Once Weekly'); For your plugin, you will be passed an array. you can easily add your schedule by doing the following. <?php // filter parameter variable name is 'array' $array['weekly'] = array( 'interval' => 604800, 'display' => __('Once Weekly') ); ?>

Notes Change Log


Since: 2.1.0

Source File
wp_get_schedules() is located in wp-includes/cron.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/wp_get_schedules" Categories: Functions | New page created

Function Reference/wp get single post Contents


1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
Retrieve a single post, based on post ID.

Usage

<?php wp_get_single_post( $postid, $mode ) ?>

Parameters
$postid (integer) (optional) Post ID. Default: 0 $mode (string) (optional) How to return result. Expects a Constant: OBJECT, ARRAY_N, or ARRAY_A. Default: OBJECT

Return Values
(object|array) Post object or array holding post contents and information with two additional elds (or keys): 'post_category' and 'tags_input'.

Examples Notes
Uses: get_post() Uses: wp_get_post_categories() Uses: wp_get_post_tags()

Change Log
Since: 1.0.0

Source File
wp_get_single_post() is located in wp-includes/post.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/wp_get_single_post" Categories: Functions | New page created

Function Reference/wp hash Contents


1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
This function can be replaced via plugins. If plugins do not redene these functions, then this will be used instead. Get hash of given string.

Usage
<?php wp_hash( $data, $scheme ) ?>

Parameters
$data (string) (required) Plain text to hash. Default: None $scheme (unknown) (optional) Default: 'auth'

Return Values

(string) Hash of $data

Examples Notes
This function can be replaced via plugins. If plugins do not redene these functions, then this will be used instead. Uses: wp_salt() Get WordPress salt.

Change Log
Since: 2.0.4

Source File
wp_hash() is located in wp-includes/pluggable.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/wp_hash" Categories: Functions | New page created

Function Reference/wp insert attachment Contents


1 Description 2 Usage 3 Example 4 Parameters 5 Related

Description
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.

Usage
<?php wp_insert_attachment( $attachment, $filename, $parent_post_id ); ?>

Example
To insert an attachment to a parent with a post ID of 37: <?php $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 ); ?>

Parameters
$attachment (array) (required) Array of data about the attachment that will be written into the wp_posts table of the database. Must contain at a minimum the keys post_title, post_content (the value for this key should be the empty string) and post_status. Default: None $lename (string) (optional) Location of the le on the server. Use absolute path and not the URI of the le. Default: false $parent_post_id (int) (optional) Attachments are associated with parent posts. This is the ID of the parent's post ID. Default: 0

Related
wp_get_attachment_url(), wp_delete_attachment(), wp_insert_post() This article is marked as in need of editing. You can help Codex by editing it.

Retrieved from "http://codex.wordpress.org/Function_Reference/wp_insert_attachment" Categories: Copyedit | Functions | New page created

Function Reference/wp insert comment Contents


1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
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'.

Usage
<?php wp_insert_comment( $commentdata ) ?>

Parameters
$commentdata (array) (required) Contains information on the comment. Default: None

Return Values
(integer) The new comment's ID.

Examples Notes
Uses: $wpdb Uses: current_time() Uses: get_gmt_from_date() Uses: wp_update_comment_count() Uses:Insers a record in the comments table in the database

Change Log
Since: 2.0.0

Source File
wp_insert_comment() is located in wp-includes/comment.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/wp_insert_comment" Categories: Functions | New page created

Function Reference/wp insert post Contents


1 Description 2 Usage 3 Example 3.1 Categories 4 Parameters 5 Return 6 Related

Description
This function inserts posts (and pages) in the database. It sanitizes variables, does some checks, lls 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).

Usage
<?php wp_insert_post( $post ); ?>

Example
Before calling wp_insert_post() it is necessary to create an object (typically an array) to pass the necessary elements that make up a post. The wp_insert_post() will ll out a default list of these but the user is required to provide the title and content otherwise the database write will fail. The user can provide more elements than are listed here by simply dening new keys in the database. The keys should match the names of the columns in the wp_posts table in the database. // Create post object $my_post = array(); $my_post['post_title'] = 'My post'; $my_post['post_content'] = 'This is my post.'; $my_post['post_status'] = 'publish'; $my_post['post_author'] = 1; $my_post['post_category'] = array(8,39); // Insert the post into the database wp_insert_post( $my_post ); The default list referred to above is dened in the function body. It is as follows: $defaults = array( 'post_status' => 'draft', 'post_type' => 'post', 'post_author' => $user_ID, 'ping_status' => get_option('default_ping_status'), 'post_parent' => 0, 'menu_order' => 0, 'to_ping' => '', 'pinged' => '', 'post_password' => '', 'guid' => '', 'post_content_filtered' => '', 'post_excerpt' => '' );

Categories
Categories need to be passed as an array of integers that match the category IDs in the database. This is the case even where only one category is assigned to the post.

Parameters
$post (object) (required) An object representing the elements that make up a post. There is a one-to-one relationship between these elements and the names of columns in the wp_posts table in the database. Default: None The contents of the post array can depend on how much (or little) you want to trust the defaults. Here is a list with a short description of all the keys you can set for a post: $post = array( 'comment_status' => [ 'closed' | 'open' ] // 'closed' means no comments. 'ID' => [ <post id> ] //Are you updating an existing post? 'menu_order' => [ <order> ] //If new post is a page, sets the order should it appear in the tabs. 'page_template => [ <template file> ] //Sets the template for the page. 'ping_status' => [ ? ] //Ping status? 'pinged' => [ ? ] //? 'post_author' => [ <user ID> ] //The user ID number of the author. 'post_category => [ array(<category id>, <...>) ] //Add some categories. 'post_content' => [ <the text of the post> ] //The full text of the post.

'post_date' => [ Y-m-d H:i:s ] //The time post was made. 'post_date_gmt' => [ Y-m-d H:i:s ] //The time post was made, in GMT. 'post_excerpt' => [ <an excerpt> ] //For all your post excerpt needs. 'post_parent' => [ <post ID> ] //Sets the parent of the new post. 'post_password' => [ ? ] //password for post? 'post_status' => [ 'draft' | 'publish' | 'pending' ] //Set the status of the new post. 'post_title' => [ <the title> ] //The title of your post. 'post_type' => [ 'post' | 'page' ] //Sometimes you want to post a page. 'tags_input' => [ '<tag>, <tag>, <...>' ] //For tags. 'to_ping' => [ ? ] //? );

Return
The ID of the post if the post is successfully added to the database. Otherwise returns 0.

Related
wp_update_post(), wp_delete_attachment(), wp_get_attachment_url(), wp_insert_attachment() This article is marked as in need of editing. You can help Codex by editing it. Retrieved from "http://codex.wordpress.org/Function_Reference/wp_insert_post" Categories: Copyedit | Functions | New page created

Function Reference/wp insert user Contents


1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
Insert an 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.

Usage
<?php wp_insert_user( $userdata ) ?>

Parameters
$userdata (array) (required) An array of user data. Default: None

Return Values
(integer) The newly created user's ID.

Examples Notes
Uses: $wpdb WordPress database layer. Uses: apply_lters() Calls lters for most of the $userdata elds with the prex 'pre_user'. See description above. Uses: do_action() Calls 'prole_update' hook when updating giving the user's ID Uses: do_action() Calls 'user_register' hook when creating a new user giving the user's ID

The $userdata array can contain the following elds Field Name
ID user_pass user_login user_url user_email display_name

Description
An integer that will be used for updating an existing user. A string that contains the plain text password for the user. A string that contains the users username for logging in. A string containing the users URL for the users web site. A string containing the users email address. A string that will be shown on the site. Defaults to users username. It is likely that you will want to change this, for both appearance and security through obscurity (that is if you dont use and delete the default admin user). The users nickname, defaults to the users username. The users rst name. The users last name. A string containing content about the user. A string for whether to enable the rich editor or not. False if not empty. A string used to set the users role. Users Jabber account. Users AOL IM account. Users Yahoo IM account.

Associated Filter
(none) pre_user_user_pass pre_user_user_login pre_user_user_nicename pre_user_user_url pre_user_user_email pre_user_display_name

user_nicename A string that contains a nicer looking name for the user. The default is the users username.

nickname rst_name last_name description rich_editing role jabber aim yim

pre_user_nickname pre_user_rst_name pre_user_last_name pre_user_description (none) (none) (none) (none) (none) (none)

user_registered The date the user registered. Format is Y-m-d H:i:s.

Change Log
Since: 2.0.0

Source File
wp_insert_user() is located in wp-includes/registration.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/wp_insert_user" Categories: Functions | New page created

Function Reference/wp iso descrambler Contents


1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
Converts an email subject to ASCII.

Usage
<?php wp_iso_descrambler( $string ) ?>

Parameters
$string (string) (required) Subject line Default: None

Return Values
(string) Converted string to ASCII

Examples Notes
"iso" seems to refer to the iso-8859-1 character set. There is a somewhat related discussion on WordPress trac about Swedish encoding.

Change Log
Since: 1.2.0

Source File
wp_iso_descrambler() is located in wp-includes/formatting.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/wp_iso_descrambler" Categories: Functions | New page created

Function Reference/wp kses Contents


1 Description

2 Usage 3 Parameters 4 Return 5 Further Reading

Description
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.

Usage
<?php wp_kses($string, $allowed_html, $allowed_protocols); ?>

Parameters
$string (string) Content to lter through kses $allowed_html (array) List of allowed HTML elements $allowed_protocols (array) (optional) Allow links in $string to these protocols. The default allowed protocols are http, https, ftp, mailto, news, irc, gopher, nntp, feed, and telnet. This covers all common link protocols, except for javascript, which should not be allowed for untrusted users.

Return
This function returns a ltered string of HTML.

Further Reading
For a comprehensive list of functions, take a look at the category Functions Also, see Function_Reference Retrieved from "http://codex.wordpress.org/Function_Reference/wp_kses" Categories: Functions | New page created

Function Reference/wp kses array lc Contents


1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
Goes through an array and changes the keys to all lower case.

Usage
<?php wp_kses_array_lc( $inarray ) ?>

Parameters
$inarray (array) (required) Unltered array Default: None

Return Values
(array) Fixed array with all lowercase keys

Examples

Notes
This function expects a multi-dimensional array for input.

Change Log
Since: 1.0.0

Source File
wp_kses_array_lc() is located in wp-includes/kses.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/wp_kses_array_lc" Categories: Functions | New page created

Function Reference/wp kses attr Contents


1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
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 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.

Usage
<?php wp_kses_attr( $element, $attr, $allowed_html, $allowed_protocols ) ?>

Parameters
$element (string) (required) HTML element/tag Default: None $attr (string) (required) HTML attributes from HTML element to closing HTML element tag Default: None $allowed_html (array) (required) Allowed HTML elements Default: None $allowed_protocols (array) (required) Allowed protocols to keep Default: None

Return Values
(string) Sanitized HTML element

Examples Notes Change Log


Since: 1.0.0

Source File
wp_kses_attr() is located in wp-includes/kses.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/wp_kses_attr" Categories: Functions | New page created

Function Reference/wp kses bad protocol Contents


1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
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)'.

Usage
<?php wp_kses_bad_protocol( $string, $allowed_protocols ) ?>

Parameters
$string (string) (required) Content to lter bad protocols from Default: None $allowed_protocols (array) (required) Allowed protocols to keep Default: None

Return Values
(string) Filtered content

Examples Notes Change Log


Since: 1.0.0

Source File
wp_kses_bad_protocol() is located in wp-includes/kses.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/wp_kses_bad_protocol" Categories: Functions | New page created

Function Reference/wp kses bad protocol once Contents


1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples

6 Notes 7 Change Log 8 Source File 9 Related

Description
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.

Usage
<?php wp_kses_bad_protocol_once( $string, $allowed_protocols ) ?>

Parameters
$string (string) (required) Content to check for bad protocols Default: None $allowed_protocols (string) (required) Allowed protocols Default: None

Return Values
(string) Sanitized content

Examples Notes
Uses global: (unknown) $_kses_allowed_protocols

Change Log
Since: 1.0.0

Source File
wp_kses_bad_protocol_once() is located in wp-includes/kses.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/wp_kses_bad_protocol_once" Categories: Functions | New page created

Function Reference/wp kses bad protocol once2 Contents


1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
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.

Usage
<?php wp_kses_bad_protocol_once2( $matches ) ?>

Parameters

$matches (mixed) (required) string or preg_replace_callback() matches array to check for bad protocols Default: None

Return Values
(string) Sanitized content

Examples Notes
This is a private function. It should not be called directly. It is listed in the Codex for completeness. Uses global: (unknown) $_kses_allowed_protocols

Change Log
Since: 1.0.0

Source File
wp_kses_bad_protocol_once2() is located in wp-includes/kses.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/wp_kses_bad_protocol_once2" Categories: Functions | New page created

Function Reference/wp kses check attr val Contents


1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
Performs different checks for attribute values. The currently implemented checks are 'maxlen', 'minlen', 'maxval', 'minval' and 'valueless' with even more checks to come soon.

Usage
<?php wp_kses_check_attr_val( $value, $vless, $checkname, $checkvalue ) ?>

Parameters
$value (string) (required) Attribute value Default: None $vless (string) (required) Whether the value is valueless or not. Use 'y' or 'n' Default: None $checkname (string) (required) What $checkvalue is checking for. Default: None $checkvalue (mixed) (required) What constraint the value should pass Default: None

Return Values
(boolean)

Whether check passes (true) or not (false)

Examples Notes Change Log


Since: 1.0.0

Source File
wp_kses_check_attr_val() is located in wp-includes/kses.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/wp_kses_check_attr_val" Categories: Functions | New page created

Function Reference/wp kses decode entities Contents


1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
Convert all entities to their character counterparts. This function decodes numeric HTML entities (like &#65; and &#x41;). It doesn't do anything with other entities like &auml;, but we don't need them in the URL protocol whitelisting system anyway.

Usage
<?php wp_kses_decode_entities( $string ) ?>

Parameters
$string (string) (required) Content to change entities Default: None

Return Values
(string) Content after decoded entities

Examples Notes Change Log


Since: 1.0.0

Source File
wp_kses_decode_entities() is located in wp-includes/kses.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/wp_kses_decode_entities" Categories: Functions | New page created

Function Reference/wp kses hair Contents

1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
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 specication. It will also remove bad URL protocols from attribute values. It also reduces duplicate attributes by using the attribute dened rst (foo='bar' foo='baz' will result in foo='bar').

Usage
<?php wp_kses_hair( $attr, $allowed_protocols ) ?>

Parameters
$attr (string) (required) Attribute list from HTML element to closing HTML element tag Default: None $allowed_protocols (array) (required) Allowed protocols to keep Default: None

Return Values
(array) List of attributes after parsing

Examples Notes Change Log


Since: 1.0.0

Source File
wp_kses_hair() is located in wp-includes/kses.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/wp_kses_hair" Categories: Functions | New page created

Function Reference/wp kses hook Contents


1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
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.

Usage
<?php wp_kses_hook( $string, $allowed_html, $allowed_protocols ) ?>

Parameters
$string (string) (required) Content to lter through kses Default: None $allowed_html (array) (required) List of allowed HTML elements Default: None $allowed_protocols (array) (required) Allowed protocol in links Default: None

Return Values
(string) Filtered content through 'pre_kses' hook

Examples Notes Change Log


Since: 1.0.0

Source File
wp_kses_hook() is located in wp-includes/kses.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/wp_kses_hook" Categories: Functions | New page created

Function Reference/wp kses html error Contents


1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
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.

Usage
<?php wp_kses_html_error( $string ) ?>

Parameters
$string (string) (required) Default: None

Return Values

(string)

Examples Notes Change Log


Since: 1.0.0

Source File
wp_kses_html_error() is located in wp-includes/kses.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/wp_kses_html_error" Categories: Functions | New page created

Function Reference/wp kses js entities Contents


1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
Removes the HTML JavaScript entities found in early versions of Netscape 4.

Usage
<?php wp_kses_js_entities( $string ) ?>

Parameters
$string (string) (required) Default: None

Return Values
(string)

Examples Notes Change Log


Since: 1.0.0

Source File
wp_kses_js_entities() is located in wp-includes/kses.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/wp_kses_js_entities" Categories: Functions | New page created

Function Reference/wp kses no null Contents


1 Description 2 Usage 3 Parameters 4 Return Values

5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
Removes any NULL characters in $string.

Usage
<?php wp_kses_no_null( $string ) ?>

Parameters
$string (string) (required) Default: None

Return Values
(string)

Examples Notes Change Log


Since: 1.0.0

Source File
wp_kses_no_null() is located in wp-includes/kses.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/wp_kses_no_null" Categories: Functions | New page created

Function Reference/wp kses normalize entities Contents


1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
Converts and xes HTML entities. This function normalizes HTML entities. It will convert 'AT&T' to the correct 'AT&T', ':' to ':', '&#XYZZY;' to '&#XYZZY;' and so on.

Usage
<?php wp_kses_normalize_entities( $string ) ?>

Parameters
$string (string) (required) Content to normalize entities Default: None

Return Values
(string)

Content with normalized entities

Examples Notes Change Log


Since: 1.0.0

Source File
wp_kses_normalize_entities() is located in wp-includes/kses.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/wp_kses_normalize_entities" Categories: Functions | New page created

Function Reference/wp kses normalize entities2 Contents


1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
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.

Usage
<?php wp_kses_normalize_entities2( $matches ) ?>

Parameters
$matches (array) (required) preg_replace_callback() matches array Default: None

Return Values
(string) Correctly encoded entity

Examples Notes
This is a private function. It should not be called directly. It is listed in the Codex for completeness.

Change Log
Since: 1.0.0

Source File
wp_kses_normalize_entities2() is located in wp-includes/kses.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/wp_kses_normalize_entities2" Categories: Functions | New page created

Function Reference/wp kses split

Contents
1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
Searches for HTML tags, no matter how malformed. It also matches stray ">" characters.

Usage
<?php wp_kses_split( $string, $allowed_html, $allowed_protocols ) ?>

Parameters
$string (string) (required) Content to lter Default: None $allowed_html (array) (required) Allowed HTML elements Default: None $allowed_protocols (array) (required) Allowed protocols to keep Default: None

Return Values
(string) Content with xed HTML tags

Examples Notes
Uses: wp_kses_split2() as a callback to do much of the work.

Change Log
Since: 1.0.0

Source File
wp_kses_split() is located in wp-includes/kses.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/wp_kses_split" Categories: Functions | New page created

Function Reference/wp kses split2 Contents


1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
Callback for wp_kses_split() for xing malformed HTML tags. This function does a lot of work. It rejects some very malformed things like <:::>. 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 lter which will remove illegal attributes and once that is completed, will be returned.

Usage
<?php wp_kses_split2( $string, $allowed_html, $allowed_protocols ) ?>

Parameters
$string (string) (required) Content to lter Default: None $allowed_html (array) (required) Allowed HTML elements Default: None $allowed_protocols (array) (required) Allowed protocols to keep Default: None

Return Values
(string) Fixed HTML element

Examples Notes
This is a private function. It should not be called directly. It is listed in the Codex for completeness. Uses: wp_kses_attr()

Change Log
Since: 1.0.0

Source File
wp_kses_split2() is located in wp-includes/kses.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/wp_kses_split2" Categories: Functions | New page created

Function Reference/wp kses strip slashes Contents


1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
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.

Usage
<?php wp_kses_stripslashes( $string ) ?>

Parameters
$string (string) (required) String to strip slashes Default: None

Return Values
(string) Fixed strings with quoted slashes

Examples Notes Change Log


Since: 1.0.0

Source File
wp_kses_stripslashes() is located in wp-includes/kses.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/wp_kses_strip_slashes" Categories: Functions | New page created

Function Reference/wp kses version Contents


1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
This function returns the kses version number.

Usage
<?php wp_kses_version() ?>

Parameters
None.

Return Values
(string) KSES Version Number

Examples Notes Change Log


Since: 1.0.0

Source File
wp_kses_version() is located in wp-includes/kses.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/wp_kses_version" Categories: Functions | New page created

Function Reference/wp mail Description


Sends an email.

Parameters
$to (string) (required) The intended recipient(s) of the message. Default: None $subject (string) (required) The subject of the message. Default: None $message (string) (required) Message content. Default: None $headers (string) (optional) Mail headers to send with the message (advanced) Default: Empty

Usage
<?php wp_mail($to, $subject, $message, $headers = ); ?> This page is marked as incomplete. You can help Codex by expanding it. Retrieved from "http://codex.wordpress.org/Function_Reference/wp_mail" Categories: Stubs | Functions

Function Reference/wp make link relative Contents


1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
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.

Usage
<?php wp_make_link_relative( $link ) ?>

Parameters
$link (string) (required) Full URL path. Default: None

Return Values
(string)

Absolute path.

Examples Notes Change Log


Since: 2.1.0

Source File
wp_make_link_relative() is located in wp-includes/formatting.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/wp_make_link_relative" Categories: Functions | New page created

Function Reference/wp mime type icon Contents


1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
Retrieve the icon for a MIME type.

Usage
<?php wp_mime_type_icon( $mime ) ?>

Parameters
$mime (string) (optional) MIME type Default: 0

Return Values
(string|boolean) Returns a value from The ltered value after all hooked functions are applied to it.

Examples Notes
Uses: apply_lters calls 'wp_mime_type_icon' on $icon, $mime and $post_id

Change Log
Since: 2.1.0

Source File
wp_mime_type_icon() is located in wp-includes/post.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/wp_mime_type_icon" Categories: Functions | New page created

Function Reference/wp mkdir p Contents

1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
Recursive directory creation based on full path. Will attempt to set permissions on folders.

Usage
<?php wp_mkdir_p( $target ) ?>

Parameters
$target (string) (required) Full path to attempt to create. Default: None

Return Values
(boolean) Whether the path was created or not. True if path already exists.

Examples Notes Change Log


Since: 2.0.1

Source File
wp_mkdir_p() is located in wp-includes/functions.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/wp_mkdir_p" Categories: Functions | New page created

Function Reference/wp new comment Contents


1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
Adds a new comment to the database. Filters new comment to ensure that the elds 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' lter for processing the comment data before the function handles it.

Usage
<?php wp_new_comment( $commentdata ) ?>

Parameters
$commentdata (array) (required) Contains information on the comment. Default: None

Return Values
(integer) The ID of the comment after adding.

Examples Notes
Uses: apply_lters() Calls 'preprocess_comment' hook on $commentdata parameter array before processing Uses: do_action() Calls 'comment_post' hook on $comment_ID returned from adding the comment and if the comment was approved. Uses: wp_lter_comment() Used to lter comment before adding comment. Uses: wp_allow_comment() checks to see if comment is approved. Uses: wp_insert_comment() Does the actual comment insertion to the database. Uses: wp_notify_moderator() Uses: wp_notify_postauthor() Uses: wp_get_comment_status()

Change Log
Since: 1.5.0

Source File
wp_new_comment() is located in wp-includes/comment.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/wp_new_comment" Categories: Functions | New page created

Function Reference/wp new user notication Contents


1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
This function can be replaced via plugins. If plugins do not redene these functions, then this will be used instead. Notify the blog admin of a new user, normally via email.

Usage
<?php wp_new_user_notification( $user_id, $plaintext_pass ) ?>

Parameters
$user_id (integer) (required) User ID Default: None $plaintext_pass (string) (optional) The user's plaintext password Default: ''

Return Values
(void)

This function does not return a value.

Examples Notes
This function can be replaced via plugins. If plugins do not redene these functions, then this will be used instead.

Change Log
Since: 2.0

Source File
wp_new_user_notication() is located in wp-includes/pluggable.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/wp_new_user_notication" Categories: Functions | New page created

Function Reference/wp next scheduled Contents


1 Description 2 Usage 3 Return Value 4 Parameters

Description
Returns the next timestamp for a cron event.

Usage
$timestamp = wp_next_scheduled( hook, args (optional));

Return Value
timestamp The time the scheduled event will next occur (unix timestamp)

Parameters
$hook (string) (required) Name of the action hook for event. Default: None $args (array) (optional) Arguments to pass to the hook function(s). Default: None See Also: wp_schedule_event wp_schedule_single_event wp_clear_scheduled_hook wp_unschedule_event Retrieved from "http://codex.wordpress.org/Function_Reference/wp_next_scheduled" Categories: Functions | New page created | WP-Cron Functions

Function Reference/wp nonce ays Contents


1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log

8 Source File 9 Related

Description
Display 'Are You Sure?' message to conrm the action being taken. If the action has the nonce explain message, then it will be displayed along with the 'Are you sure?' message.

Usage
<?php wp_nonce_ays( $action ) ?>

Parameters
$action (string) (required) The nonce action. Default: None

Return Values
(void) This function does not return a value.

Examples Notes Change Log


Since: 2.0.4

Source File
wp_nonce_ays() is located in wp-includes/functions.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/wp_nonce_ays" Categories: Functions | New page created

Function Reference/wp nonce eld Contents


1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
Retrieve or display nonce hidden eld for forms. The nonce eld 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 eld in forms. If you set $echo to true and set $referer to true, then you will need to retrieve the wp_referer_eld(). If you have the $referer set to true and are echoing the nonce eld, it will also echo the referer eld. 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 difcult for them to nd 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.

Usage
<?php wp_nonce_field( $action, $name, $referer, $echo ) ?>

Parameters
$action (string) (optional) Action name. Default: -1 $name (string) (optional) Nonce name. Default: "_wpnonce" $referer (boolean) (optional) default true. Whether to set the referer eld for validation. Default: true $echo (boolean) (optional) default true. Whether to display or return hidden form eld. Default: true

Return Values
(string) Nonce eld.

Examples Notes Change Log


Since: 2.0.4

Source File
wp_nonce_eld() is located in wp-includes/functions.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/wp_nonce_eld" Categories: Functions | New page created

Function Reference/wp nonce url Contents


1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
Retrieve URL with nonce added to URL query.

Usage
<?php wp_nonce_url( $actionurl, $action ) ?>

Parameters
$actionurl (string) (required) URL to add nonce action Default: None $action (string) (optional) Nonce action name Default: -1

Return Values

(string) URL with nonce action added.

Examples Notes Change Log


Since: 2.0.4

Source File
wp_nonce_url() is located in wp-includes/functions.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/wp_nonce_url" Categories: Functions | New page created

Function Reference/wp notify moderator Contents


1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
This function can be replaced via plugins. If plugins do not redene these functions, then this will be used instead. Noties the moderator of the blog about a new comment that is awaiting approval.

Usage
<?php wp_notify_moderator( $comment_id ) ?>

Parameters
$comment_id (integer) (required) Comment ID Default: None

Return Values
(boolean) Always returns true

Examples Notes
This function can be replaced via plugins. If plugins do not redene these functions, then this will be used instead. Uses global: (object) $wpdb

Change Log
Since: 1.0

Source File
wp_notify_moderator() is located in wp-includes/pluggable.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/wp_notify_moderator" Categories: Functions | New page created

Function Reference/wp notify postauthor

Contents
1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
This function can be replaced via plugins. If plugins do not redene these functions, then this will be used instead. Sanitizes a URL for use in a redirect.

Usage
<?php wp_notify_postauthor( $comment_id, $comment_type ) ?>

Parameters
$comment_id (integer) (required) Comment ID Default: None $comment_type (string) (optional) The comment type either 'comment' (default), 'trackback', or 'pingback' Default: ''

Return Values
(boolean) False if user email does not exist. True on completion.

Examples Notes
This function can be replaced via plugins. If plugins do not redene these functions, then this will be used instead. Uses: apply_lters() Calls 'allowed_redirect_hosts' on an array containing WordPress host string and $location host string.

Change Log
Since: 1.0.0

Source File
wp_notify_postauthor() is located in wp-includes/pluggable.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/wp_notify_postauthor" Categories: Functions | New page created

Function Reference/wp original referer eld Contents


1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
Retrieve or display original referer hidden eld for forms.

The input name is '_wp_original_http_referer' and will be either the same value of wp_referer_eld(), if that was posted already or it will be the current page, if it doesn't exist.

Usage
<?php wp_original_referer_field( $echo, $jump_back_to ) ?>

Parameters
$echo (boolean) (optional) Whether to echo the original http referer. Default: true $jump_back_to (string) (optional) default is 'current'. Can be 'previous' or page you want to jump back to. Default: 'current'

Return Values
(string) Original referer eld.

Examples Notes Change Log


Since: 2.0.4

Source File
wp_original_referer_eld() is located in wp-includes/functions.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/wp_original_referer_eld" Categories: Functions | New page created

Function Reference/wp publish post Contents


1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
Publish a post by transitioning the post status.

Usage
<?php wp_publish_post( $post_id ) ?>

Parameters
$post_id (integer) (required) Post ID. Default: None

Return Values
(null)

Examples Notes

Uses: $wpdb Uses: do_action() to call the following on $post_id and $post (post data): edit_post(), save_post() and wp_insert_post().

Change Log
Since: 2.1.0

Source File
wp_publish_post() is located in wp-includes/post.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/wp_publish_post" Categories: Functions | New page created

Function Reference/wp redirect Contents


1 Description 2 Parameters 3 Usage 4 Example

Description
Redirects the user to a specied absolute URI.

Parameters
$location (string) (required) The absolute URI which the user will be redirected to. Default: None $status (integer) (optional) The status code to use Default: 302

Usage
<?php wp_redirect($location, $status); ?>

Example
<?php wp_redirect(get_option('siteurl') . '/wp-login.php'); ?> Redirects can also be external, and/or use a "Moved Permanently" code : <?php wp_redirect('http://www.example.com', 301); ?> Retrieved from "http://codex.wordpress.org/Function_Reference/wp_redirect" Categories: Functions | New page created

Function Reference/wp referer eld Contents


1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
Retrieve or display referer hidden eld 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.

Usage
<?php wp_referer_field( $echo ) ?>

Parameters
$echo (boolean) (optional) Whether to echo or return the referer eld. Default: true

Return Values
(string) Referer eld.

Examples Notes Change Log


Since: 2.0.4

Source File
wp_referer_eld() is located in wp-includes/functions.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/wp_referer_eld" Categories: Functions | New page created

Function Reference/wp rel nofollow Contents


1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
Adds rel="nofollow" string to all HTML entities A elements in content.

Usage
<?php wp_rel_nofollow( $text ) ?>

Parameters
$text (string) (required) Content that may contain HTML A elements. Default: None

Return Values
(string) Converted content.

Examples Notes
Uses global: (object) $wpdb to escape text.

Change Log

Since: 1.5.0

Source File
wp_rel_nofollow() is located in wp-includes/formatting.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/wp_rel_nofollow" Categories: Functions | New page created

Function Reference/wp remote fopen Description


Returns the contents of a remote URI. Tries to retrieve the HTTP content with fopen rst and then using cURL, if fopen can't be used.

Usage
<?php $contents = wp_remote_fopen($uri); ?>

Parameters
$uri (string) (required) The URI of the remote page to be retrieved. Default: None Retrieved from "http://codex.wordpress.org/Function_Reference/wp_remote_fopen" Category: Functions

Function Reference/wp reschedule event Contents


1 Description 2 Usage 3 Parameters 4 Also see

Description
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.

Usage
<?php wp_reschedule_event( timestamp, recurrence, hook, args (optional));

Parameters
timestamp The time the scheduled event will occur (unix timestamp) recurrance How often the event recurs, either 'hourly' or 'daily' hook Name of action hook to re (string) args Arguments to pass into the hook function(s) (array)

Also see
For a comprehensive list of functions, take a look at the category Functions Function_Reference Retrieved from "http://codex.wordpress.org/Function_Reference/wp_reschedule_event" Categories: Functions | New page created | WP-Cron Functions

Function Reference/wp richedit pre

Contents
1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
Formats text for the rich text editor. The lter 'richedit_pre' is applied here. If $text is empty the lter will be applied to an empty string.

Usage
<?php wp_richedit_pre( $text ) ?>

Parameters
$text (string) (required) The text to be formatted. Default: None

Return Values
(string) The formatted text after lter is applied.

Examples Notes Change Log


Since: 2.0.0

Source File
wp_richedit_pre() is located in wp-includes/formatting.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/wp_richedit_pre" Categories: Functions | New page created

Function Reference/wp rss Contents


1 Description 2 Usage 3 Example 4 Parameters 5 Output 6 Related

Description
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.

Usage
<?php include_once(ABSPATH . WPINC . '/rss.php'); wp_rss($uri, $num); ?>

Example

To get and display a list of 5 links from an existing RSS feed: <?php include_once(ABSPATH . WPINC . '/rss.php'); wp_rss('http://example.com/rss/feed/goes/here', 5); ?>

Parameters
$uri (URI) (required) The URI of the RSS feed you want to retrieve. The resulting parsed feed is returned, with the more interesting and useful bits in the items array. Default: None $num (integer) (required) The number of items to display. Default: None

Output
The output will look like the following: <ul> <li> <a href='LINK FROM FEED' title='DESCRIPTION FROM FEED'>TITLE FROM FEED</a> </li> (repeat for number of links specified) </ul>

Related
fetch_rss Retrieved from "http://codex.wordpress.org/Function_Reference/wp_rss" Category: Functions

Function Reference/wp salt Contents


1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
This function can be replaced via plugins. If plugins do not redene 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 dened in the second place, which is in the wp-cong.php le. If you are going to set the secret key, then you must do so in the wp-cong.php le. The secret key in the database is randomly generated and will be appended to the secret key that is in wp-cong.php le in some instances. It is important to have the secret key dened or changed in wp-cong.php. If you have installed WordPress 2.5 or later, then you will have the SECRET_KEY dened in the wp-cong.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-cong.php le. 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.

Usage
<?php wp_salt( $scheme ) ?>

Parameters
$scheme (unknown) (optional) Default: 'auth'

Return Values
(string) Salt value from either 'SECRET_KEY' or 'secret' option

Examples Notes
This function can be replaced via plugins. If plugins do not redene these functions, then this will be used instead. See Also: Create a Secret Key for wp-cong.php Uses global: (unknown) $wp_default_secret_key

Change Log
Since: 2.5

Source File
wp_salt() is located in wp-includes/pluggable.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/wp_salt" Categories: Functions | New page created

Function Reference/wp schedule event Contents


1 Description 2 Usage 3 Parameters 4 Examples 4.1 Schedule an hourly event 5 Further Reading

Description
Schedules a hook which will be executed by the WordPress actions core on a specic interval, specied 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.

Usage
<?php wp_schedule_event(time(), 'hourly', 'my_schedule_hook'); ?>

Parameters
$timestamp (integer) (required) The rst time that you want the event to occur. This must be in a UNIX timestamp format. Default: None $recurrance (string) (required) How often the event should reoccur. Valid values: hourly daily Default: None $hook (string) (required) The name of an action hook to execute. Default: None $args (array) (optional) Arguments to pass to the hook function(s). Default: None

Examples

Schedule an hourly event


To schedule an hourly event in a plugin, call wp_schedule_event on activation (otherwise you will end up with a lot of scheduled events!): register_activation_hook(__FILE__, 'my_activation'); add_action('my_hourly_event', 'do_this_hourly'); function my_activation() { wp_schedule_event(time(), 'hourly', 'my_hourly_event'); } function do_this_hourly() { // do something every hour } Don't forget to clean the scheduler on deactivation: register_deactivation_hook(__FILE__, 'my_deactivation'); function my_deactivation() { wp_clear_scheduled_hook('my_hourly_event'); }

Further Reading
For a comprehensive list of functions, take a look at the category Functions Also, see Function_Reference Retrieved from "http://codex.wordpress.org/Function_Reference/wp_schedule_event" Categories: Functions | New page created | WP-Cron Functions

Function Reference/wp schedule single event Contents


1 Description 2 Usage 3 Examples 3.1 Schedule an event one hour from now 4 Parameters 5 Further Reading

Description
Schedules a hook which will be executed once by the Wordpress actions core at a time which you specify. The action will re off when someone visits your WordPress site, if the schedule time has passed.

Usage
<?php wp_schedule_single_event(time(), 'my_schedule_hook'); ?>

Examples
Schedule an event one hour from now
function do_this_in_an_hour() { // do something } add_action('my_new_event','do_this_in_an_hour'); // put this line inside a function, // presumably in response to something the user does // otherwise it will schedule a new event on every page visit wp_schedule_single_event(time()+3600, 'my_new_event'); // time()+3600 = one hour from now.

Parameters

$timestamp (integer) (required) The time you want the event to occur. This must be in a UNIX timestamp format. Default: None $hook (string) (required) The name of an action hook to execute. Default: None $args (array) (optional) Arguments to pass to the hook function(s) Default: None

Further Reading
For a comprehensive list of functions, take a look at the category Functions Also, see Function_Reference Retrieved from "http://codex.wordpress.org/Function_Reference/wp_schedule_single_event" Categories: Functions | WP-Cron Functions

Function Reference/wp set comment status Contents


1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
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.

Usage
<?php wp_set_comment_status( $comment_id, $comment_status ) ?>

Parameters
$comment_id (integer) (required) Comment ID. Default: None $comment_status (string) (required) New comment status, either 'hold', 'approve', 'spam', or 'delete'. Default: None

Return Values
(boolean) False on failure or deletion and true on success.

Examples Notes
Uses: wp_transition_comment_status() Passes new and old comment status along with $comment object Uses: wp_notify_postauthor() Uses: get_option() Uses: wp_delete_comment() Uses: clean_comment_cache() Uses: get_comment() Uses: wp_transition_comment_status()

Uses: wp_update_comment_count() Uses global: (object) $wpdb

Change Log
Since: 1.0.0

Source File
wp_set_comment_status() is located in wp-includes/comment.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/wp_set_comment_status" Categories: Functions | New page created

Function Reference/wp set current user Contents


1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
This function can be replaced via plugins. If plugins do not redene 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.

Usage
<?php wp_set_current_user( $id, $name ) ?>

Parameters
$id (integer) (required) User ID Default: None $name (string) (optional) User's username Default: ''

Return Values
(WP_User) Current user User object.

Examples Notes
This function can be replaced via plugins. If plugins do not redene these functions, then this will be used instead. Uses: User object Uses: setup_userdata() Uses: do_action() Calls 'set_current_user' hook after setting the current user.

Change Log
Since: 2.0.4

Source File
wp_set_current_user() is located in wp-includes/pluggable.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/wp_set_current_user" Categories: Functions | New page created

Function Reference/wp set post categories


This article is marked as in need of editing. You can help Codex by editing it.

Contents
1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
Set categories for a post. If the post categories parameter is not set, then the default category is going used.

Usage
<?php wp_set_post_categories( $post_ID, $post_categories ) ?>

Parameters
$post_ID (integer) (optional) Post ID. Default: 0 $post_categories (array) (optional) List of categories. Default: array

Return Values
(boolean|mixed)

Examples Notes Change Log


Since: 2.1.0

Source File
wp_set_post_categories() is located in wp-includes/post.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/wp_set_post_categories" Categories: Copyedit | Functions | New page created

Function Reference/wp setcookie Contents


1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples

6 Notes 7 Change Log 8 Source File 9 Related

Description
This function can be replaced via plugins. If plugins do not redene these functions, then this will be used instead. Sets a cookie for a user who just logged in. This function is deprecated. Use wp_set_auth_cookie() instead.

Usage
<?php wp_setcookie( $username, $password, $already_md5, $home, $siteurl, $remember ) ?>

Parameters
$username (string) (required) The user's username Default: None $password (string) (optional) The user's password Default: '' $already_md5 (boolean) (optional) Whether the password has already been through MD5 Default: false $home (string) (optional) Will be used instead of COOKIEPATH if set Default: '' $siteurl (string) (optional) Will be used instead of SITECOOKIEPATH if set Default: '' $remember (boolean) (optional) Remember that the user is logged in Default: false

Return Values
void This function doesn't return anything.

Examples Notes
This function can be replaced via plugins. If plugins do not redene these functions, then this will be used instead. This function is deprecated. Use wp_set_auth_cookie() instead.

Change Log
Since: 1.5 Deprecated: 2.5.0

Source File
wp_setcookie() is located in wp-includes/pluggable.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/wp_setcookie" Categories: Functions | New page created

Function Reference/wp signon Contents

1 Description 2 Usage 3 Examples 4 Parameters 5 Return 6 Related

Description
Authenticates a user with option to remember. New function instead of wp_login. Since Wordpress 2.5.

Usage
wp_signon( $credentials = , $secure_cookie = )

Examples Parameters
@param array $credentials Optional. User info in order to sign on. @param bool $secure_cookie Optional. Whether to use secure cookie. @return object Either WP_Error on failure, or WP_User on success. If you don't provide $credentials, wp_signon uses the $_POST variable.

Return
object Either WP_Error on failure, or WP_User on success

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/wp_signon" Category: Functions

Function Reference/wp specialchars Contents


1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
Converts a number of special characters into their HTML entities. Differs from htmlspecialchars as existing HTML entities will not be encoded. Specically changes: & to &#038;, < to &lt; and > to &gt;. $quotes can be set to 'single' to encode ' to &#039;, 'double' to encode " to &quot;, or '1' to do both. Default is 0 where no quotes are encoded.

Usage
<?php wp_specialchars( $text, $quotes ) ?>

Parameters
$text (string) (required) The text which is to be encoded. Default: None $quotes (mixed) (optional) Converts single quotes if set to 'single', double if set to 'double' or both if otherwise set. Default: 0

Return Values

(string) The encoded text with HTML entities.

Examples Notes
htmlspecialchars (noted in the description) is a PHP built-in function.

Change Log
Since: 1.2.2

Source File
wp_specialchars() is located in wp-includes/formatting.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/wp_specialchars" Categories: Functions | New page created

Function Reference/wp throttle comment ood Contents


1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
Determine whether comment should be blocked because of comment ood.

Usage
<?php wp_throttle_comment_flood( $block, $time_lastcomment, $time_newcomment ) ?>

Parameters
$block (boolean) (required) True if plugin is blocking comments. Default: None $time_lastcomment (integer) (required) Timestamp for last comment. Default: None $time_newcomment (integer) (required) Timestamp for new comment. Default: None

Return Values
(boolean) Returns true if $block is true or if $block is false and $time_newcomment - $time_lastcomment < 15. Returns false otherwise.

Examples Notes Change Log


Since: 2.1.0

Source File
wp_throttle_comment_ood() is located in wp-includes/comment.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/wp_throttle_comment_ood" Categories: Functions | New page created

Function Reference/wp trim excerpt Contents


1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
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.

Usage
<?php wp_trim_excerpt( $text ) ?>

Parameters
$text (string) (required) The exerpt. If set to empty an excerpt is generated. If you supply text it will be returned untouched. It will not be shortened. Default: None

Return Values
(string) The excerpt.

Examples Notes
Uses: get_the_content Uses: strip_shortcodes() on $text. Uses: apply_lters() for 'the_content' on $text. Uses: apply_lters() for 'excerpt_length' on 55

Change Log
Since: 1.5.0

Source File
wp_trim_excerpt() is located in wp-includes/formatting.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/wp_trim_excerpt" Categories: Functions | New page created

Function Reference/wp unschedule event Description


Un-schedules a previously-scheduled cron job.

Usage
<?php wp_unschedule_event(next_scheduled_time, 'my_schedule_hook', original_args ); ?> Note that you need to know the exact time of the next occurrence when scheduled hook was set to run, and the function arguments it was

supposed to have, in order to unschedule it. All future occurrences are un-scheduled by calling this function. See: wp_schedule_event wp_schedule_single_event wp_clear_scheduled_hook wp_next_scheduled This page is marked as incomplete. You can help Codex by expanding it. Retrieved from "http://codex.wordpress.org/Function_Reference/wp_unschedule_event" Categories: Stubs | Functions | New page created | WP-Cron Functions

Function Reference/wp update attachment metadata Contents


1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
Update metadata for an attachment.

Usage
<?php wp_update_attachment_metadata( $post_id, $data ) ?>

Parameters
$post_id (integer) (required) Attachment ID. Default: None $data (array) (required) Attachment data. Default: None

Return Values
(integer) Returns value from update_post_meta()

Examples Notes
Uses: apply_lters() to add wp_update_attachment_metadata() on $data and post ID.

Change Log
Since: 2.1.0

Source File
wp_update_attachment_metadata() is located in wp-includes/post.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/wp_update_attachment_metadata" Categories: Functions | New page created

Function Reference/wp update comment

Contents
1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
Updates an existing comment in the database. Filters the comment and makes sure certain elds are valid before updating.

Usage
<?php wp_update_comment( $commentarr ) ?>

Parameters
$commentarr (array) (required) Contains information on the comment. Default: None

Return Values
(integer) Comment was updated if value is 1, or was not updated if value is 0.

Examples Notes
Uses: wp_transition_comment_status() Passes new and old comment status along with $comment object Uses: get_comment() Uses: wp_lter_comment() Uses: get_gmt_from_date() Uses: clean_comment_cache() Uses: wp_update_comment_count() Uses: do_action() on 'edit_comment' on $comment_ID. Uses global: (object) $wpdb

Change Log
Since: 2.0.0

Source File
wp_update_comment() is located in wp-includes/comment.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/wp_update_comment" Categories: Functions | New page created

Function Reference/wp update comment count Contents


1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
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.

Usage
<?php wp_update_comment_count( $post_id, $do_deferred ) ?>

Parameters
$post_id (integer) (required) Post ID Default: None $do_deferred (boolean) (optional) Whether to process previously deferred post comment counts Default: false

Return Values
(boolean) True on success, false on failure

Examples Notes
See wp_update_comment_count_now() for what could cause a false return value Uses: wp_update_comment_count_now() Uses: wp_defer_comment_counting()

Change Log
Since: 2.1.0

Source File
wp_update_comment_count() is located in wp-includes/comment.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/wp_update_comment_count" Categories: Functions | New page created

Function Reference/wp update post Contents


1 Description 2 Usage 3 Example 3.1 Categories 4 Parameters 5 Return 6 Related

Description
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.

Usage
<?php wp_update_post( $post ); ?>

Example
Before calling wp_update_post() it is necessary to create an array to pass the necessary elements. Unlike wp_insert_post(), it is only necessary to pass the ID of the post to be updated and the elements to be updated. The names of the elements should match those in the

database. // Update post 37 $my_post = array(); $my_post['ID'] = 37; $my_post['post_content'] = 'This is the updated content.'; // Update the post into the database wp_update_post( $my_post );

Categories
Categories need to be passed as an array of integers that match the category IDs in the database. This is the case even where only one category is assigned to the post.

Parameters
$post (array) (optional) An object representing the elements that make up a post. There is a one-to-one relationship between these elements and the names of columns in the wp_posts table in the database. Filling out the ID eld is not strictly necessary but without it there is little point to using the function. Default: An empty array

Return
The ID of the post if the post is successfully added to the database. Otherwise returns 0.

Related
wp_insert_post() This article is marked as in need of editing. You can help Codex by editing it. Retrieved from "http://codex.wordpress.org/Function_Reference/wp_update_post" Categories: Copyedit | Functions | New page created

Function Reference/wp update user Contents


1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
Update (or create) 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.

Usage
<?php wp_update_user( $userdata ) ?>

Parameters
$userdata (array) (required) An array of user data. Default: None

Return Values
(integer)

The updated user's ID.

Examples Notes
Uses: get_userdata() Uses: wp_hash_password() Uses: wp_insert_user() Used to update existing user or add new one if user doesn't exist already Uses: wp_get_current_user() Uses: wp_clear_auth_cookie() Uses: wp_set_auth_cookie()

Change Log
Since: 2.0.0

Source File
wp_update_user() is located in wp-includes/registration.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/wp_update_user" Categories: Functions | New page created

Function Reference/wp upload bits Contents


1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
Create a le 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 'le' will have the unique le path, the 'url' key will have the link to the new le. and the 'error' key will be set to false. This function will not move an uploaded le to the upload folder. It will create a new le with the content in $bits parameter. If you move the upload le, read the content of the uploaded le, and then you can give the lename and content to this function, which will add it to the upload folder. The permissions will be set on the new le automatically by this function.

Usage
<?php wp_upload_bits( $name, $deprecated, $bits, $time ) ?>

Parameters
$name (string) (required) Default: None $deprecated (null) (required) Not used. Set to null. Default: None $bits (mixed) (required) File content Default: None $time (string) (optional) Time formatted in 'yyyy/mm'. Default: null

Return Values
(array)

Examples Notes Change Log


Since: 2.0.0

Source File
wp_upload_bits() is located in wp-includes/functions.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/wp_upload_bits" Categories: Functions | New page created

Function Reference/wp upload dir


Usage
<?php $wud = wp_upload_dir(); $old = wp_upload_dir( '2007-11-26 04:26:39' ); echo 'uploads_use_yearmonth_folders: '.get_option( 'uploads_use_yearmonth_folders' )."\n"; echo 'upload_path: ' .get_option( 'upload_path' )."\n"; echo 'upload_url_path: ' .get_option( 'upload_url_path' )."\n"; print_r($old); print_r($wud); ?>

Return
The elds returned are: [path], [url], [subdir], [basedir], [baseurl], [error] On success, the returned array will have many indices: 'path' - base directory and sub directory or full path to upload directory. 'url' - base url and sub directory or absolute URL to upload directory. 'subdir' - sub directory if uploads use year/month folders option is on. 'basedir' - path without subdir. 'baseurl' - URL path without subdir. 'error' - set to false. elds [basedir] and [baseurl] return since WordPress v.2.6

Example Output
uploads_use_yearmonth_folders: 1 upload_path: /home/example.com/wordpress/wp-content/uploads upload_url_path: http://www.example.com/wordpress/wp-content/uploads Array ( [path] => /home/example.com/wordpress/wp-content/uploads/2007/11 [url] => http://www.example.com/wordpress/wp-content/uploads/2007/11 [subdir] => /2007/11 [basedir] => /home/example.com/wordpress/wp-content/uploads [baseurl] => http://www.example.com/wordpress/wp-content/uploads [error] => ) Array ( [path] => /home/example.com/wordpress/wp-content/uploads/2008/11 [url] => http://www.example.com/wordpress/wp-content/uploads/2008/11 [subdir] => /2008/11 [basedir] => /home/example.com/wordpress/wp-content/uploads [baseurl] => http://www.example.com/wordpress/wp-content/uploads [error] => )

Retrieved from "http://codex.wordpress.org/Function_Reference/wp_upload_dir" Categories: Functions | New page created

Function Reference/wp verify nonce Contents


1 Description 2 Parameters 3 Returns 4 Example 5 See also

Description
Verify that correct nonce was used with time limit.

Parameters
$nonce (string) (required) Nonce that was used in the form to verify. Default: None $action (string) (int) Should give context to what is taking place and be the same when nonce was created. Default: -1

Returns
@return bool Whether the nonce check passed or failed.

Example
<?php $nonce= wp_create_nonce ('my-nonce'); ?> <a href='myplugin.php?_wpnonce=<?php echo $nonce ?>'> ... <?php $nonce=$_REQUEST['_wpnonce']; if (! wp_verify_nonce($nonce, 'my-nonce') ) die('Security check'); ?>

See also
Wordpress Nonce Implementation wp_create_nonce check_admin_referer

This page is marked as incomplete. You can help Codex by expanding it. Retrieved from "http://codex.wordpress.org/Function_Reference/wp_verify_nonce" Categories: Stubs | Functions

Function Reference/wpautop Contents


1 Description 2 Usage 3 Parameters 4 References

Description
Changes double line-breaks in the text into HTML paragraphs (<p>...</p>). Wordpress uses it to lter the content and the excerpt.

Usage

<?php wpautop( $pee, $br = 1 ); ?>

Parameters
pee (string) The text to be formatted. br (boolean) Preserve line breaks. When set to true, any line breaks remaining after paragraph conversion are converted to HTML <br />. Line breaks within script and style sections are not affected. Default true.

References
http://photomatt.net/scripts/autop/ This article is marked as in need of editing. You can help Codex by editing it. Retrieved from "http://codex.wordpress.org/Function_Reference/wpautop" Categories: Functions | New page created | Copyedit

Function Reference/wpdb Class Contents


1 Interfacing With the Database 1.1 Notes On Use 2 Run Any Query on the Database 2.1 Examples 3 SELECT a Variable 3.1 Examples 4 SELECT a Row 4.1 Examples 5 SELECT a Column 5.1 Examples 6 SELECT Generic Results 6.1 Examples 7 Protect Queries Against SQL Injection Attacks 7.1 Examples 8 Show and Hide SQL Errors 9 Getting Column Information 10 Clearing the Cache 11 Class Variables 12 Tables

Interfacing With the Database


WordPress provides a class of functions for all database manipulations. The class is called wpdb and is based on the ezSQL class written and maintained by Justin Vincent. Though the WordPress class is slightly different than the ezSQL class, their use is essentially the same. Please see the ezSQL documentation for more information.

Notes On Use
Within PHP code blocks in a template the $wpdb class should work as expected, but in the case of a plugin or external script it may be necessary to scope it to global before calling it in your code. This is briey explained in the Writing a Plugin documentation. If writing a plugin that will use a table that is not created in a vanilla WordPress installation, the $wpdb class can be used to read data from any table in the database in much the same way it can read data from a WordPress-Installed table. The query should be structured like "SELECT id, name FROM mytable", don't worry about specifying which database to look for the table in, the $wpdb object will automatically use the database WordPress is installed in. Any of the functions below will work with a query that is set up like this.

Run Any Query on the Database


The query function allows you to execute any query on the WordPress database. It is best to use a more specic function, however, for SELECT queries. <?php $wpdb->query('query'); ?> query (string) The query you wish to run. If there are any query results, the function will return an integer corresponding to the number of rows affected and the query results will cached for use by other wpdb functions. If there are no results, the function will return (int) 0. If there is a MySQL error, the function will return FALSE.

(Note: since both 0 and FALSE can be returned, make sure you use the correct comparison operator: equality == vs. identicality ===). Note: It is advisable to use the wpdb->escape($user_entered_data_string) method to protect the database against SQL injection attacks by malformed or malicious data, especially when using the INSERT or UPDATE SQL commands on user-entered data in the database. See the section entitled Protect Queries Against SQL Injection Attacks below. Additionally, if you wish to access the database from your code le which is not placed inside one of the standard plugin locations, you will need to require_once() the wp-load.php le as this le will will now require any other les you will need for connecting to the database. If you are going to be using the database connection inside of a function, do not forget to declare $wpdb as global. It is always advisable to put your functionality inside a plugin. However, if you need it in some cases, this workaround is available. For example, this is the code in a le has_great_code.php in the root/installation directory : require_once('wp-load.php'); function some_function() { global $wpdb; /* your function code would go here */ }

Examples
Add Post 13 to Category 2: $wpdb->query(" INSERT INTO $wpdb->post2cat (post_id, category_id) VALUES (13, 2)"); Delete the 'gargle' meta key and value from Post 13. $wpdb->query(" DELETE FROM $wpdb->postmeta WHERE post_id = '13' AND meta_key = 'gargle'"); Performed in WordPress by delete_post_meta(). Set the parent of Page 15 to Page 7. $wpdb->query(" UPDATE $wpdb->posts SET post_parent = 7 WHERE ID = 15 AND post_status = 'static'");

SELECT a Variable
The get_var function returns a single variable from the database. Though only one variable is returned, the entire result of the query is cached for later use. Returns NULL if no result is found. <?php $wpdb->get_var('query',column_offset,row_offset); ?> query (string) The query you wish to run. Setting this parameter to null will return the specied variable from the cached results of the previous query. column_offset (integer) The desired column (0 being the rst). Defaults to 0. row_offset (integer) The desired row (0 being the rst). Defaults to 0.

Examples
Retrieve the name of Category 4. $name = $wpdb->get_var("SELECT name FROM $wpdb->terms WHERE term_ID=4"); echo $name; Retrieve and display the number of users. <?php $user_count = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->users;");?> <p><?php echo 'user count is ' . $user_count; ?></p>

SELECT a Row

To retrieve an entire row from a query, use get_row. The function can return the row as an object, an associative array, or as a numbered array. If more than one row is returned by the query, only the specied row is returned by the function, but all rows are cached for later use. <?php $wpdb->get_row('query', output_type, row_offset); ?> query (string) The query you wish to run. Setting this parameter to null will return the specied row from the cached results of the previous query. output_type One of three pre-dened constants. Defaults to OBJECT. OBJECT - result will be output as an object. ARRAY_A - result will be output as an associative array. ARRAY_N - result will be output as a numbered array. row_offset (integer) The desired row (0 being the rst). Defaults to 0.

Examples
Get all the information about Link 10. $mylink = $wpdb->get_row("SELECT * FROM $wpdb->links WHERE link_id = 10"); The properties of the $mylink object are the column names of the result from the SQL query (in this all of the columns from the $wpdb->links table). echo $mylink->link_id; // prints "10" In contrast, using $mylink = $wpdb->get_row("SELECT * FROM $wpdb->links WHERE link_id = 10", ARRAY_A); would result in an associative array: echo $mylink['link_id']; // prints "10" and $mylink = $wpdb->get_row("SELECT * FROM $wpdb->links WHERE link_id = 10", ARRAY_N); would result in a numbered array: echo $mylink[1]; // prints "10"

SELECT a Column
To SELECT a column, use get_col. This function outputs a dimensional array. If more than one column is returned by the query, only the specied column will be returned by the function, but the entire result is cached for later use. <?php $wpdb->get_col('query',column_offset); ?> query (string) the query you wish to execute. Setting this parameter to null will return the specied column from the cached results of the previous query. column_offset (integer) The desired column (0 being the rst). Defaults to 0.

Examples
Get all the Categories to which Post 103 belongs. $postcats = $wpdb->get_col("SELECT category_id FROM $wpdb->post2cat WHERE post_id = 103 ORDER BY category_id"); Performed in WordPress by wp_get_post_cats().

SELECT Generic Results


Generic, mulitple row results can be pulled from the database with get_results. The function returns the entire query result as an array.

Each element of this array corresponds to one row of the query result and, like get_row can be an object, an associative array, or a numbered array. <?php $wpdb->get_results('query', output_type); ?> query (string) The query you wish to run. Setting this parameter to null will return the data from the cached results of the previous query. output_type One of three pre-dened constants. Defaults to OBJECT. See SELECT a Row and its examples for more information. OBJECT - result will be output as an object. ARRAY_A - result will be output as an associative array. ARRAY_N - result will be output as a numbered array.

Examples
Get the IDs and Titles of all the Drafts by User 5 and echo the Titles. $fivesdrafts = $wpdb->get_results("SELECT ID, post_title FROM $wpdb->posts WHERE post_status = 'draft' AND post_author = 5"); foreach ($fivesdrafts as $fivesdraft) { echo $fivesdraft->post_title; } Using the OBJECT output_type, get the 5 most recent posts in Categories 3,20, and 21 and display the permalink title to each post. (example works at WordPress Version 2.2.1) <?php $querystr =" SELECT $wpdb->posts.* FROM $wpdb->posts LEFT JOIN $wpdb->post2cat ON ($wpdb->posts.ID = $wpdb->post2cat.post_id) WHERE $wpdb->posts.post_status = 'publish' AND $wpdb->posts.post_type = 'post' AND $wpdb->post2cat.category_id IN (3,20,21) ORDER BY $wpdb->posts.post_date DESC LIMIT 5"; $pageposts = $wpdb->get_results($querystr, OBJECT); ?> <?php if ($pageposts): ?> <?php foreach ($pageposts as $post): ?> <?php setup_postdata($post); ?> <h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"> <?php the_title(); ?></a></h2> <?php endforeach; ?> <?php else : ?> <h2> Not Found</h2> <?php endif; ?>

Protect Queries Against SQL Injection Attacks


If you're creating an SQL query, make sure you protect against SQL injection attacks. This can be conveniently done with the prepare method. <?php $sql = $wpdb->prepare( 'query'[, value_parameter, value_parameter ... ] ); ?> Note that you may need to use PHP's stripslashes() when loading data back into WordPress that was inserted with a prepared query.

Examples
Add Meta key => value pair "Harriet's Adages" => "WordPress' database interface is like Sunday Morning: Easy." to Post 10. $metakey = "Harriet's Adages"; $metavalue = "WordPress' database interface is like Sunday Morning: Easy."; $wpdb->query( $wpdb->prepare( " INSERT INTO $wpdb->postmeta ( post_id, meta_key, meta_value ) VALUES ( %d, %s, %s )", 10, $metakey, $metavalue ) );

Performed in WordPress by add_meta(). Notice that you do not have to worry about quoting strings. Instead of passing the variables directly into the SQL query, place a %s marker for strings and a %d marker for integers. You can pass as many values as you like, each as a new parameter in the prepare() method.

Show and Hide SQL Errors


You can turn error echoing on and off with the show_errors and hide_errors, respectively. <?php $wpdb->show_errors(); ?> <?php $wpdb->hide_errors(); ?> You can also print the error (if any) generated by the most recent query with print_error. <?php $wpdb->print_error(); ?>

Getting Column Information


You can retrieve information about the columns of the most recent query result with get_col_info. This can be useful when a function has returned an OBJECT whose properties you don't know. The function will output the desired information from the specied column, or an array with information on all columns from the query result if no column is specied. <?php $wpdb->get_col_info('type', offset); ?> type (string) What information you wish to retrieve. May take on any of the following values (list taken from the ezSQL docs). Defaults to name. name - column name. Default. table - name of the table the column belongs to max_length - maximum length of the column not_null - 1 if the column cannot be NULL primary_key - 1 if the column is a primary key unique_key - 1 if the column is a unique key multiple_key - 1 if the column is a non-unique key numeric - 1 if the column is numeric blob - 1 if the column is a BLOB type - the type of the column unsigned - 1 if the column is unsigned zeroll - 1 if the column is zero-lled offset (integer) Specify the column from which to retrieve information (with 0 being the rst column). Defaults to -1. -1 - Retrieve information from all columns. Output as array. Default. Non-negative integer - Retrieve information from specied column (0 being the rst).

Clearing the Cache


You can clear the SQL result cache with flush. <?php $wpdb->flush(); ?> This clears $wpdb->last_result, $wpdb->last_query, and $wpdb->col_info.

Class Variables
$show_errors Whether or not Error echoing is turned on. Defaults to TRUE. $num_queries The number of queries that have been executed. $last_query The most recent query to have been executed. $queries You may save all of the queries run on the database and their stop times be setting the SAVEQUERIES constant to TRUE (this constant defaults to FALSE). If SAVEQUERIES is TRUE, your queries will be stored in this variable as an array. $last_results The most recent query results. $col_info The column information for the most recent query results. See Getting Column Information. $insert_id ID generated for an AUTO_INCREMENT column by the most recent INSERT query.

Tables
The WordPress database tables are easily referenced in the wpdb class. $posts The table of Posts. $users The table of Users. $comments The Comments table. $links The table of Links. $options The Options table. $postmeta The Meta Content (a.k.a. Custom Fields) table. $usermeta The usermeta table contains additional user information, such as nicknames, descriptions and permissions. $terms The terms table contains the 'description' of Categories, Link Categories, Tags. $term_taxonomy The term_taxonomy table describes the various taxonomies (classes of terms). Categories, Link Categories, and Tags are taxonomies. $term_relationships The term relationships table contains link between the term and the object that uses that term, meaning this le point to each Category used for each Post. Retrieved from "http://codex.wordpress.org/Function_Reference/wpdb_Class" Categories: Advanced Topics | Design and Layout | Functions | Template Tags | WordPress Development

Function Reference/wptexturize
This page is marked as incomplete. You can help Codex by expanding it.

Description
This returns given text with some transformations:

Usage
<?php wptexturize(); ?> (List is incomplete, but gives you an idea.)
-- en-dash --- em-dash ... ellipsis

There is a small "cockney" list of transformations, as well. The following common phrases will have typographic quotes added to them: 'tain't 'twere 'twas 'tis 'twill 'til 'bout 'nuff 'round 'cause

Parameters
Retrieved from "http://codex.wordpress.org/Function_Reference/wptexturize" Categories: Stubs | Functions | New page created

Function Reference/xmlrpc getpostcategory Contents

1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
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.

Usage
<?php xmlrpc_getpostcategory( $content ) ?>

Parameters
$content (string) (required) XMLRPC XML Request content Default: None

Return Values
(string|array) List of categories or category name.

Examples Notes
Uses global: (unknown) $post_default_category

Change Log
Since: 0.71

Source File
xmlrpc_getpostcategory() is located in wp-includes/functions.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/xmlrpc_getpostcategory" Categories: Functions | New page created

Function Reference/xmlrpc getposttitle Contents


1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
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.

Usage
<?php xmlrpc_getposttitle( $content ) ?>

Parameters
$content (string) (required) XMLRPC XML Request content Default: None

Return Values
(string) Post title

Examples Notes
Uses global: (string) $post_default_title

Change Log
Since: 0.71

Source File
xmlrpc_getposttitle() is located in wp-includes/functions.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/xmlrpc_getposttitle" Categories: Functions | New page created

Function Reference/xmlrpc removepostdata Contents


1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
XMLRPC XML content without title and category elements.

Usage
<?php xmlrpc_removepostdata( $content ) ?>

Parameters
$content (string) (required) XMLRPC XML Request content Default: None

Return Values
(string) XMLRPC XML Request content without title and category elements.

Examples Notes Change Log


Since: 0.71

Source File
xmlrpc_removepostdata() is located in wp-includes/functions.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/xmlrpc_removepostdata" Categories: Functions | New page created

Function Reference/zeroise Contents


1 Description 2 Usage 3 Parameters 4 Return Values 5 Examples 6 Notes 7 Change Log 8 Source File 9 Related

Description
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.

Usage
<?php zeroise( $number, $threshold ) ?>

Parameters
$number (mixed) (required) Number to append zeros to if not greater than threshold. Default: None $threshold (integer) (required) Digit places number needs to be to not have zeros added. Default: None

Return Values
(string) Adds leading zeros to number if needed.

Examples Notes Change Log


Since: 0.71

Source File
zeroise() is located in wp-includes/formatting.php.

Related
Retrieved from "http://codex.wordpress.org/Function_Reference/zeroise" Categories: Functions | New page created

You might also like