[ Index ]

PHP Cross Reference of WordPress

title

Body

[close]

/wp-admin/includes/ -> post.php (summary)

WordPress Post Administration API.

File Size: 2527 lines (78 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 40 functions

  _wp_translate_postdata()
  _wp_get_allowed_postdata()
  edit_post()
  bulk_edit_posts()
  get_default_post_to_edit()
  post_exists()
  wp_write_post()
  write_post()
  add_meta()
  delete_meta()
  get_meta_keys()
  get_post_meta_by_id()
  has_meta()
  update_meta()
  _fix_attachment_links()
  get_available_post_statuses()
  wp_edit_posts_query()
  wp_edit_attachments_query_vars()
  wp_edit_attachments_query()
  postbox_classes()
  get_sample_permalink()
  get_sample_permalink_html()
  _wp_post_thumbnail_html()
  wp_check_post_lock()
  wp_set_post_lock()
  _admin_notice_post_locked()
  wp_create_post_autosave()
  post_preview()
  wp_autosave()
  redirect_post()
  taxonomy_meta_box_sanitize_cb_checkboxes()
  taxonomy_meta_box_sanitize_cb_input()
  use_block_editor_for_post()
  use_block_editor_for_post_type()
  get_block_editor_server_block_settings()
  the_block_editor_meta_boxes()
  the_block_editor_meta_box_post_form_hidden_fields()
  _disable_block_editor_for_navigation_post_type()
  _disable_content_editor_for_navigation_post_type()
  _enable_content_editor_for_navigation_post_type()

Functions
Functions that are not part of a class:

_wp_translate_postdata( $update = false, $post_data = null )   X-Ref
Renames `$_POST` data from form names to DB post columns.

Manipulates `$_POST` directly.

since: 2.6.0
param: bool       $update    Whether the post already exists.
param: array|null $post_data Optional. The array of post data to process.
return: array|WP_Error Array of post data on success, WP_Error on failure.

_wp_get_allowed_postdata( $post_data = null )   X-Ref
Returns only allowed post data fields.

since: 5.0.1
param: array|WP_Error|null $post_data The array of post data to process, or an error object.
return: array|WP_Error Array of post data on success, WP_Error on failure.

edit_post( $post_data = null )   X-Ref
Updates an existing post with values provided in `$_POST`.

If post data is passed as an argument, it is treated as an array of data
keyed appropriately for turning into a post object.

If post data is not passed, the `$_POST` global variable is used instead.

since: 1.5.0
param: array|null $post_data Optional. The array of post data to process.
return: int Post ID.

bulk_edit_posts( $post_data = null )   X-Ref
Processes the post data for the bulk editing of posts.

Updates all bulk edited posts/pages, adding (but not removing) tags and
categories. Skips pages when they would be their own parent or child.

since: 2.7.0
param: array|null $post_data Optional. The array of post data to process.
return: array

get_default_post_to_edit( $post_type = 'post', $create_in_db = false )   X-Ref
Returns default post information to use when populating the "Write Post" form.

since: 2.0.0
param: string $post_type    Optional. A post type string. Default 'post'.
param: bool   $create_in_db Optional. Whether to insert the post into database. Default false.
return: WP_Post Post object containing all the default post data as attributes

post_exists( $title, $content = '', $date = '', $type = '', $status = '' )   X-Ref
Determines if a post exists based on title, content, date and type.

since: 2.0.0
since: 5.2.0 Added the `$type` parameter.
since: 5.8.0 Added the `$status` parameter.
param: string $title   Post title.
param: string $content Optional. Post content.
param: string $date    Optional. Post date.
param: string $type    Optional. Post type.
param: string $status  Optional. Post status.
return: int Post ID if post exists, 0 otherwise.

wp_write_post()   X-Ref
Creates a new post from the "Write Post" form using `$_POST` information.

since: 2.1.0
return: int|WP_Error Post ID on success, WP_Error on failure.

write_post()   X-Ref
Calls wp_write_post() and handles the errors.

since: 2.0.0
return: int|void Post ID on success, void on failure.

add_meta( $post_ID )   X-Ref
Adds post meta data defined in the `$_POST` superglobal for a post with given ID.

since: 1.2.0
param: int $post_ID
return: int|bool

delete_meta( $mid )   X-Ref
Deletes post meta data by meta ID.

since: 1.2.0
param: int $mid
return: bool

get_meta_keys()   X-Ref
Returns a list of previously defined keys.

since: 1.2.0
return: string[] Array of meta key names.

get_post_meta_by_id( $mid )   X-Ref
Returns post meta data by meta ID.

since: 2.1.0
param: int $mid
return: object|bool

has_meta( $postid )   X-Ref
Returns meta data for the given post ID.

since: 1.2.0
param: int $postid A post ID.
return: array[] {

update_meta( $meta_id, $meta_key, $meta_value )   X-Ref
Updates post meta data by meta ID.

since: 1.2.0
param: int    $meta_id    Meta ID.
param: string $meta_key   Meta key. Expect slashed.
param: string $meta_value Meta value. Expect slashed.
return: bool

_fix_attachment_links( $post )   X-Ref
Replaces hrefs of attachment anchors with up-to-date permalinks.

since: 2.3.0
param: int|object $post Post ID or post object.
return: void|int|WP_Error Void if nothing fixed. 0 or WP_Error on update failure. The post ID on update success.

get_available_post_statuses( $type = 'post' )   X-Ref
Returns all the possible statuses for a post type.

since: 2.5.0
param: string $type The post_type you want the statuses for. Default 'post'.
return: string[] An array of all the statuses for the supplied post type.

wp_edit_posts_query( $q = false )   X-Ref
Runs the query to fetch the posts for listing on the edit posts page.

since: 2.5.0
param: array|false $q Optional. Array of query variables to use to build the query.
return: array

wp_edit_attachments_query_vars( $q = false )   X-Ref
Returns the query variables for the current attachments request.

since: 4.2.0
param: array|false $q Optional. Array of query variables to use to build the query.
return: array The parsed query vars.

wp_edit_attachments_query( $q = false )   X-Ref
Executes a query for attachments. An array of WP_Query arguments
can be passed in, which will override the arguments set by this function.

since: 2.5.0
param: array|false $q Optional. Array of query variables to use to build the query.
return: array

postbox_classes( $box_id, $screen_id )   X-Ref
Returns the list of classes to be used by a meta box.

since: 2.5.0
param: string $box_id    Meta box ID (used in the 'id' attribute for the meta box).
param: string $screen_id The screen on which the meta box is shown.
return: string Space-separated string of class names.

get_sample_permalink( $id, $title = null, $name = null )   X-Ref
Returns a sample permalink based on the post name.

since: 2.5.0
param: int|WP_Post $id    Post ID or post object.
param: string|null $title Optional. Title to override the post's current title
param: string|null $name  Optional. Name to override the post name. Default null.
return: array {

get_sample_permalink_html( $id, $new_title = null, $new_slug = null )   X-Ref
Returns the HTML of the sample permalink slug editor.

since: 2.5.0
param: int|WP_Post $id        Post ID or post object.
param: string|null $new_title Optional. New title. Default null.
param: string|null $new_slug  Optional. New slug. Default null.
return: string The HTML of the sample permalink slug editor.

_wp_post_thumbnail_html( $thumbnail_id = null, $post = null )   X-Ref
Returns HTML for the post thumbnail meta box.

since: 2.9.0
param: int|null         $thumbnail_id Optional. Thumbnail attachment ID. Default null.
param: int|WP_Post|null $post         Optional. The post ID or object associated
return: string The post thumbnail HTML.

wp_check_post_lock( $post_id )   X-Ref
Determines whether the post is currently being edited by another user.

since: 2.5.0
param: int|WP_Post $post_id ID or object of the post to check for editing.
return: int|false ID of the user with lock. False if the post does not exist, post is not locked,

wp_set_post_lock( $post_id )   X-Ref
Marks the post as currently being edited by the current user.

since: 2.5.0
param: int|WP_Post $post_id ID or object of the post being edited.
return: array|false {

_admin_notice_post_locked()   X-Ref
Outputs the HTML for the notice to say that someone else is editing or has taken over editing of this post.

since: 2.8.5

wp_create_post_autosave( $post_data )   X-Ref
Creates autosave data for the specified post from `$_POST` data.

since: 2.6.0
param: array|int $post_data Associative array containing the post data, or integer post ID.
return: int|WP_Error The autosave revision ID. WP_Error or 0 on error.

post_preview()   X-Ref
Saves a draft or manually autosaves for the purpose of showing a post preview.

since: 2.7.0
return: string URL to redirect to show the preview.

wp_autosave( $post_data )   X-Ref
Saves a post submitted with XHR.

Intended for use with heartbeat and autosave.js

since: 3.9.0
param: array $post_data Associative array of the submitted post data.
return: mixed The value 0 or WP_Error on failure. The saved post ID on success.

redirect_post( $post_id = '' )   X-Ref
Redirects to previous page.

since: 2.7.0
param: int $post_id Optional. Post ID.

taxonomy_meta_box_sanitize_cb_checkboxes( $taxonomy, $terms )   X-Ref
Sanitizes POST values from a checkbox taxonomy metabox.

since: 5.1.0
param: string $taxonomy The taxonomy name.
param: array  $terms    Raw term data from the 'tax_input' field.
return: int[] Array of sanitized term IDs.

taxonomy_meta_box_sanitize_cb_input( $taxonomy, $terms )   X-Ref
Sanitizes POST values from an input taxonomy metabox.

since: 5.1.0
param: string       $taxonomy The taxonomy name.
param: array|string $terms    Raw term data from the 'tax_input' field.
return: array

use_block_editor_for_post( $post )   X-Ref
Returns whether the post can be edited in the block editor.

since: 5.0.0
param: int|WP_Post $post Post ID or WP_Post object.
return: bool Whether the post can be edited in the block editor.

use_block_editor_for_post_type( $post_type )   X-Ref
Returns whether a post type is compatible with the block editor.

The block editor depends on the REST API, and if the post type is not shown in the
REST API, then it won't work with the block editor.

since: 5.0.0
param: string $post_type The post type.
return: bool Whether the post type can be edited with the block editor.

get_block_editor_server_block_settings()   X-Ref
Prepares server-registered blocks for the block editor.

Returns an associative array of registered block data keyed by block name. Data includes properties
of a block relevant for client registration.

since: 5.0.0
return: array An associative array of registered block data.

the_block_editor_meta_boxes()   X-Ref
Renders the meta boxes forms.

since: 5.0.0

the_block_editor_meta_box_post_form_hidden_fields( $post )   X-Ref
Renders the hidden form required for the meta boxes form.

since: 5.0.0
param: WP_Post $post Current post object.

_disable_block_editor_for_navigation_post_type( $value, $post_type )   X-Ref
Disables block editor for wp_navigation type posts so they can be managed via the UI.

since: 5.9.0
param: bool   $value Whether the CPT supports block editor or not.
param: string $post_type Post type.
return: bool Whether the block editor should be disabled or not.

_disable_content_editor_for_navigation_post_type( $post )   X-Ref
This callback disables the content editor for wp_navigation type posts.
Content editor cannot handle wp_navigation type posts correctly.
We cannot disable the "editor" feature in the wp_navigation's CPT definition
because it disables the ability to save navigation blocks via REST API.

since: 5.9.0
param: WP_Post $post An instance of WP_Post class.

_enable_content_editor_for_navigation_post_type( $post )   X-Ref
This callback enables content editor for wp_navigation type posts.
We need to enable it back because we disable it to hide
the content editor for wp_navigation type posts.

since: 5.9.0
param: WP_Post $post An instance of WP_Post class.



Generated: Sat Jul 27 01:00:02 2024 Cross-referenced by PHPXref 0.7.1