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

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

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

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

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.

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

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.

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

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.

return: WP_Post Post object containing all the default post data as attributes
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.
since: 2.0.0

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

return: int Post ID if post exists, 0 otherwise.
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.
since: 2.0.0
since: 5.2.0 Added the `$type` parameter.
since: 5.8.0 Added the `$status` parameter.

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

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

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

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

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

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

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

return: bool
param: int $mid
since: 1.2.0

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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.

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

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

return: string Space-separated string of class names.
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.
since: 2.5.0

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

return: array {
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.
since: 2.5.0

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

return: string The HTML of the sample permalink slug editor.
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.
since: 2.5.0

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

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

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

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

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

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

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

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

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

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

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

Intended for use with heartbeat and autosave.js

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

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

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

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

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

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

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

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

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

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.

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

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.

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

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.

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

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

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

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

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

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

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



Generated: Sun Apr 21 01:00:03 2024 Cross-referenced by PHPXref 0.7.1