[ Index ]

PHP Cross Reference of WordPress Trunk (Updated Daily)

Search

title

Body

[close]

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

WordPress Post Administration API.

File Size: 2651 lines (82 kb)
Included or required: 3 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()
  wp_autosave_post_revisioned_meta_fields()
  post_preview()
  wp_autosave()
  redirect_post()
  taxonomy_meta_box_sanitize_cb_checkboxes()
  taxonomy_meta_box_sanitize_cb_input()
  get_block_editor_server_block_settings()
  the_block_editor_meta_boxes()
  schedule()
  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.

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.

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.

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.

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.

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.

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.

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

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

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.

param: int $post_id
return: int|bool

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

param: int $mid
return: bool

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

return: string[] Array of meta key names.

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

param: int $mid
return: object|bool

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

param: int $post_id A post ID.
return: array[] {

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

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.

param: int|WP_Post $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.

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.

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.

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.

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.

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( $post, $title = null, $name = null )   X-Ref
Returns a sample permalink based on the post name.

param: int|WP_Post $post  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( $post, $new_title = null, $new_slug = null )   X-Ref
Returns the HTML of the sample permalink slug editor.

param: int|WP_Post $post      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.

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 )   X-Ref
Determines whether the post is currently being edited by another user.

param: int|WP_Post $post 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 )   X-Ref
Marks the post as currently being edited by the current user.

param: int|WP_Post $post 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.


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

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.

wp_autosave_post_revisioned_meta_fields( $new_autosave )   X-Ref
Autosaves the revisioned meta fields.

Iterates through the revisioned meta fields and checks each to see if they are set,
and have a changed value. If so, the meta value is saved and attached to the autosave.

param: array $new_autosave The new post data being autosaved.

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.

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

Intended for use with heartbeat and autosave.js

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.

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.

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.

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

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.

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


schedule()   X-Ref
No description

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.

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

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.

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.

param: WP_Post $post An instance of WP_Post class.



Generated : Thu Nov 21 08:20:01 2024 Cross-referenced by PHPXref