| [ XREF Home ] [ Index ] |
PHP Cross Reference of WordPress TrunkProvided by Yoast |
[Source view] [Print] [Project Stats]
Post functions and post utility function.
| File Size: | 5240 lines (169 kb) |
| Included or required: | 0 times |
| Referenced: | 0 times |
| Includes or requires: | 0 files |
| create_initial_post_types() X-Ref |
| Creates the initial post types when 'init' action is fired. |
| get_attached_file( $attachment_id, $unfiltered = false ) X-Ref |
| Retrieve attached file path based on attachment ID. You can optionally send it through the 'get_attached_file' filter, but by default it will just return the file path unfiltered. The function works by getting the single post meta name, named '_wp_attached_file' and returning it. This is a convenience function to prevent looking up the meta name and provide a mechanism for sending the attached filename through a filter. param: int $attachment_id Attachment ID. param: bool $unfiltered Whether to apply filters. return: string The file path to the attached file. |
| update_attached_file( $attachment_id, $file ) X-Ref |
| Update attachment file path based on attachment ID. Used to update the file path of the attachment, which uses post meta name '_wp_attached_file' to store the path of the attachment. param: int $attachment_id Attachment ID param: string $file File path for the attachment return: bool False on failure, true on success. |
| _wp_relative_upload_path( $path ) X-Ref |
| Return relative path to an uploaded file. The path is relative to the current upload dir. param: string $path Full path to the file return: string relative path on success, unchanged path on failure. |
| get_children($args = '', $output = OBJECT) X-Ref |
| Retrieve all children of the post parent ID. Normally, without any enhancements, the children would apply to pages. In the context of the inner workings of WordPress, pages, posts, and attachments share the same table, so therefore the functionality could apply to any one of them. It is then noted that while this function does not work on posts, it does not mean that it won't work on posts. It is recommended that you know what context you wish to retrieve the children of. Attachments may also be made the child of a post, so if that is an accurate statement (which needs to be verified), it would then be possible to get all of the attachments for a post. Attachments have since changed since version 2.5, so this is most likely unaccurate, but serves generally as an example of what is possible. The arguments listed as defaults are for this function and also of the {@link get_posts()} function. The arguments are combined with the get_children defaults and are then passed to the {@link get_posts()} function, which accepts additional arguments. You can replace the defaults in this function, listed below and the additional arguments listed in the {@link get_posts()} function. The 'post_parent' is the most important argument and important attention needs to be paid to the $args parameter. If you pass either an object or an integer (number), then just the 'post_parent' is grabbed and everything else is lost. If you don't specify any arguments, then it is assumed that you are in The Loop and the post parent will be grabbed for from the current post. The 'post_parent' argument is the ID to get the children. The 'numberposts' is the amount of posts to retrieve that has a default of '-1', which is used to get all of the posts. Giving a number higher than 0 will only retrieve that amount of posts. The 'post_type' and 'post_status' arguments can be used to choose what criteria of posts to retrieve. The 'post_type' can be anything, but WordPress post types are 'post', 'pages', and 'attachments'. The 'post_status' argument will accept any post status within the write administration panels. param: mixed $args Optional. User defined arguments for replacing the defaults. param: string $output Optional. Constant for return type, either OBJECT (default), ARRAY_A, ARRAY_N. return: array|bool False on failure and the type will be determined by $output parameter. |
| get_extended($post) X-Ref |
| 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. param: string $post Post content. return: array Post before ('main') and after ('extended'). |
| get_post(&$post, $output = OBJECT, $filter = 'raw') X-Ref |
| Retrieves post data given a post ID or post object. See {@link sanitize_post()} for optional $filter values. Also, the parameter $post, must be given as a variable, since it is passed by reference. param: int|object $post Post ID or post object. param: string $output Optional, default is Object. Either OBJECT, ARRAY_A, or ARRAY_N. param: string $filter Optional, default is raw. return: mixed Post data |
| get_post_ancestors($post) X-Ref |
| Retrieve ancestors of a post. param: int|object $post Post ID or post object return: array Ancestor IDs or empty array if none are found. |
| get_post_field( $field, $post, $context = 'display' ) X-Ref |
| Retrieve data from a post field based on Post ID. Examples of the post field will be, 'post_type', 'post_status', 'content', etc and based off of the post object property or key names. The context values are based off of the taxonomy filter functions and supported values are found within those functions. param: string $field Post field name param: id $post Post ID param: string $context Optional. How to filter the field. Default is display. return: WP_Error|string Value in post field or WP_Error on failure |
| get_post_mime_type($ID = '') X-Ref |
| 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. param: int $ID Optional. Post ID. return: bool|string False on failure or returns the mime type |
| get_post_format( $post = null ) X-Ref |
| Retrieve the format slug for a post param: int|object $post A post return: mixed The format if successful. False if no format is set. WP_Error if errors. |
| has_post_format( $format, $post = null ) X-Ref |
| Check if a post has a particular format param: string $format The format to check for param: object|id $post The post to check. If not supplied, defaults to the current post if used in the loop. return: bool True if the post has the format, false otherwise. |
| set_post_format( $post, $format ) X-Ref |
| Assign a format to a post param: int|object $post The post for which to assign a format param: string $format A format to assign. Use an empty string or array to remove all formats from the post. return: mixed WP_Error on error. Array of affected term IDs on success. |
| get_post_status($ID = '') X-Ref |
| 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. param: int $ID Post ID return: string|bool Post status or false on failure. |
| get_post_statuses( ) X-Ref |
| Retrieve all of the WordPress supported post statuses. Posts have a limited set of valid status values, this provides the post_status values and descriptions. return: array List of post statuses. |
| get_page_statuses( ) X-Ref |
| Retrieve all of the WordPress support page statuses. Pages have a limited set of valid status values, this provides the post_status values and descriptions. return: array List of page statuses. |
| register_post_status($post_status, $args = array() X-Ref |
| Register a post type. Do not use before init. A simple function for creating or modifying a post status based on the parameters given. The function will accept an array (second optional parameter), along with a string for the post status name. Optional $args contents: label - A descriptive name for the post status marked for translation. Defaults to $post_status. public - Whether posts of this status should be shown in the front end of the site. Defaults to true. exclude_from_search - Whether to exclude posts with this post status from search results. Defaults to true. show_in_admin_all_list - Whether to include posts in the edit listing for their post type show_in_admin_status_list - Show in the list of statuses with post counts at the top of the edit listings, e.g. All (12) | Published (9) | My Custom Status (2) ... Arguments prefixed with an _underscore shouldn't be used by plugins and themes. param: string $post_status Name of the post status. param: array|string $args See above description. |
| get_post_status_object( $post_status ) X-Ref |
| Retrieve a post status object by name param: string $post_status The name of a registered post status return: object A post status object |
| get_post_stati( $args = array() X-Ref |
| Get a list of all registered post status objects. param: array|string $args An array of key => value arguments to match against the post status objects. param: string $output The type of output to return, either post status 'names' or 'objects'. 'names' is the default. param: string $operator The logical operation to perform. 'or' means only one element return: array A list of post type names or objects |
| is_post_type_hierarchical( $post_type ) X-Ref |
| Whether the post type is hierarchical. A false return value might also mean that the post type does not exist. param: string $post_type Post type name return: bool Whether post type is hierarchical. |
| post_type_exists( $post_type ) X-Ref |
| Checks if a post type is registered. param: string $post_type Post type name return: bool Whether post type is registered. |
| get_post_type( $the_post = false ) X-Ref |
| Retrieve the post type of the current post or of a given post. param: mixed $the_post Optional. Post object or post ID. return: bool|string post type or false on failure. |
| get_post_type_object( $post_type ) X-Ref |
| Retrieve a post type object by name param: string $post_type The name of a registered post type return: object A post type object |
| get_post_types( $args = array() X-Ref |
| Get a list of all registered post type objects. param: array|string $args An array of key => value arguments to match against the post type objects. param: string $output The type of output to return, either post type 'names' or 'objects'. 'names' is the default. param: string $operator The logical operation to perform. 'or' means only one element return: array A list of post type names or objects |
| register_post_type($post_type, $args = array() X-Ref |
| Register a post type. Do not use before init. A function for creating or modifying a post type based on the parameters given. The function will accept an array (second optional parameter), along with a string for the post type name. Optional $args contents: - label - Name of the post type shown in the menu. Usually plural. If not set, labels['name'] will be used. - description - A short descriptive summary of what the post type is. Defaults to blank. - public - Whether posts of this type should be shown in the admin UI. Defaults to false. - exclude_from_search - Whether to exclude posts with this post type from search results. Defaults to true if the type is not public, false if the type is public. - publicly_queryable - Whether post_type queries can be performed from the front page. Defaults to whatever public is set as. - show_ui - Whether to generate a default UI for managing this post type. Defaults to true if the type is public, false if the type is not public. - show_in_menu - Where to show the post type in the admin menu. True for a top level menu, false for no menu, or can be a top level page like 'tools.php' or 'edit.php?post_type=page'. show_ui must be true. - menu_position - The position in the menu order the post type should appear. Defaults to the bottom. - menu_icon - The url to the icon to be used for this menu. Defaults to use the posts icon. - capability_type - The string to use to build the read, edit, and delete capabilities. Defaults to 'post'. May be passed as an array to allow for alternative plurals when using this argument as a base to construct the capabilities, e.g. array('story', 'stories'). - capabilities - Array of capabilities for this post type. By default the capability_type is used as a base to construct capabilities. You can see accepted values in {@link get_post_type_capabilities()}. - map_meta_cap - Whether to use the internal default meta capability handling. Defaults to false. - hierarchical - Whether the post type is hierarchical. Defaults to false. - supports - An alias for calling add_post_type_support() directly. See {@link add_post_type_support()} for documentation. Defaults to none. - register_meta_box_cb - Provide a callback function that will be called when setting up the meta boxes for the edit form. Do remove_meta_box() and add_meta_box() calls in the callback. - taxonomies - An array of taxonomy identifiers that will be registered for the post type. Default is no taxonomies. Taxonomies can be registered later with register_taxonomy() or register_taxonomy_for_object_type(). - labels - An array of labels for this post type. By default post labels are used for non-hierarchical types and page labels for hierarchical ones. You can see accepted values in {@link get_post_type_labels()}. - permalink_epmask - The default rewrite endpoint bitmasks. - has_archive - True to enable post type archives. Will generate the proper rewrite rules if rewrite is enabled. - rewrite - false to prevent rewrite. Defaults to true. Use array('slug'=>$slug) to customize permastruct; default will use $post_type as slug. Other options include 'with_front', 'feeds', and 'pages'. - query_var - false to prevent queries, or string to value of the query var to use for this post type - can_export - true allows this post type to be exported. - show_in_nav_menus - true makes this post type available for selection in navigation menus. - _builtin - true if this post type is a native or "built-in" post_type. THIS IS FOR INTERNAL USE ONLY! - _edit_link - URL segement to use for edit link of this post type. THIS IS FOR INTERNAL USE ONLY! param: string $post_type Name of the post type. param: array|string $args See above description. return: object|WP_Error the registered post type object, or an error object |
| get_post_type_capabilities( $args ) X-Ref |
| Builds an object with all post type capabilities out of a post type object Post type capabilities use the 'capability_type' argument as a base, if the capability is not set in the 'capabilities' argument array or if the 'capabilities' argument is not supplied. The capability_type argument can optionally be registered as an array, with the first value being singular and the second plural, e.g. array('story, 'stories') Otherwise, an 's' will be added to the value for the plural form. After registration, capability_type will always be a string of the singular value. By default, seven keys are accepted as part of the capabilities array: - edit_post, read_post, and delete_post are meta capabilities, which are then generally mapped to corresponding primitive capabilities depending on the context, which would be the post being edited/read/deleted and the user or role being checked. Thus these capabilities would generally not be granted directly to users or roles. - edit_posts - Controls whether objects of this post type can be edited. - edit_others_posts - Controls whether objects of this type owned by other users can be edited. If the post type does not support an author, then this will behave like edit_posts. - publish_posts - Controls publishing objects of this post type. - read_private_posts - Controls whether private objects can be read. These four primitive capabilities are checked in core in various locations. There are also seven other primitive capabilities which are not referenced directly in core, except in map_meta_cap(), which takes the three aforementioned meta capabilities and translates them into one or more primitive capabilities that must then be checked against the user or role, depending on the context. - read - Controls whether objects of this post type can be read. - delete_posts - Controls whether objects of this post type can be deleted. - delete_private_posts - Controls whether private objects can be deleted. - delete_published_posts - Controls whether published objects can be deleted. - delete_others_posts - Controls whether objects owned by other users can be can be deleted. If the post type does not support an author, then this will behave like delete_posts. - edit_private_posts - Controls whether private objects can be edited. - edit_published_posts - Controls whether published objects can be edited. These additional capabilities are only used in map_meta_cap(). Thus, they are only assigned by default if the post type is registered with the 'map_meta_cap' argument set to true (default is false). param: object $args Post type registration arguments return: object object with all the capabilities as member variables |
| _post_type_meta_capabilities( $capabilities = null ) X-Ref |
| Stores or returns a list of post type meta caps for map_meta_cap(). |
| get_post_type_labels( $post_type_object ) X-Ref |
| Builds an object with all post type labels out of a post type object Accepted keys of the label array in the post type object: - name - general name for the post type, usually plural. The same and overriden by $post_type_object->label. Default is Posts/Pages - singular_name - name for one object of this post type. Default is Post/Page - add_new - Default is Add New for both hierarchical and non-hierarchical types. When internationalizing this string, please use a {@link http://codex.wordpress.org/I18n_for_WordPress_Developers#Disambiguation_by_context gettext context} matching your post type. Example: <code>_x('Add New', 'product');</code> - add_new_item - Default is Add New Post/Add New Page - edit_item - Default is Edit Post/Edit Page - new_item - Default is New Post/New Page - view_item - Default is View Post/View Page - search_items - Default is Search Posts/Search Pages - not_found - Default is No posts found/No pages found - not_found_in_trash - Default is No posts found in Trash/No pages found in Trash - parent_item_colon - This string isn't used on non-hierarchical types. In hierarchical ones the default is Parent Page: Above, the first default value is for non-hierarchical post types (like posts) and the second one is for hierarchical post types (like pages). param: object $post_type_object return: object object with all the labels as member variables |
| _get_custom_object_labels( $object, $nohier_vs_hier_defaults ) X-Ref |
| Builds an object with custom-something object (post type, taxonomy) labels out of a custom-something object |
| _add_post_type_submenus() X-Ref |
| Adds submenus for post types. |
| add_post_type_support( $post_type, $feature ) X-Ref |
| Register support of certain features for a post type. All features are directly associated with a functional area of the edit screen, such as the editor or a meta box: 'title', 'editor', 'comments', 'revisions', 'trackbacks', 'author', 'excerpt', 'page-attributes', 'thumbnail', and 'custom-fields'. Additionally, the 'revisions' feature dictates whether the post type will store revisions, and the 'comments' feature dicates whether the comments count will show on the edit screen. param: string $post_type The post type for which to add the feature param: string|array $feature the feature being added, can be an array of feature strings or a single string |
| remove_post_type_support( $post_type, $feature ) X-Ref |
| Remove support for a feature from a post type. param: string $post_type The post type for which to remove the feature param: string $feature The feature being removed |
| post_type_supports( $post_type, $feature ) X-Ref |
| Checks a post type's support for a given feature param: string $post_type The post type being checked param: string $feature the feature being checked return: boolean |
| set_post_type( $post_id = 0, $post_type = 'post' ) X-Ref |
| Updates the post type for the post ID. The page or post cache will be cleaned for the post ID. param: int $post_id Post ID to change post type. Not actually optional. param: string $post_type Optional, default is post. Supported values are 'post' or 'page' to return: int Amount of rows changed. Should be 1 for success and 0 for failure. |
| get_posts($args = null) X-Ref |
| Retrieve list of latest posts or posts matching criteria. The defaults are as follows: 'numberposts' - Default is 5. Total number of posts to retrieve. 'offset' - Default is 0. See {@link WP_Query::query()} for more. 'category' - What category to pull the posts from. 'orderby' - Default is 'post_date'. How to order the posts. 'order' - Default is 'DESC'. The order to retrieve the posts. 'include' - See {@link WP_Query::query()} for more. 'exclude' - See {@link WP_Query::query()} for more. 'meta_key' - See {@link WP_Query::query()} for more. 'meta_value' - See {@link WP_Query::query()} for more. 'post_type' - Default is 'post'. Can be 'page', or 'attachment' to name a few. 'post_parent' - The parent of the post or post type. 'post_status' - Default is 'publish'. Post status to retrieve. param: array $args Optional. Overrides defaults. return: array List of posts. |
| add_post_meta($post_id, $meta_key, $meta_value, $unique = false) X-Ref |
| Add meta data field to a post. Post meta data is called "Custom Fields" on the Administration Screen. param: int $post_id Post ID. param: string $meta_key Metadata name. param: mixed $meta_value Metadata value. param: bool $unique Optional, default is false. Whether the same key should not be added. return: bool False for failure. True for success. |
| delete_post_meta($post_id, $meta_key, $meta_value = '') X-Ref |
| Remove metadata matching criteria from a post. You can match based on the key, or key and value. Removing based on key and value, will keep from removing duplicate metadata with the same key. It also allows removing all metadata matching key, if needed. param: int $post_id post ID param: string $meta_key Metadata name. param: mixed $meta_value Optional. Metadata value. return: bool False for failure. True for success. |
| get_post_meta($post_id, $key, $single = false) X-Ref |
| Retrieve post meta field for a post. param: int $post_id Post ID. param: string $key The meta key to retrieve. param: bool $single Whether to return a single value. return: mixed Will be an array if $single is false. Will be value of meta data field if $single |
| update_post_meta($post_id, $meta_key, $meta_value, $prev_value = '') X-Ref |
| Update post meta field based on post ID. Use the $prev_value parameter to differentiate between meta fields with the same key and post ID. If the meta field for the post does not exist, it will be added. param: int $post_id Post ID. param: string $meta_key Metadata key. param: mixed $meta_value Metadata value. param: mixed $prev_value Optional. Previous value to check before removing. return: bool False on failure, true if success. |
| delete_post_meta_by_key($post_meta_key) X-Ref |
| Delete everything from post meta matching meta key. param: string $post_meta_key Key to search for when deleting. return: bool Whether the post meta key was deleted from the database |
| get_post_custom( $post_id = 0 ) X-Ref |
| Retrieve post meta fields, based on post ID. The post meta fields are retrieved from the cache, so the function is optimized to be called more than once. It also applies to the functions, that use this function. param: int $post_id post ID return: array |
| get_post_custom_keys( $post_id = 0 ) X-Ref |
| Retrieve meta field names for a post. If there are no meta fields, then nothing (null) will be returned. param: int $post_id post ID return: array|null Either array of the keys, or null if keys could not be retrieved. |
| get_post_custom_values( $key = '', $post_id = 0 ) X-Ref |
| Retrieve values for a custom post field. The parameters must not be considered optional. All of the post meta fields will be retrieved and only the meta field key values returned. param: string $key Meta field key. param: int $post_id Post ID return: array Meta field values. |
| is_sticky( $post_id = 0 ) X-Ref |
| Check if post is sticky. Sticky posts should remain at the top of The Loop. If the post ID is not given, then The Loop ID for the current post will be used. param: int $post_id Optional. Post ID. return: bool Whether post is sticky. |
| sanitize_post($post, $context = 'display') X-Ref |
| Sanitize every post field. If the context is 'raw', then the post object or array will get minimal santization of the int fields. param: object|array $post The Post Object or Array param: string $context Optional, default is 'display'. How to sanitize post fields. return: object|array The now sanitized Post Object or Array (will be the same type as $post) |
| sanitize_post_field($field, $value, $post_id, $context) X-Ref |
| Sanitize post field based on context. Possible context values are: 'raw', 'edit', 'db', 'display', 'attribute' and 'js'. The 'display' context is used by default. 'attribute' and 'js' contexts are treated like 'display' when calling filters. param: string $field The Post Object field name. param: mixed $value The Post Object value. param: int $post_id Post ID. param: string $context How to sanitize post fields. Looks for 'raw', 'edit', 'db', 'display', return: mixed Sanitized value. |
| stick_post($post_id) X-Ref |
| Make a post sticky. Sticky posts should be displayed at the top of the front page. param: int $post_id Post ID. |
| unstick_post($post_id) X-Ref |
| Unstick a post. Sticky posts should be displayed at the top of the front page. param: int $post_id Post ID. |
| wp_count_posts( $type = 'post', $perm = '' ) X-Ref |
| Count number of posts of a post type and is user has permissions to view. This function provides an efficient method of finding the amount of post's type a blog has. Another method is to count the amount of items in get_posts(), but that method has a lot of overhead with doing so. Therefore, when developing for 2.5+, use this function instead. The $perm parameter checks for 'readable' value and if the user can read private posts, it will display that for the user that is signed in. param: string $type Optional. Post type to retrieve count param: string $perm Optional. 'readable' or empty. return: object Number of posts for each status |
| wp_count_attachments( $mime_type = '' ) X-Ref |
| Count number of attachments for the mime type(s). If you set the optional mime_type parameter, then an array will still be returned, but will only have the item you are looking for. It does not give you the number of attachments that are children of a post. You can get that by counting the number of children that post has. param: string|array $mime_type Optional. Array or comma-separated list of MIME patterns. return: array Number of posts for each mime type. |
| wp_match_mime_types($wildcard_mime_types, $real_mime_types) X-Ref |
| Check a MIME-Type against a list. If the wildcard_mime_types parameter is a string, it must be comma separated list. If the real_mime_types is a string, it is also comma separated to create the list. param: string|array $wildcard_mime_types e.g. audio/mpeg or image (same as image/*) or param: string|array $real_mime_types post_mime_type values return: array array(wildcard=>array(real types)) |
| wp_post_mime_type_where($post_mime_types, $table_alias = '') X-Ref |
| Convert MIME types into SQL. param: string|array $post_mime_types List of mime types or comma separated string of mime types. param: string $table_alias Optional. Specify a table alias, if needed. return: string The SQL AND clause for mime searching. |
| wp_delete_post( $postid = 0, $force_delete = false ) X-Ref |
| Trashes or deletes a post or page. When the post and page is permanently deleted, everything that is tied to it is deleted also. This includes comments, post meta fields, and terms associated with the post. The post or page is moved to trash instead of permanently deleted unless trash is disabled, item is already in the trash, or $force_delete is true. param: int $postid Post ID. param: bool $force_delete Whether to bypass trash and force deletion. Defaults to false. return: mixed False on failure |
| wp_trash_post($post_id = 0) X-Ref |
| Moves a post or page to the Trash If trash is disabled, the post or page is permanently deleted. param: int $post_id Post ID. return: mixed False on failure |
| wp_untrash_post($post_id = 0) X-Ref |
| Restores a post or page from the Trash param: int $post_id Post ID. return: mixed False on failure |
| wp_trash_post_comments($post = null) X-Ref |
| Moves comments for a post to the trash param: int $post Post ID or object. return: mixed False on failure |
| wp_untrash_post_comments($post = null) X-Ref |
| Restore comments for a post from the trash param: int $post Post ID or object. return: mixed False on failure |
| wp_get_post_categories( $post_id = 0, $args = array() X-Ref |
| 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. param: int $post_id Optional. The Post ID. param: array $args Optional. Overwrite the defaults. return: array |
| wp_get_post_tags( $post_id = 0, $args = array() X-Ref |
| Retrieve the tags for a post. There is only one default for this function, called 'fields' and by default is set to 'all'. There are other defaults that can be overridden in {@link wp_get_object_terms()}. param: int $post_id Optional. The Post ID param: array $args Optional. Overwrite the defaults return: array List of post tags. |
| wp_get_post_terms( $post_id = 0, $taxonomy = 'post_tag', $args = array() X-Ref |
| Retrieve the terms for a post. There is only one default for this function, called 'fields' and by default is set to 'all'. There are other defaults that can be overridden in {@link wp_get_object_terms()}. param: int $post_id Optional. The Post ID param: string $taxonomy The taxonomy for which to retrieve terms. Defaults to post_tag. param: array $args Optional. Overwrite the defaults return: array List of post tags. |
| wp_get_recent_posts( $args = array() X-Ref |
| Retrieve number of recent posts. param: string $deprecated Deprecated. param: array $args Optional. Overrides defaults. param: string $output Optional. return: unknown. |
| wp_get_single_post($postid = 0, $mode = OBJECT) X-Ref |
| Retrieve a single post, based on post ID. Has categories in 'post_category' property or key. Has tags in 'tags_input' property or key. param: int $postid Post ID. param: string $mode How to return result, either OBJECT, ARRAY_N, or ARRAY_A. return: object|array Post object or array holding post contents and information |
| wp_insert_post($postarr, $wp_error = false) X-Ref |
| Insert a post. If the $postarr parameter has 'ID' set to a value, then post will be updated. You can set the post date manually, but setting the values for 'post_date' and 'post_date_gmt' keys. You can close the comments or open the comments by setting the value for 'comment_status' key. The defaults for the parameter $postarr are: 'post_status' - Default is 'draft'. 'post_type' - Default is 'post'. 'post_author' - Default is current user ID ($user_ID). The ID of the user who added the post. 'ping_status' - Default is the value in 'default_ping_status' option. Whether the attachment can accept pings. 'post_parent' - Default is 0. Set this for the post it belongs to, if any. 'menu_order' - Default is 0. The order it is displayed. 'to_ping' - Whether to ping. 'pinged' - Default is empty string. 'post_password' - Default is empty string. The password to access the attachment. 'guid' - Global Unique ID for referencing the attachment. 'post_content_filtered' - Post content filtered. 'post_excerpt' - Post excerpt. param: array $postarr Elements that make up post to insert. param: bool $wp_error Optional. Allow return of WP_Error on failure. return: int|WP_Error The value 0 or WP_Error on failure. The post ID on success. |
| wp_update_post($postarr = array() X-Ref |
| Update a post with new post data. The date does not have to be set for drafts. You can set the date and it will not be overridden. param: array|object $postarr Post data. Arrays are expected to be escaped, objects are not. return: int 0 on failure, Post ID on success. |
| wp_publish_post($post_id) X-Ref |
| Publish a post by transitioning the post status. param: int $post_id Post ID. return: null |
| check_and_publish_future_post($post_id) X-Ref |
| Publish future post and make sure post ID has future post status. Invoked by cron 'publish_future_post' event. This safeguard prevents cron from publishing drafts, etc. param: int $post_id Post ID. return: null Nothing is returned. Which can mean that no action is required or post was published. |
| wp_unique_post_slug( $slug, $post_ID, $post_status, $post_type, $post_parent ) X-Ref |
| Computes a unique slug for the post, when given the desired slug and some post details. param: string $slug the desired slug (post_name) param: integer $post_ID param: string $post_status no uniqueness checks are made if the post is still draft or pending param: string $post_type param: integer $post_parent return: string unique slug for the post, based on $post_name (with a -1, -2, etc. suffix) |
| wp_add_post_tags($post_id = 0, $tags = '') X-Ref |
| Adds tags to a post. param: int $post_id Post ID param: string $tags The tags to set for the post, separated by commas. return: bool|null Will return false if $post_id is not an integer or is 0. Will return null otherwise |
| wp_set_post_tags( $post_id = 0, $tags = '', $append = false ) X-Ref |
| Set the tags for a post. param: int $post_id Post ID. param: string $tags The tags to set for the post, separated by commas. param: bool $append If true, don't delete existing tags, just add on. If false, replace the tags with the new tags. return: mixed Array of affected term IDs. WP_Error or false on failure. |
| wp_set_post_terms( $post_id = 0, $tags = '', $taxonomy = 'post_tag', $append = false ) X-Ref |
| Set the terms for a post. param: int $post_id Post ID. param: string $tags The tags to set for the post, separated by commas. param: bool $append If true, don't delete existing tags, just add on. If false, replace the tags with the new tags. return: mixed Array of affected term IDs. WP_Error or false on failure. |
| wp_set_post_categories($post_ID = 0, $post_categories = array() X-Ref |
| Set categories for a post. If the post categories parameter is not set, then the default category is going used. param: int $post_ID Post ID. param: array $post_categories Optional. List of categories. return: bool|mixed |
| wp_transition_post_status($new_status, $old_status, $post) X-Ref |
| Transition the post status of a post. Calls hooks to transition post status. The first is 'transition_post_status' with new status, old status, and post data. The next action called is 'OLDSTATUS_to_NEWSTATUS' the 'NEWSTATUS' is the $new_status parameter and the 'OLDSTATUS' is $old_status parameter; it has the post data. The final action is named 'NEWSTATUS_POSTTYPE', 'NEWSTATUS' is from the $new_status parameter and POSTTYPE is post_type post data. param: string $new_status Transition to this post status. param: string $old_status Previous post status. param: object $post Post data. |
| add_ping($post_id, $uri) X-Ref |
| Add a URL to those already pung. param: int $post_id Post ID. param: string $uri Ping URI. return: int How many rows were updated. |
| get_enclosed($post_id) X-Ref |
| Retrieve enclosures already enclosed for a post. param: int $post_id Post ID. return: array List of enclosures |
| get_pung($post_id) X-Ref |
| Retrieve URLs already pinged for a post. param: int $post_id Post ID. return: array |
| get_to_ping($post_id) X-Ref |
| Retrieve URLs that need to be pinged. param: int $post_id Post ID return: array |
| trackback_url_list($tb_list, $post_id) X-Ref |
| Do trackbacks for a list of URLs. param: string $tb_list Comma separated list of URLs param: int $post_id Post ID |
| get_all_page_ids() X-Ref |
| Get a list of page IDs. return: array List of page IDs. |
| get_page(&$page, $output = OBJECT, $filter = 'raw') X-Ref |
| Retrieves page data given a page ID or page object. param: mixed $page Page object or page ID. Passed by reference. param: string $output What to output. OBJECT, ARRAY_A, or ARRAY_N. param: string $filter How the return value should be filtered. return: mixed Page data. |
| get_page_by_path($page_path, $output = OBJECT, $post_type = 'page') X-Ref |
| Retrieves a page given its path. param: string $page_path Page path param: string $output Optional. Output type. OBJECT, ARRAY_N, or ARRAY_A. Default OBJECT. param: string $post_type Optional. Post type. Default page. return: mixed Null when complete. |
| get_page_by_title($page_title, $output = OBJECT, $post_type = 'page' ) X-Ref |
| Retrieve a page given its title. param: string $page_title Page title param: string $output Optional. Output type. OBJECT, ARRAY_N, or ARRAY_A. Default OBJECT. param: string $post_type Optional. Post type. Default page. return: mixed |
| get_page_children($page_id, $pages) X-Ref |
| 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. param: int $page_id Page ID. param: array $pages List of pages' objects. return: array |
| get_page_hierarchy( &$pages, $page_id = 0 ) X-Ref |
| Order the pages with children under parents in a flat list. It uses auxiliary structure to hold parent-children relationships and runs in O(N) complexity param: array $pages Posts array. param: int $page_id Parent page ID. return: array A list arranged by hierarchy. Children immediately follow their parents. |
| _page_traverse_name( $page_id, &$children, &$result ) X-Ref |
| function to traverse and return all the nested children post names of a root page. $children contains parent-chilren relations |
| get_page_uri($page) X-Ref |
| Builds URI for a page. Sub pages will be in the "directory" under the parent page post name. param: mixed $page Page object or page ID. return: string Page URI. |
| get_pages($args = '') X-Ref |
| Retrieve a list of pages. The defaults that can be overridden are the following: 'child_of', 'sort_order', 'sort_column', 'post_title', 'hierarchical', 'exclude', 'include', 'meta_key', 'meta_value','authors', 'number', and 'offset'. param: mixed $args Optional. Array or string of options that overrides defaults. return: array List of pages matching defaults or $args |
| is_local_attachment($url) X-Ref |
| Check if the attachment URI is local one and is really an attachment. param: string $url URL to check return: bool True on success, false on failure. |
| wp_insert_attachment($object, $file = false, $parent = 0) X-Ref |
| Insert an attachment. If you set the 'ID' in the $object parameter, it will mean that you are updating and attempt to update the attachment. You can also set the attachment name or title by setting the key 'post_name' or 'post_title'. You can set the dates for the attachment manually by setting the 'post_date' and 'post_date_gmt' keys' values. By default, the comments will use the default settings for whether the comments are allowed. You can close them manually or keep them open by setting the value for the 'comment_status' key. The $object parameter can have the following: 'post_status' - Default is 'draft'. Can not be overridden, set the same as parent post. 'post_type' - Default is 'post', will be set to attachment. Can not override. 'post_author' - Default is current user ID. The ID of the user, who added the attachment. 'ping_status' - Default is the value in default ping status option. Whether the attachment can accept pings. 'post_parent' - Default is 0. Can use $parent parameter or set this for the post it belongs to, if any. 'menu_order' - Default is 0. The order it is displayed. 'to_ping' - Whether to ping. 'pinged' - Default is empty string. 'post_password' - Default is empty string. The password to access the attachment. 'guid' - Global Unique ID for referencing the attachment. 'post_content_filtered' - Attachment post content filtered. 'post_excerpt' - Attachment excerpt. param: string|array $object Arguments to override defaults. param: string $file Optional filename. param: int $parent Parent post ID. return: int Attachment ID. |
| wp_delete_attachment( $post_id, $force_delete = false ) X-Ref |
| Trashes or deletes an attachment. When an attachment is permanently deleted, the file will also be removed. Deletion removes all post meta fields, taxonomy, comments, etc. associated with the attachment (except the main post). The attachment is moved to the trash instead of permanently deleted unless trash for media is disabled, item is already in the trash, or $force_delete is true. param: int $post_id Attachment ID. param: bool $force_delete Whether to bypass trash and force deletion. Defaults to false. return: mixed False on failure. Post data on success. |
| wp_get_attachment_metadata( $post_id = 0, $unfiltered = false ) X-Ref |
| Retrieve attachment meta field for attachment ID. param: int $post_id Attachment ID param: bool $unfiltered Optional, default is false. If true, filters are not run. return: string|bool Attachment meta field. False on failure. |
| wp_update_attachment_metadata( $post_id, $data ) X-Ref |
| Update metadata for an attachment. param: int $post_id Attachment ID. param: array $data Attachment data. return: int |
| wp_get_attachment_url( $post_id = 0 ) X-Ref |
| Retrieve the URL for an attachment. param: int $post_id Attachment ID. return: string |
| wp_get_attachment_thumb_file( $post_id = 0 ) X-Ref |
| Retrieve thumbnail for an attachment. param: int $post_id Attachment ID. return: mixed False on failure. Thumbnail file path on success. |
| wp_get_attachment_thumb_url( $post_id = 0 ) X-Ref |
| Retrieve URL for an attachment thumbnail. param: int $post_id Attachment ID return: string|bool False on failure. Thumbnail URL on success. |
| wp_attachment_is_image( $post_id = 0 ) X-Ref |
| Check if the attachment is an image. param: int $post_id Attachment ID return: bool |
| wp_mime_type_icon( $mime = 0 ) X-Ref |
| Retrieve the icon for a MIME type. param: string $mime MIME type return: string|bool |
| wp_check_for_changed_slugs($post_id, $post, $post_before) X-Ref |
| Checked for changed slugs for published post objects and save the old slug. The function is used when a post object of any type is updated, by comparing the current and previous post objects. If the slug was changed and not already part of the old slugs then it will be added to the post meta field ('_wp_old_slug') for storing old slugs for that post. The most logically usage of this function is redirecting changed post objects, so that those that linked to an changed post will be redirected to the new post. param: int $post_id Post ID. param: object $post The Post Object param: object $post_before The Previous Post Object return: int Same as $post_id |
| get_private_posts_cap_sql( $post_type ) X-Ref |
| Retrieve the private post SQL based on capability. This function provides a standardized way to appropriately select on the post_status of a post type. The function will return a piece of SQL code that can be added to a WHERE clause; this SQL is constructed to allow all published posts, and all private posts to which the user has access. param: string $post_type currently only supports 'post' or 'page'. return: string SQL code that can be added to a where clause. |
| get_posts_by_author_sql( $post_type, $full = true, $post_author = null ) X-Ref |
| Retrieve the post SQL based on capability, author, and type. param: string $post_type Post type. param: bool $full Optional. Returns a full WHERE statement instead of just an 'andalso' term. param: int $post_author Optional. Query posts having a single author ID. return: string SQL WHERE code that can be added to a query. |
| get_lastpostdate($timezone = 'server') X-Ref |
| Retrieve the date that 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. param: string $timezone The location to get the time. Can be 'gmt', 'blog', or 'server'. return: string The date of the last post. |
| get_lastpostmodified($timezone = 'server') X-Ref |
| Retrieve last post modified date depending on timezone. The server timezone is the default and is the difference between GMT and server time. The 'blog' value is just when the last post was modified. The 'gmt' is when the last post was modified in GMT time. param: string $timezone The location to get the time. Can be 'gmt', 'blog', or 'server'. return: string The date the post was last modified. |
| _get_last_post_time( $timezone, $field ) X-Ref |
| Retrieve latest post date data based on timezone. param: string $timezone The location to get the time. Can be 'gmt', 'blog', or 'server'. param: string $field Field to check. Can be 'date' or 'modified'. return: string The date. |
| update_post_cache(&$posts) X-Ref |
| Updates posts in cache. param: array $posts Array of post objects |
| clean_post_cache($id) X-Ref |
| Will clean the post in the cache. Cleaning means delete from the cache of the post. Will call to clean the term object cache associated with the post ID. clean_post_cache() will call itself recursively for each child post. This function not run if $_wp_suspend_cache_invalidation is not empty. See wp_suspend_cache_invalidation(). param: int $id The Post ID in the cache to clean |
| update_page_cache(&$pages) X-Ref |
| Alias of update_post_cache(). param: array $pages list of page objects |
| clean_page_cache($id) X-Ref |
| Will clean the page in the cache. Clean (read: delete) page from cache that matches $id. Will also clean cache associated with 'all_page_ids' and 'get_pages'. param: int $id Page ID to clean |
| update_post_caches(&$posts, $post_type = 'post', $update_term_cache = true, $update_meta_cache = true) X-Ref |
| Call major cache updating functions for list of Post objects. param: array $posts Array of Post objects param: string $post_type The post type of the posts in $posts. Default is 'post'. param: bool $update_term_cache Whether to update the term cache. Default is true. param: bool $update_meta_cache Whether to update the meta cache. Default is true. |
| update_postmeta_cache($post_ids) X-Ref |
| Updates metadata cache for list of post IDs. Performs SQL query to retrieve the metadata for the post IDs and updates the metadata cache for the posts. Therefore, the functions, which call this function, do not need to perform SQL queries on their own. param: array $post_ids List of post IDs. return: bool|array Returns false if there is nothing to update or an array of metadata. |
| clean_attachment_cache($id, $clean_terms = false) X-Ref |
| Will clean the attachment in the cache. Cleaning means delete from the cache. Optionaly will clean the term object cache associated with the attachment ID. This function will not run if $_wp_suspend_cache_invalidation is not empty. See wp_suspend_cache_invalidation(). param: int $id The attachment ID in the cache to clean param: bool $clean_terms optional. Whether to clean terms cache |
| _transition_post_status($new_status, $old_status, $post) X-Ref |
| Hook for managing future post transitions to published. param: string $new_status New post status param: string $old_status Previous post status param: object $post Object type containing the post information |
| _future_post_hook( $deprecated = '', $post ) X-Ref |
| Hook used to schedule publication for a post marked for the future. The $post properties used and must exist are 'ID' and 'post_date_gmt'. param: int $deprecated Not used. Can be set to null. Never implemented. param: object $post Object type containing the post information |
| _publish_post_hook($post_id) X-Ref |
| Hook to schedule pings and enclosures when a post is published. param: int $post_id The ID in the database table of the post being published |
| _save_post_hook($post_id, $post) X-Ref |
| Hook used to prevent page/post cache and rewrite rules from staying dirty. Does two things. If the post is a page and has a template then it will update/add that template to the meta. For both pages and posts, it will clean the post cache to make sure that the cache updates to the changes done recently. For pages, the rewrite rules of WordPress are flushed to allow for any changes. The $post parameter, only uses 'post_type' property and 'page_template' property. param: int $post_id The ID in the database table for the $post param: object $post Object type containing the post information |
| _get_post_ancestors(&$_post) X-Ref |
| Retrieve post ancestors and append to post ancestors property. Will only retrieve ancestors once, if property is already set, then nothing will be done. If there is not a parent post, or post ID and post parent ID are the same then nothing will be done. The parameter is passed by reference, so nothing needs to be returned. The property will be updated and can be referenced after the function is complete. The post parent will be an ancestor and the parent of the post parent will be an ancestor. There will only be two ancestors at the most. param: object $_post Post data. return: null When nothing needs to be done. |
| _wp_post_revision_fields( $post = null, $autosave = false ) X-Ref |
| Determines which fields of posts are to be saved in revisions. Does two things. If passed a post *array*, it will return a post array ready to be insterted into the posts table as a post revision. Otherwise, returns an array whose keys are the post fields to be saved for post revisions. param: array $post Optional a post array to be processed for insertion as a post revision. param: bool $autosave optional Is the revision an autosave? return: array Post array ready to be inserted as a post revision or array of fields that can be versioned. |
| wp_save_post_revision( $post_id ) X-Ref |
| Saves an already existing post as a post revision. Typically used immediately prior to post updates. param: int $post_id The ID of the post to save as a revision. return: mixed Null or 0 if error, new revision ID, if success. |
| wp_get_post_autosave( $post_id ) X-Ref |
| Retrieve the autosaved data of the specified post. Returns a post object containing the information that was autosaved for the specified post. param: int $post_id The post ID. return: object|bool The autosaved data or false on failure or when no autosave exists. |
| _wp_get_post_autosave_hack( $query ) X-Ref |
| Internally used to hack WP_Query into submission. param: object $query WP_Query object |
| wp_is_post_revision( $post ) X-Ref |
| Determines if the specified post is a revision. param: int|object $post Post ID or post object. return: bool|int False if not a revision, ID of revision's parent otherwise. |
| wp_is_post_autosave( $post ) X-Ref |
| Determines if the specified post is an autosave. param: int|object $post Post ID or post object. return: bool|int False if not a revision, ID of autosave's parent otherwise |
| _wp_put_post_revision( $post = null, $autosave = false ) X-Ref |
| Inserts post data into the posts table as a post revision. param: int|object|array $post Post ID, post object OR post array. param: bool $autosave Optional. Is the revision an autosave? return: mixed Null or 0 if error, new revision ID if success. |
| wp_get_post_revision(&$post, $output = OBJECT, $filter = 'raw') X-Ref |
| Gets a post revision. param: int|object $post Post ID or post object param: string $output Optional. OBJECT, ARRAY_A, or ARRAY_N. param: string $filter Optional sanitation filter. @see sanitize_post() return: mixed Null if error or post object if success |
| wp_restore_post_revision( $revision_id, $fields = null ) X-Ref |
| Restores a post to the specified revision. Can restore a past revision using all fields of the post revision, or only selected fields. param: int|object $revision_id Revision ID or revision object. param: array $fields Optional. What fields to restore from. Defaults to all. return: mixed Null if error, false if no fields to restore, (int) post ID if success. |
| wp_delete_post_revision( $revision_id ) X-Ref |
| Deletes a revision. Deletes the row from the posts table corresponding to the specified revision. param: int|object $revision_id Revision ID or revision object. return: mixed Null or WP_Error if error, deleted post if success. |
| wp_get_post_revisions( $post_id = 0, $args = null ) X-Ref |
| Returns all revisions of specified post. param: int|object $post_id Post ID or post object return: array empty if no revisions |
| _set_preview($post) X-Ref |
| No description |
| _show_post_preview() X-Ref |
| No description |
| wp_get_post_parent_id( $post_ID ) X-Ref |
| Returns the post's parent's post_ID param: int $post_id return: int|bool false on error |
| wp_check_post_hierarchy_for_loops( $post_parent, $post_ID ) X-Ref |
| Checks the given subset of the post hierarchy for hierarchy loops. Prevents loops from forming and breaks those that it finds. Attached to the wp_insert_post_parent filter. param: int $post_parent ID of the parent for the post we're checking. return: int The new post_parent for the post. |
| get_post_format_strings() X-Ref |
| Returns an array of post format slugs to their translated and pretty display versions return: array The array of translations |
| get_post_format_slugs() X-Ref |
| Retrieves an array of post format slugs. return: array The array of post format slugs. |
| get_post_format_string( $slug ) X-Ref |
| Returns a pretty, translated version of a post format slug param: string $slug A post format slug return: string The translated post format name |
| set_post_thumbnail( $post, $thumbnail_id ) X-Ref |
| Sets a post thumbnail. param: int|object $post Post ID or object where thumbnail should be attached. param: int $thumbnail_id Thumbnail to attach. return: bool True on success, false on failure. |
| get_post_format_link( $format ) X-Ref |
| Returns a link to a post format index. param: $format string Post format return: string Link |
| _post_format_request( $qvs ) X-Ref |
| Filters the request to allow for the format prefix. |
| _post_format_link( $link, $term, $taxonomy ) X-Ref |
| Filters the post format term link to remove the format prefix. |
| _post_format_get_term( $term ) X-Ref |
| Remove the post format prefix from the name property of the term object created by get_term(). |
| _post_format_get_terms( $terms, $taxonomies, $args ) X-Ref |
| Remove the post format prefix from the name property of the term objects created by get_terms(). |
| _post_format_wp_get_object_terms( $terms ) X-Ref |
| Remove the post format prefix from the name property of the term objects created by wp_get_object_terms(). |
| Generated: Wed Jun 1 08:30:02 2011 |
Cross-referenced by PHPXref 0.7 Provided by Yoast and awesome WordPress Hosting |