code
stringlengths 2.5k
150k
| kind
stringclasses 1
value |
---|---|
wordpress wp_localize_jquery_ui_datepicker() wp\_localize\_jquery\_ui\_datepicker()
======================================
Localizes the jQuery UI datepicker.
File: `wp-includes/script-loader.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/script-loader.php/)
```
function wp_localize_jquery_ui_datepicker() {
global $wp_locale;
if ( ! wp_script_is( 'jquery-ui-datepicker', 'enqueued' ) ) {
return;
}
// Convert the PHP date format into jQuery UI's format.
$datepicker_date_format = str_replace(
array(
'd',
'j',
'l',
'z', // Day.
'F',
'M',
'n',
'm', // Month.
'Y',
'y', // Year.
),
array(
'dd',
'd',
'DD',
'o',
'MM',
'M',
'm',
'mm',
'yy',
'y',
),
get_option( 'date_format' )
);
$datepicker_defaults = wp_json_encode(
array(
'closeText' => __( 'Close' ),
'currentText' => __( 'Today' ),
'monthNames' => array_values( $wp_locale->month ),
'monthNamesShort' => array_values( $wp_locale->month_abbrev ),
'nextText' => __( 'Next' ),
'prevText' => __( 'Previous' ),
'dayNames' => array_values( $wp_locale->weekday ),
'dayNamesShort' => array_values( $wp_locale->weekday_abbrev ),
'dayNamesMin' => array_values( $wp_locale->weekday_initial ),
'dateFormat' => $datepicker_date_format,
'firstDay' => absint( get_option( 'start_of_week' ) ),
'isRTL' => $wp_locale->is_rtl(),
)
);
wp_add_inline_script( 'jquery-ui-datepicker', "jQuery(function(jQuery){jQuery.datepicker.setDefaults({$datepicker_defaults});});" );
}
```
| Uses | Description |
| --- | --- |
| [wp\_add\_inline\_script()](wp_add_inline_script) wp-includes/functions.wp-scripts.php | Adds extra code to a registered script. |
| [wp\_script\_is()](wp_script_is) wp-includes/functions.wp-scripts.php | Determines whether a script has been added to the queue. |
| [WP\_Locale::is\_rtl()](../classes/wp_locale/is_rtl) wp-includes/class-wp-locale.php | Checks if current locale is RTL. |
| [wp\_json\_encode()](wp_json_encode) wp-includes/functions.php | Encodes a variable into JSON, with some sanity checks. |
| [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. |
| [absint()](absint) wp-includes/functions.php | Converts a value to non-negative integer. |
| [get\_option()](get_option) wp-includes/option.php | Retrieves an option value based on an option name. |
| Version | Description |
| --- | --- |
| [4.6.0](https://developer.wordpress.org/reference/since/4.6.0/) | Introduced. |
wordpress wp_insert_site( array $data ): int|WP_Error wp\_insert\_site( array $data ): int|WP\_Error
==============================================
Inserts a new site into the database.
`$data` array Required Data for the new site that should be inserted.
* `domain`stringSite domain. Default empty string.
* `path`stringSite path. Default `'/'`.
* `network_id`intThe site's network ID. Default is the current network ID.
* `registered`stringWhen the site was registered, in SQL datetime format. Default is the current time.
* `last_updated`stringWhen the site was last updated, in SQL datetime format. Default is the value of $registered.
* `public`intWhether the site is public. Default 1.
* `archived`intWhether the site is archived. Default 0.
* `mature`intWhether the site is mature. Default 0.
* `spam`intWhether the site is spam. Default 0.
* `deleted`intWhether the site is deleted. Default 0.
* `lang_id`intThe site's language ID. Currently unused. Default 0.
* `user_id`intUser ID for the site administrator. Passed to the `wp_initialize_site` hook.
* `title`stringSite title. Default is 'Site %d' where %d is the site ID. Passed to the `wp_initialize_site` hook.
* `options`arrayCustom option $key => $value pairs to use. Default empty array. Passed to the `wp_initialize_site` hook.
* `meta`arrayCustom site metadata $key => $value pairs to use. Default empty array.
Passed to the `wp_initialize_site` hook.
int|[WP\_Error](../classes/wp_error) The new site's ID on success, or error object on failure.
File: `wp-includes/ms-site.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/ms-site.php/)
```
function wp_insert_site( array $data ) {
global $wpdb;
$now = current_time( 'mysql', true );
$defaults = array(
'domain' => '',
'path' => '/',
'network_id' => get_current_network_id(),
'registered' => $now,
'last_updated' => $now,
'public' => 1,
'archived' => 0,
'mature' => 0,
'spam' => 0,
'deleted' => 0,
'lang_id' => 0,
);
$prepared_data = wp_prepare_site_data( $data, $defaults );
if ( is_wp_error( $prepared_data ) ) {
return $prepared_data;
}
if ( false === $wpdb->insert( $wpdb->blogs, $prepared_data ) ) {
return new WP_Error( 'db_insert_error', __( 'Could not insert site into the database.' ), $wpdb->last_error );
}
$site_id = (int) $wpdb->insert_id;
clean_blog_cache( $site_id );
$new_site = get_site( $site_id );
if ( ! $new_site ) {
return new WP_Error( 'get_site_error', __( 'Could not retrieve site data.' ) );
}
/**
* Fires once a site has been inserted into the database.
*
* @since 5.1.0
*
* @param WP_Site $new_site New site object.
*/
do_action( 'wp_insert_site', $new_site );
// Extract the passed arguments that may be relevant for site initialization.
$args = array_diff_key( $data, $defaults );
if ( isset( $args['site_id'] ) ) {
unset( $args['site_id'] );
}
/**
* Fires when a site's initialization routine should be executed.
*
* @since 5.1.0
*
* @param WP_Site $new_site New site object.
* @param array $args Arguments for the initialization.
*/
do_action( 'wp_initialize_site', $new_site, $args );
// Only compute extra hook parameters if the deprecated hook is actually in use.
if ( has_action( 'wpmu_new_blog' ) ) {
$user_id = ! empty( $args['user_id'] ) ? $args['user_id'] : 0;
$meta = ! empty( $args['options'] ) ? $args['options'] : array();
// WPLANG was passed with `$meta` to the `wpmu_new_blog` hook prior to 5.1.0.
if ( ! array_key_exists( 'WPLANG', $meta ) ) {
$meta['WPLANG'] = get_network_option( $new_site->network_id, 'WPLANG' );
}
// Rebuild the data expected by the `wpmu_new_blog` hook prior to 5.1.0 using allowed keys.
// The `$allowed_data_fields` matches the one used in `wpmu_create_blog()`.
$allowed_data_fields = array( 'public', 'archived', 'mature', 'spam', 'deleted', 'lang_id' );
$meta = array_merge( array_intersect_key( $data, array_flip( $allowed_data_fields ) ), $meta );
/**
* Fires immediately after a new site is created.
*
* @since MU (3.0.0)
* @deprecated 5.1.0 Use {@see 'wp_initialize_site'} instead.
*
* @param int $site_id Site ID.
* @param int $user_id User ID.
* @param string $domain Site domain.
* @param string $path Site path.
* @param int $network_id Network ID. Only relevant on multi-network installations.
* @param array $meta Meta data. Used to set initial site options.
*/
do_action_deprecated(
'wpmu_new_blog',
array( $new_site->id, $user_id, $new_site->domain, $new_site->path, $new_site->network_id, $meta ),
'5.1.0',
'wp_initialize_site'
);
}
return (int) $new_site->id;
}
```
[do\_action\_deprecated( 'wpmu\_new\_blog', int $site\_id, int $user\_id, string $domain, string $path, int $network\_id, array $meta )](../hooks/wpmu_new_blog)
Fires immediately after a new site is created.
[do\_action( 'wp\_initialize\_site', WP\_Site $new\_site, array $args )](../hooks/wp_initialize_site)
Fires when a site’s initialization routine should be executed.
[do\_action( 'wp\_insert\_site', WP\_Site $new\_site )](../hooks/wp_insert_site)
Fires once a site has been inserted into the database.
| Uses | Description |
| --- | --- |
| [wp\_prepare\_site\_data()](wp_prepare_site_data) wp-includes/ms-site.php | Prepares site data for insertion or update in the database. |
| [get\_current\_network\_id()](get_current_network_id) wp-includes/load.php | Retrieves the current network ID. |
| [get\_site()](get_site) wp-includes/ms-site.php | Retrieves site data given a site ID or site object. |
| [do\_action\_deprecated()](do_action_deprecated) wp-includes/plugin.php | Fires functions attached to a deprecated action hook. |
| [get\_network\_option()](get_network_option) wp-includes/option.php | Retrieves a network’s option value based on the option name. |
| [current\_time()](current_time) wp-includes/functions.php | Retrieves the current time based on specified type. |
| [has\_action()](has_action) wp-includes/plugin.php | Checks if any action has been registered for a hook. |
| [clean\_blog\_cache()](clean_blog_cache) wp-includes/ms-site.php | Clean the blog cache |
| [wpdb::insert()](../classes/wpdb/insert) wp-includes/class-wpdb.php | Inserts a row into the table. |
| [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. |
| [do\_action()](do_action) wp-includes/plugin.php | Calls the callback functions that have been added to an action hook. |
| [is\_wp\_error()](is_wp_error) wp-includes/load.php | Checks whether the given variable is a WordPress Error. |
| [WP\_Error::\_\_construct()](../classes/wp_error/__construct) wp-includes/class-wp-error.php | Initializes the error. |
| Used By | Description |
| --- | --- |
| [insert\_blog()](insert_blog) wp-includes/ms-deprecated.php | Store basic site info in the blogs table. |
| [wpmu\_create\_blog()](wpmu_create_blog) wp-includes/ms-functions.php | Creates a site. |
| Version | Description |
| --- | --- |
| [5.1.0](https://developer.wordpress.org/reference/since/5.1.0/) | Introduced. |
wordpress get_the_time( string $format = '', int|WP_Post $post = null ): string|int|false get\_the\_time( string $format = '', int|WP\_Post $post = null ): string|int|false
==================================================================================
Retrieves the time at which the post was written.
`$format` string Optional Format to use for retrieving the time the post was written. Accepts `'G'`, `'U'`, or PHP date format.
Defaults to the `'time_format'` option. Default: `''`
`$post` int|[WP\_Post](../classes/wp_post) Optional Post ID or post object. Default is global `$post` object. Default: `null`
string|int|false Formatted date string or Unix timestamp if `$format` is `'U'` or `'G'`.
False on failure.
File: `wp-includes/general-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/general-template.php/)
```
function get_the_time( $format = '', $post = null ) {
$post = get_post( $post );
if ( ! $post ) {
return false;
}
$_format = ! empty( $format ) ? $format : get_option( 'time_format' );
$the_time = get_post_time( $_format, false, $post, true );
/**
* Filters the time a post was written.
*
* @since 1.5.0
*
* @param string|int $the_time Formatted date string or Unix timestamp if `$format` is 'U' or 'G'.
* @param string $format Format to use for retrieving the time the post
* was written. Accepts 'G', 'U', or PHP date format.
* @param WP_Post $post Post object.
*/
return apply_filters( 'get_the_time', $the_time, $format, $post );
}
```
[apply\_filters( 'get\_the\_time', string|int $the\_time, string $format, WP\_Post $post )](../hooks/get_the_time)
Filters the time a post was written.
| Uses | Description |
| --- | --- |
| [get\_post\_time()](get_post_time) wp-includes/general-template.php | Retrieves the time at which the post was written. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| [get\_option()](get_option) wp-includes/option.php | Retrieves an option value based on an option name. |
| [get\_post()](get_post) wp-includes/post.php | Retrieves post data given a post ID or post object. |
| Used By | Description |
| --- | --- |
| [WP\_Customize\_Manager::customize\_pane\_settings()](../classes/wp_customize_manager/customize_pane_settings) wp-includes/class-wp-customize-manager.php | Prints JavaScript settings for parent window. |
| [WP\_Posts\_List\_Table::column\_date()](../classes/wp_posts_list_table/column_date) wp-admin/includes/class-wp-posts-list-table.php | Handles the post date column output. |
| [WP\_Media\_List\_Table::column\_date()](../classes/wp_media_list_table/column_date) wp-admin/includes/class-wp-media-list-table.php | Handles the date column output. |
| [wp\_dashboard\_recent\_posts()](wp_dashboard_recent_posts) wp-admin/includes/dashboard.php | Generates Publishing Soon and Recently Published sections. |
| [wp\_dashboard\_recent\_drafts()](wp_dashboard_recent_drafts) wp-admin/includes/dashboard.php | Show recent drafts of the user on the dashboard. |
| [the\_time()](the_time) wp-includes/general-template.php | Displays the time at which the post was written. |
| Version | Description |
| --- | --- |
| [1.5.0](https://developer.wordpress.org/reference/since/1.5.0/) | Introduced. |
wordpress get_post_type_labels( object|WP_Post_Type $post_type_object ): object get\_post\_type\_labels( object|WP\_Post\_Type $post\_type\_object ): object
============================================================================
This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.
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 overridden 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 [gettext context](https://developer.wordpress.org/plugins/internationalization/how-to-internationalize-your-plugin/#disambiguation-by-context) matching your post type. Example: `_x( 'Add New', 'product', 'textdomain' );`.
* `add_new_item` – Label for adding a new singular item. Default is ‘Add New Post’ / ‘Add New Page’.
* `edit_item` – Label for editing a singular item. Default is ‘Edit Post’ / ‘Edit Page’.
* `new_item` – Label for the new item page title. Default is ‘New Post’ / ‘New Page’.
* `view_item` – Label for viewing a singular item. Default is ‘View Post’ / ‘View Page’.
* `view_items` – Label for viewing post type archives. Default is ‘View Posts’ / ‘View Pages’.
* `search_items` – Label for searching plural items. Default is ‘Search Posts’ / ‘Search Pages’.
* `not_found` – Label used when no items are found. Default is ‘No posts found’ / ‘No pages found’.
* `not_found_in_trash` – Label used when no items are in the Trash. Default is ‘No posts found in Trash’ / ‘No pages found in Trash’.
* `parent_item_colon` – Label used to prefix parents of hierarchical items. Not used on non-hierarchical post types. Default is ‘Parent Page:’.
* `all_items` – Label to signify all items in a submenu link. Default is ‘All Posts’ / ‘All Pages’.
* `archives` – Label for archives in nav menus. Default is ‘Post Archives’ / ‘Page Archives’.
* `attributes` – Label for the attributes meta box. Default is ‘Post Attributes’ / ‘Page Attributes’.
* `insert_into_item` – Label for the media frame button. Default is ‘Insert into post’ / ‘Insert into page’.
* `uploaded_to_this_item` – Label for the media frame filter. Default is ‘Uploaded to this post’ / ‘Uploaded to this page’.
* `featured_image` – Label for the featured image meta box title. Default is ‘Featured image’.
* `set_featured_image` – Label for setting the featured image. Default is ‘Set featured image’.
* `remove_featured_image` – Label for removing the featured image. Default is ‘Remove featured image’.
* `use_featured_image` – Label in the media frame for using a featured image. Default is ‘Use as featured image’.
* `menu_name` – Label for the menu name. Default is the same as `name`.
* `filter_items_list` – Label for the table views hidden heading. Default is ‘Filter posts list’ / ‘Filter pages list’.
* `filter_by_date` – Label for the date filter in list tables. Default is ‘Filter by date’.
* `items_list_navigation` – Label for the table pagination hidden heading. Default is ‘Posts list navigation’ / ‘Pages list navigation’.
* `items_list` – Label for the table hidden heading. Default is ‘Posts list’ / ‘Pages list’.
* `item_published` – Label used when an item is published. Default is ‘Post published.’ / ‘Page published.’
* `item_published_privately` – Label used when an item is published with private visibility.
Default is ‘Post published privately.’ / ‘Page published privately.’
* `item_reverted_to_draft` – Label used when an item is switched to a draft.
Default is ‘Post reverted to draft.’ / ‘Page reverted to draft.’
* `item_scheduled` – Label used when an item is scheduled for publishing. Default is ‘Post scheduled.’ / ‘Page scheduled.’
* `item_updated` – Label used when an item is updated. Default is ‘Post updated.’ / ‘Page updated.’
* `item_link` – Title for a navigation link block variation. Default is ‘Post Link’ / ‘Page Link’.
* `item_link_description` – Description for a navigation link block variation. Default is ‘A link to a post.’ / ‘A link to a 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).
Note: To set labels used in post type admin notices, see the [‘post\_updated\_messages’](../hooks/post_updated_messages) filter.
`$post_type_object` object|[WP\_Post\_Type](../classes/wp_post_type) Required Post type object. object Object with all the labels as member variables.
File: `wp-includes/post.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/post.php/)
```
function get_post_type_labels( $post_type_object ) {
$nohier_vs_hier_defaults = WP_Post_Type::get_default_labels();
$nohier_vs_hier_defaults['menu_name'] = $nohier_vs_hier_defaults['name'];
$labels = _get_custom_object_labels( $post_type_object, $nohier_vs_hier_defaults );
$post_type = $post_type_object->name;
$default_labels = clone $labels;
/**
* Filters the labels of a specific post type.
*
* The dynamic portion of the hook name, `$post_type`, refers to
* the post type slug.
*
* Possible hook names include:
*
* - `post_type_labels_post`
* - `post_type_labels_page`
* - `post_type_labels_attachment`
*
* @since 3.5.0
*
* @see get_post_type_labels() for the full list of labels.
*
* @param object $labels Object with labels for the post type as member variables.
*/
$labels = apply_filters( "post_type_labels_{$post_type}", $labels );
// Ensure that the filtered labels contain all required default values.
$labels = (object) array_merge( (array) $default_labels, (array) $labels );
return $labels;
}
```
[apply\_filters( "post\_type\_labels\_{$post\_type}", object $labels )](../hooks/post_type_labels_post_type)
Filters the labels of a specific post type.
| Uses | Description |
| --- | --- |
| [WP\_Post\_Type::get\_default\_labels()](../classes/wp_post_type/get_default_labels) wp-includes/class-wp-post-type.php | Returns the default labels for post types. |
| [\_get\_custom\_object\_labels()](_get_custom_object_labels) wp-includes/post.php | Builds an object with custom-something object (post type, taxonomy) labels out of a custom-something object |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| Used By | Description |
| --- | --- |
| [WP\_Post\_Type::set\_props()](../classes/wp_post_type/set_props) wp-includes/class-wp-post-type.php | Sets post type properties. |
| Version | Description |
| --- | --- |
| [5.8.0](https://developer.wordpress.org/reference/since/5.8.0/) | Added the `item_link` and `item_link_description` labels. |
| [5.7.0](https://developer.wordpress.org/reference/since/5.7.0/) | Added the `filter_by_date` label. |
| [5.0.0](https://developer.wordpress.org/reference/since/5.0.0/) | Added the `item_published`, `item_published_privately`, `item_reverted_to_draft`, `item_scheduled`, and `item_updated` labels. |
| [4.7.0](https://developer.wordpress.org/reference/since/4.7.0/) | Added the `view_items` and `attributes` labels. |
| [4.6.0](https://developer.wordpress.org/reference/since/4.6.0/) | Converted the `$post_type` parameter to accept a `WP_Post_Type` object. |
| [4.4.0](https://developer.wordpress.org/reference/since/4.4.0/) | Added the `archives`, `insert_into_item`, `uploaded_to_this_item`, `filter_items_list`, `items_list_navigation`, and `items_list` labels. |
| [4.3.0](https://developer.wordpress.org/reference/since/4.3.0/) | Added the `featured_image`, `set_featured_image`, `remove_featured_image`, and `use_featured_image` labels. |
| [3.0.0](https://developer.wordpress.org/reference/since/3.0.0/) | Introduced. |
| programming_docs |
wordpress wp_add_id3_tag_data( array $metadata, array $data ) wp\_add\_id3\_tag\_data( array $metadata, array $data )
=======================================================
Parses ID3v2, ID3v1, and getID3 comments to extract usable data.
`$metadata` array Required An existing array with data. `$data` array Required Data supplied by ID3 tags. File: `wp-admin/includes/media.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/media.php/)
```
function wp_add_id3_tag_data( &$metadata, $data ) {
foreach ( array( 'id3v2', 'id3v1' ) as $version ) {
if ( ! empty( $data[ $version ]['comments'] ) ) {
foreach ( $data[ $version ]['comments'] as $key => $list ) {
if ( 'length' !== $key && ! empty( $list ) ) {
$metadata[ $key ] = wp_kses_post( reset( $list ) );
// Fix bug in byte stream analysis.
if ( 'terms_of_use' === $key && 0 === strpos( $metadata[ $key ], 'yright notice.' ) ) {
$metadata[ $key ] = 'Cop' . $metadata[ $key ];
}
}
}
break;
}
}
if ( ! empty( $data['id3v2']['APIC'] ) ) {
$image = reset( $data['id3v2']['APIC'] );
if ( ! empty( $image['data'] ) ) {
$metadata['image'] = array(
'data' => $image['data'],
'mime' => $image['image_mime'],
'width' => $image['image_width'],
'height' => $image['image_height'],
);
}
} elseif ( ! empty( $data['comments']['picture'] ) ) {
$image = reset( $data['comments']['picture'] );
if ( ! empty( $image['data'] ) ) {
$metadata['image'] = array(
'data' => $image['data'],
'mime' => $image['image_mime'],
);
}
}
}
```
| Uses | Description |
| --- | --- |
| [wp\_kses\_post()](wp_kses_post) wp-includes/kses.php | Sanitizes content for allowed HTML tags for post content. |
| Used By | Description |
| --- | --- |
| [wp\_read\_video\_metadata()](wp_read_video_metadata) wp-admin/includes/media.php | Retrieves metadata from a video file’s ID3 tags. |
| [wp\_read\_audio\_metadata()](wp_read_audio_metadata) wp-admin/includes/media.php | Retrieves metadata from an audio file’s ID3 tags. |
| Version | Description |
| --- | --- |
| [3.6.0](https://developer.wordpress.org/reference/since/3.6.0/) | Introduced. |
wordpress get_upload_iframe_src( string $type = null, int $post_id = null, string $tab = null ): string get\_upload\_iframe\_src( string $type = null, int $post\_id = null, string $tab = null ): string
=================================================================================================
Retrieves the upload iframe source URL.
`$type` string Optional Media type. Default: `null`
`$post_id` int Optional Post ID. Default: `null`
`$tab` string Optional Media upload tab. Default: `null`
string Upload iframe source URL.
File: `wp-admin/includes/media.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/media.php/)
```
function get_upload_iframe_src( $type = null, $post_id = null, $tab = null ) {
global $post_ID;
if ( empty( $post_id ) ) {
$post_id = $post_ID;
}
$upload_iframe_src = add_query_arg( 'post_id', (int) $post_id, admin_url( 'media-upload.php' ) );
if ( $type && 'media' !== $type ) {
$upload_iframe_src = add_query_arg( 'type', $type, $upload_iframe_src );
}
if ( ! empty( $tab ) ) {
$upload_iframe_src = add_query_arg( 'tab', $tab, $upload_iframe_src );
}
/**
* Filters the upload iframe source URL for a specific media type.
*
* The dynamic portion of the hook name, `$type`, refers to the type
* of media uploaded.
*
* Possible hook names include:
*
* - `image_upload_iframe_src`
* - `media_upload_iframe_src`
*
* @since 3.0.0
*
* @param string $upload_iframe_src The upload iframe source URL.
*/
$upload_iframe_src = apply_filters( "{$type}_upload_iframe_src", $upload_iframe_src );
return add_query_arg( 'TB_iframe', true, $upload_iframe_src );
}
```
[apply\_filters( "{$type}\_upload\_iframe\_src", string $upload\_iframe\_src )](../hooks/type_upload_iframe_src)
Filters the upload iframe source URL for a specific media type.
| Uses | Description |
| --- | --- |
| [add\_query\_arg()](add_query_arg) wp-includes/functions.php | Retrieves a modified URL query string. |
| [admin\_url()](admin_url) wp-includes/link-template.php | Retrieves the URL to the admin area for the current site. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| Used By | Description |
| --- | --- |
| [\_wp\_post\_thumbnail\_html()](_wp_post_thumbnail_html) wp-admin/includes/post.php | Returns HTML for the post thumbnail meta box. |
| Version | Description |
| --- | --- |
| [3.0.0](https://developer.wordpress.org/reference/since/3.0.0/) | Introduced. |
wordpress install_blog_defaults( int $blog_id, int $user_id ) install\_blog\_defaults( int $blog\_id, int $user\_id )
=======================================================
This function has been deprecated. MU instead.
Set blog defaults.
This function creates a row in the wp\_blogs table.
`$blog_id` int Required Ignored in this function. `$user_id` int Required File: `wp-includes/ms-deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/ms-deprecated.php/)
```
function install_blog_defaults( $blog_id, $user_id ) {
global $wpdb;
_deprecated_function( __FUNCTION__, 'MU' );
require_once ABSPATH . 'wp-admin/includes/upgrade.php';
$suppress = $wpdb->suppress_errors();
wp_install_defaults( $user_id );
$wpdb->suppress_errors( $suppress );
}
```
| Uses | Description |
| --- | --- |
| [wp\_install\_defaults()](wp_install_defaults) wp-admin/includes/upgrade.php | Creates the initial content for a newly-installed site. |
| [wpdb::suppress\_errors()](../classes/wpdb/suppress_errors) wp-includes/class-wpdb.php | Enables or disables suppressing of database errors. |
| [\_deprecated\_function()](_deprecated_function) wp-includes/functions.php | Marks a function as deprecated and inform when it has been used. |
| Version | Description |
| --- | --- |
| [MU (3.0.0)](https://developer.wordpress.org/reference/since/mu.3.0.0/) | MU (3.0.0) |
| [MU](https://developer.wordpress.org/reference/since/mu/) | Introduced. |
wordpress wp_ajax_dashboard_widgets() wp\_ajax\_dashboard\_widgets()
==============================
Ajax handler for dashboard widgets.
File: `wp-admin/includes/ajax-actions.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/ajax-actions.php/)
```
function wp_ajax_dashboard_widgets() {
require_once ABSPATH . 'wp-admin/includes/dashboard.php';
$pagenow = $_GET['pagenow'];
if ( 'dashboard-user' === $pagenow || 'dashboard-network' === $pagenow || 'dashboard' === $pagenow ) {
set_current_screen( $pagenow );
}
switch ( $_GET['widget'] ) {
case 'dashboard_primary':
wp_dashboard_primary();
break;
}
wp_die();
}
```
| Uses | Description |
| --- | --- |
| [set\_current\_screen()](set_current_screen) wp-admin/includes/screen.php | Set the current screen object |
| [wp\_dashboard\_primary()](wp_dashboard_primary) wp-admin/includes/dashboard.php | ‘WordPress Events and News’ dashboard widget. |
| [wp\_die()](wp_die) wp-includes/functions.php | Kills WordPress execution and displays HTML page with an error message. |
| Version | Description |
| --- | --- |
| [3.4.0](https://developer.wordpress.org/reference/since/3.4.0/) | Introduced. |
wordpress wp_get_active_and_valid_themes(): string[] wp\_get\_active\_and\_valid\_themes(): string[]
===============================================
This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.
Retrieves an array of active and valid themes.
While upgrading or installing WordPress, no themes are returned.
string[] Array of absolute paths to theme directories.
File: `wp-includes/load.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/load.php/)
```
function wp_get_active_and_valid_themes() {
global $pagenow;
$themes = array();
if ( wp_installing() && 'wp-activate.php' !== $pagenow ) {
return $themes;
}
if ( TEMPLATEPATH !== STYLESHEETPATH ) {
$themes[] = STYLESHEETPATH;
}
$themes[] = TEMPLATEPATH;
/*
* Remove themes from the list of active themes when we're on an endpoint
* that should be protected against WSODs and the theme is paused.
*/
if ( wp_is_recovery_mode() ) {
$themes = wp_skip_paused_themes( $themes );
// If no active and valid themes exist, skip loading themes.
if ( empty( $themes ) ) {
add_filter( 'wp_using_themes', '__return_false' );
}
}
return $themes;
}
```
| Uses | Description |
| --- | --- |
| [wp\_is\_recovery\_mode()](wp_is_recovery_mode) wp-includes/load.php | Is WordPress in Recovery Mode. |
| [wp\_skip\_paused\_themes()](wp_skip_paused_themes) wp-includes/load.php | Filters a given list of themes, removing any paused themes from it. |
| [wp\_installing()](wp_installing) wp-includes/load.php | Check or set whether WordPress is in “installation” mode. |
| [add\_filter()](add_filter) wp-includes/plugin.php | Adds a callback function to a filter hook. |
| Version | Description |
| --- | --- |
| [5.1.0](https://developer.wordpress.org/reference/since/5.1.0/) | Introduced. |
wordpress locate_template( string|array $template_names, bool $load = false, bool $require_once = true, array $args = array() ): string locate\_template( string|array $template\_names, bool $load = false, bool $require\_once = true, array $args = array() ): string
================================================================================================================================
Retrieves the name of the highest priority template file that exists.
Searches in the STYLESHEETPATH before TEMPLATEPATH and wp-includes/theme-compat so that themes which inherit from a parent theme can just overload one file.
`$template_names` string|array Required Template file(s) to search for, in order. `$load` bool Optional If true the template file will be loaded if it is found. Default: `false`
`$require_once` bool Optional Whether to require\_once or require. Has no effect if `$load` is false.
Default: `true`
`$args` array Optional Additional arguments passed to the template.
Default: `array()`
string The template filename if one is located.
File: `wp-includes/template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/template.php/)
```
function locate_template( $template_names, $load = false, $require_once = true, $args = array() ) {
$located = '';
foreach ( (array) $template_names as $template_name ) {
if ( ! $template_name ) {
continue;
}
if ( file_exists( STYLESHEETPATH . '/' . $template_name ) ) {
$located = STYLESHEETPATH . '/' . $template_name;
break;
} elseif ( file_exists( TEMPLATEPATH . '/' . $template_name ) ) {
$located = TEMPLATEPATH . '/' . $template_name;
break;
} elseif ( file_exists( ABSPATH . WPINC . '/theme-compat/' . $template_name ) ) {
$located = ABSPATH . WPINC . '/theme-compat/' . $template_name;
break;
}
}
if ( $load && '' !== $located ) {
load_template( $located, $require_once, $args );
}
return $located;
}
```
| Uses | Description |
| --- | --- |
| [load\_template()](load_template) wp-includes/template.php | Requires the template file with WordPress environment. |
| Used By | Description |
| --- | --- |
| [get\_header()](get_header) wp-includes/general-template.php | Loads header template. |
| [get\_footer()](get_footer) wp-includes/general-template.php | Loads footer template. |
| [get\_sidebar()](get_sidebar) wp-includes/general-template.php | Loads sidebar template. |
| [get\_template\_part()](get_template_part) wp-includes/general-template.php | Loads a template part into a template. |
| [get\_search\_form()](get_search_form) wp-includes/general-template.php | Displays search form. |
| [get\_query\_template()](get_query_template) wp-includes/template.php | Retrieves path to a template. |
| Version | Description |
| --- | --- |
| [5.5.0](https://developer.wordpress.org/reference/since/5.5.0/) | The `$args` parameter was added. |
| [2.7.0](https://developer.wordpress.org/reference/since/2.7.0/) | Introduced. |
wordpress wp_robots_max_image_preview_large( array $robots ): array wp\_robots\_max\_image\_preview\_large( array $robots ): array
==============================================================
Adds `max-image-preview:large` to the robots meta tag.
This directive tells web robots that large image previews are allowed to be displayed, e.g. in search engines, unless the blog is marked as not being public.
Typical usage is as a [‘wp\_robots’](../hooks/wp_robots) callback:
```
add_filter( 'wp_robots', 'wp_robots_max_image_preview_large' );
```
`$robots` array Required Associative array of robots directives. array Filtered robots directives.
File: `wp-includes/robots-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/robots-template.php/)
```
function wp_robots_max_image_preview_large( array $robots ) {
if ( get_option( 'blog_public' ) ) {
$robots['max-image-preview'] = 'large';
}
return $robots;
}
```
| Uses | Description |
| --- | --- |
| [get\_option()](get_option) wp-includes/option.php | Retrieves an option value based on an option name. |
| Version | Description |
| --- | --- |
| [5.7.0](https://developer.wordpress.org/reference/since/5.7.0/) | Introduced. |
wordpress get_current_site_name( WP_Network $current_site ): WP_Network get\_current\_site\_name( WP\_Network $current\_site ): WP\_Network
===================================================================
This function has been deprecated. Use [get\_current\_site()](get_current_site) instead.
This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.
This deprecated function formerly set the site\_name property of the $current\_site object.
This function simply returns the object, as before.
The bootstrap takes care of setting site\_name.
`$current_site` [WP\_Network](../classes/wp_network) Required [WP\_Network](../classes/wp_network)
File: `wp-includes/ms-load.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/ms-load.php/)
```
function get_current_site_name( $current_site ) {
_deprecated_function( __FUNCTION__, '3.9.0', 'get_current_site()' );
return $current_site;
}
```
| Uses | Description |
| --- | --- |
| [\_deprecated\_function()](_deprecated_function) wp-includes/functions.php | Marks a function as deprecated and inform when it has been used. |
| Version | Description |
| --- | --- |
| [3.9.0](https://developer.wordpress.org/reference/since/3.9.0/) | Use [get\_current\_site()](get_current_site) instead. |
| [3.0.0](https://developer.wordpress.org/reference/since/3.0.0/) | Introduced. |
wordpress get_stylesheet_uri(): string get\_stylesheet\_uri(): string
==============================
Retrieves stylesheet URI for the active theme.
The stylesheet file name is ‘style.css’ which is appended to the stylesheet directory URI path.
See [get\_stylesheet\_directory\_uri()](get_stylesheet_directory_uri) .
string URI to active theme's stylesheet.
Returns URL of current theme stylesheet.
File: `wp-includes/theme.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/theme.php/)
```
function get_stylesheet_uri() {
$stylesheet_dir_uri = get_stylesheet_directory_uri();
$stylesheet_uri = $stylesheet_dir_uri . '/style.css';
/**
* Filters the URI of the active theme stylesheet.
*
* @since 1.5.0
*
* @param string $stylesheet_uri Stylesheet URI for the active theme/child theme.
* @param string $stylesheet_dir_uri Stylesheet directory URI for the active theme/child theme.
*/
return apply_filters( 'stylesheet_uri', $stylesheet_uri, $stylesheet_dir_uri );
}
```
[apply\_filters( 'stylesheet\_uri', string $stylesheet\_uri, string $stylesheet\_dir\_uri )](../hooks/stylesheet_uri)
Filters the URI of the active theme stylesheet.
| Uses | Description |
| --- | --- |
| [get\_stylesheet\_directory\_uri()](get_stylesheet_directory_uri) wp-includes/theme.php | Retrieves stylesheet directory URI for the active theme. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| Used By | Description |
| --- | --- |
| [get\_bloginfo()](get_bloginfo) wp-includes/general-template.php | Retrieves information about the current site. |
| Version | Description |
| --- | --- |
| [1.5.0](https://developer.wordpress.org/reference/since/1.5.0/) | Introduced. |
wordpress register_theme_feature( string $feature, array $args = array() ): true|WP_Error register\_theme\_feature( string $feature, array $args = array() ): true|WP\_Error
==================================================================================
Registers a theme feature for use in [add\_theme\_support()](add_theme_support) .
This does not indicate that the active theme supports the feature, it only describes the feature’s supported options.
* [add\_theme\_support()](add_theme_support)
`$feature` string Required The name uniquely identifying the feature. See [add\_theme\_support()](add_theme_support) for the list of possible values. More Arguments from add\_theme\_support( ... $feature ) The feature being added. Likely core values include:
* `'admin-bar'`
* `'align-wide'`
* `'automatic-feed-links'`
* `'core-block-patterns'`
* `'custom-background'`
* `'custom-header'`
* `'custom-line-height'`
* `'custom-logo'`
* `'customize-selective-refresh-widgets'`
* `'custom-spacing'`
* `'custom-units'`
* `'dark-editor-style'`
* `'disable-custom-colors'`
* `'disable-custom-font-sizes'`
* `'editor-color-palette'`
* `'editor-gradient-presets'`
* `'editor-font-sizes'`
* `'editor-styles'`
* `'featured-content'`
* `'html5'`
* `'menus'`
* `'post-formats'`
* `'post-thumbnails'`
* `'responsive-embeds'`
* `'starter-content'`
* `'title-tag'`
* `'wp-block-styles'`
* `'widgets'`
* `'widgets-block-editor'`
`$args` array Optional Data used to describe the theme.
* `type`stringThe type of data associated with this feature.
Valid values are `'string'`, `'boolean'`, `'integer'`, `'number'`, `'array'`, and `'object'`. Defaults to `'boolean'`.
* `variadic`boolDoes this feature utilize the variadic support of [add\_theme\_support()](add_theme_support) , or are all arguments specified as the second parameter. Must be used with the "array" type.
* `description`stringA short description of the feature. Included in the Themes REST API schema. Intended for developers.
* `show_in_rest`bool|array Whether this feature should be included in the Themes REST API endpoint.
Defaults to not being included. When registering an 'array' or 'object' type, this argument must be an array with the 'schema' key.
+ `schema`arraySpecifies the JSON Schema definition describing the feature. If any objects in the schema do not include the `'additionalProperties'` keyword, it is set to false.
+ `name`stringAn alternate name to be used as the property name in the REST API.
+ `prepare_callback`callableA function used to format the theme support in the REST API.
Receives the raw theme support value. More Arguments from add\_theme\_support( ... $args ) extra arguments to pass along with certain features. Default: `array()`
true|[WP\_Error](../classes/wp_error) True if the theme feature was successfully registered, a [WP\_Error](../classes/wp_error) object if not.
File: `wp-includes/theme.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/theme.php/)
```
function register_theme_feature( $feature, $args = array() ) {
global $_wp_registered_theme_features;
if ( ! is_array( $_wp_registered_theme_features ) ) {
$_wp_registered_theme_features = array();
}
$defaults = array(
'type' => 'boolean',
'variadic' => false,
'description' => '',
'show_in_rest' => false,
);
$args = wp_parse_args( $args, $defaults );
if ( true === $args['show_in_rest'] ) {
$args['show_in_rest'] = array();
}
if ( is_array( $args['show_in_rest'] ) ) {
$args['show_in_rest'] = wp_parse_args(
$args['show_in_rest'],
array(
'schema' => array(),
'name' => $feature,
'prepare_callback' => null,
)
);
}
if ( ! in_array( $args['type'], array( 'string', 'boolean', 'integer', 'number', 'array', 'object' ), true ) ) {
return new WP_Error(
'invalid_type',
__( 'The feature "type" is not valid JSON Schema type.' )
);
}
if ( true === $args['variadic'] && 'array' !== $args['type'] ) {
return new WP_Error(
'variadic_must_be_array',
__( 'When registering a "variadic" theme feature, the "type" must be an "array".' )
);
}
if ( false !== $args['show_in_rest'] && in_array( $args['type'], array( 'array', 'object' ), true ) ) {
if ( ! is_array( $args['show_in_rest'] ) || empty( $args['show_in_rest']['schema'] ) ) {
return new WP_Error(
'missing_schema',
__( 'When registering an "array" or "object" feature to show in the REST API, the feature\'s schema must also be defined.' )
);
}
if ( 'array' === $args['type'] && ! isset( $args['show_in_rest']['schema']['items'] ) ) {
return new WP_Error(
'missing_schema_items',
__( 'When registering an "array" feature, the feature\'s schema must include the "items" keyword.' )
);
}
if ( 'object' === $args['type'] && ! isset( $args['show_in_rest']['schema']['properties'] ) ) {
return new WP_Error(
'missing_schema_properties',
__( 'When registering an "object" feature, the feature\'s schema must include the "properties" keyword.' )
);
}
}
if ( is_array( $args['show_in_rest'] ) ) {
if ( isset( $args['show_in_rest']['prepare_callback'] )
&& ! is_callable( $args['show_in_rest']['prepare_callback'] )
) {
return new WP_Error(
'invalid_rest_prepare_callback',
sprintf(
/* translators: %s: prepare_callback */
__( 'The "%s" must be a callable function.' ),
'prepare_callback'
)
);
}
$args['show_in_rest']['schema'] = wp_parse_args(
$args['show_in_rest']['schema'],
array(
'description' => $args['description'],
'type' => $args['type'],
'default' => false,
)
);
if ( is_bool( $args['show_in_rest']['schema']['default'] )
&& ! in_array( 'boolean', (array) $args['show_in_rest']['schema']['type'], true )
) {
// Automatically include the "boolean" type when the default value is a boolean.
$args['show_in_rest']['schema']['type'] = (array) $args['show_in_rest']['schema']['type'];
array_unshift( $args['show_in_rest']['schema']['type'], 'boolean' );
}
$args['show_in_rest']['schema'] = rest_default_additional_properties_to_false( $args['show_in_rest']['schema'] );
}
$_wp_registered_theme_features[ $feature ] = $args;
return true;
}
```
| Uses | Description |
| --- | --- |
| [rest\_default\_additional\_properties\_to\_false()](rest_default_additional_properties_to_false) wp-includes/rest-api.php | Sets the “additionalProperties” to false by default for all object definitions in the schema. |
| [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. |
| [wp\_parse\_args()](wp_parse_args) wp-includes/functions.php | Merges user defined arguments into defaults array. |
| [WP\_Error::\_\_construct()](../classes/wp_error/__construct) wp-includes/class-wp-error.php | Initializes the error. |
| Used By | Description |
| --- | --- |
| [create\_initial\_theme\_features()](create_initial_theme_features) wp-includes/theme.php | Creates the initial theme features when the ‘setup\_theme’ action is fired. |
| Version | Description |
| --- | --- |
| [5.5.0](https://developer.wordpress.org/reference/since/5.5.0/) | Introduced. |
| programming_docs |
wordpress get_queried_object(): WP_Term|WP_Post_Type|WP_Post|WP_User|null get\_queried\_object(): WP\_Term|WP\_Post\_Type|WP\_Post|WP\_User|null
======================================================================
Retrieves the currently queried object.
Wrapper for [WP\_Query::get\_queried\_object()](../classes/wp_query/get_queried_object).
[WP\_Term](../classes/wp_term)|[WP\_Post\_Type](../classes/wp_post_type)|[WP\_Post](../classes/wp_post)|[WP\_User](../classes/wp_user)|null The queried object.
File: `wp-includes/query.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/query.php/)
```
function get_queried_object() {
global $wp_query;
return $wp_query->get_queried_object();
}
```
| Uses | Description |
| --- | --- |
| [WP\_Query::get\_queried\_object()](../classes/wp_query/get_queried_object) wp-includes/class-wp-query.php | Retrieves the currently queried object. |
| Used By | Description |
| --- | --- |
| [rest\_get\_queried\_resource\_route()](rest_get_queried_resource_route) wp-includes/rest-api.php | Gets the REST route for the currently queried object. |
| [WP\_Widget\_Custom\_HTML::widget()](../classes/wp_widget_custom_html/widget) wp-includes/widgets/class-wp-widget-custom-html.php | Outputs the content for the current Custom HTML widget instance. |
| [get\_embed\_template()](get_embed_template) wp-includes/template.php | Retrieves an embed template path in the current or parent template. |
| [wp\_get\_document\_title()](wp_get_document_title) wp-includes/general-template.php | Returns document title for the current page. |
| [get\_the\_archive\_title()](get_the_archive_title) wp-includes/general-template.php | Retrieves the archive title based on the queried object. |
| [term\_description()](term_description) wp-includes/category-template.php | Retrieves term description. |
| [wp\_list\_categories()](wp_list_categories) wp-includes/category-template.php | Displays or retrieves the HTML list of categories. |
| [feed\_links\_extra()](feed_links_extra) wp-includes/general-template.php | Displays the links to the extra feeds such as category feeds. |
| [single\_post\_title()](single_post_title) wp-includes/general-template.php | Displays or retrieves page title for post. |
| [wp\_title()](wp_title) wp-includes/general-template.php | Displays or retrieves page title for all areas of blog. |
| [single\_term\_title()](single_term_title) wp-includes/general-template.php | Displays or retrieves page title for taxonomy term archive. |
| [WP::handle\_404()](../classes/wp/handle_404) wp-includes/class-wp.php | Set the Headers for 404, if nothing is found for requested URL. |
| [WP\_Widget\_Text::widget()](../classes/wp_widget_text/widget) wp-includes/widgets/class-wp-widget-text.php | Outputs the content for the current Text widget instance. |
| [edit\_term\_link()](edit_term_link) wp-includes/link-template.php | Displays or retrieves the edit term link with formatting. |
| [get\_single\_template()](get_single_template) wp-includes/template.php | Retrieves path of single template in current or parent template. Applies to single Posts, single Attachments, and single custom post types. |
| [get\_attachment\_template()](get_attachment_template) wp-includes/template.php | Retrieves path of attachment template in current or parent template. |
| [get\_author\_template()](get_author_template) wp-includes/template.php | Retrieves path of author template in current or parent template. |
| [get\_category\_template()](get_category_template) wp-includes/template.php | Retrieves path of category template in current or parent template. |
| [get\_tag\_template()](get_tag_template) wp-includes/template.php | Retrieves path of tag template in current or parent template. |
| [get\_taxonomy\_template()](get_taxonomy_template) wp-includes/template.php | Retrieves path of custom taxonomy term template in current or parent template. |
| [get\_page\_template()](get_page_template) wp-includes/template.php | Retrieves path of page template in current or parent template. |
| [wp\_list\_pages()](wp_list_pages) wp-includes/post-template.php | Retrieves or displays a list of pages (or hierarchical post type items) in list (li) format. |
| Version | Description |
| --- | --- |
| [3.1.0](https://developer.wordpress.org/reference/since/3.1.0/) | Introduced. |
wordpress wp_exif_date2ts( string $str ): int|false wp\_exif\_date2ts( string $str ): int|false
===========================================
Converts the exif date format to a unix timestamp.
`$str` string Required A date string expected to be in Exif format (Y:m:d H:i:s). int|false The unix timestamp, or false on failure.
File: `wp-admin/includes/image.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/image.php/)
```
function wp_exif_date2ts( $str ) {
list( $date, $time ) = explode( ' ', trim( $str ) );
list( $y, $m, $d ) = explode( ':', $date );
return strtotime( "{$y}-{$m}-{$d} {$time}" );
}
```
| Used By | Description |
| --- | --- |
| [wp\_read\_image\_metadata()](wp_read_image_metadata) wp-admin/includes/image.php | Gets extended image metadata, exif or iptc as available. |
| Version | Description |
| --- | --- |
| [2.5.0](https://developer.wordpress.org/reference/since/2.5.0/) | Introduced. |
wordpress get_tax_sql( array $tax_query, string $primary_table, string $primary_id_column ): string[] get\_tax\_sql( array $tax\_query, string $primary\_table, string $primary\_id\_column ): string[]
=================================================================================================
Given a taxonomy query, generates SQL to be appended to a main query.
* [WP\_Tax\_Query](../classes/wp_tax_query)
`$tax_query` array Required A compact tax query `$primary_table` string Required `$primary_id_column` string Required string[]
File: `wp-includes/taxonomy.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/taxonomy.php/)
```
function get_tax_sql( $tax_query, $primary_table, $primary_id_column ) {
$tax_query_obj = new WP_Tax_Query( $tax_query );
return $tax_query_obj->get_sql( $primary_table, $primary_id_column );
}
```
| Uses | Description |
| --- | --- |
| [WP\_Tax\_Query::\_\_construct()](../classes/wp_tax_query/__construct) wp-includes/class-wp-tax-query.php | Constructor. |
| Version | Description |
| --- | --- |
| [3.1.0](https://developer.wordpress.org/reference/since/3.1.0/) | Introduced. |
wordpress wp_get_custom_css_post( string $stylesheet = '' ): WP_Post|null wp\_get\_custom\_css\_post( string $stylesheet = '' ): WP\_Post|null
====================================================================
Fetches the `custom_css` post for a given theme.
`$stylesheet` string Optional A theme object stylesheet name. Defaults to the active theme. Default: `''`
[WP\_Post](../classes/wp_post)|null The custom\_css post or null if none exists.
File: `wp-includes/theme.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/theme.php/)
```
function wp_get_custom_css_post( $stylesheet = '' ) {
if ( empty( $stylesheet ) ) {
$stylesheet = get_stylesheet();
}
$custom_css_query_vars = array(
'post_type' => 'custom_css',
'post_status' => get_post_stati(),
'name' => sanitize_title( $stylesheet ),
'posts_per_page' => 1,
'no_found_rows' => true,
'cache_results' => true,
'update_post_meta_cache' => false,
'update_post_term_cache' => false,
'lazy_load_term_meta' => false,
);
$post = null;
if ( get_stylesheet() === $stylesheet ) {
$post_id = get_theme_mod( 'custom_css_post_id' );
if ( $post_id > 0 && get_post( $post_id ) ) {
$post = get_post( $post_id );
}
// `-1` indicates no post exists; no query necessary.
if ( ! $post && -1 !== $post_id ) {
$query = new WP_Query( $custom_css_query_vars );
$post = $query->post;
/*
* Cache the lookup. See wp_update_custom_css_post().
* @todo This should get cleared if a custom_css post is added/removed.
*/
set_theme_mod( 'custom_css_post_id', $post ? $post->ID : -1 );
}
} else {
$query = new WP_Query( $custom_css_query_vars );
$post = $query->post;
}
return $post;
}
```
| Uses | Description |
| --- | --- |
| [set\_theme\_mod()](set_theme_mod) wp-includes/theme.php | Updates theme modification value for the active theme. |
| [get\_theme\_mod()](get_theme_mod) wp-includes/theme.php | Retrieves theme modification value for the active theme. |
| [get\_stylesheet()](get_stylesheet) wp-includes/theme.php | Retrieves name of the current stylesheet. |
| [sanitize\_title()](sanitize_title) wp-includes/formatting.php | Sanitizes a string into a slug, which can be used in URLs or HTML attributes. |
| [WP\_Query::\_\_construct()](../classes/wp_query/__construct) wp-includes/class-wp-query.php | Constructor. |
| [get\_post\_stati()](get_post_stati) wp-includes/post.php | Gets a list of post statuses. |
| [get\_post()](get_post) wp-includes/post.php | Retrieves post data given a post ID or post object. |
| Used By | Description |
| --- | --- |
| [wp\_update\_custom\_css\_post()](wp_update_custom_css_post) wp-includes/theme.php | Updates the `custom_css` post for a given theme. |
| [wp\_get\_custom\_css()](wp_get_custom_css) wp-includes/theme.php | Fetches the saved Custom CSS content for rendering. |
| [WP\_Customize\_Custom\_CSS\_Setting::value()](../classes/wp_customize_custom_css_setting/value) wp-includes/customize/class-wp-customize-custom-css-setting.php | Fetch the value of the setting. Will return the previewed value when `preview()` is called. |
| Version | Description |
| --- | --- |
| [4.7.0](https://developer.wordpress.org/reference/since/4.7.0/) | Introduced. |
wordpress is_subdomain_install(): bool is\_subdomain\_install(): bool
==============================
Whether a subdomain configuration is enabled.
bool True if subdomain configuration is enabled, false otherwise.
File: `wp-includes/ms-load.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/ms-load.php/)
```
function is_subdomain_install() {
if ( defined( 'SUBDOMAIN_INSTALL' ) ) {
return SUBDOMAIN_INSTALL;
}
return ( defined( 'VHOST' ) && 'yes' === VHOST );
}
```
| Used By | Description |
| --- | --- |
| [wp\_initialize\_site()](wp_initialize_site) wp-includes/ms-site.php | Runs the initialization routine for a given site. |
| [wp\_normalize\_site\_data()](wp_normalize_site_data) wp-includes/ms-site.php | Normalizes data for a site prior to inserting or updating in the database. |
| [get\_oembed\_response\_data\_for\_url()](get_oembed_response_data_for_url) wp-includes/embed.php | Retrieves the oEmbed response data for a given URL. |
| [show\_blog\_form()](show_blog_form) wp-signup.php | Generates and displays the Sign-up and Create Site forms. |
| [network\_step2()](network_step2) wp-admin/includes/network.php | Prints step 2 for Network installation process. |
| [avoid\_blog\_page\_permalink\_collision()](avoid_blog_page_permalink_collision) wp-admin/includes/ms.php | Avoids a collision between a site slug and a permalink slug. |
| [WP\_MS\_Sites\_List\_Table::prepare\_items()](../classes/wp_ms_sites_list_table/prepare_items) wp-admin/includes/class-wp-ms-sites-list-table.php | Prepares the list of sites for display. |
| [install\_blog()](install_blog) wp-includes/ms-deprecated.php | Install an empty blog. |
| [wpmu\_validate\_blog\_signup()](wpmu_validate_blog_signup) wp-includes/ms-functions.php | Processes new site registrations. |
| [wpmu\_signup\_blog\_notification()](wpmu_signup_blog_notification) wp-includes/ms-functions.php | Sends a confirmation request email to a user when they sign up for a new site. The new site will not become active until the confirmation link is clicked. |
| [get\_blogaddress\_by\_domain()](get_blogaddress_by_domain) wp-includes/ms-deprecated.php | Get a full blog URL, given a domain and a path. |
| [get\_blogaddress\_by\_name()](get_blogaddress_by_name) wp-includes/ms-blogs.php | Get a full blog URL, given a blog name. |
| [get\_id\_from\_blogname()](get_id_from_blogname) wp-includes/ms-blogs.php | Retrieves a site’s ID given its (subdomain or directory) slug. |
| [get\_blog\_details()](get_blog_details) wp-includes/ms-blogs.php | Retrieve the details for a blog from the blogs table and blog options. |
| [ms\_cookie\_constants()](ms_cookie_constants) wp-includes/ms-default-constants.php | Defines Multisite cookie constants. |
| Version | Description |
| --- | --- |
| [3.0.0](https://developer.wordpress.org/reference/since/3.0.0/) | Introduced. |
wordpress wp_check_comment_data_max_lengths( array $comment_data ): WP_Error|true wp\_check\_comment\_data\_max\_lengths( array $comment\_data ): WP\_Error|true
==============================================================================
Compares the lengths of comment data against the maximum character limits.
`$comment_data` array Required Array of arguments for inserting a comment. [WP\_Error](../classes/wp_error)|true [WP\_Error](../classes/wp_error) when a comment field exceeds the limit, otherwise true.
File: `wp-includes/comment.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/comment.php/)
```
function wp_check_comment_data_max_lengths( $comment_data ) {
$max_lengths = wp_get_comment_fields_max_lengths();
if ( isset( $comment_data['comment_author'] ) && mb_strlen( $comment_data['comment_author'], '8bit' ) > $max_lengths['comment_author'] ) {
return new WP_Error( 'comment_author_column_length', __( '<strong>Error:</strong> Your name is too long.' ), 200 );
}
if ( isset( $comment_data['comment_author_email'] ) && strlen( $comment_data['comment_author_email'] ) > $max_lengths['comment_author_email'] ) {
return new WP_Error( 'comment_author_email_column_length', __( '<strong>Error:</strong> Your email address is too long.' ), 200 );
}
if ( isset( $comment_data['comment_author_url'] ) && strlen( $comment_data['comment_author_url'] ) > $max_lengths['comment_author_url'] ) {
return new WP_Error( 'comment_author_url_column_length', __( '<strong>Error:</strong> Your URL is too long.' ), 200 );
}
if ( isset( $comment_data['comment_content'] ) && mb_strlen( $comment_data['comment_content'], '8bit' ) > $max_lengths['comment_content'] ) {
return new WP_Error( 'comment_content_column_length', __( '<strong>Error:</strong> Your comment is too long.' ), 200 );
}
return true;
}
```
| Uses | Description |
| --- | --- |
| [wp\_get\_comment\_fields\_max\_lengths()](wp_get_comment_fields_max_lengths) wp-includes/comment.php | Retrieves the maximum character lengths for the comment form fields. |
| [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. |
| [WP\_Error::\_\_construct()](../classes/wp_error/__construct) wp-includes/class-wp-error.php | Initializes the error. |
| Used By | Description |
| --- | --- |
| [WP\_REST\_Comments\_Controller::update\_item()](../classes/wp_rest_comments_controller/update_item) wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php | Updates a comment. |
| [WP\_REST\_Comments\_Controller::create\_item()](../classes/wp_rest_comments_controller/create_item) wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php | Creates a comment. |
| [wp\_handle\_comment\_submission()](wp_handle_comment_submission) wp-includes/comment.php | Handles the submission of a comment, usually posted to wp-comments-post.php via a comment form. |
| Version | Description |
| --- | --- |
| [4.7.0](https://developer.wordpress.org/reference/since/4.7.0/) | Introduced. |
wordpress show_message( string|WP_Error $message ) show\_message( string|WP\_Error $message )
==========================================
Displays the given administration message.
`$message` string|[WP\_Error](../classes/wp_error) Required File: `wp-admin/includes/misc.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/misc.php/)
```
function show_message( $message ) {
if ( is_wp_error( $message ) ) {
if ( $message->get_error_data() && is_string( $message->get_error_data() ) ) {
$message = $message->get_error_message() . ': ' . $message->get_error_data();
} else {
$message = $message->get_error_message();
}
}
echo "<p>$message</p>\n";
wp_ob_end_flush_all();
flush();
}
```
| Uses | Description |
| --- | --- |
| [wp\_ob\_end\_flush\_all()](wp_ob_end_flush_all) wp-includes/functions.php | Flushes all output buffers for PHP 5.2. |
| [is\_wp\_error()](is_wp_error) wp-includes/load.php | Checks whether the given variable is a WordPress Error. |
| Used By | Description |
| --- | --- |
| [WP\_Upgrader\_Skin::feedback()](../classes/wp_upgrader_skin/feedback) wp-admin/includes/class-wp-upgrader-skin.php | |
| [\_redirect\_to\_about\_wordpress()](_redirect_to_about_wordpress) wp-admin/includes/update-core.php | Redirect to the About WordPress page after a successful upgrade. |
| [do\_core\_upgrade()](do_core_upgrade) wp-admin/update-core.php | Upgrade WordPress core display. |
| Version | Description |
| --- | --- |
| [2.1.0](https://developer.wordpress.org/reference/since/2.1.0/) | Introduced. |
wordpress wp_clean_plugins_cache( bool $clear_update_cache = true ) wp\_clean\_plugins\_cache( bool $clear\_update\_cache = true )
==============================================================
Clears the plugins cache used by [get\_plugins()](get_plugins) and by default, the plugin updates cache.
`$clear_update_cache` bool Optional Whether to clear the plugin updates cache. Default: `true`
File: `wp-admin/includes/plugin.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/plugin.php/)
```
function wp_clean_plugins_cache( $clear_update_cache = true ) {
if ( $clear_update_cache ) {
delete_site_transient( 'update_plugins' );
}
wp_cache_delete( 'plugins', 'plugins' );
}
```
| Uses | Description |
| --- | --- |
| [wp\_cache\_delete()](wp_cache_delete) wp-includes/cache.php | Removes the cache contents matching key and group. |
| [delete\_site\_transient()](delete_site_transient) wp-includes/option.php | Deletes a site transient. |
| Used By | Description |
| --- | --- |
| [wp\_clean\_update\_cache()](wp_clean_update_cache) wp-includes/update.php | Clears existing update caches for plugins, themes, and core. |
| [WP\_Automatic\_Updater::run()](../classes/wp_automatic_updater/run) wp-admin/includes/class-wp-automatic-updater.php | Kicks off the background update process, looping through all pending updates. |
| [Plugin\_Upgrader::bulk\_upgrade()](../classes/plugin_upgrader/bulk_upgrade) wp-admin/includes/class-plugin-upgrader.php | Bulk upgrade several plugins at once. |
| [Plugin\_Upgrader::install()](../classes/plugin_upgrader/install) wp-admin/includes/class-plugin-upgrader.php | Install a plugin package. |
| [Plugin\_Upgrader::upgrade()](../classes/plugin_upgrader/upgrade) wp-admin/includes/class-plugin-upgrader.php | Upgrade a plugin. |
| Version | Description |
| --- | --- |
| [3.7.0](https://developer.wordpress.org/reference/since/3.7.0/) | Introduced. |
wordpress attachment_id3_data_meta_box( WP_Post $post ) attachment\_id3\_data\_meta\_box( WP\_Post $post )
==================================================
Displays fields for ID3 data.
`$post` [WP\_Post](../classes/wp_post) Required Current post object. File: `wp-admin/includes/meta-boxes.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/meta-boxes.php/)
```
function attachment_id3_data_meta_box( $post ) {
$meta = array();
if ( ! empty( $post->ID ) ) {
$meta = wp_get_attachment_metadata( $post->ID );
}
foreach ( wp_get_attachment_id3_keys( $post, 'edit' ) as $key => $label ) :
$value = '';
if ( ! empty( $meta[ $key ] ) ) {
$value = $meta[ $key ];
}
?>
<p>
<label for="title"><?php echo $label; ?></label><br />
<input type="text" name="id3_<?php echo esc_attr( $key ); ?>" id="id3_<?php echo esc_attr( $key ); ?>" class="large-text" value="<?php echo esc_attr( $value ); ?>" />
</p>
<?php
endforeach;
}
```
| Uses | Description |
| --- | --- |
| [wp\_get\_attachment\_metadata()](wp_get_attachment_metadata) wp-includes/post.php | Retrieves attachment metadata for attachment ID. |
| [wp\_get\_attachment\_id3\_keys()](wp_get_attachment_id3_keys) wp-includes/media.php | Returns useful keys to use to lookup data from an attachment’s stored metadata. |
| [esc\_attr()](esc_attr) wp-includes/formatting.php | Escaping for HTML attributes. |
| Version | Description |
| --- | --- |
| [3.9.0](https://developer.wordpress.org/reference/since/3.9.0/) | Introduced. |
| programming_docs |
wordpress _wp_post_thumbnail_html( int|null $thumbnail_id = null, int|WP_Post|null $post = null ): string \_wp\_post\_thumbnail\_html( int|null $thumbnail\_id = null, int|WP\_Post|null $post = null ): string
=====================================================================================================
Returns HTML for the post thumbnail meta box.
`$thumbnail_id` int|null Optional Thumbnail attachment ID. Default: `null`
`$post` int|[WP\_Post](../classes/wp_post)|null Optional The post ID or object associated with the thumbnail. Defaults to global $post. Default: `null`
string The post thumbnail HTML.
File: `wp-admin/includes/post.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/post.php/)
```
function _wp_post_thumbnail_html( $thumbnail_id = null, $post = null ) {
$_wp_additional_image_sizes = wp_get_additional_image_sizes();
$post = get_post( $post );
$post_type_object = get_post_type_object( $post->post_type );
$set_thumbnail_link = '<p class="hide-if-no-js"><a href="%s" id="set-post-thumbnail"%s class="thickbox">%s</a></p>';
$upload_iframe_src = get_upload_iframe_src( 'image', $post->ID );
$content = sprintf(
$set_thumbnail_link,
esc_url( $upload_iframe_src ),
'', // Empty when there's no featured image set, `aria-describedby` attribute otherwise.
esc_html( $post_type_object->labels->set_featured_image )
);
if ( $thumbnail_id && get_post( $thumbnail_id ) ) {
$size = isset( $_wp_additional_image_sizes['post-thumbnail'] ) ? 'post-thumbnail' : array( 266, 266 );
/**
* Filters the size used to display the post thumbnail image in the 'Featured image' meta box.
*
* Note: When a theme adds 'post-thumbnail' support, a special 'post-thumbnail'
* image size is registered, which differs from the 'thumbnail' image size
* managed via the Settings > Media screen.
*
* @since 4.4.0
*
* @param string|int[] $size Requested image size. Can be any registered image size name, or
* an array of width and height values in pixels (in that order).
* @param int $thumbnail_id Post thumbnail attachment ID.
* @param WP_Post $post The post object associated with the thumbnail.
*/
$size = apply_filters( 'admin_post_thumbnail_size', $size, $thumbnail_id, $post );
$thumbnail_html = wp_get_attachment_image( $thumbnail_id, $size );
if ( ! empty( $thumbnail_html ) ) {
$content = sprintf(
$set_thumbnail_link,
esc_url( $upload_iframe_src ),
' aria-describedby="set-post-thumbnail-desc"',
$thumbnail_html
);
$content .= '<p class="hide-if-no-js howto" id="set-post-thumbnail-desc">' . __( 'Click the image to edit or update' ) . '</p>';
$content .= '<p class="hide-if-no-js"><a href="#" id="remove-post-thumbnail">' . esc_html( $post_type_object->labels->remove_featured_image ) . '</a></p>';
}
}
$content .= '<input type="hidden" id="_thumbnail_id" name="_thumbnail_id" value="' . esc_attr( $thumbnail_id ? $thumbnail_id : '-1' ) . '" />';
/**
* Filters the admin post thumbnail HTML markup to return.
*
* @since 2.9.0
* @since 3.5.0 Added the `$post_id` parameter.
* @since 4.6.0 Added the `$thumbnail_id` parameter.
*
* @param string $content Admin post thumbnail HTML markup.
* @param int $post_id Post ID.
* @param int|null $thumbnail_id Thumbnail attachment ID, or null if there isn't one.
*/
return apply_filters( 'admin_post_thumbnail_html', $content, $post->ID, $thumbnail_id );
}
```
[apply\_filters( 'admin\_post\_thumbnail\_html', string $content, int $post\_id, int|null $thumbnail\_id )](../hooks/admin_post_thumbnail_html)
Filters the admin post thumbnail HTML markup to return.
[apply\_filters( 'admin\_post\_thumbnail\_size', string|int[] $size, int $thumbnail\_id, WP\_Post $post )](../hooks/admin_post_thumbnail_size)
Filters the size used to display the post thumbnail image in the ‘Featured image’ meta box.
| Uses | Description |
| --- | --- |
| [wp\_get\_additional\_image\_sizes()](wp_get_additional_image_sizes) wp-includes/media.php | Retrieves additional image sizes. |
| [get\_upload\_iframe\_src()](get_upload_iframe_src) wp-admin/includes/media.php | Retrieves the upload iframe source URL. |
| [wp\_get\_attachment\_image()](wp_get_attachment_image) wp-includes/media.php | Gets an HTML img element representing an image attachment. |
| [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. |
| [esc\_url()](esc_url) wp-includes/formatting.php | Checks and cleans a URL. |
| [esc\_html()](esc_html) wp-includes/formatting.php | Escaping for HTML blocks. |
| [esc\_attr()](esc_attr) wp-includes/formatting.php | Escaping for HTML attributes. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| [get\_post()](get_post) wp-includes/post.php | Retrieves post data given a post ID or post object. |
| [get\_post\_type\_object()](get_post_type_object) wp-includes/post.php | Retrieves a post type object by name. |
| Used By | Description |
| --- | --- |
| [wp\_ajax\_get\_post\_thumbnail\_html()](wp_ajax_get_post_thumbnail_html) wp-admin/includes/ajax-actions.php | Ajax handler for retrieving HTML for the featured image. |
| [wp\_ajax\_set\_post\_thumbnail()](wp_ajax_set_post_thumbnail) wp-admin/includes/ajax-actions.php | Ajax handler for setting the featured image. |
| [post\_thumbnail\_meta\_box()](post_thumbnail_meta_box) wp-admin/includes/meta-boxes.php | Displays post thumbnail meta box. |
| Version | Description |
| --- | --- |
| [2.9.0](https://developer.wordpress.org/reference/since/2.9.0/) | Introduced. |
wordpress sanitize_key( string $key ): string sanitize\_key( string $key ): string
====================================
Sanitizes a string key.
Keys are used as internal identifiers. Lowercase alphanumeric characters, dashes, and underscores are allowed.
`$key` string Required String key. string Sanitized key.
File: `wp-includes/formatting.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/formatting.php/)
```
function sanitize_key( $key ) {
$sanitized_key = '';
if ( is_scalar( $key ) ) {
$sanitized_key = strtolower( $key );
$sanitized_key = preg_replace( '/[^a-z0-9_\-]/', '', $sanitized_key );
}
/**
* Filters a sanitized key string.
*
* @since 3.0.0
*
* @param string $sanitized_key Sanitized key.
* @param string $key The key prior to sanitization.
*/
return apply_filters( 'sanitize_key', $sanitized_key, $key );
}
```
[apply\_filters( 'sanitize\_key', string $sanitized\_key, string $key )](../hooks/sanitize_key)
Filters a sanitized key string.
| Uses | Description |
| --- | --- |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| Used By | Description |
| --- | --- |
| [WP\_Style\_Engine\_CSS\_Declarations::sanitize\_property()](../classes/wp_style_engine_css_declarations/sanitize_property) wp-includes/style-engine/class-wp-style-engine-css-declarations.php | Sanitizes property names. |
| [wp\_create\_user\_request()](wp_create_user_request) wp-includes/user.php | Creates and logs a user request to perform a specific action. |
| [\_wp\_personal\_data\_handle\_actions()](_wp_personal_data_handle_actions) wp-admin/includes/privacy-tools.php | Handle list table actions. |
| [wp\_start\_scraping\_edited\_file\_errors()](wp_start_scraping_edited_file_errors) wp-includes/load.php | Start scraping edited file errors. |
| [WP\_Customize\_Manager::handle\_load\_themes\_request()](../classes/wp_customize_manager/handle_load_themes_request) wp-includes/class-wp-customize-manager.php | Loads themes into the theme browsing/installation UI. |
| [WP\_Theme::get\_post\_templates()](../classes/wp_theme/get_post_templates) wp-includes/class-wp-theme.php | Returns the theme’s post templates. |
| [wp\_ajax\_search\_install\_plugins()](wp_ajax_search_install_plugins) wp-admin/includes/ajax-actions.php | Ajax handler for searching plugins to install. |
| [wp\_ajax\_delete\_plugin()](wp_ajax_delete_plugin) wp-admin/includes/ajax-actions.php | Ajax handler for deleting a plugin. |
| [wp\_ajax\_search\_plugins()](wp_ajax_search_plugins) wp-admin/includes/ajax-actions.php | Ajax handler for searching plugins. |
| [wp\_ajax\_install\_theme()](wp_ajax_install_theme) wp-admin/includes/ajax-actions.php | Ajax handler for installing a theme. |
| [wp\_ajax\_install\_plugin()](wp_ajax_install_plugin) wp-admin/includes/ajax-actions.php | Ajax handler for installing a plugin. |
| [WP\_Customize\_Nav\_Menu\_Item\_Setting::sanitize()](../classes/wp_customize_nav_menu_item_setting/sanitize) wp-includes/customize/class-wp-customize-nav-menu-item-setting.php | Sanitize an input. |
| [WP\_Customize\_Nav\_Menus::ajax\_load\_available\_items()](../classes/wp_customize_nav_menus/ajax_load_available_items) wp-includes/class-wp-customize-nav-menus.php | Ajax handler for loading available menu items. |
| [wp\_ajax\_update\_plugin()](wp_ajax_update_plugin) wp-admin/includes/ajax-actions.php | Ajax handler for updating a plugin. |
| [WP\_Query::parse\_orderby()](../classes/wp_query/parse_orderby) wp-includes/class-wp-query.php | Converts the given orderby alias (if allowed) to a properly-prefixed value. |
| [WP\_Screen::get()](../classes/wp_screen/get) wp-admin/includes/class-wp-screen.php | Fetches a screen object. |
| [export\_wp()](export_wp) wp-admin/includes/export.php | Generates the WXR export file for download. |
| [WP\_List\_Table::\_\_construct()](../classes/wp_list_table/__construct) wp-admin/includes/class-wp-list-table.php | Constructor. |
| [update\_user\_status()](update_user_status) wp-includes/ms-deprecated.php | Update the status of a user in the database. |
| [set\_screen\_options()](set_screen_options) wp-admin/includes/misc.php | Saves option for number of rows when listing posts, pages, comments, etc. |
| [post\_preview()](post_preview) wp-admin/includes/post.php | Saves a draft or manually autosaves for the purpose of showing a post preview. |
| [\_wp\_translate\_postdata()](_wp_translate_postdata) wp-admin/includes/post.php | Renames `$_POST` data from form names to DB post columns. |
| [edit\_post()](edit_post) wp-admin/includes/post.php | Updates an existing post with values provided in `$_POST`. |
| [bulk\_edit\_posts()](bulk_edit_posts) wp-admin/includes/post.php | Processes the post data for the bulk editing of posts. |
| [wp\_ajax\_heartbeat()](wp_ajax_heartbeat) wp-admin/includes/ajax-actions.php | Ajax handler for the Heartbeat API. |
| [wp\_ajax\_save\_user\_color\_scheme()](wp_ajax_save_user_color_scheme) wp-admin/includes/ajax-actions.php | Ajax handler for auto-saving the selected color scheme for a user’s own profile. |
| [wp\_ajax\_dismiss\_wp\_pointer()](wp_ajax_dismiss_wp_pointer) wp-admin/includes/ajax-actions.php | Ajax handler for dismissing a WordPress pointer. |
| [wp\_ajax\_closed\_postboxes()](wp_ajax_closed_postboxes) wp-admin/includes/ajax-actions.php | Ajax handler for closed post boxes. |
| [wp\_ajax\_hidden\_columns()](wp_ajax_hidden_columns) wp-admin/includes/ajax-actions.php | Ajax handler for hidden columns. |
| [wp\_ajax\_meta\_box\_order()](wp_ajax_meta_box_order) wp-admin/includes/ajax-actions.php | Ajax handler for saving the meta box order. |
| [wp\_ajax\_inline\_save\_tax()](wp_ajax_inline_save_tax) wp-admin/includes/ajax-actions.php | Ajax handler for quick edit saving for a term. |
| [wp\_ajax\_get\_tagcloud()](wp_ajax_get_tagcloud) wp-admin/includes/ajax-actions.php | Ajax handler for getting a tagcloud. |
| [wp\_ajax\_nopriv\_heartbeat()](wp_ajax_nopriv_heartbeat) wp-admin/includes/ajax-actions.php | Ajax handler for the Heartbeat API in the no-privilege context. |
| [wp\_ajax\_ajax\_tag\_search()](wp_ajax_ajax_tag_search) wp-admin/includes/ajax-actions.php | Ajax handler for tag search. |
| [WP\_Comments\_List\_Table::prepare\_items()](../classes/wp_comments_list_table/prepare_items) wp-admin/includes/class-wp-comments-list-table.php | |
| [WP\_Customize\_Manager::\_\_construct()](../classes/wp_customize_manager/__construct) wp-includes/class-wp-customize-manager.php | Constructor. |
| [\_wp\_customize\_include()](_wp_customize_include) wp-includes/theme.php | Includes and instantiates the [WP\_Customize\_Manager](../classes/wp_customize_manager) class. |
| [WP\_Query::parse\_query()](../classes/wp_query/parse_query) wp-includes/class-wp-query.php | Parse a query string and set query type booleans. |
| [WP\_Tax\_Query::transform\_query()](../classes/wp_tax_query/transform_query) wp-includes/class-wp-tax-query.php | Transforms a single query, from one field to another. |
| [WP\_User\_Query::prepare\_query()](../classes/wp_user_query/prepare_query) wp-includes/class-wp-user-query.php | Prepares the query variables. |
| [\_get\_last\_post\_time()](_get_last_post_time) wp-includes/post.php | Gets the timestamp of the last time any post was modified or published. |
| [register\_post\_status()](register_post_status) wp-includes/post.php | Registers a post status. Do not use before init. |
| [register\_post\_type()](register_post_type) wp-includes/post.php | Registers a post type. |
| [\_wp\_preview\_terms\_filter()](_wp_preview_terms_filter) wp-includes/revision.php | Filters terms lookup to set the post format. |
| [has\_post\_format()](has_post_format) wp-includes/post-formats.php | Check if a post has any of the given formats, or any format. |
| [set\_post\_format()](set_post_format) wp-includes/post-formats.php | Assign a format to a post |
| [wp\_update\_nav\_menu\_item()](wp_update_nav_menu_item) wp-includes/nav-menu.php | Saves the properties of a menu item or create a new one. |
| [wp\_xmlrpc\_server::mw\_editPost()](../classes/wp_xmlrpc_server/mw_editpost) wp-includes/class-wp-xmlrpc-server.php | Edit a post. |
| [wp\_xmlrpc\_server::mw\_newPost()](../classes/wp_xmlrpc_server/mw_newpost) wp-includes/class-wp-xmlrpc-server.php | Create a new post. |
| [WP\_Meta\_Query::get\_sql()](../classes/wp_meta_query/get_sql) wp-includes/class-wp-meta-query.php | Generates SQL clauses to be appended to a main query. |
| [delete\_metadata()](delete_metadata) wp-includes/meta.php | Deletes metadata for the specified object. |
| [update\_metadata\_by\_mid()](update_metadata_by_mid) wp-includes/meta.php | Updates metadata by meta ID. |
| [delete\_metadata\_by\_mid()](delete_metadata_by_mid) wp-includes/meta.php | Deletes metadata by meta ID. |
| [update\_meta\_cache()](update_meta_cache) wp-includes/meta.php | Updates the metadata cache for the specified objects. |
| [add\_metadata()](add_metadata) wp-includes/meta.php | Adds metadata for the specified object. |
| [update\_metadata()](update_metadata) wp-includes/meta.php | Updates metadata for the specified object. If no value already exists for the specified object ID and metadata key, the metadata will be added. |
| Version | Description |
| --- | --- |
| [3.0.0](https://developer.wordpress.org/reference/since/3.0.0/) | Introduced. |
wordpress wp_load_core_site_options( int $network_id = null ) wp\_load\_core\_site\_options( int $network\_id = null )
========================================================
Loads and caches certain often requested site options if [is\_multisite()](is_multisite) and a persistent cache is not being used.
`$network_id` int Optional site ID for which to query the options. Defaults to the current site. Default: `null`
File: `wp-includes/option.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/option.php/)
```
function wp_load_core_site_options( $network_id = null ) {
global $wpdb;
if ( ! is_multisite() || wp_using_ext_object_cache() || wp_installing() ) {
return;
}
if ( empty( $network_id ) ) {
$network_id = get_current_network_id();
}
$core_options = array( 'site_name', 'siteurl', 'active_sitewide_plugins', '_site_transient_timeout_theme_roots', '_site_transient_theme_roots', 'site_admins', 'can_compress_scripts', 'global_terms_enabled', 'ms_files_rewriting' );
$core_options_in = "'" . implode( "', '", $core_options ) . "'";
$options = $wpdb->get_results( $wpdb->prepare( "SELECT meta_key, meta_value FROM $wpdb->sitemeta WHERE meta_key IN ($core_options_in) AND site_id = %d", $network_id ) );
$data = array();
foreach ( $options as $option ) {
$key = $option->meta_key;
$cache_key = "{$network_id}:$key";
$option->meta_value = maybe_unserialize( $option->meta_value );
$data[ $cache_key ] = $option->meta_value;
}
wp_cache_set_multiple( $data, 'site-options' );
}
```
| Uses | Description |
| --- | --- |
| [wp\_cache\_set\_multiple()](wp_cache_set_multiple) wp-includes/cache.php | Sets multiple values to the cache in one call. |
| [get\_current\_network\_id()](get_current_network_id) wp-includes/load.php | Retrieves the current network ID. |
| [wp\_installing()](wp_installing) wp-includes/load.php | Check or set whether WordPress is in “installation” mode. |
| [wp\_using\_ext\_object\_cache()](wp_using_ext_object_cache) wp-includes/load.php | Toggle `$_wp_using_ext_object_cache` on and off without directly touching global. |
| [maybe\_unserialize()](maybe_unserialize) wp-includes/functions.php | Unserializes data only if it was serialized. |
| [is\_multisite()](is_multisite) wp-includes/load.php | If Multisite is enabled. |
| [wpdb::get\_results()](../classes/wpdb/get_results) wp-includes/class-wpdb.php | Retrieves an entire SQL result set from the database (i.e., many rows). |
| [wpdb::prepare()](../classes/wpdb/prepare) wp-includes/class-wpdb.php | Prepares a SQL query for safe execution. |
| Version | Description |
| --- | --- |
| [3.0.0](https://developer.wordpress.org/reference/since/3.0.0/) | Introduced. |
wordpress wp_dashboard_trigger_widget_control( int|false $widget_control_id = false ) wp\_dashboard\_trigger\_widget\_control( int|false $widget\_control\_id = false )
=================================================================================
Calls widget control callback.
`$widget_control_id` int|false Optional Registered widget ID. Default: `false`
File: `wp-admin/includes/dashboard.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/dashboard.php/)
```
function wp_dashboard_trigger_widget_control( $widget_control_id = false ) {
global $wp_dashboard_control_callbacks;
if ( is_scalar( $widget_control_id ) && $widget_control_id
&& isset( $wp_dashboard_control_callbacks[ $widget_control_id ] )
&& is_callable( $wp_dashboard_control_callbacks[ $widget_control_id ] )
) {
call_user_func(
$wp_dashboard_control_callbacks[ $widget_control_id ],
'',
array(
'id' => $widget_control_id,
'callback' => $wp_dashboard_control_callbacks[ $widget_control_id ],
)
);
}
}
```
| Used By | Description |
| --- | --- |
| [\_wp\_dashboard\_control\_callback()](_wp_dashboard_control_callback) wp-admin/includes/dashboard.php | Outputs controls for the current dashboard widget. |
| [wp\_dashboard\_setup()](wp_dashboard_setup) wp-admin/includes/dashboard.php | Registers dashboard widgets. |
| Version | Description |
| --- | --- |
| [2.5.0](https://developer.wordpress.org/reference/since/2.5.0/) | Introduced. |
wordpress get_id_from_blogname( string $slug ): int|null get\_id\_from\_blogname( string $slug ): int|null
=================================================
Retrieves a site’s ID given its (subdomain or directory) slug.
`$slug` string Required A site's slug. int|null The site ID, or null if no site is found for the given slug.
File: `wp-includes/ms-blogs.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/ms-blogs.php/)
```
function get_id_from_blogname( $slug ) {
$current_network = get_network();
$slug = trim( $slug, '/' );
if ( is_subdomain_install() ) {
$domain = $slug . '.' . preg_replace( '|^www\.|', '', $current_network->domain );
$path = $current_network->path;
} else {
$domain = $current_network->domain;
$path = $current_network->path . $slug . '/';
}
$site_ids = get_sites(
array(
'number' => 1,
'fields' => 'ids',
'domain' => $domain,
'path' => $path,
'update_site_meta_cache' => false,
)
);
if ( empty( $site_ids ) ) {
return null;
}
return array_shift( $site_ids );
}
```
| Uses | Description |
| --- | --- |
| [get\_network()](get_network) wp-includes/ms-network.php | Retrieves network data given a network ID or network object. |
| [get\_sites()](get_sites) wp-includes/ms-site.php | Retrieves a list of sites matching requested arguments. |
| [is\_subdomain\_install()](is_subdomain_install) wp-includes/ms-load.php | Whether a subdomain configuration is enabled. |
| Used By | Description |
| --- | --- |
| [avoid\_blog\_page\_permalink\_collision()](avoid_blog_page_permalink_collision) wp-admin/includes/ms.php | Avoids a collision between a site slug and a permalink slug. |
| [get\_blog\_details()](get_blog_details) wp-includes/ms-blogs.php | Retrieve the details for a blog from the blogs table and blog options. |
| Version | Description |
| --- | --- |
| [MU (3.0.0)](https://developer.wordpress.org/reference/since/mu.3.0.0/) | MU (3.0.0) |
| [4.7.0](https://developer.wordpress.org/reference/since/4.7.0/) | Introduced. |
| programming_docs |
wordpress get_single_template(): string get\_single\_template(): string
===============================
Retrieves path of single template in current or parent template. Applies to single Posts, single Attachments, and single custom post types.
The hierarchy for this template looks like:
1. {Post Type Template}.php
2. single-{post\_type}-{post\_name}.php
3. single-{post\_type}.php
4. single.php
An example of this is:
1. templates/full-width.php
2. single-post-hello-world.php
3. single-post.php
4. single.php
The template hierarchy and template path are filterable via the [‘$type\_template\_hierarchy’](../hooks/type_template_hierarchy) and [‘$type\_template’](../hooks/type_template) dynamic hooks, where `$type` is ‘single’.
* [get\_query\_template()](get_query_template)
string Full path to single template file.
File: `wp-includes/template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/template.php/)
```
function get_single_template() {
$object = get_queried_object();
$templates = array();
if ( ! empty( $object->post_type ) ) {
$template = get_page_template_slug( $object );
if ( $template && 0 === validate_file( $template ) ) {
$templates[] = $template;
}
$name_decoded = urldecode( $object->post_name );
if ( $name_decoded !== $object->post_name ) {
$templates[] = "single-{$object->post_type}-{$name_decoded}.php";
}
$templates[] = "single-{$object->post_type}-{$object->post_name}.php";
$templates[] = "single-{$object->post_type}.php";
}
$templates[] = 'single.php';
return get_query_template( 'single', $templates );
}
```
| Uses | Description |
| --- | --- |
| [get\_queried\_object()](get_queried_object) wp-includes/query.php | Retrieves the currently queried object. |
| [validate\_file()](validate_file) wp-includes/functions.php | Validates a file name and path against an allowed set of rules. |
| [get\_query\_template()](get_query_template) wp-includes/template.php | Retrieves path to a template. |
| [get\_page\_template\_slug()](get_page_template_slug) wp-includes/post-template.php | Gets the specific template filename for a given post. |
| Version | Description |
| --- | --- |
| [4.7.0](https://developer.wordpress.org/reference/since/4.7.0/) | `{Post Type Template}.php` was added to the top of the template hierarchy. |
| [4.4.0](https://developer.wordpress.org/reference/since/4.4.0/) | `single-{post_type}-{post_name}.php` was added to the top of the template hierarchy. |
| [1.5.0](https://developer.wordpress.org/reference/since/1.5.0/) | Introduced. |
wordpress recurse_dirsize( string $directory, string|string[] $exclude = null, int $max_execution_time = null, array $directory_cache = null ): int|false|null recurse\_dirsize( string $directory, string|string[] $exclude = null, int $max\_execution\_time = null, array $directory\_cache = null ): int|false|null
========================================================================================================================================================
Gets the size of a directory recursively.
Used by [get\_dirsize()](get_dirsize) to get a directory size when it contains other directories.
`$directory` string Required Full path of a directory. `$exclude` string|string[] Optional Full path of a subdirectory to exclude from the total, or array of paths. Expected without trailing slash(es). Default: `null`
`$max_execution_time` int Optional Maximum time to run before giving up. In seconds.
The timeout is global and is measured from the moment WordPress started to load. Default: `null`
`$directory_cache` array Optional Array of cached directory paths. Default: `null`
int|false|null Size in bytes if a valid directory. False if not. Null if timeout.
File: `wp-includes/functions.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/functions.php/)
```
function recurse_dirsize( $directory, $exclude = null, $max_execution_time = null, &$directory_cache = null ) {
$directory = untrailingslashit( $directory );
$save_cache = false;
if ( ! isset( $directory_cache ) ) {
$directory_cache = get_transient( 'dirsize_cache' );
$save_cache = true;
}
if ( isset( $directory_cache[ $directory ] ) && is_int( $directory_cache[ $directory ] ) ) {
return $directory_cache[ $directory ];
}
if ( ! file_exists( $directory ) || ! is_dir( $directory ) || ! is_readable( $directory ) ) {
return false;
}
if (
( is_string( $exclude ) && $directory === $exclude ) ||
( is_array( $exclude ) && in_array( $directory, $exclude, true ) )
) {
return false;
}
if ( null === $max_execution_time ) {
// Keep the previous behavior but attempt to prevent fatal errors from timeout if possible.
if ( function_exists( 'ini_get' ) ) {
$max_execution_time = ini_get( 'max_execution_time' );
} else {
// Disable...
$max_execution_time = 0;
}
// Leave 1 second "buffer" for other operations if $max_execution_time has reasonable value.
if ( $max_execution_time > 10 ) {
$max_execution_time -= 1;
}
}
/**
* Filters the amount of storage space used by one directory and all its children, in megabytes.
*
* Return the actual used space to short-circuit the recursive PHP file size calculation
* and use something else, like a CDN API or native operating system tools for better performance.
*
* @since 5.6.0
*
* @param int|false $space_used The amount of used space, in bytes. Default false.
* @param string $directory Full path of a directory.
* @param string|string[]|null $exclude Full path of a subdirectory to exclude from the total,
* or array of paths.
* @param int $max_execution_time Maximum time to run before giving up. In seconds.
* @param array $directory_cache Array of cached directory paths.
*/
$size = apply_filters( 'pre_recurse_dirsize', false, $directory, $exclude, $max_execution_time, $directory_cache );
if ( false === $size ) {
$size = 0;
$handle = opendir( $directory );
if ( $handle ) {
while ( ( $file = readdir( $handle ) ) !== false ) {
$path = $directory . '/' . $file;
if ( '.' !== $file && '..' !== $file ) {
if ( is_file( $path ) ) {
$size += filesize( $path );
} elseif ( is_dir( $path ) ) {
$handlesize = recurse_dirsize( $path, $exclude, $max_execution_time, $directory_cache );
if ( $handlesize > 0 ) {
$size += $handlesize;
}
}
if ( $max_execution_time > 0 &&
( microtime( true ) - WP_START_TIMESTAMP ) > $max_execution_time
) {
// Time exceeded. Give up instead of risking a fatal timeout.
$size = null;
break;
}
}
}
closedir( $handle );
}
}
if ( ! is_array( $directory_cache ) ) {
$directory_cache = array();
}
$directory_cache[ $directory ] = $size;
// Only write the transient on the top level call and not on recursive calls.
if ( $save_cache ) {
set_transient( 'dirsize_cache', $directory_cache );
}
return $size;
}
```
[apply\_filters( 'pre\_recurse\_dirsize', int|false $space\_used, string $directory, string|string[]|null $exclude, int $max\_execution\_time, array $directory\_cache )](../hooks/pre_recurse_dirsize)
Filters the amount of storage space used by one directory and all its children, in megabytes.
| Uses | Description |
| --- | --- |
| [untrailingslashit()](untrailingslashit) wp-includes/formatting.php | Removes trailing forward slashes and backslashes if they exist. |
| [get\_transient()](get_transient) wp-includes/option.php | Retrieves the value of a transient. |
| [set\_transient()](set_transient) wp-includes/option.php | Sets/updates the value of a transient. |
| [recurse\_dirsize()](recurse_dirsize) wp-includes/functions.php | Gets the size of a directory recursively. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| Used By | Description |
| --- | --- |
| [WP\_Debug\_Data::get\_sizes()](../classes/wp_debug_data/get_sizes) wp-admin/includes/class-wp-debug-data.php | Fetches the sizes of the WordPress directories: `wordpress` (ABSPATH), `plugins`, `themes`, and `uploads`. |
| [get\_dirsize()](get_dirsize) wp-includes/functions.php | Gets the size of a directory. |
| [recurse\_dirsize()](recurse_dirsize) wp-includes/functions.php | Gets the size of a directory recursively. |
| Version | Description |
| --- | --- |
| [MU (3.0.0)](https://developer.wordpress.org/reference/since/mu.3.0.0/) | MU (3.0.0) |
| [5.6.0](https://developer.wordpress.org/reference/since/5.6.0/) | The `$directory_cache` parameter was added. |
| [5.2.0](https://developer.wordpress.org/reference/since/5.2.0/) | The `$max_execution_time` parameter was added. |
| [4.3.0](https://developer.wordpress.org/reference/since/4.3.0/) | Introduced. |
wordpress wp_is_jsonp_request(): bool wp\_is\_jsonp\_request(): bool
==============================
Checks whether current request is a JSONP request, or is expecting a JSONP response.
bool True if JSONP request, false otherwise.
File: `wp-includes/load.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/load.php/)
```
function wp_is_jsonp_request() {
if ( ! isset( $_GET['_jsonp'] ) ) {
return false;
}
if ( ! function_exists( 'wp_check_jsonp_callback' ) ) {
require_once ABSPATH . WPINC . '/functions.php';
}
$jsonp_callback = $_GET['_jsonp'];
if ( ! wp_check_jsonp_callback( $jsonp_callback ) ) {
return false;
}
/** This filter is documented in wp-includes/rest-api/class-wp-rest-server.php */
$jsonp_enabled = apply_filters( 'rest_jsonp_enabled', true );
return $jsonp_enabled;
}
```
[apply\_filters( 'rest\_jsonp\_enabled', bool $jsonp\_enabled )](../hooks/rest_jsonp_enabled)
Filters whether JSONP is enabled for the REST API.
| Uses | Description |
| --- | --- |
| [wp\_check\_jsonp\_callback()](wp_check_jsonp_callback) wp-includes/functions.php | Checks that a JSONP callback is a valid JavaScript callback name. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| Used By | Description |
| --- | --- |
| [wp\_die()](wp_die) wp-includes/functions.php | Kills WordPress execution and displays HTML page with an error message. |
| Version | Description |
| --- | --- |
| [5.2.0](https://developer.wordpress.org/reference/since/5.2.0/) | Introduced. |
wordpress wp_kses_bad_protocol( string $string, string[] $allowed_protocols ): string wp\_kses\_bad\_protocol( string $string, string[] $allowed\_protocols ): string
===============================================================================
Sanitizes a string and removed disallowed URL protocols.
This function removes all non-allowed protocols from the beginning of the string. It ignores whitespace and the case of the letters, and it does understand HTML entities. It does its work recursively, so it won’t be fooled by a string like `javascript:javascript:alert(57)`.
`$string` string Required Content to filter bad protocols from. `$allowed_protocols` string[] Required Array of allowed URL protocols. string Filtered content.
File: `wp-includes/kses.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/kses.php/)
```
function wp_kses_bad_protocol( $string, $allowed_protocols ) {
$string = wp_kses_no_null( $string );
$iterations = 0;
do {
$original_string = $string;
$string = wp_kses_bad_protocol_once( $string, $allowed_protocols );
} while ( $original_string != $string && ++$iterations < 6 );
if ( $original_string != $string ) {
return '';
}
return $string;
}
```
| Uses | Description |
| --- | --- |
| [wp\_kses\_no\_null()](wp_kses_no_null) wp-includes/kses.php | Removes any invalid control characters in a text string. |
| [wp\_kses\_bad\_protocol\_once()](wp_kses_bad_protocol_once) wp-includes/kses.php | Sanitizes content from bad protocols and other characters. |
| Used By | Description |
| --- | --- |
| [wp\_kses\_one\_attr()](wp_kses_one_attr) wp-includes/kses.php | Filters one HTML attribute and ensures its value is allowed. |
| [esc\_url()](esc_url) wp-includes/formatting.php | Checks and cleans a URL. |
| [safecss\_filter\_attr()](safecss_filter_attr) wp-includes/kses.php | Filters an inline style attribute and removes disallowed rules. |
| [wp\_kses\_hair()](wp_kses_hair) wp-includes/kses.php | Builds an attribute list from string containing attributes. |
| [WP\_Http::request()](../classes/wp_http/request) wp-includes/class-wp-http.php | Send an HTTP request to a URI. |
| [wp\_http\_validate\_url()](wp_http_validate_url) wp-includes/http.php | Validate a URL for safe use in the HTTP API. |
| Version | Description |
| --- | --- |
| [1.0.0](https://developer.wordpress.org/reference/since/1.0.0/) | Introduced. |
wordpress wp_just_in_time_script_localization() wp\_just\_in\_time\_script\_localization()
==========================================
Loads localized data on print rather than initialization.
These localizations require information that may not be loaded even by init.
File: `wp-includes/script-loader.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/script-loader.php/)
```
function wp_just_in_time_script_localization() {
wp_localize_script(
'autosave',
'autosaveL10n',
array(
'autosaveInterval' => AUTOSAVE_INTERVAL,
'blog_id' => get_current_blog_id(),
)
);
wp_localize_script(
'mce-view',
'mceViewL10n',
array(
'shortcodes' => ! empty( $GLOBALS['shortcode_tags'] ) ? array_keys( $GLOBALS['shortcode_tags'] ) : array(),
)
);
wp_localize_script(
'word-count',
'wordCountL10n',
array(
/*
* translators: If your word count is based on single characters (e.g. East Asian characters),
* enter 'characters_excluding_spaces' or 'characters_including_spaces'. Otherwise, enter 'words'.
* Do not translate into your own language.
*/
'type' => _x( 'words', 'Word count type. Do not translate!' ),
'shortcodes' => ! empty( $GLOBALS['shortcode_tags'] ) ? array_keys( $GLOBALS['shortcode_tags'] ) : array(),
)
);
}
```
| Uses | Description |
| --- | --- |
| [wp\_localize\_script()](wp_localize_script) wp-includes/functions.wp-scripts.php | Localize a script. |
| [\_x()](_x) wp-includes/l10n.php | Retrieves translated string with gettext context. |
| [get\_current\_blog\_id()](get_current_blog_id) wp-includes/load.php | Retrieve the current site ID. |
| Version | Description |
| --- | --- |
| [2.5.0](https://developer.wordpress.org/reference/since/2.5.0/) | Introduced. |
wordpress wp_cache_set_sites_last_changed() wp\_cache\_set\_sites\_last\_changed()
======================================
Sets the last changed time for the ‘sites’ cache group.
File: `wp-includes/ms-site.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/ms-site.php/)
```
function wp_cache_set_sites_last_changed() {
wp_cache_set( 'last_changed', microtime(), 'sites' );
}
```
| Uses | Description |
| --- | --- |
| [wp\_cache\_set()](wp_cache_set) wp-includes/cache.php | Saves the data to the cache. |
| Used By | Description |
| --- | --- |
| [populate\_site\_meta()](populate_site_meta) wp-admin/includes/schema.php | Creates WordPress site meta and sets the default values. |
| Version | Description |
| --- | --- |
| [5.1.0](https://developer.wordpress.org/reference/since/5.1.0/) | Introduced. |
wordpress _close_comments_for_old_posts( WP_Post $posts, WP_Query $query ): array \_close\_comments\_for\_old\_posts( WP\_Post $posts, WP\_Query $query ): array
==============================================================================
This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.
Closes comments on old posts on the fly, without any extra DB queries. Hooked to the\_posts.
`$posts` [WP\_Post](../classes/wp_post) Required Post data object. `$query` [WP\_Query](../classes/wp_query) Required Query object. array
File: `wp-includes/comment.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/comment.php/)
```
function _close_comments_for_old_posts( $posts, $query ) {
if ( empty( $posts ) || ! $query->is_singular() || ! get_option( 'close_comments_for_old_posts' ) ) {
return $posts;
}
/**
* Filters the list of post types to automatically close comments for.
*
* @since 3.2.0
*
* @param string[] $post_types An array of post type names.
*/
$post_types = apply_filters( 'close_comments_for_post_types', array( 'post' ) );
if ( ! in_array( $posts[0]->post_type, $post_types, true ) ) {
return $posts;
}
$days_old = (int) get_option( 'close_comments_days_old' );
if ( ! $days_old ) {
return $posts;
}
if ( time() - strtotime( $posts[0]->post_date_gmt ) > ( $days_old * DAY_IN_SECONDS ) ) {
$posts[0]->comment_status = 'closed';
$posts[0]->ping_status = 'closed';
}
return $posts;
}
```
[apply\_filters( 'close\_comments\_for\_post\_types', string[] $post\_types )](../hooks/close_comments_for_post_types)
Filters the list of post types to automatically close comments for.
| Uses | Description |
| --- | --- |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| [get\_option()](get_option) wp-includes/option.php | Retrieves an option value based on an option name. |
| Version | Description |
| --- | --- |
| [2.7.0](https://developer.wordpress.org/reference/since/2.7.0/) | Introduced. |
wordpress the_header_video_url() the\_header\_video\_url()
=========================
Displays header video URL.
File: `wp-includes/theme.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/theme.php/)
```
function the_header_video_url() {
$video = get_header_video_url();
if ( $video ) {
echo esc_url( $video );
}
}
```
| Uses | Description |
| --- | --- |
| [get\_header\_video\_url()](get_header_video_url) wp-includes/theme.php | Retrieves header video URL for custom header. |
| [esc\_url()](esc_url) wp-includes/formatting.php | Checks and cleans a URL. |
| Version | Description |
| --- | --- |
| [4.7.0](https://developer.wordpress.org/reference/since/4.7.0/) | Introduced. |
wordpress register_nav_menus( string[] $locations = array() ) register\_nav\_menus( string[] $locations = array() )
=====================================================
Registers navigation menu locations for a theme.
`$locations` string[] Optional Associative array of menu location identifiers (like a slug) and descriptive text. Default: `array()`
See [register\_nav\_menu()](register_nav_menu) for creating a single menu, and [Navigation Menus](https://codex.wordpress.org/Navigation_Menus "Navigation Menus") for adding theme support.
This function automatically registers custom menu support for the theme, therefore you do **not** need to call `add_theme_support( 'menus' );`
Use [wp\_nav\_menu()](wp_nav_menu) to display your custom menu.
On the **Menus** admin page, there is a **Show advanced menu properties** to allow *“Link Target” “CSS Classes” “Link Relationship (XFN) Description”*
Use [get\_registered\_nav\_menus](get_registered_nav_menus "Function Reference/get registered nav menus") to get back a list of the menus that have been registered in a theme.
File: `wp-includes/nav-menu.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/nav-menu.php/)
```
function register_nav_menus( $locations = array() ) {
global $_wp_registered_nav_menus;
add_theme_support( 'menus' );
foreach ( $locations as $key => $value ) {
if ( is_int( $key ) ) {
_doing_it_wrong( __FUNCTION__, __( 'Nav menu locations must be strings.' ), '5.3.0' );
break;
}
}
$_wp_registered_nav_menus = array_merge( (array) $_wp_registered_nav_menus, $locations );
}
```
| Uses | Description |
| --- | --- |
| [add\_theme\_support()](add_theme_support) wp-includes/theme.php | Registers theme support for a given feature. |
| [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. |
| [\_doing\_it\_wrong()](_doing_it_wrong) wp-includes/functions.php | Marks something as being incorrectly called. |
| Used By | Description |
| --- | --- |
| [register\_nav\_menu()](register_nav_menu) wp-includes/nav-menu.php | Registers a navigation menu location for a theme. |
| Version | Description |
| --- | --- |
| [3.0.0](https://developer.wordpress.org/reference/since/3.0.0/) | Introduced. |
| programming_docs |
wordpress wp_get_archives( string|array $args = '' ): void|string wp\_get\_archives( string|array $args = '' ): void|string
=========================================================
Displays archive links based on type and format.
* [get\_archives\_link()](get_archives_link)
`$args` string|array Optional Default archive links arguments. Optional.
* `type`stringType of archive to retrieve. Accepts `'daily'`, `'weekly'`, `'monthly'`, `'yearly'`, `'postbypost'`, or `'alpha'`. Both `'postbypost'` and `'alpha'` display the same archive link list as well as post titles instead of displaying dates. The difference between the two is that `'alpha'` will order by post title and `'postbypost'` will order by post date.
Default `'monthly'`.
* `limit`string|intNumber of links to limit the query to. Default empty (no limit).
* `format`stringFormat each link should take using the $before and $after args.
Accepts `'link'` (`<link>` tag), `'option'` (`<option>` tag), `'html'` (`<li>` tag), or a custom format, which generates a link anchor with $before preceding and $after succeeding. Default `'html'`.
* `before`stringMarkup to prepend to the beginning of each link.
* `after`stringMarkup to append to the end of each link.
* `show_post_count`boolWhether to display the post count alongside the link. Default false.
* `echo`bool|intWhether to echo or return the links list. Default `1|true` to echo.
* `order`stringWhether to use ascending or descending order. Accepts `'ASC'`, or `'DESC'`.
Default `'DESC'`.
* `post_type`stringPost type. Default `'post'`.
* `year`stringYear. Default current year.
* `monthnum`stringMonth number. Default current month number.
* `day`stringDay. Default current day.
* `w`stringWeek. Default current week.
Default: `''`
void|string Void if `'echo'` argument is true, archive links if `'echo'` is false.
File: `wp-includes/general-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/general-template.php/)
```
function wp_get_archives( $args = '' ) {
global $wpdb, $wp_locale;
$defaults = array(
'type' => 'monthly',
'limit' => '',
'format' => 'html',
'before' => '',
'after' => '',
'show_post_count' => false,
'echo' => 1,
'order' => 'DESC',
'post_type' => 'post',
'year' => get_query_var( 'year' ),
'monthnum' => get_query_var( 'monthnum' ),
'day' => get_query_var( 'day' ),
'w' => get_query_var( 'w' ),
);
$parsed_args = wp_parse_args( $args, $defaults );
$post_type_object = get_post_type_object( $parsed_args['post_type'] );
if ( ! is_post_type_viewable( $post_type_object ) ) {
return;
}
$parsed_args['post_type'] = $post_type_object->name;
if ( '' === $parsed_args['type'] ) {
$parsed_args['type'] = 'monthly';
}
if ( ! empty( $parsed_args['limit'] ) ) {
$parsed_args['limit'] = absint( $parsed_args['limit'] );
$parsed_args['limit'] = ' LIMIT ' . $parsed_args['limit'];
}
$order = strtoupper( $parsed_args['order'] );
if ( 'ASC' !== $order ) {
$order = 'DESC';
}
// This is what will separate dates on weekly archive links.
$archive_week_separator = '–';
$sql_where = $wpdb->prepare( "WHERE post_type = %s AND post_status = 'publish'", $parsed_args['post_type'] );
/**
* Filters the SQL WHERE clause for retrieving archives.
*
* @since 2.2.0
*
* @param string $sql_where Portion of SQL query containing the WHERE clause.
* @param array $parsed_args An array of default arguments.
*/
$where = apply_filters( 'getarchives_where', $sql_where, $parsed_args );
/**
* Filters the SQL JOIN clause for retrieving archives.
*
* @since 2.2.0
*
* @param string $sql_join Portion of SQL query containing JOIN clause.
* @param array $parsed_args An array of default arguments.
*/
$join = apply_filters( 'getarchives_join', '', $parsed_args );
$output = '';
$last_changed = wp_cache_get_last_changed( 'posts' );
$limit = $parsed_args['limit'];
if ( 'monthly' === $parsed_args['type'] ) {
$query = "SELECT YEAR(post_date) AS `year`, MONTH(post_date) AS `month`, count(ID) as posts FROM $wpdb->posts $join $where GROUP BY YEAR(post_date), MONTH(post_date) ORDER BY post_date $order $limit";
$key = md5( $query );
$key = "wp_get_archives:$key:$last_changed";
$results = wp_cache_get( $key, 'posts' );
if ( ! $results ) {
$results = $wpdb->get_results( $query );
wp_cache_set( $key, $results, 'posts' );
}
if ( $results ) {
$after = $parsed_args['after'];
foreach ( (array) $results as $result ) {
$url = get_month_link( $result->year, $result->month );
if ( 'post' !== $parsed_args['post_type'] ) {
$url = add_query_arg( 'post_type', $parsed_args['post_type'], $url );
}
/* translators: 1: Month name, 2: 4-digit year. */
$text = sprintf( __( '%1$s %2$d' ), $wp_locale->get_month( $result->month ), $result->year );
if ( $parsed_args['show_post_count'] ) {
$parsed_args['after'] = ' (' . $result->posts . ')' . $after;
}
$selected = is_archive() && (string) $parsed_args['year'] === $result->year && (string) $parsed_args['monthnum'] === $result->month;
$output .= get_archives_link( $url, $text, $parsed_args['format'], $parsed_args['before'], $parsed_args['after'], $selected );
}
}
} elseif ( 'yearly' === $parsed_args['type'] ) {
$query = "SELECT YEAR(post_date) AS `year`, count(ID) as posts FROM $wpdb->posts $join $where GROUP BY YEAR(post_date) ORDER BY post_date $order $limit";
$key = md5( $query );
$key = "wp_get_archives:$key:$last_changed";
$results = wp_cache_get( $key, 'posts' );
if ( ! $results ) {
$results = $wpdb->get_results( $query );
wp_cache_set( $key, $results, 'posts' );
}
if ( $results ) {
$after = $parsed_args['after'];
foreach ( (array) $results as $result ) {
$url = get_year_link( $result->year );
if ( 'post' !== $parsed_args['post_type'] ) {
$url = add_query_arg( 'post_type', $parsed_args['post_type'], $url );
}
$text = sprintf( '%d', $result->year );
if ( $parsed_args['show_post_count'] ) {
$parsed_args['after'] = ' (' . $result->posts . ')' . $after;
}
$selected = is_archive() && (string) $parsed_args['year'] === $result->year;
$output .= get_archives_link( $url, $text, $parsed_args['format'], $parsed_args['before'], $parsed_args['after'], $selected );
}
}
} elseif ( 'daily' === $parsed_args['type'] ) {
$query = "SELECT YEAR(post_date) AS `year`, MONTH(post_date) AS `month`, DAYOFMONTH(post_date) AS `dayofmonth`, count(ID) as posts FROM $wpdb->posts $join $where GROUP BY YEAR(post_date), MONTH(post_date), DAYOFMONTH(post_date) ORDER BY post_date $order $limit";
$key = md5( $query );
$key = "wp_get_archives:$key:$last_changed";
$results = wp_cache_get( $key, 'posts' );
if ( ! $results ) {
$results = $wpdb->get_results( $query );
wp_cache_set( $key, $results, 'posts' );
}
if ( $results ) {
$after = $parsed_args['after'];
foreach ( (array) $results as $result ) {
$url = get_day_link( $result->year, $result->month, $result->dayofmonth );
if ( 'post' !== $parsed_args['post_type'] ) {
$url = add_query_arg( 'post_type', $parsed_args['post_type'], $url );
}
$date = sprintf( '%1$d-%2$02d-%3$02d 00:00:00', $result->year, $result->month, $result->dayofmonth );
$text = mysql2date( get_option( 'date_format' ), $date );
if ( $parsed_args['show_post_count'] ) {
$parsed_args['after'] = ' (' . $result->posts . ')' . $after;
}
$selected = is_archive() && (string) $parsed_args['year'] === $result->year && (string) $parsed_args['monthnum'] === $result->month && (string) $parsed_args['day'] === $result->dayofmonth;
$output .= get_archives_link( $url, $text, $parsed_args['format'], $parsed_args['before'], $parsed_args['after'], $selected );
}
}
} elseif ( 'weekly' === $parsed_args['type'] ) {
$week = _wp_mysql_week( '`post_date`' );
$query = "SELECT DISTINCT $week AS `week`, YEAR( `post_date` ) AS `yr`, DATE_FORMAT( `post_date`, '%Y-%m-%d' ) AS `yyyymmdd`, count( `ID` ) AS `posts` FROM `$wpdb->posts` $join $where GROUP BY $week, YEAR( `post_date` ) ORDER BY `post_date` $order $limit";
$key = md5( $query );
$key = "wp_get_archives:$key:$last_changed";
$results = wp_cache_get( $key, 'posts' );
if ( ! $results ) {
$results = $wpdb->get_results( $query );
wp_cache_set( $key, $results, 'posts' );
}
$arc_w_last = '';
if ( $results ) {
$after = $parsed_args['after'];
foreach ( (array) $results as $result ) {
if ( $result->week != $arc_w_last ) {
$arc_year = $result->yr;
$arc_w_last = $result->week;
$arc_week = get_weekstartend( $result->yyyymmdd, get_option( 'start_of_week' ) );
$arc_week_start = date_i18n( get_option( 'date_format' ), $arc_week['start'] );
$arc_week_end = date_i18n( get_option( 'date_format' ), $arc_week['end'] );
$url = add_query_arg(
array(
'm' => $arc_year,
'w' => $result->week,
),
home_url( '/' )
);
if ( 'post' !== $parsed_args['post_type'] ) {
$url = add_query_arg( 'post_type', $parsed_args['post_type'], $url );
}
$text = $arc_week_start . $archive_week_separator . $arc_week_end;
if ( $parsed_args['show_post_count'] ) {
$parsed_args['after'] = ' (' . $result->posts . ')' . $after;
}
$selected = is_archive() && (string) $parsed_args['year'] === $result->yr && (string) $parsed_args['w'] === $result->week;
$output .= get_archives_link( $url, $text, $parsed_args['format'], $parsed_args['before'], $parsed_args['after'], $selected );
}
}
}
} elseif ( ( 'postbypost' === $parsed_args['type'] ) || ( 'alpha' === $parsed_args['type'] ) ) {
$orderby = ( 'alpha' === $parsed_args['type'] ) ? 'post_title ASC ' : 'post_date DESC, ID DESC ';
$query = "SELECT * FROM $wpdb->posts $join $where ORDER BY $orderby $limit";
$key = md5( $query );
$key = "wp_get_archives:$key:$last_changed";
$results = wp_cache_get( $key, 'posts' );
if ( ! $results ) {
$results = $wpdb->get_results( $query );
wp_cache_set( $key, $results, 'posts' );
}
if ( $results ) {
foreach ( (array) $results as $result ) {
if ( '0000-00-00 00:00:00' !== $result->post_date ) {
$url = get_permalink( $result );
if ( $result->post_title ) {
/** This filter is documented in wp-includes/post-template.php */
$text = strip_tags( apply_filters( 'the_title', $result->post_title, $result->ID ) );
} else {
$text = $result->ID;
}
$selected = get_the_ID() === $result->ID;
$output .= get_archives_link( $url, $text, $parsed_args['format'], $parsed_args['before'], $parsed_args['after'], $selected );
}
}
}
}
if ( $parsed_args['echo'] ) {
echo $output;
} else {
return $output;
}
}
```
[apply\_filters( 'getarchives\_join', string $sql\_join, array $parsed\_args )](../hooks/getarchives_join)
Filters the SQL JOIN clause for retrieving archives.
[apply\_filters( 'getarchives\_where', string $sql\_where, array $parsed\_args )](../hooks/getarchives_where)
Filters the SQL WHERE clause for retrieving archives.
[apply\_filters( 'the\_title', string $post\_title, int $post\_id )](../hooks/the_title)
Filters the post title.
| Uses | Description |
| --- | --- |
| [wp\_cache\_get\_last\_changed()](wp_cache_get_last_changed) wp-includes/functions.php | Gets last changed date for the specified cache group. |
| [get\_weekstartend()](get_weekstartend) wp-includes/functions.php | Gets the week start and end from the datetime or date string from MySQL. |
| [get\_the\_ID()](get_the_id) wp-includes/post-template.php | Retrieves the ID of the current item in the WordPress Loop. |
| [get\_year\_link()](get_year_link) wp-includes/link-template.php | Retrieves the permalink for the year archives. |
| [get\_day\_link()](get_day_link) wp-includes/link-template.php | Retrieves the permalink for the day archives with year and month. |
| [get\_month\_link()](get_month_link) wp-includes/link-template.php | Retrieves the permalink for the month archives with year. |
| [WP\_Locale::get\_month()](../classes/wp_locale/get_month) wp-includes/class-wp-locale.php | Retrieves the full translated month by month number. |
| [is\_post\_type\_viewable()](is_post_type_viewable) wp-includes/post.php | Determines whether a post type is considered “viewable”. |
| [date\_i18n()](date_i18n) wp-includes/functions.php | Retrieves the date in localized format, based on a sum of Unix timestamp and timezone offset in seconds. |
| [mysql2date()](mysql2date) wp-includes/functions.php | Converts given MySQL date string into a different format. |
| [is\_archive()](is_archive) wp-includes/query.php | Determines whether the query is for an existing archive page. |
| [get\_query\_var()](get_query_var) wp-includes/query.php | Retrieves the value of a query variable in the [WP\_Query](../classes/wp_query) class. |
| [get\_archives\_link()](get_archives_link) wp-includes/general-template.php | Retrieves archive link content based on predefined or custom code. |
| [wp\_cache\_set()](wp_cache_set) wp-includes/cache.php | Saves the data to the cache. |
| [add\_query\_arg()](add_query_arg) wp-includes/functions.php | Retrieves a modified URL query string. |
| [absint()](absint) wp-includes/functions.php | Converts a value to non-negative integer. |
| [wp\_parse\_args()](wp_parse_args) wp-includes/functions.php | Merges user defined arguments into defaults array. |
| [home\_url()](home_url) wp-includes/link-template.php | Retrieves the URL for the current site where the front end is accessible. |
| [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. |
| [get\_permalink()](get_permalink) wp-includes/link-template.php | Retrieves the full permalink for the current post or post ID. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| [get\_option()](get_option) wp-includes/option.php | Retrieves an option value based on an option name. |
| [wp\_cache\_get()](wp_cache_get) wp-includes/cache.php | Retrieves the cache contents from the cache by key and group. |
| [get\_post\_type\_object()](get_post_type_object) wp-includes/post.php | Retrieves a post type object by name. |
| [wpdb::get\_results()](../classes/wpdb/get_results) wp-includes/class-wpdb.php | Retrieves an entire SQL result set from the database (i.e., many rows). |
| [wpdb::prepare()](../classes/wpdb/prepare) wp-includes/class-wpdb.php | Prepares a SQL query for safe execution. |
| Used By | Description |
| --- | --- |
| [get\_archives()](get_archives) wp-includes/deprecated.php | Retrieves a list of archives. |
| [WP\_Widget\_Archives::widget()](../classes/wp_widget_archives/widget) wp-includes/widgets/class-wp-widget-archives.php | Outputs the content for the current Archives widget instance. |
| Version | Description |
| --- | --- |
| [5.2.0](https://developer.wordpress.org/reference/since/5.2.0/) | The `$year`, `$monthnum`, `$day`, and `$w` arguments were added. |
| [4.4.0](https://developer.wordpress.org/reference/since/4.4.0/) | The `$post_type` argument was added. |
| [1.2.0](https://developer.wordpress.org/reference/since/1.2.0/) | Introduced. |
wordpress get_pagenum_link( int $pagenum = 1, bool $escape = true ): string get\_pagenum\_link( int $pagenum = 1, bool $escape = true ): string
===================================================================
Retrieves the link for a page number.
`$pagenum` int Optional Page number. Default: `1`
`$escape` bool Optional Whether to escape the URL for display, with [esc\_url()](esc_url) . Defaults to true.
Otherwise, prepares the URL with [sanitize\_url()](sanitize_url) . Default: `true`
string The link URL for the given page number.
File: `wp-includes/link-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/link-template.php/)
```
function get_pagenum_link( $pagenum = 1, $escape = true ) {
global $wp_rewrite;
$pagenum = (int) $pagenum;
$request = remove_query_arg( 'paged' );
$home_root = parse_url( home_url() );
$home_root = ( isset( $home_root['path'] ) ) ? $home_root['path'] : '';
$home_root = preg_quote( $home_root, '|' );
$request = preg_replace( '|^' . $home_root . '|i', '', $request );
$request = preg_replace( '|^/+|', '', $request );
if ( ! $wp_rewrite->using_permalinks() || is_admin() ) {
$base = trailingslashit( get_bloginfo( 'url' ) );
if ( $pagenum > 1 ) {
$result = add_query_arg( 'paged', $pagenum, $base . $request );
} else {
$result = $base . $request;
}
} else {
$qs_regex = '|\?.*?$|';
preg_match( $qs_regex, $request, $qs_match );
if ( ! empty( $qs_match[0] ) ) {
$query_string = $qs_match[0];
$request = preg_replace( $qs_regex, '', $request );
} else {
$query_string = '';
}
$request = preg_replace( "|$wp_rewrite->pagination_base/\d+/?$|", '', $request );
$request = preg_replace( '|^' . preg_quote( $wp_rewrite->index, '|' ) . '|i', '', $request );
$request = ltrim( $request, '/' );
$base = trailingslashit( get_bloginfo( 'url' ) );
if ( $wp_rewrite->using_index_permalinks() && ( $pagenum > 1 || '' !== $request ) ) {
$base .= $wp_rewrite->index . '/';
}
if ( $pagenum > 1 ) {
$request = ( ( ! empty( $request ) ) ? trailingslashit( $request ) : $request ) . user_trailingslashit( $wp_rewrite->pagination_base . '/' . $pagenum, 'paged' );
}
$result = $base . $request . $query_string;
}
/**
* Filters the page number link for the current request.
*
* @since 2.5.0
* @since 5.2.0 Added the `$pagenum` argument.
*
* @param string $result The page number link.
* @param int $pagenum The page number.
*/
$result = apply_filters( 'get_pagenum_link', $result, $pagenum );
if ( $escape ) {
return esc_url( $result );
} else {
return sanitize_url( $result );
}
}
```
[apply\_filters( 'get\_pagenum\_link', string $result, int $pagenum )](../hooks/get_pagenum_link)
Filters the page number link for the current request.
| Uses | Description |
| --- | --- |
| [sanitize\_url()](sanitize_url) wp-includes/formatting.php | Sanitizes a URL for database or redirect usage. |
| [remove\_query\_arg()](remove_query_arg) wp-includes/functions.php | Removes an item or items from a query string. |
| [user\_trailingslashit()](user_trailingslashit) wp-includes/link-template.php | Retrieves a trailing-slashed string if the site is set for adding trailing slashes. |
| [WP\_Rewrite::using\_index\_permalinks()](../classes/wp_rewrite/using_index_permalinks) wp-includes/class-wp-rewrite.php | Determines whether permalinks are being used and rewrite module is not enabled. |
| [WP\_Rewrite::using\_permalinks()](../classes/wp_rewrite/using_permalinks) wp-includes/class-wp-rewrite.php | Determines whether permalinks are being used. |
| [esc\_url()](esc_url) wp-includes/formatting.php | Checks and cleans a URL. |
| [trailingslashit()](trailingslashit) wp-includes/formatting.php | Appends a trailing slash. |
| [get\_bloginfo()](get_bloginfo) wp-includes/general-template.php | Retrieves information about the current site. |
| [is\_admin()](is_admin) wp-includes/load.php | Determines whether the current request is for an administrative interface page. |
| [add\_query\_arg()](add_query_arg) wp-includes/functions.php | Retrieves a modified URL query string. |
| [home\_url()](home_url) wp-includes/link-template.php | Retrieves the URL for the current site where the front end is accessible. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| Used By | Description |
| --- | --- |
| [paginate\_links()](paginate_links) wp-includes/general-template.php | Retrieves paginated links for archive post pages. |
| [get\_next\_posts\_page\_link()](get_next_posts_page_link) wp-includes/link-template.php | Retrieves the next posts page link. |
| [get\_previous\_posts\_page\_link()](get_previous_posts_page_link) wp-includes/link-template.php | Retrieves the previous posts page link. |
| Version | Description |
| --- | --- |
| [1.5.0](https://developer.wordpress.org/reference/since/1.5.0/) | Introduced. |
| programming_docs |
wordpress get_post_mime_type( int|WP_Post $post = null ): string|false get\_post\_mime\_type( int|WP\_Post $post = null ): string|false
================================================================
Retrieves 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.
`$post` int|[WP\_Post](../classes/wp_post) Optional Post ID or post object. Defaults to global $post. Default: `null`
string|false The mime type on success, false on failure.
File: `wp-includes/post.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/post.php/)
```
function get_post_mime_type( $post = null ) {
$post = get_post( $post );
if ( is_object( $post ) ) {
return $post->post_mime_type;
}
return false;
}
```
| Uses | Description |
| --- | --- |
| [get\_post()](get_post) wp-includes/post.php | Retrieves post data given a post ID or post object. |
| Used By | Description |
| --- | --- |
| [WP\_REST\_Attachments\_Controller::edit\_media\_item()](../classes/wp_rest_attachments_controller/edit_media_item) wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php | Applies edits to a media item and creates a new attachment record. |
| [wp\_image\_editor()](wp_image_editor) wp-admin/includes/image-edit.php | Loads the WP image-editing interface. |
| [wp\_generate\_attachment\_metadata()](wp_generate_attachment_metadata) wp-admin/includes/image.php | Generates attachment meta data and create image sub-sizes for images. |
| [get\_body\_class()](get_body_class) wp-includes/post-template.php | Retrieves an array of the class names for the body element. |
| Version | Description |
| --- | --- |
| [2.0.0](https://developer.wordpress.org/reference/since/2.0.0/) | Introduced. |
wordpress wp_ajax_delete_comment() wp\_ajax\_delete\_comment()
===========================
Ajax handler for deleting a comment.
File: `wp-admin/includes/ajax-actions.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/ajax-actions.php/)
```
function wp_ajax_delete_comment() {
$id = isset( $_POST['id'] ) ? (int) $_POST['id'] : 0;
$comment = get_comment( $id );
if ( ! $comment ) {
wp_die( time() );
}
if ( ! current_user_can( 'edit_comment', $comment->comment_ID ) ) {
wp_die( -1 );
}
check_ajax_referer( "delete-comment_$id" );
$status = wp_get_comment_status( $comment );
$delta = -1;
if ( isset( $_POST['trash'] ) && 1 == $_POST['trash'] ) {
if ( 'trash' === $status ) {
wp_die( time() );
}
$r = wp_trash_comment( $comment );
} elseif ( isset( $_POST['untrash'] ) && 1 == $_POST['untrash'] ) {
if ( 'trash' !== $status ) {
wp_die( time() );
}
$r = wp_untrash_comment( $comment );
// Undo trash, not in Trash.
if ( ! isset( $_POST['comment_status'] ) || 'trash' !== $_POST['comment_status'] ) {
$delta = 1;
}
} elseif ( isset( $_POST['spam'] ) && 1 == $_POST['spam'] ) {
if ( 'spam' === $status ) {
wp_die( time() );
}
$r = wp_spam_comment( $comment );
} elseif ( isset( $_POST['unspam'] ) && 1 == $_POST['unspam'] ) {
if ( 'spam' !== $status ) {
wp_die( time() );
}
$r = wp_unspam_comment( $comment );
// Undo spam, not in spam.
if ( ! isset( $_POST['comment_status'] ) || 'spam' !== $_POST['comment_status'] ) {
$delta = 1;
}
} elseif ( isset( $_POST['delete'] ) && 1 == $_POST['delete'] ) {
$r = wp_delete_comment( $comment );
} else {
wp_die( -1 );
}
if ( $r ) {
// Decide if we need to send back '1' or a more complicated response including page links and comment counts.
_wp_ajax_delete_comment_response( $comment->comment_ID, $delta );
}
wp_die( 0 );
}
```
| Uses | Description |
| --- | --- |
| [\_wp\_ajax\_delete\_comment\_response()](_wp_ajax_delete_comment_response) wp-admin/includes/ajax-actions.php | Sends back current comment total and new page links if they need to be updated. |
| [wp\_get\_comment\_status()](wp_get_comment_status) wp-includes/comment.php | Retrieves the status of a comment by comment ID. |
| [wp\_spam\_comment()](wp_spam_comment) wp-includes/comment.php | Marks a comment as Spam. |
| [wp\_unspam\_comment()](wp_unspam_comment) wp-includes/comment.php | Removes a comment from the Spam. |
| [wp\_trash\_comment()](wp_trash_comment) wp-includes/comment.php | Moves a comment to the Trash |
| [wp\_untrash\_comment()](wp_untrash_comment) wp-includes/comment.php | Removes a comment from the Trash |
| [wp\_delete\_comment()](wp_delete_comment) wp-includes/comment.php | Trashes or deletes a comment. |
| [current\_user\_can()](current_user_can) wp-includes/capabilities.php | Returns whether the current user has the specified capability. |
| [check\_ajax\_referer()](check_ajax_referer) wp-includes/pluggable.php | Verifies the Ajax request to prevent processing requests external of the blog. |
| [wp\_die()](wp_die) wp-includes/functions.php | Kills WordPress execution and displays HTML page with an error message. |
| [get\_comment()](get_comment) wp-includes/comment.php | Retrieves comment data given a comment ID or comment object. |
| Version | Description |
| --- | --- |
| [3.1.0](https://developer.wordpress.org/reference/since/3.1.0/) | Introduced. |
wordpress wp_update_site( int $site_id, array $data ): int|WP_Error wp\_update\_site( int $site\_id, array $data ): int|WP\_Error
=============================================================
Updates a site in the database.
`$site_id` int Required ID of the site that should be updated. `$data` array Required Site data to update. See [wp\_insert\_site()](wp_insert_site) for the list of supported keys. More Arguments from wp\_insert\_site( ... $data ) Data for the new site that should be inserted.
* `domain`stringSite domain. Default empty string.
* `path`stringSite path. Default `'/'`.
* `network_id`intThe site's network ID. Default is the current network ID.
* `registered`stringWhen the site was registered, in SQL datetime format. Default is the current time.
* `last_updated`stringWhen the site was last updated, in SQL datetime format. Default is the value of $registered.
* `public`intWhether the site is public. Default 1.
* `archived`intWhether the site is archived. Default 0.
* `mature`intWhether the site is mature. Default 0.
* `spam`intWhether the site is spam. Default 0.
* `deleted`intWhether the site is deleted. Default 0.
* `lang_id`intThe site's language ID. Currently unused. Default 0.
* `user_id`intUser ID for the site administrator. Passed to the `wp_initialize_site` hook.
* `title`stringSite title. Default is 'Site %d' where %d is the site ID. Passed to the `wp_initialize_site` hook.
* `options`arrayCustom option $key => $value pairs to use. Default empty array. Passed to the `wp_initialize_site` hook.
* `meta`arrayCustom site metadata $key => $value pairs to use. Default empty array.
Passed to the `wp_initialize_site` hook.
int|[WP\_Error](../classes/wp_error) The updated site's ID on success, or error object on failure.
File: `wp-includes/ms-site.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/ms-site.php/)
```
function wp_update_site( $site_id, array $data ) {
global $wpdb;
if ( empty( $site_id ) ) {
return new WP_Error( 'site_empty_id', __( 'Site ID must not be empty.' ) );
}
$old_site = get_site( $site_id );
if ( ! $old_site ) {
return new WP_Error( 'site_not_exist', __( 'Site does not exist.' ) );
}
$defaults = $old_site->to_array();
$defaults['network_id'] = (int) $defaults['site_id'];
$defaults['last_updated'] = current_time( 'mysql', true );
unset( $defaults['blog_id'], $defaults['site_id'] );
$data = wp_prepare_site_data( $data, $defaults, $old_site );
if ( is_wp_error( $data ) ) {
return $data;
}
if ( false === $wpdb->update( $wpdb->blogs, $data, array( 'blog_id' => $old_site->id ) ) ) {
return new WP_Error( 'db_update_error', __( 'Could not update site in the database.' ), $wpdb->last_error );
}
clean_blog_cache( $old_site );
$new_site = get_site( $old_site->id );
/**
* Fires once a site has been updated in the database.
*
* @since 5.1.0
*
* @param WP_Site $new_site New site object.
* @param WP_Site $old_site Old site object.
*/
do_action( 'wp_update_site', $new_site, $old_site );
return (int) $new_site->id;
}
```
[do\_action( 'wp\_update\_site', WP\_Site $new\_site, WP\_Site $old\_site )](../hooks/wp_update_site)
Fires once a site has been updated in the database.
| Uses | Description |
| --- | --- |
| [wp\_prepare\_site\_data()](wp_prepare_site_data) wp-includes/ms-site.php | Prepares site data for insertion or update in the database. |
| [get\_site()](get_site) wp-includes/ms-site.php | Retrieves site data given a site ID or site object. |
| [current\_time()](current_time) wp-includes/functions.php | Retrieves the current time based on specified type. |
| [clean\_blog\_cache()](clean_blog_cache) wp-includes/ms-site.php | Clean the blog cache |
| [wpdb::update()](../classes/wpdb/update) wp-includes/class-wpdb.php | Updates a row in the table. |
| [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. |
| [do\_action()](do_action) wp-includes/plugin.php | Calls the callback functions that have been added to an action hook. |
| [is\_wp\_error()](is_wp_error) wp-includes/load.php | Checks whether the given variable is a WordPress Error. |
| [WP\_Error::\_\_construct()](../classes/wp_error/__construct) wp-includes/class-wp-error.php | Initializes the error. |
| Used By | Description |
| --- | --- |
| [update\_blog\_status()](update_blog_status) wp-includes/ms-blogs.php | Update a blog details field. |
| [update\_blog\_details()](update_blog_details) wp-includes/ms-blogs.php | Update the details for a blog. Updates the blogs table for a given blog ID. |
| Version | Description |
| --- | --- |
| [5.1.0](https://developer.wordpress.org/reference/since/5.1.0/) | Introduced. |
wordpress wp_update_blog_public_option_on_site_update( int $site_id, string $public ) wp\_update\_blog\_public\_option\_on\_site\_update( int $site\_id, string $public )
===================================================================================
Updates the `blog_public` option for a given site ID.
`$site_id` int Required Site ID. `$public` string Required The value of the site status. File: `wp-includes/ms-site.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/ms-site.php/)
```
function wp_update_blog_public_option_on_site_update( $site_id, $public ) {
// Bail if the site's database tables do not exist (yet).
if ( ! wp_is_site_initialized( $site_id ) ) {
return;
}
update_blog_option( $site_id, 'blog_public', $public );
}
```
| Uses | Description |
| --- | --- |
| [wp\_is\_site\_initialized()](wp_is_site_initialized) wp-includes/ms-site.php | Checks whether a site is initialized. |
| [update\_blog\_option()](update_blog_option) wp-includes/ms-blogs.php | Update an option for a particular blog. |
| Version | Description |
| --- | --- |
| [5.1.0](https://developer.wordpress.org/reference/since/5.1.0/) | Introduced. |
wordpress the_title_attribute( string|array $args = '' ): void|string the\_title\_attribute( string|array $args = '' ): void|string
=============================================================
Sanitizes the current title when retrieving or displaying.
Works like [the\_title()](the_title) , except the parameters can be in a string or an array. See the function for what can be override in the $args parameter.
The title before it is displayed will have the tags stripped and [esc\_attr()](esc_attr) before it is passed to the user or displayed. The default as with [the\_title()](the_title) , is to display the title.
`$args` string|array Optional Title attribute arguments. Optional.
* `before`stringMarkup to prepend to the title.
* `after`stringMarkup to append to the title.
* `echo`boolWhether to echo or return the title. Default true for echo.
* `post`[WP\_Post](../classes/wp_post)Current post object to retrieve the title for.
Default: `''`
void|string Void if `'echo'` argument is true, the title attribute if `'echo'` is false.
File: `wp-includes/post-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/post-template.php/)
```
function the_title_attribute( $args = '' ) {
$defaults = array(
'before' => '',
'after' => '',
'echo' => true,
'post' => get_post(),
);
$parsed_args = wp_parse_args( $args, $defaults );
$title = get_the_title( $parsed_args['post'] );
if ( strlen( $title ) == 0 ) {
return;
}
$title = $parsed_args['before'] . $title . $parsed_args['after'];
$title = esc_attr( strip_tags( $title ) );
if ( $parsed_args['echo'] ) {
echo $title;
} else {
return $title;
}
}
```
| Uses | Description |
| --- | --- |
| [get\_the\_title()](get_the_title) wp-includes/post-template.php | Retrieves the post title. |
| [esc\_attr()](esc_attr) wp-includes/formatting.php | Escaping for HTML attributes. |
| [wp\_parse\_args()](wp_parse_args) wp-includes/functions.php | Merges user defined arguments into defaults array. |
| [get\_post()](get_post) wp-includes/post.php | Retrieves post data given a post ID or post object. |
| Used By | Description |
| --- | --- |
| [feed\_links\_extra()](feed_links_extra) wp-includes/general-template.php | Displays the links to the extra feeds such as category feeds. |
| [the\_shortlink()](the_shortlink) wp-includes/link-template.php | Displays the shortlink for a post. |
| [get\_adjacent\_post\_rel\_link()](get_adjacent_post_rel_link) wp-includes/link-template.php | Retrieves the adjacent post relational link. |
| [get\_the\_content()](get_the_content) wp-includes/post-template.php | Retrieves the post content. |
| Version | Description |
| --- | --- |
| [2.3.0](https://developer.wordpress.org/reference/since/2.3.0/) | Introduced. |
wordpress wp_ajax_edit_comment() wp\_ajax\_edit\_comment()
=========================
Ajax handler for editing a comment.
File: `wp-admin/includes/ajax-actions.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/ajax-actions.php/)
```
function wp_ajax_edit_comment() {
check_ajax_referer( 'replyto-comment', '_ajax_nonce-replyto-comment' );
$comment_id = (int) $_POST['comment_ID'];
if ( ! current_user_can( 'edit_comment', $comment_id ) ) {
wp_die( -1 );
}
if ( '' === $_POST['content'] ) {
wp_die( __( 'Please type your comment text.' ) );
}
if ( isset( $_POST['status'] ) ) {
$_POST['comment_status'] = $_POST['status'];
}
$updated = edit_comment();
if ( is_wp_error( $updated ) ) {
wp_die( $updated->get_error_message() );
}
$position = ( isset( $_POST['position'] ) && (int) $_POST['position'] ) ? (int) $_POST['position'] : '-1';
$checkbox = ( isset( $_POST['checkbox'] ) && true == $_POST['checkbox'] ) ? 1 : 0;
$wp_list_table = _get_list_table( $checkbox ? 'WP_Comments_List_Table' : 'WP_Post_Comments_List_Table', array( 'screen' => 'edit-comments' ) );
$comment = get_comment( $comment_id );
if ( empty( $comment->comment_ID ) ) {
wp_die( -1 );
}
ob_start();
$wp_list_table->single_row( $comment );
$comment_list_item = ob_get_clean();
$x = new WP_Ajax_Response();
$x->add(
array(
'what' => 'edit_comment',
'id' => $comment->comment_ID,
'data' => $comment_list_item,
'position' => $position,
)
);
$x->send();
}
```
| Uses | Description |
| --- | --- |
| [WP\_List\_Table::single\_row()](../classes/wp_list_table/single_row) wp-admin/includes/class-wp-list-table.php | Generates content for a single row of the table. |
| [\_get\_list\_table()](_get_list_table) wp-admin/includes/list-table.php | Fetches an instance of a [WP\_List\_Table](../classes/wp_list_table) class. |
| [edit\_comment()](edit_comment) wp-admin/includes/comment.php | Updates a comment with values provided in $\_POST. |
| [WP\_Ajax\_Response::\_\_construct()](../classes/wp_ajax_response/__construct) wp-includes/class-wp-ajax-response.php | Constructor – Passes args to [WP\_Ajax\_Response::add()](../classes/wp_ajax_response/add). |
| [current\_user\_can()](current_user_can) wp-includes/capabilities.php | Returns whether the current user has the specified capability. |
| [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. |
| [check\_ajax\_referer()](check_ajax_referer) wp-includes/pluggable.php | Verifies the Ajax request to prevent processing requests external of the blog. |
| [wp\_die()](wp_die) wp-includes/functions.php | Kills WordPress execution and displays HTML page with an error message. |
| [get\_comment()](get_comment) wp-includes/comment.php | Retrieves comment data given a comment ID or comment object. |
| [is\_wp\_error()](is_wp_error) wp-includes/load.php | Checks whether the given variable is a WordPress Error. |
| Version | Description |
| --- | --- |
| [3.1.0](https://developer.wordpress.org/reference/since/3.1.0/) | Introduced. |
wordpress wp_image_file_matches_image_meta( string $image_location, array $image_meta, int $attachment_id ): bool wp\_image\_file\_matches\_image\_meta( string $image\_location, array $image\_meta, int $attachment\_id ): bool
===============================================================================================================
Determines if the image meta data is for the image source file.
The image meta data is retrieved by attachment post ID. In some cases the post IDs may change.
For example when the website is exported and imported at another website. Then the attachment post IDs that are in post\_content for the exported website may not match the same attachments at the new website.
`$image_location` string Required The full path or URI to the image file. `$image_meta` array Required The attachment meta data as returned by '[wp\_get\_attachment\_metadata()](wp_get_attachment_metadata) '. `$attachment_id` int Optional The image attachment ID. Default 0. bool Whether the image meta is for this image file.
File: `wp-includes/media.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/media.php/)
```
function wp_image_file_matches_image_meta( $image_location, $image_meta, $attachment_id = 0 ) {
$match = false;
// Ensure the $image_meta is valid.
if ( isset( $image_meta['file'] ) && strlen( $image_meta['file'] ) > 4 ) {
// Remove query args in image URI.
list( $image_location ) = explode( '?', $image_location );
// Check if the relative image path from the image meta is at the end of $image_location.
if ( strrpos( $image_location, $image_meta['file'] ) === strlen( $image_location ) - strlen( $image_meta['file'] ) ) {
$match = true;
} else {
// Retrieve the uploads sub-directory from the full size image.
$dirname = _wp_get_attachment_relative_path( $image_meta['file'] );
if ( $dirname ) {
$dirname = trailingslashit( $dirname );
}
if ( ! empty( $image_meta['original_image'] ) ) {
$relative_path = $dirname . $image_meta['original_image'];
if ( strrpos( $image_location, $relative_path ) === strlen( $image_location ) - strlen( $relative_path ) ) {
$match = true;
}
}
if ( ! $match && ! empty( $image_meta['sizes'] ) ) {
foreach ( $image_meta['sizes'] as $image_size_data ) {
$relative_path = $dirname . $image_size_data['file'];
if ( strrpos( $image_location, $relative_path ) === strlen( $image_location ) - strlen( $relative_path ) ) {
$match = true;
break;
}
}
}
}
}
/**
* Filters whether an image path or URI matches image meta.
*
* @since 5.5.0
*
* @param bool $match Whether the image relative path from the image meta
* matches the end of the URI or path to the image file.
* @param string $image_location Full path or URI to the tested image file.
* @param array $image_meta The image meta data as returned by 'wp_get_attachment_metadata()'.
* @param int $attachment_id The image attachment ID or 0 if not supplied.
*/
return apply_filters( 'wp_image_file_matches_image_meta', $match, $image_location, $image_meta, $attachment_id );
}
```
[apply\_filters( 'wp\_image\_file\_matches\_image\_meta', bool $match, string $image\_location, array $image\_meta, int $attachment\_id )](../hooks/wp_image_file_matches_image_meta)
Filters whether an image path or URI matches image meta.
| Uses | Description |
| --- | --- |
| [\_wp\_get\_attachment\_relative\_path()](_wp_get_attachment_relative_path) wp-includes/media.php | Gets the attachment path relative to the upload directory. |
| [trailingslashit()](trailingslashit) wp-includes/formatting.php | Appends a trailing slash. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| Used By | Description |
| --- | --- |
| [WP\_REST\_Attachments\_Controller::edit\_media\_item()](../classes/wp_rest_attachments_controller/edit_media_item) wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php | Applies edits to a media item and creates a new attachment record. |
| Version | Description |
| --- | --- |
| [5.5.0](https://developer.wordpress.org/reference/since/5.5.0/) | Introduced. |
| programming_docs |
wordpress wp_playlist_scripts( string $type ) wp\_playlist\_scripts( string $type )
=====================================
Outputs and enqueues default scripts and styles for playlists.
`$type` string Required Type of playlist. Accepts `'audio'` or `'video'`. File: `wp-includes/media.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/media.php/)
```
function wp_playlist_scripts( $type ) {
wp_enqueue_style( 'wp-mediaelement' );
wp_enqueue_script( 'wp-playlist' );
?>
<!--[if lt IE 9]><script>document.createElement('<?php echo esc_js( $type ); ?>');</script><![endif]-->
<?php
add_action( 'wp_footer', 'wp_underscore_playlist_templates', 0 );
add_action( 'admin_footer', 'wp_underscore_playlist_templates', 0 );
}
```
| Uses | Description |
| --- | --- |
| [esc\_js()](esc_js) wp-includes/formatting.php | Escapes single quotes, `"`, , `&`, and fixes line endings. |
| [wp\_enqueue\_script()](wp_enqueue_script) wp-includes/functions.wp-scripts.php | Enqueue a script. |
| [wp\_enqueue\_style()](wp_enqueue_style) wp-includes/functions.wp-styles.php | Enqueue a CSS stylesheet. |
| [add\_action()](add_action) wp-includes/plugin.php | Adds a callback function to an action hook. |
| Used By | Description |
| --- | --- |
| [WP\_Widget\_Text::enqueue\_preview\_scripts()](../classes/wp_widget_text/enqueue_preview_scripts) wp-includes/widgets/class-wp-widget-text.php | Enqueue preview scripts. |
| Version | Description |
| --- | --- |
| [3.9.0](https://developer.wordpress.org/reference/since/3.9.0/) | Introduced. |
wordpress rest_handle_deprecated_function( string $function, string $replacement, string $version ) rest\_handle\_deprecated\_function( string $function, string $replacement, string $version )
============================================================================================
Handles [\_deprecated\_function()](_deprecated_function) errors.
`$function` string Required The function that was called. `$replacement` string Required The function that should have been called. `$version` string Required Version. File: `wp-includes/rest-api.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/rest-api.php/)
```
function rest_handle_deprecated_function( $function, $replacement, $version ) {
if ( ! WP_DEBUG || headers_sent() ) {
return;
}
if ( ! empty( $replacement ) ) {
/* translators: 1: Function name, 2: WordPress version number, 3: New function name. */
$string = sprintf( __( '%1$s (since %2$s; use %3$s instead)' ), $function, $version, $replacement );
} else {
/* translators: 1: Function name, 2: WordPress version number. */
$string = sprintf( __( '%1$s (since %2$s; no alternative available)' ), $function, $version );
}
header( sprintf( 'X-WP-DeprecatedFunction: %s', $string ) );
}
```
| Uses | Description |
| --- | --- |
| [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. |
| Version | Description |
| --- | --- |
| [4.4.0](https://developer.wordpress.org/reference/since/4.4.0/) | Introduced. |
wordpress trackback_rdf( int|string $deprecated = '' ) trackback\_rdf( int|string $deprecated = '' )
=============================================
Generates and displays the RDF for the trackback information of current post.
Deprecated in 3.0.0, and restored in 3.0.1.
`$deprecated` int|string Optional Not used (Was $timezone = 0). Default: `''`
File: `wp-includes/comment-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/comment-template.php/)
```
function trackback_rdf( $deprecated = '' ) {
if ( ! empty( $deprecated ) ) {
_deprecated_argument( __FUNCTION__, '2.5.0' );
}
if ( isset( $_SERVER['HTTP_USER_AGENT'] ) && false !== stripos( $_SERVER['HTTP_USER_AGENT'], 'W3C_Validator' ) ) {
return;
}
echo '<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">
<rdf:Description rdf:about="';
the_permalink();
echo '"' . "\n";
echo ' dc:identifier="';
the_permalink();
echo '"' . "\n";
echo ' dc:title="' . str_replace( '--', '--', wptexturize( strip_tags( get_the_title() ) ) ) . '"' . "\n";
echo ' trackback:ping="' . get_trackback_url() . '"' . " />\n";
echo '</rdf:RDF>';
}
```
| Uses | Description |
| --- | --- |
| [stripos()](stripos) wp-includes/class-pop3.php | |
| [wptexturize()](wptexturize) wp-includes/formatting.php | Replaces common plain text characters with formatted entities. |
| [the\_permalink()](the_permalink) wp-includes/link-template.php | Displays the permalink for the current post. |
| [get\_the\_title()](get_the_title) wp-includes/post-template.php | Retrieves the post title. |
| [get\_trackback\_url()](get_trackback_url) wp-includes/comment-template.php | Retrieves the current post’s trackback URL. |
| [\_deprecated\_argument()](_deprecated_argument) wp-includes/functions.php | Marks a function argument as deprecated and inform when it has been used. |
| Version | Description |
| --- | --- |
| [0.71](https://developer.wordpress.org/reference/since/0.71/) | Introduced. |
wordpress get_object_term_cache( int $id, string $taxonomy ): bool|WP_Term[]|WP_Error get\_object\_term\_cache( int $id, string $taxonomy ): bool|WP\_Term[]|WP\_Error
================================================================================
Retrieves the cached term objects for the given object ID.
Upstream functions (like [get\_the\_terms()](get_the_terms) and [is\_object\_in\_term()](is_object_in_term) ) are responsible for populating the object-term relationship cache. The current function only fetches relationship data that is already in the cache.
`$id` int Required Term object ID, for example a post, comment, or user ID. `$taxonomy` string Required Taxonomy name. bool|[WP\_Term](../classes/wp_term)[]|[WP\_Error](../classes/wp_error) Array of `WP_Term` objects, if cached.
False if cache is empty for `$taxonomy` and `$id`.
[WP\_Error](../classes/wp_error) if [get\_term()](get_term) returns an error object for any term.
File: `wp-includes/taxonomy.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/taxonomy.php/)
```
function get_object_term_cache( $id, $taxonomy ) {
$_term_ids = wp_cache_get( $id, "{$taxonomy}_relationships" );
// We leave the priming of relationship caches to upstream functions.
if ( false === $_term_ids ) {
return false;
}
// Backward compatibility for if a plugin is putting objects into the cache, rather than IDs.
$term_ids = array();
foreach ( $_term_ids as $term_id ) {
if ( is_numeric( $term_id ) ) {
$term_ids[] = (int) $term_id;
} elseif ( isset( $term_id->term_id ) ) {
$term_ids[] = (int) $term_id->term_id;
}
}
// Fill the term objects.
_prime_term_caches( $term_ids );
$terms = array();
foreach ( $term_ids as $term_id ) {
$term = get_term( $term_id, $taxonomy );
if ( is_wp_error( $term ) ) {
return $term;
}
$terms[] = $term;
}
return $terms;
}
```
| Uses | Description |
| --- | --- |
| [\_prime\_term\_caches()](_prime_term_caches) wp-includes/taxonomy.php | Adds any terms from the given IDs to the cache that do not already exist in cache. |
| [wp\_cache\_get()](wp_cache_get) wp-includes/cache.php | Retrieves the cache contents from the cache by key and group. |
| [get\_term()](get_term) wp-includes/taxonomy.php | Gets all term data from database by term ID. |
| [is\_wp\_error()](is_wp_error) wp-includes/load.php | Checks whether the given variable is a WordPress Error. |
| Used By | Description |
| --- | --- |
| [wp\_queue\_posts\_for\_term\_meta\_lazyload()](wp_queue_posts_for_term_meta_lazyload) wp-includes/post.php | Queues posts for lazy-loading of term meta. |
| [get\_terms\_to\_edit()](get_terms_to_edit) wp-admin/includes/taxonomy.php | Gets comma-separated list of terms available to edit for the given post ID. |
| [get\_inline\_data()](get_inline_data) wp-admin/includes/template.php | Adds hidden fields with the data for use in the inline editor for posts and pages. |
| [get\_attachment\_fields\_to\_edit()](get_attachment_fields_to_edit) wp-admin/includes/media.php | Retrieves the attachment fields to edit form fields. |
| [get\_compat\_media\_markup()](get_compat_media_markup) wp-admin/includes/media.php | |
| [get\_the\_terms()](get_the_terms) wp-includes/category-template.php | Retrieves the terms of the taxonomy that are attached to the post. |
| [get\_the\_taxonomies()](get_the_taxonomies) wp-includes/taxonomy.php | Retrieves all taxonomies associated with a post. |
| [is\_object\_in\_term()](is_object_in_term) wp-includes/taxonomy.php | Determines if the given object is associated with any of the given terms. |
| Version | Description |
| --- | --- |
| [4.7.0](https://developer.wordpress.org/reference/since/4.7.0/) | Returns a `WP_Error` object if there's an error with any of the matched terms. |
| [2.3.0](https://developer.wordpress.org/reference/since/2.3.0/) | Introduced. |
wordpress wp_check_php_version(): array|false wp\_check\_php\_version(): array|false
======================================
Checks if the user needs to update PHP.
array|false Array of PHP version data. False on failure.
File: `wp-admin/includes/misc.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/misc.php/)
```
function wp_check_php_version() {
$version = PHP_VERSION;
$key = md5( $version );
$response = get_site_transient( 'php_check_' . $key );
if ( false === $response ) {
$url = 'http://api.wordpress.org/core/serve-happy/1.0/';
if ( wp_http_supports( array( 'ssl' ) ) ) {
$url = set_url_scheme( $url, 'https' );
}
$url = add_query_arg( 'php_version', $version, $url );
$response = wp_remote_get( $url );
if ( is_wp_error( $response ) || 200 !== wp_remote_retrieve_response_code( $response ) ) {
return false;
}
/**
* Response should be an array with:
* 'recommended_version' - string - The PHP version recommended by WordPress.
* 'is_supported' - boolean - Whether the PHP version is actively supported.
* 'is_secure' - boolean - Whether the PHP version receives security updates.
* 'is_acceptable' - boolean - Whether the PHP version is still acceptable or warnings
* should be shown and an update recommended.
*/
$response = json_decode( wp_remote_retrieve_body( $response ), true );
if ( ! is_array( $response ) ) {
return false;
}
set_site_transient( 'php_check_' . $key, $response, WEEK_IN_SECONDS );
}
if ( isset( $response['is_acceptable'] ) && $response['is_acceptable'] ) {
/**
* Filters whether the active PHP version is considered acceptable by WordPress.
*
* Returning false will trigger a PHP version warning to show up in the admin dashboard to administrators.
*
* This filter is only run if the wordpress.org Serve Happy API considers the PHP version acceptable, ensuring
* that this filter can only make this check stricter, but not loosen it.
*
* @since 5.1.1
*
* @param bool $is_acceptable Whether the PHP version is considered acceptable. Default true.
* @param string $version PHP version checked.
*/
$response['is_acceptable'] = (bool) apply_filters( 'wp_is_php_version_acceptable', true, $version );
}
$response['is_lower_than_future_minimum'] = false;
// The minimum supported PHP version will be updated to 7.2. Check if the current version is lower.
if ( version_compare( $version, '7.2', '<' ) ) {
$response['is_lower_than_future_minimum'] = true;
// Force showing of warnings.
$response['is_acceptable'] = false;
}
return $response;
}
```
[apply\_filters( 'wp\_is\_php\_version\_acceptable', bool $is\_acceptable, string $version )](../hooks/wp_is_php_version_acceptable)
Filters whether the active PHP version is considered acceptable by WordPress.
| Uses | Description |
| --- | --- |
| [set\_url\_scheme()](set_url_scheme) wp-includes/link-template.php | Sets the scheme for a URL. |
| [wp\_http\_supports()](wp_http_supports) wp-includes/http.php | Determines if there is an HTTP Transport that can process this request. |
| [wp\_remote\_get()](wp_remote_get) wp-includes/http.php | Performs an HTTP request using the GET method and returns its response. |
| [wp\_remote\_retrieve\_response\_code()](wp_remote_retrieve_response_code) wp-includes/http.php | Retrieve only the response code from the raw response. |
| [wp\_remote\_retrieve\_body()](wp_remote_retrieve_body) wp-includes/http.php | Retrieve only the body from the raw response. |
| [set\_site\_transient()](set_site_transient) wp-includes/option.php | Sets/updates the value of a site transient. |
| [get\_site\_transient()](get_site_transient) wp-includes/option.php | Retrieves the value of a site transient. |
| [add\_query\_arg()](add_query_arg) wp-includes/functions.php | Retrieves a modified URL query string. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| [is\_wp\_error()](is_wp_error) wp-includes/load.php | Checks whether the given variable is a WordPress Error. |
| Used By | Description |
| --- | --- |
| [WP\_Site\_Health::get\_test\_php\_version()](../classes/wp_site_health/get_test_php_version) wp-admin/includes/class-wp-site-health.php | Tests if the supplied PHP version is supported. |
| [wp\_dashboard\_php\_nag()](wp_dashboard_php_nag) wp-admin/includes/dashboard.php | Displays the PHP update nag. |
| [dashboard\_php\_nag\_class()](dashboard_php_nag_class) wp-admin/includes/dashboard.php | Adds an additional class to the PHP nag if the current version is insecure. |
| [wp\_dashboard\_setup()](wp_dashboard_setup) wp-admin/includes/dashboard.php | Registers dashboard widgets. |
| Version | Description |
| --- | --- |
| [5.1.1](https://developer.wordpress.org/reference/since/5.1.1/) | Added the ['wp\_is\_php\_version\_acceptable'](../hooks/wp_is_php_version_acceptable) filter. |
| [5.1.0](https://developer.wordpress.org/reference/since/5.1.0/) | Introduced. |
wordpress comments_link( string $deprecated = '', string $deprecated_2 = '' ) comments\_link( string $deprecated = '', string $deprecated\_2 = '' )
=====================================================================
Displays the link to the current post comments.
`$deprecated` string Optional Not Used. Default: `''`
`$deprecated_2` string Optional Not Used. Default: `''`
File: `wp-includes/comment-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/comment-template.php/)
```
function comments_link( $deprecated = '', $deprecated_2 = '' ) {
if ( ! empty( $deprecated ) ) {
_deprecated_argument( __FUNCTION__, '0.72' );
}
if ( ! empty( $deprecated_2 ) ) {
_deprecated_argument( __FUNCTION__, '1.3.0' );
}
echo esc_url( get_comments_link() );
}
```
| Uses | Description |
| --- | --- |
| [get\_comments\_link()](get_comments_link) wp-includes/comment-template.php | Retrieves the link to the current post comments. |
| [esc\_url()](esc_url) wp-includes/formatting.php | Checks and cleans a URL. |
| [\_deprecated\_argument()](_deprecated_argument) wp-includes/functions.php | Marks a function argument as deprecated and inform when it has been used. |
| Used By | Description |
| --- | --- |
| [print\_embed\_comments\_button()](print_embed_comments_button) wp-includes/embed.php | Prints the necessary markup for the embed comments button. |
| [comments\_popup\_link()](comments_popup_link) wp-includes/comment-template.php | Displays the link to the comments for the current post ID. |
| Version | Description |
| --- | --- |
| [0.71](https://developer.wordpress.org/reference/since/0.71/) | Introduced. |
wordpress add_metadata( string $meta_type, int $object_id, string $meta_key, mixed $meta_value, bool $unique = false ): int|false add\_metadata( string $meta\_type, int $object\_id, string $meta\_key, mixed $meta\_value, bool $unique = false ): int|false
============================================================================================================================
Adds metadata for the specified object.
`$meta_type` string Required Type of object metadata is for. Accepts `'post'`, `'comment'`, `'term'`, `'user'`, or any other object type with an associated meta table. `$object_id` int Required ID of the object metadata is for. `$meta_key` string Required Metadata key. `$meta_value` mixed Required Metadata value. Must be serializable if non-scalar. `$unique` bool Optional Whether the specified metadata key should be unique for the object.
If true, and the object already has a value for the specified metadata key, no change will be made. Default: `false`
int|false The meta ID on success, false on failure.
File: `wp-includes/meta.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/meta.php/)
```
function add_metadata( $meta_type, $object_id, $meta_key, $meta_value, $unique = false ) {
global $wpdb;
if ( ! $meta_type || ! $meta_key || ! is_numeric( $object_id ) ) {
return false;
}
$object_id = absint( $object_id );
if ( ! $object_id ) {
return false;
}
$table = _get_meta_table( $meta_type );
if ( ! $table ) {
return false;
}
$meta_subtype = get_object_subtype( $meta_type, $object_id );
$column = sanitize_key( $meta_type . '_id' );
// expected_slashed ($meta_key)
$meta_key = wp_unslash( $meta_key );
$meta_value = wp_unslash( $meta_value );
$meta_value = sanitize_meta( $meta_key, $meta_value, $meta_type, $meta_subtype );
/**
* Short-circuits adding metadata of a specific type.
*
* The dynamic portion of the hook name, `$meta_type`, refers to the meta object type
* (post, comment, term, user, or any other type with an associated meta table).
* Returning a non-null value will effectively short-circuit the function.
*
* Possible hook names include:
*
* - `add_post_metadata`
* - `add_comment_metadata`
* - `add_term_metadata`
* - `add_user_metadata`
*
* @since 3.1.0
*
* @param null|bool $check Whether to allow adding metadata for the given type.
* @param int $object_id ID of the object metadata is for.
* @param string $meta_key Metadata key.
* @param mixed $meta_value Metadata value. Must be serializable if non-scalar.
* @param bool $unique Whether the specified meta key should be unique for the object.
*/
$check = apply_filters( "add_{$meta_type}_metadata", null, $object_id, $meta_key, $meta_value, $unique );
if ( null !== $check ) {
return $check;
}
if ( $unique && $wpdb->get_var(
$wpdb->prepare(
"SELECT COUNT(*) FROM $table WHERE meta_key = %s AND $column = %d",
$meta_key,
$object_id
)
) ) {
return false;
}
$_meta_value = $meta_value;
$meta_value = maybe_serialize( $meta_value );
/**
* Fires immediately before meta of a specific type is added.
*
* The dynamic portion of the hook name, `$meta_type`, refers to the meta object type
* (post, comment, term, user, or any other type with an associated meta table).
*
* Possible hook names include:
*
* - `add_post_meta`
* - `add_comment_meta`
* - `add_term_meta`
* - `add_user_meta`
*
* @since 3.1.0
*
* @param int $object_id ID of the object metadata is for.
* @param string $meta_key Metadata key.
* @param mixed $_meta_value Metadata value.
*/
do_action( "add_{$meta_type}_meta", $object_id, $meta_key, $_meta_value );
$result = $wpdb->insert(
$table,
array(
$column => $object_id,
'meta_key' => $meta_key,
'meta_value' => $meta_value,
)
);
if ( ! $result ) {
return false;
}
$mid = (int) $wpdb->insert_id;
wp_cache_delete( $object_id, $meta_type . '_meta' );
/**
* Fires immediately after meta of a specific type is added.
*
* The dynamic portion of the hook name, `$meta_type`, refers to the meta object type
* (post, comment, term, user, or any other type with an associated meta table).
*
* Possible hook names include:
*
* - `added_post_meta`
* - `added_comment_meta`
* - `added_term_meta`
* - `added_user_meta`
*
* @since 2.9.0
*
* @param int $mid The meta ID after successful update.
* @param int $object_id ID of the object metadata is for.
* @param string $meta_key Metadata key.
* @param mixed $_meta_value Metadata value.
*/
do_action( "added_{$meta_type}_meta", $mid, $object_id, $meta_key, $_meta_value );
return $mid;
}
```
[do\_action( "added\_{$meta\_type}\_meta", int $mid, int $object\_id, string $meta\_key, mixed $\_meta\_value )](../hooks/added_meta_type_meta)
Fires immediately after meta of a specific type is added.
[do\_action( "add\_{$meta\_type}\_meta", int $object\_id, string $meta\_key, mixed $\_meta\_value )](../hooks/add_meta_type_meta)
Fires immediately before meta of a specific type is added.
[apply\_filters( "add\_{$meta\_type}\_metadata", null|bool $check, int $object\_id, string $meta\_key, mixed $meta\_value, bool $unique )](../hooks/add_meta_type_metadata)
Short-circuits adding metadata of a specific type.
| Uses | Description |
| --- | --- |
| [get\_object\_subtype()](get_object_subtype) wp-includes/meta.php | Returns the object subtype for a given object ID of a specific type. |
| [wp\_cache\_delete()](wp_cache_delete) wp-includes/cache.php | Removes the cache contents matching key and group. |
| [maybe\_serialize()](maybe_serialize) wp-includes/functions.php | Serializes data, if needed. |
| [wpdb::insert()](../classes/wpdb/insert) wp-includes/class-wpdb.php | Inserts a row into the table. |
| [\_get\_meta\_table()](_get_meta_table) wp-includes/meta.php | Retrieves the name of the metadata table for the specified object type. |
| [sanitize\_meta()](sanitize_meta) wp-includes/meta.php | Sanitizes meta value. |
| [wp\_unslash()](wp_unslash) wp-includes/formatting.php | Removes slashes from a string or recursively removes slashes from strings within an array. |
| [sanitize\_key()](sanitize_key) wp-includes/formatting.php | Sanitizes a string key. |
| [absint()](absint) wp-includes/functions.php | Converts a value to non-negative integer. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| [do\_action()](do_action) wp-includes/plugin.php | Calls the callback functions that have been added to an action hook. |
| [wpdb::get\_var()](../classes/wpdb/get_var) wp-includes/class-wpdb.php | Retrieves one variable from the database. |
| [wpdb::prepare()](../classes/wpdb/prepare) wp-includes/class-wpdb.php | Prepares a SQL query for safe execution. |
| Used By | Description |
| --- | --- |
| [add\_site\_meta()](add_site_meta) wp-includes/ms-site.php | Adds metadata to a site. |
| [WP\_REST\_Meta\_Fields::update\_multi\_meta\_value()](../classes/wp_rest_meta_fields/update_multi_meta_value) wp-includes/rest-api/fields/class-wp-rest-meta-fields.php | Updates multiple meta values for an object. |
| [add\_term\_meta()](add_term_meta) wp-includes/taxonomy.php | Adds metadata to a term. |
| [add\_user\_meta()](add_user_meta) wp-includes/user.php | Adds meta data to a user. |
| [add\_post\_meta()](add_post_meta) wp-includes/post.php | Adds a meta field to the given post. |
| [add\_comment\_meta()](add_comment_meta) wp-includes/comment.php | Adds meta data field to a comment. |
| [update\_metadata()](update_metadata) wp-includes/meta.php | Updates metadata for the specified object. If no value already exists for the specified object ID and metadata key, the metadata will be added. |
| Version | Description |
| --- | --- |
| [2.9.0](https://developer.wordpress.org/reference/since/2.9.0/) | Introduced. |
| programming_docs |
wordpress is_user_admin(): bool is\_user\_admin(): bool
=======================
Determines whether the current request is for a user admin screen.
e.g. `/wp-admin/user/`
Does not check if the user is an administrator; use [current\_user\_can()](current_user_can) for checking roles and capabilities.
bool True if inside WordPress user administration pages.
File: `wp-includes/load.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/load.php/)
```
function is_user_admin() {
if ( isset( $GLOBALS['current_screen'] ) ) {
return $GLOBALS['current_screen']->in_admin( 'user' );
} elseif ( defined( 'WP_USER_ADMIN' ) ) {
return WP_USER_ADMIN;
}
return false;
}
```
| Used By | Description |
| --- | --- |
| [wp\_dashboard\_right\_now()](wp_dashboard_right_now) wp-admin/includes/dashboard.php | Dashboard widget that displays some basic stats about the site. |
| [wp\_dashboard\_setup()](wp_dashboard_setup) wp-admin/includes/dashboard.php | Registers dashboard widgets. |
| [self\_admin\_url()](self_admin_url) wp-includes/link-template.php | Retrieves the URL to the admin area for either the current site or the network depending on context. |
| [get\_edit\_profile\_url()](get_edit_profile_url) wp-includes/link-template.php | Retrieves the URL to the user’s profile editor. |
| [WP\_Admin\_Bar::add\_menus()](../classes/wp_admin_bar/add_menus) wp-includes/class-wp-admin-bar.php | Adds menus to the admin bar. |
| [wp\_admin\_bar\_site\_menu()](wp_admin_bar_site_menu) wp-includes/admin-bar.php | Adds the “Site Name” menu. |
| Version | Description |
| --- | --- |
| [3.1.0](https://developer.wordpress.org/reference/since/3.1.0/) | Introduced. |
wordpress print_emoji_styles() print\_emoji\_styles()
======================
Prints the important emoji-related styles.
File: `wp-includes/formatting.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/formatting.php/)
```
function print_emoji_styles() {
static $printed = false;
if ( $printed ) {
return;
}
$printed = true;
$type_attr = current_theme_supports( 'html5', 'style' ) ? '' : ' type="text/css"';
?>
<style<?php echo $type_attr; ?>>
img.wp-smiley,
img.emoji {
display: inline !important;
border: none !important;
box-shadow: none !important;
height: 1em !important;
width: 1em !important;
margin: 0 0.07em !important;
vertical-align: -0.1em !important;
background: none !important;
padding: 0 !important;
}
</style>
<?php
}
```
| Uses | Description |
| --- | --- |
| [current\_theme\_supports()](current_theme_supports) wp-includes/theme.php | Checks a theme’s support for a given feature. |
| Version | Description |
| --- | --- |
| [4.2.0](https://developer.wordpress.org/reference/since/4.2.0/) | Introduced. |
wordpress wp_create_post_autosave( array|int $post_data ): int|WP_Error wp\_create\_post\_autosave( array|int $post\_data ): int|WP\_Error
==================================================================
Creates autosave data for the specified post from `$_POST` data.
`$post_data` array|int Required Associative array containing the post data, or integer post ID.
If a numeric post ID is provided, will use the `$_POST` superglobal. int|[WP\_Error](../classes/wp_error) The autosave revision ID. [WP\_Error](../classes/wp_error) or 0 on error.
File: `wp-admin/includes/post.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/post.php/)
```
function wp_create_post_autosave( $post_data ) {
if ( is_numeric( $post_data ) ) {
$post_id = $post_data;
$post_data = $_POST;
} else {
$post_id = (int) $post_data['post_ID'];
}
$post_data = _wp_translate_postdata( true, $post_data );
if ( is_wp_error( $post_data ) ) {
return $post_data;
}
$post_data = _wp_get_allowed_postdata( $post_data );
$post_author = get_current_user_id();
// Store one autosave per author. If there is already an autosave, overwrite it.
$old_autosave = wp_get_post_autosave( $post_id, $post_author );
if ( $old_autosave ) {
$new_autosave = _wp_post_revision_data( $post_data, true );
$new_autosave['ID'] = $old_autosave->ID;
$new_autosave['post_author'] = $post_author;
$post = get_post( $post_id );
// If the new autosave has the same content as the post, delete the autosave.
$autosave_is_different = false;
foreach ( array_intersect( array_keys( $new_autosave ), array_keys( _wp_post_revision_fields( $post ) ) ) as $field ) {
if ( normalize_whitespace( $new_autosave[ $field ] ) !== normalize_whitespace( $post->$field ) ) {
$autosave_is_different = true;
break;
}
}
if ( ! $autosave_is_different ) {
wp_delete_post_revision( $old_autosave->ID );
return 0;
}
/**
* Fires before an autosave is stored.
*
* @since 4.1.0
*
* @param array $new_autosave Post array - the autosave that is about to be saved.
*/
do_action( 'wp_creating_autosave', $new_autosave );
return wp_update_post( $new_autosave );
}
// _wp_put_post_revision() expects unescaped.
$post_data = wp_unslash( $post_data );
// Otherwise create the new autosave as a special post revision.
return _wp_put_post_revision( $post_data, true );
}
```
[do\_action( 'wp\_creating\_autosave', array $new\_autosave )](../hooks/wp_creating_autosave)
Fires before an autosave is stored.
| Uses | Description |
| --- | --- |
| [\_wp\_get\_allowed\_postdata()](_wp_get_allowed_postdata) wp-admin/includes/post.php | Returns only allowed post data fields. |
| [\_wp\_post\_revision\_data()](_wp_post_revision_data) wp-includes/revision.php | Returns a post array ready to be inserted into the posts table as a post revision. |
| [\_wp\_translate\_postdata()](_wp_translate_postdata) wp-admin/includes/post.php | Renames `$_POST` data from form names to DB post columns. |
| [normalize\_whitespace()](normalize_whitespace) wp-includes/formatting.php | Normalizes EOL characters and strips duplicate whitespace. |
| [wp\_update\_post()](wp_update_post) wp-includes/post.php | Updates a post with new post data. |
| [wp\_delete\_post\_revision()](wp_delete_post_revision) wp-includes/revision.php | Deletes a revision. |
| [\_wp\_put\_post\_revision()](_wp_put_post_revision) wp-includes/revision.php | Inserts post data into the posts table as a post revision. |
| [wp\_get\_post\_autosave()](wp_get_post_autosave) wp-includes/revision.php | Retrieves the autosaved data of the specified post. |
| [\_wp\_post\_revision\_fields()](_wp_post_revision_fields) wp-includes/revision.php | Determines which fields of posts are to be saved in revisions. |
| [wp\_unslash()](wp_unslash) wp-includes/formatting.php | Removes slashes from a string or recursively removes slashes from strings within an array. |
| [do\_action()](do_action) wp-includes/plugin.php | Calls the callback functions that have been added to an action hook. |
| [get\_current\_user\_id()](get_current_user_id) wp-includes/user.php | Gets the current user’s ID. |
| [get\_post()](get_post) wp-includes/post.php | Retrieves post data given a post ID or post object. |
| [is\_wp\_error()](is_wp_error) wp-includes/load.php | Checks whether the given variable is a WordPress Error. |
| Used By | Description |
| --- | --- |
| [WP\_Customize\_Manager::save\_changeset\_post()](../classes/wp_customize_manager/save_changeset_post) wp-includes/class-wp-customize-manager.php | Saves the post for the loaded changeset. |
| [post\_preview()](post_preview) wp-admin/includes/post.php | Saves a draft or manually autosaves for the purpose of showing a post preview. |
| [wp\_autosave()](wp_autosave) wp-admin/includes/post.php | Saves a post submitted with XHR. |
| Version | Description |
| --- | --- |
| [2.6.0](https://developer.wordpress.org/reference/since/2.6.0/) | Introduced. |
wordpress rest_get_avatar_urls( mixed $id_or_email ): (string|false)[] rest\_get\_avatar\_urls( mixed $id\_or\_email ): (string|false)[]
=================================================================
Retrieves the avatar urls in various sizes.
* [get\_avatar\_url()](get_avatar_url)
`$id_or_email` mixed Required The Gravatar to retrieve a URL for. Accepts a user\_id, gravatar md5 hash, user email, [WP\_User](../classes/wp_user) object, [WP\_Post](../classes/wp_post) object, or [WP\_Comment](../classes/wp_comment) object. (string|false)[] Avatar URLs keyed by size. Each value can be a URL string or boolean false.
File: `wp-includes/rest-api.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/rest-api.php/)
```
function rest_get_avatar_urls( $id_or_email ) {
$avatar_sizes = rest_get_avatar_sizes();
$urls = array();
foreach ( $avatar_sizes as $size ) {
$urls[ $size ] = get_avatar_url( $id_or_email, array( 'size' => $size ) );
}
return $urls;
}
```
| Uses | Description |
| --- | --- |
| [rest\_get\_avatar\_sizes()](rest_get_avatar_sizes) wp-includes/rest-api.php | Retrieves the pixel sizes for avatars. |
| [get\_avatar\_url()](get_avatar_url) wp-includes/link-template.php | Retrieves the avatar URL. |
| Used By | Description |
| --- | --- |
| [WP\_REST\_Users\_Controller::prepare\_item\_for\_response()](../classes/wp_rest_users_controller/prepare_item_for_response) wp-includes/rest-api/endpoints/class-wp-rest-users-controller.php | Prepares a single user output for response. |
| [WP\_REST\_Comments\_Controller::prepare\_item\_for\_response()](../classes/wp_rest_comments_controller/prepare_item_for_response) wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php | Prepares a single comment output for response. |
| Version | Description |
| --- | --- |
| [4.7.0](https://developer.wordpress.org/reference/since/4.7.0/) | Introduced. |
wordpress get_meta_keys(): string[] get\_meta\_keys(): string[]
===========================
Returns a list of previously defined keys.
string[] Array of meta key names.
File: `wp-admin/includes/post.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/post.php/)
```
function get_meta_keys() {
global $wpdb;
$keys = $wpdb->get_col(
"
SELECT meta_key
FROM $wpdb->postmeta
GROUP BY meta_key
ORDER BY meta_key"
);
return $keys;
}
```
| Uses | Description |
| --- | --- |
| [wpdb::get\_col()](../classes/wpdb/get_col) wp-includes/class-wpdb.php | Retrieves one column from the database. |
| Version | Description |
| --- | --- |
| [1.2.0](https://developer.wordpress.org/reference/since/1.2.0/) | Introduced. |
wordpress wp_robots_noindex( array $robots ): array wp\_robots\_noindex( array $robots ): array
===========================================
Adds `noindex` to the robots meta tag if required by the site configuration.
If a blog is marked as not being public then noindex will be output to tell web robots not to index the page content. Add this to the [‘wp\_robots’](../hooks/wp_robots) filter.
Typical usage is as a [‘wp\_robots’](../hooks/wp_robots) callback:
```
add_filter( 'wp_robots', 'wp_robots_noindex' );
```
* [wp\_robots\_no\_robots()](wp_robots_no_robots)
`$robots` array Required Associative array of robots directives. array Filtered robots directives.
File: `wp-includes/robots-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/robots-template.php/)
```
function wp_robots_noindex( array $robots ) {
if ( ! get_option( 'blog_public' ) ) {
return wp_robots_no_robots( $robots );
}
return $robots;
}
```
| Uses | Description |
| --- | --- |
| [wp\_robots\_no\_robots()](wp_robots_no_robots) wp-includes/robots-template.php | Adds `noindex` to the robots meta tag. |
| [get\_option()](get_option) wp-includes/option.php | Retrieves an option value based on an option name. |
| Version | Description |
| --- | --- |
| [5.7.0](https://developer.wordpress.org/reference/since/5.7.0/) | Introduced. |
wordpress wp_filter_comment( array $commentdata ): array wp\_filter\_comment( array $commentdata ): array
================================================
Filters and sanitizes comment data.
Sets the comment data ‘filtered’ field to true when finished. This can be checked as to whether the comment should be filtered and to keep from filtering the same comment more than once.
`$commentdata` array Required Contains information on the comment. array Parsed comment information.
File: `wp-includes/comment.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/comment.php/)
```
function wp_filter_comment( $commentdata ) {
if ( isset( $commentdata['user_ID'] ) ) {
/**
* Filters the comment author's user ID before it is set.
*
* The first time this filter is evaluated, `user_ID` is checked
* (for back-compat), followed by the standard `user_id` value.
*
* @since 1.5.0
*
* @param int $user_id The comment author's user ID.
*/
$commentdata['user_id'] = apply_filters( 'pre_user_id', $commentdata['user_ID'] );
} elseif ( isset( $commentdata['user_id'] ) ) {
/** This filter is documented in wp-includes/comment.php */
$commentdata['user_id'] = apply_filters( 'pre_user_id', $commentdata['user_id'] );
}
/**
* Filters the comment author's browser user agent before it is set.
*
* @since 1.5.0
*
* @param string $comment_agent The comment author's browser user agent.
*/
$commentdata['comment_agent'] = apply_filters( 'pre_comment_user_agent', ( isset( $commentdata['comment_agent'] ) ? $commentdata['comment_agent'] : '' ) );
/** This filter is documented in wp-includes/comment.php */
$commentdata['comment_author'] = apply_filters( 'pre_comment_author_name', $commentdata['comment_author'] );
/**
* Filters the comment content before it is set.
*
* @since 1.5.0
*
* @param string $comment_content The comment content.
*/
$commentdata['comment_content'] = apply_filters( 'pre_comment_content', $commentdata['comment_content'] );
/**
* Filters the comment author's IP address before it is set.
*
* @since 1.5.0
*
* @param string $comment_author_ip The comment author's IP address.
*/
$commentdata['comment_author_IP'] = apply_filters( 'pre_comment_user_ip', $commentdata['comment_author_IP'] );
/** This filter is documented in wp-includes/comment.php */
$commentdata['comment_author_url'] = apply_filters( 'pre_comment_author_url', $commentdata['comment_author_url'] );
/** This filter is documented in wp-includes/comment.php */
$commentdata['comment_author_email'] = apply_filters( 'pre_comment_author_email', $commentdata['comment_author_email'] );
$commentdata['filtered'] = true;
return $commentdata;
}
```
[apply\_filters( 'pre\_comment\_author\_email', string $author\_email\_cookie )](../hooks/pre_comment_author_email)
Filters the comment author’s email cookie before it is set.
[apply\_filters( 'pre\_comment\_author\_name', string $author\_cookie )](../hooks/pre_comment_author_name)
Filters the comment author’s name cookie before it is set.
[apply\_filters( 'pre\_comment\_author\_url', string $author\_url\_cookie )](../hooks/pre_comment_author_url)
Filters the comment author’s URL cookie before it is set.
[apply\_filters( 'pre\_comment\_content', string $comment\_content )](../hooks/pre_comment_content)
Filters the comment content before it is set.
[apply\_filters( 'pre\_comment\_user\_agent', string $comment\_agent )](../hooks/pre_comment_user_agent)
Filters the comment author’s browser user agent before it is set.
[apply\_filters( 'pre\_comment\_user\_ip', string $comment\_author\_ip )](../hooks/pre_comment_user_ip)
Filters the comment author’s IP address before it is set.
[apply\_filters( 'pre\_user\_id', int $user\_id )](../hooks/pre_user_id)
Filters the comment author’s user ID before it is set.
| Uses | Description |
| --- | --- |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| Used By | Description |
| --- | --- |
| [WP\_REST\_Comments\_Controller::create\_item()](../classes/wp_rest_comments_controller/create_item) wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php | Creates a comment. |
| [wp\_new\_comment()](wp_new_comment) wp-includes/comment.php | Adds a new comment to the database. |
| [wp\_update\_comment()](wp_update_comment) wp-includes/comment.php | Updates an existing comment in the database. |
| Version | Description |
| --- | --- |
| [2.0.0](https://developer.wordpress.org/reference/since/2.0.0/) | Introduced. |
wordpress login_header( string $title = 'Log In', string $message = '', WP_Error $wp_error = null ) login\_header( string $title = 'Log In', string $message = '', WP\_Error $wp\_error = null )
============================================================================================
Output the login page header.
`$title` string Optional WordPress login Page title to display in the `<title>` element.
Default: `'Log In'`
`$message` string Optional Message to display in header. Default: `''`
`$wp_error` [WP\_Error](../classes/wp_error) Optional The error to pass. Default is a [WP\_Error](../classes/wp_error) instance. Default: `null`
File: `wp-login.php`. [View all references](https://developer.wordpress.org/reference/files/wp-login.php/)
```
function login_header( $title = 'Log In', $message = '', $wp_error = null ) {
global $error, $interim_login, $action;
// Don't index any of these forms.
add_filter( 'wp_robots', 'wp_robots_sensitive_page' );
add_action( 'login_head', 'wp_strict_cross_origin_referrer' );
add_action( 'login_head', 'wp_login_viewport_meta' );
if ( ! is_wp_error( $wp_error ) ) {
$wp_error = new WP_Error();
}
// Shake it!
$shake_error_codes = array( 'empty_password', 'empty_email', 'invalid_email', 'invalidcombo', 'empty_username', 'invalid_username', 'incorrect_password', 'retrieve_password_email_failure' );
/**
* Filters the error codes array for shaking the login form.
*
* @since 3.0.0
*
* @param string[] $shake_error_codes Error codes that shake the login form.
*/
$shake_error_codes = apply_filters( 'shake_error_codes', $shake_error_codes );
if ( $shake_error_codes && $wp_error->has_errors() && in_array( $wp_error->get_error_code(), $shake_error_codes, true ) ) {
add_action( 'login_footer', 'wp_shake_js', 12 );
}
$login_title = get_bloginfo( 'name', 'display' );
/* translators: Login screen title. 1: Login screen name, 2: Network or site name. */
$login_title = sprintf( __( '%1$s ‹ %2$s — WordPress' ), $title, $login_title );
if ( wp_is_recovery_mode() ) {
/* translators: %s: Login screen title. */
$login_title = sprintf( __( 'Recovery Mode — %s' ), $login_title );
}
/**
* Filters the title tag content for login page.
*
* @since 4.9.0
*
* @param string $login_title The page title, with extra context added.
* @param string $title The original page title.
*/
$login_title = apply_filters( 'login_title', $login_title, $title );
?><!DOCTYPE html>
<html <?php language_attributes(); ?>>
<head>
<meta http-equiv="Content-Type" content="<?php bloginfo( 'html_type' ); ?>; charset=<?php bloginfo( 'charset' ); ?>" />
<title><?php echo $login_title; ?></title>
<?php
wp_enqueue_style( 'login' );
/*
* Remove all stored post data on logging out.
* This could be added by add_action('login_head'...) like wp_shake_js(),
* but maybe better if it's not removable by plugins.
*/
if ( 'loggedout' === $wp_error->get_error_code() ) {
?>
<script>if("sessionStorage" in window){try{for(var key in sessionStorage){if(key.indexOf("wp-autosave-")!=-1){sessionStorage.removeItem(key)}}}catch(e){}};</script>
<?php
}
/**
* Enqueue scripts and styles for the login page.
*
* @since 3.1.0
*/
do_action( 'login_enqueue_scripts' );
/**
* Fires in the login page header after scripts are enqueued.
*
* @since 2.1.0
*/
do_action( 'login_head' );
$login_header_url = __( 'https://wordpress.org/' );
/**
* Filters link URL of the header logo above login form.
*
* @since 2.1.0
*
* @param string $login_header_url Login header logo URL.
*/
$login_header_url = apply_filters( 'login_headerurl', $login_header_url );
$login_header_title = '';
/**
* Filters the title attribute of the header logo above login form.
*
* @since 2.1.0
* @deprecated 5.2.0 Use {@see 'login_headertext'} instead.
*
* @param string $login_header_title Login header logo title attribute.
*/
$login_header_title = apply_filters_deprecated(
'login_headertitle',
array( $login_header_title ),
'5.2.0',
'login_headertext',
__( 'Usage of the title attribute on the login logo is not recommended for accessibility reasons. Use the link text instead.' )
);
$login_header_text = empty( $login_header_title ) ? __( 'Powered by WordPress' ) : $login_header_title;
/**
* Filters the link text of the header logo above the login form.
*
* @since 5.2.0
*
* @param string $login_header_text The login header logo link text.
*/
$login_header_text = apply_filters( 'login_headertext', $login_header_text );
$classes = array( 'login-action-' . $action, 'wp-core-ui' );
if ( is_rtl() ) {
$classes[] = 'rtl';
}
if ( $interim_login ) {
$classes[] = 'interim-login';
?>
<style type="text/css">html{background-color: transparent;}</style>
<?php
if ( 'success' === $interim_login ) {
$classes[] = 'interim-login-success';
}
}
$classes[] = ' locale-' . sanitize_html_class( strtolower( str_replace( '_', '-', get_locale() ) ) );
/**
* Filters the login page body classes.
*
* @since 3.5.0
*
* @param string[] $classes An array of body classes.
* @param string $action The action that brought the visitor to the login page.
*/
$classes = apply_filters( 'login_body_class', $classes, $action );
?>
</head>
<body class="login no-js <?php echo esc_attr( implode( ' ', $classes ) ); ?>">
<script type="text/javascript">
document.body.className = document.body.className.replace('no-js','js');
</script>
<?php
/**
* Fires in the login page header after the body tag is opened.
*
* @since 4.6.0
*/
do_action( 'login_header' );
?>
<div id="login">
<h1><a href="<?php echo esc_url( $login_header_url ); ?>"><?php echo $login_header_text; ?></a></h1>
<?php
/**
* Filters the message to display above the login form.
*
* @since 2.1.0
*
* @param string $message Login message text.
*/
$message = apply_filters( 'login_message', $message );
if ( ! empty( $message ) ) {
echo $message . "\n";
}
// In case a plugin uses $error rather than the $wp_errors object.
if ( ! empty( $error ) ) {
$wp_error->add( 'error', $error );
unset( $error );
}
if ( $wp_error->has_errors() ) {
$errors = '';
$messages = '';
foreach ( $wp_error->get_error_codes() as $code ) {
$severity = $wp_error->get_error_data( $code );
foreach ( $wp_error->get_error_messages( $code ) as $error_message ) {
if ( 'message' === $severity ) {
$messages .= ' ' . $error_message . "<br />\n";
} else {
$errors .= ' ' . $error_message . "<br />\n";
}
}
}
if ( ! empty( $errors ) ) {
/**
* Filters the error messages displayed above the login form.
*
* @since 2.1.0
*
* @param string $errors Login error message.
*/
echo '<div id="login_error">' . apply_filters( 'login_errors', $errors ) . "</div>\n";
}
if ( ! empty( $messages ) ) {
/**
* Filters instructional messages displayed above the login form.
*
* @since 2.5.0
*
* @param string $messages Login messages.
*/
echo '<p class="message" id="login-message">' . apply_filters( 'login_messages', $messages ) . "</p>\n";
}
}
} // End of login_header().
```
[apply\_filters( 'login\_body\_class', string[] $classes, string $action )](../hooks/login_body_class)
Filters the login page body classes.
[do\_action( 'login\_enqueue\_scripts' )](../hooks/login_enqueue_scripts)
Enqueue scripts and styles for the login page.
[apply\_filters( 'login\_errors', string $errors )](../hooks/login_errors)
Filters the error messages displayed above the login form.
[do\_action( 'login\_head' )](../hooks/login_head)
Fires in the login page header after scripts are enqueued.
[do\_action( 'login\_header' )](../hooks/login_header)
Fires in the login page header after the body tag is opened.
[apply\_filters( 'login\_headertext', string $login\_header\_text )](../hooks/login_headertext)
Filters the link text of the header logo above the login form.
[apply\_filters\_deprecated( 'login\_headertitle', string $login\_header\_title )](../hooks/login_headertitle)
Filters the title attribute of the header logo above login form.
[apply\_filters( 'login\_headerurl', string $login\_header\_url )](../hooks/login_headerurl)
Filters link URL of the header logo above login form.
[apply\_filters( 'login\_message', string $message )](../hooks/login_message)
Filters the message to display above the login form.
[apply\_filters( 'login\_messages', string $messages )](../hooks/login_messages)
Filters instructional messages displayed above the login form.
[apply\_filters( 'login\_title', string $login\_title, string $title )](../hooks/login_title)
Filters the title tag content for login page.
[apply\_filters( 'shake\_error\_codes', string[] $shake\_error\_codes )](../hooks/shake_error_codes)
Filters the error codes array for shaking the login form.
| Uses | Description |
| --- | --- |
| [wp\_is\_recovery\_mode()](wp_is_recovery_mode) wp-includes/load.php | Is WordPress in Recovery Mode. |
| [bloginfo()](bloginfo) wp-includes/general-template.php | Displays information about the current site. |
| [WP\_Error::get\_error\_messages()](../classes/wp_error/get_error_messages) wp-includes/class-wp-error.php | Retrieves all error messages, or the error messages for the given error code. |
| [WP\_Error::get\_error\_data()](../classes/wp_error/get_error_data) wp-includes/class-wp-error.php | Retrieves the most recently added error data for an error code. |
| [WP\_Error::add()](../classes/wp_error/add) wp-includes/class-wp-error.php | Adds an error or appends an additional message to an existing error. |
| [WP\_Error::get\_error\_code()](../classes/wp_error/get_error_code) wp-includes/class-wp-error.php | Retrieves the first error code available. |
| [WP\_Error::has\_errors()](../classes/wp_error/has_errors) wp-includes/class-wp-error.php | Verifies if the instance contains errors. |
| [is\_rtl()](is_rtl) wp-includes/l10n.php | Determines whether the current locale is right-to-left (RTL). |
| [wp\_enqueue\_style()](wp_enqueue_style) wp-includes/functions.wp-styles.php | Enqueue a CSS stylesheet. |
| [language\_attributes()](language_attributes) wp-includes/general-template.php | Displays the language attributes for the ‘html’ tag. |
| [sanitize\_html\_class()](sanitize_html_class) wp-includes/formatting.php | Sanitizes an HTML classname to ensure it only contains valid characters. |
| [get\_locale()](get_locale) wp-includes/l10n.php | Retrieves the current locale. |
| [apply\_filters\_deprecated()](apply_filters_deprecated) wp-includes/plugin.php | Fires functions attached to a deprecated filter hook. |
| [WP\_Error::get\_error\_codes()](../classes/wp_error/get_error_codes) wp-includes/class-wp-error.php | Retrieves all error codes. |
| [get\_bloginfo()](get_bloginfo) wp-includes/general-template.php | Retrieves information about the current site. |
| [esc\_url()](esc_url) wp-includes/formatting.php | Checks and cleans a URL. |
| [add\_filter()](add_filter) wp-includes/plugin.php | Adds a callback function to a filter hook. |
| [add\_action()](add_action) wp-includes/plugin.php | Adds a callback function to an action hook. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| [do\_action()](do_action) wp-includes/plugin.php | Calls the callback functions that have been added to an action hook. |
| [esc\_attr()](esc_attr) wp-includes/formatting.php | Escaping for HTML attributes. |
| [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. |
| [is\_wp\_error()](is_wp_error) wp-includes/load.php | Checks whether the given variable is a WordPress Error. |
| [WP\_Error::\_\_construct()](../classes/wp_error/__construct) wp-includes/class-wp-error.php | Initializes the error. |
| Version | Description |
| --- | --- |
| [2.1.0](https://developer.wordpress.org/reference/since/2.1.0/) | Introduced. |
| programming_docs |
wordpress _wp_call_all_hook( array $args ) \_wp\_call\_all\_hook( array $args )
====================================
This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.
Calls the ‘all’ hook, which will process the functions hooked into it.
The ‘all’ hook passes all of the arguments or parameters that were used for the hook, which this function was called for.
This function is used internally for [apply\_filters()](apply_filters) , [do\_action()](do_action) , and [do\_action\_ref\_array()](do_action_ref_array) and is not meant to be used from outside those functions. This function does not check for the existence of the all hook, so it will fail unless the all hook exists prior to this function call.
`$args` array Required The collected parameters from the hook that was called. File: `wp-includes/plugin.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/plugin.php/)
```
function _wp_call_all_hook( $args ) {
global $wp_filter;
$wp_filter['all']->do_all_hook( $args );
}
```
| Used By | Description |
| --- | --- |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| [apply\_filters\_ref\_array()](apply_filters_ref_array) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook, specifying arguments in an array. |
| [do\_action()](do_action) wp-includes/plugin.php | Calls the callback functions that have been added to an action hook. |
| [do\_action\_ref\_array()](do_action_ref_array) wp-includes/plugin.php | Calls the callback functions that have been added to an action hook, specifying arguments in an array. |
| Version | Description |
| --- | --- |
| [2.5.0](https://developer.wordpress.org/reference/since/2.5.0/) | Introduced. |
wordpress gallery_shortcode( array $attr ): string gallery\_shortcode( array $attr ): string
=========================================
Builds the Gallery shortcode output.
This implements the functionality of the Gallery Shortcode for displaying WordPress images on a post.
`$attr` array Required Attributes of the gallery shortcode.
* `order`stringOrder of the images in the gallery. Default `'ASC'`. Accepts `'ASC'`, `'DESC'`.
* `orderby`stringThe field to use when ordering the images. Default 'menu\_order ID'.
Accepts any valid SQL ORDERBY statement.
* `id`intPost ID.
* `itemtag`stringHTML tag to use for each image in the gallery.
Default `'dl'`, or `'figure'` when the theme registers HTML5 gallery support.
* `icontag`stringHTML tag to use for each image's icon.
Default `'dt'`, or `'div'` when the theme registers HTML5 gallery support.
* `captiontag`stringHTML tag to use for each image's caption.
Default `'dd'`, or `'figcaption'` when the theme registers HTML5 gallery support.
* `columns`intNumber of columns of images to display. Default 3.
* `size`string|int[]Size of the images to display. Accepts any registered image size name, or an array of width and height values in pixels (in that order). Default `'thumbnail'`.
* `ids`stringA comma-separated list of IDs of attachments to display. Default empty.
* `include`stringA comma-separated list of IDs of attachments to include. Default empty.
* `exclude`stringA comma-separated list of IDs of attachments to exclude. Default empty.
* `link`stringWhat to link each image to. Default empty (links to the attachment page).
Accepts `'file'`, `'none'`.
string HTML content to display gallery.
File: `wp-includes/media.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/media.php/)
```
function gallery_shortcode( $attr ) {
$post = get_post();
static $instance = 0;
$instance++;
if ( ! empty( $attr['ids'] ) ) {
// 'ids' is explicitly ordered, unless you specify otherwise.
if ( empty( $attr['orderby'] ) ) {
$attr['orderby'] = 'post__in';
}
$attr['include'] = $attr['ids'];
}
/**
* Filters the default gallery shortcode output.
*
* If the filtered output isn't empty, it will be used instead of generating
* the default gallery template.
*
* @since 2.5.0
* @since 4.2.0 The `$instance` parameter was added.
*
* @see gallery_shortcode()
*
* @param string $output The gallery output. Default empty.
* @param array $attr Attributes of the gallery shortcode.
* @param int $instance Unique numeric ID of this gallery shortcode instance.
*/
$output = apply_filters( 'post_gallery', '', $attr, $instance );
if ( ! empty( $output ) ) {
return $output;
}
$html5 = current_theme_supports( 'html5', 'gallery' );
$atts = shortcode_atts(
array(
'order' => 'ASC',
'orderby' => 'menu_order ID',
'id' => $post ? $post->ID : 0,
'itemtag' => $html5 ? 'figure' : 'dl',
'icontag' => $html5 ? 'div' : 'dt',
'captiontag' => $html5 ? 'figcaption' : 'dd',
'columns' => 3,
'size' => 'thumbnail',
'include' => '',
'exclude' => '',
'link' => '',
),
$attr,
'gallery'
);
$id = (int) $atts['id'];
if ( ! empty( $atts['include'] ) ) {
$_attachments = get_posts(
array(
'include' => $atts['include'],
'post_status' => 'inherit',
'post_type' => 'attachment',
'post_mime_type' => 'image',
'order' => $atts['order'],
'orderby' => $atts['orderby'],
)
);
$attachments = array();
foreach ( $_attachments as $key => $val ) {
$attachments[ $val->ID ] = $_attachments[ $key ];
}
} elseif ( ! empty( $atts['exclude'] ) ) {
$attachments = get_children(
array(
'post_parent' => $id,
'exclude' => $atts['exclude'],
'post_status' => 'inherit',
'post_type' => 'attachment',
'post_mime_type' => 'image',
'order' => $atts['order'],
'orderby' => $atts['orderby'],
)
);
} else {
$attachments = get_children(
array(
'post_parent' => $id,
'post_status' => 'inherit',
'post_type' => 'attachment',
'post_mime_type' => 'image',
'order' => $atts['order'],
'orderby' => $atts['orderby'],
)
);
}
if ( empty( $attachments ) ) {
return '';
}
if ( is_feed() ) {
$output = "\n";
foreach ( $attachments as $att_id => $attachment ) {
if ( ! empty( $atts['link'] ) ) {
if ( 'none' === $atts['link'] ) {
$output .= wp_get_attachment_image( $att_id, $atts['size'], false, $attr );
} else {
$output .= wp_get_attachment_link( $att_id, $atts['size'], false );
}
} else {
$output .= wp_get_attachment_link( $att_id, $atts['size'], true );
}
$output .= "\n";
}
return $output;
}
$itemtag = tag_escape( $atts['itemtag'] );
$captiontag = tag_escape( $atts['captiontag'] );
$icontag = tag_escape( $atts['icontag'] );
$valid_tags = wp_kses_allowed_html( 'post' );
if ( ! isset( $valid_tags[ $itemtag ] ) ) {
$itemtag = 'dl';
}
if ( ! isset( $valid_tags[ $captiontag ] ) ) {
$captiontag = 'dd';
}
if ( ! isset( $valid_tags[ $icontag ] ) ) {
$icontag = 'dt';
}
$columns = (int) $atts['columns'];
$itemwidth = $columns > 0 ? floor( 100 / $columns ) : 100;
$float = is_rtl() ? 'right' : 'left';
$selector = "gallery-{$instance}";
$gallery_style = '';
/**
* Filters whether to print default gallery styles.
*
* @since 3.1.0
*
* @param bool $print Whether to print default gallery styles.
* Defaults to false if the theme supports HTML5 galleries.
* Otherwise, defaults to true.
*/
if ( apply_filters( 'use_default_gallery_style', ! $html5 ) ) {
$type_attr = current_theme_supports( 'html5', 'style' ) ? '' : ' type="text/css"';
$gallery_style = "
<style{$type_attr}>
#{$selector} {
margin: auto;
}
#{$selector} .gallery-item {
float: {$float};
margin-top: 10px;
text-align: center;
width: {$itemwidth}%;
}
#{$selector} img {
border: 2px solid #cfcfcf;
}
#{$selector} .gallery-caption {
margin-left: 0;
}
/* see gallery_shortcode() in wp-includes/media.php */
</style>\n\t\t";
}
$size_class = sanitize_html_class( is_array( $atts['size'] ) ? implode( 'x', $atts['size'] ) : $atts['size'] );
$gallery_div = "<div id='$selector' class='gallery galleryid-{$id} gallery-columns-{$columns} gallery-size-{$size_class}'>";
/**
* Filters the default gallery shortcode CSS styles.
*
* @since 2.5.0
*
* @param string $gallery_style Default CSS styles and opening HTML div container
* for the gallery shortcode output.
*/
$output = apply_filters( 'gallery_style', $gallery_style . $gallery_div );
$i = 0;
foreach ( $attachments as $id => $attachment ) {
$attr = ( trim( $attachment->post_excerpt ) ) ? array( 'aria-describedby' => "$selector-$id" ) : '';
if ( ! empty( $atts['link'] ) && 'file' === $atts['link'] ) {
$image_output = wp_get_attachment_link( $id, $atts['size'], false, false, false, $attr );
} elseif ( ! empty( $atts['link'] ) && 'none' === $atts['link'] ) {
$image_output = wp_get_attachment_image( $id, $atts['size'], false, $attr );
} else {
$image_output = wp_get_attachment_link( $id, $atts['size'], true, false, false, $attr );
}
$image_meta = wp_get_attachment_metadata( $id );
$orientation = '';
if ( isset( $image_meta['height'], $image_meta['width'] ) ) {
$orientation = ( $image_meta['height'] > $image_meta['width'] ) ? 'portrait' : 'landscape';
}
$output .= "<{$itemtag} class='gallery-item'>";
$output .= "
<{$icontag} class='gallery-icon {$orientation}'>
$image_output
</{$icontag}>";
if ( $captiontag && trim( $attachment->post_excerpt ) ) {
$output .= "
<{$captiontag} class='wp-caption-text gallery-caption' id='$selector-$id'>
" . wptexturize( $attachment->post_excerpt ) . "
</{$captiontag}>";
}
$output .= "</{$itemtag}>";
if ( ! $html5 && $columns > 0 && 0 === ++$i % $columns ) {
$output .= '<br style="clear: both" />';
}
}
if ( ! $html5 && $columns > 0 && 0 !== $i % $columns ) {
$output .= "
<br style='clear: both' />";
}
$output .= "
</div>\n";
return $output;
}
```
[apply\_filters( 'gallery\_style', string $gallery\_style )](../hooks/gallery_style)
Filters the default gallery shortcode CSS styles.
[apply\_filters( 'post\_gallery', string $output, array $attr, int $instance )](../hooks/post_gallery)
Filters the default gallery shortcode output.
[apply\_filters( 'use\_default\_gallery\_style', bool $print )](../hooks/use_default_gallery_style)
Filters whether to print default gallery styles.
| Uses | Description |
| --- | --- |
| [get\_children()](get_children) wp-includes/post.php | Retrieves all children of the post parent ID. |
| [tag\_escape()](tag_escape) wp-includes/formatting.php | Escapes an HTML tag name. |
| [sanitize\_html\_class()](sanitize_html_class) wp-includes/formatting.php | Sanitizes an HTML classname to ensure it only contains valid characters. |
| [wptexturize()](wptexturize) wp-includes/formatting.php | Replaces common plain text characters with formatted entities. |
| [wp\_kses\_allowed\_html()](wp_kses_allowed_html) wp-includes/kses.php | Returns an array of allowed HTML tags and attributes for a given context. |
| [is\_feed()](is_feed) wp-includes/query.php | Determines whether the query is for a feed. |
| [is\_rtl()](is_rtl) wp-includes/l10n.php | Determines whether the current locale is right-to-left (RTL). |
| [shortcode\_atts()](shortcode_atts) wp-includes/shortcodes.php | Combines user attributes with known attributes and fill in defaults when needed. |
| [wp\_get\_attachment\_link()](wp_get_attachment_link) wp-includes/post-template.php | Retrieves an attachment page link using an image or icon, if possible. |
| [wp\_get\_attachment\_image()](wp_get_attachment_image) wp-includes/media.php | Gets an HTML img element representing an image attachment. |
| [wp\_get\_attachment\_metadata()](wp_get_attachment_metadata) wp-includes/post.php | Retrieves attachment metadata for attachment ID. |
| [get\_posts()](get_posts) wp-includes/post.php | Retrieves an array of the latest posts, or posts matching the given criteria. |
| [current\_theme\_supports()](current_theme_supports) wp-includes/theme.php | Checks a theme’s support for a given feature. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| [get\_post()](get_post) wp-includes/post.php | Retrieves post data given a post ID or post object. |
| Used By | Description |
| --- | --- |
| [WP\_Widget\_Media\_Gallery::render\_media()](../classes/wp_widget_media_gallery/render_media) wp-includes/widgets/class-wp-widget-media-gallery.php | Render the media on the frontend. |
| Version | Description |
| --- | --- |
| [5.6.0](https://developer.wordpress.org/reference/since/5.6.0/) | Replaced order-style PHP type conversion functions with typecasts. Fix logic for an array of image dimensions. |
| [5.5.0](https://developer.wordpress.org/reference/since/5.5.0/) | Ensured that galleries can be output as a list of links in feeds. |
| [5.3.0](https://developer.wordpress.org/reference/since/5.3.0/) | Saved progress of intermediate image creation after upload. |
| [5.1.0](https://developer.wordpress.org/reference/since/5.1.0/) | Code cleanup for WPCS 1.0.0 coding standards. |
| [4.6.0](https://developer.wordpress.org/reference/since/4.6.0/) | Standardized filter docs to match documentation standards for PHP. |
| [4.2.0](https://developer.wordpress.org/reference/since/4.2.0/) | Passed the shortcode instance ID to `post_gallery` and `post_playlist` filters. |
| [4.1.0](https://developer.wordpress.org/reference/since/4.1.0/) | Added attribute to `wp_get_attachment_link()` to output `aria-describedby`. |
| [4.0.0](https://developer.wordpress.org/reference/since/4.0.0/) | Removed use of `extract()`. |
| [3.9.0](https://developer.wordpress.org/reference/since/3.9.0/) | `html5` gallery support, accepting `'itemtag'`, `'icontag'`, and `'captiontag'` attributes. |
| [3.7.0](https://developer.wordpress.org/reference/since/3.7.0/) | Introduced the `link` attribute. |
| [3.6.0](https://developer.wordpress.org/reference/since/3.6.0/) | Added validation for tags used in gallery shortcode. Add orientation information to items. |
| [3.5.0](https://developer.wordpress.org/reference/since/3.5.0/) | Use [get\_post()](get_post) instead of global `$post`. Handle mapping of `ids` to `include` and `orderby`. |
| [2.9.0](https://developer.wordpress.org/reference/since/2.9.0/) | Added support for `include` and `exclude` to shortcode. |
| [2.8.0](https://developer.wordpress.org/reference/since/2.8.0/) | Added the `$attr` parameter to set the shortcode output. New attributes included such as `size`, `itemtag`, `icontag`, `captiontag`, and columns. Changed markup from `div` tags to `dl`, `dt` and `dd` tags. Support more than one gallery on the same page. |
| [2.5.0](https://developer.wordpress.org/reference/since/2.5.0/) | Introduced. |
wordpress update_blog_public( int $old_value, int $value ) update\_blog\_public( int $old\_value, int $value )
===================================================
Updates this blog’s ‘public’ setting in the global blogs table.
Public blogs have a setting of 1, private blogs are 0.
`$old_value` int Required `$value` int Required The new public value File: `wp-includes/ms-functions.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/ms-functions.php/)
```
function update_blog_public( $old_value, $value ) {
update_blog_status( get_current_blog_id(), 'public', (int) $value );
}
```
| Uses | Description |
| --- | --- |
| [update\_blog\_status()](update_blog_status) wp-includes/ms-blogs.php | Update a blog details field. |
| [get\_current\_blog\_id()](get_current_blog_id) wp-includes/load.php | Retrieve the current site ID. |
| Version | Description |
| --- | --- |
| [MU (3.0.0)](https://developer.wordpress.org/reference/since/mu.3.0.0/) | Introduced. |
wordpress wp_create_user( string $username, string $password, string $email = '' ): int|WP_Error wp\_create\_user( string $username, string $password, string $email = '' ): int|WP\_Error
=========================================================================================
Provides a simpler way of inserting a user into the database.
Creates a new user with just the username, password, and email. For more complex user creation use [wp\_insert\_user()](wp_insert_user) to specify more information.
* [wp\_insert\_user()](wp_insert_user) : More complete way to create a new user.
`$username` string Required The user's username. `$password` string Required The user's password. `$email` string Optional The user's email. Default: `''`
int|[WP\_Error](../classes/wp_error) The newly created user's ID or a [WP\_Error](../classes/wp_error) object if the user could not be created.
File: `wp-includes/user.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/user.php/)
```
function wp_create_user( $username, $password, $email = '' ) {
$user_login = wp_slash( $username );
$user_email = wp_slash( $email );
$user_pass = $password;
$userdata = compact( 'user_login', 'user_email', 'user_pass' );
return wp_insert_user( $userdata );
}
```
| Uses | Description |
| --- | --- |
| [wp\_insert\_user()](wp_insert_user) wp-includes/user.php | Inserts a user into the database. |
| [wp\_slash()](wp_slash) wp-includes/formatting.php | Adds slashes to a string or recursively adds slashes to strings within an array. |
| Used By | Description |
| --- | --- |
| [wp\_install()](wp_install) wp-admin/includes/upgrade.php | Installs the site. |
| [create\_user()](create_user) wp-includes/deprecated.php | An alias of [wp\_create\_user()](wp_create_user) . |
| [register\_new\_user()](register_new_user) wp-includes/user.php | Handles registering a new user. |
| [wpmu\_create\_user()](wpmu_create_user) wp-includes/ms-functions.php | Creates a user. |
| Version | Description |
| --- | --- |
| [2.0.0](https://developer.wordpress.org/reference/since/2.0.0/) | Introduced. |
wordpress comments_popup_link( false|string $zero = false, false|string $one = false, false|string $more = false, string $css_class = '', false|string $none = false ) comments\_popup\_link( false|string $zero = false, false|string $one = false, false|string $more = false, string $css\_class = '', false|string $none = false )
===============================================================================================================================================================
Displays the link to the comments for the current post ID.
`$zero` false|string Optional String to display when no comments. Default: `false`
`$one` false|string Optional String to display when only one comment is available. Default: `false`
`$more` false|string Optional String to display when there are more than one comment. Default: `false`
`$css_class` string Optional CSS class to use for comments. Default: `''`
`$none` false|string Optional String to display when comments have been turned off. Default: `false`
File: `wp-includes/comment-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/comment-template.php/)
```
function comments_popup_link( $zero = false, $one = false, $more = false, $css_class = '', $none = false ) {
$post_id = get_the_ID();
$post_title = get_the_title();
$number = get_comments_number( $post_id );
if ( false === $zero ) {
/* translators: %s: Post title. */
$zero = sprintf( __( 'No Comments<span class="screen-reader-text"> on %s</span>' ), $post_title );
}
if ( false === $one ) {
/* translators: %s: Post title. */
$one = sprintf( __( '1 Comment<span class="screen-reader-text"> on %s</span>' ), $post_title );
}
if ( false === $more ) {
/* translators: 1: Number of comments, 2: Post title. */
$more = _n( '%1$s Comment<span class="screen-reader-text"> on %2$s</span>', '%1$s Comments<span class="screen-reader-text"> on %2$s</span>', $number );
$more = sprintf( $more, number_format_i18n( $number ), $post_title );
}
if ( false === $none ) {
/* translators: %s: Post title. */
$none = sprintf( __( 'Comments Off<span class="screen-reader-text"> on %s</span>' ), $post_title );
}
if ( 0 == $number && ! comments_open() && ! pings_open() ) {
echo '<span' . ( ( ! empty( $css_class ) ) ? ' class="' . esc_attr( $css_class ) . '"' : '' ) . '>' . $none . '</span>';
return;
}
if ( post_password_required() ) {
_e( 'Enter your password to view comments.' );
return;
}
echo '<a href="';
if ( 0 == $number ) {
$respond_link = get_permalink() . '#respond';
/**
* Filters the respond link when a post has no comments.
*
* @since 4.4.0
*
* @param string $respond_link The default response link.
* @param int $post_id The post ID.
*/
echo apply_filters( 'respond_link', $respond_link, $post_id );
} else {
comments_link();
}
echo '"';
if ( ! empty( $css_class ) ) {
echo ' class="' . $css_class . '" ';
}
$attributes = '';
/**
* Filters the comments link attributes for display.
*
* @since 2.5.0
*
* @param string $attributes The comments link attributes. Default empty.
*/
echo apply_filters( 'comments_popup_link_attributes', $attributes );
echo '>';
comments_number( $zero, $one, $more );
echo '</a>';
}
```
[apply\_filters( 'comments\_popup\_link\_attributes', string $attributes )](../hooks/comments_popup_link_attributes)
Filters the comments link attributes for display.
[apply\_filters( 'respond\_link', string $respond\_link, int $post\_id )](../hooks/respond_link)
Filters the respond link when a post has no comments.
| Uses | Description |
| --- | --- |
| [\_n()](_n) wp-includes/l10n.php | Translates and retrieves the singular or plural form based on the supplied number. |
| [post\_password\_required()](post_password_required) wp-includes/post-template.php | Determines whether the post requires password and whether a correct password has been provided. |
| [get\_the\_ID()](get_the_id) wp-includes/post-template.php | Retrieves the ID of the current item in the WordPress Loop. |
| [get\_the\_title()](get_the_title) wp-includes/post-template.php | Retrieves the post title. |
| [comments\_open()](comments_open) wp-includes/comment-template.php | Determines whether the current post is open for comments. |
| [pings\_open()](pings_open) wp-includes/comment-template.php | Determines whether the current post is open for pings. |
| [get\_comments\_number()](get_comments_number) wp-includes/comment-template.php | Retrieves the amount of comments a post has. |
| [comments\_link()](comments_link) wp-includes/comment-template.php | Displays the link to the current post comments. |
| [comments\_number()](comments_number) wp-includes/comment-template.php | Displays the language string for the number of comments the current post has. |
| [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. |
| [\_e()](_e) wp-includes/l10n.php | Displays translated text. |
| [esc\_attr()](esc_attr) wp-includes/formatting.php | Escaping for HTML attributes. |
| [number\_format\_i18n()](number_format_i18n) wp-includes/functions.php | Converts float number to format based on the locale. |
| [get\_permalink()](get_permalink) wp-includes/link-template.php | Retrieves the full permalink for the current post or post ID. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| Version | Description |
| --- | --- |
| [0.71](https://developer.wordpress.org/reference/since/0.71/) | Introduced. |
| programming_docs |
wordpress wp_enable_block_templates() wp\_enable\_block\_templates()
==============================
This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.
Enables the block templates (editor mode) for themes with theme.json by default.
File: `wp-includes/theme-templates.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/theme-templates.php/)
```
function wp_enable_block_templates() {
if ( wp_is_block_theme() || WP_Theme_JSON_Resolver::theme_has_support() ) {
add_theme_support( 'block-templates' );
}
}
```
| Uses | Description |
| --- | --- |
| [wp\_is\_block\_theme()](wp_is_block_theme) wp-includes/theme.php | Returns whether the active theme is a block-based theme or not. |
| [WP\_Theme\_JSON\_Resolver::theme\_has\_support()](../classes/wp_theme_json_resolver/theme_has_support) wp-includes/class-wp-theme-json-resolver.php | Determines whether the active theme has a theme.json file. |
| [add\_theme\_support()](add_theme_support) wp-includes/theme.php | Registers theme support for a given feature. |
| Version | Description |
| --- | --- |
| [5.8.0](https://developer.wordpress.org/reference/since/5.8.0/) | Introduced. |
wordpress attachment_url_to_postid( string $url ): int attachment\_url\_to\_postid( string $url ): int
===============================================
Tries to convert an attachment URL into a post ID.
`$url` string Required The URL to resolve. int The found post ID, or 0 on failure.
File: `wp-includes/media.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/media.php/)
```
function attachment_url_to_postid( $url ) {
global $wpdb;
$dir = wp_get_upload_dir();
$path = $url;
$site_url = parse_url( $dir['url'] );
$image_path = parse_url( $path );
// Force the protocols to match if needed.
if ( isset( $image_path['scheme'] ) && ( $image_path['scheme'] !== $site_url['scheme'] ) ) {
$path = str_replace( $image_path['scheme'], $site_url['scheme'], $path );
}
if ( 0 === strpos( $path, $dir['baseurl'] . '/' ) ) {
$path = substr( $path, strlen( $dir['baseurl'] . '/' ) );
}
$sql = $wpdb->prepare(
"SELECT post_id, meta_value FROM $wpdb->postmeta WHERE meta_key = '_wp_attached_file' AND meta_value = %s",
$path
);
$results = $wpdb->get_results( $sql );
$post_id = null;
if ( $results ) {
// Use the first available result, but prefer a case-sensitive match, if exists.
$post_id = reset( $results )->post_id;
if ( count( $results ) > 1 ) {
foreach ( $results as $result ) {
if ( $path === $result->meta_value ) {
$post_id = $result->post_id;
break;
}
}
}
}
/**
* Filters an attachment ID found by URL.
*
* @since 4.2.0
*
* @param int|null $post_id The post_id (if any) found by the function.
* @param string $url The URL being looked up.
*/
return (int) apply_filters( 'attachment_url_to_postid', $post_id, $url );
}
```
[apply\_filters( 'attachment\_url\_to\_postid', int|null $post\_id, string $url )](../hooks/attachment_url_to_postid)
Filters an attachment ID found by URL.
| Uses | Description |
| --- | --- |
| [wp\_get\_upload\_dir()](wp_get_upload_dir) wp-includes/functions.php | Retrieves uploads directory information. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| [wpdb::get\_results()](../classes/wpdb/get_results) wp-includes/class-wpdb.php | Retrieves an entire SQL result set from the database (i.e., many rows). |
| [wpdb::prepare()](../classes/wpdb/prepare) wp-includes/class-wpdb.php | Prepares a SQL query for safe execution. |
| Used By | Description |
| --- | --- |
| [wp\_ajax\_set\_attachment\_thumbnail()](wp_ajax_set_attachment_thumbnail) wp-admin/includes/ajax-actions.php | Ajax handler for setting the featured image for an attachment. |
| [WP\_Customize\_Upload\_Control::to\_json()](../classes/wp_customize_upload_control/to_json) wp-includes/customize/class-wp-customize-upload-control.php | Refresh the parameters passed to the JavaScript via JSON. |
| Version | Description |
| --- | --- |
| [4.0.0](https://developer.wordpress.org/reference/since/4.0.0/) | Introduced. |
wordpress validate_email( string $email, bool $check_domain = true ): string|false validate\_email( string $email, bool $check\_domain = true ): string|false
==========================================================================
This function has been deprecated. Use [is\_email()](is_email) instead.
Deprecated functionality to validate an email address.
* [is\_email()](is_email)
`$email` string Required Email address to verify. `$check_domain` bool Optional Deprecated. Default: `true`
string|false Valid email address on success, false on failure.
File: `wp-includes/ms-deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/ms-deprecated.php/)
```
function validate_email( $email, $check_domain = true) {
_deprecated_function( __FUNCTION__, '3.0.0', 'is_email()' );
return is_email( $email, $check_domain );
}
```
| Uses | Description |
| --- | --- |
| [is\_email()](is_email) wp-includes/formatting.php | Verifies that an email is valid. |
| [\_deprecated\_function()](_deprecated_function) wp-includes/functions.php | Marks a function as deprecated and inform when it has been used. |
| Version | Description |
| --- | --- |
| [3.0.0](https://developer.wordpress.org/reference/since/3.0.0/) | Use [is\_email()](is_email) |
| [MU (3.0.0)](https://developer.wordpress.org/reference/since/mu.3.0.0/) | Introduced. |
wordpress get_media_item( int $attachment_id, string|array $args = null ): string get\_media\_item( int $attachment\_id, string|array $args = null ): string
==========================================================================
Retrieves HTML form for modifying the image attachment.
`$attachment_id` int Required Attachment ID for modification. `$args` string|array Optional Override defaults. Default: `null`
string HTML form for attachment.
errors (*array*) (*optional*) Passed to [get\_attachment\_fields\_to\_edit()](get_attachment_fields_to_edit) by this function. Presumably used to change default error messages for default fields Default: null send (*boolean*) (*optional*) Whether to include the submit button html. Default: the result of conditional logic. Set to the result of post\_type\_supports( post->ID, ‘editor’ ) if the post has an ID. Or, if the post doesn’t have an ID, “true”. delete (*boolean*) (*optional*) Whether to include delete link html. Default: true toggle (*boolean*) (*optional*) Whether to include toggle link html. Default: true show\_title (*boolean*) (*optional*) Whether to include attachment title html. Default: true File: `wp-admin/includes/media.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/media.php/)
```
function get_media_item( $attachment_id, $args = null ) {
global $redir_tab;
$thumb_url = false;
$attachment_id = (int) $attachment_id;
if ( $attachment_id ) {
$thumb_url = wp_get_attachment_image_src( $attachment_id, 'thumbnail', true );
if ( $thumb_url ) {
$thumb_url = $thumb_url[0];
}
}
$post = get_post( $attachment_id );
$current_post_id = ! empty( $_GET['post_id'] ) ? (int) $_GET['post_id'] : 0;
$default_args = array(
'errors' => null,
'send' => $current_post_id ? post_type_supports( get_post_type( $current_post_id ), 'editor' ) : true,
'delete' => true,
'toggle' => true,
'show_title' => true,
);
$parsed_args = wp_parse_args( $args, $default_args );
/**
* Filters the arguments used to retrieve an image for the edit image form.
*
* @since 3.1.0
*
* @see get_media_item
*
* @param array $parsed_args An array of arguments.
*/
$parsed_args = apply_filters( 'get_media_item_args', $parsed_args );
$toggle_on = __( 'Show' );
$toggle_off = __( 'Hide' );
$file = get_attached_file( $post->ID );
$filename = esc_html( wp_basename( $file ) );
$title = esc_attr( $post->post_title );
$post_mime_types = get_post_mime_types();
$keys = array_keys( wp_match_mime_types( array_keys( $post_mime_types ), $post->post_mime_type ) );
$type = reset( $keys );
$type_html = "<input type='hidden' id='type-of-$attachment_id' value='" . esc_attr( $type ) . "' />";
$form_fields = get_attachment_fields_to_edit( $post, $parsed_args['errors'] );
if ( $parsed_args['toggle'] ) {
$class = empty( $parsed_args['errors'] ) ? 'startclosed' : 'startopen';
$toggle_links = "
<a class='toggle describe-toggle-on' href='#'>$toggle_on</a>
<a class='toggle describe-toggle-off' href='#'>$toggle_off</a>";
} else {
$class = '';
$toggle_links = '';
}
$display_title = ( ! empty( $title ) ) ? $title : $filename; // $title shouldn't ever be empty, but just in case.
$display_title = $parsed_args['show_title'] ? "<div class='filename new'><span class='title'>" . wp_html_excerpt( $display_title, 60, '…' ) . '</span></div>' : '';
$gallery = ( ( isset( $_REQUEST['tab'] ) && 'gallery' === $_REQUEST['tab'] ) || ( isset( $redir_tab ) && 'gallery' === $redir_tab ) );
$order = '';
foreach ( $form_fields as $key => $val ) {
if ( 'menu_order' === $key ) {
if ( $gallery ) {
$order = "<div class='menu_order'> <input class='menu_order_input' type='text' id='attachments[$attachment_id][menu_order]' name='attachments[$attachment_id][menu_order]' value='" . esc_attr( $val['value'] ) . "' /></div>";
} else {
$order = "<input type='hidden' name='attachments[$attachment_id][menu_order]' value='" . esc_attr( $val['value'] ) . "' />";
}
unset( $form_fields['menu_order'] );
break;
}
}
$media_dims = '';
$meta = wp_get_attachment_metadata( $post->ID );
if ( isset( $meta['width'], $meta['height'] ) ) {
$media_dims .= "<span id='media-dims-$post->ID'>{$meta['width']} × {$meta['height']}</span> ";
}
/**
* Filters the media metadata.
*
* @since 2.5.0
*
* @param string $media_dims The HTML markup containing the media dimensions.
* @param WP_Post $post The WP_Post attachment object.
*/
$media_dims = apply_filters( 'media_meta', $media_dims, $post );
$image_edit_button = '';
if ( wp_attachment_is_image( $post->ID ) && wp_image_editor_supports( array( 'mime_type' => $post->post_mime_type ) ) ) {
$nonce = wp_create_nonce( "image_editor-$post->ID" );
$image_edit_button = "<input type='button' id='imgedit-open-btn-$post->ID' onclick='imageEdit.open( $post->ID, \"$nonce\" )' class='button' value='" . esc_attr__( 'Edit Image' ) . "' /> <span class='spinner'></span>";
}
$attachment_url = get_permalink( $attachment_id );
$item = "
$type_html
$toggle_links
$order
$display_title
<table class='slidetoggle describe $class'>
<thead class='media-item-info' id='media-head-$post->ID'>
<tr>
<td class='A1B1' id='thumbnail-head-$post->ID'>
<p><a href='$attachment_url' target='_blank'><img class='thumbnail' src='$thumb_url' alt='' /></a></p>
<p>$image_edit_button</p>
</td>
<td>
<p><strong>" . __( 'File name:' ) . "</strong> $filename</p>
<p><strong>" . __( 'File type:' ) . "</strong> $post->post_mime_type</p>
<p><strong>" . __( 'Upload date:' ) . '</strong> ' . mysql2date( __( 'F j, Y' ), $post->post_date ) . '</p>';
if ( ! empty( $media_dims ) ) {
$item .= '<p><strong>' . __( 'Dimensions:' ) . "</strong> $media_dims</p>\n";
}
$item .= "</td></tr>\n";
$item .= "
</thead>
<tbody>
<tr><td colspan='2' class='imgedit-response' id='imgedit-response-$post->ID'></td></tr>\n
<tr><td style='display:none' colspan='2' class='image-editor' id='image-editor-$post->ID'></td></tr>\n
<tr><td colspan='2'><p class='media-types media-types-required-info'>" .
wp_required_field_message() .
"</p></td></tr>\n";
$defaults = array(
'input' => 'text',
'required' => false,
'value' => '',
'extra_rows' => array(),
);
if ( $parsed_args['send'] ) {
$parsed_args['send'] = get_submit_button( __( 'Insert into Post' ), '', "send[$attachment_id]", false );
}
$delete = empty( $parsed_args['delete'] ) ? '' : $parsed_args['delete'];
if ( $delete && current_user_can( 'delete_post', $attachment_id ) ) {
if ( ! EMPTY_TRASH_DAYS ) {
$delete = "<a href='" . wp_nonce_url( "post.php?action=delete&post=$attachment_id", 'delete-post_' . $attachment_id ) . "' id='del[$attachment_id]' class='delete-permanently'>" . __( 'Delete Permanently' ) . '</a>';
} elseif ( ! MEDIA_TRASH ) {
$delete = "<a href='#' class='del-link' onclick=\"document.getElementById('del_attachment_$attachment_id').style.display='block';return false;\">" . __( 'Delete' ) . "</a>
<div id='del_attachment_$attachment_id' class='del-attachment' style='display:none;'>" .
/* translators: %s: File name. */
'<p>' . sprintf( __( 'You are about to delete %s.' ), '<strong>' . $filename . '</strong>' ) . "</p>
<a href='" . wp_nonce_url( "post.php?action=delete&post=$attachment_id", 'delete-post_' . $attachment_id ) . "' id='del[$attachment_id]' class='button'>" . __( 'Continue' ) . "</a>
<a href='#' class='button' onclick=\"this.parentNode.style.display='none';return false;\">" . __( 'Cancel' ) . '</a>
</div>';
} else {
$delete = "<a href='" . wp_nonce_url( "post.php?action=trash&post=$attachment_id", 'trash-post_' . $attachment_id ) . "' id='del[$attachment_id]' class='delete'>" . __( 'Move to Trash' ) . "</a>
<a href='" . wp_nonce_url( "post.php?action=untrash&post=$attachment_id", 'untrash-post_' . $attachment_id ) . "' id='undo[$attachment_id]' class='undo hidden'>" . __( 'Undo' ) . '</a>';
}
} else {
$delete = '';
}
$thumbnail = '';
$calling_post_id = 0;
if ( isset( $_GET['post_id'] ) ) {
$calling_post_id = absint( $_GET['post_id'] );
} elseif ( isset( $_POST ) && count( $_POST ) ) {// Like for async-upload where $_GET['post_id'] isn't set.
$calling_post_id = $post->post_parent;
}
if ( 'image' === $type && $calling_post_id
&& current_theme_supports( 'post-thumbnails', get_post_type( $calling_post_id ) )
&& post_type_supports( get_post_type( $calling_post_id ), 'thumbnail' )
&& get_post_thumbnail_id( $calling_post_id ) != $attachment_id
) {
$calling_post = get_post( $calling_post_id );
$calling_post_type_object = get_post_type_object( $calling_post->post_type );
$ajax_nonce = wp_create_nonce( "set_post_thumbnail-$calling_post_id" );
$thumbnail = "<a class='wp-post-thumbnail' id='wp-post-thumbnail-" . $attachment_id . "' href='#' onclick='WPSetAsThumbnail(\"$attachment_id\", \"$ajax_nonce\");return false;'>" . esc_html( $calling_post_type_object->labels->use_featured_image ) . '</a>';
}
if ( ( $parsed_args['send'] || $thumbnail || $delete ) && ! isset( $form_fields['buttons'] ) ) {
$form_fields['buttons'] = array( 'tr' => "\t\t<tr class='submit'><td></td><td class='savesend'>" . $parsed_args['send'] . " $thumbnail $delete</td></tr>\n" );
}
$hidden_fields = array();
foreach ( $form_fields as $id => $field ) {
if ( '_' === $id[0] ) {
continue;
}
if ( ! empty( $field['tr'] ) ) {
$item .= $field['tr'];
continue;
}
$field = array_merge( $defaults, $field );
$name = "attachments[$attachment_id][$id]";
if ( 'hidden' === $field['input'] ) {
$hidden_fields[ $name ] = $field['value'];
continue;
}
$required = $field['required'] ? ' ' . wp_required_field_indicator() : '';
$required_attr = $field['required'] ? ' required' : '';
$class = $id;
$class .= $field['required'] ? ' form-required' : '';
$item .= "\t\t<tr class='$class'>\n\t\t\t<th scope='row' class='label'><label for='$name'><span class='alignleft'>{$field['label']}{$required}</span><br class='clear' /></label></th>\n\t\t\t<td class='field'>";
if ( ! empty( $field[ $field['input'] ] ) ) {
$item .= $field[ $field['input'] ];
} elseif ( 'textarea' === $field['input'] ) {
if ( 'post_content' === $id && user_can_richedit() ) {
// Sanitize_post() skips the post_content when user_can_richedit.
$field['value'] = htmlspecialchars( $field['value'], ENT_QUOTES );
}
// Post_excerpt is already escaped by sanitize_post() in get_attachment_fields_to_edit().
$item .= "<textarea id='$name' name='$name'{$required_attr}>" . $field['value'] . '</textarea>';
} else {
$item .= "<input type='text' class='text' id='$name' name='$name' value='" . esc_attr( $field['value'] ) . "'{$required_attr} />";
}
if ( ! empty( $field['helps'] ) ) {
$item .= "<p class='help'>" . implode( "</p>\n<p class='help'>", array_unique( (array) $field['helps'] ) ) . '</p>';
}
$item .= "</td>\n\t\t</tr>\n";
$extra_rows = array();
if ( ! empty( $field['errors'] ) ) {
foreach ( array_unique( (array) $field['errors'] ) as $error ) {
$extra_rows['error'][] = $error;
}
}
if ( ! empty( $field['extra_rows'] ) ) {
foreach ( $field['extra_rows'] as $class => $rows ) {
foreach ( (array) $rows as $html ) {
$extra_rows[ $class ][] = $html;
}
}
}
foreach ( $extra_rows as $class => $rows ) {
foreach ( $rows as $html ) {
$item .= "\t\t<tr><td></td><td class='$class'>$html</td></tr>\n";
}
}
}
if ( ! empty( $form_fields['_final'] ) ) {
$item .= "\t\t<tr class='final'><td colspan='2'>{$form_fields['_final']}</td></tr>\n";
}
$item .= "\t</tbody>\n";
$item .= "\t</table>\n";
foreach ( $hidden_fields as $name => $value ) {
$item .= "\t<input type='hidden' name='$name' id='$name' value='" . esc_attr( $value ) . "' />\n";
}
if ( $post->post_parent < 1 && isset( $_REQUEST['post_id'] ) ) {
$parent = (int) $_REQUEST['post_id'];
$parent_name = "attachments[$attachment_id][post_parent]";
$item .= "\t<input type='hidden' name='$parent_name' id='$parent_name' value='$parent' />\n";
}
return $item;
}
```
[apply\_filters( 'get\_media\_item\_args', array $parsed\_args )](../hooks/get_media_item_args)
Filters the arguments used to retrieve an image for the edit image form.
[apply\_filters( 'media\_meta', string $media\_dims, WP\_Post $post )](../hooks/media_meta)
Filters the media metadata.
| Uses | Description |
| --- | --- |
| [wp\_required\_field\_message()](wp_required_field_message) wp-includes/general-template.php | Creates a message to explain required form fields. |
| [wp\_required\_field\_indicator()](wp_required_field_indicator) wp-includes/general-template.php | Assigns a visual indicator for required form fields. |
| [get\_post\_type()](get_post_type) wp-includes/post.php | Retrieves the post type of the current post or of a given post. |
| [post\_type\_supports()](post_type_supports) wp-includes/post.php | Checks a post type’s support for a given feature. |
| [wp\_match\_mime\_types()](wp_match_mime_types) wp-includes/post.php | Checks a MIME-Type against a list. |
| [get\_post\_mime\_types()](get_post_mime_types) wp-includes/post.php | Gets default post mime types. |
| [wp\_get\_attachment\_metadata()](wp_get_attachment_metadata) wp-includes/post.php | Retrieves attachment metadata for attachment ID. |
| [wp\_attachment\_is\_image()](wp_attachment_is_image) wp-includes/post.php | Determines whether an attachment is an image. |
| [wp\_get\_attachment\_image\_src()](wp_get_attachment_image_src) wp-includes/media.php | Retrieves an image to represent an attachment. |
| [wp\_image\_editor\_supports()](wp_image_editor_supports) wp-includes/media.php | Tests whether there is an editor that supports a given mime type or methods. |
| [get\_post\_thumbnail\_id()](get_post_thumbnail_id) wp-includes/post-thumbnail-template.php | Retrieves the post thumbnail ID. |
| [mysql2date()](mysql2date) wp-includes/functions.php | Converts given MySQL date string into a different format. |
| [get\_attached\_file()](get_attached_file) wp-includes/post.php | Retrieves attached file path based on attachment ID. |
| [user\_can\_richedit()](user_can_richedit) wp-includes/general-template.php | Determines whether the user can access the visual editor. |
| [esc\_attr\_\_()](esc_attr__) wp-includes/l10n.php | Retrieves the translation of $text and escapes it for safe use in an attribute. |
| [wp\_create\_nonce()](wp_create_nonce) wp-includes/pluggable.php | Creates a cryptographic token tied to a specific action, user, user session, and window of time. |
| [get\_submit\_button()](get_submit_button) wp-admin/includes/template.php | Returns a submit button, with provided text and appropriate class. |
| [get\_attachment\_fields\_to\_edit()](get_attachment_fields_to_edit) wp-admin/includes/media.php | Retrieves the attachment fields to edit form fields. |
| [wp\_html\_excerpt()](wp_html_excerpt) wp-includes/formatting.php | Safely extracts not more than the first $count characters from HTML string. |
| [get\_post\_type\_object()](get_post_type_object) wp-includes/post.php | Retrieves a post type object by name. |
| [get\_post()](get_post) wp-includes/post.php | Retrieves post data given a post ID or post object. |
| [current\_user\_can()](current_user_can) wp-includes/capabilities.php | Returns whether the current user has the specified capability. |
| [current\_theme\_supports()](current_theme_supports) wp-includes/theme.php | Checks a theme’s support for a given feature. |
| [wp\_basename()](wp_basename) wp-includes/formatting.php | i18n-friendly version of basename(). |
| [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. |
| [wp\_parse\_args()](wp_parse_args) wp-includes/functions.php | Merges user defined arguments into defaults array. |
| [esc\_html()](esc_html) wp-includes/formatting.php | Escaping for HTML blocks. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| [get\_permalink()](get_permalink) wp-includes/link-template.php | Retrieves the full permalink for the current post or post ID. |
| [esc\_attr()](esc_attr) wp-includes/formatting.php | Escaping for HTML attributes. |
| [absint()](absint) wp-includes/functions.php | Converts a value to non-negative integer. |
| [wp\_nonce\_url()](wp_nonce_url) wp-includes/functions.php | Retrieves URL with nonce added to URL query. |
| Used By | Description |
| --- | --- |
| [get\_media\_items()](get_media_items) wp-admin/includes/media.php | Retrieves HTML for media items of post gallery. |
| Version | Description |
| --- | --- |
| [2.5.0](https://developer.wordpress.org/reference/since/2.5.0/) | Introduced. |
| programming_docs |
wordpress mysql2date( string $format, string $date, bool $translate = true ): string|int|false mysql2date( string $format, string $date, bool $translate = true ): string|int|false
====================================================================================
Converts given MySQL date string into a different format.
* `$format` should be a PHP date format string.
+ ‘U’ and ‘G’ formats will return an integer sum of timestamp with timezone offset.
+ `$date` is expected to be local time in MySQL format (`Y-m-d H:i:s`).
Historically UTC time could be passed to the function to produce Unix timestamp.
If `$translate` is true then the given date and format string will be passed to `wp_date()` for translation.
`$format` string Required Format of the date to return. `$date` string Required Date string to convert. `$translate` bool Optional Whether the return date should be translated. Default: `true`
string|int|false Integer if `$format` is `'U'` or `'G'`, string otherwise.
False on failure.
File: `wp-includes/functions.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/functions.php/)
```
function mysql2date( $format, $date, $translate = true ) {
if ( empty( $date ) ) {
return false;
}
$datetime = date_create( $date, wp_timezone() );
if ( false === $datetime ) {
return false;
}
// Returns a sum of timestamp with timezone offset. Ideally should never be used.
if ( 'G' === $format || 'U' === $format ) {
return $datetime->getTimestamp() + $datetime->getOffset();
}
if ( $translate ) {
return wp_date( $format, $datetime->getTimestamp() );
}
return $datetime->format( $format );
}
```
| Uses | Description |
| --- | --- |
| [wp\_timezone()](wp_timezone) wp-includes/functions.php | Retrieves the timezone of the site as a `DateTimeZone` object. |
| [wp\_date()](wp_date) wp-includes/functions.php | Retrieves the date, in localized format. |
| Used By | Description |
| --- | --- |
| [WP\_Query::generate\_postdata()](../classes/wp_query/generate_postdata) wp-includes/class-wp-query.php | Generate post data. |
| [WP\_Customize\_Manager::save\_changeset\_post()](../classes/wp_customize_manager/save_changeset_post) wp-includes/class-wp-customize-manager.php | Saves the post for the loaded changeset. |
| [wp\_check\_comment\_flood()](wp_check_comment_flood) wp-includes/comment.php | Checks whether comment flooding is occurring. |
| [mysql\_to\_rfc3339()](mysql_to_rfc3339) wp-includes/functions.php | Parses and formats a MySQL datetime (Y-m-d H:i:s) for ISO8601 (Y-m-d\TH:i:s). |
| [WP\_MS\_Sites\_List\_Table::column\_lastupdated()](../classes/wp_ms_sites_list_table/column_lastupdated) wp-admin/includes/class-wp-ms-sites-list-table.php | Handles the lastupdated column output. |
| [WP\_MS\_Sites\_List\_Table::column\_registered()](../classes/wp_ms_sites_list_table/column_registered) wp-admin/includes/class-wp-ms-sites-list-table.php | Handles the registered column output. |
| [WP\_MS\_Users\_List\_Table::column\_registered()](../classes/wp_ms_users_list_table/column_registered) wp-admin/includes/class-wp-ms-users-list-table.php | Handles the registered date column output. |
| [export\_wp()](export_wp) wp-admin/includes/export.php | Generates the WXR export file for download. |
| [get\_inline\_data()](get_inline_data) wp-admin/includes/template.php | Adds hidden fields with the data for use in the inline editor for posts and pages. |
| [touch\_time()](touch_time) wp-admin/includes/template.php | Prints out HTML form date elements for editing post or comment publish date. |
| [get\_media\_item()](get_media_item) wp-admin/includes/media.php | Retrieves HTML form for modifying the image attachment. |
| [wp\_ajax\_wp\_fullscreen\_save\_post()](wp_ajax_wp_fullscreen_save_post) wp-admin/includes/ajax-actions.php | Ajax handler for saving posts from the fullscreen editor. |
| [wp\_ajax\_find\_posts()](wp_ajax_find_posts) wp-admin/includes/ajax-actions.php | Ajax handler for querying posts for the Find Posts modal. |
| [wp\_get\_archives()](wp_get_archives) wp-includes/general-template.php | Displays archive links based on type and format. |
| [the\_date\_xml()](the_date_xml) wp-includes/general-template.php | Outputs the date in iso8601 format for xml files. |
| [get\_boundary\_post\_rel\_link()](get_boundary_post_rel_link) wp-includes/deprecated.php | Get boundary post relational link. |
| [get\_parent\_post\_rel\_link()](get_parent_post_rel_link) wp-includes/deprecated.php | Get parent post relational link. |
| [WP::send\_headers()](../classes/wp/send_headers) wp-includes/class-wp.php | Sends additional HTTP headers for caching, content type, etc. |
| [get\_adjacent\_post\_link()](get_adjacent_post_link) wp-includes/link-template.php | Retrieves the adjacent post link. |
| [get\_adjacent\_post\_rel\_link()](get_adjacent_post_rel_link) wp-includes/link-template.php | Retrieves the adjacent post relational link. |
| [Walker\_Page::start\_el()](../classes/walker_page/start_el) wp-includes/class-walker-page.php | Outputs the beginning of the current element in the tree. |
| [wp\_prepare\_attachment\_for\_js()](wp_prepare_attachment_for_js) wp-includes/media.php | Prepares an attachment post object for JS, where it is expected to be JSON-encoded and fit into an Attachment model. |
| [wpmu\_validate\_user\_signup()](wpmu_validate_user_signup) wp-includes/ms-functions.php | Sanitizes and validates data required for a user sign-up. |
| [wpmu\_validate\_blog\_signup()](wpmu_validate_blog_signup) wp-includes/ms-functions.php | Processes new site registrations. |
| [wp\_xmlrpc\_server::wp\_editPost()](../classes/wp_xmlrpc_server/wp_editpost) wp-includes/class-wp-xmlrpc-server.php | Edit a post for any registered post type. |
| [wp\_xmlrpc\_server::\_convert\_date()](../classes/wp_xmlrpc_server/_convert_date) wp-includes/class-wp-xmlrpc-server.php | Convert a WordPress date string to an [IXR\_Date](../classes/ixr_date) object. |
| [wp\_xmlrpc\_server::\_convert\_date\_gmt()](../classes/wp_xmlrpc_server/_convert_date_gmt) wp-includes/class-wp-xmlrpc-server.php | Convert a WordPress GMT date string to an [IXR\_Date](../classes/ixr_date) object. |
| [get\_comment\_time()](get_comment_time) wp-includes/comment-template.php | Retrieves the comment time of the current comment. |
| [get\_comment\_date()](get_comment_date) wp-includes/comment-template.php | Retrieves the comment date of the current comment. |
| [\_WP\_Editors::wp\_link\_query()](../classes/_wp_editors/wp_link_query) wp-includes/class-wp-editor.php | Performs post queries for internal linking. |
| Version | Description |
| --- | --- |
| [0.71](https://developer.wordpress.org/reference/since/0.71/) | Introduced. |
wordpress wp_insert_attachment( string|array $args, string|false $file = false, int $parent, bool $wp_error = false, bool $fire_after_hooks = true ): int|WP_Error wp\_insert\_attachment( string|array $args, string|false $file = false, int $parent, bool $wp\_error = false, bool $fire\_after\_hooks = true ): int|WP\_Error
==============================================================================================================================================================
Inserts an attachment.
If you set the ‘ID’ in the $args 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.
* [wp\_insert\_post()](wp_insert_post)
`$args` string|array Required Arguments for inserting an attachment. `$file` string|false Optional Filename. Default: `false`
`$parent` int Optional Parent post ID. `$wp_error` bool Optional Whether to return a [WP\_Error](../classes/wp_error) on failure. Default: `false`
`$fire_after_hooks` bool Optional Whether to fire the after insert hooks. Default: `true`
int|[WP\_Error](../classes/wp_error) The attachment ID on success. The value 0 or [WP\_Error](../classes/wp_error) on failure.
File: `wp-includes/post.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/post.php/)
```
function wp_insert_attachment( $args, $file = false, $parent = 0, $wp_error = false, $fire_after_hooks = true ) {
$defaults = array(
'file' => $file,
'post_parent' => 0,
);
$data = wp_parse_args( $args, $defaults );
if ( ! empty( $parent ) ) {
$data['post_parent'] = $parent;
}
$data['post_type'] = 'attachment';
return wp_insert_post( $data, $wp_error, $fire_after_hooks );
}
```
| Uses | Description |
| --- | --- |
| [wp\_insert\_post()](wp_insert_post) wp-includes/post.php | Inserts or update a post. |
| [wp\_parse\_args()](wp_parse_args) wp-includes/functions.php | Merges user defined arguments into defaults array. |
| Used By | Description |
| --- | --- |
| [WP\_REST\_Attachments\_Controller::edit\_media\_item()](../classes/wp_rest_attachments_controller/edit_media_item) wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php | Applies edits to a media item and creates a new attachment record. |
| [WP\_REST\_Attachments\_Controller::insert\_attachment()](../classes/wp_rest_attachments_controller/insert_attachment) wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php | Inserts the attachment post in the database. Does not update the attachment meta. |
| [WP\_Site\_Icon::insert\_attachment()](../classes/wp_site_icon/insert_attachment) wp-admin/includes/class-wp-site-icon.php | Inserts an attachment. |
| [wp\_ajax\_crop\_image()](wp_ajax_crop_image) wp-admin/includes/ajax-actions.php | Ajax handler for cropping an image. |
| [File\_Upload\_Upgrader::\_\_construct()](../classes/file_upload_upgrader/__construct) wp-admin/includes/class-file-upload-upgrader.php | Construct the upgrader for a form. |
| [wp\_generate\_attachment\_metadata()](wp_generate_attachment_metadata) wp-admin/includes/image.php | Generates attachment meta data and create image sub-sizes for images. |
| [media\_handle\_upload()](media_handle_upload) wp-admin/includes/media.php | Saves a file submitted from a POST request and create an attachment post for it. |
| [media\_handle\_sideload()](media_handle_sideload) wp-admin/includes/media.php | Handles a side-loaded file in the same way as an uploaded file is handled by [media\_handle\_upload()](media_handle_upload) . |
| [wp\_import\_handle\_upload()](wp_import_handle_upload) wp-admin/includes/import.php | Handles importer uploading and adds attachment. |
| [Custom\_Image\_Header::insert\_attachment()](../classes/custom_image_header/insert_attachment) wp-admin/includes/class-custom-image-header.php | Insert an attachment and its metadata. |
| [Custom\_Image\_Header::step\_2\_manage\_upload()](../classes/custom_image_header/step_2_manage_upload) wp-admin/includes/class-custom-image-header.php | Upload the file to be cropped in the second step. |
| [Custom\_Background::handle\_upload()](../classes/custom_background/handle_upload) wp-admin/includes/class-custom-background.php | Handles an Image upload for the background image. |
| [wp\_update\_post()](wp_update_post) wp-includes/post.php | Updates a post with new post data. |
| [wp\_xmlrpc\_server::mw\_newMediaObject()](../classes/wp_xmlrpc_server/mw_newmediaobject) wp-includes/class-wp-xmlrpc-server.php | Uploads a file, following your settings. |
| Version | Description |
| --- | --- |
| [5.6.0](https://developer.wordpress.org/reference/since/5.6.0/) | Added the `$fire_after_hooks` parameter. |
| [4.7.0](https://developer.wordpress.org/reference/since/4.7.0/) | Added the `$wp_error` parameter to allow a [WP\_Error](../classes/wp_error) to be returned on failure. |
| [2.0.0](https://developer.wordpress.org/reference/since/2.0.0/) | Introduced. |
wordpress _post_format_get_term( object $term ): object \_post\_format\_get\_term( object $term ): object
=================================================
This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.
Remove the post format prefix from the name property of the term object created by [get\_term()](get_term) .
`$term` object Required object
File: `wp-includes/post-formats.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/post-formats.php/)
```
function _post_format_get_term( $term ) {
if ( isset( $term->slug ) ) {
$term->name = get_post_format_string( str_replace( 'post-format-', '', $term->slug ) );
}
return $term;
}
```
| Uses | Description |
| --- | --- |
| [get\_post\_format\_string()](get_post_format_string) wp-includes/post-formats.php | Returns a pretty, translated version of a post format slug |
| Version | Description |
| --- | --- |
| [3.1.0](https://developer.wordpress.org/reference/since/3.1.0/) | Introduced. |
wordpress wp_filter_content_tags( string $content, string $context = null ): string wp\_filter\_content\_tags( string $content, string $context = null ): string
============================================================================
Filters specific tags in post content and modifies their markup.
Modifies HTML tags in post content to include new browser and HTML technologies that may not have existed at the time of post creation. These modifications currently include adding `srcset`, `sizes`, and `loading` attributes to `img` HTML tags, as well as adding `loading` attributes to `iframe` HTML tags.
Future similar optimizations should be added/expected here.
* [wp\_img\_tag\_add\_width\_and\_height\_attr()](wp_img_tag_add_width_and_height_attr)
* [wp\_img\_tag\_add\_srcset\_and\_sizes\_attr()](wp_img_tag_add_srcset_and_sizes_attr)
* [wp\_img\_tag\_add\_loading\_attr()](wp_img_tag_add_loading_attr)
* [wp\_iframe\_tag\_add\_loading\_attr()](wp_iframe_tag_add_loading_attr)
`$content` string Required The HTML content to be filtered. `$context` string Optional Additional context to pass to the filters.
Defaults to `current_filter()` when not set. Default: `null`
string Converted content with images modified.
File: `wp-includes/media.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/media.php/)
```
function wp_filter_content_tags( $content, $context = null ) {
if ( null === $context ) {
$context = current_filter();
}
$add_img_loading_attr = wp_lazy_loading_enabled( 'img', $context );
$add_iframe_loading_attr = wp_lazy_loading_enabled( 'iframe', $context );
if ( ! preg_match_all( '/<(img|iframe)\s[^>]+>/', $content, $matches, PREG_SET_ORDER ) ) {
return $content;
}
// List of the unique `img` tags found in $content.
$images = array();
// List of the unique `iframe` tags found in $content.
$iframes = array();
foreach ( $matches as $match ) {
list( $tag, $tag_name ) = $match;
switch ( $tag_name ) {
case 'img':
if ( preg_match( '/wp-image-([0-9]+)/i', $tag, $class_id ) ) {
$attachment_id = absint( $class_id[1] );
if ( $attachment_id ) {
// If exactly the same image tag is used more than once, overwrite it.
// All identical tags will be replaced later with 'str_replace()'.
$images[ $tag ] = $attachment_id;
break;
}
}
$images[ $tag ] = 0;
break;
case 'iframe':
$iframes[ $tag ] = 0;
break;
}
}
// Reduce the array to unique attachment IDs.
$attachment_ids = array_unique( array_filter( array_values( $images ) ) );
if ( count( $attachment_ids ) > 1 ) {
/*
* Warm the object cache with post and meta information for all found
* images to avoid making individual database calls.
*/
_prime_post_caches( $attachment_ids, false, true );
}
// Iterate through the matches in order of occurrence as it is relevant for whether or not to lazy-load.
foreach ( $matches as $match ) {
// Filter an image match.
if ( isset( $images[ $match[0] ] ) ) {
$filtered_image = $match[0];
$attachment_id = $images[ $match[0] ];
// Add 'width' and 'height' attributes if applicable.
if ( $attachment_id > 0 && false === strpos( $filtered_image, ' width=' ) && false === strpos( $filtered_image, ' height=' ) ) {
$filtered_image = wp_img_tag_add_width_and_height_attr( $filtered_image, $context, $attachment_id );
}
// Add 'srcset' and 'sizes' attributes if applicable.
if ( $attachment_id > 0 && false === strpos( $filtered_image, ' srcset=' ) ) {
$filtered_image = wp_img_tag_add_srcset_and_sizes_attr( $filtered_image, $context, $attachment_id );
}
// Add 'loading' attribute if applicable.
if ( $add_img_loading_attr && false === strpos( $filtered_image, ' loading=' ) ) {
$filtered_image = wp_img_tag_add_loading_attr( $filtered_image, $context );
}
// Add 'decoding=async' attribute unless a 'decoding' attribute is already present.
if ( ! str_contains( $filtered_image, ' decoding=' ) ) {
$filtered_image = wp_img_tag_add_decoding_attr( $filtered_image, $context );
}
/**
* Filters an img tag within the content for a given context.
*
* @since 6.0.0
*
* @param string $filtered_image Full img tag with attributes that will replace the source img tag.
* @param string $context Additional context, like the current filter name or the function name from where this was called.
* @param int $attachment_id The image attachment ID. May be 0 in case the image is not an attachment.
*/
$filtered_image = apply_filters( 'wp_content_img_tag', $filtered_image, $context, $attachment_id );
if ( $filtered_image !== $match[0] ) {
$content = str_replace( $match[0], $filtered_image, $content );
}
/*
* Unset image lookup to not run the same logic again unnecessarily if the same image tag is used more than
* once in the same blob of content.
*/
unset( $images[ $match[0] ] );
}
// Filter an iframe match.
if ( isset( $iframes[ $match[0] ] ) ) {
$filtered_iframe = $match[0];
// Add 'loading' attribute if applicable.
if ( $add_iframe_loading_attr && false === strpos( $filtered_iframe, ' loading=' ) ) {
$filtered_iframe = wp_iframe_tag_add_loading_attr( $filtered_iframe, $context );
}
if ( $filtered_iframe !== $match[0] ) {
$content = str_replace( $match[0], $filtered_iframe, $content );
}
/*
* Unset iframe lookup to not run the same logic again unnecessarily if the same iframe tag is used more
* than once in the same blob of content.
*/
unset( $iframes[ $match[0] ] );
}
}
return $content;
}
```
[apply\_filters( 'wp\_content\_img\_tag', string $filtered\_image, string $context, int $attachment\_id )](../hooks/wp_content_img_tag)
Filters an img tag within the content for a given context.
| Uses | Description |
| --- | --- |
| [wp\_img\_tag\_add\_decoding\_attr()](wp_img_tag_add_decoding_attr) wp-includes/media.php | Adds `decoding` attribute to an `img` HTML tag. |
| [wp\_iframe\_tag\_add\_loading\_attr()](wp_iframe_tag_add_loading_attr) wp-includes/media.php | Adds `loading` attribute to an `iframe` HTML tag. |
| [wp\_img\_tag\_add\_width\_and\_height\_attr()](wp_img_tag_add_width_and_height_attr) wp-includes/media.php | Adds `width` and `height` attributes to an `img` HTML tag. |
| [wp\_img\_tag\_add\_srcset\_and\_sizes\_attr()](wp_img_tag_add_srcset_and_sizes_attr) wp-includes/media.php | Adds `srcset` and `sizes` attributes to an existing `img` HTML tag. |
| [wp\_img\_tag\_add\_loading\_attr()](wp_img_tag_add_loading_attr) wp-includes/media.php | Adds `loading` attribute to an `img` HTML tag. |
| [wp\_lazy\_loading\_enabled()](wp_lazy_loading_enabled) wp-includes/media.php | Determines whether to add the `loading` attribute to the specified tag in the specified context. |
| [current\_filter()](current_filter) wp-includes/plugin.php | Retrieves the name of the current filter hook. |
| [\_prime\_post\_caches()](_prime_post_caches) wp-includes/post.php | Adds any posts from the given IDs to the cache that do not already exist in cache. |
| [absint()](absint) wp-includes/functions.php | Converts a value to non-negative integer. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| Used By | Description |
| --- | --- |
| [get\_the\_block\_template\_html()](get_the_block_template_html) wp-includes/block-template.php | Returns the markup for the current template. |
| [wp\_make\_content\_images\_responsive()](wp_make_content_images_responsive) wp-includes/deprecated.php | Filters ‘img’ elements in post content to add ‘srcset’ and ‘sizes’ attributes. |
| Version | Description |
| --- | --- |
| [5.7.0](https://developer.wordpress.org/reference/since/5.7.0/) | Now supports adding `loading` attributes to `iframe` tags. |
| [5.5.0](https://developer.wordpress.org/reference/since/5.5.0/) | Introduced. |
| programming_docs |
wordpress wp_is_site_url_using_https(): bool wp\_is\_site\_url\_using\_https(): bool
=======================================
Checks whether the current site’s URL where WordPress is stored is using HTTPS.
This checks the URL where WordPress application files (e.g. wp-blog-header.php or the wp-admin/ folder) are accessible.
* [site\_url()](site_url)
bool True if using HTTPS, false otherwise.
File: `wp-includes/https-detection.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/https-detection.php/)
```
function wp_is_site_url_using_https() {
// Use direct option access for 'siteurl' and manually run the 'site_url'
// filter because `site_url()` will adjust the scheme based on what the
// current request is using.
/** This filter is documented in wp-includes/link-template.php */
$site_url = apply_filters( 'site_url', get_option( 'siteurl' ), '', null, null );
return 'https' === wp_parse_url( $site_url, PHP_URL_SCHEME );
}
```
[apply\_filters( 'site\_url', string $url, string $path, string|null $scheme, int|null $blog\_id )](../hooks/site_url)
Filters the site URL.
| Uses | Description |
| --- | --- |
| [wp\_parse\_url()](wp_parse_url) wp-includes/http.php | A wrapper for PHP’s parse\_url() function that handles consistency in the return values across PHP versions. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| [get\_option()](get_option) wp-includes/option.php | Retrieves an option value based on an option name. |
| Used By | Description |
| --- | --- |
| [wp\_is\_using\_https()](wp_is_using_https) wp-includes/https-detection.php | Checks whether the website is using HTTPS. |
| [WP\_Site\_Health::get\_test\_https\_status()](../classes/wp_site_health/get_test_https_status) wp-admin/includes/class-wp-site-health.php | Tests if the site is serving content over HTTPS. |
| Version | Description |
| --- | --- |
| [5.7.0](https://developer.wordpress.org/reference/since/5.7.0/) | Introduced. |
wordpress sanitize_option( string $option, string $value ): string sanitize\_option( string $option, string $value ): string
=========================================================
Sanitizes various option values based on the nature of the option.
This is basically a switch statement which will pass $value through a number of functions depending on the $option.
`$option` string Required The name of the option. `$value` string Required The unsanitised value. string Sanitized value.
After the value has been handled by the functions in the switch statement, it will be passed through a [sanitize\_option\_$option](../hooks/sanitize_option_option) filter.
New options can be defined by adding an appropriate [sanitize\_option\_$option](../hooks/sanitize_option_option) filter (e.g. ‘sanitize\_option\_avatar’ for a filter for an ‘avatar’ option)
Existing options handled by [sanitize\_option()](sanitize_option) :
admin\_email
new\_admin\_email
thumbnail\_size\_w
thumbnail\_size\_h
medium\_size\_w
medium\_size\_h
large\_size\_w
large\_size\_h
mailserver\_port
comment\_max\_links
page\_on\_front
page\_for\_posts
rss\_excerpt\_length
default\_category
default\_email\_category
default\_link\_category
close\_comments\_days\_old
comments\_per\_page
thread\_comments\_depth
users\_can\_register
start\_of\_week
posts\_per\_page
posts\_per\_rss
default\_ping\_status
default\_comment\_status
blogdescription
blogname
blog\_charset
blog\_public
date\_format
time\_format
mailserver\_url
mailserver\_login
mailserver\_pass
upload\_path
ping\_sites
gmt\_offset
siteurl
home
WPLANG
illegal\_names
limited\_email\_domains
banned\_email\_domains
timezone\_string
permalink\_structure
category\_base
tag\_base
File: `wp-includes/formatting.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/formatting.php/)
```
function sanitize_option( $option, $value ) {
global $wpdb;
$original_value = $value;
$error = null;
switch ( $option ) {
case 'admin_email':
case 'new_admin_email':
$value = $wpdb->strip_invalid_text_for_column( $wpdb->options, 'option_value', $value );
if ( is_wp_error( $value ) ) {
$error = $value->get_error_message();
} else {
$value = sanitize_email( $value );
if ( ! is_email( $value ) ) {
$error = __( 'The email address entered did not appear to be a valid email address. Please enter a valid email address.' );
}
}
break;
case 'thumbnail_size_w':
case 'thumbnail_size_h':
case 'medium_size_w':
case 'medium_size_h':
case 'medium_large_size_w':
case 'medium_large_size_h':
case 'large_size_w':
case 'large_size_h':
case 'mailserver_port':
case 'comment_max_links':
case 'page_on_front':
case 'page_for_posts':
case 'rss_excerpt_length':
case 'default_category':
case 'default_email_category':
case 'default_link_category':
case 'close_comments_days_old':
case 'comments_per_page':
case 'thread_comments_depth':
case 'users_can_register':
case 'start_of_week':
case 'site_icon':
case 'fileupload_maxk':
$value = absint( $value );
break;
case 'posts_per_page':
case 'posts_per_rss':
$value = (int) $value;
if ( empty( $value ) ) {
$value = 1;
}
if ( $value < -1 ) {
$value = abs( $value );
}
break;
case 'default_ping_status':
case 'default_comment_status':
// Options that if not there have 0 value but need to be something like "closed".
if ( '0' == $value || '' === $value ) {
$value = 'closed';
}
break;
case 'blogdescription':
case 'blogname':
$value = $wpdb->strip_invalid_text_for_column( $wpdb->options, 'option_value', $value );
if ( $value !== $original_value ) {
$value = $wpdb->strip_invalid_text_for_column( $wpdb->options, 'option_value', wp_encode_emoji( $original_value ) );
}
if ( is_wp_error( $value ) ) {
$error = $value->get_error_message();
} else {
$value = esc_html( $value );
}
break;
case 'blog_charset':
$value = preg_replace( '/[^a-zA-Z0-9_-]/', '', $value ); // Strips slashes.
break;
case 'blog_public':
// This is the value if the settings checkbox is not checked on POST. Don't rely on this.
if ( null === $value ) {
$value = 1;
} else {
$value = (int) $value;
}
break;
case 'date_format':
case 'time_format':
case 'mailserver_url':
case 'mailserver_login':
case 'mailserver_pass':
case 'upload_path':
$value = $wpdb->strip_invalid_text_for_column( $wpdb->options, 'option_value', $value );
if ( is_wp_error( $value ) ) {
$error = $value->get_error_message();
} else {
$value = strip_tags( $value );
$value = wp_kses_data( $value );
}
break;
case 'ping_sites':
$value = explode( "\n", $value );
$value = array_filter( array_map( 'trim', $value ) );
$value = array_filter( array_map( 'sanitize_url', $value ) );
$value = implode( "\n", $value );
break;
case 'gmt_offset':
$value = preg_replace( '/[^0-9:.-]/', '', $value ); // Strips slashes.
break;
case 'siteurl':
$value = $wpdb->strip_invalid_text_for_column( $wpdb->options, 'option_value', $value );
if ( is_wp_error( $value ) ) {
$error = $value->get_error_message();
} else {
if ( preg_match( '#http(s?)://(.+)#i', $value ) ) {
$value = sanitize_url( $value );
} else {
$error = __( 'The WordPress address you entered did not appear to be a valid URL. Please enter a valid URL.' );
}
}
break;
case 'home':
$value = $wpdb->strip_invalid_text_for_column( $wpdb->options, 'option_value', $value );
if ( is_wp_error( $value ) ) {
$error = $value->get_error_message();
} else {
if ( preg_match( '#http(s?)://(.+)#i', $value ) ) {
$value = sanitize_url( $value );
} else {
$error = __( 'The Site address you entered did not appear to be a valid URL. Please enter a valid URL.' );
}
}
break;
case 'WPLANG':
$allowed = get_available_languages();
if ( ! is_multisite() && defined( 'WPLANG' ) && '' !== WPLANG && 'en_US' !== WPLANG ) {
$allowed[] = WPLANG;
}
if ( ! in_array( $value, $allowed, true ) && ! empty( $value ) ) {
$value = get_option( $option );
}
break;
case 'illegal_names':
$value = $wpdb->strip_invalid_text_for_column( $wpdb->options, 'option_value', $value );
if ( is_wp_error( $value ) ) {
$error = $value->get_error_message();
} else {
if ( ! is_array( $value ) ) {
$value = explode( ' ', $value );
}
$value = array_values( array_filter( array_map( 'trim', $value ) ) );
if ( ! $value ) {
$value = '';
}
}
break;
case 'limited_email_domains':
case 'banned_email_domains':
$value = $wpdb->strip_invalid_text_for_column( $wpdb->options, 'option_value', $value );
if ( is_wp_error( $value ) ) {
$error = $value->get_error_message();
} else {
if ( ! is_array( $value ) ) {
$value = explode( "\n", $value );
}
$domains = array_values( array_filter( array_map( 'trim', $value ) ) );
$value = array();
foreach ( $domains as $domain ) {
if ( ! preg_match( '/(--|\.\.)/', $domain ) && preg_match( '|^([a-zA-Z0-9-\.])+$|', $domain ) ) {
$value[] = $domain;
}
}
if ( ! $value ) {
$value = '';
}
}
break;
case 'timezone_string':
$allowed_zones = timezone_identifiers_list( DateTimeZone::ALL_WITH_BC );
if ( ! in_array( $value, $allowed_zones, true ) && ! empty( $value ) ) {
$error = __( 'The timezone you have entered is not valid. Please select a valid timezone.' );
}
break;
case 'permalink_structure':
case 'category_base':
case 'tag_base':
$value = $wpdb->strip_invalid_text_for_column( $wpdb->options, 'option_value', $value );
if ( is_wp_error( $value ) ) {
$error = $value->get_error_message();
} else {
$value = sanitize_url( $value );
$value = str_replace( 'http://', '', $value );
}
if ( 'permalink_structure' === $option && null === $error
&& '' !== $value && ! preg_match( '/%[^\/%]+%/', $value )
) {
$error = sprintf(
/* translators: %s: Documentation URL. */
__( 'A structure tag is required when using custom permalinks. <a href="%s">Learn more</a>' ),
__( 'https://wordpress.org/support/article/using-permalinks/#choosing-your-permalink-structure' )
);
}
break;
case 'default_role':
if ( ! get_role( $value ) && get_role( 'subscriber' ) ) {
$value = 'subscriber';
}
break;
case 'moderation_keys':
case 'disallowed_keys':
$value = $wpdb->strip_invalid_text_for_column( $wpdb->options, 'option_value', $value );
if ( is_wp_error( $value ) ) {
$error = $value->get_error_message();
} else {
$value = explode( "\n", $value );
$value = array_filter( array_map( 'trim', $value ) );
$value = array_unique( $value );
$value = implode( "\n", $value );
}
break;
}
if ( null !== $error ) {
if ( '' === $error && is_wp_error( $value ) ) {
/* translators: 1: Option name, 2: Error code. */
$error = sprintf( __( 'Could not sanitize the %1$s option. Error code: %2$s' ), $option, $value->get_error_code() );
}
$value = get_option( $option );
if ( function_exists( 'add_settings_error' ) ) {
add_settings_error( $option, "invalid_{$option}", $error );
}
}
/**
* Filters an option value following sanitization.
*
* @since 2.3.0
* @since 4.3.0 Added the `$original_value` parameter.
*
* @param string $value The sanitized option value.
* @param string $option The option name.
* @param string $original_value The original value passed to the function.
*/
return apply_filters( "sanitize_option_{$option}", $value, $option, $original_value );
}
```
[apply\_filters( "sanitize\_option\_{$option}", string $value, string $option, string $original\_value )](../hooks/sanitize_option_option)
Filters an option value following sanitization.
| Uses | Description |
| --- | --- |
| [wpdb::strip\_invalid\_text\_for\_column()](../classes/wpdb/strip_invalid_text_for_column) wp-includes/class-wpdb.php | Strips any invalid characters from the string for a given table and column. |
| [wp\_encode\_emoji()](wp_encode_emoji) wp-includes/formatting.php | Converts emoji characters to their equivalent HTML entity. |
| [add\_settings\_error()](add_settings_error) wp-admin/includes/template.php | Registers a settings error to be displayed to the user. |
| [get\_role()](get_role) wp-includes/capabilities.php | Retrieves role object. |
| [get\_available\_languages()](get_available_languages) wp-includes/l10n.php | Gets all available languages based on the presence of \*.mo files in a given directory. |
| [sanitize\_email()](sanitize_email) wp-includes/formatting.php | Strips out all characters that are not allowable in an email. |
| [is\_email()](is_email) wp-includes/formatting.php | Verifies that an email is valid. |
| [sanitize\_url()](sanitize_url) wp-includes/formatting.php | Sanitizes a URL for database or redirect usage. |
| [wp\_kses\_data()](wp_kses_data) wp-includes/kses.php | Sanitize content with allowed HTML KSES rules. |
| [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. |
| [esc\_html()](esc_html) wp-includes/formatting.php | Escaping for HTML blocks. |
| [is\_multisite()](is_multisite) wp-includes/load.php | If Multisite is enabled. |
| [absint()](absint) wp-includes/functions.php | Converts a value to non-negative integer. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| [get\_option()](get_option) wp-includes/option.php | Retrieves an option value based on an option name. |
| [is\_wp\_error()](is_wp_error) wp-includes/load.php | Checks whether the given variable is a WordPress Error. |
| Used By | Description |
| --- | --- |
| [update\_network\_option()](update_network_option) wp-includes/option.php | Updates the value of a network option that was already added. |
| [add\_network\_option()](add_network_option) wp-includes/option.php | Adds a new network option. |
| [get\_settings\_errors()](get_settings_errors) wp-admin/includes/template.php | Fetches settings errors registered by [add\_settings\_error()](add_settings_error) . |
| [wp\_ajax\_date\_format()](wp_ajax_date_format) wp-admin/includes/ajax-actions.php | Ajax handler for date formatting. |
| [wp\_ajax\_time\_format()](wp_ajax_time_format) wp-admin/includes/ajax-actions.php | Ajax handler for time formatting. |
| [update\_option()](update_option) wp-includes/option.php | Updates the value of an option that was already added. |
| [add\_option()](add_option) wp-includes/option.php | Adds a new option. |
| Version | Description |
| --- | --- |
| [2.0.5](https://developer.wordpress.org/reference/since/2.0.5/) | Introduced. |
wordpress network_site_url( string $path = '', string|null $scheme = null ): string network\_site\_url( string $path = '', string|null $scheme = null ): string
===========================================================================
Retrieves the site URL for the current network.
Returns the site URL with the appropriate protocol, ‘https’ if [is\_ssl()](is_ssl) and ‘http’ otherwise. If $scheme is ‘http’ or ‘https’, [is\_ssl()](is_ssl) is overridden.
* [set\_url\_scheme()](set_url_scheme)
`$path` string Optional Path relative to the site URL. Default: `''`
`$scheme` string|null Optional Scheme to give the site URL context. Accepts `'http'`, `'https'`, or `'relative'`. Default: `null`
string Site URL link with optional path appended.
File: `wp-includes/link-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/link-template.php/)
```
function network_site_url( $path = '', $scheme = null ) {
if ( ! is_multisite() ) {
return site_url( $path, $scheme );
}
$current_network = get_network();
if ( 'relative' === $scheme ) {
$url = $current_network->path;
} else {
$url = set_url_scheme( 'http://' . $current_network->domain . $current_network->path, $scheme );
}
if ( $path && is_string( $path ) ) {
$url .= ltrim( $path, '/' );
}
/**
* Filters the network site URL.
*
* @since 3.0.0
*
* @param string $url The complete network site URL including scheme and path.
* @param string $path Path relative to the network site URL. Blank string if
* no path is specified.
* @param string|null $scheme Scheme to give the URL context. Accepts 'http', 'https',
* 'relative' or null.
*/
return apply_filters( 'network_site_url', $url, $path, $scheme );
}
```
[apply\_filters( 'network\_site\_url', string $url, string $path, string|null $scheme )](../hooks/network_site_url)
Filters the network site URL.
| Uses | Description |
| --- | --- |
| [get\_network()](get_network) wp-includes/ms-network.php | Retrieves network data given a network ID or network object. |
| [set\_url\_scheme()](set_url_scheme) wp-includes/link-template.php | Sets the scheme for a URL. |
| [site\_url()](site_url) wp-includes/link-template.php | Retrieves the URL for the current site where WordPress application files (e.g. wp-blog-header.php or the wp-admin/ folder) are accessible. |
| [is\_multisite()](is_multisite) wp-includes/load.php | If Multisite is enabled. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| Used By | Description |
| --- | --- |
| [retrieve\_password()](retrieve_password) wp-includes/user.php | Handles sending a password retrieval email to a user. |
| [wp\_new\_user\_notification()](wp_new_user_notification) wp-includes/pluggable.php | Emails login credentials to a newly-registered user. |
| [wp\_lostpassword\_url()](wp_lostpassword_url) wp-includes/general-template.php | Returns the URL that allows the user to reset the lost password. |
| [network\_admin\_url()](network_admin_url) wp-includes/link-template.php | Retrieves the URL to the admin area for the network. |
| [user\_admin\_url()](user_admin_url) wp-includes/link-template.php | Retrieves the URL to the admin area for the current user. |
| [wp\_version\_check()](wp_version_check) wp-includes/update.php | Checks WordPress version against the newest version. |
| [redirect\_canonical()](redirect_canonical) wp-includes/canonical.php | Redirects incoming links to the proper URL based on the site url. |
| [wpmu\_signup\_blog\_notification()](wpmu_signup_blog_notification) wp-includes/ms-functions.php | Sends a confirmation request email to a user when they sign up for a new site. The new site will not become active until the confirmation link is clicked. |
| Version | Description |
| --- | --- |
| [3.0.0](https://developer.wordpress.org/reference/since/3.0.0/) | Introduced. |
wordpress rest_get_endpoint_args_for_schema( array $schema, string $method = WP_REST_Server::CREATABLE ): array rest\_get\_endpoint\_args\_for\_schema( array $schema, string $method = WP\_REST\_Server::CREATABLE ): array
============================================================================================================
Retrieves an array of endpoint arguments from the item schema and endpoint method.
`$schema` array Required The full JSON schema for the endpoint. `$method` string Optional HTTP method of the endpoint. The arguments for `CREATABLE` endpoints are checked for required values and may fall-back to a given default, this is not done on `EDITABLE` endpoints. Default: `WP_REST_Server::CREATABLE`
array The endpoint arguments.
File: `wp-includes/rest-api.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/rest-api.php/)
```
function rest_get_endpoint_args_for_schema( $schema, $method = WP_REST_Server::CREATABLE ) {
$schema_properties = ! empty( $schema['properties'] ) ? $schema['properties'] : array();
$endpoint_args = array();
$valid_schema_properties = rest_get_allowed_schema_keywords();
$valid_schema_properties = array_diff( $valid_schema_properties, array( 'default', 'required' ) );
foreach ( $schema_properties as $field_id => $params ) {
// Arguments specified as `readonly` are not allowed to be set.
if ( ! empty( $params['readonly'] ) ) {
continue;
}
$endpoint_args[ $field_id ] = array(
'validate_callback' => 'rest_validate_request_arg',
'sanitize_callback' => 'rest_sanitize_request_arg',
);
if ( WP_REST_Server::CREATABLE === $method && isset( $params['default'] ) ) {
$endpoint_args[ $field_id ]['default'] = $params['default'];
}
if ( WP_REST_Server::CREATABLE === $method && ! empty( $params['required'] ) ) {
$endpoint_args[ $field_id ]['required'] = true;
}
foreach ( $valid_schema_properties as $schema_prop ) {
if ( isset( $params[ $schema_prop ] ) ) {
$endpoint_args[ $field_id ][ $schema_prop ] = $params[ $schema_prop ];
}
}
// Merge in any options provided by the schema property.
if ( isset( $params['arg_options'] ) ) {
// Only use required / default from arg_options on CREATABLE endpoints.
if ( WP_REST_Server::CREATABLE !== $method ) {
$params['arg_options'] = array_diff_key(
$params['arg_options'],
array(
'required' => '',
'default' => '',
)
);
}
$endpoint_args[ $field_id ] = array_merge( $endpoint_args[ $field_id ], $params['arg_options'] );
}
}
return $endpoint_args;
}
```
| Uses | Description |
| --- | --- |
| [rest\_get\_allowed\_schema\_keywords()](rest_get_allowed_schema_keywords) wp-includes/rest-api.php | Get all valid JSON schema properties. |
| Used By | Description |
| --- | --- |
| [WP\_REST\_Controller::get\_endpoint\_args\_for\_item\_schema()](../classes/wp_rest_controller/get_endpoint_args_for_item_schema) wp-includes/rest-api/endpoints/class-wp-rest-controller.php | Retrieves an array of endpoint arguments from the item schema for the controller. |
| Version | Description |
| --- | --- |
| [5.6.0](https://developer.wordpress.org/reference/since/5.6.0/) | Introduced. |
| programming_docs |
wordpress unregister_sidebar_widget( int|string $id ) unregister\_sidebar\_widget( int|string $id )
=============================================
This function has been deprecated. Use [wp\_unregister\_sidebar\_widget()](wp_unregister_sidebar_widget) instead.
Serves as an alias of [wp\_unregister\_sidebar\_widget()](wp_unregister_sidebar_widget) .
* [wp\_unregister\_sidebar\_widget()](wp_unregister_sidebar_widget)
`$id` int|string Required Widget ID. File: `wp-includes/deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/deprecated.php/)
```
function unregister_sidebar_widget($id) {
_deprecated_function( __FUNCTION__, '2.8.0', 'wp_unregister_sidebar_widget()' );
return wp_unregister_sidebar_widget($id);
}
```
| Uses | Description |
| --- | --- |
| [wp\_unregister\_sidebar\_widget()](wp_unregister_sidebar_widget) wp-includes/widgets.php | Remove widget from sidebar. |
| [\_deprecated\_function()](_deprecated_function) wp-includes/functions.php | Marks a function as deprecated and inform when it has been used. |
| Version | Description |
| --- | --- |
| [2.8.0](https://developer.wordpress.org/reference/since/2.8.0/) | Use [wp\_unregister\_sidebar\_widget()](wp_unregister_sidebar_widget) |
| [2.2.0](https://developer.wordpress.org/reference/since/2.2.0/) | Introduced. |
wordpress wp_dropdown_cats( int $current_cat, int $current_parent, int $category_parent, int $level, array $categories ): void|false wp\_dropdown\_cats( int $current\_cat, int $current\_parent, int $category\_parent, int $level, array $categories ): void|false
===============================================================================================================================
This function has been deprecated. Use [wp\_dropdown\_categories()](wp_dropdown_categories) instead.
Legacy function used for generating a categories drop-down control.
* [wp\_dropdown\_categories()](wp_dropdown_categories)
`$current_cat` int Optional ID of the current category. Default 0. `$current_parent` int Optional Current parent category ID. Default 0. `$category_parent` int Optional Parent ID to retrieve categories for. Default 0. `$level` int Optional Number of levels deep to display. Default 0. `$categories` array Optional Categories to include in the control. Default 0. void|false Void on success, false if no categories were found.
File: `wp-admin/includes/deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/deprecated.php/)
```
function wp_dropdown_cats( $current_cat = 0, $current_parent = 0, $category_parent = 0, $level = 0, $categories = 0 ) {
_deprecated_function( __FUNCTION__, '3.0.0', 'wp_dropdown_categories()' );
if (!$categories )
$categories = get_categories( array('hide_empty' => 0) );
if ( $categories ) {
foreach ( $categories as $category ) {
if ( $current_cat != $category->term_id && $category_parent == $category->parent) {
$pad = str_repeat( '– ', $level );
$category->name = esc_html( $category->name );
echo "\n\t<option value='$category->term_id'";
if ( $current_parent == $category->term_id )
echo " selected='selected'";
echo ">$pad$category->name</option>";
wp_dropdown_cats( $current_cat, $current_parent, $category->term_id, $level +1, $categories );
}
}
} else {
return false;
}
}
```
| Uses | Description |
| --- | --- |
| [wp\_dropdown\_cats()](wp_dropdown_cats) wp-admin/includes/deprecated.php | Legacy function used for generating a categories drop-down control. |
| [get\_categories()](get_categories) wp-includes/category.php | Retrieves a list of category objects. |
| [esc\_html()](esc_html) wp-includes/formatting.php | Escaping for HTML blocks. |
| [\_deprecated\_function()](_deprecated_function) wp-includes/functions.php | Marks a function as deprecated and inform when it has been used. |
| Used By | Description |
| --- | --- |
| [wp\_dropdown\_cats()](wp_dropdown_cats) wp-admin/includes/deprecated.php | Legacy function used for generating a categories drop-down control. |
| Version | Description |
| --- | --- |
| [3.0.0](https://developer.wordpress.org/reference/since/3.0.0/) | Use [wp\_dropdown\_categories()](wp_dropdown_categories) |
| [1.2.0](https://developer.wordpress.org/reference/since/1.2.0/) | Introduced. |
wordpress get_the_post_thumbnail_caption( int|WP_Post $post = null ): string get\_the\_post\_thumbnail\_caption( int|WP\_Post $post = null ): string
=======================================================================
Returns the post thumbnail caption.
`$post` int|[WP\_Post](../classes/wp_post) Optional Post ID or [WP\_Post](../classes/wp_post) object. Default is global `$post`. Default: `null`
string Post thumbnail caption.
File: `wp-includes/post-thumbnail-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/post-thumbnail-template.php/)
```
function get_the_post_thumbnail_caption( $post = null ) {
$post_thumbnail_id = get_post_thumbnail_id( $post );
if ( ! $post_thumbnail_id ) {
return '';
}
$caption = wp_get_attachment_caption( $post_thumbnail_id );
if ( ! $caption ) {
$caption = '';
}
return $caption;
}
```
| Uses | Description |
| --- | --- |
| [wp\_get\_attachment\_caption()](wp_get_attachment_caption) wp-includes/post.php | Retrieves the caption for an attachment. |
| [get\_post\_thumbnail\_id()](get_post_thumbnail_id) wp-includes/post-thumbnail-template.php | Retrieves the post thumbnail ID. |
| Used By | Description |
| --- | --- |
| [the\_post\_thumbnail\_caption()](the_post_thumbnail_caption) wp-includes/post-thumbnail-template.php | Displays the post thumbnail caption. |
| Version | Description |
| --- | --- |
| [4.6.0](https://developer.wordpress.org/reference/since/4.6.0/) | Introduced. |
wordpress wp_crop_image( string|int $src, int $src_x, int $src_y, int $src_w, int $src_h, int $dst_w, int $dst_h, bool|false $src_abs = false, string|false $dst_file = false ): string|WP_Error wp\_crop\_image( string|int $src, int $src\_x, int $src\_y, int $src\_w, int $src\_h, int $dst\_w, int $dst\_h, bool|false $src\_abs = false, string|false $dst\_file = false ): string|WP\_Error
=================================================================================================================================================================================================
Crops an image to a given size.
`$src` string|int Required The source file or Attachment ID. `$src_x` int Required The start x position to crop from. `$src_y` int Required The start y position to crop from. `$src_w` int Required The width to crop. `$src_h` int Required The height to crop. `$dst_w` int Required The destination width. `$dst_h` int Required The destination height. `$src_abs` bool|false Optional If the source crop points are absolute. Default: `false`
`$dst_file` string|false Optional The destination file to write to. Default: `false`
string|[WP\_Error](../classes/wp_error) New filepath on success, [WP\_Error](../classes/wp_error) on failure.
File: `wp-admin/includes/image.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/image.php/)
```
function wp_crop_image( $src, $src_x, $src_y, $src_w, $src_h, $dst_w, $dst_h, $src_abs = false, $dst_file = false ) {
$src_file = $src;
if ( is_numeric( $src ) ) { // Handle int as attachment ID.
$src_file = get_attached_file( $src );
if ( ! file_exists( $src_file ) ) {
// If the file doesn't exist, attempt a URL fopen on the src link.
// This can occur with certain file replication plugins.
$src = _load_image_to_edit_path( $src, 'full' );
} else {
$src = $src_file;
}
}
$editor = wp_get_image_editor( $src );
if ( is_wp_error( $editor ) ) {
return $editor;
}
$src = $editor->crop( $src_x, $src_y, $src_w, $src_h, $dst_w, $dst_h, $src_abs );
if ( is_wp_error( $src ) ) {
return $src;
}
if ( ! $dst_file ) {
$dst_file = str_replace( wp_basename( $src_file ), 'cropped-' . wp_basename( $src_file ), $src_file );
}
/*
* The directory containing the original file may no longer exist when
* using a replication plugin.
*/
wp_mkdir_p( dirname( $dst_file ) );
$dst_file = dirname( $dst_file ) . '/' . wp_unique_filename( dirname( $dst_file ), wp_basename( $dst_file ) );
$result = $editor->save( $dst_file );
if ( is_wp_error( $result ) ) {
return $result;
}
if ( ! empty( $result['path'] ) ) {
return $result['path'];
}
return $dst_file;
}
```
| Uses | Description |
| --- | --- |
| [\_load\_image\_to\_edit\_path()](_load_image_to_edit_path) wp-admin/includes/image.php | Retrieves the path or URL of an attachment’s attached file. |
| [wp\_mkdir\_p()](wp_mkdir_p) wp-includes/functions.php | Recursive directory creation based on full path. |
| [wp\_unique\_filename()](wp_unique_filename) wp-includes/functions.php | Gets a filename that is sanitized and unique for the given directory. |
| [wp\_get\_image\_editor()](wp_get_image_editor) wp-includes/media.php | Returns a [WP\_Image\_Editor](../classes/wp_image_editor) instance and loads file into it. |
| [get\_attached\_file()](get_attached_file) wp-includes/post.php | Retrieves attached file path based on attachment ID. |
| [wp\_basename()](wp_basename) wp-includes/formatting.php | i18n-friendly version of basename(). |
| [is\_wp\_error()](is_wp_error) wp-includes/load.php | Checks whether the given variable is a WordPress Error. |
| Used By | Description |
| --- | --- |
| [wp\_ajax\_crop\_image()](wp_ajax_crop_image) wp-admin/includes/ajax-actions.php | Ajax handler for cropping an image. |
| [Custom\_Image\_Header::ajax\_header\_crop()](../classes/custom_image_header/ajax_header_crop) wp-admin/includes/class-custom-image-header.php | Gets attachment uploaded by Media Manager, crops it, then saves it as a new object. Returns JSON-encoded object details. |
| [Custom\_Image\_Header::step\_2()](../classes/custom_image_header/step_2) wp-admin/includes/class-custom-image-header.php | Display second step of custom header image page. |
| [Custom\_Image\_Header::step\_3()](../classes/custom_image_header/step_3) wp-admin/includes/class-custom-image-header.php | Display third step of custom header image page. |
| Version | Description |
| --- | --- |
| [2.1.0](https://developer.wordpress.org/reference/since/2.1.0/) | Introduced. |
wordpress wp_robots_noindex_search( array $robots ): array wp\_robots\_noindex\_search( array $robots ): array
===================================================
Adds `noindex` to the robots meta tag if a search is being performed.
If a search is being performed then noindex will be output to tell web robots not to index the page content. Add this to the [‘wp\_robots’](../hooks/wp_robots) filter.
Typical usage is as a [‘wp\_robots’](../hooks/wp_robots) callback:
```
add_filter( 'wp_robots', 'wp_robots_noindex_search' );
```
* [wp\_robots\_no\_robots()](wp_robots_no_robots)
`$robots` array Required Associative array of robots directives. array Filtered robots directives.
File: `wp-includes/robots-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/robots-template.php/)
```
function wp_robots_noindex_search( array $robots ) {
if ( is_search() ) {
return wp_robots_no_robots( $robots );
}
return $robots;
}
```
| Uses | Description |
| --- | --- |
| [wp\_robots\_no\_robots()](wp_robots_no_robots) wp-includes/robots-template.php | Adds `noindex` to the robots meta tag. |
| [is\_search()](is_search) wp-includes/query.php | Determines whether the query is for a search. |
| Version | Description |
| --- | --- |
| [5.7.0](https://developer.wordpress.org/reference/since/5.7.0/) | Introduced. |
wordpress wp_dashboard_right_now() wp\_dashboard\_right\_now()
===========================
Dashboard widget that displays some basic stats about the site.
Formerly ‘Right Now’. A streamlined ‘At a Glance’ as of 3.8.
File: `wp-admin/includes/dashboard.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/dashboard.php/)
```
function wp_dashboard_right_now() {
?>
<div class="main">
<ul>
<?php
// Posts and Pages.
foreach ( array( 'post', 'page' ) as $post_type ) {
$num_posts = wp_count_posts( $post_type );
if ( $num_posts && $num_posts->publish ) {
if ( 'post' === $post_type ) {
/* translators: %s: Number of posts. */
$text = _n( '%s Post', '%s Posts', $num_posts->publish );
} else {
/* translators: %s: Number of pages. */
$text = _n( '%s Page', '%s Pages', $num_posts->publish );
}
$text = sprintf( $text, number_format_i18n( $num_posts->publish ) );
$post_type_object = get_post_type_object( $post_type );
if ( $post_type_object && current_user_can( $post_type_object->cap->edit_posts ) ) {
printf( '<li class="%1$s-count"><a href="edit.php?post_type=%1$s">%2$s</a></li>', $post_type, $text );
} else {
printf( '<li class="%1$s-count"><span>%2$s</span></li>', $post_type, $text );
}
}
}
// Comments.
$num_comm = wp_count_comments();
if ( $num_comm && ( $num_comm->approved || $num_comm->moderated ) ) {
/* translators: %s: Number of comments. */
$text = sprintf( _n( '%s Comment', '%s Comments', $num_comm->approved ), number_format_i18n( $num_comm->approved ) );
?>
<li class="comment-count">
<a href="edit-comments.php"><?php echo $text; ?></a>
</li>
<?php
$moderated_comments_count_i18n = number_format_i18n( $num_comm->moderated );
/* translators: %s: Number of comments. */
$text = sprintf( _n( '%s Comment in moderation', '%s Comments in moderation', $num_comm->moderated ), $moderated_comments_count_i18n );
?>
<li class="comment-mod-count<?php echo ! $num_comm->moderated ? ' hidden' : ''; ?>">
<a href="edit-comments.php?comment_status=moderated" class="comments-in-moderation-text"><?php echo $text; ?></a>
</li>
<?php
}
/**
* Filters the array of extra elements to list in the 'At a Glance'
* dashboard widget.
*
* Prior to 3.8.0, the widget was named 'Right Now'. Each element
* is wrapped in list-item tags on output.
*
* @since 3.8.0
*
* @param string[] $items Array of extra 'At a Glance' widget items.
*/
$elements = apply_filters( 'dashboard_glance_items', array() );
if ( $elements ) {
echo '<li>' . implode( "</li>\n<li>", $elements ) . "</li>\n";
}
?>
</ul>
<?php
update_right_now_message();
// Check if search engines are asked not to index this site.
if ( ! is_network_admin() && ! is_user_admin()
&& current_user_can( 'manage_options' ) && ! get_option( 'blog_public' )
) {
/**
* Filters the link title attribute for the 'Search engines discouraged'
* message displayed in the 'At a Glance' dashboard widget.
*
* Prior to 3.8.0, the widget was named 'Right Now'.
*
* @since 3.0.0
* @since 4.5.0 The default for `$title` was updated to an empty string.
*
* @param string $title Default attribute text.
*/
$title = apply_filters( 'privacy_on_link_title', '' );
/**
* Filters the link label for the 'Search engines discouraged' message
* displayed in the 'At a Glance' dashboard widget.
*
* Prior to 3.8.0, the widget was named 'Right Now'.
*
* @since 3.0.0
*
* @param string $content Default text.
*/
$content = apply_filters( 'privacy_on_link_text', __( 'Search engines discouraged' ) );
$title_attr = '' === $title ? '' : " title='$title'";
echo "<p class='search-engines-info'><a href='options-reading.php'$title_attr>$content</a></p>";
}
?>
</div>
<?php
/*
* activity_box_end has a core action, but only prints content when multisite.
* Using an output buffer is the only way to really check if anything's displayed here.
*/
ob_start();
/**
* Fires at the end of the 'At a Glance' dashboard widget.
*
* Prior to 3.8.0, the widget was named 'Right Now'.
*
* @since 2.5.0
*/
do_action( 'rightnow_end' );
/**
* Fires at the end of the 'At a Glance' dashboard widget.
*
* Prior to 3.8.0, the widget was named 'Right Now'.
*
* @since 2.0.0
*/
do_action( 'activity_box_end' );
$actions = ob_get_clean();
if ( ! empty( $actions ) ) :
?>
<div class="sub">
<?php echo $actions; ?>
</div>
<?php
endif;
}
```
[do\_action( 'activity\_box\_end' )](../hooks/activity_box_end)
Fires at the end of the ‘At a Glance’ dashboard widget.
[apply\_filters( 'dashboard\_glance\_items', string[] $items )](../hooks/dashboard_glance_items)
Filters the array of extra elements to list in the ‘At a Glance’ dashboard widget.
[apply\_filters( 'privacy\_on\_link\_text', string $content )](../hooks/privacy_on_link_text)
Filters the link label for the ‘Search engines discouraged’ message displayed in the ‘At a Glance’ dashboard widget.
[apply\_filters( 'privacy\_on\_link\_title', string $title )](../hooks/privacy_on_link_title)
Filters the link title attribute for the ‘Search engines discouraged’ message displayed in the ‘At a Glance’ dashboard widget.
[do\_action( 'rightnow\_end' )](../hooks/rightnow_end)
Fires at the end of the ‘At a Glance’ dashboard widget.
| Uses | Description |
| --- | --- |
| [update\_right\_now\_message()](update_right_now_message) wp-admin/includes/update.php | Displays WordPress version and active theme in the ‘At a Glance’ dashboard widget. |
| [\_n()](_n) wp-includes/l10n.php | Translates and retrieves the singular or plural form based on the supplied number. |
| [is\_network\_admin()](is_network_admin) wp-includes/load.php | Determines whether the current request is for the network administrative interface. |
| [is\_user\_admin()](is_user_admin) wp-includes/load.php | Determines whether the current request is for a user admin screen. |
| [wp\_count\_posts()](wp_count_posts) wp-includes/post.php | Counts number of posts of a post type and if user has permissions to view. |
| [wp\_count\_comments()](wp_count_comments) wp-includes/comment.php | Retrieves the total comment counts for the whole site or a single post. |
| [current\_user\_can()](current_user_can) wp-includes/capabilities.php | Returns whether the current user has the specified capability. |
| [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. |
| [number\_format\_i18n()](number_format_i18n) wp-includes/functions.php | Converts float number to format based on the locale. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| [do\_action()](do_action) wp-includes/plugin.php | Calls the callback functions that have been added to an action hook. |
| [get\_option()](get_option) wp-includes/option.php | Retrieves an option value based on an option name. |
| [get\_post\_type\_object()](get_post_type_object) wp-includes/post.php | Retrieves a post type object by name. |
| Version | Description |
| --- | --- |
| [2.7.0](https://developer.wordpress.org/reference/since/2.7.0/) | Introduced. |
wordpress wp_get_ready_cron_jobs(): array[] wp\_get\_ready\_cron\_jobs(): array[]
=====================================
Retrieve cron jobs ready to be run.
Returns the results of [\_get\_cron\_array()](_get_cron_array) limited to events ready to be run, ie, with a timestamp in the past.
array[] Array of cron job arrays ready to be run.
File: `wp-includes/cron.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/cron.php/)
```
function wp_get_ready_cron_jobs() {
/**
* Filter to preflight or hijack retrieving ready cron jobs.
*
* Returning an array will short-circuit the normal retrieval of ready
* cron jobs, causing the function to return the filtered value instead.
*
* @since 5.1.0
*
* @param null|array[] $pre Array of ready cron tasks to return instead. Default null
* to continue using results from _get_cron_array().
*/
$pre = apply_filters( 'pre_get_ready_cron_jobs', null );
if ( null !== $pre ) {
return $pre;
}
$crons = _get_cron_array();
$gmt_time = microtime( true );
$results = array();
foreach ( $crons as $timestamp => $cronhooks ) {
if ( $timestamp > $gmt_time ) {
break;
}
$results[ $timestamp ] = $cronhooks;
}
return $results;
}
```
[apply\_filters( 'pre\_get\_ready\_cron\_jobs', null|array[] $pre )](../hooks/pre_get_ready_cron_jobs)
Filter to preflight or hijack retrieving ready cron jobs.
| Uses | Description |
| --- | --- |
| [\_get\_cron\_array()](_get_cron_array) wp-includes/cron.php | Retrieve cron info array option. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| Used By | Description |
| --- | --- |
| [\_wp\_cron()](_wp_cron) wp-includes/cron.php | Run scheduled callbacks or spawn cron for all scheduled events. |
| [spawn\_cron()](spawn_cron) wp-includes/cron.php | Sends a request to run cron through HTTP request that doesn’t halt page loading. |
| Version | Description |
| --- | --- |
| [5.1.0](https://developer.wordpress.org/reference/since/5.1.0/) | Introduced. |
| programming_docs |
wordpress wp_set_object_terms( int $object_id, string|int|array $terms, string $taxonomy, bool $append = false ): array|WP_Error wp\_set\_object\_terms( int $object\_id, string|int|array $terms, string $taxonomy, bool $append = false ): array|WP\_Error
===========================================================================================================================
Creates term and taxonomy relationships.
Relates an object (post, link, etc.) to a term and taxonomy type. Creates the term and taxonomy relationship if it doesn’t already exist. Creates a term if it doesn’t exist (using the slug).
A relationship means that the term is grouped in or belongs to the taxonomy.
A term has no meaning until it is given context by defining which taxonomy it exists under.
`$object_id` int Required The object to relate to. `$terms` string|int|array Required A single term slug, single term ID, or array of either term slugs or IDs.
Will replace all existing related terms in this taxonomy. Passing an empty value will remove all related terms. `$taxonomy` string Required The context in which to relate the term to the object. `$append` bool Optional If false will delete difference of terms. Default: `false`
array|[WP\_Error](../classes/wp_error) Term taxonomy IDs of the affected terms or [WP\_Error](../classes/wp_error) on failure.
For parameter `$terms`, integers are interpreted as tag IDs. Some functions may return term\_ids as strings which will be interpreted as slugs consisting of numeric characters.
For Return:
* (array) An array of the terms ( as term\_taxonomy\_ids ! ) affected if successful
* (array) An empty array if the $terms argument was NULL or empty – successmessage for the removing of the term
* ([WP\_Error](../classes/wp_error)) The WordPress Error object on invalid taxonomy (‘invalid\_taxonomy’).
* (string) The first offending term if a term given in the $terms parameter is named incorrectly. (Invalid term ids are accepted and inserted).
This function **does not check** if there is a relationship between the object (=post type) and the taxonomy (like post\_tag, category or custom taxonomy). Because of that, any existing term will be paired with the object, whether or not there is a connection between the object and the taxonomy (of this particular term)!! ( [Further information in **german**](http://www.wp-entwickler.at/vorsicht-beim-setzen-von-terms-mit-wp-set-object-terms/))
Perhaps the [wp\_set\_post\_terms()](wp_set_post_terms) is a more useful function, since it checks the values, converting taxonomies separated by commas and validating hierarchical terms in integers.
It may be confusing but the returned array consists of **term\_taxonomy\_ids** instead of term\_ids.
File: `wp-includes/taxonomy.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/taxonomy.php/)
```
function wp_set_object_terms( $object_id, $terms, $taxonomy, $append = false ) {
global $wpdb;
$object_id = (int) $object_id;
if ( ! taxonomy_exists( $taxonomy ) ) {
return new WP_Error( 'invalid_taxonomy', __( 'Invalid taxonomy.' ) );
}
if ( ! is_array( $terms ) ) {
$terms = array( $terms );
}
if ( ! $append ) {
$old_tt_ids = wp_get_object_terms(
$object_id,
$taxonomy,
array(
'fields' => 'tt_ids',
'orderby' => 'none',
'update_term_meta_cache' => false,
)
);
} else {
$old_tt_ids = array();
}
$tt_ids = array();
$term_ids = array();
$new_tt_ids = array();
foreach ( (array) $terms as $term ) {
if ( '' === trim( $term ) ) {
continue;
}
$term_info = term_exists( $term, $taxonomy );
if ( ! $term_info ) {
// Skip if a non-existent term ID is passed.
if ( is_int( $term ) ) {
continue;
}
$term_info = wp_insert_term( $term, $taxonomy );
}
if ( is_wp_error( $term_info ) ) {
return $term_info;
}
$term_ids[] = $term_info['term_id'];
$tt_id = $term_info['term_taxonomy_id'];
$tt_ids[] = $tt_id;
if ( $wpdb->get_var( $wpdb->prepare( "SELECT term_taxonomy_id FROM $wpdb->term_relationships WHERE object_id = %d AND term_taxonomy_id = %d", $object_id, $tt_id ) ) ) {
continue;
}
/**
* Fires immediately before an object-term relationship is added.
*
* @since 2.9.0
* @since 4.7.0 Added the `$taxonomy` parameter.
*
* @param int $object_id Object ID.
* @param int $tt_id Term taxonomy ID.
* @param string $taxonomy Taxonomy slug.
*/
do_action( 'add_term_relationship', $object_id, $tt_id, $taxonomy );
$wpdb->insert(
$wpdb->term_relationships,
array(
'object_id' => $object_id,
'term_taxonomy_id' => $tt_id,
)
);
/**
* Fires immediately after an object-term relationship is added.
*
* @since 2.9.0
* @since 4.7.0 Added the `$taxonomy` parameter.
*
* @param int $object_id Object ID.
* @param int $tt_id Term taxonomy ID.
* @param string $taxonomy Taxonomy slug.
*/
do_action( 'added_term_relationship', $object_id, $tt_id, $taxonomy );
$new_tt_ids[] = $tt_id;
}
if ( $new_tt_ids ) {
wp_update_term_count( $new_tt_ids, $taxonomy );
}
if ( ! $append ) {
$delete_tt_ids = array_diff( $old_tt_ids, $tt_ids );
if ( $delete_tt_ids ) {
$in_delete_tt_ids = "'" . implode( "', '", $delete_tt_ids ) . "'";
$delete_term_ids = $wpdb->get_col( $wpdb->prepare( "SELECT tt.term_id FROM $wpdb->term_taxonomy AS tt WHERE tt.taxonomy = %s AND tt.term_taxonomy_id IN ($in_delete_tt_ids)", $taxonomy ) );
$delete_term_ids = array_map( 'intval', $delete_term_ids );
$remove = wp_remove_object_terms( $object_id, $delete_term_ids, $taxonomy );
if ( is_wp_error( $remove ) ) {
return $remove;
}
}
}
$t = get_taxonomy( $taxonomy );
if ( ! $append && isset( $t->sort ) && $t->sort ) {
$values = array();
$term_order = 0;
$final_tt_ids = wp_get_object_terms(
$object_id,
$taxonomy,
array(
'fields' => 'tt_ids',
'update_term_meta_cache' => false,
)
);
foreach ( $tt_ids as $tt_id ) {
if ( in_array( (int) $tt_id, $final_tt_ids, true ) ) {
$values[] = $wpdb->prepare( '(%d, %d, %d)', $object_id, $tt_id, ++$term_order );
}
}
if ( $values ) {
if ( false === $wpdb->query( "INSERT INTO $wpdb->term_relationships (object_id, term_taxonomy_id, term_order) VALUES " . implode( ',', $values ) . ' ON DUPLICATE KEY UPDATE term_order = VALUES(term_order)' ) ) {
return new WP_Error( 'db_insert_error', __( 'Could not insert term relationship into the database.' ), $wpdb->last_error );
}
}
}
wp_cache_delete( $object_id, $taxonomy . '_relationships' );
wp_cache_delete( 'last_changed', 'terms' );
/**
* Fires after an object's terms have been set.
*
* @since 2.8.0
*
* @param int $object_id Object ID.
* @param array $terms An array of object term IDs or slugs.
* @param array $tt_ids An array of term taxonomy IDs.
* @param string $taxonomy Taxonomy slug.
* @param bool $append Whether to append new terms to the old terms.
* @param array $old_tt_ids Old array of term taxonomy IDs.
*/
do_action( 'set_object_terms', $object_id, $terms, $tt_ids, $taxonomy, $append, $old_tt_ids );
return $tt_ids;
}
```
[do\_action( 'added\_term\_relationship', int $object\_id, int $tt\_id, string $taxonomy )](../hooks/added_term_relationship)
Fires immediately after an object-term relationship is added.
[do\_action( 'add\_term\_relationship', int $object\_id, int $tt\_id, string $taxonomy )](../hooks/add_term_relationship)
Fires immediately before an object-term relationship is added.
[do\_action( 'set\_object\_terms', int $object\_id, array $terms, array $tt\_ids, string $taxonomy, bool $append, array $old\_tt\_ids )](../hooks/set_object_terms)
Fires after an object’s terms have been set.
| Uses | Description |
| --- | --- |
| [wp\_cache\_delete()](wp_cache_delete) wp-includes/cache.php | Removes the cache contents matching key and group. |
| [wpdb::get\_col()](../classes/wpdb/get_col) wp-includes/class-wpdb.php | Retrieves one column from the database. |
| [wp\_update\_term\_count()](wp_update_term_count) wp-includes/taxonomy.php | Updates the amount of terms in taxonomy. |
| [wp\_get\_object\_terms()](wp_get_object_terms) wp-includes/taxonomy.php | Retrieves the terms associated with the given object(s), in the supplied taxonomies. |
| [wp\_insert\_term()](wp_insert_term) wp-includes/taxonomy.php | Adds a new term to the database. |
| [wp\_remove\_object\_terms()](wp_remove_object_terms) wp-includes/taxonomy.php | Removes term(s) associated with a given object. |
| [term\_exists()](term_exists) wp-includes/taxonomy.php | Determines whether a taxonomy term exists. |
| [taxonomy\_exists()](taxonomy_exists) wp-includes/taxonomy.php | Determines whether the taxonomy name exists. |
| [wpdb::query()](../classes/wpdb/query) wp-includes/class-wpdb.php | Performs a database query, using current database connection. |
| [wpdb::insert()](../classes/wpdb/insert) wp-includes/class-wpdb.php | Inserts a row into the table. |
| [is\_wp\_error()](is_wp_error) wp-includes/load.php | Checks whether the given variable is a WordPress Error. |
| [wpdb::prepare()](../classes/wpdb/prepare) wp-includes/class-wpdb.php | Prepares a SQL query for safe execution. |
| [get\_taxonomy()](get_taxonomy) wp-includes/taxonomy.php | Retrieves the taxonomy object of $taxonomy. |
| [wpdb::get\_var()](../classes/wpdb/get_var) wp-includes/class-wpdb.php | Retrieves one variable from the database. |
| [do\_action()](do_action) wp-includes/plugin.php | Calls the callback functions that have been added to an action hook. |
| [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. |
| [WP\_Error::\_\_construct()](../classes/wp_error/__construct) wp-includes/class-wp-error.php | Initializes the error. |
| Used By | Description |
| --- | --- |
| [WP\_REST\_Posts\_Controller::handle\_terms()](../classes/wp_rest_posts_controller/handle_terms) wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php | Updates the post’s terms from a REST request. |
| [media\_upload\_form\_handler()](media_upload_form_handler) wp-admin/includes/media.php | Handles form submissions for the legacy media uploader. |
| [wp\_ajax\_save\_attachment\_compat()](wp_ajax_save_attachment_compat) wp-admin/includes/ajax-actions.php | Ajax handler for saving backward compatible attachment attributes. |
| [wp\_set\_link\_cats()](wp_set_link_cats) wp-admin/includes/bookmark.php | Update link with the specified link categories. |
| [wp\_add\_object\_terms()](wp_add_object_terms) wp-includes/taxonomy.php | Adds term(s) associated with a given object. |
| [wp\_delete\_term()](wp_delete_term) wp-includes/taxonomy.php | Removes a term from the database. |
| [wp\_set\_post\_terms()](wp_set_post_terms) wp-includes/post.php | Sets the terms for a post. |
| [wp\_update\_nav\_menu\_item()](wp_update_nav_menu_item) wp-includes/nav-menu.php | Saves the properties of a menu item or create a new one. |
| Version | Description |
| --- | --- |
| [2.3.0](https://developer.wordpress.org/reference/since/2.3.0/) | Introduced. |
wordpress has_site_icon( int $blog_id ): bool has\_site\_icon( int $blog\_id ): bool
======================================
Determines whether the site has a Site Icon.
`$blog_id` int Optional ID of the blog in question. Default current blog. bool Whether the site has a site icon or not.
File: `wp-includes/general-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/general-template.php/)
```
function has_site_icon( $blog_id = 0 ) {
return (bool) get_site_icon_url( 512, '', $blog_id );
}
```
| Uses | Description |
| --- | --- |
| [get\_site\_icon\_url()](get_site_icon_url) wp-includes/general-template.php | Returns the Site Icon URL. |
| Used By | Description |
| --- | --- |
| [wp\_site\_icon()](wp_site_icon) wp-includes/general-template.php | Displays site icon meta tags. |
| [wp\_admin\_bar\_my\_sites\_menu()](wp_admin_bar_my_sites_menu) wp-includes/admin-bar.php | Adds the “My Sites/[Site Name]” menu and all submenus. |
| Version | Description |
| --- | --- |
| [4.3.0](https://developer.wordpress.org/reference/since/4.3.0/) | Introduced. |
wordpress choose_primary_blog() choose\_primary\_blog()
=======================
Handles the display of choosing a user’s primary site.
This displays the user’s primary site and allows the user to choose which site is primary.
File: `wp-admin/includes/ms.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/ms.php/)
```
function choose_primary_blog() {
?>
<table class="form-table" role="presentation">
<tr>
<?php /* translators: My Sites label. */ ?>
<th scope="row"><label for="primary_blog"><?php _e( 'Primary Site' ); ?></label></th>
<td>
<?php
$all_blogs = get_blogs_of_user( get_current_user_id() );
$primary_blog = (int) get_user_meta( get_current_user_id(), 'primary_blog', true );
if ( count( $all_blogs ) > 1 ) {
$found = false;
?>
<select name="primary_blog" id="primary_blog">
<?php
foreach ( (array) $all_blogs as $blog ) {
if ( $blog->userblog_id === $primary_blog ) {
$found = true;
}
?>
<option value="<?php echo $blog->userblog_id; ?>"<?php selected( $primary_blog, $blog->userblog_id ); ?>><?php echo esc_url( get_home_url( $blog->userblog_id ) ); ?></option>
<?php
}
?>
</select>
<?php
if ( ! $found ) {
$blog = reset( $all_blogs );
update_user_meta( get_current_user_id(), 'primary_blog', $blog->userblog_id );
}
} elseif ( 1 === count( $all_blogs ) ) {
$blog = reset( $all_blogs );
echo esc_url( get_home_url( $blog->userblog_id ) );
if ( $blog->userblog_id !== $primary_blog ) { // Set the primary blog again if it's out of sync with blog list.
update_user_meta( get_current_user_id(), 'primary_blog', $blog->userblog_id );
}
} else {
echo 'N/A';
}
?>
</td>
</tr>
</table>
<?php
}
```
| Uses | Description |
| --- | --- |
| [selected()](selected) wp-includes/general-template.php | Outputs the HTML selected attribute. |
| [get\_home\_url()](get_home_url) wp-includes/link-template.php | Retrieves the URL for a given site where the front end is accessible. |
| [get\_blogs\_of\_user()](get_blogs_of_user) wp-includes/user.php | Gets the sites a user belongs to. |
| [get\_user\_meta()](get_user_meta) wp-includes/user.php | Retrieves user meta field for a user. |
| [update\_user\_meta()](update_user_meta) wp-includes/user.php | Updates user meta field based on user ID. |
| [\_e()](_e) wp-includes/l10n.php | Displays translated text. |
| [esc\_url()](esc_url) wp-includes/formatting.php | Checks and cleans a URL. |
| [get\_current\_user\_id()](get_current_user_id) wp-includes/user.php | Gets the current user’s ID. |
| Version | Description |
| --- | --- |
| [3.0.0](https://developer.wordpress.org/reference/since/3.0.0/) | Introduced. |
wordpress wp_paused_themes(): WP_Paused_Extensions_Storage wp\_paused\_themes(): WP\_Paused\_Extensions\_Storage
=====================================================
Get the instance for storing paused extensions.
[WP\_Paused\_Extensions\_Storage](../classes/wp_paused_extensions_storage)
File: `wp-includes/error-protection.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/error-protection.php/)
```
function wp_paused_themes() {
static $storage = null;
if ( null === $storage ) {
$storage = new WP_Paused_Extensions_Storage( 'theme' );
}
return $storage;
}
```
| Uses | Description |
| --- | --- |
| [WP\_Paused\_Extensions\_Storage::\_\_construct()](../classes/wp_paused_extensions_storage/__construct) wp-includes/class-wp-paused-extensions-storage.php | Constructor. |
| Used By | Description |
| --- | --- |
| [WP\_Recovery\_Mode::store\_error()](../classes/wp_recovery_mode/store_error) wp-includes/class-wp-recovery-mode.php | Stores the given error so that the extension causing it is paused. |
| [WP\_Recovery\_Mode::exit\_recovery\_mode()](../classes/wp_recovery_mode/exit_recovery_mode) wp-includes/class-wp-recovery-mode.php | Ends the current recovery mode session. |
| [wp\_skip\_paused\_themes()](wp_skip_paused_themes) wp-includes/load.php | Filters a given list of themes, removing any paused themes from it. |
| [resume\_theme()](resume_theme) wp-admin/includes/theme.php | Tries to resume a single theme. |
| [switch\_theme()](switch_theme) wp-includes/theme.php | Switches the theme. |
| [WP\_Theme::\_\_construct()](../classes/wp_theme/__construct) wp-includes/class-wp-theme.php | Constructor for [WP\_Theme](../classes/wp_theme). |
wordpress wp_ajax_wp_remove_post_lock() wp\_ajax\_wp\_remove\_post\_lock()
==================================
Ajax handler for removing a post lock.
File: `wp-admin/includes/ajax-actions.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/ajax-actions.php/)
```
function wp_ajax_wp_remove_post_lock() {
if ( empty( $_POST['post_ID'] ) || empty( $_POST['active_post_lock'] ) ) {
wp_die( 0 );
}
$post_id = (int) $_POST['post_ID'];
$post = get_post( $post_id );
if ( ! $post ) {
wp_die( 0 );
}
check_ajax_referer( 'update-post_' . $post_id );
if ( ! current_user_can( 'edit_post', $post_id ) ) {
wp_die( -1 );
}
$active_lock = array_map( 'absint', explode( ':', $_POST['active_post_lock'] ) );
if ( get_current_user_id() != $active_lock[1] ) {
wp_die( 0 );
}
/**
* Filters the post lock window duration.
*
* @since 3.3.0
*
* @param int $interval The interval in seconds the post lock duration
* should last, plus 5 seconds. Default 150.
*/
$new_lock = ( time() - apply_filters( 'wp_check_post_lock_window', 150 ) + 5 ) . ':' . $active_lock[1];
update_post_meta( $post_id, '_edit_lock', $new_lock, implode( ':', $active_lock ) );
wp_die( 1 );
}
```
[apply\_filters( 'wp\_check\_post\_lock\_window', int $interval )](../hooks/wp_check_post_lock_window)
Filters the post lock window duration.
| Uses | Description |
| --- | --- |
| [update\_post\_meta()](update_post_meta) wp-includes/post.php | Updates a post meta field based on the given post ID. |
| [current\_user\_can()](current_user_can) wp-includes/capabilities.php | Returns whether the current user has the specified capability. |
| [check\_ajax\_referer()](check_ajax_referer) wp-includes/pluggable.php | Verifies the Ajax request to prevent processing requests external of the blog. |
| [wp\_die()](wp_die) wp-includes/functions.php | Kills WordPress execution and displays HTML page with an error message. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| [get\_current\_user\_id()](get_current_user_id) wp-includes/user.php | Gets the current user’s ID. |
| [get\_post()](get_post) wp-includes/post.php | Retrieves post data given a post ID or post object. |
| Version | Description |
| --- | --- |
| [3.1.0](https://developer.wordpress.org/reference/since/3.1.0/) | Introduced. |
wordpress get_blog_status( int $id, string $pref ): bool|string|null get\_blog\_status( int $id, string $pref ): bool|string|null
============================================================
Get a blog details field.
`$id` int Required Blog ID. `$pref` string Required Field name. bool|string|null $value
File: `wp-includes/ms-blogs.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/ms-blogs.php/)
```
function get_blog_status( $id, $pref ) {
global $wpdb;
$details = get_site( $id );
if ( $details ) {
return $details->$pref;
}
return $wpdb->get_var( $wpdb->prepare( "SELECT %s FROM {$wpdb->blogs} WHERE blog_id = %d", $pref, $id ) );
}
```
| Uses | Description |
| --- | --- |
| [get\_site()](get_site) wp-includes/ms-site.php | Retrieves site data given a site ID or site object. |
| [wpdb::get\_var()](../classes/wpdb/get_var) wp-includes/class-wpdb.php | Retrieves one variable from the database. |
| [wpdb::prepare()](../classes/wpdb/prepare) wp-includes/class-wpdb.php | Prepares a SQL query for safe execution. |
| Used By | Description |
| --- | --- |
| [is\_archived()](is_archived) wp-includes/ms-blogs.php | Check if a particular blog is archived. |
| Version | Description |
| --- | --- |
| [MU (3.0.0)](https://developer.wordpress.org/reference/since/mu.3.0.0/) | Introduced. |
| programming_docs |
wordpress update_post_thumbnail_cache( WP_Query $wp_query = null ) update\_post\_thumbnail\_cache( WP\_Query $wp\_query = null )
=============================================================
Updates cache for thumbnails in the current loop.
`$wp_query` [WP\_Query](../classes/wp_query) Optional A [WP\_Query](../classes/wp_query) instance. Defaults to the $wp\_query global. Default: `null`
File: `wp-includes/post-thumbnail-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/post-thumbnail-template.php/)
```
function update_post_thumbnail_cache( $wp_query = null ) {
if ( ! $wp_query ) {
$wp_query = $GLOBALS['wp_query'];
}
if ( $wp_query->thumbnails_cached ) {
return;
}
$thumb_ids = array();
foreach ( $wp_query->posts as $post ) {
$id = get_post_thumbnail_id( $post->ID );
if ( $id ) {
$thumb_ids[] = $id;
}
}
if ( ! empty( $thumb_ids ) ) {
_prime_post_caches( $thumb_ids, false, true );
}
$wp_query->thumbnails_cached = true;
}
```
| Uses | Description |
| --- | --- |
| [get\_post\_thumbnail\_id()](get_post_thumbnail_id) wp-includes/post-thumbnail-template.php | Retrieves the post thumbnail ID. |
| [\_prime\_post\_caches()](_prime_post_caches) wp-includes/post.php | Adds any posts from the given IDs to the cache that do not already exist in cache. |
| Used By | Description |
| --- | --- |
| [WP\_REST\_Posts\_Controller::get\_items()](../classes/wp_rest_posts_controller/get_items) wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php | Retrieves a collection of posts. |
| [get\_the\_post\_thumbnail()](get_the_post_thumbnail) wp-includes/post-thumbnail-template.php | Retrieves the post thumbnail. |
| Version | Description |
| --- | --- |
| [3.2.0](https://developer.wordpress.org/reference/since/3.2.0/) | Introduced. |
wordpress wp_pre_kses_block_attributes( string $string, array[]|string $allowed_html, string[] $allowed_protocols ): string wp\_pre\_kses\_block\_attributes( string $string, array[]|string $allowed\_html, string[] $allowed\_protocols ): string
=======================================================================================================================
Removes non-allowable HTML from parsed block attribute values when filtering in the post context.
`$string` string Required Content to be run through KSES. `$allowed_html` array[]|string Required An array of allowed HTML elements and attributes, or a context name such as `'post'`. `$allowed_protocols` string[] Required Array of allowed URL protocols. string Filtered text to run through KSES.
File: `wp-includes/formatting.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/formatting.php/)
```
function wp_pre_kses_block_attributes( $string, $allowed_html, $allowed_protocols ) {
/*
* `filter_block_content` is expected to call `wp_kses`. Temporarily remove
* the filter to avoid recursion.
*/
remove_filter( 'pre_kses', 'wp_pre_kses_block_attributes', 10 );
$string = filter_block_content( $string, $allowed_html, $allowed_protocols );
add_filter( 'pre_kses', 'wp_pre_kses_block_attributes', 10, 3 );
return $string;
}
```
| Uses | Description |
| --- | --- |
| [filter\_block\_content()](filter_block_content) wp-includes/blocks.php | Filters and sanitizes block content to remove non-allowable HTML from parsed block attribute values. |
| [remove\_filter()](remove_filter) wp-includes/plugin.php | Removes a callback function from a filter hook. |
| [add\_filter()](add_filter) wp-includes/plugin.php | Adds a callback function to a filter hook. |
| Version | Description |
| --- | --- |
| [5.3.1](https://developer.wordpress.org/reference/since/5.3.1/) | Introduced. |
wordpress update_comment_cache( WP_Comment[] $comments, bool $update_meta_cache = true ) update\_comment\_cache( WP\_Comment[] $comments, bool $update\_meta\_cache = true )
===================================================================================
Updates the comment cache of given comments.
Will add the comments in $comments to the cache. If comment ID already exists in the comment cache then it will not be updated. The comment is added to the cache using the comment group with the key using the ID of the comments.
`$comments` [WP\_Comment](../classes/wp_comment)[] Required Array of comment objects `$update_meta_cache` bool Optional Whether to update commentmeta cache. Default: `true`
File: `wp-includes/comment.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/comment.php/)
```
function update_comment_cache( $comments, $update_meta_cache = true ) {
$data = array();
foreach ( (array) $comments as $comment ) {
$data[ $comment->comment_ID ] = $comment;
}
wp_cache_add_multiple( $data, 'comment' );
if ( $update_meta_cache ) {
// Avoid `wp_list_pluck()` in case `$comments` is passed by reference.
$comment_ids = array();
foreach ( $comments as $comment ) {
$comment_ids[] = $comment->comment_ID;
}
update_meta_cache( 'comment', $comment_ids );
}
}
```
| Uses | Description |
| --- | --- |
| [wp\_cache\_add\_multiple()](wp_cache_add_multiple) wp-includes/cache.php | Adds multiple values to the cache in one call. |
| [update\_meta\_cache()](update_meta_cache) wp-includes/meta.php | Updates the metadata cache for the specified objects. |
| Used By | Description |
| --- | --- |
| [\_prime\_comment\_caches()](_prime_comment_caches) wp-includes/comment.php | Adds any comments from the given IDs to the cache that do not already exist in cache. |
| [WP\_Comments\_List\_Table::prepare\_items()](../classes/wp_comments_list_table/prepare_items) wp-admin/includes/class-wp-comments-list-table.php | |
| Version | Description |
| --- | --- |
| [4.4.0](https://developer.wordpress.org/reference/since/4.4.0/) | Introduced the `$update_meta_cache` parameter. |
| [2.3.0](https://developer.wordpress.org/reference/since/2.3.0/) | Introduced. |
wordpress _make_cat_compat( array|object|WP_Term $category ) \_make\_cat\_compat( array|object|WP\_Term $category )
======================================================
This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.
Updates category structure to old pre-2.3 from new taxonomy structure.
This function was added for the taxonomy support to update the new category structure with the old category one. This will maintain compatibility with plugins and themes which depend on the old key or property names.
The parameter should only be passed a variable and not create the array or object inline to the parameter. The reason for this is that parameter is passed by reference and PHP will fail unless it has the variable.
There is no return value, because everything is updated on the variable you pass to it. This is one of the features with using pass by reference in PHP.
`$category` array|object|[WP\_Term](../classes/wp_term) Required Category row object or array. File: `wp-includes/category.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/category.php/)
```
function _make_cat_compat( &$category ) {
if ( is_object( $category ) && ! is_wp_error( $category ) ) {
$category->cat_ID = $category->term_id;
$category->category_count = $category->count;
$category->category_description = $category->description;
$category->cat_name = $category->name;
$category->category_nicename = $category->slug;
$category->category_parent = $category->parent;
} elseif ( is_array( $category ) && isset( $category['term_id'] ) ) {
$category['cat_ID'] = &$category['term_id'];
$category['category_count'] = &$category['count'];
$category['category_description'] = &$category['description'];
$category['cat_name'] = &$category['name'];
$category['category_nicename'] = &$category['slug'];
$category['category_parent'] = &$category['parent'];
}
}
```
| Uses | Description |
| --- | --- |
| [is\_wp\_error()](is_wp_error) wp-includes/load.php | Checks whether the given variable is a WordPress Error. |
| Used By | Description |
| --- | --- |
| [get\_category\_to\_edit()](get_category_to_edit) wp-admin/includes/taxonomy.php | Gets category object for given ID and ‘edit’ filter context. |
| [wp\_update\_category()](wp_update_category) wp-admin/includes/taxonomy.php | Aliases [wp\_insert\_category()](wp_insert_category) with minimal args. |
| [get\_the\_category()](get_the_category) wp-includes/category-template.php | Retrieves post categories. |
| [WP\_Query::get\_queried\_object()](../classes/wp_query/get_queried_object) wp-includes/class-wp-query.php | Retrieves the currently queried object. |
| [get\_categories()](get_categories) wp-includes/category.php | Retrieves a list of category objects. |
| [get\_category()](get_category) wp-includes/category.php | Retrieves category data given a category ID or category object. |
| [get\_category\_by\_path()](get_category_by_path) wp-includes/category.php | Retrieves a category based on URL containing the category slug. |
| [get\_category\_by\_slug()](get_category_by_slug) wp-includes/category.php | Retrieves a category object by category slug. |
| Version | Description |
| --- | --- |
| [4.4.0](https://developer.wordpress.org/reference/since/4.4.0/) | The `$category` parameter now also accepts a [WP\_Term](../classes/wp_term) object. |
| [2.3.0](https://developer.wordpress.org/reference/since/2.3.0/) | Introduced. |
wordpress _wp_delete_orphaned_draft_menu_items() \_wp\_delete\_orphaned\_draft\_menu\_items()
============================================
This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.
Deletes orphaned draft menu items
File: `wp-admin/includes/nav-menu.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/nav-menu.php/)
```
function _wp_delete_orphaned_draft_menu_items() {
global $wpdb;
$delete_timestamp = time() - ( DAY_IN_SECONDS * EMPTY_TRASH_DAYS );
// Delete orphaned draft menu items.
$menu_items_to_delete = $wpdb->get_col( $wpdb->prepare( "SELECT ID FROM $wpdb->posts AS p LEFT JOIN $wpdb->postmeta AS m ON p.ID = m.post_id WHERE post_type = 'nav_menu_item' AND post_status = 'draft' AND meta_key = '_menu_item_orphaned' AND meta_value < %d", $delete_timestamp ) );
foreach ( (array) $menu_items_to_delete as $menu_item_id ) {
wp_delete_post( $menu_item_id, true );
}
}
```
| Uses | Description |
| --- | --- |
| [wp\_delete\_post()](wp_delete_post) wp-includes/post.php | Trashes or deletes a post or page. |
| [wpdb::get\_col()](../classes/wpdb/get_col) wp-includes/class-wpdb.php | Retrieves one column from the database. |
| [wpdb::prepare()](../classes/wpdb/prepare) wp-includes/class-wpdb.php | Prepares a SQL query for safe execution. |
| Version | Description |
| --- | --- |
| [3.0.0](https://developer.wordpress.org/reference/since/3.0.0/) | Introduced. |
wordpress get_media_items( int $post_id, array $errors ): string get\_media\_items( int $post\_id, array $errors ): string
=========================================================
Retrieves HTML for media items of post gallery.
The HTML markup retrieved will be created for the progress of SWF Upload component. Will also create link for showing and hiding the form to modify the image attachment.
`$post_id` int Required Post ID. `$errors` array Required Errors for attachment, if any. string HTML content for media items of post gallery.
File: `wp-admin/includes/media.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/media.php/)
```
function get_media_items( $post_id, $errors ) {
$attachments = array();
if ( $post_id ) {
$post = get_post( $post_id );
if ( $post && 'attachment' === $post->post_type ) {
$attachments = array( $post->ID => $post );
} else {
$attachments = get_children(
array(
'post_parent' => $post_id,
'post_type' => 'attachment',
'orderby' => 'menu_order ASC, ID',
'order' => 'DESC',
)
);
}
} else {
if ( is_array( $GLOBALS['wp_the_query']->posts ) ) {
foreach ( $GLOBALS['wp_the_query']->posts as $attachment ) {
$attachments[ $attachment->ID ] = $attachment;
}
}
}
$output = '';
foreach ( (array) $attachments as $id => $attachment ) {
if ( 'trash' === $attachment->post_status ) {
continue;
}
$item = get_media_item( $id, array( 'errors' => isset( $errors[ $id ] ) ? $errors[ $id ] : null ) );
if ( $item ) {
$output .= "\n<div id='media-item-$id' class='media-item child-of-$attachment->post_parent preloaded'><div class='progress hidden'><div class='bar'></div></div><div id='media-upload-error-$id' class='hidden'></div><div class='filename hidden'></div>$item\n</div>";
}
}
return $output;
}
```
| Uses | Description |
| --- | --- |
| [get\_children()](get_children) wp-includes/post.php | Retrieves all children of the post parent ID. |
| [get\_media\_item()](get_media_item) wp-admin/includes/media.php | Retrieves HTML form for modifying the image attachment. |
| [get\_post()](get_post) wp-includes/post.php | Retrieves post data given a post ID or post object. |
| Used By | Description |
| --- | --- |
| [media\_upload\_type\_form()](media_upload_type_form) wp-admin/includes/media.php | Outputs the legacy media upload form for a given media type. |
| [media\_upload\_gallery\_form()](media_upload_gallery_form) wp-admin/includes/media.php | Adds gallery form to upload iframe. |
| [media\_upload\_library\_form()](media_upload_library_form) wp-admin/includes/media.php | Outputs the legacy media upload form for the media library. |
| Version | Description |
| --- | --- |
| [2.5.0](https://developer.wordpress.org/reference/since/2.5.0/) | Introduced. |
wordpress wp_update_php_annotation( string $before = '<p class="description">', string $after = '</p>' ) wp\_update\_php\_annotation( string $before = '<p class="description">', string $after = '</p>' )
=================================================================================================
Prints the default annotation for the web host altering the “Update PHP” page URL.
This function is to be used after [wp\_get\_update\_php\_url()](wp_get_update_php_url) to display a consistent annotation if the web host has altered the default "Update PHP" page URL.
`$before` string Optional Markup to output before the annotation. Default `<p class="description">`. Default: `'<p class="description">'`
`$after` string Optional Markup to output after the annotation. Default `</p>`. Default: `'</p>'`
File: `wp-includes/functions.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/functions.php/)
```
function wp_update_php_annotation( $before = '<p class="description">', $after = '</p>' ) {
$annotation = wp_get_update_php_annotation();
if ( $annotation ) {
echo $before . $annotation . $after;
}
}
```
| Uses | Description |
| --- | --- |
| [wp\_get\_update\_php\_annotation()](wp_get_update_php_annotation) wp-includes/functions.php | Returns the default annotation for the web hosting altering the “Update PHP” page URL. |
| Used By | Description |
| --- | --- |
| [wp\_dashboard\_php\_nag()](wp_dashboard_php_nag) wp-admin/includes/dashboard.php | Displays the PHP update nag. |
| [WP\_Customize\_Theme\_Control::content\_template()](../classes/wp_customize_theme_control/content_template) wp-includes/customize/class-wp-customize-theme-control.php | Render a JS template for theme display. |
| [customize\_themes\_print\_templates()](customize_themes_print_templates) wp-admin/includes/theme.php | Prints JS templates for the theme-browsing UI in the Customizer. |
| [WP\_Plugins\_List\_Table::single\_row()](../classes/wp_plugins_list_table/single_row) wp-admin/includes/class-wp-plugins-list-table.php | |
| [wp\_plugin\_update\_row()](wp_plugin_update_row) wp-admin/includes/update.php | Displays update information for a plugin. |
| [wp\_theme\_update\_row()](wp_theme_update_row) wp-admin/includes/update.php | Displays update information for a theme. |
| [install\_plugin\_information()](install_plugin_information) wp-admin/includes/plugin-install.php | Displays plugin information in dialog box form. |
| [WP\_Plugin\_Install\_List\_Table::display\_rows()](../classes/wp_plugin_install_list_table/display_rows) wp-admin/includes/class-wp-plugin-install-list-table.php | |
| Version | Description |
| --- | --- |
| [5.2.0](https://developer.wordpress.org/reference/since/5.2.0/) | Added the `$before` and `$after` parameters. |
| [5.1.0](https://developer.wordpress.org/reference/since/5.1.0/) | Introduced. |
wordpress _wp_get_attachment_relative_path( string $file ): string \_wp\_get\_attachment\_relative\_path( string $file ): string
=============================================================
This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.
Gets the attachment path relative to the upload directory.
`$file` string Required Attachment file name. string Attachment path relative to the upload directory.
File: `wp-includes/media.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/media.php/)
```
function _wp_get_attachment_relative_path( $file ) {
$dirname = dirname( $file );
if ( '.' === $dirname ) {
return '';
}
if ( false !== strpos( $dirname, 'wp-content/uploads' ) ) {
// Get the directory name relative to the upload directory (back compat for pre-2.7 uploads).
$dirname = substr( $dirname, strpos( $dirname, 'wp-content/uploads' ) + 18 );
$dirname = ltrim( $dirname, '/' );
}
return $dirname;
}
```
| Used By | Description |
| --- | --- |
| [wp\_image\_file\_matches\_image\_meta()](wp_image_file_matches_image_meta) wp-includes/media.php | Determines if the image meta data is for the image source file. |
| [wp\_calculate\_image\_srcset()](wp_calculate_image_srcset) wp-includes/media.php | A helper function to calculate the image sources to include in a ‘srcset’ attribute. |
| [wp\_get\_attachment\_url()](wp_get_attachment_url) wp-includes/post.php | Retrieves the URL for an attachment. |
| Version | Description |
| --- | --- |
| [4.4.1](https://developer.wordpress.org/reference/since/4.4.1/) | Introduced. |
wordpress comment_form_title( string|false $no_reply_text = false, string|false $reply_text = false, bool $link_to_parent = true ) comment\_form\_title( string|false $no\_reply\_text = false, string|false $reply\_text = false, bool $link\_to\_parent = true )
===============================================================================================================================
Displays text based on comment reply status.
Only affects users with JavaScript disabled.
`$no_reply_text` string|false Optional Text to display when not replying to a comment.
Default: `false`
`$reply_text` string|false Optional Text to display when replying to a comment.
Accepts "%s" for the author of the comment being replied to. Default: `false`
`$link_to_parent` bool Optional Boolean to control making the author's name a link to their comment. Default: `true`
* This function affects users with Javascript disabled or pages without the comment-reply.js JavaScript loaded.
* This function is normally used directly below `<div id="respond">` and before the comment form.
File: `wp-includes/comment-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/comment-template.php/)
```
function comment_form_title( $no_reply_text = false, $reply_text = false, $link_to_parent = true ) {
global $comment;
if ( false === $no_reply_text ) {
$no_reply_text = __( 'Leave a Reply' );
}
if ( false === $reply_text ) {
/* translators: %s: Author of the comment being replied to. */
$reply_text = __( 'Leave a Reply to %s' );
}
$reply_to_id = isset( $_GET['replytocom'] ) ? (int) $_GET['replytocom'] : 0;
if ( 0 == $reply_to_id ) {
echo $no_reply_text;
} else {
// Sets the global so that template tags can be used in the comment form.
$comment = get_comment( $reply_to_id );
if ( $link_to_parent ) {
$author = '<a href="#comment-' . get_comment_ID() . '">' . get_comment_author( $comment ) . '</a>';
} else {
$author = get_comment_author( $comment );
}
printf( $reply_text, $author );
}
}
```
| Uses | Description |
| --- | --- |
| [get\_comment\_author()](get_comment_author) wp-includes/comment-template.php | Retrieves the author of the current comment. |
| [get\_comment\_ID()](get_comment_id) wp-includes/comment-template.php | Retrieves the comment ID of the current comment. |
| [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. |
| [get\_comment()](get_comment) wp-includes/comment.php | Retrieves comment data given a comment ID or comment object. |
| Used By | Description |
| --- | --- |
| [comment\_form()](comment_form) wp-includes/comment-template.php | Outputs a complete commenting form for use within a template. |
| Version | Description |
| --- | --- |
| [2.7.0](https://developer.wordpress.org/reference/since/2.7.0/) | Introduced. |
| programming_docs |
wordpress wp_publish_post( int|WP_Post $post ) wp\_publish\_post( int|WP\_Post $post )
=======================================
Publishes a post by transitioning the post status.
`$post` int|[WP\_Post](../classes/wp_post) Required Post ID or post object. This function does not do anything except transition the post status. If you want to ensure post\_name is set, use [wp\_update\_post()](wp_update_post) instead.
File: `wp-includes/post.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/post.php/)
```
function wp_publish_post( $post ) {
global $wpdb;
$post = get_post( $post );
if ( ! $post ) {
return;
}
if ( 'publish' === $post->post_status ) {
return;
}
$post_before = get_post( $post->ID );
// Ensure at least one term is applied for taxonomies with a default term.
foreach ( get_object_taxonomies( $post->post_type, 'object' ) as $taxonomy => $tax_object ) {
// Skip taxonomy if no default term is set.
if (
'category' !== $taxonomy &&
empty( $tax_object->default_term )
) {
continue;
}
// Do not modify previously set terms.
if ( ! empty( get_the_terms( $post, $taxonomy ) ) ) {
continue;
}
if ( 'category' === $taxonomy ) {
$default_term_id = (int) get_option( 'default_category', 0 );
} else {
$default_term_id = (int) get_option( 'default_term_' . $taxonomy, 0 );
}
if ( ! $default_term_id ) {
continue;
}
wp_set_post_terms( $post->ID, array( $default_term_id ), $taxonomy );
}
$wpdb->update( $wpdb->posts, array( 'post_status' => 'publish' ), array( 'ID' => $post->ID ) );
clean_post_cache( $post->ID );
$old_status = $post->post_status;
$post->post_status = 'publish';
wp_transition_post_status( 'publish', $old_status, $post );
/** This action is documented in wp-includes/post.php */
do_action( "edit_post_{$post->post_type}", $post->ID, $post );
/** This action is documented in wp-includes/post.php */
do_action( 'edit_post', $post->ID, $post );
/** This action is documented in wp-includes/post.php */
do_action( "save_post_{$post->post_type}", $post->ID, $post, true );
/** This action is documented in wp-includes/post.php */
do_action( 'save_post', $post->ID, $post, true );
/** This action is documented in wp-includes/post.php */
do_action( 'wp_insert_post', $post->ID, $post, true );
wp_after_insert_post( $post, true, $post_before );
}
```
[do\_action( 'edit\_post', int $post\_ID, WP\_Post $post )](../hooks/edit_post)
Fires once an existing post has been updated.
[do\_action( "edit\_post\_{$post->post\_type}", int $post\_ID, WP\_Post $post )](../hooks/edit_post_post-post_type)
Fires once an existing post has been updated.
[do\_action( 'save\_post', int $post\_ID, WP\_Post $post, bool $update )](../hooks/save_post)
Fires once a post has been saved.
[do\_action( "save\_post\_{$post->post\_type}", int $post\_ID, WP\_Post $post, bool $update )](../hooks/save_post_post-post_type)
Fires once a post has been saved.
[do\_action( 'wp\_insert\_post', int $post\_ID, WP\_Post $post, bool $update )](../hooks/wp_insert_post)
Fires once a post has been saved.
| Uses | Description |
| --- | --- |
| [wp\_after\_insert\_post()](wp_after_insert_post) wp-includes/post.php | Fires actions after a post, its terms and meta data has been saved. |
| [get\_the\_terms()](get_the_terms) wp-includes/category-template.php | Retrieves the terms of the taxonomy that are attached to the post. |
| [get\_object\_taxonomies()](get_object_taxonomies) wp-includes/taxonomy.php | Returns the names or objects of the taxonomies which are registered for the requested object or object type, such as a post object or post type name. |
| [clean\_post\_cache()](clean_post_cache) wp-includes/post.php | Will clean the post in the cache. |
| [wp\_set\_post\_terms()](wp_set_post_terms) wp-includes/post.php | Sets the terms for a post. |
| [wp\_transition\_post\_status()](wp_transition_post_status) wp-includes/post.php | Fires actions related to the transitioning of a post’s status. |
| [wpdb::update()](../classes/wpdb/update) wp-includes/class-wpdb.php | Updates a row in the table. |
| [do\_action()](do_action) wp-includes/plugin.php | Calls the callback functions that have been added to an action hook. |
| [get\_option()](get_option) wp-includes/option.php | Retrieves an option value based on an option name. |
| [get\_post()](get_post) wp-includes/post.php | Retrieves post data given a post ID or post object. |
| Used By | Description |
| --- | --- |
| [check\_and\_publish\_future\_post()](check_and_publish_future_post) wp-includes/post.php | Publishes future post and make sure post ID has future post status. |
| Version | Description |
| --- | --- |
| [2.1.0](https://developer.wordpress.org/reference/since/2.1.0/) | Introduced. |
wordpress clean_url( string $url, array $protocols = null, string $context = 'display' ): string clean\_url( string $url, array $protocols = null, string $context = 'display' ): string
=======================================================================================
This function has been deprecated. Use [esc\_url()](esc_url) instead.
Checks and cleans a URL.
A number of characters are removed from the URL. If the URL is for displaying (the default behaviour) ampersands are also replaced. The ‘clean\_url’ filter is applied to the returned cleaned URL.
* [esc\_url()](esc_url)
`$url` string Required The URL to be cleaned. `$protocols` array Optional An array of acceptable protocols. Default: `null`
`$context` string Optional How the URL will be used. Default is `'display'`. Default: `'display'`
string The cleaned $url after the ['clean\_url'](../hooks/clean_url) filter is applied.
File: `wp-includes/deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/deprecated.php/)
```
function clean_url( $url, $protocols = null, $context = 'display' ) {
if ( $context == 'db' )
_deprecated_function( 'clean_url( $context = \'db\' )', '3.0.0', 'sanitize_url()' );
else
_deprecated_function( __FUNCTION__, '3.0.0', 'esc_url()' );
return esc_url( $url, $protocols, $context );
}
```
| Uses | Description |
| --- | --- |
| [esc\_url()](esc_url) wp-includes/formatting.php | Checks and cleans a URL. |
| [\_deprecated\_function()](_deprecated_function) wp-includes/functions.php | Marks a function as deprecated and inform when it has been used. |
| Version | Description |
| --- | --- |
| [3.0.0](https://developer.wordpress.org/reference/since/3.0.0/) | Use [esc\_url()](esc_url) |
| [1.2.0](https://developer.wordpress.org/reference/since/1.2.0/) | Introduced. |
wordpress _wp_build_title_and_description_for_taxonomy_block_template( string $taxonomy, string $slug, WP_Block_Template $template ): bool \_wp\_build\_title\_and\_description\_for\_taxonomy\_block\_template( string $taxonomy, string $slug, WP\_Block\_Template $template ): bool
===========================================================================================================================================
This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.
Builds the title and description of a taxonomy-specific template based on the underlying entity referenced.
Mutates the underlying template object.
`$taxonomy` string Required Identifier of the taxonomy, e.g. category. `$slug` string Required Slug of the term, e.g. shoes. `$template` [WP\_Block\_Template](../classes/wp_block_template) Required Template to mutate adding the description and title computed. bool True if the term referenced was found and false otherwise.
File: `wp-includes/block-template-utils.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/block-template-utils.php/)
```
function _wp_build_title_and_description_for_taxonomy_block_template( $taxonomy, $slug, WP_Block_Template $template ) {
$taxonomy_object = get_taxonomy( $taxonomy );
$default_args = array(
'taxonomy' => $taxonomy,
'hide_empty' => false,
'update_term_meta_cache' => false,
);
$term_query = new WP_Term_Query();
$args = array(
'number' => 1,
'slug' => $slug,
);
$args = wp_parse_args( $args, $default_args );
$terms_query = $term_query->query( $args );
if ( empty( $terms_query->terms ) ) {
$template->title = sprintf(
/* translators: Custom template title in the Site Editor, referencing a taxonomy term that was not found. 1: Taxonomy singular name, 2: Term slug. */
__( 'Not found: %1$s (%2$s)' ),
$taxonomy_object->labels->singular_name,
$slug
);
return false;
}
$term_title = $terms_query->terms[0]->name;
$template->title = sprintf(
/* translators: Custom template title in the Site Editor. 1: Taxonomy singular name, 2: Term title. */
__( '%1$s: %2$s' ),
$taxonomy_object->labels->singular_name,
$term_title
);
$template->description = sprintf(
/* translators: Custom template description in the Site Editor. %s: Term title. */
__( 'Template for %s' ),
$term_title
);
$term_query = new WP_Term_Query();
$args = array(
'number' => 2,
'name' => $term_title,
);
$args = wp_parse_args( $args, $default_args );
$terms_with_same_title_query = $term_query->query( $args );
if ( count( $terms_with_same_title_query->terms ) > 1 ) {
$template->title = sprintf(
/* translators: Custom template title in the Site Editor. 1: Template title, 2: Term slug. */
__( '%1$s (%2$s)' ),
$template->title,
$slug
);
}
return true;
}
```
| Uses | Description |
| --- | --- |
| [WP\_Term\_Query::\_\_construct()](../classes/wp_term_query/__construct) wp-includes/class-wp-term-query.php | Constructor. |
| [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. |
| [wp\_parse\_args()](wp_parse_args) wp-includes/functions.php | Merges user defined arguments into defaults array. |
| [get\_taxonomy()](get_taxonomy) wp-includes/taxonomy.php | Retrieves the taxonomy object of $taxonomy. |
| Used By | Description |
| --- | --- |
| [\_build\_block\_template\_result\_from\_post()](_build_block_template_result_from_post) wp-includes/block-template-utils.php | Builds a unified template object based a post Object. |
| Version | Description |
| --- | --- |
| [6.1.0](https://developer.wordpress.org/reference/since/6.1.0/) | Introduced. |
wordpress network_home_url( string $path = '', string|null $scheme = null ): string network\_home\_url( string $path = '', string|null $scheme = null ): string
===========================================================================
Retrieves the home URL for the current network.
Returns the home URL with the appropriate protocol, ‘https’ [is\_ssl()](is_ssl) and ‘http’ otherwise. If `$scheme` is ‘http’ or ‘https’, `is_ssl()` is overridden.
`$path` string Optional Path relative to the home URL. Default: `''`
`$scheme` string|null Optional Scheme to give the home URL context. Accepts `'http'`, `'https'`, or `'relative'`. Default: `null`
string Home URL link with optional path appended.
File: `wp-includes/link-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/link-template.php/)
```
function network_home_url( $path = '', $scheme = null ) {
if ( ! is_multisite() ) {
return home_url( $path, $scheme );
}
$current_network = get_network();
$orig_scheme = $scheme;
if ( ! in_array( $scheme, array( 'http', 'https', 'relative' ), true ) ) {
$scheme = is_ssl() ? 'https' : 'http';
}
if ( 'relative' === $scheme ) {
$url = $current_network->path;
} else {
$url = set_url_scheme( 'http://' . $current_network->domain . $current_network->path, $scheme );
}
if ( $path && is_string( $path ) ) {
$url .= ltrim( $path, '/' );
}
/**
* Filters the network home URL.
*
* @since 3.0.0
*
* @param string $url The complete network home URL including scheme and path.
* @param string $path Path relative to the network home URL. Blank string
* if no path is specified.
* @param string|null $orig_scheme Scheme to give the URL context. Accepts 'http', 'https',
* 'relative' or null.
*/
return apply_filters( 'network_home_url', $url, $path, $orig_scheme );
}
```
[apply\_filters( 'network\_home\_url', string $url, string $path, string|null $orig\_scheme )](../hooks/network_home_url)
Filters the network home URL.
| Uses | Description |
| --- | --- |
| [get\_network()](get_network) wp-includes/ms-network.php | Retrieves network data given a network ID or network object. |
| [is\_ssl()](is_ssl) wp-includes/load.php | Determines if SSL is used. |
| [set\_url\_scheme()](set_url_scheme) wp-includes/link-template.php | Sets the scheme for a URL. |
| [is\_multisite()](is_multisite) wp-includes/load.php | If Multisite is enabled. |
| [home\_url()](home_url) wp-includes/link-template.php | Retrieves the URL for the current site where the front end is accessible. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| Used By | Description |
| --- | --- |
| [update\_network\_option\_new\_admin\_email()](update_network_option_new_admin_email) wp-includes/ms-functions.php | Sends a confirmation request email when a change of network admin email address is attempted. |
| [WP\_Automatic\_Updater::send\_debug\_email()](../classes/wp_automatic_updater/send_debug_email) wp-admin/includes/class-wp-automatic-updater.php | Prepares and sends an email of a full log of background update results, useful for debugging and geekery. |
| [wxr\_site\_url()](wxr_site_url) wp-admin/includes/export.php | Returns the URL of the site. |
| [wp\_install\_defaults()](wp_install_defaults) wp-admin/includes/upgrade.php | Creates the initial content for a newly-installed site. |
| [wp\_notify\_postauthor()](wp_notify_postauthor) wp-includes/pluggable.php | Notifies an author (and/or others) of a comment/trackback/pingback on a post. |
| [wp\_mail()](wp_mail) wp-includes/pluggable.php | Sends an email, similar to PHP’s mail function. |
| [wpmu\_welcome\_user\_notification()](wpmu_welcome_user_notification) wp-includes/ms-functions.php | Notifies a user that their account activation has been successful. |
| [maybe\_redirect\_404()](maybe_redirect_404) wp-includes/ms-functions.php | Corrects 404 redirects when NOBLOGREDIRECT is defined. |
| [wpmu\_welcome\_notification()](wpmu_welcome_notification) wp-includes/ms-functions.php | Notifies the site administrator that their site activation was successful. |
| [wpmu\_signup\_blog\_notification()](wpmu_signup_blog_notification) wp-includes/ms-functions.php | Sends a confirmation request email to a user when they sign up for a new site. The new site will not become active until the confirmation link is clicked. |
| [wpmu\_signup\_user\_notification()](wpmu_signup_user_notification) wp-includes/ms-functions.php | Sends a confirmation request email to a user when they sign up for a new user account (without signing up for a site at the same time). The user account will not become active until the confirmation link is clicked. |
| [get\_blogaddress\_by\_name()](get_blogaddress_by_name) wp-includes/ms-blogs.php | Get a full blog URL, given a blog name. |
| Version | Description |
| --- | --- |
| [3.0.0](https://developer.wordpress.org/reference/since/3.0.0/) | Introduced. |
wordpress get_post_status_object( string $post_status ): stdClass|null get\_post\_status\_object( string $post\_status ): stdClass|null
================================================================
Retrieves a post status object by name.
* [register\_post\_status()](register_post_status)
`$post_status` string Required The name of a registered post status. stdClass|null A post status object.
File: `wp-includes/post.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/post.php/)
```
function get_post_status_object( $post_status ) {
global $wp_post_statuses;
if ( empty( $wp_post_statuses[ $post_status ] ) ) {
return null;
}
return $wp_post_statuses[ $post_status ];
}
```
| Used By | Description |
| --- | --- |
| [wp\_force\_plain\_post\_permalink()](wp_force_plain_post_permalink) wp-includes/link-template.php | Determine whether post should always use a plain permalink structure. |
| [is\_post\_status\_viewable()](is_post_status_viewable) wp-includes/post.php | Determines whether a post status is considered “viewable”. |
| [WP\_Privacy\_Requests\_Table::column\_status()](../classes/wp_privacy_requests_table/column_status) wp-admin/includes/class-wp-privacy-requests-table.php | Status column. |
| [WP\_Privacy\_Requests\_Table::get\_views()](../classes/wp_privacy_requests_table/get_views) wp-admin/includes/class-wp-privacy-requests-table.php | Get an associative array ( id => link ) with the list of views available on this table. |
| [WP\_REST\_Post\_Statuses\_Controller::get\_items()](../classes/wp_rest_post_statuses_controller/get_items) wp-includes/rest-api/endpoints/class-wp-rest-post-statuses-controller.php | Retrieves all post statuses, depending on user context. |
| [WP\_REST\_Post\_Statuses\_Controller::get\_item\_permissions\_check()](../classes/wp_rest_post_statuses_controller/get_item_permissions_check) wp-includes/rest-api/endpoints/class-wp-rest-post-statuses-controller.php | Checks if a given request has access to read a post status. |
| [WP\_REST\_Post\_Statuses\_Controller::get\_item()](../classes/wp_rest_post_statuses_controller/get_item) wp-includes/rest-api/endpoints/class-wp-rest-post-statuses-controller.php | Retrieves a specific post status. |
| [WP\_REST\_Posts\_Controller::check\_read\_permission()](../classes/wp_rest_posts_controller/check_read_permission) wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php | Checks if a post can be read. |
| [WP\_REST\_Posts\_Controller::handle\_status\_param()](../classes/wp_rest_posts_controller/handle_status_param) wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php | Determines validity and normalizes the given status parameter. |
| [wp\_handle\_comment\_submission()](wp_handle_comment_submission) wp-includes/comment.php | Handles the submission of a comment, usually posted to wp-comments-post.php via a comment form. |
| [\_wp\_translate\_postdata()](_wp_translate_postdata) wp-admin/includes/post.php | Renames `$_POST` data from form names to DB post columns. |
| [map\_meta\_cap()](map_meta_cap) wp-includes/capabilities.php | Maps a capability to the primitive capabilities required of the given user to satisfy the capability being checked. |
| [WP\_Customize\_Manager::save()](../classes/wp_customize_manager/save) wp-includes/class-wp-customize-manager.php | Handles customize\_save WP Ajax request to save/update a changeset. |
| [WP::parse\_request()](../classes/wp/parse_request) wp-includes/class-wp.php | Parses the request to find the correct WordPress query. |
| [WP\_Query::get\_posts()](../classes/wp_query/get_posts) wp-includes/class-wp-query.php | Retrieves an array of posts based on query variables. |
| [url\_to\_postid()](url_to_postid) wp-includes/rewrite.php | Examines a URL and try to determine the post ID it represents. |
| [redirect\_canonical()](redirect_canonical) wp-includes/canonical.php | Redirects incoming links to the proper URL based on the site url. |
| [wp\_xmlrpc\_server::\_insert\_post()](../classes/wp_xmlrpc_server/_insert_post) wp-includes/class-wp-xmlrpc-server.php | Helper method for wp\_newPost() and wp\_editPost(), containing shared logic. |
| Version | Description |
| --- | --- |
| [3.0.0](https://developer.wordpress.org/reference/since/3.0.0/) | Introduced. |
| programming_docs |
wordpress _enable_content_editor_for_navigation_post_type( WP_Post $post ) \_enable\_content\_editor\_for\_navigation\_post\_type( WP\_Post $post )
========================================================================
This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness. Use <_disable_content_editor_for_navigation_post_type> instead.
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.
* <_disable_content_editor_for_navigation_post_type>
`$post` [WP\_Post](../classes/wp_post) Required An instance of [WP\_Post](../classes/wp_post) class. File: `wp-admin/includes/post.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/post.php/)
```
function _enable_content_editor_for_navigation_post_type( $post ) {
$post_type = get_post_type( $post );
if ( 'wp_navigation' !== $post_type ) {
return;
}
add_post_type_support( $post_type, 'editor' );
}
```
| Uses | Description |
| --- | --- |
| [add\_post\_type\_support()](add_post_type_support) wp-includes/post.php | Registers support of certain features for a post type. |
| [get\_post\_type()](get_post_type) wp-includes/post.php | Retrieves the post type of the current post or of a given post. |
| Version | Description |
| --- | --- |
| [5.9.0](https://developer.wordpress.org/reference/since/5.9.0/) | Introduced. |
wordpress wp_get_current_user(): WP_User wp\_get\_current\_user(): WP\_User
==================================
Retrieves the current user object.
Will set the current user, if the current user is not set. The current user will be set to the logged-in person. If no user is logged-in, then it will set the current user to 0, which is invalid and won’t have any permissions.
* [\_wp\_get\_current\_user()](_wp_get_current_user)
[WP\_User](../classes/wp_user) Current [WP\_User](../classes/wp_user) instance.
File: `wp-includes/pluggable.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/pluggable.php/)
```
function wp_get_current_user() {
return _wp_get_current_user();
}
```
| Uses | Description |
| --- | --- |
| [\_wp\_get\_current\_user()](_wp_get_current_user) wp-includes/user.php | Retrieves the current user object. |
| Used By | Description |
| --- | --- |
| [WP\_REST\_Application\_Passwords\_Controller::get\_user()](../classes/wp_rest_application_passwords_controller/get_user) wp-includes/rest-api/endpoints/class-wp-rest-application-passwords-controller.php | Gets the requested user. |
| [populate\_network\_meta()](populate_network_meta) wp-admin/includes/schema.php | Creates WordPress network meta and sets the default values. |
| [the\_block\_editor\_meta\_box\_post\_form\_hidden\_fields()](the_block_editor_meta_box_post_form_hidden_fields) wp-admin/includes/post.php | Renders the hidden form required for the meta boxes form. |
| [wp\_enqueue\_code\_editor()](wp_enqueue_code_editor) wp-includes/general-template.php | Enqueues assets needed by the code editor for the given settings. |
| [wp\_switch\_roles\_and\_user()](wp_switch_roles_and_user) wp-includes/ms-blogs.php | Switches the initialized roles and current user capabilities to another site. |
| [WP\_Widget\_Custom\_HTML::add\_help\_text()](../classes/wp_widget_custom_html/add_help_text) wp-includes/widgets/class-wp-widget-custom-html.php | Add help text to widgets admin screen. |
| [update\_network\_option\_new\_admin\_email()](update_network_option_new_admin_email) wp-includes/ms-functions.php | Sends a confirmation request email when a change of network admin email address is attempted. |
| [get\_user\_locale()](get_user_locale) wp-includes/l10n.php | Retrieves the locale of a user. |
| [WP\_REST\_Users\_Controller::get\_current\_item()](../classes/wp_rest_users_controller/get_current_item) wp-includes/rest-api/endpoints/class-wp-rest-users-controller.php | Retrieves the current user. |
| [WP\_REST\_Comments\_Controller::create\_item()](../classes/wp_rest_comments_controller/create_item) wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php | Creates a comment. |
| [wp\_handle\_comment\_submission()](wp_handle_comment_submission) wp-includes/comment.php | Handles the submission of a comment, usually posted to wp-comments-post.php via a comment form. |
| [WP\_Screen::render\_meta\_boxes\_preferences()](../classes/wp_screen/render_meta_boxes_preferences) wp-admin/includes/class-wp-screen.php | Renders the meta boxes preferences. |
| [signup\_another\_blog()](signup_another_blog) wp-signup.php | Shows a form for returning users to sign up for another site. |
| [validate\_another\_blog\_signup()](validate_another_blog_signup) wp-signup.php | Validates a new site sign-up for an existing user. |
| [validate\_blog\_form()](validate_blog_form) wp-signup.php | Validates the new site sign-up. |
| [update\_option\_new\_admin\_email()](update_option_new_admin_email) wp-admin/includes/misc.php | Sends a confirmation request email when a change of site admin email address is attempted. |
| [send\_confirmation\_on\_profile\_email()](send_confirmation_on_profile_email) wp-includes/user.php | Sends a confirmation request email when a change of user email address is attempted. |
| [set\_screen\_options()](set_screen_options) wp-admin/includes/misc.php | Saves option for number of rows when listing posts, pages, comments, etc. |
| [wp\_ajax\_closed\_postboxes()](wp_ajax_closed_postboxes) wp-admin/includes/ajax-actions.php | Ajax handler for closed post boxes. |
| [wp\_ajax\_hidden\_columns()](wp_ajax_hidden_columns) wp-admin/includes/ajax-actions.php | Ajax handler for hidden columns. |
| [wp\_ajax\_meta\_box\_order()](wp_ajax_meta_box_order) wp-admin/includes/ajax-actions.php | Ajax handler for saving the meta box order. |
| [wp\_ajax\_replyto\_comment()](wp_ajax_replyto_comment) wp-admin/includes/ajax-actions.php | Ajax handler for replying to a comment. |
| [wp\_nav\_menu\_setup()](wp_nav_menu_setup) wp-admin/includes/nav-menu.php | Register nav menu meta boxes and advanced menu items. |
| [wp\_initial\_nav\_menu\_meta\_boxes()](wp_initial_nav_menu_meta_boxes) wp-admin/includes/nav-menu.php | Limit the amount of meta boxes to pages, posts, links, and categories for first time users. |
| [confirm\_delete\_users()](confirm_delete_users) wp-admin/includes/ms.php | |
| [current\_user\_can()](current_user_can) wp-includes/capabilities.php | Returns whether the current user has the specified capability. |
| [is\_super\_admin()](is_super_admin) wp-includes/capabilities.php | Determines whether user is a site admin. |
| [WP\_Customize\_Manager::register\_controls()](../classes/wp_customize_manager/register_controls) wp-includes/class-wp-customize-manager.php | Registers some default controls. |
| [wp\_verify\_nonce()](wp_verify_nonce) wp-includes/pluggable.php | Verifies that a correct security nonce was used with time limit. |
| [wp\_create\_nonce()](wp_create_nonce) wp-includes/pluggable.php | Creates a cryptographic token tied to a specific action, user, user session, and window of time. |
| [is\_user\_logged\_in()](is_user_logged_in) wp-includes/pluggable.php | Determines whether the current visitor is a logged in user. |
| [wp\_default\_editor()](wp_default_editor) wp-includes/general-template.php | Finds out which editor should be displayed by default. |
| [WP::init()](../classes/wp/init) wp-includes/class-wp.php | Set up the current user. |
| [wp\_admin\_bar\_my\_account\_item()](wp_admin_bar_my_account_item) wp-includes/admin-bar.php | Adds the “My Account” item. |
| [wp\_admin\_bar\_my\_account\_menu()](wp_admin_bar_my_account_menu) wp-includes/admin-bar.php | Adds the “My Account” submenu items. |
| [wp\_update\_user()](wp_update_user) wp-includes/user.php | Updates a user in the database. |
| [get\_current\_user\_id()](get_current_user_id) wp-includes/user.php | Gets the current user’s ID. |
| [is\_user\_option\_local()](is_user_option_local) wp-includes/ms-deprecated.php | Check whether a usermeta key has to do with the current blog. |
| [is\_user\_spammy()](is_user_spammy) wp-includes/ms-functions.php | Determines whether a user is marked as a spammer, based on user login. |
| [comment\_form()](comment_form) wp-includes/comment-template.php | Outputs a complete commenting form for use within a template. |
| Version | Description |
| --- | --- |
| [2.0.3](https://developer.wordpress.org/reference/since/2.0.3/) | Introduced. |
wordpress get_meta_sql( array $meta_query, string $type, string $primary_table, string $primary_id_column, object $context = null ): string[]|false get\_meta\_sql( array $meta\_query, string $type, string $primary\_table, string $primary\_id\_column, object $context = null ): string[]|false
===============================================================================================================================================
Given a meta query, generates SQL clauses to be appended to a main query.
* [WP\_Meta\_Query](../classes/wp_meta_query)
`$meta_query` array Required A meta query. `$type` string Required Type of meta. `$primary_table` string Required Primary database table name. `$primary_id_column` string Required Primary ID column name. `$context` object Optional The main query object Default: `null`
string[]|false Array containing JOIN and WHERE SQL clauses to append to the main query, or false if no table exists for the requested meta type.
* `join`stringSQL fragment to append to the main JOIN clause.
* `where`stringSQL fragment to append to the main WHERE clause.
File: `wp-includes/meta.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/meta.php/)
```
function get_meta_sql( $meta_query, $type, $primary_table, $primary_id_column, $context = null ) {
$meta_query_obj = new WP_Meta_Query( $meta_query );
return $meta_query_obj->get_sql( $type, $primary_table, $primary_id_column, $context );
}
```
| Uses | Description |
| --- | --- |
| [WP\_Meta\_Query::\_\_construct()](../classes/wp_meta_query/__construct) wp-includes/class-wp-meta-query.php | Constructor. |
| Version | Description |
| --- | --- |
| [3.2.0](https://developer.wordpress.org/reference/since/3.2.0/) | Introduced. |
wordpress the_post_thumbnail_url( string|int[] $size = 'post-thumbnail' ) the\_post\_thumbnail\_url( string|int[] $size = 'post-thumbnail' )
==================================================================
Displays the post thumbnail URL.
`$size` string|int[] Optional Image size to use. Accepts any valid image size, or an array of width and height values in pixels (in that order).
Default `'post-thumbnail'`. Default: `'post-thumbnail'`
File: `wp-includes/post-thumbnail-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/post-thumbnail-template.php/)
```
function the_post_thumbnail_url( $size = 'post-thumbnail' ) {
$url = get_the_post_thumbnail_url( null, $size );
if ( $url ) {
echo esc_url( $url );
}
}
```
| Uses | Description |
| --- | --- |
| [get\_the\_post\_thumbnail\_url()](get_the_post_thumbnail_url) wp-includes/post-thumbnail-template.php | Returns the post thumbnail URL. |
| [esc\_url()](esc_url) wp-includes/formatting.php | Checks and cleans a URL. |
| Version | Description |
| --- | --- |
| [4.4.0](https://developer.wordpress.org/reference/since/4.4.0/) | Introduced. |
wordpress plugins_url( string $path = '', string $plugin = '' ): string plugins\_url( string $path = '', string $plugin = '' ): string
==============================================================
Retrieves a URL within the plugins or mu-plugins directory.
Defaults to the plugins directory URL if no arguments are supplied.
`$path` string Optional Extra path appended to the end of the URL, including the relative directory if $plugin is supplied. Default: `''`
`$plugin` string Optional A full path to a file inside a plugin or mu-plugin.
The URL will be relative to its directory.
Typically this is done by passing `__FILE__` as the argument. Default: `''`
string Plugins URL link with optional paths appended.
This function retrieves the absolute URL to the plugins or mu-plugins directory (without the trailing slash) or, when using the $path argument, to a specific file under that directory. You can either specify the $path argument as a hardcoded path relative to the plugins or mu-plugins directory, or conveniently pass \_\_FILE\_\_ as the second argument to make the $path relative to the parent directory of the current PHP script file.
Uses the WP\_PLUGIN\_URL or, in the case the $plugin path begins with the WPMU\_PLUGIN\_DIR path, the WPMU\_PLUGIN\_URL constant internally, to compose the resultant URL. Note that the direct usage of WordPress internal constants [is not recommended](https://codex.wordpress.org/Determining_Plugin_and_Content_Directories "Determining Plugin and Content Directories").
Uses [[apply\_filters()](apply_filters)](apply_filters "Function Reference/apply filters") to apply “plugins\_url” filters on the resultant URL, with the following line of code
```
return apply_filters( 'plugins_url', $url, $path, $plugin );
```
The [plugins\_url()](plugins_url) function should not be called in the global context of plugins, but rather in a hook like “init” or “admin\_init” to ensure that the “plugins\_url” filters are already hooked at the time the function is called. This is vital for many site configurations to work, and if [plugins\_url()](plugins_url) is called in the global context of a plugin file it cannot be filtered by other plugins (though [mu-plugins](https://codex.wordpress.org/Must_Use_Plugins "Must Use Plugins") are able to filter it because they run before any other plugins).
File: `wp-includes/link-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/link-template.php/)
```
function plugins_url( $path = '', $plugin = '' ) {
$path = wp_normalize_path( $path );
$plugin = wp_normalize_path( $plugin );
$mu_plugin_dir = wp_normalize_path( WPMU_PLUGIN_DIR );
if ( ! empty( $plugin ) && 0 === strpos( $plugin, $mu_plugin_dir ) ) {
$url = WPMU_PLUGIN_URL;
} else {
$url = WP_PLUGIN_URL;
}
$url = set_url_scheme( $url );
if ( ! empty( $plugin ) && is_string( $plugin ) ) {
$folder = dirname( plugin_basename( $plugin ) );
if ( '.' !== $folder ) {
$url .= '/' . ltrim( $folder, '/' );
}
}
if ( $path && is_string( $path ) ) {
$url .= '/' . ltrim( $path, '/' );
}
/**
* Filters the URL to the plugins directory.
*
* @since 2.8.0
*
* @param string $url The complete URL to the plugins directory including scheme and path.
* @param string $path Path relative to the URL to the plugins directory. Blank string
* if no path is specified.
* @param string $plugin The plugin file path to be relative to. Blank string if no plugin
* is specified.
*/
return apply_filters( 'plugins_url', $url, $path, $plugin );
}
```
[apply\_filters( 'plugins\_url', string $url, string $path, string $plugin )](../hooks/plugins_url)
Filters the URL to the plugins directory.
| Uses | Description |
| --- | --- |
| [wp\_normalize\_path()](wp_normalize_path) wp-includes/functions.php | Normalizes a filesystem path. |
| [set\_url\_scheme()](set_url_scheme) wp-includes/link-template.php | Sets the scheme for a URL. |
| [plugin\_basename()](plugin_basename) wp-includes/plugin.php | Gets the basename of a plugin. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| Used By | Description |
| --- | --- |
| [register\_block\_script\_handle()](register_block_script_handle) wp-includes/blocks.php | Finds a script handle for the selected block metadata field. It detects when a path to file was provided and finds a corresponding asset file with details necessary to register the script under automatically generated handle name. It returns unprocessed script handle otherwise. |
| [register\_block\_style\_handle()](register_block_style_handle) wp-includes/blocks.php | Finds a style handle for the block metadata field. It detects when a path to file was provided and registers the style under automatically generated handle name. It returns unprocessed style handle otherwise. |
| [load\_script\_textdomain()](load_script_textdomain) wp-includes/l10n.php | Loads the script translated strings. |
| [get\_theme\_root\_uri()](get_theme_root_uri) wp-includes/theme.php | Retrieves URI for themes directory. |
| [plugin\_dir\_url()](plugin_dir_url) wp-includes/plugin.php | Get the URL directory path (with trailing slash) for the plugin \_\_FILE\_\_ passed in. |
| Version | Description |
| --- | --- |
| [2.6.0](https://developer.wordpress.org/reference/since/2.6.0/) | Introduced. |
wordpress wp_print_theme_file_tree( array|string $tree, int $level = 2, int $size = 1, int $index = 1 ) wp\_print\_theme\_file\_tree( array|string $tree, int $level = 2, int $size = 1, int $index = 1 )
=================================================================================================
This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.
Outputs the formatted file list for the theme file editor.
`$tree` array|string Required List of file/folder paths, or filename. `$level` int Optional The aria-level for the current iteration. Default: `2`
`$size` int Optional The aria-setsize for the current iteration. Default: `1`
`$index` int Optional The aria-posinset for the current iteration. Default: `1`
File: `wp-admin/includes/misc.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/misc.php/)
```
function wp_print_theme_file_tree( $tree, $level = 2, $size = 1, $index = 1 ) {
global $relative_file, $stylesheet;
if ( is_array( $tree ) ) {
$index = 0;
$size = count( $tree );
foreach ( $tree as $label => $theme_file ) :
$index++;
if ( ! is_array( $theme_file ) ) {
wp_print_theme_file_tree( $theme_file, $level, $index, $size );
continue;
}
?>
<li role="treeitem" aria-expanded="true" tabindex="-1"
aria-level="<?php echo esc_attr( $level ); ?>"
aria-setsize="<?php echo esc_attr( $size ); ?>"
aria-posinset="<?php echo esc_attr( $index ); ?>">
<span class="folder-label"><?php echo esc_html( $label ); ?> <span class="screen-reader-text"><?php _e( 'folder' ); ?></span><span aria-hidden="true" class="icon"></span></span>
<ul role="group" class="tree-folder"><?php wp_print_theme_file_tree( $theme_file, $level + 1, $index, $size ); ?></ul>
</li>
<?php
endforeach;
} else {
$filename = $tree;
$url = add_query_arg(
array(
'file' => rawurlencode( $tree ),
'theme' => rawurlencode( $stylesheet ),
),
self_admin_url( 'theme-editor.php' )
);
?>
<li role="none" class="<?php echo esc_attr( $relative_file === $filename ? 'current-file' : '' ); ?>">
<a role="treeitem" tabindex="<?php echo esc_attr( $relative_file === $filename ? '0' : '-1' ); ?>"
href="<?php echo esc_url( $url ); ?>"
aria-level="<?php echo esc_attr( $level ); ?>"
aria-setsize="<?php echo esc_attr( $size ); ?>"
aria-posinset="<?php echo esc_attr( $index ); ?>">
<?php
$file_description = esc_html( get_file_description( $filename ) );
if ( $file_description !== $filename && wp_basename( $filename ) !== $file_description ) {
$file_description .= '<br /><span class="nonessential">(' . esc_html( $filename ) . ')</span>';
}
if ( $relative_file === $filename ) {
echo '<span class="notice notice-info">' . $file_description . '</span>';
} else {
echo $file_description;
}
?>
</a>
</li>
<?php
}
}
```
| Uses | Description |
| --- | --- |
| [wp\_print\_theme\_file\_tree()](wp_print_theme_file_tree) wp-admin/includes/misc.php | Outputs the formatted file list for the theme file editor. |
| [get\_file\_description()](get_file_description) wp-admin/includes/file.php | Gets the description for standard WordPress theme files. |
| [self\_admin\_url()](self_admin_url) wp-includes/link-template.php | Retrieves the URL to the admin area for either the current site or the network depending on context. |
| [\_e()](_e) wp-includes/l10n.php | Displays translated text. |
| [wp\_basename()](wp_basename) wp-includes/formatting.php | i18n-friendly version of basename(). |
| [esc\_attr()](esc_attr) wp-includes/formatting.php | Escaping for HTML attributes. |
| [esc\_html()](esc_html) wp-includes/formatting.php | Escaping for HTML blocks. |
| [esc\_url()](esc_url) wp-includes/formatting.php | Checks and cleans a URL. |
| [add\_query\_arg()](add_query_arg) wp-includes/functions.php | Retrieves a modified URL query string. |
| Used By | Description |
| --- | --- |
| [wp\_print\_theme\_file\_tree()](wp_print_theme_file_tree) wp-admin/includes/misc.php | Outputs the formatted file list for the theme file editor. |
| Version | Description |
| --- | --- |
| [4.9.0](https://developer.wordpress.org/reference/since/4.9.0/) | Introduced. |
| programming_docs |
wordpress wp_check_password( string $password, string $hash, string|int $user_id = '' ): bool wp\_check\_password( string $password, string $hash, string|int $user\_id = '' ): bool
======================================================================================
Checks the plaintext password against the encrypted Password.
Maintains compatibility between old version and the new cookie authentication protocol using PHPass library. The $hash parameter is the encrypted password and the function compares the plain text password when encrypted similarly against the already encrypted password to see if they match.
For integration with other applications, this function can be overwritten to instead use the other package password checking algorithm.
`$password` string Required Plaintext user's password. `$hash` string Required Hash of the user's password to check against. `$user_id` string|int Optional User ID. Default: `''`
bool False, if the $password does not match the hashed password.
This function can be replaced via [plugins](https://wordpress.org/support/article/glossary/ "Glossary"). If plugins do not redefine these functions, then this will be used instead.
File: `wp-includes/pluggable.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/pluggable.php/)
```
function wp_check_password( $password, $hash, $user_id = '' ) {
global $wp_hasher;
// If the hash is still md5...
if ( strlen( $hash ) <= 32 ) {
$check = hash_equals( $hash, md5( $password ) );
if ( $check && $user_id ) {
// Rehash using new hash.
wp_set_password( $password, $user_id );
$hash = wp_hash_password( $password );
}
/**
* Filters whether the plaintext password matches the encrypted password.
*
* @since 2.5.0
*
* @param bool $check Whether the passwords match.
* @param string $password The plaintext password.
* @param string $hash The hashed password.
* @param string|int $user_id User ID. Can be empty.
*/
return apply_filters( 'check_password', $check, $password, $hash, $user_id );
}
// If the stored hash is longer than an MD5,
// presume the new style phpass portable hash.
if ( empty( $wp_hasher ) ) {
require_once ABSPATH . WPINC . '/class-phpass.php';
// By default, use the portable hash from phpass.
$wp_hasher = new PasswordHash( 8, true );
}
$check = $wp_hasher->CheckPassword( $password, $hash );
/** This filter is documented in wp-includes/pluggable.php */
return apply_filters( 'check_password', $check, $password, $hash, $user_id );
}
```
[apply\_filters( 'check\_password', bool $check, string $password, string $hash, string|int $user\_id )](../hooks/check_password)
Filters whether the plaintext password matches the encrypted password.
| Uses | Description |
| --- | --- |
| [wp\_set\_password()](wp_set_password) wp-includes/pluggable.php | Updates the user’s password with a new encrypted one. |
| [wp\_hash\_password()](wp_hash_password) wp-includes/pluggable.php | Creates a hash (encrypt) of a plain text password. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| Used By | Description |
| --- | --- |
| [wp\_authenticate\_application\_password()](wp_authenticate_application_password) wp-includes/user.php | Authenticates the user using an application password. |
| [WP\_Recovery\_Mode\_Key\_Service::validate\_recovery\_mode\_key()](../classes/wp_recovery_mode_key_service/validate_recovery_mode_key) wp-includes/class-wp-recovery-mode-key-service.php | Verifies if the recovery mode key is correct. |
| [wp\_authenticate\_email\_password()](wp_authenticate_email_password) wp-includes/user.php | Authenticates a user using the email and password. |
| [wp\_authenticate\_username\_password()](wp_authenticate_username_password) wp-includes/user.php | Authenticates a user, confirming the username and password are valid. |
| Version | Description |
| --- | --- |
| [2.5.0](https://developer.wordpress.org/reference/since/2.5.0/) | Introduced. |
wordpress wp_iframe( callable $content_func, mixed $args ) wp\_iframe( callable $content\_func, mixed $args )
==================================================
Outputs the iframe to display the media upload page.
`$content_func` callable Required Function that outputs the content. `$args` mixed Optional additional parameters to pass to the callback function when it's called. File: `wp-admin/includes/media.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/media.php/)
```
function wp_iframe( $content_func, ...$args ) {
_wp_admin_html_begin();
?>
<title><?php bloginfo( 'name' ); ?> › <?php _e( 'Uploads' ); ?> — <?php _e( 'WordPress' ); ?></title>
<?php
wp_enqueue_style( 'colors' );
// Check callback name for 'media'.
if (
( is_array( $content_func ) && ! empty( $content_func[1] ) && 0 === strpos( (string) $content_func[1], 'media' ) ) ||
( ! is_array( $content_func ) && 0 === strpos( $content_func, 'media' ) )
) {
wp_enqueue_style( 'deprecated-media' );
}
?>
<script type="text/javascript">
addLoadEvent = function(func){if(typeof jQuery!=='undefined')jQuery(function(){func();});else if(typeof wpOnload!=='function'){wpOnload=func;}else{var oldonload=wpOnload;wpOnload=function(){oldonload();func();}}};
var ajaxurl = '<?php echo esc_js( admin_url( 'admin-ajax.php', 'relative' ) ); ?>', pagenow = 'media-upload-popup', adminpage = 'media-upload-popup',
isRtl = <?php echo (int) is_rtl(); ?>;
</script>
<?php
/** This action is documented in wp-admin/admin-header.php */
do_action( 'admin_enqueue_scripts', 'media-upload-popup' );
/**
* Fires when admin styles enqueued for the legacy (pre-3.5.0) media upload popup are printed.
*
* @since 2.9.0
*/
do_action( 'admin_print_styles-media-upload-popup' ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
/** This action is documented in wp-admin/admin-header.php */
do_action( 'admin_print_styles' );
/**
* Fires when admin scripts enqueued for the legacy (pre-3.5.0) media upload popup are printed.
*
* @since 2.9.0
*/
do_action( 'admin_print_scripts-media-upload-popup' ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
/** This action is documented in wp-admin/admin-header.php */
do_action( 'admin_print_scripts' );
/**
* Fires when scripts enqueued for the admin header for the legacy (pre-3.5.0)
* media upload popup are printed.
*
* @since 2.9.0
*/
do_action( 'admin_head-media-upload-popup' ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
/** This action is documented in wp-admin/admin-header.php */
do_action( 'admin_head' );
if ( is_string( $content_func ) ) {
/**
* Fires in the admin header for each specific form tab in the legacy
* (pre-3.5.0) media upload popup.
*
* The dynamic portion of the hook name, `$content_func`, refers to the form
* callback for the media upload type.
*
* @since 2.5.0
*/
do_action( "admin_head_{$content_func}" );
}
$body_id_attr = '';
if ( isset( $GLOBALS['body_id'] ) ) {
$body_id_attr = ' id="' . $GLOBALS['body_id'] . '"';
}
?>
</head>
<body<?php echo $body_id_attr; ?> class="wp-core-ui no-js">
<script type="text/javascript">
document.body.className = document.body.className.replace('no-js', 'js');
</script>
<?php
call_user_func_array( $content_func, $args );
/** This action is documented in wp-admin/admin-footer.php */
do_action( 'admin_print_footer_scripts' );
?>
<script type="text/javascript">if(typeof wpOnload==='function')wpOnload();</script>
</body>
</html>
<?php
}
```
[do\_action( 'admin\_enqueue\_scripts', string $hook\_suffix )](../hooks/admin_enqueue_scripts)
Enqueue scripts for all admin pages.
[do\_action( 'admin\_head' )](../hooks/admin_head)
Fires in head section for all admin pages.
[do\_action( 'admin\_head-media-upload-popup' )](../hooks/admin_head-media-upload-popup)
Fires when scripts enqueued for the admin header for the legacy (pre-3.5.0) media upload popup are printed.
[do\_action( "admin\_head\_{$content\_func}" )](../hooks/admin_head_content_func)
Fires in the admin header for each specific form tab in the legacy (pre-3.5.0) media upload popup.
[do\_action( 'admin\_print\_footer\_scripts' )](../hooks/admin_print_footer_scripts)
Prints any scripts and data queued for the footer.
[do\_action( 'admin\_print\_scripts' )](../hooks/admin_print_scripts)
Fires when scripts are printed for all admin pages.
[do\_action( 'admin\_print\_scripts-media-upload-popup' )](../hooks/admin_print_scripts-media-upload-popup)
Fires when admin scripts enqueued for the legacy (pre-3.5.0) media upload popup are printed.
[do\_action( 'admin\_print\_styles' )](../hooks/admin_print_styles)
Fires when styles are printed for all admin pages.
[do\_action( 'admin\_print\_styles-media-upload-popup' )](../hooks/admin_print_styles-media-upload-popup)
Fires when admin styles enqueued for the legacy (pre-3.5.0) media upload popup are printed.
| Uses | Description |
| --- | --- |
| [\_wp\_admin\_html\_begin()](_wp_admin_html_begin) wp-admin/includes/template.php | Prints out the beginning of the admin HTML header. |
| [esc\_js()](esc_js) wp-includes/formatting.php | Escapes single quotes, `"`, , `&`, and fixes line endings. |
| [bloginfo()](bloginfo) wp-includes/general-template.php | Displays information about the current site. |
| [is\_rtl()](is_rtl) wp-includes/l10n.php | Determines whether the current locale is right-to-left (RTL). |
| [wp\_enqueue\_style()](wp_enqueue_style) wp-includes/functions.wp-styles.php | Enqueue a CSS stylesheet. |
| [\_e()](_e) wp-includes/l10n.php | Displays translated text. |
| [admin\_url()](admin_url) wp-includes/link-template.php | Retrieves the URL to the admin area for the current site. |
| [do\_action()](do_action) wp-includes/plugin.php | Calls the callback functions that have been added to an action hook. |
| Used By | Description |
| --- | --- |
| [wp\_media\_upload\_handler()](wp_media_upload_handler) wp-admin/includes/media.php | Handles the process of uploading media. |
| [media\_upload\_gallery()](media_upload_gallery) wp-admin/includes/media.php | Retrieves the legacy media uploader form in an iframe. |
| [media\_upload\_library()](media_upload_library) wp-admin/includes/media.php | Retrieves the legacy media library form in an iframe. |
| Version | Description |
| --- | --- |
| [5.3.0](https://developer.wordpress.org/reference/since/5.3.0/) | Formalized the existing and already documented `...$args` parameter by adding it to the function signature. |
| [2.5.0](https://developer.wordpress.org/reference/since/2.5.0/) | Introduced. |
wordpress ms_not_installed( string $domain, string $path ) ms\_not\_installed( string $domain, string $path )
==================================================
This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.
Displays a failure message.
Used when a blog’s tables do not exist. Checks for a missing $[wpdb](../classes/wpdb)->site table as well.
`$domain` string Required The requested domain for the error to reference. `$path` string Required The requested path for the error to reference. File: `wp-includes/ms-load.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/ms-load.php/)
```
function ms_not_installed( $domain, $path ) {
global $wpdb;
if ( ! is_admin() ) {
dead_db();
}
wp_load_translations_early();
$title = __( 'Error establishing a database connection' );
$msg = '<h1>' . $title . '</h1>';
$msg .= '<p>' . __( 'If your site does not display, please contact the owner of this network.' ) . '';
$msg .= ' ' . __( 'If you are the owner of this network please check that your host’s database server is running properly and all tables are error free.' ) . '</p>';
$query = $wpdb->prepare( 'SHOW TABLES LIKE %s', $wpdb->esc_like( $wpdb->site ) );
if ( ! $wpdb->get_var( $query ) ) {
$msg .= '<p>' . sprintf(
/* translators: %s: Table name. */
__( '<strong>Database tables are missing.</strong> This means that your host’s database server is not running, WordPress was not installed properly, or someone deleted %s. You really should look at your database now.' ),
'<code>' . $wpdb->site . '</code>'
) . '</p>';
} else {
$msg .= '<p>' . sprintf(
/* translators: 1: Site URL, 2: Table name, 3: Database name. */
__( '<strong>Could not find site %1$s.</strong> Searched for table %2$s in database %3$s. Is that right?' ),
'<code>' . rtrim( $domain . $path, '/' ) . '</code>',
'<code>' . $wpdb->blogs . '</code>',
'<code>' . DB_NAME . '</code>'
) . '</p>';
}
$msg .= '<p><strong>' . __( 'What do I do now?' ) . '</strong> ';
$msg .= sprintf(
/* translators: %s: Documentation URL. */
__( 'Read the <a href="%s" target="_blank">Debugging a WordPress Network</a> article. Some of the suggestions there may help you figure out what went wrong.' ),
__( 'https://wordpress.org/support/article/debugging-a-wordpress-network/' )
);
$msg .= ' ' . __( 'If you are still stuck with this message, then check that your database contains the following tables:' ) . '</p><ul>';
foreach ( $wpdb->tables( 'global' ) as $t => $table ) {
if ( 'sitecategories' === $t ) {
continue;
}
$msg .= '<li>' . $table . '</li>';
}
$msg .= '</ul>';
wp_die( $msg, $title, array( 'response' => 500 ) );
}
```
| Uses | Description |
| --- | --- |
| [wpdb::esc\_like()](../classes/wpdb/esc_like) wp-includes/class-wpdb.php | First half of escaping for `LIKE` special characters `%` and `_` before preparing for SQL. |
| [wp\_load\_translations\_early()](wp_load_translations_early) wp-includes/load.php | Attempt an early load of translations. |
| [dead\_db()](dead_db) wp-includes/functions.php | Loads custom DB error or display WordPress DB error. |
| [wpdb::tables()](../classes/wpdb/tables) wp-includes/class-wpdb.php | Returns an array of WordPress tables. |
| [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. |
| [is\_admin()](is_admin) wp-includes/load.php | Determines whether the current request is for an administrative interface page. |
| [wp\_die()](wp_die) wp-includes/functions.php | Kills WordPress execution and displays HTML page with an error message. |
| [wpdb::get\_var()](../classes/wpdb/get_var) wp-includes/class-wpdb.php | Retrieves one variable from the database. |
| [wpdb::prepare()](../classes/wpdb/prepare) wp-includes/class-wpdb.php | Prepares a SQL query for safe execution. |
| Version | Description |
| --- | --- |
| [4.4.0](https://developer.wordpress.org/reference/since/4.4.0/) | The `$domain` and `$path` parameters were added. |
| [3.0.0](https://developer.wordpress.org/reference/since/3.0.0/) | Introduced. |
wordpress dismiss_core_update( object $update ): bool dismiss\_core\_update( object $update ): bool
=============================================
Dismisses core update.
`$update` object Required bool
File: `wp-admin/includes/update.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/update.php/)
```
function dismiss_core_update( $update ) {
$dismissed = get_site_option( 'dismissed_update_core' );
$dismissed[ $update->current . '|' . $update->locale ] = true;
return update_site_option( 'dismissed_update_core', $dismissed );
}
```
| Uses | Description |
| --- | --- |
| [update\_site\_option()](update_site_option) wp-includes/option.php | Updates the value of an option that was already added for the current network. |
| [get\_site\_option()](get_site_option) wp-includes/option.php | Retrieve an option value for the current network based on name of option. |
| Used By | Description |
| --- | --- |
| [do\_dismiss\_core\_update()](do_dismiss_core_update) wp-admin/update-core.php | Dismiss a core update. |
| Version | Description |
| --- | --- |
| [2.7.0](https://developer.wordpress.org/reference/since/2.7.0/) | Introduced. |
wordpress enqueue_embed_scripts() enqueue\_embed\_scripts()
=========================
Enqueues embed iframe default CSS and JS.
Enqueue PNG fallback CSS for embed iframe for legacy versions of IE.
Allows plugins to queue scripts for the embed iframe end using [wp\_enqueue\_script()](wp_enqueue_script) .
Runs first in oembed\_head().
File: `wp-includes/embed.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/embed.php/)
```
function enqueue_embed_scripts() {
wp_enqueue_style( 'wp-embed-template-ie' );
/**
* Fires when scripts and styles are enqueued for the embed iframe.
*
* @since 4.4.0
*/
do_action( 'enqueue_embed_scripts' );
}
```
[do\_action( 'enqueue\_embed\_scripts' )](../hooks/enqueue_embed_scripts)
Fires when scripts and styles are enqueued for the embed iframe.
| Uses | Description |
| --- | --- |
| [wp\_enqueue\_style()](wp_enqueue_style) wp-includes/functions.wp-styles.php | Enqueue a CSS stylesheet. |
| [do\_action()](do_action) wp-includes/plugin.php | Calls the callback functions that have been added to an action hook. |
| Version | Description |
| --- | --- |
| [4.4.0](https://developer.wordpress.org/reference/since/4.4.0/) | Introduced. |
wordpress wp_deregister_script( string $handle ) wp\_deregister\_script( string $handle )
========================================
Remove a registered script.
Note: there are intentional safeguards in place to prevent critical admin scripts, such as jQuery core, from being unregistered.
* [WP\_Dependencies::remove()](../classes/wp_dependencies/remove)
`$handle` string Required Name of the script to be removed. File: `wp-includes/functions.wp-scripts.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/functions-wp-scripts.php/)
```
function wp_deregister_script( $handle ) {
global $pagenow;
_wp_scripts_maybe_doing_it_wrong( __FUNCTION__, $handle );
/**
* Do not allow accidental or negligent de-registering of critical scripts in the admin.
* Show minimal remorse if the correct hook is used.
*/
$current_filter = current_filter();
if ( ( is_admin() && 'admin_enqueue_scripts' !== $current_filter ) ||
( 'wp-login.php' === $pagenow && 'login_enqueue_scripts' !== $current_filter )
) {
$not_allowed = array(
'jquery',
'jquery-core',
'jquery-migrate',
'jquery-ui-core',
'jquery-ui-accordion',
'jquery-ui-autocomplete',
'jquery-ui-button',
'jquery-ui-datepicker',
'jquery-ui-dialog',
'jquery-ui-draggable',
'jquery-ui-droppable',
'jquery-ui-menu',
'jquery-ui-mouse',
'jquery-ui-position',
'jquery-ui-progressbar',
'jquery-ui-resizable',
'jquery-ui-selectable',
'jquery-ui-slider',
'jquery-ui-sortable',
'jquery-ui-spinner',
'jquery-ui-tabs',
'jquery-ui-tooltip',
'jquery-ui-widget',
'underscore',
'backbone',
);
if ( in_array( $handle, $not_allowed, true ) ) {
_doing_it_wrong(
__FUNCTION__,
sprintf(
/* translators: 1: Script name, 2: wp_enqueue_scripts */
__( 'Do not deregister the %1$s script in the administration area. To target the front-end theme, use the %2$s hook.' ),
"<code>$handle</code>",
'<code>wp_enqueue_scripts</code>'
),
'3.6.0'
);
return;
}
}
wp_scripts()->remove( $handle );
}
```
| Uses | Description |
| --- | --- |
| [wp\_scripts()](wp_scripts) wp-includes/functions.wp-scripts.php | Initialize $wp\_scripts if it has not been set. |
| [current\_filter()](current_filter) wp-includes/plugin.php | Retrieves the name of the current filter hook. |
| [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. |
| [is\_admin()](is_admin) wp-includes/load.php | Determines whether the current request is for an administrative interface page. |
| [\_doing\_it\_wrong()](_doing_it_wrong) wp-includes/functions.php | Marks something as being incorrectly called. |
| Version | Description |
| --- | --- |
| [2.1.0](https://developer.wordpress.org/reference/since/2.1.0/) | Introduced. |
| programming_docs |
wordpress get_sitestats(): int[] get\_sitestats(): int[]
=======================
Gets the network’s site and user counts.
int[] Site and user count for the network.
* `blogs`intNumber of sites on the network.
* `users`intNumber of users on the network.
File: `wp-includes/ms-functions.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/ms-functions.php/)
```
function get_sitestats() {
$stats = array(
'blogs' => get_blog_count(),
'users' => get_user_count(),
);
return $stats;
}
```
| Uses | Description |
| --- | --- |
| [get\_blog\_count()](get_blog_count) wp-includes/ms-functions.php | Gets the number of active sites on the installation. |
| [get\_user\_count()](get_user_count) wp-includes/user.php | Returns the number of active users in your installation. |
| Version | Description |
| --- | --- |
| [MU (3.0.0)](https://developer.wordpress.org/reference/since/mu.3.0.0/) | Introduced. |
wordpress _get_list_table( string $class_name, array $args = array() ): WP_List_Table|false \_get\_list\_table( string $class\_name, array $args = array() ): WP\_List\_Table|false
=======================================================================================
Fetches an instance of a [WP\_List\_Table](../classes/wp_list_table) class.
`$class_name` string Required The type of the list table, which is the class name. `$args` array Optional Arguments to pass to the class. Accepts `'screen'`. Default: `array()`
[WP\_List\_Table](../classes/wp_list_table)|false List table object on success, false if the class does not exist.
File: `wp-admin/includes/list-table.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/list-table.php/)
```
function _get_list_table( $class_name, $args = array() ) {
$core_classes = array(
// Site Admin.
'WP_Posts_List_Table' => 'posts',
'WP_Media_List_Table' => 'media',
'WP_Terms_List_Table' => 'terms',
'WP_Users_List_Table' => 'users',
'WP_Comments_List_Table' => 'comments',
'WP_Post_Comments_List_Table' => array( 'comments', 'post-comments' ),
'WP_Links_List_Table' => 'links',
'WP_Plugin_Install_List_Table' => 'plugin-install',
'WP_Themes_List_Table' => 'themes',
'WP_Theme_Install_List_Table' => array( 'themes', 'theme-install' ),
'WP_Plugins_List_Table' => 'plugins',
'WP_Application_Passwords_List_Table' => 'application-passwords',
// Network Admin.
'WP_MS_Sites_List_Table' => 'ms-sites',
'WP_MS_Users_List_Table' => 'ms-users',
'WP_MS_Themes_List_Table' => 'ms-themes',
// Privacy requests tables.
'WP_Privacy_Data_Export_Requests_List_Table' => 'privacy-data-export-requests',
'WP_Privacy_Data_Removal_Requests_List_Table' => 'privacy-data-removal-requests',
);
if ( isset( $core_classes[ $class_name ] ) ) {
foreach ( (array) $core_classes[ $class_name ] as $required ) {
require_once ABSPATH . 'wp-admin/includes/class-wp-' . $required . '-list-table.php';
}
if ( isset( $args['screen'] ) ) {
$args['screen'] = convert_to_screen( $args['screen'] );
} elseif ( isset( $GLOBALS['hook_suffix'] ) ) {
$args['screen'] = get_current_screen();
} else {
$args['screen'] = null;
}
/**
* Filters the list table class to instantiate.
*
* @since 6.1.0
*
* @param string $class_name The list table class to use.
* @param array $args An array containing _get_list_table() arguments.
*/
$custom_class_name = apply_filters( 'wp_list_table_class_name', $class_name, $args );
if ( is_string( $custom_class_name ) && class_exists( $custom_class_name ) ) {
$class_name = $custom_class_name;
}
return new $class_name( $args );
}
return false;
}
```
[apply\_filters( 'wp\_list\_table\_class\_name', string $class\_name, array $args )](../hooks/wp_list_table_class_name)
Filters the list table class to instantiate.
| Uses | Description |
| --- | --- |
| [get\_current\_screen()](get_current_screen) wp-admin/includes/screen.php | Get the current screen object |
| [convert\_to\_screen()](convert_to_screen) wp-admin/includes/template.php | Converts a screen string to a screen object. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| Used By | Description |
| --- | --- |
| [wp\_ajax\_search\_install\_plugins()](wp_ajax_search_install_plugins) wp-admin/includes/ajax-actions.php | Ajax handler for searching plugins to install. |
| [wp\_ajax\_search\_plugins()](wp_ajax_search_plugins) wp-admin/includes/ajax-actions.php | Ajax handler for searching plugins. |
| [display\_theme()](display_theme) wp-admin/includes/theme-install.php | Prints a theme on the Install Themes pages. |
| [display\_themes()](display_themes) wp-admin/includes/theme-install.php | Displays theme content based on theme list. |
| [install\_theme\_information()](install_theme_information) wp-admin/includes/theme-install.php | Displays theme information in dialog box form. |
| [wp\_plugin\_update\_row()](wp_plugin_update_row) wp-admin/includes/update.php | Displays update information for a plugin. |
| [wp\_theme\_update\_row()](wp_theme_update_row) wp-admin/includes/update.php | Displays update information for a theme. |
| [wp\_dashboard\_recent\_comments()](wp_dashboard_recent_comments) wp-admin/includes/dashboard.php | Show Comments section. |
| [wp\_comment\_reply()](wp_comment_reply) wp-admin/includes/template.php | Outputs the in-line comment reply-to form in the Comments list table. |
| [wp\_ajax\_add\_user()](wp_ajax_add_user) wp-admin/includes/ajax-actions.php | Ajax handler for adding a user. |
| [wp\_ajax\_inline\_save()](wp_ajax_inline_save) wp-admin/includes/ajax-actions.php | Ajax handler for Quick Edit saving a post from a list table. |
| [wp\_ajax\_inline\_save\_tax()](wp_ajax_inline_save_tax) wp-admin/includes/ajax-actions.php | Ajax handler for quick edit saving for a term. |
| [wp\_ajax\_add\_tag()](wp_ajax_add_tag) wp-admin/includes/ajax-actions.php | Ajax handler to add a tag. |
| [wp\_ajax\_get\_comments()](wp_ajax_get_comments) wp-admin/includes/ajax-actions.php | Ajax handler for getting comments. |
| [wp\_ajax\_replyto\_comment()](wp_ajax_replyto_comment) wp-admin/includes/ajax-actions.php | Ajax handler for replying to a comment. |
| [wp\_ajax\_edit\_comment()](wp_ajax_edit_comment) wp-admin/includes/ajax-actions.php | Ajax handler for editing a comment. |
| [wp\_ajax\_fetch\_list()](wp_ajax_fetch_list) wp-admin/includes/ajax-actions.php | Ajax handler for fetching a list table. |
| [post\_comment\_meta\_box()](post_comment_meta_box) wp-admin/includes/meta-boxes.php | Displays comments for post. |
| Version | Description |
| --- | --- |
| [3.1.0](https://developer.wordpress.org/reference/since/3.1.0/) | Introduced. |
wordpress registered_meta_key_exists( string $object_type, string $meta_key, string $object_subtype = '' ): bool registered\_meta\_key\_exists( string $object\_type, string $meta\_key, string $object\_subtype = '' ): bool
============================================================================================================
Checks if a meta key is registered.
`$object_type` string Required Type of object metadata is for. Accepts `'post'`, `'comment'`, `'term'`, `'user'`, or any other object type with an associated meta table. `$meta_key` string Required Metadata key. `$object_subtype` string Optional The subtype of the object type. Default: `''`
bool True if the meta key is registered to the object type and, if provided, the object subtype. False if not.
File: `wp-includes/meta.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/meta.php/)
```
function registered_meta_key_exists( $object_type, $meta_key, $object_subtype = '' ) {
$meta_keys = get_registered_meta_keys( $object_type, $object_subtype );
return isset( $meta_keys[ $meta_key ] );
}
```
| Uses | Description |
| --- | --- |
| [get\_registered\_meta\_keys()](get_registered_meta_keys) wp-includes/meta.php | Retrieves a list of registered metadata args for an object type, keyed by their meta keys. |
| Used By | Description |
| --- | --- |
| [unregister\_meta\_key()](unregister_meta_key) wp-includes/meta.php | Unregisters a meta key from the list of registered keys. |
| [get\_registered\_metadata()](get_registered_metadata) wp-includes/meta.php | Retrieves registered metadata for a specified object. |
| Version | Description |
| --- | --- |
| [4.9.8](https://developer.wordpress.org/reference/since/4.9.8/) | The `$object_subtype` parameter was added. |
| [4.6.0](https://developer.wordpress.org/reference/since/4.6.0/) | Introduced. |
wordpress wp_robots_no_robots( array $robots ): array wp\_robots\_no\_robots( array $robots ): array
==============================================
Adds `noindex` to the robots meta tag.
This directive tells web robots not to index the page content.
Typical usage is as a [‘wp\_robots’](../hooks/wp_robots) callback:
```
add_filter( 'wp_robots', 'wp_robots_no_robots' );
```
`$robots` array Required Associative array of robots directives. array Filtered robots directives.
File: `wp-includes/robots-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/robots-template.php/)
```
function wp_robots_no_robots( array $robots ) {
$robots['noindex'] = true;
if ( get_option( 'blog_public' ) ) {
$robots['follow'] = true;
} else {
$robots['nofollow'] = true;
}
return $robots;
}
```
| Uses | Description |
| --- | --- |
| [get\_option()](get_option) wp-includes/option.php | Retrieves an option value based on an option name. |
| Used By | Description |
| --- | --- |
| [wp\_robots\_noindex()](wp_robots_noindex) wp-includes/robots-template.php | Adds `noindex` to the robots meta tag if required by the site configuration. |
| [wp\_robots\_noindex\_embeds()](wp_robots_noindex_embeds) wp-includes/robots-template.php | Adds `noindex` to the robots meta tag for embeds. |
| [wp\_robots\_noindex\_search()](wp_robots_noindex_search) wp-includes/robots-template.php | Adds `noindex` to the robots meta tag if a search is being performed. |
| Version | Description |
| --- | --- |
| [5.7.0](https://developer.wordpress.org/reference/since/5.7.0/) | Introduced. |
wordpress wp_list_comments( string|array $args = array(), WP_Comment[] $comments = null ): void|string wp\_list\_comments( string|array $args = array(), WP\_Comment[] $comments = null ): void|string
===============================================================================================
Displays a list of comments.
Used in the comments.php template to list comments for a particular post.
* WP\_Query::$comments
`$args` string|array Optional Formatting options.
* `walker`objectInstance of a [Walker](../classes/walker) class to list comments. Default null.
* `max_depth`intThe maximum comments depth.
* `style`stringThe style of list ordering. Accepts `'ul'`, `'ol'`, or `'div'`.
`'div'` will result in no additional list markup. Default `'ul'`.
* `callback`callableCallback function to use. Default null.
* `end-callback`callableCallback function to use at the end. Default null.
* `type`stringType of comments to list. Accepts `'all'`, `'comment'`, `'pingback'`, `'trackback'`, `'pings'`. Default `'all'`.
* `page`intPage ID to list comments for.
* `per_page`intNumber of comments to list per page.
* `avatar_size`intHeight and width dimensions of the avatar size. Default 32.
* `reverse_top_level`boolOrdering of the listed comments. If true, will display newest comments first. Default null.
* `reverse_children`boolWhether to reverse child comments in the list. Default null.
* `format`stringHow to format the comments list. Accepts `'html5'`, `'xhtml'`.
Default `'html5'` if the theme supports it.
* `short_ping`boolWhether to output short pings. Default false.
* `echo`boolWhether to echo the output or return it. Default true.
Default: `array()`
`$comments` [WP\_Comment](../classes/wp_comment)[] Optional Array of [WP\_Comment](../classes/wp_comment) objects. Default: `null`
void|string Void if `'echo'` argument is true, or no comments to list.
Otherwise, HTML list of comments.
Default options for $args
```
$args = array(
'walker' => null,
'max_depth' => '',
'style' => 'ul',
'callback' => null,
'end-callback' => null,
'type' => 'all',
'page' => '',
'per_page' => '',
'avatar_size' => 32,
'reverse_top_level' => null,
'reverse_children' => '',
'format' => 'html5', // or 'xhtml' if no 'HTML5' theme support
'short_ping' => false, // @since 3.6
'echo' => true // boolean, default is true
);
```
The ‘`max_depth`‘, ‘`per_page`‘, and ‘`reverse_top_level`‘ parameters can be more easily controlled through the [Discussion Settings](https://wordpress.org/support/article/settings-discussion-screen/) Administration Panel but a theme can override those settings.
File: `wp-includes/comment-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/comment-template.php/)
```
function wp_list_comments( $args = array(), $comments = null ) {
global $wp_query, $comment_alt, $comment_depth, $comment_thread_alt, $overridden_cpage, $in_comment_loop;
$in_comment_loop = true;
$comment_alt = 0;
$comment_thread_alt = 0;
$comment_depth = 1;
$defaults = array(
'walker' => null,
'max_depth' => '',
'style' => 'ul',
'callback' => null,
'end-callback' => null,
'type' => 'all',
'page' => '',
'per_page' => '',
'avatar_size' => 32,
'reverse_top_level' => null,
'reverse_children' => '',
'format' => current_theme_supports( 'html5', 'comment-list' ) ? 'html5' : 'xhtml',
'short_ping' => false,
'echo' => true,
);
$parsed_args = wp_parse_args( $args, $defaults );
/**
* Filters the arguments used in retrieving the comment list.
*
* @since 4.0.0
*
* @see wp_list_comments()
*
* @param array $parsed_args An array of arguments for displaying comments.
*/
$parsed_args = apply_filters( 'wp_list_comments_args', $parsed_args );
// Figure out what comments we'll be looping through ($_comments).
if ( null !== $comments ) {
$comments = (array) $comments;
if ( empty( $comments ) ) {
return;
}
if ( 'all' !== $parsed_args['type'] ) {
$comments_by_type = separate_comments( $comments );
if ( empty( $comments_by_type[ $parsed_args['type'] ] ) ) {
return;
}
$_comments = $comments_by_type[ $parsed_args['type'] ];
} else {
$_comments = $comments;
}
} else {
/*
* If 'page' or 'per_page' has been passed, and does not match what's in $wp_query,
* perform a separate comment query and allow Walker_Comment to paginate.
*/
if ( $parsed_args['page'] || $parsed_args['per_page'] ) {
$current_cpage = get_query_var( 'cpage' );
if ( ! $current_cpage ) {
$current_cpage = 'newest' === get_option( 'default_comments_page' ) ? 1 : $wp_query->max_num_comment_pages;
}
$current_per_page = get_query_var( 'comments_per_page' );
if ( $parsed_args['page'] != $current_cpage || $parsed_args['per_page'] != $current_per_page ) {
$comment_args = array(
'post_id' => get_the_ID(),
'orderby' => 'comment_date_gmt',
'order' => 'ASC',
'status' => 'approve',
);
if ( is_user_logged_in() ) {
$comment_args['include_unapproved'] = array( get_current_user_id() );
} else {
$unapproved_email = wp_get_unapproved_comment_author_email();
if ( $unapproved_email ) {
$comment_args['include_unapproved'] = array( $unapproved_email );
}
}
$comments = get_comments( $comment_args );
if ( 'all' !== $parsed_args['type'] ) {
$comments_by_type = separate_comments( $comments );
if ( empty( $comments_by_type[ $parsed_args['type'] ] ) ) {
return;
}
$_comments = $comments_by_type[ $parsed_args['type'] ];
} else {
$_comments = $comments;
}
}
// Otherwise, fall back on the comments from `$wp_query->comments`.
} else {
if ( empty( $wp_query->comments ) ) {
return;
}
if ( 'all' !== $parsed_args['type'] ) {
if ( empty( $wp_query->comments_by_type ) ) {
$wp_query->comments_by_type = separate_comments( $wp_query->comments );
}
if ( empty( $wp_query->comments_by_type[ $parsed_args['type'] ] ) ) {
return;
}
$_comments = $wp_query->comments_by_type[ $parsed_args['type'] ];
} else {
$_comments = $wp_query->comments;
}
if ( $wp_query->max_num_comment_pages ) {
$default_comments_page = get_option( 'default_comments_page' );
$cpage = get_query_var( 'cpage' );
if ( 'newest' === $default_comments_page ) {
$parsed_args['cpage'] = $cpage;
/*
* When first page shows oldest comments, post permalink is the same as
* the comment permalink.
*/
} elseif ( 1 == $cpage ) {
$parsed_args['cpage'] = '';
} else {
$parsed_args['cpage'] = $cpage;
}
$parsed_args['page'] = 0;
$parsed_args['per_page'] = 0;
}
}
}
if ( '' === $parsed_args['per_page'] && get_option( 'page_comments' ) ) {
$parsed_args['per_page'] = get_query_var( 'comments_per_page' );
}
if ( empty( $parsed_args['per_page'] ) ) {
$parsed_args['per_page'] = 0;
$parsed_args['page'] = 0;
}
if ( '' === $parsed_args['max_depth'] ) {
if ( get_option( 'thread_comments' ) ) {
$parsed_args['max_depth'] = get_option( 'thread_comments_depth' );
} else {
$parsed_args['max_depth'] = -1;
}
}
if ( '' === $parsed_args['page'] ) {
if ( empty( $overridden_cpage ) ) {
$parsed_args['page'] = get_query_var( 'cpage' );
} else {
$threaded = ( -1 != $parsed_args['max_depth'] );
$parsed_args['page'] = ( 'newest' === get_option( 'default_comments_page' ) ) ? get_comment_pages_count( $_comments, $parsed_args['per_page'], $threaded ) : 1;
set_query_var( 'cpage', $parsed_args['page'] );
}
}
// Validation check.
$parsed_args['page'] = (int) $parsed_args['page'];
if ( 0 == $parsed_args['page'] && 0 != $parsed_args['per_page'] ) {
$parsed_args['page'] = 1;
}
if ( null === $parsed_args['reverse_top_level'] ) {
$parsed_args['reverse_top_level'] = ( 'desc' === get_option( 'comment_order' ) );
}
wp_queue_comments_for_comment_meta_lazyload( $_comments );
if ( empty( $parsed_args['walker'] ) ) {
$walker = new Walker_Comment;
} else {
$walker = $parsed_args['walker'];
}
$output = $walker->paged_walk( $_comments, $parsed_args['max_depth'], $parsed_args['page'], $parsed_args['per_page'], $parsed_args );
$in_comment_loop = false;
if ( $parsed_args['echo'] ) {
echo $output;
} else {
return $output;
}
}
```
[apply\_filters( 'wp\_list\_comments\_args', array $parsed\_args )](../hooks/wp_list_comments_args)
Filters the arguments used in retrieving the comment list.
| Uses | Description |
| --- | --- |
| [wp\_get\_unapproved\_comment\_author\_email()](wp_get_unapproved_comment_author_email) wp-includes/comment.php | Gets unapproved comment author’s email. |
| [wp\_queue\_comments\_for\_comment\_meta\_lazyload()](wp_queue_comments_for_comment_meta_lazyload) wp-includes/comment.php | Queues comments for metadata lazy-loading. |
| [get\_query\_var()](get_query_var) wp-includes/query.php | Retrieves the value of a query variable in the [WP\_Query](../classes/wp_query) class. |
| [set\_query\_var()](set_query_var) wp-includes/query.php | Sets the value of a query variable in the [WP\_Query](../classes/wp_query) class. |
| [Walker::paged\_walk()](../classes/walker/paged_walk) wp-includes/class-wp-walker.php | Produces a page of nested elements. |
| [get\_the\_ID()](get_the_id) wp-includes/post-template.php | Retrieves the ID of the current item in the WordPress Loop. |
| [separate\_comments()](separate_comments) wp-includes/comment.php | Separates an array of comments into an array keyed by comment\_type. |
| [get\_comment\_pages\_count()](get_comment_pages_count) wp-includes/comment.php | Calculates the total number of comment pages. |
| [get\_comments()](get_comments) wp-includes/comment.php | Retrieves a list of comments. |
| [current\_theme\_supports()](current_theme_supports) wp-includes/theme.php | Checks a theme’s support for a given feature. |
| [is\_user\_logged\_in()](is_user_logged_in) wp-includes/pluggable.php | Determines whether the current visitor is a logged in user. |
| [wp\_parse\_args()](wp_parse_args) wp-includes/functions.php | Merges user defined arguments into defaults array. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| [get\_option()](get_option) wp-includes/option.php | Retrieves an option value based on an option name. |
| [get\_current\_user\_id()](get_current_user_id) wp-includes/user.php | Gets the current user’s ID. |
| Version | Description |
| --- | --- |
| [2.7.0](https://developer.wordpress.org/reference/since/2.7.0/) | Introduced. |
| programming_docs |
wordpress _wp_oembed_get_object(): WP_oEmbed \_wp\_oembed\_get\_object(): WP\_oEmbed
=======================================
This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.
Returns the initialized [WP\_oEmbed](../classes/wp_oembed) object.
[WP\_oEmbed](../classes/wp_oembed) object.
File: `wp-includes/embed.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/embed.php/)
```
function _wp_oembed_get_object() {
static $wp_oembed = null;
if ( is_null( $wp_oembed ) ) {
$wp_oembed = new WP_oEmbed();
}
return $wp_oembed;
}
```
| Uses | Description |
| --- | --- |
| [WP\_oEmbed::\_\_construct()](../classes/wp_oembed/__construct) wp-includes/class-wp-oembed.php | Constructor. |
| Used By | Description |
| --- | --- |
| [WP\_oEmbed\_Controller::get\_proxy\_item()](../classes/wp_oembed_controller/get_proxy_item) wp-includes/class-wp-oembed-controller.php | Callback for the proxy API endpoint. |
| [wp\_filter\_pre\_oembed\_result()](wp_filter_pre_oembed_result) wp-includes/embed.php | Filters the oEmbed result before any HTTP requests are made. |
| [wp\_filter\_oembed\_result()](wp_filter_oembed_result) wp-includes/embed.php | Filters the given oEmbed HTML. |
| [wp\_oembed\_get()](wp_oembed_get) wp-includes/embed.php | Attempts to fetch the embed HTML for a provided URL using oEmbed. |
| [wp\_oembed\_add\_provider()](wp_oembed_add_provider) wp-includes/embed.php | Adds a URL format and oEmbed provider URL pair. |
| [wp\_oembed\_remove\_provider()](wp_oembed_remove_provider) wp-includes/embed.php | Removes an oEmbed provider. |
| Version | Description |
| --- | --- |
| [2.9.0](https://developer.wordpress.org/reference/since/2.9.0/) | Introduced. |
wordpress prep_atom_text_construct( string $data ): array prep\_atom\_text\_construct( string $data ): array
==================================================
Determines the type of a string of data with the data formatted.
Tell whether the type is text, HTML, or XHTML, per RFC 4287 section 3.1.
In the case of WordPress, text is defined as containing no markup, XHTML is defined as "well formed", and HTML as tag soup (i.e., the rest).
Container div tags are added to XHTML values, per section 3.1.1.3.
`$data` string Required Input string. array array(type, value)
File: `wp-includes/feed.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/feed.php/)
```
function prep_atom_text_construct( $data ) {
if ( strpos( $data, '<' ) === false && strpos( $data, '&' ) === false ) {
return array( 'text', $data );
}
if ( ! function_exists( 'xml_parser_create' ) ) {
trigger_error( __( "PHP's XML extension is not available. Please contact your hosting provider to enable PHP's XML extension." ) );
return array( 'html', "<![CDATA[$data]]>" );
}
$parser = xml_parser_create();
xml_parse( $parser, '<div>' . $data . '</div>', true );
$code = xml_get_error_code( $parser );
xml_parser_free( $parser );
unset( $parser );
if ( ! $code ) {
if ( strpos( $data, '<' ) === false ) {
return array( 'text', $data );
} else {
$data = "<div xmlns='http://www.w3.org/1999/xhtml'>$data</div>";
return array( 'xhtml', $data );
}
}
if ( strpos( $data, ']]>' ) === false ) {
return array( 'html', "<![CDATA[$data]]>" );
} else {
return array( 'html', htmlspecialchars( $data ) );
}
}
```
| Uses | Description |
| --- | --- |
| [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. |
| Version | Description |
| --- | --- |
| [2.5.0](https://developer.wordpress.org/reference/since/2.5.0/) | Introduced. |
wordpress wp_get_default_extension_for_mime_type( string $mime_type ): string|false wp\_get\_default\_extension\_for\_mime\_type( string $mime\_type ): string|false
================================================================================
Returns first matched extension for the mime-type, as mapped from [wp\_get\_mime\_types()](wp_get_mime_types) .
`$mime_type` string Required string|false
File: `wp-includes/functions.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/functions.php/)
```
function wp_get_default_extension_for_mime_type( $mime_type ) {
$extensions = explode( '|', array_search( $mime_type, wp_get_mime_types(), true ) );
if ( empty( $extensions[0] ) ) {
return false;
}
return $extensions[0];
}
```
| Uses | Description |
| --- | --- |
| [wp\_get\_mime\_types()](wp_get_mime_types) wp-includes/functions.php | Retrieves the list of mime types and file extensions. |
| Used By | Description |
| --- | --- |
| [wp\_unique\_filename()](wp_unique_filename) wp-includes/functions.php | Gets a filename that is sanitized and unique for the given directory. |
| [WP\_Image\_Editor::get\_extension()](../classes/wp_image_editor/get_extension) wp-includes/class-wp-image-editor.php | Returns first matched extension from Mime-type, as mapped from [wp\_get\_mime\_types()](wp_get_mime_types) |
| Version | Description |
| --- | --- |
| [5.8.1](https://developer.wordpress.org/reference/since/5.8.1/) | Introduced. |
wordpress wp_sensitive_page_meta() wp\_sensitive\_page\_meta()
===========================
This function has been deprecated. Use [wp\_robots\_sensitive\_page()](wp_robots_sensitive_page) instead.
Display a `noindex,noarchive` meta tag and referrer `strict-origin-when-cross-origin` meta tag.
Outputs a `noindex,noarchive` meta tag that tells web robots not to index or cache the page content.
Outputs a referrer `strict-origin-when-cross-origin` meta tag that tells the browser not to send the full URL as a referrer to other sites when cross-origin assets are loaded.
Typical usage is as a [‘wp\_head’](../hooks/wp_head) callback:
```
add_action( 'wp_head', 'wp_sensitive_page_meta' );
```
* [wp\_robots\_sensitive\_page()](wp_robots_sensitive_page)
File: `wp-includes/deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/deprecated.php/)
```
function wp_sensitive_page_meta() {
_deprecated_function( __FUNCTION__, '5.7.0', 'wp_robots_sensitive_page()' );
?>
<meta name='robots' content='noindex,noarchive' />
<?php
wp_strict_cross_origin_referrer();
}
```
| Uses | Description |
| --- | --- |
| [wp\_strict\_cross\_origin\_referrer()](wp_strict_cross_origin_referrer) wp-includes/general-template.php | Displays a referrer `strict-origin-when-cross-origin` meta tag. |
| [\_deprecated\_function()](_deprecated_function) wp-includes/functions.php | Marks a function as deprecated and inform when it has been used. |
| Version | Description |
| --- | --- |
| [5.7.0](https://developer.wordpress.org/reference/since/5.7.0/) | Use [wp\_robots\_sensitive\_page()](wp_robots_sensitive_page) instead on `'wp_robots'` filter and [wp\_strict\_cross\_origin\_referrer()](wp_strict_cross_origin_referrer) on `'wp_head'` action. |
| [5.0.1](https://developer.wordpress.org/reference/since/5.0.1/) | Introduced. |
wordpress validate_theme_requirements( string $stylesheet ): true|WP_Error validate\_theme\_requirements( string $stylesheet ): true|WP\_Error
===================================================================
Validates the theme requirements for WordPress version and PHP version.
Uses the information from `Requires at least` and `Requires PHP` headers defined in the theme’s `style.css` file.
`$stylesheet` string Required Directory name for the theme. true|[WP\_Error](../classes/wp_error) True if requirements are met, [WP\_Error](../classes/wp_error) on failure.
File: `wp-includes/theme.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/theme.php/)
```
function validate_theme_requirements( $stylesheet ) {
$theme = wp_get_theme( $stylesheet );
$requirements = array(
'requires' => ! empty( $theme->get( 'RequiresWP' ) ) ? $theme->get( 'RequiresWP' ) : '',
'requires_php' => ! empty( $theme->get( 'RequiresPHP' ) ) ? $theme->get( 'RequiresPHP' ) : '',
);
$compatible_wp = is_wp_version_compatible( $requirements['requires'] );
$compatible_php = is_php_version_compatible( $requirements['requires_php'] );
if ( ! $compatible_wp && ! $compatible_php ) {
return new WP_Error(
'theme_wp_php_incompatible',
sprintf(
/* translators: %s: Theme name. */
_x( '<strong>Error:</strong> Current WordPress and PHP versions do not meet minimum requirements for %s.', 'theme' ),
$theme->display( 'Name' )
)
);
} elseif ( ! $compatible_php ) {
return new WP_Error(
'theme_php_incompatible',
sprintf(
/* translators: %s: Theme name. */
_x( '<strong>Error:</strong> Current PHP version does not meet minimum requirements for %s.', 'theme' ),
$theme->display( 'Name' )
)
);
} elseif ( ! $compatible_wp ) {
return new WP_Error(
'theme_wp_incompatible',
sprintf(
/* translators: %s: Theme name. */
_x( '<strong>Error:</strong> Current WordPress version does not meet minimum requirements for %s.', 'theme' ),
$theme->display( 'Name' )
)
);
}
return true;
}
```
| Uses | Description |
| --- | --- |
| [is\_wp\_version\_compatible()](is_wp_version_compatible) wp-includes/functions.php | Checks compatibility with the current WordPress version. |
| [is\_php\_version\_compatible()](is_php_version_compatible) wp-includes/functions.php | Checks compatibility with the current PHP version. |
| [wp\_get\_theme()](wp_get_theme) wp-includes/theme.php | Gets a [WP\_Theme](../classes/wp_theme) object for a theme. |
| [\_x()](_x) wp-includes/l10n.php | Retrieves translated string with gettext context. |
| [WP\_Error::\_\_construct()](../classes/wp_error/__construct) wp-includes/class-wp-error.php | Initializes the error. |
| Used By | Description |
| --- | --- |
| [switch\_theme()](switch_theme) wp-includes/theme.php | Switches the theme. |
| Version | Description |
| --- | --- |
| [5.8.0](https://developer.wordpress.org/reference/since/5.8.0/) | Removed support for using `readme.txt` as a fallback. |
| [5.5.0](https://developer.wordpress.org/reference/since/5.5.0/) | Introduced. |
wordpress get_the_modified_time( string $format = '', int|WP_Post $post = null ): string|int|false get\_the\_modified\_time( string $format = '', int|WP\_Post $post = null ): string|int|false
============================================================================================
Retrieves the time at which the post was last modified.
`$format` string Optional Format to use for retrieving the time the post was modified. Accepts `'G'`, `'U'`, or PHP date format.
Defaults to the `'time_format'` option. Default: `''`
`$post` int|[WP\_Post](../classes/wp_post) Optional Post ID or [WP\_Post](../classes/wp_post) object. Default current post. Default: `null`
string|int|false Formatted date string or Unix timestamp. False on failure.
See [Formatting Date and Time](https://wordpress.org/support/article/formatting-date-and-time/) for other time and date formats.
File: `wp-includes/general-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/general-template.php/)
```
function get_the_modified_time( $format = '', $post = null ) {
$post = get_post( $post );
if ( ! $post ) {
// For backward compatibility, failures go through the filter below.
$the_time = false;
} else {
$_format = ! empty( $format ) ? $format : get_option( 'time_format' );
$the_time = get_post_modified_time( $_format, false, $post, true );
}
/**
* Filters the localized time a post was last modified.
*
* @since 2.0.0
* @since 4.6.0 Added the `$post` parameter.
*
* @param string|int|false $the_time The formatted time or false if no post is found.
* @param string $format Format to use for retrieving the time the post
* was modified. Accepts 'G', 'U', or PHP date format.
* @param WP_Post|null $post WP_Post object or null if no post is found.
*/
return apply_filters( 'get_the_modified_time', $the_time, $format, $post );
}
```
[apply\_filters( 'get\_the\_modified\_time', string|int|false $the\_time, string $format, WP\_Post|null $post )](../hooks/get_the_modified_time)
Filters the localized time a post was last modified.
| Uses | Description |
| --- | --- |
| [get\_post\_modified\_time()](get_post_modified_time) wp-includes/general-template.php | Retrieves the time at which the post was last modified. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| [get\_option()](get_option) wp-includes/option.php | Retrieves an option value based on an option name. |
| [get\_post()](get_post) wp-includes/post.php | Retrieves post data given a post ID or post object. |
| Used By | Description |
| --- | --- |
| [the\_modified\_time()](the_modified_time) wp-includes/general-template.php | Displays the time at which the post was last modified. |
| Version | Description |
| --- | --- |
| [4.6.0](https://developer.wordpress.org/reference/since/4.6.0/) | Added the `$post` parameter. |
| [2.0.0](https://developer.wordpress.org/reference/since/2.0.0/) | Introduced. |
wordpress wp_reset_query() wp\_reset\_query()
==================
Destroys the previous query and sets up a new query.
This should be used after [query\_posts()](query_posts) and before another [query\_posts()](query_posts) .
This will remove obscure bugs that occur when the previous [WP\_Query](../classes/wp_query) object is not destroyed properly before another is set up.
`query_posts()` will change your main query and is **not recommended**. Only use if absolutely necessary. Creating a new instance of `WP_Query` or `get_posts()` is preferred for secondary loops. If you would like to modify the main query, use the [`pre_get_posts`](../hooks/pre_get_posts) action.
File: `wp-includes/query.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/query.php/)
```
function wp_reset_query() {
$GLOBALS['wp_query'] = $GLOBALS['wp_the_query'];
wp_reset_postdata();
}
```
| Uses | Description |
| --- | --- |
| [wp\_reset\_postdata()](wp_reset_postdata) wp-includes/query.php | After looping through a separate query, this function restores the $post global to the current post in the main query. |
| Version | Description |
| --- | --- |
| [2.3.0](https://developer.wordpress.org/reference/since/2.3.0/) | Introduced. |
wordpress allow_subdirectory_install(): bool allow\_subdirectory\_install(): bool
====================================
Allow subdirectory installation.
bool Whether subdirectory installation is allowed
File: `wp-admin/includes/network.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/network.php/)
```
function allow_subdirectory_install() {
global $wpdb;
/**
* Filters whether to enable the subdirectory installation feature in Multisite.
*
* @since 3.0.0
*
* @param bool $allow Whether to enable the subdirectory installation feature in Multisite.
* Default false.
*/
if ( apply_filters( 'allow_subdirectory_install', false ) ) {
return true;
}
if ( defined( 'ALLOW_SUBDIRECTORY_INSTALL' ) && ALLOW_SUBDIRECTORY_INSTALL ) {
return true;
}
$post = $wpdb->get_row( "SELECT ID FROM $wpdb->posts WHERE post_date < DATE_SUB(NOW(), INTERVAL 1 MONTH) AND post_status = 'publish'" );
if ( empty( $post ) ) {
return true;
}
return false;
}
```
[apply\_filters( 'allow\_subdirectory\_install', bool $allow )](../hooks/allow_subdirectory_install)
Filters whether to enable the subdirectory installation feature in Multisite.
| Uses | Description |
| --- | --- |
| [wpdb::get\_row()](../classes/wpdb/get_row) wp-includes/class-wpdb.php | Retrieves one row from the database. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| Used By | Description |
| --- | --- |
| [network\_step1()](network_step1) wp-admin/includes/network.php | Prints step 1 for Network installation process. |
| [network\_step2()](network_step2) wp-admin/includes/network.php | Prints step 2 for Network installation process. |
| Version | Description |
| --- | --- |
| [3.0.0](https://developer.wordpress.org/reference/since/3.0.0/) | Introduced. |
wordpress get_ancestors( int $object_id, string $object_type = '', string $resource_type = '' ): int[] get\_ancestors( int $object\_id, string $object\_type = '', string $resource\_type = '' ): int[]
================================================================================================
Gets an array of ancestor IDs for a given object.
`$object_id` int Optional The ID of the object. Default 0. `$object_type` string Optional The type of object for which we'll be retrieving ancestors. Accepts a post type or a taxonomy name. Default: `''`
`$resource_type` string Optional Type of resource $object\_type is. Accepts `'post_type'` or `'taxonomy'`. Default: `''`
int[] An array of IDs of ancestors from lowest to highest in the hierarchy.
File: `wp-includes/taxonomy.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/taxonomy.php/)
```
function get_ancestors( $object_id = 0, $object_type = '', $resource_type = '' ) {
$object_id = (int) $object_id;
$ancestors = array();
if ( empty( $object_id ) ) {
/** This filter is documented in wp-includes/taxonomy.php */
return apply_filters( 'get_ancestors', $ancestors, $object_id, $object_type, $resource_type );
}
if ( ! $resource_type ) {
if ( is_taxonomy_hierarchical( $object_type ) ) {
$resource_type = 'taxonomy';
} elseif ( post_type_exists( $object_type ) ) {
$resource_type = 'post_type';
}
}
if ( 'taxonomy' === $resource_type ) {
$term = get_term( $object_id, $object_type );
while ( ! is_wp_error( $term ) && ! empty( $term->parent ) && ! in_array( $term->parent, $ancestors, true ) ) {
$ancestors[] = (int) $term->parent;
$term = get_term( $term->parent, $object_type );
}
} elseif ( 'post_type' === $resource_type ) {
$ancestors = get_post_ancestors( $object_id );
}
/**
* Filters a given object's ancestors.
*
* @since 3.1.0
* @since 4.1.1 Introduced the `$resource_type` parameter.
*
* @param int[] $ancestors An array of IDs of object ancestors.
* @param int $object_id Object ID.
* @param string $object_type Type of object.
* @param string $resource_type Type of resource $object_type is.
*/
return apply_filters( 'get_ancestors', $ancestors, $object_id, $object_type, $resource_type );
}
```
[apply\_filters( 'get\_ancestors', int[] $ancestors, int $object\_id, string $object\_type, string $resource\_type )](../hooks/get_ancestors)
Filters a given object’s ancestors.
| Uses | Description |
| --- | --- |
| [is\_taxonomy\_hierarchical()](is_taxonomy_hierarchical) wp-includes/taxonomy.php | Determines whether the taxonomy object is hierarchical. |
| [post\_type\_exists()](post_type_exists) wp-includes/post.php | Determines whether a post type is registered. |
| [get\_post\_ancestors()](get_post_ancestors) wp-includes/post.php | Retrieves the IDs of the ancestors of a post. |
| [get\_term()](get_term) wp-includes/taxonomy.php | Gets all term data from database by term ID. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| [is\_wp\_error()](is_wp_error) wp-includes/load.php | Checks whether the given variable is a WordPress Error. |
| Used By | Description |
| --- | --- |
| [get\_term\_parents\_list()](get_term_parents_list) wp-includes/category-template.php | Retrieves term parents with separator. |
| [wp\_ajax\_add\_tag()](wp_ajax_add_tag) wp-admin/includes/ajax-actions.php | Ajax handler to add a tag. |
| [WP\_Terms\_List\_Table::single\_row()](../classes/wp_terms_list_table/single_row) wp-admin/includes/class-wp-terms-list-table.php | |
| [get\_term\_link()](get_term_link) wp-includes/taxonomy.php | Generates a permalink for a taxonomy term archive. |
| Version | Description |
| --- | --- |
| [4.1.0](https://developer.wordpress.org/reference/since/4.1.0/) | Introduced the `$resource_type` argument. |
| [3.1.0](https://developer.wordpress.org/reference/since/3.1.0/) | Introduced. |
| programming_docs |
wordpress make_site_theme(): string|false make\_site\_theme(): string|false
=================================
Creates a site theme.
string|false
File: `wp-admin/includes/upgrade.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/upgrade.php/)
```
function make_site_theme() {
// Name the theme after the blog.
$theme_name = __get_option( 'blogname' );
$template = sanitize_title( $theme_name );
$site_dir = WP_CONTENT_DIR . "/themes/$template";
// If the theme already exists, nothing to do.
if ( is_dir( $site_dir ) ) {
return false;
}
// We must be able to write to the themes dir.
if ( ! is_writable( WP_CONTENT_DIR . '/themes' ) ) {
return false;
}
umask( 0 );
if ( ! mkdir( $site_dir, 0777 ) ) {
return false;
}
if ( file_exists( ABSPATH . 'wp-layout.css' ) ) {
if ( ! make_site_theme_from_oldschool( $theme_name, $template ) ) {
// TODO: rm -rf the site theme directory.
return false;
}
} else {
if ( ! make_site_theme_from_default( $theme_name, $template ) ) {
// TODO: rm -rf the site theme directory.
return false;
}
}
// Make the new site theme active.
$current_template = __get_option( 'template' );
if ( WP_DEFAULT_THEME == $current_template ) {
update_option( 'template', $template );
update_option( 'stylesheet', $template );
}
return $template;
}
```
| Uses | Description |
| --- | --- |
| [make\_site\_theme\_from\_oldschool()](make_site_theme_from_oldschool) wp-admin/includes/upgrade.php | Creates a site theme from an existing theme. |
| [make\_site\_theme\_from\_default()](make_site_theme_from_default) wp-admin/includes/upgrade.php | Creates a site theme from the default theme. |
| [sanitize\_title()](sanitize_title) wp-includes/formatting.php | Sanitizes a string into a slug, which can be used in URLs or HTML attributes. |
| [update\_option()](update_option) wp-includes/option.php | Updates the value of an option that was already added. |
| Version | Description |
| --- | --- |
| [1.5.0](https://developer.wordpress.org/reference/since/1.5.0/) | Introduced. |
wordpress has_term( string|int|array $term = '', string $taxonomy = '', int|WP_Post $post = null ): bool has\_term( string|int|array $term = '', string $taxonomy = '', int|WP\_Post $post = null ): bool
================================================================================================
Checks if the current post has any of given terms.
The given terms are checked against the post’s terms’ term\_ids, names and slugs.
Terms given as integers will only be checked against the post’s terms’ term\_ids.
If no terms are given, determines if post has any terms.
`$term` string|int|array Optional The term name/term\_id/slug, or an array of them to check for. Default: `''`
`$taxonomy` string Optional Taxonomy name. Default: `''`
`$post` int|[WP\_Post](../classes/wp_post) Optional Post to check. Defaults to the current post. Default: `null`
bool True if the current post has any of the given terms (or any term, if no term specified). False otherwise.
File: `wp-includes/category-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/category-template.php/)
```
function has_term( $term = '', $taxonomy = '', $post = null ) {
$post = get_post( $post );
if ( ! $post ) {
return false;
}
$r = is_object_in_term( $post->ID, $taxonomy, $term );
if ( is_wp_error( $r ) ) {
return false;
}
return $r;
}
```
| Uses | Description |
| --- | --- |
| [is\_object\_in\_term()](is_object_in_term) wp-includes/taxonomy.php | Determines if the given object is associated with any of the given terms. |
| [get\_post()](get_post) wp-includes/post.php | Retrieves post data given a post ID or post object. |
| [is\_wp\_error()](is_wp_error) wp-includes/load.php | Checks whether the given variable is a WordPress Error. |
| Used By | Description |
| --- | --- |
| [has\_category()](has_category) wp-includes/category-template.php | Checks if the current post has any of given category. |
| [has\_tag()](has_tag) wp-includes/category-template.php | Checks if the current post has any of given tags. |
| [redirect\_canonical()](redirect_canonical) wp-includes/canonical.php | Redirects incoming links to the proper URL based on the site url. |
| [has\_post\_format()](has_post_format) wp-includes/post-formats.php | Check if a post has any of the given formats, or any format. |
| Version | Description |
| --- | --- |
| [3.1.0](https://developer.wordpress.org/reference/since/3.1.0/) | Introduced. |
wordpress wp_validate_application_password( int|false $input_user ): int|false wp\_validate\_application\_password( int|false $input\_user ): int|false
========================================================================
Validates the application password credentials passed via Basic Authentication.
`$input_user` int|false Required User ID if one has been determined, false otherwise. int|false The authenticated user ID if successful, false otherwise.
File: `wp-includes/user.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/user.php/)
```
function wp_validate_application_password( $input_user ) {
// Don't authenticate twice.
if ( ! empty( $input_user ) ) {
return $input_user;
}
if ( ! wp_is_application_passwords_available() ) {
return $input_user;
}
// Both $_SERVER['PHP_AUTH_USER'] and $_SERVER['PHP_AUTH_PW'] must be set in order to attempt authentication.
if ( ! isset( $_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW'] ) ) {
return $input_user;
}
$authenticated = wp_authenticate_application_password( null, $_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW'] );
if ( $authenticated instanceof WP_User ) {
return $authenticated->ID;
}
// If it wasn't a user what got returned, just pass on what we had received originally.
return $input_user;
}
```
| Uses | Description |
| --- | --- |
| [wp\_is\_application\_passwords\_available()](wp_is_application_passwords_available) wp-includes/user.php | Checks if Application Passwords is globally available. |
| [wp\_authenticate\_application\_password()](wp_authenticate_application_password) wp-includes/user.php | Authenticates the user using an application password. |
| Version | Description |
| --- | --- |
| [5.6.0](https://developer.wordpress.org/reference/since/5.6.0/) | Introduced. |
wordpress get_users_of_blog( int $id = '' ): array get\_users\_of\_blog( int $id = '' ): array
===========================================
This function has been deprecated. Use [get\_users()](get_users) instead.
Get users for the site.
For setups that use the multisite feature. Can be used outside of the multisite feature.
* [get\_users()](get_users)
`$id` int Optional Site ID. Default: `''`
array List of users that are part of that site ID
File: `wp-includes/deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/deprecated.php/)
```
function get_users_of_blog( $id = '' ) {
_deprecated_function( __FUNCTION__, '3.1.0', 'get_users()' );
global $wpdb;
if ( empty( $id ) ) {
$id = get_current_blog_id();
}
$blog_prefix = $wpdb->get_blog_prefix($id);
$users = $wpdb->get_results( "SELECT user_id, user_id AS ID, user_login, display_name, user_email, meta_value FROM $wpdb->users, $wpdb->usermeta WHERE {$wpdb->users}.ID = {$wpdb->usermeta}.user_id AND meta_key = '{$blog_prefix}capabilities' ORDER BY {$wpdb->usermeta}.user_id" );
return $users;
}
```
| Uses | Description |
| --- | --- |
| [wpdb::get\_blog\_prefix()](../classes/wpdb/get_blog_prefix) wp-includes/class-wpdb.php | Gets blog prefix. |
| [get\_current\_blog\_id()](get_current_blog_id) wp-includes/load.php | Retrieve the current site ID. |
| [\_deprecated\_function()](_deprecated_function) wp-includes/functions.php | Marks a function as deprecated and inform when it has been used. |
| [wpdb::get\_results()](../classes/wpdb/get_results) wp-includes/class-wpdb.php | Retrieves an entire SQL result set from the database (i.e., many rows). |
| Version | Description |
| --- | --- |
| [3.1.0](https://developer.wordpress.org/reference/since/3.1.0/) | Use [get\_users()](get_users) |
| [2.2.0](https://developer.wordpress.org/reference/since/2.2.0/) | Introduced. |
wordpress wp_ajax_delete_theme() wp\_ajax\_delete\_theme()
=========================
Ajax handler for deleting a theme.
* [delete\_theme()](delete_theme)
File: `wp-admin/includes/ajax-actions.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/ajax-actions.php/)
```
function wp_ajax_delete_theme() {
check_ajax_referer( 'updates' );
if ( empty( $_POST['slug'] ) ) {
wp_send_json_error(
array(
'slug' => '',
'errorCode' => 'no_theme_specified',
'errorMessage' => __( 'No theme specified.' ),
)
);
}
$stylesheet = preg_replace( '/[^A-z0-9_\-]/', '', wp_unslash( $_POST['slug'] ) );
$status = array(
'delete' => 'theme',
'slug' => $stylesheet,
);
if ( ! current_user_can( 'delete_themes' ) ) {
$status['errorMessage'] = __( 'Sorry, you are not allowed to delete themes on this site.' );
wp_send_json_error( $status );
}
if ( ! wp_get_theme( $stylesheet )->exists() ) {
$status['errorMessage'] = __( 'The requested theme does not exist.' );
wp_send_json_error( $status );
}
// Check filesystem credentials. `delete_theme()` will bail otherwise.
$url = wp_nonce_url( 'themes.php?action=delete&stylesheet=' . urlencode( $stylesheet ), 'delete-theme_' . $stylesheet );
ob_start();
$credentials = request_filesystem_credentials( $url );
ob_end_clean();
if ( false === $credentials || ! WP_Filesystem( $credentials ) ) {
global $wp_filesystem;
$status['errorCode'] = 'unable_to_connect_to_filesystem';
$status['errorMessage'] = __( 'Unable to connect to the filesystem. Please confirm your credentials.' );
// Pass through the error from WP_Filesystem if one was raised.
if ( $wp_filesystem instanceof WP_Filesystem_Base && is_wp_error( $wp_filesystem->errors ) && $wp_filesystem->errors->has_errors() ) {
$status['errorMessage'] = esc_html( $wp_filesystem->errors->get_error_message() );
}
wp_send_json_error( $status );
}
include_once ABSPATH . 'wp-admin/includes/theme.php';
$result = delete_theme( $stylesheet );
if ( is_wp_error( $result ) ) {
$status['errorMessage'] = $result->get_error_message();
wp_send_json_error( $status );
} elseif ( false === $result ) {
$status['errorMessage'] = __( 'Theme could not be deleted.' );
wp_send_json_error( $status );
}
wp_send_json_success( $status );
}
```
| Uses | Description |
| --- | --- |
| [delete\_theme()](delete_theme) wp-admin/includes/theme.php | Removes a theme. |
| [request\_filesystem\_credentials()](request_filesystem_credentials) wp-admin/includes/file.php | Displays a form to the user to request for their FTP/SSH details in order to connect to the filesystem. |
| [WP\_Filesystem()](wp_filesystem) wp-admin/includes/file.php | Initializes and connects the WordPress Filesystem Abstraction classes. |
| [current\_user\_can()](current_user_can) wp-includes/capabilities.php | Returns whether the current user has the specified capability. |
| [wp\_get\_theme()](wp_get_theme) wp-includes/theme.php | Gets a [WP\_Theme](../classes/wp_theme) object for a theme. |
| [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. |
| [wp\_unslash()](wp_unslash) wp-includes/formatting.php | Removes slashes from a string or recursively removes slashes from strings within an array. |
| [esc\_html()](esc_html) wp-includes/formatting.php | Escaping for HTML blocks. |
| [check\_ajax\_referer()](check_ajax_referer) wp-includes/pluggable.php | Verifies the Ajax request to prevent processing requests external of the blog. |
| [wp\_send\_json\_error()](wp_send_json_error) wp-includes/functions.php | Sends a JSON response back to an Ajax request, indicating failure. |
| [wp\_send\_json\_success()](wp_send_json_success) wp-includes/functions.php | Sends a JSON response back to an Ajax request, indicating success. |
| [wp\_nonce\_url()](wp_nonce_url) wp-includes/functions.php | Retrieves URL with nonce added to URL query. |
| [is\_wp\_error()](is_wp_error) wp-includes/load.php | Checks whether the given variable is a WordPress Error. |
| Version | Description |
| --- | --- |
| [4.6.0](https://developer.wordpress.org/reference/since/4.6.0/) | Introduced. |
wordpress add_editor_style( array|string $stylesheet = 'editor-style.css' ) add\_editor\_style( array|string $stylesheet = 'editor-style.css' )
===================================================================
Adds callback for custom TinyMCE editor stylesheets.
The parameter $stylesheet is the name of the stylesheet, relative to the theme root. It also accepts an array of stylesheets.
It is optional and defaults to ‘editor-style.css’.
This function automatically adds another stylesheet with -rtl prefix, e.g. editor-style-rtl.css.
If that file doesn’t exist, it is removed before adding the stylesheet(s) to TinyMCE.
If an array of stylesheets is passed to [add\_editor\_style()](add_editor_style) , RTL is only added for the first stylesheet.
Since version 3.4 the TinyMCE body has .rtl CSS class.
It is a better option to use that class and add any RTL styles to the main stylesheet.
`$stylesheet` array|string Optional Stylesheet name or array thereof, relative to theme root.
Defaults to `'editor-style.css'` Default: `'editor-style.css'`
Allows theme developers to link a custom stylesheet file to the TinyMCE visual editor. The function tests for the existence of the relative path(s) given as the $stylesheet argument against the current theme directory and links the file(s) on success. If no $stylesheet argument is specified, the function will test for the existence of the default editor stylesheet file, editor-style.css, against the current theme directory, and link that file on success.
If a child theme is used, both the current child and parent theme directories are tested and both the files with the same relative path are linked with this single call if they are found.
To link a stylesheet file from a location other than the current theme directory, such as under your plugin directory, use a filter attached to the [mce\_css](../hooks/mce_css "Plugin API/Filter Reference/mce css") hook instead.
File: `wp-includes/theme.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/theme.php/)
```
function add_editor_style( $stylesheet = 'editor-style.css' ) {
global $editor_styles;
add_theme_support( 'editor-style' );
$editor_styles = (array) $editor_styles;
$stylesheet = (array) $stylesheet;
if ( is_rtl() ) {
$rtl_stylesheet = str_replace( '.css', '-rtl.css', $stylesheet[0] );
$stylesheet[] = $rtl_stylesheet;
}
$editor_styles = array_merge( $editor_styles, $stylesheet );
}
```
| Uses | Description |
| --- | --- |
| [add\_theme\_support()](add_theme_support) wp-includes/theme.php | Registers theme support for a given feature. |
| [is\_rtl()](is_rtl) wp-includes/l10n.php | Determines whether the current locale is right-to-left (RTL). |
| Version | Description |
| --- | --- |
| [3.0.0](https://developer.wordpress.org/reference/since/3.0.0/) | Introduced. |
wordpress wp_add_privacy_policy_content( string $plugin_name, string $policy_text ) wp\_add\_privacy\_policy\_content( string $plugin\_name, string $policy\_text )
===============================================================================
Declares a helper function for adding content to the Privacy Policy Guide.
Plugins and themes should suggest text for inclusion in the site’s privacy policy.
The suggested text should contain information about any functionality that affects user privacy, and will be shown on the Privacy Policy Guide screen.
A plugin or theme can use this function multiple times as long as it will help to better present the suggested policy content. For example modular plugins such as WooCommerse or Jetpack can add or remove suggested content depending on the modules/extensions that are enabled.
For more information see the Plugin Handbook: <https://developer.wordpress.org/plugins/privacy/suggesting-text-for-the-site-privacy-policy/>.
The HTML contents of the `$policy_text` supports use of a specialized `.privacy-policy-tutorial` CSS class which can be used to provide supplemental information. Any content contained within HTML elements that have the `.privacy-policy-tutorial` CSS class applied will be omitted from the clipboard when the section content is copied.
Intended for use with the `'admin_init'` action.
`$plugin_name` string Required The name of the plugin or theme that is suggesting content for the site's privacy policy. `$policy_text` string Required The suggested content for inclusion in the policy. File: `wp-admin/includes/plugin.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/plugin.php/)
```
function wp_add_privacy_policy_content( $plugin_name, $policy_text ) {
if ( ! is_admin() ) {
_doing_it_wrong(
__FUNCTION__,
sprintf(
/* translators: %s: admin_init */
__( 'The suggested privacy policy content should be added only in wp-admin by using the %s (or later) action.' ),
'<code>admin_init</code>'
),
'4.9.7'
);
return;
} elseif ( ! doing_action( 'admin_init' ) && ! did_action( 'admin_init' ) ) {
_doing_it_wrong(
__FUNCTION__,
sprintf(
/* translators: %s: admin_init */
__( 'The suggested privacy policy content should be added by using the %s (or later) action. Please see the inline documentation.' ),
'<code>admin_init</code>'
),
'4.9.7'
);
return;
}
if ( ! class_exists( 'WP_Privacy_Policy_Content' ) ) {
require_once ABSPATH . 'wp-admin/includes/class-wp-privacy-policy-content.php';
}
WP_Privacy_Policy_Content::add( $plugin_name, $policy_text );
}
```
| Uses | Description |
| --- | --- |
| [WP\_Privacy\_Policy\_Content::add()](../classes/wp_privacy_policy_content/add) wp-admin/includes/class-wp-privacy-policy-content.php | Add content to the postbox shown when editing the privacy policy. |
| [doing\_action()](doing_action) wp-includes/plugin.php | Returns whether or not an action hook is currently being processed. |
| [did\_action()](did_action) wp-includes/plugin.php | Retrieves the number of times an action has been fired during the current request. |
| [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. |
| [is\_admin()](is_admin) wp-includes/load.php | Determines whether the current request is for an administrative interface page. |
| [\_doing\_it\_wrong()](_doing_it_wrong) wp-includes/functions.php | Marks something as being incorrectly called. |
| Used By | Description |
| --- | --- |
| [WP\_Privacy\_Policy\_Content::add\_suggested\_content()](../classes/wp_privacy_policy_content/add_suggested_content) wp-admin/includes/class-wp-privacy-policy-content.php | Add the suggested privacy policy text to the policy postbox. |
| Version | Description |
| --- | --- |
| [4.9.6](https://developer.wordpress.org/reference/since/4.9.6/) | Introduced. |
wordpress _excerpt_render_inner_columns_blocks( array $columns, array $allowed_blocks ): string \_excerpt\_render\_inner\_columns\_blocks( array $columns, array $allowed\_blocks ): string
===========================================================================================
This function has been deprecated. Use [\_excerpt\_render\_inner\_blocks()](_excerpt_render_inner_blocks) instead.
This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness. Use [\_excerpt\_render\_inner\_blocks()](_excerpt_render_inner_blocks) instead.
Render inner blocks from the `core/columns` block for generating an excerpt.
* [\_excerpt\_render\_inner\_blocks()](_excerpt_render_inner_blocks)
`$columns` array Required The parsed columns block. `$allowed_blocks` array Required The list of allowed inner blocks. string The rendered inner blocks.
File: `wp-includes/deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/deprecated.php/)
```
function _excerpt_render_inner_columns_blocks( $columns, $allowed_blocks ) {
_deprecated_function( __FUNCTION__, '5.8.0', '_excerpt_render_inner_blocks()' );
return _excerpt_render_inner_blocks( $columns, $allowed_blocks );
}
```
| Uses | Description |
| --- | --- |
| [\_excerpt\_render\_inner\_blocks()](_excerpt_render_inner_blocks) wp-includes/blocks.php | Renders inner blocks from the allowed wrapper blocks for generating an excerpt. |
| [\_deprecated\_function()](_deprecated_function) wp-includes/functions.php | Marks a function as deprecated and inform when it has been used. |
| Version | Description |
| --- | --- |
| [5.8.0](https://developer.wordpress.org/reference/since/5.8.0/) | Use [\_excerpt\_render\_inner\_blocks()](_excerpt_render_inner_blocks) introduced in 5.8.0. |
| [5.2.0](https://developer.wordpress.org/reference/since/5.2.0/) | Introduced. |
| programming_docs |
wordpress default_topic_count_scale( int $count ): int default\_topic\_count\_scale( int $count ): int
===============================================
Default topic count scaling for tag links.
`$count` int Required Number of posts with that tag. int Scaled count.
File: `wp-includes/category-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/category-template.php/)
```
function default_topic_count_scale( $count ) {
return round( log10( $count + 1 ) * 100 );
}
```
| Version | Description |
| --- | --- |
| [2.9.0](https://developer.wordpress.org/reference/since/2.9.0/) | Introduced. |
wordpress link_submit_meta_box( object $link ) link\_submit\_meta\_box( object $link )
=======================================
Displays link create form fields.
`$link` object Required Current link object. File: `wp-admin/includes/meta-boxes.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/meta-boxes.php/)
```
function link_submit_meta_box( $link ) {
?>
<div class="submitbox" id="submitlink">
<div id="minor-publishing">
<?php // Hidden submit button early on so that the browser chooses the right button when form is submitted with Return key. ?>
<div style="display:none;">
<?php submit_button( __( 'Save' ), '', 'save', false ); ?>
</div>
<div id="minor-publishing-actions">
<div id="preview-action">
<?php if ( ! empty( $link->link_id ) ) { ?>
<a class="preview button" href="<?php echo $link->link_url; ?>" target="_blank"><?php _e( 'Visit Link' ); ?></a>
<?php } ?>
</div>
<div class="clear"></div>
</div>
<div id="misc-publishing-actions">
<div class="misc-pub-section misc-pub-private">
<label for="link_private" class="selectit"><input id="link_private" name="link_visible" type="checkbox" value="N" <?php checked( $link->link_visible, 'N' ); ?> /> <?php _e( 'Keep this link private' ); ?></label>
</div>
</div>
</div>
<div id="major-publishing-actions">
<?php
/** This action is documented in wp-admin/includes/meta-boxes.php */
do_action( 'post_submitbox_start', null );
?>
<div id="delete-action">
<?php
if ( ! empty( $_GET['action'] ) && 'edit' === $_GET['action'] && current_user_can( 'manage_links' ) ) {
printf(
'<a class="submitdelete deletion" href="%s" onclick="return confirm( \'%s\' );">%s</a>',
wp_nonce_url( "link.php?action=delete&link_id=$link->link_id", 'delete-bookmark_' . $link->link_id ),
/* translators: %s: Link name. */
esc_js( sprintf( __( "You are about to delete this link '%s'\n 'Cancel' to stop, 'OK' to delete." ), $link->link_name ) ),
__( 'Delete' )
);
}
?>
</div>
<div id="publishing-action">
<?php if ( ! empty( $link->link_id ) ) { ?>
<input name="save" type="submit" class="button button-primary button-large" id="publish" value="<?php esc_attr_e( 'Update Link' ); ?>" />
<?php } else { ?>
<input name="save" type="submit" class="button button-primary button-large" id="publish" value="<?php esc_attr_e( 'Add Link' ); ?>" />
<?php } ?>
</div>
<div class="clear"></div>
</div>
<?php
/**
* Fires at the end of the Publish box in the Link editing screen.
*
* @since 2.5.0
*/
do_action( 'submitlink_box' );
?>
<div class="clear"></div>
</div>
<?php
}
```
[do\_action( 'post\_submitbox\_start', WP\_Post|null $post )](../hooks/post_submitbox_start)
Fires at the beginning of the publishing actions section of the Publish meta box.
[do\_action( 'submitlink\_box' )](../hooks/submitlink_box)
Fires at the end of the Publish box in the Link editing screen.
| Uses | Description |
| --- | --- |
| [submit\_button()](submit_button) wp-admin/includes/template.php | Echoes a submit button, with provided text and appropriate class(es). |
| [esc\_attr\_e()](esc_attr_e) wp-includes/l10n.php | Displays translated text that has been escaped for safe use in an attribute. |
| [esc\_js()](esc_js) wp-includes/formatting.php | Escapes single quotes, `"`, , `&`, and fixes line endings. |
| [checked()](checked) wp-includes/general-template.php | Outputs the HTML checked attribute. |
| [current\_user\_can()](current_user_can) wp-includes/capabilities.php | Returns whether the current user has the specified capability. |
| [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. |
| [\_e()](_e) wp-includes/l10n.php | Displays translated text. |
| [wp\_nonce\_url()](wp_nonce_url) wp-includes/functions.php | Retrieves URL with nonce added to URL query. |
| [do\_action()](do_action) wp-includes/plugin.php | Calls the callback functions that have been added to an action hook. |
| Version | Description |
| --- | --- |
| [2.7.0](https://developer.wordpress.org/reference/since/2.7.0/) | Introduced. |
wordpress wp_add_dashboard_widget( string $widget_id, string $widget_name, callable $callback, callable $control_callback = null, array $callback_args = null, string $context = 'normal', string $priority = 'core' ) wp\_add\_dashboard\_widget( string $widget\_id, string $widget\_name, callable $callback, callable $control\_callback = null, array $callback\_args = null, string $context = 'normal', string $priority = 'core' )
===================================================================================================================================================================================================================
Adds a new dashboard widget.
`$widget_id` string Required Widget ID (used in the `'id'` attribute for the widget). `$widget_name` string Required Title of the widget. `$callback` callable Required Function that fills the widget with the desired content.
The function should echo its output. `$control_callback` callable Optional Function that outputs controls for the widget. Default: `null`
`$callback_args` array Optional Data that should be set as the $args property of the widget array (which is the second parameter passed to your callback). Default: `null`
`$context` string Optional The context within the screen where the box should display.
Accepts `'normal'`, `'side'`, `'column3'`, or `'column4'`. Default `'normal'`. Default: `'normal'`
`$priority` string Optional The priority within the context where the box should show.
Accepts `'high'`, `'core'`, `'default'`, or `'low'`. Default `'core'`. Default: `'core'`
File: `wp-admin/includes/dashboard.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/dashboard.php/)
```
function wp_add_dashboard_widget( $widget_id, $widget_name, $callback, $control_callback = null, $callback_args = null, $context = 'normal', $priority = 'core' ) {
global $wp_dashboard_control_callbacks;
$screen = get_current_screen();
$private_callback_args = array( '__widget_basename' => $widget_name );
if ( is_null( $callback_args ) ) {
$callback_args = $private_callback_args;
} elseif ( is_array( $callback_args ) ) {
$callback_args = array_merge( $callback_args, $private_callback_args );
}
if ( $control_callback && is_callable( $control_callback ) && current_user_can( 'edit_dashboard' ) ) {
$wp_dashboard_control_callbacks[ $widget_id ] = $control_callback;
if ( isset( $_GET['edit'] ) && $widget_id === $_GET['edit'] ) {
list($url) = explode( '#', add_query_arg( 'edit', false ), 2 );
$widget_name .= ' <span class="postbox-title-action"><a href="' . esc_url( $url ) . '">' . __( 'Cancel' ) . '</a></span>';
$callback = '_wp_dashboard_control_callback';
} else {
list($url) = explode( '#', add_query_arg( 'edit', $widget_id ), 2 );
$widget_name .= ' <span class="postbox-title-action"><a href="' . esc_url( "$url#$widget_id" ) . '" class="edit-box open-box">' . __( 'Configure' ) . '</a></span>';
}
}
$side_widgets = array( 'dashboard_quick_press', 'dashboard_primary' );
if ( in_array( $widget_id, $side_widgets, true ) ) {
$context = 'side';
}
$high_priority_widgets = array( 'dashboard_browser_nag', 'dashboard_php_nag' );
if ( in_array( $widget_id, $high_priority_widgets, true ) ) {
$priority = 'high';
}
if ( empty( $context ) ) {
$context = 'normal';
}
if ( empty( $priority ) ) {
$priority = 'core';
}
add_meta_box( $widget_id, $widget_name, $callback, $screen, $context, $priority, $callback_args );
}
```
| Uses | Description |
| --- | --- |
| [get\_current\_screen()](get_current_screen) wp-admin/includes/screen.php | Get the current screen object |
| [add\_meta\_box()](add_meta_box) wp-admin/includes/template.php | Adds a meta box to one or more screens. |
| [current\_user\_can()](current_user_can) wp-includes/capabilities.php | Returns whether the current user has the specified capability. |
| [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. |
| [esc\_url()](esc_url) wp-includes/formatting.php | Checks and cleans a URL. |
| [add\_query\_arg()](add_query_arg) wp-includes/functions.php | Retrieves a modified URL query string. |
| Used By | Description |
| --- | --- |
| [wp\_dashboard\_setup()](wp_dashboard_setup) wp-admin/includes/dashboard.php | Registers dashboard widgets. |
| Version | Description |
| --- | --- |
| [5.6.0](https://developer.wordpress.org/reference/since/5.6.0/) | The `$context` and `$priority` parameters were added. |
| [2.7.0](https://developer.wordpress.org/reference/since/2.7.0/) | Introduced. |
wordpress wp_prepare_attachment_for_js( int|WP_Post $attachment ): array|void wp\_prepare\_attachment\_for\_js( int|WP\_Post $attachment ): array|void
========================================================================
Prepares an attachment post object for JS, where it is expected to be JSON-encoded and fit into an Attachment model.
`$attachment` int|[WP\_Post](../classes/wp_post) Required Attachment ID or object. array|void Array of attachment details, or void if the parameter does not correspond to an attachment.
* `alt`stringAlt text of the attachment.
* `author`stringID of the attachment author, as a string.
* `authorName`stringName of the attachment author.
* `caption`stringCaption for the attachment.
* `compat`arrayContaining item and meta.
* `context`stringContext, whether it's used as the site icon for example.
* `date`intUploaded date, timestamp in milliseconds.
* `dateFormatted`stringFormatted date (e.g. June 29, 2018).
* `description`stringDescription of the attachment.
* `editLink`stringURL to the edit page for the attachment.
* `filename`stringFile name of the attachment.
* `filesizeHumanReadable`stringFilesize of the attachment in human readable format (e.g. 1 MB).
* `filesizeInBytes`intFilesize of the attachment in bytes.
* `height`intIf the attachment is an image, represents the height of the image in pixels.
* `icon`stringIcon URL of the attachment (e.g. /wp-includes/images/media/archive.png).
* `id`intID of the attachment.
* `link`stringURL to the attachment.
* `menuOrder`intMenu order of the attachment post.
* `meta`arrayMeta data for the attachment.
* `mime`stringMime type of the attachment (e.g. image/jpeg or application/zip).
* `modified`intLast modified, timestamp in milliseconds.
* `name`stringName, same as title of the attachment.
* `nonces`arrayNonces for update, delete and edit.
* `orientation`stringIf the attachment is an image, represents the image orientation (landscape or portrait).
* `sizes`arrayIf the attachment is an image, contains an array of arrays for the images sizes: thumbnail, medium, large, and full.
* `status`stringPost status of the attachment (usually `'inherit'`).
* `subtype`stringMime subtype of the attachment (usually the last part, e.g. jpeg or zip).
* `title`stringTitle of the attachment (usually slugified file name without the extension).
* `type`stringType of the attachment (usually first part of the mime type, e.g. image).
* `uploadedTo`intParent post to which the attachment was uploaded.
* `uploadedToLink`stringURL to the edit page of the parent post of the attachment.
* `uploadedToTitle`stringPost title of the parent of the attachment.
* `url`stringDirect URL to the attachment file (from wp-content).
* `width`intIf the attachment is an image, represents the width of the image in pixels.
File: `wp-includes/media.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/media.php/)
```
function wp_prepare_attachment_for_js( $attachment ) {
$attachment = get_post( $attachment );
if ( ! $attachment ) {
return;
}
if ( 'attachment' !== $attachment->post_type ) {
return;
}
$meta = wp_get_attachment_metadata( $attachment->ID );
if ( false !== strpos( $attachment->post_mime_type, '/' ) ) {
list( $type, $subtype ) = explode( '/', $attachment->post_mime_type );
} else {
list( $type, $subtype ) = array( $attachment->post_mime_type, '' );
}
$attachment_url = wp_get_attachment_url( $attachment->ID );
$base_url = str_replace( wp_basename( $attachment_url ), '', $attachment_url );
$response = array(
'id' => $attachment->ID,
'title' => $attachment->post_title,
'filename' => wp_basename( get_attached_file( $attachment->ID ) ),
'url' => $attachment_url,
'link' => get_attachment_link( $attachment->ID ),
'alt' => get_post_meta( $attachment->ID, '_wp_attachment_image_alt', true ),
'author' => $attachment->post_author,
'description' => $attachment->post_content,
'caption' => $attachment->post_excerpt,
'name' => $attachment->post_name,
'status' => $attachment->post_status,
'uploadedTo' => $attachment->post_parent,
'date' => strtotime( $attachment->post_date_gmt ) * 1000,
'modified' => strtotime( $attachment->post_modified_gmt ) * 1000,
'menuOrder' => $attachment->menu_order,
'mime' => $attachment->post_mime_type,
'type' => $type,
'subtype' => $subtype,
'icon' => wp_mime_type_icon( $attachment->ID ),
'dateFormatted' => mysql2date( __( 'F j, Y' ), $attachment->post_date ),
'nonces' => array(
'update' => false,
'delete' => false,
'edit' => false,
),
'editLink' => false,
'meta' => false,
);
$author = new WP_User( $attachment->post_author );
if ( $author->exists() ) {
$author_name = $author->display_name ? $author->display_name : $author->nickname;
$response['authorName'] = html_entity_decode( $author_name, ENT_QUOTES, get_bloginfo( 'charset' ) );
$response['authorLink'] = get_edit_user_link( $author->ID );
} else {
$response['authorName'] = __( '(no author)' );
}
if ( $attachment->post_parent ) {
$post_parent = get_post( $attachment->post_parent );
if ( $post_parent ) {
$response['uploadedToTitle'] = $post_parent->post_title ? $post_parent->post_title : __( '(no title)' );
$response['uploadedToLink'] = get_edit_post_link( $attachment->post_parent, 'raw' );
}
}
$attached_file = get_attached_file( $attachment->ID );
if ( isset( $meta['filesize'] ) ) {
$bytes = $meta['filesize'];
} elseif ( file_exists( $attached_file ) ) {
$bytes = wp_filesize( $attached_file );
} else {
$bytes = '';
}
if ( $bytes ) {
$response['filesizeInBytes'] = $bytes;
$response['filesizeHumanReadable'] = size_format( $bytes );
}
$context = get_post_meta( $attachment->ID, '_wp_attachment_context', true );
$response['context'] = ( $context ) ? $context : '';
if ( current_user_can( 'edit_post', $attachment->ID ) ) {
$response['nonces']['update'] = wp_create_nonce( 'update-post_' . $attachment->ID );
$response['nonces']['edit'] = wp_create_nonce( 'image_editor-' . $attachment->ID );
$response['editLink'] = get_edit_post_link( $attachment->ID, 'raw' );
}
if ( current_user_can( 'delete_post', $attachment->ID ) ) {
$response['nonces']['delete'] = wp_create_nonce( 'delete-post_' . $attachment->ID );
}
if ( $meta && ( 'image' === $type || ! empty( $meta['sizes'] ) ) ) {
$sizes = array();
/** This filter is documented in wp-admin/includes/media.php */
$possible_sizes = apply_filters(
'image_size_names_choose',
array(
'thumbnail' => __( 'Thumbnail' ),
'medium' => __( 'Medium' ),
'large' => __( 'Large' ),
'full' => __( 'Full Size' ),
)
);
unset( $possible_sizes['full'] );
/*
* Loop through all potential sizes that may be chosen. Try to do this with some efficiency.
* First: run the image_downsize filter. If it returns something, we can use its data.
* If the filter does not return something, then image_downsize() is just an expensive way
* to check the image metadata, which we do second.
*/
foreach ( $possible_sizes as $size => $label ) {
/** This filter is documented in wp-includes/media.php */
$downsize = apply_filters( 'image_downsize', false, $attachment->ID, $size );
if ( $downsize ) {
if ( empty( $downsize[3] ) ) {
continue;
}
$sizes[ $size ] = array(
'height' => $downsize[2],
'width' => $downsize[1],
'url' => $downsize[0],
'orientation' => $downsize[2] > $downsize[1] ? 'portrait' : 'landscape',
);
} elseif ( isset( $meta['sizes'][ $size ] ) ) {
// Nothing from the filter, so consult image metadata if we have it.
$size_meta = $meta['sizes'][ $size ];
// We have the actual image size, but might need to further constrain it if content_width is narrower.
// Thumbnail, medium, and full sizes are also checked against the site's height/width options.
list( $width, $height ) = image_constrain_size_for_editor( $size_meta['width'], $size_meta['height'], $size, 'edit' );
$sizes[ $size ] = array(
'height' => $height,
'width' => $width,
'url' => $base_url . $size_meta['file'],
'orientation' => $height > $width ? 'portrait' : 'landscape',
);
}
}
if ( 'image' === $type ) {
if ( ! empty( $meta['original_image'] ) ) {
$response['originalImageURL'] = wp_get_original_image_url( $attachment->ID );
$response['originalImageName'] = wp_basename( wp_get_original_image_path( $attachment->ID ) );
}
$sizes['full'] = array( 'url' => $attachment_url );
if ( isset( $meta['height'], $meta['width'] ) ) {
$sizes['full']['height'] = $meta['height'];
$sizes['full']['width'] = $meta['width'];
$sizes['full']['orientation'] = $meta['height'] > $meta['width'] ? 'portrait' : 'landscape';
}
$response = array_merge( $response, $sizes['full'] );
} elseif ( $meta['sizes']['full']['file'] ) {
$sizes['full'] = array(
'url' => $base_url . $meta['sizes']['full']['file'],
'height' => $meta['sizes']['full']['height'],
'width' => $meta['sizes']['full']['width'],
'orientation' => $meta['sizes']['full']['height'] > $meta['sizes']['full']['width'] ? 'portrait' : 'landscape',
);
}
$response = array_merge( $response, array( 'sizes' => $sizes ) );
}
if ( $meta && 'video' === $type ) {
if ( isset( $meta['width'] ) ) {
$response['width'] = (int) $meta['width'];
}
if ( isset( $meta['height'] ) ) {
$response['height'] = (int) $meta['height'];
}
}
if ( $meta && ( 'audio' === $type || 'video' === $type ) ) {
if ( isset( $meta['length_formatted'] ) ) {
$response['fileLength'] = $meta['length_formatted'];
$response['fileLengthHumanReadable'] = human_readable_duration( $meta['length_formatted'] );
}
$response['meta'] = array();
foreach ( wp_get_attachment_id3_keys( $attachment, 'js' ) as $key => $label ) {
$response['meta'][ $key ] = false;
if ( ! empty( $meta[ $key ] ) ) {
$response['meta'][ $key ] = $meta[ $key ];
}
}
$id = get_post_thumbnail_id( $attachment->ID );
if ( ! empty( $id ) ) {
list( $src, $width, $height ) = wp_get_attachment_image_src( $id, 'full' );
$response['image'] = compact( 'src', 'width', 'height' );
list( $src, $width, $height ) = wp_get_attachment_image_src( $id, 'thumbnail' );
$response['thumb'] = compact( 'src', 'width', 'height' );
} else {
$src = wp_mime_type_icon( $attachment->ID );
$width = 48;
$height = 64;
$response['image'] = compact( 'src', 'width', 'height' );
$response['thumb'] = compact( 'src', 'width', 'height' );
}
}
if ( function_exists( 'get_compat_media_markup' ) ) {
$response['compat'] = get_compat_media_markup( $attachment->ID, array( 'in_modal' => true ) );
}
if ( function_exists( 'get_media_states' ) ) {
$media_states = get_media_states( $attachment );
if ( ! empty( $media_states ) ) {
$response['mediaStates'] = implode( ', ', $media_states );
}
}
/**
* Filters the attachment data prepared for JavaScript.
*
* @since 3.5.0
*
* @param array $response Array of prepared attachment data. @see wp_prepare_attachment_for_js().
* @param WP_Post $attachment Attachment object.
* @param array|false $meta Array of attachment meta data, or false if there is none.
*/
return apply_filters( 'wp_prepare_attachment_for_js', $response, $attachment, $meta );
}
```
[apply\_filters( 'image\_downsize', bool|array $downsize, int $id, string|int[] $size )](../hooks/image_downsize)
Filters whether to preempt the output of [image\_downsize()](image_downsize) .
[apply\_filters( 'image\_size\_names\_choose', string[] $size\_names )](../hooks/image_size_names_choose)
Filters the names and labels of the default image sizes.
[apply\_filters( 'wp\_prepare\_attachment\_for\_js', array $response, WP\_Post $attachment, array|false $meta )](../hooks/wp_prepare_attachment_for_js)
Filters the attachment data prepared for JavaScript.
| Uses | Description |
| --- | --- |
| [wp\_filesize()](wp_filesize) wp-includes/functions.php | Wrapper for PHP filesize with filters and casting the result as an integer. |
| [mysql2date()](mysql2date) wp-includes/functions.php | Converts given MySQL date string into a different format. |
| [wp\_get\_attachment\_url()](wp_get_attachment_url) wp-includes/post.php | Retrieves the URL for an attachment. |
| [wp\_get\_attachment\_metadata()](wp_get_attachment_metadata) wp-includes/post.php | Retrieves attachment metadata for attachment ID. |
| [wp\_mime\_type\_icon()](wp_mime_type_icon) wp-includes/post.php | Retrieves the icon for a MIME type or attachment. |
| [image\_constrain\_size\_for\_editor()](image_constrain_size_for_editor) wp-includes/media.php | Scales down the default size of an image. |
| [wp\_get\_attachment\_image\_src()](wp_get_attachment_image_src) wp-includes/media.php | Retrieves an image to represent an attachment. |
| [wp\_get\_attachment\_id3\_keys()](wp_get_attachment_id3_keys) wp-includes/media.php | Returns useful keys to use to lookup data from an attachment’s stored metadata. |
| [get\_post\_thumbnail\_id()](get_post_thumbnail_id) wp-includes/post-thumbnail-template.php | Retrieves the post thumbnail ID. |
| [get\_attachment\_link()](get_attachment_link) wp-includes/link-template.php | Retrieves the permalink for an attachment. |
| [get\_edit\_post\_link()](get_edit_post_link) wp-includes/link-template.php | Retrieves the edit post link for post. |
| [get\_media\_states()](get_media_states) wp-admin/includes/template.php | Retrieves an array of media states from an attachment. |
| [get\_edit\_user\_link()](get_edit_user_link) wp-includes/link-template.php | Retrieves the edit user link. |
| [size\_format()](size_format) wp-includes/functions.php | Converts a number of bytes to the largest unit the bytes will fit into. |
| [wp\_create\_nonce()](wp_create_nonce) wp-includes/pluggable.php | Creates a cryptographic token tied to a specific action, user, user session, and window of time. |
| [WP\_User::\_\_construct()](../classes/wp_user/__construct) wp-includes/class-wp-user.php | Constructor. |
| [get\_compat\_media\_markup()](get_compat_media_markup) wp-admin/includes/media.php | |
| [human\_readable\_duration()](human_readable_duration) wp-includes/functions.php | Converts a duration to human readable format. |
| [wp\_get\_original\_image\_path()](wp_get_original_image_path) wp-includes/post.php | Retrieves the path to an uploaded image file. |
| [wp\_get\_original\_image\_url()](wp_get_original_image_url) wp-includes/post.php | Retrieves the URL to an original attachment image. |
| [get\_attached\_file()](get_attached_file) wp-includes/post.php | Retrieves attached file path based on attachment ID. |
| [get\_bloginfo()](get_bloginfo) wp-includes/general-template.php | Retrieves information about the current site. |
| [wp\_basename()](wp_basename) wp-includes/formatting.php | i18n-friendly version of basename(). |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. |
| [current\_user\_can()](current_user_can) wp-includes/capabilities.php | Returns whether the current user has the specified capability. |
| [get\_post\_meta()](get_post_meta) wp-includes/post.php | Retrieves a post meta field for the given post ID. |
| [get\_post()](get_post) wp-includes/post.php | Retrieves post data given a post ID or post object. |
| Used By | Description |
| --- | --- |
| [wp\_ajax\_media\_create\_image\_subsizes()](wp_ajax_media_create_image_subsizes) wp-admin/includes/ajax-actions.php | Ajax handler for creating missing image sub-sizes for just uploaded images. |
| [wp\_ajax\_crop\_image()](wp_ajax_crop_image) wp-admin/includes/ajax-actions.php | Ajax handler for cropping an image. |
| [WP\_Customize\_Media\_Control::to\_json()](../classes/wp_customize_media_control/to_json) wp-includes/customize/class-wp-customize-media-control.php | Refresh the parameters passed to the JavaScript via JSON. |
| [wp\_ajax\_upload\_attachment()](wp_ajax_upload_attachment) wp-admin/includes/ajax-actions.php | Ajax handler for uploading attachments |
| [wp\_ajax\_get\_attachment()](wp_ajax_get_attachment) wp-admin/includes/ajax-actions.php | Ajax handler for getting an attachment. |
| [wp\_ajax\_save\_attachment\_compat()](wp_ajax_save_attachment_compat) wp-admin/includes/ajax-actions.php | Ajax handler for saving backward compatible attachment attributes. |
| [WP\_Customize\_Upload\_Control::to\_json()](../classes/wp_customize_upload_control/to_json) wp-includes/customize/class-wp-customize-upload-control.php | Refresh the parameters passed to the JavaScript via JSON. |
| Version | Description |
| --- | --- |
| [3.5.0](https://developer.wordpress.org/reference/since/3.5.0/) | Introduced. |
| programming_docs |
wordpress wp_cache_delete_multiple( array $keys, string $group = '' ): bool[] wp\_cache\_delete\_multiple( array $keys, string $group = '' ): bool[]
======================================================================
Deletes multiple values from the cache in one call.
* [WP\_Object\_Cache::delete\_multiple()](../classes/wp_object_cache/delete_multiple)
`$keys` array Required Array of keys under which the cache to deleted. `$group` string Optional Where the cache contents are grouped. Default: `''`
bool[] Array of return values, grouped by key. Each value is either true on success, or false if the contents were not deleted.
File: `wp-includes/cache.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/cache.php/)
```
function wp_cache_delete_multiple( array $keys, $group = '' ) {
global $wp_object_cache;
return $wp_object_cache->delete_multiple( $keys, $group );
}
```
| Uses | Description |
| --- | --- |
| [WP\_Object\_Cache::delete\_multiple()](../classes/wp_object_cache/delete_multiple) wp-includes/class-wp-object-cache.php | Deletes multiple values from the cache in one call. |
| Used By | Description |
| --- | --- |
| [\_clear\_modified\_cache\_on\_transition\_comment\_status()](_clear_modified_cache_on_transition_comment_status) wp-includes/comment.php | Clears the lastcommentmodified cached value when a comment status is changed. |
| [clean\_network\_cache()](clean_network_cache) wp-includes/ms-network.php | Removes a network from the object cache. |
| [clean\_object\_term\_cache()](clean_object_term_cache) wp-includes/taxonomy.php | Removes the taxonomy relationship to terms from the cache. |
| [clean\_term\_cache()](clean_term_cache) wp-includes/taxonomy.php | Removes all of the term IDs from the cache. |
| [clean\_comment\_cache()](clean_comment_cache) wp-includes/comment.php | Removes a comment from the object cache. |
| [wp\_insert\_comment()](wp_insert_comment) wp-includes/comment.php | Inserts a comment into the database. |
| [delete\_metadata()](delete_metadata) wp-includes/meta.php | Deletes metadata for the specified object. |
| Version | Description |
| --- | --- |
| [6.0.0](https://developer.wordpress.org/reference/since/6.0.0/) | Introduced. |
wordpress wp_check_comment_flood( bool $is_flood, string $ip, string $email, string $date, bool $avoid_die = false ): bool wp\_check\_comment\_flood( bool $is\_flood, string $ip, string $email, string $date, bool $avoid\_die = false ): bool
=====================================================================================================================
Checks whether comment flooding is occurring.
Won’t run, if current user can manage options, so to not block administrators.
`$is_flood` bool Required Is a comment flooding occurring? `$ip` string Required Comment author's IP address. `$email` string Required Comment author's email address. `$date` string Required MySQL time string. `$avoid_die` bool Optional When true, a disallowed comment will result in the function returning without executing [wp\_die()](wp_die) or die(). More Arguments from wp\_die( ... $args ) Arguments to control behavior. If `$args` is an integer, then it is treated as the response code.
* `response`intThe HTTP response code. Default 200 for Ajax requests, 500 otherwise.
* `link_url`stringA URL to include a link to. Only works in combination with $link\_text.
Default empty string.
* `link_text`stringA label for the link to include. Only works in combination with $link\_url.
Default empty string.
* `back_link`boolWhether to include a link to go back. Default false.
* `text_direction`stringThe text direction. This is only useful internally, when WordPress is still loading and the site's locale is not set up yet. Accepts `'rtl'` and `'ltr'`.
Default is the value of [is\_rtl()](is_rtl) .
* `charset`stringCharacter set of the HTML output. Default `'utf-8'`.
* `code`stringError code to use. Default is `'wp_die'`, or the main error code if $message is a [WP\_Error](../classes/wp_error).
* `exit`boolWhether to exit the process after completion. Default true.
Default: `false`
bool Whether comment flooding is occurring.
File: `wp-includes/comment.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/comment.php/)
```
function wp_check_comment_flood( $is_flood, $ip, $email, $date, $avoid_die = false ) {
global $wpdb;
// Another callback has declared a flood. Trust it.
if ( true === $is_flood ) {
return $is_flood;
}
// Don't throttle admins or moderators.
if ( current_user_can( 'manage_options' ) || current_user_can( 'moderate_comments' ) ) {
return false;
}
$hour_ago = gmdate( 'Y-m-d H:i:s', time() - HOUR_IN_SECONDS );
if ( is_user_logged_in() ) {
$user = get_current_user_id();
$check_column = '`user_id`';
} else {
$user = $ip;
$check_column = '`comment_author_IP`';
}
$sql = $wpdb->prepare(
"SELECT `comment_date_gmt` FROM `$wpdb->comments` WHERE `comment_date_gmt` >= %s AND ( $check_column = %s OR `comment_author_email` = %s ) ORDER BY `comment_date_gmt` DESC LIMIT 1",
$hour_ago,
$user,
$email
);
$lasttime = $wpdb->get_var( $sql );
if ( $lasttime ) {
$time_lastcomment = mysql2date( 'U', $lasttime, false );
$time_newcomment = mysql2date( 'U', $date, false );
/**
* Filters the comment flood status.
*
* @since 2.1.0
*
* @param bool $bool Whether a comment flood is occurring. Default false.
* @param int $time_lastcomment Timestamp of when the last comment was posted.
* @param int $time_newcomment Timestamp of when the new comment was posted.
*/
$flood_die = apply_filters( 'comment_flood_filter', false, $time_lastcomment, $time_newcomment );
if ( $flood_die ) {
/**
* Fires before the comment flood message is triggered.
*
* @since 1.5.0
*
* @param int $time_lastcomment Timestamp of when the last comment was posted.
* @param int $time_newcomment Timestamp of when the new comment was posted.
*/
do_action( 'comment_flood_trigger', $time_lastcomment, $time_newcomment );
if ( $avoid_die ) {
return true;
} else {
/**
* Filters the comment flood error message.
*
* @since 5.2.0
*
* @param string $comment_flood_message Comment flood error message.
*/
$comment_flood_message = apply_filters( 'comment_flood_message', __( 'You are posting comments too quickly. Slow down.' ) );
if ( wp_doing_ajax() ) {
die( $comment_flood_message );
}
wp_die( $comment_flood_message, 429 );
}
}
}
return false;
}
```
[apply\_filters( 'comment\_flood\_filter', bool $bool, int $time\_lastcomment, int $time\_newcomment )](../hooks/comment_flood_filter)
Filters the comment flood status.
[apply\_filters( 'comment\_flood\_message', string $comment\_flood\_message )](../hooks/comment_flood_message)
Filters the comment flood error message.
[do\_action( 'comment\_flood\_trigger', int $time\_lastcomment, int $time\_newcomment )](../hooks/comment_flood_trigger)
Fires before the comment flood message is triggered.
| Uses | Description |
| --- | --- |
| [wp\_doing\_ajax()](wp_doing_ajax) wp-includes/load.php | Determines whether the current request is a WordPress Ajax request. |
| [mysql2date()](mysql2date) wp-includes/functions.php | Converts given MySQL date string into a different format. |
| [current\_user\_can()](current_user_can) wp-includes/capabilities.php | Returns whether the current user has the specified capability. |
| [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. |
| [is\_user\_logged\_in()](is_user_logged_in) wp-includes/pluggable.php | Determines whether the current visitor is a logged in user. |
| [wp\_die()](wp_die) wp-includes/functions.php | Kills WordPress execution and displays HTML page with an error message. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| [do\_action()](do_action) wp-includes/plugin.php | Calls the callback functions that have been added to an action hook. |
| [get\_current\_user\_id()](get_current_user_id) wp-includes/user.php | Gets the current user’s ID. |
| [wpdb::get\_var()](../classes/wpdb/get_var) wp-includes/class-wpdb.php | Retrieves one variable from the database. |
| [wpdb::prepare()](../classes/wpdb/prepare) wp-includes/class-wpdb.php | Prepares a SQL query for safe execution. |
| Version | Description |
| --- | --- |
| [4.7.0](https://developer.wordpress.org/reference/since/4.7.0/) | Introduced. |
wordpress _wp_multiple_block_styles( array $metadata ): array \_wp\_multiple\_block\_styles( array $metadata ): array
=======================================================
This function has been deprecated.
Allows multiple block styles.
`$metadata` array Required Metadata for registering a block type. array Metadata for registering a block type.
File: `wp-includes/deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/deprecated.php/)
```
function _wp_multiple_block_styles( $metadata ) {
_deprecated_function( __FUNCTION__, '6.1.0' );
return $metadata;
}
```
| Uses | Description |
| --- | --- |
| [\_deprecated\_function()](_deprecated_function) wp-includes/functions.php | Marks a function as deprecated and inform when it has been used. |
| Version | Description |
| --- | --- |
| [6.1.0](https://developer.wordpress.org/reference/since/6.1.0/) | This function has been deprecated. |
| [5.9.0](https://developer.wordpress.org/reference/since/5.9.0/) | Introduced. |
wordpress display_theme( object $theme ) display\_theme( object $theme )
===============================
This function has been deprecated.
Prints a theme on the Install Themes pages.
`$theme` object Required File: `wp-admin/includes/theme-install.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/theme-install.php/)
```
function display_theme( $theme ) {
_deprecated_function( __FUNCTION__, '3.4.0' );
global $wp_list_table;
if ( ! isset( $wp_list_table ) ) {
$wp_list_table = _get_list_table( 'WP_Theme_Install_List_Table' );
}
$wp_list_table->prepare_items();
$wp_list_table->single_row( $theme );
}
```
| Uses | Description |
| --- | --- |
| [WP\_List\_Table::single\_row()](../classes/wp_list_table/single_row) wp-admin/includes/class-wp-list-table.php | Generates content for a single row of the table. |
| [WP\_List\_Table::prepare\_items()](../classes/wp_list_table/prepare_items) wp-admin/includes/class-wp-list-table.php | Prepares the list of items for displaying. |
| [\_get\_list\_table()](_get_list_table) wp-admin/includes/list-table.php | Fetches an instance of a [WP\_List\_Table](../classes/wp_list_table) class. |
| [\_deprecated\_function()](_deprecated_function) wp-includes/functions.php | Marks a function as deprecated and inform when it has been used. |
| Version | Description |
| --- | --- |
| [3.4.0](https://developer.wordpress.org/reference/since/3.4.0/) | Introduced. |
wordpress get_screen_icon(): string get\_screen\_icon(): string
===========================
This function has been deprecated.
Retrieves the screen icon (no longer used in 3.8+).
string An HTML comment explaining that icons are no longer used.
File: `wp-admin/includes/deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/deprecated.php/)
```
function get_screen_icon() {
_deprecated_function( __FUNCTION__, '3.8.0' );
return '<!-- Screen icons are no longer used as of WordPress 3.8. -->';
}
```
| Uses | Description |
| --- | --- |
| [\_deprecated\_function()](_deprecated_function) wp-includes/functions.php | Marks a function as deprecated and inform when it has been used. |
| Used By | Description |
| --- | --- |
| [screen\_icon()](screen_icon) wp-admin/includes/deprecated.php | Displays a screen icon. |
| Version | Description |
| --- | --- |
| [3.8.0](https://developer.wordpress.org/reference/since/3.8.0/) | This function has been deprecated. |
| [3.2.0](https://developer.wordpress.org/reference/since/3.2.0/) | Introduced. |
wordpress wp_nav_menu_locations_meta_box() wp\_nav\_menu\_locations\_meta\_box()
=====================================
This function has been deprecated.
This was once used to display a meta box for the nav menu theme locations.
Deprecated in favor of a ‘Manage Locations’ tab added to nav menus management screen.
File: `wp-admin/includes/deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/deprecated.php/)
```
function wp_nav_menu_locations_meta_box() {
_deprecated_function( __FUNCTION__, '3.6.0' );
}
```
| Uses | Description |
| --- | --- |
| [\_deprecated\_function()](_deprecated_function) wp-includes/functions.php | Marks a function as deprecated and inform when it has been used. |
| Version | Description |
| --- | --- |
| [3.6.0](https://developer.wordpress.org/reference/since/3.6.0/) | This function has been deprecated. |
| [3.0.0](https://developer.wordpress.org/reference/since/3.0.0/) | Introduced. |
wordpress wp_embed_excerpt_more( string $more_string ): string wp\_embed\_excerpt\_more( string $more\_string ): string
========================================================
Filters the string in the ‘more’ link displayed after a trimmed excerpt.
Replaces ‘[…]’ (appended to automatically generated excerpts) with an ellipsis and a "Continue reading" link in the embed template.
`$more_string` string Required Default `'more'` string. string 'Continue reading' link prepended with an ellipsis.
File: `wp-includes/embed.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/embed.php/)
```
function wp_embed_excerpt_more( $more_string ) {
if ( ! is_embed() ) {
return $more_string;
}
$link = sprintf(
'<a href="%1$s" class="wp-embed-more" target="_top">%2$s</a>',
esc_url( get_permalink() ),
/* translators: %s: Post title. */
sprintf( __( 'Continue reading %s' ), '<span class="screen-reader-text">' . get_the_title() . '</span>' )
);
return ' … ' . $link;
}
```
| Uses | Description |
| --- | --- |
| [is\_embed()](is_embed) wp-includes/query.php | Is the query for an embedded post? |
| [get\_the\_title()](get_the_title) wp-includes/post-template.php | Retrieves the post title. |
| [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. |
| [esc\_url()](esc_url) wp-includes/formatting.php | Checks and cleans a URL. |
| [get\_permalink()](get_permalink) wp-includes/link-template.php | Retrieves the full permalink for the current post or post ID. |
| Version | Description |
| --- | --- |
| [4.4.0](https://developer.wordpress.org/reference/since/4.4.0/) | Introduced. |
wordpress wp_nonce_field( int|string $action = -1, string $name = '_wpnonce', bool $referer = true, bool $echo = true ): string wp\_nonce\_field( int|string $action = -1, string $name = '\_wpnonce', bool $referer = true, bool $echo = true ): string
========================================================================================================================
Retrieves or display nonce hidden field for forms.
The nonce field 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 field in forms.
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 difficult for them to find 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.
`$action` int|string Optional Action name. Default: `-1`
`$name` string Optional Nonce name. Default `'_wpnonce'`. Default: `'_wpnonce'`
`$referer` bool Optional Whether to set the referer field for validation. Default: `true`
`$echo` bool Optional Whether to display or return hidden form field. Default: `true`
string Nonce field HTML markup.
File: `wp-includes/functions.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/functions.php/)
```
function wp_nonce_field( $action = -1, $name = '_wpnonce', $referer = true, $echo = true ) {
$name = esc_attr( $name );
$nonce_field = '<input type="hidden" id="' . $name . '" name="' . $name . '" value="' . wp_create_nonce( $action ) . '" />';
if ( $referer ) {
$nonce_field .= wp_referer_field( false );
}
if ( $echo ) {
echo $nonce_field;
}
return $nonce_field;
}
```
| Uses | Description |
| --- | --- |
| [wp\_referer\_field()](wp_referer_field) wp-includes/functions.php | Retrieves or displays referer hidden field for forms. |
| [wp\_create\_nonce()](wp_create_nonce) wp-includes/pluggable.php | Creates a cryptographic token tied to a specific action, user, user session, and window of time. |
| [esc\_attr()](esc_attr) wp-includes/formatting.php | Escaping for HTML attributes. |
| Used By | Description |
| --- | --- |
| [the\_block\_editor\_meta\_boxes()](the_block_editor_meta_boxes) wp-admin/includes/post.php | Renders the meta boxes forms. |
| [the\_block\_editor\_meta\_box\_post\_form\_hidden\_fields()](the_block_editor_meta_box_post_form_hidden_fields) wp-admin/includes/post.php | Renders the hidden form required for the meta boxes form. |
| [network\_step1()](network_step1) wp-admin/includes/network.php | Prints step 1 for Network installation process. |
| [WP\_Screen::render\_screen\_options()](../classes/wp_screen/render_screen_options) wp-admin/includes/class-wp-screen.php | Renders the screen options tab. |
| [install\_themes\_upload()](install_themes_upload) wp-admin/includes/theme-install.php | Displays a form to upload themes from zip files. |
| [WP\_List\_Table::display\_tablenav()](../classes/wp_list_table/display_tablenav) wp-admin/includes/class-wp-list-table.php | Generates the table navigation above or below the table |
| [admin\_color\_scheme\_picker()](admin_color_scheme_picker) wp-admin/includes/misc.php | Displays the default admin color scheme picker (Used in user-edit.php). |
| [WP\_Theme\_Install\_List\_Table::display()](../classes/wp_theme_install_list_table/display) wp-admin/includes/class-wp-theme-install-list-table.php | Displays the theme install table. |
| [install\_plugins\_upload()](install_plugins_upload) wp-admin/includes/plugin-install.php | Displays a form to upload plugins from zip files. |
| [\_wp\_dashboard\_control\_callback()](_wp_dashboard_control_callback) wp-admin/includes/dashboard.php | Outputs controls for the current dashboard widget. |
| [wp\_dashboard()](wp_dashboard) wp-admin/includes/dashboard.php | Displays the dashboard. |
| [wp\_dashboard\_quick\_press()](wp_dashboard_quick_press) wp-admin/includes/dashboard.php | The Quick Draft widget display and creation of drafts. |
| [settings\_fields()](settings_fields) wp-admin/includes/plugin.php | Outputs nonce, action, and option\_page fields for a settings page. |
| [find\_posts\_div()](find_posts_div) wp-admin/includes/template.php | Outputs the modal window used for attaching media to posts or pages in the media-listing screen. |
| [wp\_comment\_reply()](wp_comment_reply) wp-admin/includes/template.php | Outputs the in-line comment reply-to form in the Comments list table. |
| [\_list\_meta\_row()](_list_meta_row) wp-admin/includes/template.php | Outputs a single row of public meta data in the Custom Fields meta box. |
| [meta\_form()](meta_form) wp-admin/includes/template.php | Prints the form in the Custom Fields meta box. |
| [WP\_Themes\_List\_Table::display()](../classes/wp_themes_list_table/display) wp-admin/includes/class-wp-themes-list-table.php | Displays the themes table. |
| [media\_upload\_type\_form()](media_upload_type_form) wp-admin/includes/media.php | Outputs the legacy media upload form for a given media type. |
| [media\_upload\_type\_url\_form()](media_upload_type_url_form) wp-admin/includes/media.php | Outputs the legacy media upload form for external media. |
| [media\_upload\_gallery\_form()](media_upload_gallery_form) wp-admin/includes/media.php | Adds gallery form to upload iframe. |
| [media\_upload\_library\_form()](media_upload_library_form) wp-admin/includes/media.php | Outputs the legacy media upload form for the media library. |
| [post\_comment\_meta\_box()](post_comment_meta_box) wp-admin/includes/meta-boxes.php | Displays comments for post. |
| [link\_categories\_meta\_box()](link_categories_meta_box) wp-admin/includes/meta-boxes.php | Displays link categories form fields. |
| [post\_categories\_meta\_box()](post_categories_meta_box) wp-admin/includes/meta-boxes.php | Displays post categories form fields. |
| [WP\_Post\_Comments\_List\_Table::display()](../classes/wp_post_comments_list_table/display) wp-admin/includes/class-wp-post-comments-list-table.php | |
| [WP\_Comments\_List\_Table::extra\_tablenav()](../classes/wp_comments_list_table/extra_tablenav) wp-admin/includes/class-wp-comments-list-table.php | |
| [WP\_Comments\_List\_Table::display()](../classes/wp_comments_list_table/display) wp-admin/includes/class-wp-comments-list-table.php | Displays the comments table. |
| [WP\_Terms\_List\_Table::inline\_edit()](../classes/wp_terms_list_table/inline_edit) wp-admin/includes/class-wp-terms-list-table.php | Outputs the hidden row displayed when inline editing |
| [request\_filesystem\_credentials()](request_filesystem_credentials) wp-admin/includes/file.php | Displays a form to the user to request for their FTP/SSH details in order to connect to the filesystem. |
| [WP\_Posts\_List\_Table::inline\_edit()](../classes/wp_posts_list_table/inline_edit) wp-admin/includes/class-wp-posts-list-table.php | Outputs the hidden row displayed when inline editing |
| [Custom\_Image\_Header::step\_1()](../classes/custom_image_header/step_1) wp-admin/includes/class-custom-image-header.php | Display first step of custom header image page. |
| [Custom\_Image\_Header::step\_2()](../classes/custom_image_header/step_2) wp-admin/includes/class-custom-image-header.php | Display second step of custom header image page. |
| [confirm\_delete\_users()](confirm_delete_users) wp-admin/includes/ms.php | |
| [list\_core\_update()](list_core_update) wp-admin/update-core.php | Lists available core updates. |
| [list\_plugin\_updates()](list_plugin_updates) wp-admin/update-core.php | Display the upgrade plugins form. |
| [list\_theme\_updates()](list_theme_updates) wp-admin/update-core.php | Display the upgrade themes form. |
| [list\_translation\_updates()](list_translation_updates) wp-admin/update-core.php | Display the update translations form. |
| [Custom\_Background::admin\_page()](../classes/custom_background/admin_page) wp-admin/includes/class-custom-background.php | Displays the custom background page. |
| [signup\_nonce\_fields()](signup_nonce_fields) wp-includes/ms-functions.php | Adds a nonce field to the signup page. |
| [wp\_comment\_form\_unfiltered\_html\_nonce()](wp_comment_form_unfiltered_html_nonce) wp-includes/comment-template.php | Displays form token for unfiltered comments. |
| [\_WP\_Editors::wp\_link\_dialog()](../classes/_wp_editors/wp_link_dialog) wp-includes/class-wp-editor.php | Dialog for internal linking. |
| Version | Description |
| --- | --- |
| [2.0.4](https://developer.wordpress.org/reference/since/2.0.4/) | Introduced. |
| programming_docs |
wordpress the_feed_link( string $anchor, string $feed = '' ) the\_feed\_link( string $anchor, string $feed = '' )
====================================================
Displays the permalink for the feed type.
`$anchor` string Required The link's anchor text. `$feed` string Optional Feed type. Possible values include `'rss2'`, `'atom'`.
Default is the value of [get\_default\_feed()](get_default_feed) . Default: `''`
File: `wp-includes/link-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/link-template.php/)
```
function the_feed_link( $anchor, $feed = '' ) {
$link = '<a href="' . esc_url( get_feed_link( $feed ) ) . '">' . $anchor . '</a>';
/**
* Filters the feed link anchor tag.
*
* @since 3.0.0
*
* @param string $link The complete anchor tag for a feed link.
* @param string $feed The feed type. Possible values include 'rss2', 'atom',
* or an empty string for the default feed type.
*/
echo apply_filters( 'the_feed_link', $link, $feed );
}
```
[apply\_filters( 'the\_feed\_link', string $link, string $feed )](../hooks/the_feed_link)
Filters the feed link anchor tag.
| Uses | Description |
| --- | --- |
| [get\_feed\_link()](get_feed_link) wp-includes/link-template.php | Retrieves the permalink for the feed type. |
| [esc\_url()](esc_url) wp-includes/formatting.php | Checks and cleans a URL. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| Version | Description |
| --- | --- |
| [3.0.0](https://developer.wordpress.org/reference/since/3.0.0/) | Introduced. |
wordpress is_registered_sidebar( string|int $sidebar_id ): bool is\_registered\_sidebar( string|int $sidebar\_id ): bool
========================================================
Checks if a sidebar is registered.
`$sidebar_id` string|int Required The ID of the sidebar when it was registered. bool True if the sidebar is registered, false otherwise.
File: `wp-includes/widgets.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/widgets.php/)
```
function is_registered_sidebar( $sidebar_id ) {
global $wp_registered_sidebars;
return isset( $wp_registered_sidebars[ $sidebar_id ] );
}
```
| Used By | Description |
| --- | --- |
| [WP\_Customize\_Widgets::render\_widget\_partial()](../classes/wp_customize_widgets/render_widget_partial) wp-includes/class-wp-customize-widgets.php | Renders a specific widget using the supplied sidebar arguments. |
| [WP\_Customize\_Widgets::filter\_dynamic\_sidebar\_params()](../classes/wp_customize_widgets/filter_dynamic_sidebar_params) wp-includes/class-wp-customize-widgets.php | Inject selective refresh data attributes into widget container elements. |
| [register\_sidebars()](register_sidebars) wp-includes/widgets.php | Creates multiple sidebars. |
| [WP\_Customize\_Widgets::tally\_sidebars\_via\_is\_active\_sidebar\_calls()](../classes/wp_customize_widgets/tally_sidebars_via_is_active_sidebar_calls) wp-includes/class-wp-customize-widgets.php | Tallies the sidebars rendered via [is\_active\_sidebar()](is_active_sidebar) . |
| [WP\_Customize\_Widgets::tally\_sidebars\_via\_dynamic\_sidebar\_calls()](../classes/wp_customize_widgets/tally_sidebars_via_dynamic_sidebar_calls) wp-includes/class-wp-customize-widgets.php | Tallies the sidebars rendered via [dynamic\_sidebar()](dynamic_sidebar) . |
| [WP\_Customize\_Widgets::customize\_register()](../classes/wp_customize_widgets/customize_register) wp-includes/class-wp-customize-widgets.php | Registers Customizer settings and controls for all sidebars and widgets. |
| Version | Description |
| --- | --- |
| [4.4.0](https://developer.wordpress.org/reference/since/4.4.0/) | Introduced. |
wordpress sanitize_category( object|array $category, string $context = 'display' ): object|array sanitize\_category( object|array $category, string $context = 'display' ): object|array
=======================================================================================
Sanitizes category data based on context.
`$category` object|array Required Category data. `$context` string Optional Default `'display'`. Default: `'display'`
object|array Same type as $category with sanitized data for safe use.
File: `wp-includes/category.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/category.php/)
```
function sanitize_category( $category, $context = 'display' ) {
return sanitize_term( $category, 'category', $context );
}
```
| Uses | Description |
| --- | --- |
| [sanitize\_term()](sanitize_term) wp-includes/taxonomy.php | Sanitizes all term fields. |
| Version | Description |
| --- | --- |
| [2.3.0](https://developer.wordpress.org/reference/since/2.3.0/) | Introduced. |
wordpress wp_get_loading_attr_default( string $context ): string|bool wp\_get\_loading\_attr\_default( string $context ): string|bool
===============================================================
Gets the default value to use for a `loading` attribute on an element.
This function should only be called for a tag and context if lazy-loading is generally enabled.
The function usually returns ‘lazy’, but uses certain heuristics to guess whether the current element is likely to appear above the fold, in which case it returns a boolean `false`, which will lead to the `loading` attribute being omitted on the element. The purpose of this refinement is to avoid lazy-loading elements that are within the initial viewport, which can have a negative performance impact.
Under the hood, the function uses [wp\_increase\_content\_media\_count()](wp_increase_content_media_count) every time it is called for an element within the main content. If the element is the very first content element, the `loading` attribute will be omitted.
This default threshold of 1 content element to omit the `loading` attribute for can be customized using the [‘wp\_omit\_loading\_attr\_threshold’](../hooks/wp_omit_loading_attr_threshold) filter.
`$context` string Required Context for the element for which the `loading` attribute value is requested. string|bool The default `loading` attribute value. Either `'lazy'`, `'eager'`, or a boolean `false`, to indicate that the `loading` attribute should be skipped.
File: `wp-includes/media.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/media.php/)
```
function wp_get_loading_attr_default( $context ) {
// Only elements with 'the_content' or 'the_post_thumbnail' context have special handling.
if ( 'the_content' !== $context && 'the_post_thumbnail' !== $context ) {
return 'lazy';
}
// Only elements within the main query loop have special handling.
if ( is_admin() || ! in_the_loop() || ! is_main_query() ) {
return 'lazy';
}
// Increase the counter since this is a main query content element.
$content_media_count = wp_increase_content_media_count();
// If the count so far is below the threshold, return `false` so that the `loading` attribute is omitted.
if ( $content_media_count <= wp_omit_loading_attr_threshold() ) {
return false;
}
// For elements after the threshold, lazy-load them as usual.
return 'lazy';
}
```
| Uses | Description |
| --- | --- |
| [wp\_increase\_content\_media\_count()](wp_increase_content_media_count) wp-includes/media.php | Increases an internal content media count variable. |
| [wp\_omit\_loading\_attr\_threshold()](wp_omit_loading_attr_threshold) wp-includes/media.php | Gets the threshold for how many of the first content media elements to not lazy-load. |
| [in\_the\_loop()](in_the_loop) wp-includes/query.php | Determines whether the caller is in the Loop. |
| [is\_main\_query()](is_main_query) wp-includes/query.php | Determines whether the query is the main query. |
| [is\_admin()](is_admin) wp-includes/load.php | Determines whether the current request is for an administrative interface page. |
| Used By | Description |
| --- | --- |
| [wp\_iframe\_tag\_add\_loading\_attr()](wp_iframe_tag_add_loading_attr) wp-includes/media.php | Adds `loading` attribute to an `iframe` HTML tag. |
| [wp\_img\_tag\_add\_loading\_attr()](wp_img_tag_add_loading_attr) wp-includes/media.php | Adds `loading` attribute to an `img` HTML tag. |
| [get\_avatar()](get_avatar) wp-includes/pluggable.php | Retrieves the avatar `<img>` tag for a user, email address, MD5 hash, comment, or post. |
| [get\_the\_post\_thumbnail()](get_the_post_thumbnail) wp-includes/post-thumbnail-template.php | Retrieves the post thumbnail. |
| [wp\_get\_attachment\_image()](wp_get_attachment_image) wp-includes/media.php | Gets an HTML img element representing an image attachment. |
| Version | Description |
| --- | --- |
| [5.9.0](https://developer.wordpress.org/reference/since/5.9.0/) | Introduced. |
wordpress get_default_post_to_edit( string $post_type = 'post', bool $create_in_db = false ): WP_Post get\_default\_post\_to\_edit( string $post\_type = 'post', bool $create\_in\_db = false ): WP\_Post
===================================================================================================
Returns default post information to use when populating the “Write Post” form.
`$post_type` string Optional A post type string. Default `'post'`. Default: `'post'`
`$create_in_db` bool Optional Whether to insert the post into database. Default: `false`
[WP\_Post](../classes/wp_post) Post object containing all the default post data as attributes
File: `wp-admin/includes/post.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/post.php/)
```
function get_default_post_to_edit( $post_type = 'post', $create_in_db = false ) {
$post_title = '';
if ( ! empty( $_REQUEST['post_title'] ) ) {
$post_title = esc_html( wp_unslash( $_REQUEST['post_title'] ) );
}
$post_content = '';
if ( ! empty( $_REQUEST['content'] ) ) {
$post_content = esc_html( wp_unslash( $_REQUEST['content'] ) );
}
$post_excerpt = '';
if ( ! empty( $_REQUEST['excerpt'] ) ) {
$post_excerpt = esc_html( wp_unslash( $_REQUEST['excerpt'] ) );
}
if ( $create_in_db ) {
$post_id = wp_insert_post(
array(
'post_title' => __( 'Auto Draft' ),
'post_type' => $post_type,
'post_status' => 'auto-draft',
),
false,
false
);
$post = get_post( $post_id );
if ( current_theme_supports( 'post-formats' ) && post_type_supports( $post->post_type, 'post-formats' ) && get_option( 'default_post_format' ) ) {
set_post_format( $post, get_option( 'default_post_format' ) );
}
wp_after_insert_post( $post, false, null );
// Schedule auto-draft cleanup.
if ( ! wp_next_scheduled( 'wp_scheduled_auto_draft_delete' ) ) {
wp_schedule_event( time(), 'daily', 'wp_scheduled_auto_draft_delete' );
}
} else {
$post = new stdClass;
$post->ID = 0;
$post->post_author = '';
$post->post_date = '';
$post->post_date_gmt = '';
$post->post_password = '';
$post->post_name = '';
$post->post_type = $post_type;
$post->post_status = 'draft';
$post->to_ping = '';
$post->pinged = '';
$post->comment_status = get_default_comment_status( $post_type );
$post->ping_status = get_default_comment_status( $post_type, 'pingback' );
$post->post_pingback = get_option( 'default_pingback_flag' );
$post->post_category = get_option( 'default_category' );
$post->page_template = 'default';
$post->post_parent = 0;
$post->menu_order = 0;
$post = new WP_Post( $post );
}
/**
* Filters the default post content initially used in the "Write Post" form.
*
* @since 1.5.0
*
* @param string $post_content Default post content.
* @param WP_Post $post Post object.
*/
$post->post_content = (string) apply_filters( 'default_content', $post_content, $post );
/**
* Filters the default post title initially used in the "Write Post" form.
*
* @since 1.5.0
*
* @param string $post_title Default post title.
* @param WP_Post $post Post object.
*/
$post->post_title = (string) apply_filters( 'default_title', $post_title, $post );
/**
* Filters the default post excerpt initially used in the "Write Post" form.
*
* @since 1.5.0
*
* @param string $post_excerpt Default post excerpt.
* @param WP_Post $post Post object.
*/
$post->post_excerpt = (string) apply_filters( 'default_excerpt', $post_excerpt, $post );
return $post;
}
```
[apply\_filters( 'default\_content', string $post\_content, WP\_Post $post )](../hooks/default_content)
Filters the default post content initially used in the “Write Post” form.
[apply\_filters( 'default\_excerpt', string $post\_excerpt, WP\_Post $post )](../hooks/default_excerpt)
Filters the default post excerpt initially used in the “Write Post” form.
[apply\_filters( 'default\_title', string $post\_title, WP\_Post $post )](../hooks/default_title)
Filters the default post title initially used in the “Write Post” form.
| Uses | Description |
| --- | --- |
| [wp\_after\_insert\_post()](wp_after_insert_post) wp-includes/post.php | Fires actions after a post, its terms and meta data has been saved. |
| [get\_default\_comment\_status()](get_default_comment_status) wp-includes/comment.php | Gets the default comment status for a post type. |
| [wp\_next\_scheduled()](wp_next_scheduled) wp-includes/cron.php | Retrieve the next timestamp for an event. |
| [wp\_schedule\_event()](wp_schedule_event) wp-includes/cron.php | Schedules a recurring event. |
| [WP\_Post::\_\_construct()](../classes/wp_post/__construct) wp-includes/class-wp-post.php | Constructor. |
| [wp\_insert\_post()](wp_insert_post) wp-includes/post.php | Inserts or update a post. |
| [post\_type\_supports()](post_type_supports) wp-includes/post.php | Checks a post type’s support for a given feature. |
| [set\_post\_format()](set_post_format) wp-includes/post-formats.php | Assign a format to a post |
| [current\_theme\_supports()](current_theme_supports) wp-includes/theme.php | Checks a theme’s support for a given feature. |
| [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. |
| [wp\_unslash()](wp_unslash) wp-includes/formatting.php | Removes slashes from a string or recursively removes slashes from strings within an array. |
| [esc\_html()](esc_html) wp-includes/formatting.php | Escaping for HTML blocks. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| [get\_option()](get_option) wp-includes/option.php | Retrieves an option value based on an option name. |
| [get\_post()](get_post) wp-includes/post.php | Retrieves post data given a post ID or post object. |
| Used By | Description |
| --- | --- |
| [get\_default\_page\_to\_edit()](get_default_page_to_edit) wp-admin/includes/deprecated.php | Gets the default page information to use. |
| [wp\_dashboard\_quick\_press()](wp_dashboard_quick_press) wp-admin/includes/dashboard.php | The Quick Draft widget display and creation of drafts. |
| [WP\_Posts\_List\_Table::inline\_edit()](../classes/wp_posts_list_table/inline_edit) wp-admin/includes/class-wp-posts-list-table.php | Outputs the hidden row displayed when inline editing |
| [wp\_xmlrpc\_server::mw\_newPost()](../classes/wp_xmlrpc_server/mw_newpost) wp-includes/class-wp-xmlrpc-server.php | Create a new post. |
| [wp\_xmlrpc\_server::\_insert\_post()](../classes/wp_xmlrpc_server/_insert_post) wp-includes/class-wp-xmlrpc-server.php | Helper method for wp\_newPost() and wp\_editPost(), containing shared logic. |
| Version | Description |
| --- | --- |
| [2.0.0](https://developer.wordpress.org/reference/since/2.0.0/) | Introduced. |
wordpress get_core_updates( array $options = array() ): array|false get\_core\_updates( array $options = array() ): array|false
===========================================================
Gets available core updates.
`$options` array Optional Set $options[`'dismissed'`] to true to show dismissed upgrades too, set $options[`'available'`] to false to skip not-dismissed updates. Default: `array()`
array|false Array of the update objects on success, false on failure.
File: `wp-admin/includes/update.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/update.php/)
```
function get_core_updates( $options = array() ) {
$options = array_merge(
array(
'available' => true,
'dismissed' => false,
),
$options
);
$dismissed = get_site_option( 'dismissed_update_core' );
if ( ! is_array( $dismissed ) ) {
$dismissed = array();
}
$from_api = get_site_transient( 'update_core' );
if ( ! isset( $from_api->updates ) || ! is_array( $from_api->updates ) ) {
return false;
}
$updates = $from_api->updates;
$result = array();
foreach ( $updates as $update ) {
if ( 'autoupdate' === $update->response ) {
continue;
}
if ( array_key_exists( $update->current . '|' . $update->locale, $dismissed ) ) {
if ( $options['dismissed'] ) {
$update->dismissed = true;
$result[] = $update;
}
} else {
if ( $options['available'] ) {
$update->dismissed = false;
$result[] = $update;
}
}
}
return $result;
}
```
| Uses | Description |
| --- | --- |
| [get\_site\_transient()](get_site_transient) wp-includes/option.php | Retrieves the value of a site transient. |
| [get\_site\_option()](get_site_option) wp-includes/option.php | Retrieve an option value for the current network based on name of option. |
| Used By | Description |
| --- | --- |
| [core\_auto\_updates\_settings()](core_auto_updates_settings) wp-admin/update-core.php | Display WordPress auto-updates settings. |
| [WP\_Debug\_Data::debug\_data()](../classes/wp_debug_data/debug_data) wp-admin/includes/class-wp-debug-data.php | Static function for generating site debug data when required. |
| [WP\_Site\_Health::get\_test\_wordpress\_version()](../classes/wp_site_health/get_test_wordpress_version) wp-admin/includes/class-wp-site-health.php | Tests for WordPress version and outputs it. |
| [get\_preferred\_from\_update\_core()](get_preferred_from_update_core) wp-admin/includes/update.php | Selects the first update version from the update\_core option. |
| [list\_core\_update()](list_core_update) wp-admin/update-core.php | Lists available core updates. |
| [dismissed\_updates()](dismissed_updates) wp-admin/update-core.php | Display dismissed updates. |
| [core\_upgrade\_preamble()](core_upgrade_preamble) wp-admin/update-core.php | Display upgrade WordPress for downloading latest or upgrading automatically form. |
| [list\_plugin\_updates()](list_plugin_updates) wp-admin/update-core.php | Display the upgrade plugins form. |
| [wp\_get\_update\_data()](wp_get_update_data) wp-includes/update.php | Collects counts and UI strings for available updates. |
| Version | Description |
| --- | --- |
| [2.7.0](https://developer.wordpress.org/reference/since/2.7.0/) | Introduced. |
wordpress count_users( string $strategy = 'time', int|null $site_id = null ): array count\_users( string $strategy = 'time', int|null $site\_id = null ): array
===========================================================================
Counts number of users who have each of the user roles.
Assumes there are neither duplicated nor orphaned capabilities meta\_values.
Assumes role names are unique phrases. Same assumption made by [WP\_User\_Query::prepare\_query()](../classes/wp_user_query/prepare_query) Using $strategy = ‘time’ this is CPU-intensive and should handle around 10^7 users.
Using $strategy = ‘memory’ this is memory-intensive and should handle around 10^5 users, but see WP Bug #12257.
`$strategy` string Optional The computational strategy to use when counting the users.
Accepts either `'time'` or `'memory'`. Default `'time'`. Default: `'time'`
`$site_id` int|null Optional The site ID to count users for. Defaults to the current site. Default: `null`
array User counts.
* `total_users`intTotal number of users on the site.
* `avail_roles`int[]Array of user counts keyed by user role.
File: `wp-includes/user.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/user.php/)
```
function count_users( $strategy = 'time', $site_id = null ) {
global $wpdb;
// Initialize.
if ( ! $site_id ) {
$site_id = get_current_blog_id();
}
/**
* Filters the user count before queries are run.
*
* Return a non-null value to cause count_users() to return early.
*
* @since 5.1.0
*
* @param null|array $result The value to return instead. Default null to continue with the query.
* @param string $strategy Optional. The computational strategy to use when counting the users.
* Accepts either 'time' or 'memory'. Default 'time'.
* @param int $site_id The site ID to count users for.
*/
$pre = apply_filters( 'pre_count_users', null, $strategy, $site_id );
if ( null !== $pre ) {
return $pre;
}
$blog_prefix = $wpdb->get_blog_prefix( $site_id );
$result = array();
if ( 'time' === $strategy ) {
if ( is_multisite() && get_current_blog_id() != $site_id ) {
switch_to_blog( $site_id );
$avail_roles = wp_roles()->get_names();
restore_current_blog();
} else {
$avail_roles = wp_roles()->get_names();
}
// Build a CPU-intensive query that will return concise information.
$select_count = array();
foreach ( $avail_roles as $this_role => $name ) {
$select_count[] = $wpdb->prepare( 'COUNT(NULLIF(`meta_value` LIKE %s, false))', '%' . $wpdb->esc_like( '"' . $this_role . '"' ) . '%' );
}
$select_count[] = "COUNT(NULLIF(`meta_value` = 'a:0:{}', false))";
$select_count = implode( ', ', $select_count );
// Add the meta_value index to the selection list, then run the query.
$row = $wpdb->get_row(
"
SELECT {$select_count}, COUNT(*)
FROM {$wpdb->usermeta}
INNER JOIN {$wpdb->users} ON user_id = ID
WHERE meta_key = '{$blog_prefix}capabilities'
",
ARRAY_N
);
// Run the previous loop again to associate results with role names.
$col = 0;
$role_counts = array();
foreach ( $avail_roles as $this_role => $name ) {
$count = (int) $row[ $col++ ];
if ( $count > 0 ) {
$role_counts[ $this_role ] = $count;
}
}
$role_counts['none'] = (int) $row[ $col++ ];
// Get the meta_value index from the end of the result set.
$total_users = (int) $row[ $col ];
$result['total_users'] = $total_users;
$result['avail_roles'] =& $role_counts;
} else {
$avail_roles = array(
'none' => 0,
);
$users_of_blog = $wpdb->get_col(
"
SELECT meta_value
FROM {$wpdb->usermeta}
INNER JOIN {$wpdb->users} ON user_id = ID
WHERE meta_key = '{$blog_prefix}capabilities'
"
);
foreach ( $users_of_blog as $caps_meta ) {
$b_roles = maybe_unserialize( $caps_meta );
if ( ! is_array( $b_roles ) ) {
continue;
}
if ( empty( $b_roles ) ) {
$avail_roles['none']++;
}
foreach ( $b_roles as $b_role => $val ) {
if ( isset( $avail_roles[ $b_role ] ) ) {
$avail_roles[ $b_role ]++;
} else {
$avail_roles[ $b_role ] = 1;
}
}
}
$result['total_users'] = count( $users_of_blog );
$result['avail_roles'] =& $avail_roles;
}
return $result;
}
```
[apply\_filters( 'pre\_count\_users', null|array $result, string $strategy, int $site\_id )](../hooks/pre_count_users)
Filters the user count before queries are run.
| Uses | Description |
| --- | --- |
| [wp\_roles()](wp_roles) wp-includes/capabilities.php | Retrieves the global [WP\_Roles](../classes/wp_roles) instance and instantiates it if necessary. |
| [wpdb::esc\_like()](../classes/wpdb/esc_like) wp-includes/class-wpdb.php | First half of escaping for `LIKE` special characters `%` and `_` before preparing for SQL. |
| [WP\_Roles::get\_names()](../classes/wp_roles/get_names) wp-includes/class-wp-roles.php | Retrieves a list of role names. |
| [maybe\_unserialize()](maybe_unserialize) wp-includes/functions.php | Unserializes data only if it was serialized. |
| [switch\_to\_blog()](switch_to_blog) wp-includes/ms-blogs.php | Switch the current blog. |
| [restore\_current\_blog()](restore_current_blog) wp-includes/ms-blogs.php | Restore the current blog, after calling [switch\_to\_blog()](switch_to_blog) . |
| [wpdb::get\_row()](../classes/wpdb/get_row) wp-includes/class-wpdb.php | Retrieves one row from the database. |
| [wpdb::get\_col()](../classes/wpdb/get_col) wp-includes/class-wpdb.php | Retrieves one column from the database. |
| [wpdb::get\_blog\_prefix()](../classes/wpdb/get_blog_prefix) wp-includes/class-wpdb.php | Gets blog prefix. |
| [get\_current\_blog\_id()](get_current_blog_id) wp-includes/load.php | Retrieve the current site ID. |
| [is\_multisite()](is_multisite) wp-includes/load.php | If Multisite is enabled. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| [wpdb::prepare()](../classes/wpdb/prepare) wp-includes/class-wpdb.php | Prepares a SQL query for safe execution. |
| Used By | Description |
| --- | --- |
| [WP\_Users\_List\_Table::get\_views()](../classes/wp_users_list_table/get_views) wp-admin/includes/class-wp-users-list-table.php | Return an associative array listing all the views that can be used with this table. |
| Version | Description |
| --- | --- |
| [4.9.0](https://developer.wordpress.org/reference/since/4.9.0/) | The `$site_id` parameter was added to support multisite. |
| [4.4.0](https://developer.wordpress.org/reference/since/4.4.0/) | The number of users with no role is now included in the `none` element. |
| [3.0.0](https://developer.wordpress.org/reference/since/3.0.0/) | Introduced. |
| programming_docs |
wordpress wp_validate_boolean( mixed $var ): bool wp\_validate\_boolean( mixed $var ): bool
=========================================
Filters/validates a variable as a boolean.
Alternative to `filter_var( $var, FILTER_VALIDATE_BOOLEAN )`.
`$var` mixed Required Boolean value to validate. bool Whether the value is validated.
File: `wp-includes/functions.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/functions.php/)
```
function wp_validate_boolean( $var ) {
if ( is_bool( $var ) ) {
return $var;
}
if ( is_string( $var ) && 'false' === strtolower( $var ) ) {
return false;
}
return (bool) $var;
}
```
| Used By | Description |
| --- | --- |
| [get\_term\_parents\_list()](get_term_parents_list) wp-includes/category-template.php | Retrieves term parents with separator. |
| [wp\_xmlrpc\_server::\_toggle\_sticky()](../classes/wp_xmlrpc_server/_toggle_sticky) wp-includes/class-wp-xmlrpc-server.php | Encapsulate the logic for sticking a post and determining if the user has permission to do so |
| [wp\_video\_shortcode()](wp_video_shortcode) wp-includes/media.php | Builds the Video shortcode output. |
| [wp\_playlist\_shortcode()](wp_playlist_shortcode) wp-includes/media.php | Builds the Playlist shortcode output. |
| [wp\_audio\_shortcode()](wp_audio_shortcode) wp-includes/media.php | Builds the Audio shortcode output. |
| Version | Description |
| --- | --- |
| [4.0.0](https://developer.wordpress.org/reference/since/4.0.0/) | Introduced. |
wordpress register_rest_field( string|array $object_type, string $attribute, array $args = array() ) register\_rest\_field( string|array $object\_type, string $attribute, array $args = array() )
=============================================================================================
Registers a new field on an existing WordPress object type.
`$object_type` string|array Required Object(s) the field is being registered to, "post"|"term"|"comment" etc. `$attribute` string Required The attribute name. `$args` array Optional An array of arguments used to handle the registered field.
* `get_callback`callable|nullOptional. The callback function used to retrieve the field value. Default is `'null'`, the field will not be returned in the response. The function will be passed the prepared object data.
* `update_callback`callable|nullOptional. The callback function used to set and update the field value. Default is `'null'`, the value cannot be set or updated. The function will be passed the model object, like [WP\_Post](../classes/wp_post).
* `schema`array|nullOptional. The schema for this field.
Default is `'null'`, no schema entry will be returned.
Default: `array()`
File: `wp-includes/rest-api.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/rest-api.php/)
```
function register_rest_field( $object_type, $attribute, $args = array() ) {
global $wp_rest_additional_fields;
$defaults = array(
'get_callback' => null,
'update_callback' => null,
'schema' => null,
);
$args = wp_parse_args( $args, $defaults );
$object_types = (array) $object_type;
foreach ( $object_types as $object_type ) {
$wp_rest_additional_fields[ $object_type ][ $attribute ] = $args;
}
}
```
| Uses | Description |
| --- | --- |
| [wp\_parse\_args()](wp_parse_args) wp-includes/functions.php | Merges user defined arguments into defaults array. |
| Used By | Description |
| --- | --- |
| [WP\_REST\_Meta\_Fields::register\_field()](../classes/wp_rest_meta_fields/register_field) wp-includes/rest-api/fields/class-wp-rest-meta-fields.php | Registers the meta field. |
| Version | Description |
| --- | --- |
| [4.7.0](https://developer.wordpress.org/reference/since/4.7.0/) | Introduced. |
wordpress rest_is_ip_address( string $ip ): string|false rest\_is\_ip\_address( string $ip ): string|false
=================================================
Determines if an IP address is valid.
Handles both IPv4 and IPv6 addresses.
`$ip` string Required IP address. string|false The valid IP address, otherwise false.
File: `wp-includes/rest-api.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/rest-api.php/)
```
function rest_is_ip_address( $ip ) {
$ipv4_pattern = '/^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/';
if ( ! preg_match( $ipv4_pattern, $ip ) && ! Requests_IPv6::check_ipv6( $ip ) ) {
return false;
}
return $ip;
}
```
| Uses | Description |
| --- | --- |
| [Requests\_IPv6::check\_ipv6()](../classes/requests_ipv6/check_ipv6) wp-includes/Requests/IPv6.php | Checks an IPv6 address |
| Used By | Description |
| --- | --- |
| [rest\_validate\_value\_from\_schema()](rest_validate_value_from_schema) wp-includes/rest-api.php | Validate a value based on a schema. |
| [WP\_REST\_Comments\_Controller::prepare\_item\_for\_database()](../classes/wp_rest_comments_controller/prepare_item_for_database) wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php | Prepares a single comment to be inserted into the database. |
| Version | Description |
| --- | --- |
| [4.7.0](https://developer.wordpress.org/reference/since/4.7.0/) | Introduced. |
wordpress do_feed_atom( bool $for_comments ) do\_feed\_atom( bool $for\_comments )
=====================================
Loads either Atom comment feed or Atom posts feed.
* [load\_template()](load_template)
`$for_comments` bool Required True for the comment feed, false for normal feed. File: `wp-includes/functions.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/functions.php/)
```
function do_feed_atom( $for_comments ) {
if ( $for_comments ) {
load_template( ABSPATH . WPINC . '/feed-atom-comments.php' );
} else {
load_template( ABSPATH . WPINC . '/feed-atom.php' );
}
}
```
| Uses | Description |
| --- | --- |
| [load\_template()](load_template) wp-includes/template.php | Requires the template file with WordPress environment. |
| Version | Description |
| --- | --- |
| [2.1.0](https://developer.wordpress.org/reference/since/2.1.0/) | Introduced. |
wordpress comment_author( int|WP_Comment $comment_ID ) comment\_author( int|WP\_Comment $comment\_ID )
===============================================
Displays the author of the current comment.
`$comment_ID` int|[WP\_Comment](../classes/wp_comment) Optional [WP\_Comment](../classes/wp_comment) or the ID of the comment for which to print the author.
Default current comment. If no name is provided (and “User must fill out name and email” is not enabled under [Discussion Options](https://wordpress.org/support/article/settings-discussion-screen/)), WordPress will assign “Anonymous” as comment author.
File: `wp-includes/comment-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/comment-template.php/)
```
function comment_author( $comment_ID = 0 ) {
$comment = get_comment( $comment_ID );
$author = get_comment_author( $comment );
/**
* Filters the comment author's name for display.
*
* @since 1.2.0
* @since 4.1.0 The `$comment_ID` parameter was added.
*
* @param string $author The comment author's username.
* @param string $comment_ID The comment ID as a numeric string.
*/
echo apply_filters( 'comment_author', $author, $comment->comment_ID );
}
```
[apply\_filters( 'comment\_author', string $author, string $comment\_ID )](../hooks/comment_author)
Filters the comment author’s name for display.
| Uses | Description |
| --- | --- |
| [get\_comment\_author()](get_comment_author) wp-includes/comment-template.php | Retrieves the author of the current comment. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| [get\_comment()](get_comment) wp-includes/comment.php | Retrieves comment data given a comment ID or comment object. |
| Used By | Description |
| --- | --- |
| [WP\_Comments\_List\_Table::column\_author()](../classes/wp_comments_list_table/column_author) wp-admin/includes/class-wp-comments-list-table.php | |
| Version | Description |
| --- | --- |
| [4.4.0](https://developer.wordpress.org/reference/since/4.4.0/) | Added the ability for `$comment_ID` to also accept a [WP\_Comment](../classes/wp_comment) object. |
| [0.71](https://developer.wordpress.org/reference/since/0.71/) | Introduced. |
wordpress get_block_templates( array $query = array(), string $template_type = 'wp_template' ): array get\_block\_templates( array $query = array(), string $template\_type = 'wp\_template' ): array
===============================================================================================
Retrieves a list of unified template objects based on a query.
`$query` array Optional Arguments to retrieve templates.
* `slug__in`arrayList of slugs to include.
* `wp_id`intPost ID of customized template.
* `area`stringA `'wp_template_part_area'` taxonomy value to filter by (for wp\_template\_part template type only).
* `post_type`stringPost type to get the templates for.
Default: `array()`
`$template_type` string Optional `'wp_template'` or `'wp_template_part'`. Default: `'wp_template'`
array Templates.
File: `wp-includes/block-template-utils.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/block-template-utils.php/)
```
function get_block_templates( $query = array(), $template_type = 'wp_template' ) {
/**
* Filters the block templates array before the query takes place.
*
* Return a non-null value to bypass the WordPress queries.
*
* @since 5.9.0
*
* @param WP_Block_Template[]|null $block_templates Return an array of block templates to short-circuit the default query,
* or null to allow WP to run it's normal queries.
* @param array $query {
* Optional. Arguments to retrieve templates.
*
* @type array $slug__in List of slugs to include.
* @type int $wp_id Post ID of customized template.
* @type string $post_type Post type to get the templates for.
* }
* @param string $template_type wp_template or wp_template_part.
*/
$templates = apply_filters( 'pre_get_block_templates', null, $query, $template_type );
if ( ! is_null( $templates ) ) {
return $templates;
}
$post_type = isset( $query['post_type'] ) ? $query['post_type'] : '';
$wp_query_args = array(
'post_status' => array( 'auto-draft', 'draft', 'publish' ),
'post_type' => $template_type,
'posts_per_page' => -1,
'no_found_rows' => true,
'tax_query' => array(
array(
'taxonomy' => 'wp_theme',
'field' => 'name',
'terms' => wp_get_theme()->get_stylesheet(),
),
),
);
if ( 'wp_template_part' === $template_type && isset( $query['area'] ) ) {
$wp_query_args['tax_query'][] = array(
'taxonomy' => 'wp_template_part_area',
'field' => 'name',
'terms' => $query['area'],
);
$wp_query_args['tax_query']['relation'] = 'AND';
}
if ( isset( $query['slug__in'] ) ) {
$wp_query_args['post_name__in'] = $query['slug__in'];
}
// This is only needed for the regular templates/template parts post type listing and editor.
if ( isset( $query['wp_id'] ) ) {
$wp_query_args['p'] = $query['wp_id'];
} else {
$wp_query_args['post_status'] = 'publish';
}
$template_query = new WP_Query( $wp_query_args );
$query_result = array();
foreach ( $template_query->posts as $post ) {
$template = _build_block_template_result_from_post( $post );
if ( is_wp_error( $template ) ) {
continue;
}
if ( $post_type && ! $template->is_custom ) {
continue;
}
if (
$post_type &&
isset( $template->post_types ) &&
! in_array( $post_type, $template->post_types, true )
) {
continue;
}
$query_result[] = $template;
}
if ( ! isset( $query['wp_id'] ) ) {
$template_files = _get_block_templates_files( $template_type );
foreach ( $template_files as $template_file ) {
$template = _build_block_template_result_from_file( $template_file, $template_type );
if ( $post_type && ! $template->is_custom ) {
continue;
}
if ( $post_type &&
isset( $template->post_types ) &&
! in_array( $post_type, $template->post_types, true )
) {
continue;
}
$is_not_custom = false === array_search(
wp_get_theme()->get_stylesheet() . '//' . $template_file['slug'],
wp_list_pluck( $query_result, 'id' ),
true
);
$fits_slug_query =
! isset( $query['slug__in'] ) || in_array( $template_file['slug'], $query['slug__in'], true );
$fits_area_query =
! isset( $query['area'] ) || $template_file['area'] === $query['area'];
$should_include = $is_not_custom && $fits_slug_query && $fits_area_query;
if ( $should_include ) {
$query_result[] = $template;
}
}
}
/**
* Filters the array of queried block templates array after they've been fetched.
*
* @since 5.9.0
*
* @param WP_Block_Template[] $query_result Array of found block templates.
* @param array $query {
* Optional. Arguments to retrieve templates.
*
* @type array $slug__in List of slugs to include.
* @type int $wp_id Post ID of customized template.
* }
* @param string $template_type wp_template or wp_template_part.
*/
return apply_filters( 'get_block_templates', $query_result, $query, $template_type );
}
```
[apply\_filters( 'get\_block\_templates', WP\_Block\_Template[] $query\_result, array $query, string $template\_type )](../hooks/get_block_templates)
Filters the array of queried block templates array after they’ve been fetched.
[apply\_filters( 'pre\_get\_block\_templates', WP\_Block\_Template[]|null $block\_templates, array $query, string $template\_type )](../hooks/pre_get_block_templates)
Filters the block templates array before the query takes place.
| Uses | Description |
| --- | --- |
| [\_build\_block\_template\_result\_from\_post()](_build_block_template_result_from_post) wp-includes/block-template-utils.php | Builds a unified template object based a post Object. |
| [\_build\_block\_template\_result\_from\_file()](_build_block_template_result_from_file) wp-includes/block-template-utils.php | Builds a unified template object based on a theme file. |
| [\_get\_block\_templates\_files()](_get_block_templates_files) wp-includes/block-template-utils.php | Retrieves the template files from the theme. |
| [WP\_Theme::get\_stylesheet()](../classes/wp_theme/get_stylesheet) wp-includes/class-wp-theme.php | Returns the directory name of the theme’s “stylesheet” files, inside the theme root. |
| [WP\_Query::\_\_construct()](../classes/wp_query/__construct) wp-includes/class-wp-query.php | Constructor. |
| [wp\_list\_pluck()](wp_list_pluck) wp-includes/functions.php | Plucks a certain field out of each object or array in an array. |
| [wp\_get\_theme()](wp_get_theme) wp-includes/theme.php | Gets a [WP\_Theme](../classes/wp_theme) object for a theme. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| [is\_wp\_error()](is_wp_error) wp-includes/load.php | Checks whether the given variable is a WordPress Error. |
| Used By | Description |
| --- | --- |
| [wp\_generate\_block\_templates\_export\_file()](wp_generate_block_templates_export_file) wp-includes/block-template-utils.php | Creates an export of the current templates and template parts from the site editor at the specified path in a ZIP file. |
| [WP\_REST\_Templates\_Controller::get\_items()](../classes/wp_rest_templates_controller/get_items) wp-includes/rest-api/endpoints/class-wp-rest-templates-controller.php | Returns a list of templates. |
| [WP\_REST\_Templates\_Controller::create\_item()](../classes/wp_rest_templates_controller/create_item) wp-includes/rest-api/endpoints/class-wp-rest-templates-controller.php | Creates a single template. |
| [resolve\_block\_template()](resolve_block_template) wp-includes/block-template.php | Returns the correct ‘wp\_template’ to render for the request template type. |
| [WP\_Theme::get\_post\_templates()](../classes/wp_theme/get_post_templates) wp-includes/class-wp-theme.php | Returns the theme’s post templates. |
| Version | Description |
| --- | --- |
| [5.8.0](https://developer.wordpress.org/reference/since/5.8.0/) | Introduced. |
wordpress _get_non_cached_ids( int[] $object_ids, string $cache_key ): int[] \_get\_non\_cached\_ids( int[] $object\_ids, string $cache\_key ): int[]
========================================================================
Retrieves IDs that are not already present in the cache.
`$object_ids` int[] Required Array of IDs. `$cache_key` string Required The cache bucket to check against. int[] Array of IDs not present in the cache.
File: `wp-includes/functions.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/functions.php/)
```
function _get_non_cached_ids( $object_ids, $cache_key ) {
$non_cached_ids = array();
$cache_values = wp_cache_get_multiple( $object_ids, $cache_key );
foreach ( $cache_values as $id => $value ) {
if ( ! $value ) {
$non_cached_ids[] = (int) $id;
}
}
return $non_cached_ids;
}
```
| Uses | Description |
| --- | --- |
| [wp\_cache\_get\_multiple()](wp_cache_get_multiple) wp-includes/cache.php | Retrieves multiple values from the cache in one call. |
| Used By | Description |
| --- | --- |
| [\_prime\_term\_caches()](_prime_term_caches) wp-includes/taxonomy.php | Adds any terms from the given IDs to the cache that do not already exist in cache. |
| [\_prime\_network\_caches()](_prime_network_caches) wp-includes/ms-network.php | Adds any networks from the given IDs to the cache that do not already exist in cache. |
| [\_prime\_site\_caches()](_prime_site_caches) wp-includes/ms-site.php | Adds any sites from the given IDs to the cache that do not already exist in cache. |
| [\_prime\_comment\_caches()](_prime_comment_caches) wp-includes/comment.php | Adds any comments from the given IDs to the cache that do not already exist in cache. |
| [cache\_users()](cache_users) wp-includes/pluggable.php | Retrieves info for user lists to prevent multiple queries by [get\_userdata()](get_userdata) . |
| [\_prime\_post\_caches()](_prime_post_caches) wp-includes/post.php | Adds any posts from the given IDs to the cache that do not already exist in cache. |
| Version | Description |
| --- | --- |
| [6.1.0](https://developer.wordpress.org/reference/since/6.1.0/) | This function is no longer marked as "private". |
| [3.4.0](https://developer.wordpress.org/reference/since/3.4.0/) | Introduced. |
wordpress wp_cache_flush(): bool wp\_cache\_flush(): bool
========================
Removes all cache items.
* [WP\_Object\_Cache::flush()](../classes/wp_object_cache/flush)
bool True on success, false on failure.
File: `wp-includes/cache.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/cache.php/)
```
function wp_cache_flush() {
global $wp_object_cache;
return $wp_object_cache->flush();
}
```
| Uses | Description |
| --- | --- |
| [WP\_Object\_Cache::flush()](../classes/wp_object_cache/flush) wp-includes/class-wp-object-cache.php | Clears the object cache of all data. |
| Used By | Description |
| --- | --- |
| [wp\_cache\_flush\_runtime()](wp_cache_flush_runtime) wp-includes/cache.php | Removes all cache items from the in-memory runtime cache. |
| [wp\_upgrade()](wp_upgrade) wp-admin/includes/upgrade.php | Runs WordPress Upgrade functions. |
| [wp\_install()](wp_install) wp-admin/includes/upgrade.php | Installs the site. |
| [update\_core()](update_core) wp-admin/includes/update-core.php | Upgrades the core of WordPress. |
| Version | Description |
| --- | --- |
| [2.0.0](https://developer.wordpress.org/reference/since/2.0.0/) | Introduced. |
| programming_docs |
wordpress wp_maybe_update_network_site_counts( int|null $network_id = null ) wp\_maybe\_update\_network\_site\_counts( int|null $network\_id = null )
========================================================================
Updates the count of sites for the current network.
If enabled through the [‘enable\_live\_network\_counts’](../hooks/enable_live_network_counts) filter, update the sites count on a network when a site is created or its status is updated.
`$network_id` int|null Optional ID of the network. Default is the current network. Default: `null`
File: `wp-includes/ms-functions.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/ms-functions.php/)
```
function wp_maybe_update_network_site_counts( $network_id = null ) {
$is_small_network = ! wp_is_large_network( 'sites', $network_id );
/**
* Filters whether to update network site or user counts when a new site is created.
*
* @since 3.7.0
*
* @see wp_is_large_network()
*
* @param bool $small_network Whether the network is considered small.
* @param string $context Context. Either 'users' or 'sites'.
*/
if ( ! apply_filters( 'enable_live_network_counts', $is_small_network, 'sites' ) ) {
return;
}
wp_update_network_site_counts( $network_id );
}
```
[apply\_filters( 'enable\_live\_network\_counts', bool $small\_network, string $context )](../hooks/enable_live_network_counts)
Filters whether to update network site or user counts when a new site is created.
| Uses | Description |
| --- | --- |
| [wp\_update\_network\_site\_counts()](wp_update_network_site_counts) wp-includes/ms-functions.php | Updates the network-wide site count. |
| [wp\_is\_large\_network()](wp_is_large_network) wp-includes/ms-functions.php | Determines whether or not we have a large network. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| Used By | Description |
| --- | --- |
| [wp\_maybe\_update\_network\_site\_counts\_on\_update()](wp_maybe_update_network_site_counts_on_update) wp-includes/ms-site.php | Updates the count of sites for a network based on a changed site. |
| Version | Description |
| --- | --- |
| [4.8.0](https://developer.wordpress.org/reference/since/4.8.0/) | The `$network_id` parameter has been added. |
| [3.7.0](https://developer.wordpress.org/reference/since/3.7.0/) | Introduced. |
wordpress _cleanup_header_comment( string $str ): string \_cleanup\_header\_comment( string $str ): string
=================================================
This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness. Use [https://core.trac.wordpress.org/ticket/8497](httpscore-trac-wordpress-orgticket8497) instead.
Strips close comment and close php tags from file headers used by WP.
* <https://core.trac.wordpress.org/ticket/8497>
`$str` string Required Header comment to clean up. string
File: `wp-includes/functions.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/functions.php/)
```
function _cleanup_header_comment( $str ) {
return trim( preg_replace( '/\s*(?:\*\/|\?>).*/', '', $str ) );
}
```
| Used By | Description |
| --- | --- |
| [WP\_Theme::get\_post\_templates()](../classes/wp_theme/get_post_templates) wp-includes/class-wp-theme.php | Returns the theme’s post templates. |
| [get\_file\_description()](get_file_description) wp-admin/includes/file.php | Gets the description for standard WordPress theme files. |
| [get\_file\_data()](get_file_data) wp-includes/functions.php | Retrieves metadata from a file. |
| Version | Description |
| --- | --- |
| [2.8.0](https://developer.wordpress.org/reference/since/2.8.0/) | Introduced. |
wordpress remove_filter( string $hook_name, callable|string|array $callback, int $priority = 10 ): bool remove\_filter( string $hook\_name, callable|string|array $callback, int $priority = 10 ): bool
===============================================================================================
Removes a callback function from a filter hook.
This can be used to remove default functions attached to a specific filter hook and possibly replace them with a substitute.
To remove a hook, the `$callback` and `$priority` arguments must match when the hook was added. This goes for both filters and actions. No warning will be given on removal failure.
`$hook_name` string Required The filter hook to which the function to be removed is hooked. `$callback` callable|string|array Required The callback to be removed from running when the filter is applied.
This function can be called unconditionally to speculatively remove a callback that may or may not exist. `$priority` int Optional The exact priority used when adding the original filter callback. Default: `10`
bool Whether the function existed before it was removed.
File: `wp-includes/plugin.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/plugin.php/)
```
function remove_filter( $hook_name, $callback, $priority = 10 ) {
global $wp_filter;
$r = false;
if ( isset( $wp_filter[ $hook_name ] ) ) {
$r = $wp_filter[ $hook_name ]->remove_filter( $hook_name, $callback, $priority );
if ( ! $wp_filter[ $hook_name ]->callbacks ) {
unset( $wp_filter[ $hook_name ] );
}
}
return $r;
}
```
| Used By | Description |
| --- | --- |
| [WP\_REST\_Menu\_Items\_Controller::prepare\_item\_for\_response()](../classes/wp_rest_menu_items_controller/prepare_item_for_response) wp-includes/rest-api/endpoints/class-wp-rest-menu-items-controller.php | Prepares a single post output for response. |
| [WP\_REST\_Global\_Styles\_Controller::prepare\_item\_for\_response()](../classes/wp_rest_global_styles_controller/prepare_item_for_response) wp-includes/rest-api/endpoints/class-wp-rest-global-styles-controller.php | Prepare a global styles config output for response. |
| [\_resolve\_template\_for\_new\_post()](_resolve_template_for_new_post) wp-includes/block-template.php | Sets the current [WP\_Query](../classes/wp_query) to return auto-draft posts. |
| [wp\_pre\_kses\_block\_attributes()](wp_pre_kses_block_attributes) wp-includes/formatting.php | Removes non-allowable HTML from parsed block attribute values when filtering in the post context. |
| [wp\_remove\_targeted\_link\_rel\_filters()](wp_remove_targeted_link_rel_filters) wp-includes/formatting.php | Removes all filters modifying the rel attribute of targeted links. |
| [WP\_REST\_Post\_Search\_Handler::prepare\_item()](../classes/wp_rest_post_search_handler/prepare_item) wp-includes/rest-api/search/class-wp-rest-post-search-handler.php | Prepares the search result for a given ID. |
| [do\_blocks()](do_blocks) wp-includes/blocks.php | Parses dynamic blocks out of `post_content` and re-renders them. |
| [\_restore\_wpautop\_hook()](_restore_wpautop_hook) wp-includes/blocks.php | If [do\_blocks()](do_blocks) needs to remove [wpautop()](wpautop) from the `the_content` filter, this re-adds it afterwards, for subsequent `the_content` usage. |
| [WP\_Widget\_Custom\_HTML::widget()](../classes/wp_widget_custom_html/widget) wp-includes/widgets/class-wp-widget-custom-html.php | Outputs the content for the current Custom HTML widget instance. |
| [WP\_Widget\_Media\_Video::render\_media()](../classes/wp_widget_media_video/render_media) wp-includes/widgets/class-wp-widget-media-video.php | Render the media on the frontend. |
| [WP\_Customize\_Manager::save\_changeset\_post()](../classes/wp_customize_manager/save_changeset_post) wp-includes/class-wp-customize-manager.php | Saves the post for the loaded changeset. |
| [WP\_REST\_Posts\_Controller::prepare\_item\_for\_response()](../classes/wp_rest_posts_controller/prepare_item_for_response) wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php | Prepares a single post output for response. |
| [WP\_REST\_Posts\_Controller::get\_items()](../classes/wp_rest_posts_controller/get_items) wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php | Retrieves a collection of posts. |
| [WP\_REST\_Comments\_Controller::check\_read\_post\_permission()](../classes/wp_rest_comments_controller/check_read_post_permission) wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php | Checks if the post can be read. |
| [WP\_Taxonomy::remove\_hooks()](../classes/wp_taxonomy/remove_hooks) wp-includes/class-wp-taxonomy.php | Removes the ajax callback for the meta box. |
| [WP\_Customize\_Nav\_Menus::insert\_auto\_draft\_post()](../classes/wp_customize_nav_menus/insert_auto_draft_post) wp-includes/class-wp-customize-nav-menus.php | Adds a new `auto-draft` post. |
| [\_filter\_query\_attachment\_filenames()](_filter_query_attachment_filenames) wp-includes/deprecated.php | Filter the SQL clauses of an attachment query to include filenames. |
| [unregister\_meta\_key()](unregister_meta_key) wp-includes/meta.php | Unregisters a meta key from the list of registered keys. |
| [WP\_Metadata\_Lazyloader::reset\_queue()](../classes/wp_metadata_lazyloader/reset_queue) wp-includes/class-wp-metadata-lazyloader.php | Resets lazy-load queue for a given object type. |
| [WP\_Customize\_Widgets::render\_widget\_partial()](../classes/wp_customize_widgets/render_widget_partial) wp-includes/class-wp-customize-widgets.php | Renders a specific widget using the supplied sidebar arguments. |
| [wp\_handle\_comment\_submission()](wp_handle_comment_submission) wp-includes/comment.php | Handles the submission of a comment, usually posted to wp-comments-post.php via a comment form. |
| [WP\_Customize\_Nav\_Menus::customize\_register()](../classes/wp_customize_nav_menus/customize_register) wp-includes/class-wp-customize-nav-menus.php | Adds the customizer settings and controls. |
| [wp\_ajax\_crop\_image()](wp_ajax_crop_image) wp-admin/includes/ajax-actions.php | Ajax handler for cropping an image. |
| [Language\_Pack\_Upgrader::bulk\_upgrade()](../classes/language_pack_upgrader/bulk_upgrade) wp-admin/includes/class-language-pack-upgrader.php | Bulk upgrade language packs. |
| [Plugin\_Upgrader::bulk\_upgrade()](../classes/plugin_upgrader/bulk_upgrade) wp-admin/includes/class-plugin-upgrader.php | Bulk upgrade several plugins at once. |
| [Theme\_Upgrader::check\_parent\_theme\_filter()](../classes/theme_upgrader/check_parent_theme_filter) wp-admin/includes/class-theme-upgrader.php | Check if a child theme is being installed and we need to install its parent. |
| [Theme\_Upgrader::install()](../classes/theme_upgrader/install) wp-admin/includes/class-theme-upgrader.php | Install a theme package. |
| [Theme\_Upgrader::upgrade()](../classes/theme_upgrader/upgrade) wp-admin/includes/class-theme-upgrader.php | Upgrade a theme. |
| [Theme\_Upgrader::bulk\_upgrade()](../classes/theme_upgrader/bulk_upgrade) wp-admin/includes/class-theme-upgrader.php | Upgrade several themes at once. |
| [Plugin\_Upgrader::install()](../classes/plugin_upgrader/install) wp-admin/includes/class-plugin-upgrader.php | Install a plugin package. |
| [Plugin\_Upgrader::upgrade()](../classes/plugin_upgrader/upgrade) wp-admin/includes/class-plugin-upgrader.php | Upgrade a plugin. |
| [unregister\_setting()](unregister_setting) wp-includes/option.php | Unregisters a setting. |
| [wp\_ajax\_send\_attachment\_to\_editor()](wp_ajax_send_attachment_to_editor) wp-admin/includes/ajax-actions.php | Ajax handler for sending an attachment to the editor. |
| [wp\_ajax\_replyto\_comment()](wp_ajax_replyto_comment) wp-admin/includes/ajax-actions.php | Ajax handler for replying to a comment. |
| [wp\_link\_manager\_disabled\_message()](wp_link_manager_disabled_message) wp-admin/includes/bookmark.php | Outputs the ‘disabled’ message for the WordPress Link Manager. |
| [WP\_Customize\_Manager::stop\_previewing\_theme()](../classes/wp_customize_manager/stop_previewing_theme) wp-includes/class-wp-customize-manager.php | Stops previewing the selected theme. |
| [kses\_remove\_filters()](kses_remove_filters) wp-includes/kses.php | Removes all KSES input form content filters. |
| [WP\_Widget\_Text::widget()](../classes/wp_widget_text/widget) wp-includes/widgets/class-wp-widget-text.php | Outputs the content for the current Text widget instance. |
| [WP\_Widget\_Text::form()](../classes/wp_widget_text/form) wp-includes/widgets/class-wp-widget-text.php | Outputs the Text widget settings form. |
| [remove\_action()](remove_action) wp-includes/plugin.php | Removes a callback function from an action hook. |
| [welcome\_user\_msg\_filter()](welcome_user_msg_filter) wp-includes/ms-functions.php | Ensures that the welcome message is not empty. Currently unused. |
| [Walker\_Comment::start\_el()](../classes/walker_comment/start_el) wp-includes/class-walker-comment.php | Starts the element output. |
| [WP\_Customize\_Widgets::stop\_capturing\_option\_updates()](../classes/wp_customize_widgets/stop_capturing_option_updates) wp-includes/class-wp-customize-widgets.php | Undoes any changes to the options since options capture began. |
| [wp\_update\_comment()](wp_update_comment) wp-includes/comment.php | Updates an existing comment in the database. |
| [\_WP\_Editors::editor()](../classes/_wp_editors/editor) wp-includes/class-wp-editor.php | Outputs the HTML for a single instance of the editor. |
| Version | Description |
| --- | --- |
| [1.2.0](https://developer.wordpress.org/reference/since/1.2.0/) | Introduced. |
wordpress sanitize_bookmark_field( string $field, mixed $value, int $bookmark_id, string $context ): mixed sanitize\_bookmark\_field( string $field, mixed $value, int $bookmark\_id, string $context ): mixed
===================================================================================================
Sanitizes a bookmark field.
Sanitizes the bookmark fields based on what the field name is. If the field has a strict value set, then it will be tested for that, else a more generic filtering is applied. After the more strict filter is applied, if the `$context` is ‘raw’ then the value is immediately return.
Hooks exist for the more generic cases. With the ‘edit’ context, the [‘edit\_$field’](../hooks/edit_field) filter will be called and passed the `$value` and `$bookmark_id` respectively.
With the ‘db’ context, the [‘pre\_$field’](../hooks/pre_field) filter is called and passed the value.
The ‘display’ context is the final context and has the `$field` has the filter name and is passed the `$value`, `$bookmark_id`, and `$context`, respectively.
`$field` string Required The bookmark field. `$value` mixed Required The bookmark field value. `$bookmark_id` int Required Bookmark ID. `$context` string Required How to filter the field value. Accepts `'raw'`, `'edit'`, `'db'`, `'display'`, `'attribute'`, or `'js'`. Default `'display'`. mixed The filtered value.
File: `wp-includes/bookmark.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/bookmark.php/)
```
function sanitize_bookmark_field( $field, $value, $bookmark_id, $context ) {
$int_fields = array( 'link_id', 'link_rating' );
if ( in_array( $field, $int_fields, true ) ) {
$value = (int) $value;
}
switch ( $field ) {
case 'link_category': // array( ints )
$value = array_map( 'absint', (array) $value );
// We return here so that the categories aren't filtered.
// The 'link_category' filter is for the name of a link category, not an array of a link's link categories.
return $value;
case 'link_visible': // bool stored as Y|N
$value = preg_replace( '/[^YNyn]/', '', $value );
break;
case 'link_target': // "enum"
$targets = array( '_top', '_blank' );
if ( ! in_array( $value, $targets, true ) ) {
$value = '';
}
break;
}
if ( 'raw' === $context ) {
return $value;
}
if ( 'edit' === $context ) {
/** This filter is documented in wp-includes/post.php */
$value = apply_filters( "edit_{$field}", $value, $bookmark_id );
if ( 'link_notes' === $field ) {
$value = esc_html( $value ); // textarea_escaped
} else {
$value = esc_attr( $value );
}
} elseif ( 'db' === $context ) {
/** This filter is documented in wp-includes/post.php */
$value = apply_filters( "pre_{$field}", $value );
} else {
/** This filter is documented in wp-includes/post.php */
$value = apply_filters( "{$field}", $value, $bookmark_id, $context );
if ( 'attribute' === $context ) {
$value = esc_attr( $value );
} elseif ( 'js' === $context ) {
$value = esc_js( $value );
}
}
// Restore the type for integer fields after esc_attr().
if ( in_array( $field, $int_fields, true ) ) {
$value = (int) $value;
}
return $value;
}
```
[apply\_filters( "edit\_{$field}", mixed $value, int $post\_id )](../hooks/edit_field)
Filters the value of a specific post field to edit.
[apply\_filters( "pre\_{$field}", mixed $value )](../hooks/pre_field)
Filters the value of a specific post field before saving.
[apply\_filters( "{$field}", mixed $value, int $post\_id, string $context )](../hooks/field)
Filters the value of a specific post field for display.
| Uses | Description |
| --- | --- |
| [esc\_js()](esc_js) wp-includes/formatting.php | Escapes single quotes, `"`, , `&`, and fixes line endings. |
| [esc\_html()](esc_html) wp-includes/formatting.php | Escaping for HTML blocks. |
| [esc\_attr()](esc_attr) wp-includes/formatting.php | Escaping for HTML attributes. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| Used By | Description |
| --- | --- |
| [get\_links()](get_links) wp-includes/deprecated.php | Gets the links associated with category by ID. |
| [get\_linkrating()](get_linkrating) wp-includes/deprecated.php | Legacy function that retrieved the value of a link’s link\_rating field. |
| [\_walk\_bookmarks()](_walk_bookmarks) wp-includes/bookmark-template.php | The formatted output of a list of bookmarks. |
| [sanitize\_bookmark()](sanitize_bookmark) wp-includes/bookmark.php | Sanitizes all bookmark fields. |
| [get\_bookmark\_field()](get_bookmark_field) wp-includes/bookmark.php | Retrieves single bookmark data item or field. |
| Version | Description |
| --- | --- |
| [2.3.0](https://developer.wordpress.org/reference/since/2.3.0/) | Introduced. |
wordpress rest_output_link_header() rest\_output\_link\_header()
============================
Sends a Link header for the REST API.
File: `wp-includes/rest-api.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/rest-api.php/)
```
function rest_output_link_header() {
if ( headers_sent() ) {
return;
}
$api_root = get_rest_url();
if ( empty( $api_root ) ) {
return;
}
header( sprintf( 'Link: <%s>; rel="https://api.w.org/"', sanitize_url( $api_root ) ), false );
$resource = rest_get_queried_resource_route();
if ( $resource ) {
header( sprintf( 'Link: <%s>; rel="alternate"; type="application/json"', sanitize_url( rest_url( $resource ) ) ), false );
}
}
```
| Uses | Description |
| --- | --- |
| [rest\_get\_queried\_resource\_route()](rest_get_queried_resource_route) wp-includes/rest-api.php | Gets the REST route for the currently queried object. |
| [get\_rest\_url()](get_rest_url) wp-includes/rest-api.php | Retrieves the URL to a REST endpoint on a site. |
| [sanitize\_url()](sanitize_url) wp-includes/formatting.php | Sanitizes a URL for database or redirect usage. |
| [rest\_url()](rest_url) wp-includes/rest-api.php | Retrieves the URL to a REST endpoint. |
| Version | Description |
| --- | --- |
| [4.4.0](https://developer.wordpress.org/reference/since/4.4.0/) | Introduced. |
| programming_docs |
wordpress wp_get_additional_image_sizes(): array wp\_get\_additional\_image\_sizes(): array
==========================================
Retrieves additional image sizes.
array Additional images size data.
File: `wp-includes/media.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/media.php/)
```
function wp_get_additional_image_sizes() {
global $_wp_additional_image_sizes;
if ( ! $_wp_additional_image_sizes ) {
$_wp_additional_image_sizes = array();
}
return $_wp_additional_image_sizes;
}
```
| Used By | Description |
| --- | --- |
| [wp\_get\_registered\_image\_subsizes()](wp_get_registered_image_subsizes) wp-includes/media.php | Returns a normalized list of all currently registered image sub-sizes. |
| [wp\_save\_image()](wp_save_image) wp-admin/includes/image-edit.php | Saves image to post, along with enqueued changes in `$_REQUEST['history']`. |
| [\_wp\_post\_thumbnail\_html()](_wp_post_thumbnail_html) wp-admin/includes/post.php | Returns HTML for the post thumbnail meta box. |
| [get\_intermediate\_image\_sizes()](get_intermediate_image_sizes) wp-includes/media.php | Gets the available intermediate image size names. |
| [image\_constrain\_size\_for\_editor()](image_constrain_size_for_editor) wp-includes/media.php | Scales down the default size of an image. |
| [has\_image\_size()](has_image_size) wp-includes/media.php | Checks if an image size exists. |
| Version | Description |
| --- | --- |
| [4.7.0](https://developer.wordpress.org/reference/since/4.7.0/) | Introduced. |
wordpress add_comments_page( string $page_title, string $menu_title, string $capability, string $menu_slug, callable $callback = '', int $position = null ): string|false add\_comments\_page( string $page\_title, string $menu\_title, string $capability, string $menu\_slug, callable $callback = '', int $position = null ): string|false
====================================================================================================================================================================
Adds a submenu page to the Comments main menu.
This function takes a capability which will be used to determine whether or not a page is included in the menu.
The function which is hooked in to handle the output of the page must check that the user has the required capability as well.
`$page_title` string Required The text to be displayed in the title tags of the page when the menu is selected. `$menu_title` string Required The text to be used for the menu. `$capability` string Required The capability required for this menu to be displayed to the user. `$menu_slug` string Required The slug name to refer to this menu by (should be unique for this menu). `$callback` callable Optional The function to be called to output the content for this page. Default: `''`
`$position` int Optional The position in the menu order this item should appear. Default: `null`
string|false The resulting page's hook\_suffix, or false if the user does not have the capability required.
File: `wp-admin/includes/plugin.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/plugin.php/)
```
function add_comments_page( $page_title, $menu_title, $capability, $menu_slug, $callback = '', $position = null ) {
return add_submenu_page( 'edit-comments.php', $page_title, $menu_title, $capability, $menu_slug, $callback, $position );
}
```
| Uses | Description |
| --- | --- |
| [add\_submenu\_page()](add_submenu_page) wp-admin/includes/plugin.php | Adds a submenu page. |
| Version | Description |
| --- | --- |
| [5.3.0](https://developer.wordpress.org/reference/since/5.3.0/) | Added the `$position` parameter. |
| [2.7.0](https://developer.wordpress.org/reference/since/2.7.0/) | Introduced. |
wordpress wp_maybe_grant_site_health_caps( bool[] $allcaps, string[] $caps, array $args, WP_User $user ): bool[] wp\_maybe\_grant\_site\_health\_caps( bool[] $allcaps, string[] $caps, array $args, WP\_User $user ): bool[]
============================================================================================================
Filters the user capabilities to grant the ‘view\_site\_health\_checks’ capabilities as necessary.
`$allcaps` bool[] Required An array of all the user's capabilities. `$caps` string[] Required Required primitive capabilities for the requested capability. `$args` array Required Arguments that accompany the requested capability check.
* stringRequested capability.
* `1`intConcerned user ID.
* `...$2`mixedOptional second and further parameters, typically object ID.
`$user` [WP\_User](../classes/wp_user) Required The user object. bool[] Filtered array of the user's capabilities.
File: `wp-includes/capabilities.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/capabilities.php/)
```
function wp_maybe_grant_site_health_caps( $allcaps, $caps, $args, $user ) {
if ( ! empty( $allcaps['install_plugins'] ) && ( ! is_multisite() || is_super_admin( $user->ID ) ) ) {
$allcaps['view_site_health_checks'] = true;
}
return $allcaps;
}
```
| Uses | Description |
| --- | --- |
| [is\_super\_admin()](is_super_admin) wp-includes/capabilities.php | Determines whether user is a site admin. |
| [is\_multisite()](is_multisite) wp-includes/load.php | If Multisite is enabled. |
| Version | Description |
| --- | --- |
| [5.2.2](https://developer.wordpress.org/reference/since/5.2.2/) | Introduced. |
wordpress wp_import_upload_form( string $action ) wp\_import\_upload\_form( string $action )
==========================================
Outputs the form used by the importers to accept the data to be imported.
`$action` string Required The action attribute for the form. File: `wp-admin/includes/template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/template.php/)
```
function wp_import_upload_form( $action ) {
/**
* Filters the maximum allowed upload size for import files.
*
* @since 2.3.0
*
* @see wp_max_upload_size()
*
* @param int $max_upload_size Allowed upload size. Default 1 MB.
*/
$bytes = apply_filters( 'import_upload_size_limit', wp_max_upload_size() );
$size = size_format( $bytes );
$upload_dir = wp_upload_dir();
if ( ! empty( $upload_dir['error'] ) ) :
?>
<div class="error"><p><?php _e( 'Before you can upload your import file, you will need to fix the following error:' ); ?></p>
<p><strong><?php echo $upload_dir['error']; ?></strong></p></div>
<?php
else :
?>
<form enctype="multipart/form-data" id="import-upload-form" method="post" class="wp-upload-form" action="<?php echo esc_url( wp_nonce_url( $action, 'import-upload' ) ); ?>">
<p>
<?php
printf(
'<label for="upload">%s</label> (%s)',
__( 'Choose a file from your computer:' ),
/* translators: %s: Maximum allowed file size. */
sprintf( __( 'Maximum size: %s' ), $size )
);
?>
<input type="file" id="upload" name="import" size="25" />
<input type="hidden" name="action" value="save" />
<input type="hidden" name="max_file_size" value="<?php echo $bytes; ?>" />
</p>
<?php submit_button( __( 'Upload file and import' ), 'primary' ); ?>
</form>
<?php
endif;
}
```
[apply\_filters( 'import\_upload\_size\_limit', int $max\_upload\_size )](../hooks/import_upload_size_limit)
Filters the maximum allowed upload size for import files.
| Uses | Description |
| --- | --- |
| [submit\_button()](submit_button) wp-admin/includes/template.php | Echoes a submit button, with provided text and appropriate class(es). |
| [wp\_upload\_dir()](wp_upload_dir) wp-includes/functions.php | Returns an array containing the current upload directory’s path and URL. |
| [size\_format()](size_format) wp-includes/functions.php | Converts a number of bytes to the largest unit the bytes will fit into. |
| [wp\_max\_upload\_size()](wp_max_upload_size) wp-includes/media.php | Determines the maximum upload size allowed in php.ini. |
| [\_e()](_e) wp-includes/l10n.php | Displays translated text. |
| [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. |
| [esc\_url()](esc_url) wp-includes/formatting.php | Checks and cleans a URL. |
| [wp\_nonce\_url()](wp_nonce_url) wp-includes/functions.php | Retrieves URL with nonce added to URL query. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| Version | Description |
| --- | --- |
| [2.0.0](https://developer.wordpress.org/reference/since/2.0.0/) | Introduced. |
wordpress wp_add_iframed_editor_assets_html() wp\_add\_iframed\_editor\_assets\_html()
========================================
This function has been deprecated.
Inject the block editor assets that need to be loaded into the editor’s iframe as an inline script.
File: `wp-includes/deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/deprecated.php/)
```
function wp_add_iframed_editor_assets_html() {
_deprecated_function( __FUNCTION__, '6.0.0' );
}
```
| Uses | Description |
| --- | --- |
| [\_deprecated\_function()](_deprecated_function) wp-includes/functions.php | Marks a function as deprecated and inform when it has been used. |
| Version | Description |
| --- | --- |
| [6.0.0](https://developer.wordpress.org/reference/since/6.0.0/) | This function has been deprecated. |
| [5.8.0](https://developer.wordpress.org/reference/since/5.8.0/) | Introduced. |
wordpress update_blog_option( int $id, string $option, mixed $value, mixed $deprecated = null ): bool update\_blog\_option( int $id, string $option, mixed $value, mixed $deprecated = null ): bool
=============================================================================================
Update an option for a particular blog.
`$id` int Required The blog ID. `$option` string Required The option key. `$value` mixed Required The option value. `$deprecated` mixed Optional Not used. Default: `null`
bool True if the value was updated, false otherwise.
File: `wp-includes/ms-blogs.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/ms-blogs.php/)
```
function update_blog_option( $id, $option, $value, $deprecated = null ) {
$id = (int) $id;
if ( null !== $deprecated ) {
_deprecated_argument( __FUNCTION__, '3.1.0' );
}
if ( get_current_blog_id() == $id ) {
return update_option( $option, $value );
}
switch_to_blog( $id );
$return = update_option( $option, $value );
restore_current_blog();
return $return;
}
```
| Uses | Description |
| --- | --- |
| [switch\_to\_blog()](switch_to_blog) wp-includes/ms-blogs.php | Switch the current blog. |
| [restore\_current\_blog()](restore_current_blog) wp-includes/ms-blogs.php | Restore the current blog, after calling [switch\_to\_blog()](switch_to_blog) . |
| [get\_current\_blog\_id()](get_current_blog_id) wp-includes/load.php | Retrieve the current site ID. |
| [\_deprecated\_argument()](_deprecated_argument) wp-includes/functions.php | Marks a function argument as deprecated and inform when it has been used. |
| [update\_option()](update_option) wp-includes/option.php | Updates the value of an option that was already added. |
| Used By | Description |
| --- | --- |
| [wp\_update\_blog\_public\_option\_on\_site\_update()](wp_update_blog_public_option_on_site_update) wp-includes/ms-site.php | Updates the `blog_public` option for a given site ID. |
| Version | Description |
| --- | --- |
| [MU (3.0.0)](https://developer.wordpress.org/reference/since/mu.3.0.0/) | Introduced. |
wordpress get_posts_nav_link( string|array $args = array() ): string get\_posts\_nav\_link( string|array $args = array() ): string
=============================================================
Retrieves the post pages link navigation for previous and next pages.
`$args` string|array Optional Arguments to build the post pages link navigation.
* `sep`stringSeparator character. Default `'—'`.
* `prelabel`stringLink text to display for the previous page link.
Default '« Previous Page'.
* `nxtlabel`stringLink text to display for the next page link.
Default 'Next Page »'.
Default: `array()`
string The posts link navigation.
File: `wp-includes/link-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/link-template.php/)
```
function get_posts_nav_link( $args = array() ) {
global $wp_query;
$return = '';
if ( ! is_singular() ) {
$defaults = array(
'sep' => ' — ',
'prelabel' => __( '« Previous Page' ),
'nxtlabel' => __( 'Next Page »' ),
);
$args = wp_parse_args( $args, $defaults );
$max_num_pages = $wp_query->max_num_pages;
$paged = get_query_var( 'paged' );
// Only have sep if there's both prev and next results.
if ( $paged < 2 || $paged >= $max_num_pages ) {
$args['sep'] = '';
}
if ( $max_num_pages > 1 ) {
$return = get_previous_posts_link( $args['prelabel'] );
$return .= preg_replace( '/&([^#])(?![a-z]{1,8};)/i', '&$1', $args['sep'] );
$return .= get_next_posts_link( $args['nxtlabel'] );
}
}
return $return;
}
```
| Uses | Description |
| --- | --- |
| [is\_singular()](is_singular) wp-includes/query.php | Determines whether the query is for an existing single post of any post type (post, attachment, page, custom post types). |
| [get\_query\_var()](get_query_var) wp-includes/query.php | Retrieves the value of a query variable in the [WP\_Query](../classes/wp_query) class. |
| [get\_previous\_posts\_link()](get_previous_posts_link) wp-includes/link-template.php | Retrieves the previous posts page link. |
| [get\_next\_posts\_link()](get_next_posts_link) wp-includes/link-template.php | Retrieves the next posts page link. |
| [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. |
| [wp\_parse\_args()](wp_parse_args) wp-includes/functions.php | Merges user defined arguments into defaults array. |
| Used By | Description |
| --- | --- |
| [posts\_nav\_link()](posts_nav_link) wp-includes/link-template.php | Displays the post pages link navigation for previous and next pages. |
| Version | Description |
| --- | --- |
| [2.8.0](https://developer.wordpress.org/reference/since/2.8.0/) | Introduced. |
wordpress _ex( string $text, string $context, string $domain = 'default' ) \_ex( string $text, string $context, string $domain = 'default' )
=================================================================
Displays translated string with gettext context.
`$text` string Required Text to translate. `$context` string Required Context information for the translators. `$domain` string Optional Text domain. Unique identifier for retrieving translated strings.
Default `'default'`. Default: `'default'`
File: `wp-includes/l10n.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/l10n.php/)
```
function _ex( $text, $context, $domain = 'default' ) {
echo _x( $text, $context, $domain );
}
```
| Uses | Description |
| --- | --- |
| [\_x()](_x) wp-includes/l10n.php | Retrieves translated string with gettext context. |
| Used By | Description |
| --- | --- |
| [WP\_Customize\_Themes\_Panel::render\_template()](../classes/wp_customize_themes_panel/render_template) wp-includes/customize/class-wp-customize-themes-panel.php | An Underscore (JS) template for rendering this panel’s container. |
| [WP\_Customize\_Theme\_Control::content\_template()](../classes/wp_customize_theme_control/content_template) wp-includes/customize/class-wp-customize-theme-control.php | Render a JS template for theme display. |
| [customize\_themes\_print\_templates()](customize_themes_print_templates) wp-admin/includes/theme.php | Prints JS templates for the theme-browsing UI in the Customizer. |
| [wp\_print\_revision\_templates()](wp_print_revision_templates) wp-admin/includes/revision.php | Print JavaScript templates required for the revisions experience. |
| [display\_setup\_form()](display_setup_form) wp-admin/install.php | Displays installer setup form. |
| [install\_theme\_search\_form()](install_theme_search_form) wp-admin/includes/theme-install.php | Displays search form for searching themes. |
| [install\_search\_form()](install_search_form) wp-admin/includes/plugin-install.php | Displays a search form for searching plugins. |
| [install\_plugin\_information()](install_plugin_information) wp-admin/includes/plugin-install.php | Displays plugin information in dialog box form. |
| [list\_meta()](list_meta) wp-admin/includes/template.php | Outputs a post’s public meta data in the Custom Fields meta box. |
| [meta\_form()](meta_form) wp-admin/includes/template.php | Prints the form in the Custom Fields meta box. |
| [media\_upload\_gallery\_form()](media_upload_gallery_form) wp-admin/includes/media.php | Adds gallery form to upload iframe. |
| [media\_upload\_form()](media_upload_form) wp-admin/includes/media.php | Outputs the legacy media upload form. |
| [link\_categories\_meta\_box()](link_categories_meta_box) wp-admin/includes/meta-boxes.php | Displays link categories form fields. |
| [post\_submit\_meta\_box()](post_submit_meta_box) wp-admin/includes/meta-boxes.php | Displays post submit form fields. |
| [WP\_Terms\_List\_Table::inline\_edit()](../classes/wp_terms_list_table/inline_edit) wp-admin/includes/class-wp-terms-list-table.php | Outputs the hidden row displayed when inline editing |
| [WP\_Posts\_List\_Table::inline\_edit()](../classes/wp_posts_list_table/inline_edit) wp-admin/includes/class-wp-posts-list-table.php | Outputs the hidden row displayed when inline editing |
| [wp\_widget\_control()](wp_widget_control) wp-admin/includes/widgets.php | Meta widget used to display the control form for a widget. |
| [Custom\_Background::admin\_page()](../classes/custom_background/admin_page) wp-admin/includes/class-custom-background.php | Displays the custom background page. |
| [WP\_Widget\_Links::form()](../classes/wp_widget_links/form) wp-includes/widgets/class-wp-widget-links.php | Outputs the settings form for the Links widget. |
| [WP\_Customize\_Header\_Image\_Control::render\_content()](../classes/wp_customize_header_image_control/render_content) wp-includes/customize/class-wp-customize-header-image-control.php | |
| [wp\_print\_media\_templates()](wp_print_media_templates) wp-includes/media-template.php | Prints the templates used in the media manager. |
| Version | Description |
| --- | --- |
| [3.0.0](https://developer.wordpress.org/reference/since/3.0.0/) | Introduced. |
wordpress the_shortlink( string $text = '', string $title = '', string $before = '', string $after = '' ) the\_shortlink( string $text = '', string $title = '', string $before = '', string $after = '' )
================================================================================================
Displays the shortlink for a post.
Must be called from inside "The Loop"
Call like the\_shortlink( \_\_( ‘Shortlinkage FTW’ ) )
`$text` string Optional The link text or HTML to be displayed. Defaults to 'This is the short link.' Default: `''`
`$title` string Optional The tooltip for the link. Must be sanitized. Defaults to the sanitized post title. Default: `''`
`$before` string Optional HTML to display before the link. Default: `''`
`$after` string Optional HTML to display after the link. Default: `''`
Used on single post [permalink](https://wordpress.org/support/article/glossary/ "Glossary") pages, this template tag displays a “URL shortening” link for the current post. By default, this will mean the URL has a format of /?p=1234, and will only appear if pretty permalinks are enabled.
However, this feature is limited by design and intended to be leveraged by plugins that may offer links in a different format, a custom format, or even a format provided by a third-party URL shortening service. Refer to [get\_permalink()](get_permalink) if you want to return the permalink to a post for use in PHP.
**Note**: This function outputs the complete shortlink for the post, to return the shortlink use [wp\_get\_shortlink()](wp_get_shortlink) .
File: `wp-includes/link-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/link-template.php/)
```
function the_shortlink( $text = '', $title = '', $before = '', $after = '' ) {
$post = get_post();
if ( empty( $text ) ) {
$text = __( 'This is the short link.' );
}
if ( empty( $title ) ) {
$title = the_title_attribute( array( 'echo' => false ) );
}
$shortlink = wp_get_shortlink( $post->ID );
if ( ! empty( $shortlink ) ) {
$link = '<a rel="shortlink" href="' . esc_url( $shortlink ) . '" title="' . $title . '">' . $text . '</a>';
/**
* Filters the short link anchor tag for a post.
*
* @since 3.0.0
*
* @param string $link Shortlink anchor tag.
* @param string $shortlink Shortlink URL.
* @param string $text Shortlink's text.
* @param string $title Shortlink's title attribute.
*/
$link = apply_filters( 'the_shortlink', $link, $shortlink, $text, $title );
echo $before, $link, $after;
}
}
```
[apply\_filters( 'the\_shortlink', string $link, string $shortlink, string $text, string $title )](../hooks/the_shortlink)
Filters the short link anchor tag for a post.
| Uses | Description |
| --- | --- |
| [wp\_get\_shortlink()](wp_get_shortlink) wp-includes/link-template.php | Returns a shortlink for a post, page, attachment, or site. |
| [the\_title\_attribute()](the_title_attribute) wp-includes/post-template.php | Sanitizes the current title when retrieving or displaying. |
| [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. |
| [esc\_url()](esc_url) wp-includes/formatting.php | Checks and cleans a URL. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| [get\_post()](get_post) wp-includes/post.php | Retrieves post data given a post ID or post object. |
| Version | Description |
| --- | --- |
| [3.0.0](https://developer.wordpress.org/reference/since/3.0.0/) | Introduced. |
| programming_docs |
wordpress rss2_site_icon() rss2\_site\_icon()
==================
Displays Site Icon in RSS2.
File: `wp-includes/feed.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/feed.php/)
```
function rss2_site_icon() {
$rss_title = get_wp_title_rss();
if ( empty( $rss_title ) ) {
$rss_title = get_bloginfo_rss( 'name' );
}
$url = get_site_icon_url( 32 );
if ( $url ) {
echo '
<image>
<url>' . convert_chars( $url ) . '</url>
<title>' . $rss_title . '</title>
<link>' . get_bloginfo_rss( 'url' ) . '</link>
<width>32</width>
<height>32</height>
</image> ' . "\n";
}
}
```
| Uses | Description |
| --- | --- |
| [get\_site\_icon\_url()](get_site_icon_url) wp-includes/general-template.php | Returns the Site Icon URL. |
| [convert\_chars()](convert_chars) wp-includes/formatting.php | Converts lone & characters into `&` (a.k.a. `&`) |
| [get\_wp\_title\_rss()](get_wp_title_rss) wp-includes/feed.php | Retrieves the blog title for the feed title. |
| [get\_bloginfo\_rss()](get_bloginfo_rss) wp-includes/feed.php | Retrieves RSS container for the bloginfo function. |
| Version | Description |
| --- | --- |
| [4.3.0](https://developer.wordpress.org/reference/since/4.3.0/) | Introduced. |
wordpress register_post_type( string $post_type, array|string $args = array() ): WP_Post_Type|WP_Error register\_post\_type( string $post\_type, array|string $args = array() ): WP\_Post\_Type|WP\_Error
==================================================================================================
Registers a post type.
Note: Post type registrations should not be hooked before the [‘init’](../hooks/init) action. Also, any taxonomy connections should be registered via the `$taxonomies` argument to ensure consistency when hooks such as [‘parse\_query’](../hooks/parse_query) or [‘pre\_get\_posts’](../hooks/pre_get_posts) are used.
Post types can support any number of built-in core features such as meta boxes, custom fields, post thumbnails, post statuses, comments, and more. See the `$supports` argument for a complete list of supported features.
`$post_type` string Required Post type key. Must not exceed 20 characters and may only contain lowercase alphanumeric characters, dashes, and underscores. See [sanitize\_key()](sanitize_key) . `$args` array|string Optional Array or string of arguments for registering a post type.
* `label`stringName of the post type shown in the menu. Usually plural.
Default is value of $labels[`'name'`].
* `labels`string[]An array of labels for this post type. If not set, post labels are inherited for non-hierarchical types and page labels for hierarchical ones. See [get\_post\_type\_labels()](get_post_type_labels) for a full list of supported labels.
* `description`stringA short descriptive summary of what the post type is.
* `public`boolWhether a post type is intended for use publicly either via the admin interface or by front-end users. While the default settings of $exclude\_from\_search, $publicly\_queryable, $show\_ui, and $show\_in\_nav\_menus are inherited from $public, each does not rely on this relationship and controls a very specific intention.
Default false.
* `hierarchical`boolWhether the post type is hierarchical (e.g. page). Default false.
* `exclude_from_search`boolWhether to exclude posts with this post type from front end search results. Default is the opposite value of $public.
* `publicly_queryable`boolWhether queries can be performed on the front end for the post type as part of parse\_request(). Endpoints would include: \* ?post\_type={post\_type\_key} \* ?{post\_type\_key}={single\_post\_slug} \* ?{post\_type\_query\_var}={single\_post\_slug} If not set, the default is inherited from $public.
* `show_ui`boolWhether to generate and allow a UI for managing this post type in the admin. Default is value of $public.
* `show_in_menu`bool|stringWhere to show the post type in the admin menu. To work, $show\_ui must be true. If true, the post type is shown in its own top level menu. If false, no menu is shown. If a string of an existing top level menu (`'tools.php'` or `'edit.php?post_type=page'`, for example), the post type will be placed as a sub-menu of that.
Default is value of $show\_ui.
* `show_in_nav_menus`boolMakes this post type available for selection in navigation menus.
Default is value of $public.
* `show_in_admin_bar`boolMakes this post type available via the admin bar. Default is value of $show\_in\_menu.
* `show_in_rest`boolWhether to include the post type in the REST API. Set this to true for the post type to be available in the block editor.
* `rest_base`stringTo change the base URL of REST API route. Default is $post\_type.
* `rest_namespace`stringTo change the namespace URL of REST API route. Default is wp/v2.
* `rest_controller_class`stringREST API controller class name. Default is '[WP\_REST\_Posts\_Controller](../classes/wp_rest_posts_controller)'.
* `menu_position`intThe position in the menu order the post type should appear. To work, $show\_in\_menu must be true. Default null (at the bottom).
* `menu_icon`stringThe URL to the icon to be used for this menu. Pass a base64-encoded SVG using a data URI, which will be colored to match the color scheme -- this should begin with `'data:image/svg+xml;base64,'`. Pass the name of a Dashicons helper class to use a font icon, e.g.
`'dashicons-chart-pie'`. Pass `'none'` to leave div.wp-menu-image empty so an icon can be added via CSS. Defaults to use the posts icon.
* `capability_type`string|arrayThe string to use to build the read, edit, and delete capabilities.
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'`). Default `'post'`.
* `capabilities`string[]Array of capabilities for this post type. $capability\_type is used as a base to construct capabilities by default.
See [get\_post\_type\_capabilities()](get_post_type_capabilities) .
* `map_meta_cap`boolWhether to use the internal default meta capability handling.
Default false.
* `supports`arrayCore feature(s) the post type supports. Serves as an alias for calling [add\_post\_type\_support()](add_post_type_support) directly. Core features include `'title'`, `'editor'`, `'comments'`, `'revisions'`, `'trackbacks'`, `'author'`, `'excerpt'`, `'page-attributes'`, `'thumbnail'`, `'custom-fields'`, and `'post-formats'`.
Additionally, the `'revisions'` feature dictates whether the post type will store revisions, and the `'comments'` feature dictates whether the comments count will show on the edit screen. A feature can also be specified as an array of arguments to provide additional information about supporting that feature.
Example: `array( 'my_feature', array( 'field' => 'value' ) )`.
Default is an array containing `'title'` and `'editor'`.
* `register_meta_box_cb`callableProvide a callback function that sets up the meta boxes for the edit form. Do [remove\_meta\_box()](remove_meta_box) and [add\_meta\_box()](add_meta_box) calls in the callback. Default null.
* `taxonomies`string[]An array of taxonomy identifiers that will be registered for the post type. Taxonomies can be registered later with [register\_taxonomy()](register_taxonomy) or [register\_taxonomy\_for\_object\_type()](register_taxonomy_for_object_type) .
* `has_archive`bool|stringWhether there should be post type archives, or if a string, the archive slug to use. Will generate the proper rewrite rules if $rewrite is enabled. Default false.
* `rewrite`bool|array Triggers the handling of rewrites for this post type. To prevent rewrite, set to false.
Defaults to true, using $post\_type as slug. To specify rewrite rules, an array can be passed with any of these keys:
+ `slug`stringCustomize the permastruct slug. Defaults to $post\_type key.
+ `with_front`boolWhether the permastruct should be prepended with WP\_Rewrite::$front.
Default true.
+ `feeds`boolWhether the feed permastruct should be built for this post type.
Default is value of $has\_archive.
+ `pages`boolWhether the permastruct should provide for pagination. Default true.
+ `ep_mask`intEndpoint mask to assign. If not specified and permalink\_epmask is set, inherits from $permalink\_epmask. If not specified and permalink\_epmask is not set, defaults to EP\_PERMALINK.
+ `query_var`string|boolSets the query\_var key for this post type. Defaults to $post\_type key. If false, a post type cannot be loaded at ?{query\_var}={post\_slug}. If specified as a string, the query ?{query\_var\_string}={post\_slug} will be valid.
+ `can_export`boolWhether to allow this post type to be exported. Default true.
+ `delete_with_user`boolWhether to delete posts of this type when deleting a user.
- If true, posts of this type belonging to the user will be moved to Trash when the user is deleted.
- If false, posts of this type belonging to the user will \*not\* be trashed or deleted.
- If not set (the default), posts are trashed if post type supports the `'author'` feature. Otherwise posts are not trashed or deleted. Default null.
+ `template`arrayArray of blocks to use as the default initial state for an editor session. Each item should be an array containing block name and optional attributes.
+ `template_lock`string|falseWhether the block template should be locked if $template is set.
- If set to `'all'`, the user is unable to insert new blocks, move existing blocks and delete blocks.
- If set to `'insert'`, the user is able to move existing blocks but is unable to insert new blocks and delete blocks. Default false.
+ `_builtin`boolFOR INTERNAL USE ONLY! True if this post type is a native or "built-in" post\_type. Default false.
+ `_edit_link`stringFOR INTERNAL USE ONLY! URL segment to use for edit link of this post type. Default `'post.php?post=%d'`. More Arguments from get\_post\_type\_capabilities( ... $args ) Post type registration arguments. Default: `array()`
[WP\_Post\_Type](../classes/wp_post_type)|[WP\_Error](../classes/wp_error) The registered post type object on success, [WP\_Error](../classes/wp_error) object on failure.
You can use this function in themes and plugins. However, if you use it in a theme, your post type will disappear from the admin if a user switches away from your theme. See [Must Use Plugins](https://wordpress.org/support/article/must-use-plugins/ "Must Use Plugins") If you want to keep your changes e.g. post type, even if you switch between your themes.
When registering a post type, always register your taxonomies using the `taxonomies` argument. If you do not, the taxonomies and post type will not be recognized as connected when using filters such as `parse_query` or `pre_get_posts`. This can lead to unexpected results and failures.
Even if you register a taxonomy while creating the post type, you must still explicitly register and define the taxonomy using [register\_taxonomy()](register_taxonomy) .
The following post types are reserved and are already used by WordPress.
+ post
+ page
+ attachment
+ revision
+ nav\_menu\_item
+ custom\_css
+ customize\_changeset
+ oembed\_cache
+ user\_request
+ wp\_block In addition, the following post types should not be used as they interfere with other WordPress functions.
+ action
+ author
+ order
+ theme In general, you should always prefix your post types, or specify a custom `query\_var`, to avoid conflicting with existing WordPress query variables.
More information: [Post Types](https://wordpress.org/support/article/post-types/ "Post Types").
(*string*) (*optional*) A short descriptive summary of what the post type is. Default: blank The only way to read that field is using this code:
```
$obj = get_post_type_object( 'your_post_type_name' );
echo esc_html( $obj->description );
```
(*boolean*) (*optional*) Controls how the type is visible to authors (`show_in_nav_menus`, `show_ui`) and readers (`exclude_from_search`, `publicly_queryable`). Default: false
+ ‘**true’** – Implies `exclude_from_search: false`, `publicly_queryable: true`, `show_in_nav_menus: true`, and `show_ui:true`. The built-in types *attachment*, *page*, and *post* are similar to this.
+ ‘**false’** – Implies `exclude_from_search: true`, `publicly_queryable: false`, `show_in_nav_menus: false`, and `show_ui: false`. The built-in types *nav\_menu\_item* and *revision* are similar to this. Best used if you’ll provide your own editing and viewing interfaces (or none at all). If no value is specified for `exclude_from_search`, `publicly_queryable`, `show_in_nav_menus`, or `show_ui`, they inherit their values from `public`. (*boolean*) (*importance*) Whether to exclude posts with this post type from front end search results. Default: value of the **opposite** of *public* argument
+ ‘true’ – site/?s=search-term will **not** include posts of this post type.
+ ‘false’ – site/?s=search-term will include posts of this post type.
**Note:** If you want to show the posts’s list that are associated to taxonomy’s terms, you must set exclude\_from\_search to false (ie : for call site\_domaine/?taxonomy\_slug=term\_slug or site\_domaine/taxonomy\_slug/term\_slug). If you set to true, on the taxonomy page (ex: taxonomy.php) WordPress will not find your posts and/or pagination will make 404 error… (*boolean*) (*optional*) Whether queries can be performed on the front end as part of parse\_request(). Default: value of *public* argument
**Note:** The queries affected include the following (also initiated when rewrites are handled)
+ ?post\_type={post\_type\_key}
+ ?{post\_type\_key}={single\_post\_slug}
+ ?{post\_type\_query\_var}={single\_post\_slug}
**Note:** If query\_var is empty, null, or a boolean FALSE, WordPress will still attempt to interpret it (4.2.2) and previews/views of your custom post will return 404s. (*boolean*) (*optional*) Whether to generate a default UI for managing this post type in the admin. Default: value of *public* argument
+ ‘false’ – do not display a user-interface for this post type
+ ‘true’ – display a user-interface (admin panel) for this post type Note: \_built-in post types, such as post and page, are intentionally set to false. (*boolean*) (*optional*) Whether post\_type is available for selection in navigation menus. Default: value of *public* argument (*boolean or string*) (*optional*) Where to show the post type in the admin menu. show\_ui must be true. Default: value of show\_ui argument
+ ‘false’ – do not display in the admin menu
+ ‘true’ – display as a top level menu
+ ‘some string’ – If an existing top level page such as ‘tools.php’ or ‘edit.php?post\_type=page’, the post type will be placed as a sub menu of that. Note: When using ‘some string’ to show as a submenu of a menu page created by a plugin, this item will become the first submenu item, and replace the location of the top-level link. If this isn’t desired, the plugin that creates the menu page needs to set the add\_action priority for admin\_menu to 9 or lower. Note: As this one inherits its value from show\_ui, which inherits its value from public, it seems to be the most reliable property to determine, if a post type is meant to be publicly useable. At least this works for \_builtin post types and only gives back post and page. (*boolean*) (*optional*) Whether to make this post type available in the WordPress admin bar. Default: value of the show\_in\_menu argument (*integer*) (*optional*) The position in the menu order the post type should appear. show\_in\_menu must be true. Default: null – defaults to below Comments
+ 5 – below Posts
+ 10 – below Media
+ 15 – below Links
+ 20 – below Pages
+ 25 – below comments
+ 60 – below first separator
+ 65 – below Plugins
+ 70 – below Users
+ 75 – below Tools
+ 80 – below Settings
+ 100 – below second separator (*string*) (*optional*) The url to the icon to be used for this menu or the name of the icon from the iconfont [[1]](https://github.com/WordPress/dashicons) Default: null – defaults to the posts icon Examples
+ ‘dashicons-video-alt’ (Uses the video icon from Dashicons[[2]](https://developer.wordpress.org/resource/dashicons/))
+ ‘[get\_template\_directory\_uri()](get_template_directory_uri) . “/images/cutom-posttype-icon.png”‘ (Use a image located in the current theme)
+ ‘data:image/svg+xml;base64,’ . base64\_encode( “<svg version=”1.1″ xmlns=”<http://www.w3.org/2000/svg>” xmlns:xlink=”<http://www.w3.org/1999/xlink>” x=”0px” y=”0px” width=”20px” height=”20px” viewBox=”0 0 459 459″> <path fill=”black” d=”POINTS”/></svg>” )’ (directly embedding a svg with ‘fill=”black”‘ will allow correct colors. Also see [[3]](https://stackoverflow.com/a/42265057/933065)) (*string or array*) (*optional*) The string to use to build the read, edit, and delete capabilities. 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’) the first array element will be used for the singular capabilities and the second array element for the plural capabilities, this is instead of the auto generated version if no array is given which would be “storys”. The ‘capability\_type’ parameter is used as a base to construct capabilities unless they are explicitly set with the ‘capabilities’ parameter. It seems that `map\_meta\_cap` needs to be set to false or null, to make this work (see note 2 below). Default: “post”
**Example** with “book” or “array( ‘book’, ‘books’ )” value, it will generate the 7 capabilities equal to set capabilities parameter to this :
```
'capabilities' => array(
'edit_post' => 'edit_book',
'read_post' => 'read_book',
'delete_post' => 'delete_book',
'edit_posts' => 'edit_books',
'edit_others_posts' => 'edit_others_books',
'publish_posts' => 'publish_books',
'read_private_posts' => 'read_private_books',
'create_posts' => 'edit_books',
),
```
**Note 1:** The “create\_posts” capability correspond to “edit\_books” so it become equal to “edit\_posts”.
**Note 2:** See capabilities note 2 about meta capabilities mapping for custom post type. You can take a look into the $GLOBALS['wp\_post\_types']['your\_cpt\_name'] array, then you’ll see the following:
```
[cap] => stdClass Object
(
// Meta capabilities
[edit_post] => edit_book
[read_post] => read_book
[delete_post] => delete_book
// Primitive capabilities used outside of map_meta_cap():
[edit_posts] => edit_books
[edit_others_posts] => edit_others_books
[publish_posts] => publish_books
[read_private_posts] => read_private_books
// Primitive capabilities used within map_meta_cap():
[create_posts] => edit_books
)
```
Some of the capability types that can be used (probably not exhaustive list):
+ post (default)
+ page These built-in types cannot be used:
+ attachment
+ mediapage
**Note 3:** If you use capabilities parameter, capability\_type complete your capabilities. (*array*) (*optional*) An array of the capabilities for this post type. Default: capability\_type is used to construct By default, seven keys are accepted as part of the capabilities array:
+ edit\_post, read\_post, and delete\_post – These three are **meta capabilities**, which are then generally mapped to corresponding **primitive capabilities** depending on the context, for example 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.
**Note:** those last four **primitive capabilities** are checked in core in various locations. There are also eight other **primitive capabilities** which are not referenced directly in core, except in [map\_meta\_cap()](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. These additional capabilities are only used in [map\_meta\_cap()](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).
+ 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.
+ create\_posts – Controls whether new objects can be created If you assign a 'capability\_type' and then take a look into the $GLOBALS['wp\_post\_types']['your\_cpt\_name'] array, then you’ll see the following:
```
[cap] => stdClass Object
(
// Meta capabilities
[edit_post] => "edit_{$capability_type}"
[read_post] => "read_{$capability_type}"
[delete_post] => "delete_{$capability_type}"
// Primitive capabilities used outside of map_meta_cap():
[edit_posts] => "edit_{$capability_type}s"
[edit_others_posts] => "edit_others_{$capability_type}s"
[publish_posts] => "publish_{$capability_type}s"
[read_private_posts] => "read_private_{$capability_type}s"
// Primitive capabilities used within map_meta_cap():
[read] => "read",
[delete_posts] => "delete_{$capability_type}s"
[delete_private_posts] => "delete_private_{$capability_type}s"
[delete_published_posts] => "delete_published_{$capability_type}s"
[delete_others_posts] => "delete_others_{$capability_type}s"
[edit_private_posts] => "edit_private_{$capability_type}s"
[edit_published_posts] => "edit_published_{$capability_type}s"
[create_posts] => "edit_{$capability_type}s"
)
```
*Note the “s” at the end of plural capabilities.*
(*boolean*) (*optional*) Whether to use the internal default meta capability handling. Default: null
**Note:** If set it to false then standard admin role can’t edit the posts types. Then the edit\_post capability must be added to all roles to add or edit the posts types. (*boolean*) (*optional*) Whether the post type is hierarchical (e.g. page). Allows Parent to be specified. The ‘supports’ parameter should contain ‘page-attributes’ to show the parent select box on the editor page. Default: false
**Note:** this parameter was intended for [Pages](https://codex.wordpress.org/Pages "Pages"). Be careful when choosing it for your custom post type – if you are planning to have very many entries (say – over 2-3 thousand), you will run into load time issues. With this parameter set to *true* WordPress will fetch all IDs of that particular post type on each administration page load for your post type. Servers with limited memory resources may also be challenged by this parameter being set to *true*. (*array/boolean*) (*optional*) An alias for calling [add\_post\_type\_support()](add_post_type_support) directly. As of [3.5](https://codex.wordpress.org/Version_3.5 "Version 3.5"), boolean **false** can be passed as value instead of an array to prevent default (title and editor) behavior. Default: title and editor
+ ‘title’
+ ‘editor’ (content)
+ ‘author’
+ ‘thumbnail’ (featured image, current theme must also support [post-thumbnails](https://codex.wordpress.org/Post_Thumbnails "Post Thumbnails"))
+ ‘excerpt’
+ ‘trackbacks’
+ ‘custom-fields’
+ ‘comments’ (also will see comment count balloon on edit screen)
+ ‘revisions’ (will store revisions)
+ ‘page-attributes’ (menu order, hierarchical must be true to show Parent option)
+ ‘post-formats’ add post formats, see [Post Formats](https://codex.wordpress.org/Post_Formats "Post Formats")
**Note:** When you use custom post type that use thumbnails remember to check that the theme also supports thumbnails or use [add\_theme\_support()](add_theme_support) function. (*callback* ) (*optional*) Provide a callback function that will be called when setting up the meta boxes for the edit form. The callback function takes one argument $post, which contains the [WP\_Post](../classes/wp_post) object for the currently edited post. Do [remove\_meta\_box()](remove_meta_box) and [add\_meta\_box()](add_meta_box) calls in the callback. Default: *None*
(*array*) (*optional*) An array of registered taxonomies like `category` or `post_tag` that will be used with this post type. This can be used in lieu of calling [register\_taxonomy\_for\_object\_type()](register_taxonomy_for_object_type) directly. Custom taxonomies still need to be registered with [register\_taxonomy()](register_taxonomy) . Default: no taxonomies (*boolean or string*) (*optional*) Enables post type archives. Will use $post\_type as archive slug by default. Default: false Note: Will generate the proper rewrite rules if rewrite is enabled. Also use rewrite to change the slug used. If string, it should be translatable. (*boolean or array*) (*optional*) Triggers the handling of rewrites for this post type. To prevent rewrites, set to false. Default: true and use $post\_type as slug $args array
+ 'slug' => string Customize the permalink structure slug. Defaults to the $post\_type value. Should be translatable.
+ 'with\_front' => bool Should the permalink structure be prepended with the front base. (example: if your permalink structure is /blog/, then your links will be: false->/news/, true->/blog/news/). Defaults to true
+ 'feeds' => bool Should a feed permalink structure be built for this post type. Defaults to has\_archive value.
+ 'pages' => bool Should the permalink structure provide for pagination. Defaults to true
+ 'ep\_mask' => const *As of 3.4* Assign an endpoint mask for this post type. For more info see [Rewrite API/add\_rewrite\_endpoint](add_rewrite_endpoint "Rewrite API/add rewrite endpoint"), and [Make WordPress Plugins summary of endpoints](https://make.wordpress.org/plugins/2012/06/07/rewrite-endpoints-api/).
- If not specified, then it inherits from permalink\_epmask(if permalink\_epmask is set), otherwise defaults to EP\_PERMALINK.
**Note:** If registering a post type inside of a plugin, call [flush\_rewrite\_rules()](flush_rewrite_rules) in your activation and deactivation hook (see Flushing Rewrite on Activation below). If [flush\_rewrite\_rules()](flush_rewrite_rules) is not used, then you will have to manually go to Settings > Permalinks and refresh your permalink structure before your custom post type will show the correct structure. (*string*) (*optional*) The default rewrite endpoint bitmasks. For more info see [Trac Ticket 12605](https://core.trac.wordpress.org/ticket/12605) and this – [Make WordPress Plugins summary of endpoints](https://make.wordpress.org/plugins/2012/06/07/rewrite-endpoints-api/). Default: EP\_PERMALINK
**Note:** In 3.4, this argument is effectively replaced by the 'ep\_mask' argument under rewrite. (*boolean or string*) (*optional*) Sets the query\_var key for this post type. Default: true – set to $post\_type
+ ‘false’ – Disables query\_var key use. A post type cannot be loaded at /?{query\_var}={single\_post\_slug}
+ ‘string’ – /?{query\_var\_string}={single\_post\_slug} will work as intended.
**Note:** The query\_var parameter has no effect if the ‘publicly\_queryable’ parameter is set to false. query\_var adds the custom post type’s query var to the built-in query\_vars array so that WordPress will recognize it. WordPress removes any query var not included in that array. If set to true it allows you to request a custom posts type (book) using this: example.com/?book=life-of-pi If set to a string rather than true (for example ‘publication’), you can do: example.com/?publication=life-of-pi (*boolean*) (*optional*) Can this post\_type be exported. Default: true (*boolean*) (*optional*) Whether to delete posts of this type when deleting a user. If true, posts of this type belonging to the user will be moved to trash when then user is deleted. If false, posts of this type belonging to the user will **not** be trashed or deleted. If not set (the default), posts are trashed if post\_type\_supports('author'). Otherwise posts are not trashed or deleted. Default: null (*boolean*) (*optional*) Whether to expose this post type in the REST API. Must be true to enable the Gutenberg editor. Default: false (*string*) (*optional*) The base slug that this post type will use when accessed using the REST API. Default: $post\_type (*string*) (*optional*) An optional custom controller to use instead of [WP\_REST\_Posts\_Controller](../classes/wp_rest_posts_controller). Must be a subclass of [WP\_REST\_Controller](../classes/wp_rest_controller). Default: [WP\_REST\_Posts\_Controller](../classes/wp_rest_posts_controller)
(*boolean*) (*not for general use*) Whether this post type is a native or “built-in” post\_type. **Note: this entry is for documentation – core developers recommend you don’t use this when registering your own post type** Default: false
+ ‘false’ – default this is a custom post type
+ ‘true’ – this is a built-in native post type (post, page, attachment, revision, nav\_menu\_item) (*boolean*) (*not for general use*) Link to edit an entry with this post type. **Note: this entry is for documentation – core developers recommend you don’t use this when registering your own post type** Default:
+ ‘post.php?post=%d’ To get permalinks to work when you activate the plugin use the following example, paying attention to how `my_cpt_init()` is called in the register\_activation\_hook callback:
```
add_action( 'init', 'my_cpt_init' );
function my_cpt_init() {
register_post_type( ... );
}
register_activation_hook( __FILE__, 'my_rewrite_flush' );
function my_rewrite_flush() {
// First, we "add" the custom post type via the above written function.
// Note: "add" is written with quotes, as CPTs don't get added to the DB,
// They are only referenced in the post_type column with a post entry,
// when you add a post of this CPT.
my_cpt_init();
// ATTENTION: This is *only* done during plugin activation hook in this example!
// You should *NEVER EVER* do this on every page load!!
flush_rewrite_rules();
}
```
For themes, you’ll need to use the `after_switch_theme` hook instead. Like so:
```
add_action( 'init', 'my_cpt_init' );
function my_cpt_init() {
register_post_type( ... );
}
add_action( 'after_switch_theme', 'my_rewrite_flush' );
function my_rewrite_flush() {
my_cpt_init();
flush_rewrite_rules();
}
```
Note that although the **$public** attribute is optional, the inputs passed to the **[register\_post\_type()](register_post_type)** function are *exactly* what is queried by the [get\_post\_types()](get_post_types) function. So if you verbosely set the equivalent options for **publicly\_queriable**, **show\_ui**, **show\_in\_nav\_menus**, and **exclude\_from\_search**, this will not be handled the same as if you had set the **$public** attribute. See [bug 18950](https://core.trac.wordpress.org/ticket/18950).
File: `wp-includes/post.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/post.php/)
```
function register_post_type( $post_type, $args = array() ) {
global $wp_post_types;
if ( ! is_array( $wp_post_types ) ) {
$wp_post_types = array();
}
// Sanitize post type name.
$post_type = sanitize_key( $post_type );
if ( empty( $post_type ) || strlen( $post_type ) > 20 ) {
_doing_it_wrong( __FUNCTION__, __( 'Post type names must be between 1 and 20 characters in length.' ), '4.2.0' );
return new WP_Error( 'post_type_length_invalid', __( 'Post type names must be between 1 and 20 characters in length.' ) );
}
$post_type_object = new WP_Post_Type( $post_type, $args );
$post_type_object->add_supports();
$post_type_object->add_rewrite_rules();
$post_type_object->register_meta_boxes();
$wp_post_types[ $post_type ] = $post_type_object;
$post_type_object->add_hooks();
$post_type_object->register_taxonomies();
/**
* Fires after a post type is registered.
*
* @since 3.3.0
* @since 4.6.0 Converted the `$post_type` parameter to accept a `WP_Post_Type` object.
*
* @param string $post_type Post type.
* @param WP_Post_Type $post_type_object Arguments used to register the post type.
*/
do_action( 'registered_post_type', $post_type, $post_type_object );
/**
* Fires after a specific post type is registered.
*
* The dynamic portion of the filter name, `$post_type`, refers to the post type key.
*
* Possible hook names include:
*
* - `registered_post_type_post`
* - `registered_post_type_page`
*
* @since 6.0.0
*
* @param string $post_type Post type.
* @param WP_Post_Type $post_type_object Arguments used to register the post type.
*/
do_action( "registered_post_type_{$post_type}", $post_type, $post_type_object );
return $post_type_object;
}
```
[do\_action( 'registered\_post\_type', string $post\_type, WP\_Post\_Type $post\_type\_object )](../hooks/registered_post_type)
Fires after a post type is registered.
[do\_action( "registered\_post\_type\_{$post\_type}", string $post\_type, WP\_Post\_Type $post\_type\_object )](../hooks/registered_post_type_post_type)
Fires after a specific post type is registered.
| Uses | Description |
| --- | --- |
| [WP\_Post\_Type::\_\_construct()](../classes/wp_post_type/__construct) wp-includes/class-wp-post-type.php | Constructor. |
| [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. |
| [sanitize\_key()](sanitize_key) wp-includes/formatting.php | Sanitizes a string key. |
| [\_doing\_it\_wrong()](_doing_it_wrong) wp-includes/functions.php | Marks something as being incorrectly called. |
| [do\_action()](do_action) wp-includes/plugin.php | Calls the callback functions that have been added to an action hook. |
| [WP\_Error::\_\_construct()](../classes/wp_error/__construct) wp-includes/class-wp-error.php | Initializes the error. |
| Used By | Description |
| --- | --- |
| [create\_initial\_post\_types()](create_initial_post_types) wp-includes/post.php | Creates the initial post types when ‘init’ action is fired. |
| Version | Description |
| --- | --- |
| [5.9.0](https://developer.wordpress.org/reference/since/5.9.0/) | The `rest_namespace` argument was added. |
| [5.3.0](https://developer.wordpress.org/reference/since/5.3.0/) | The `supports` argument will now accept an array of arguments for a feature. |
| [5.0.0](https://developer.wordpress.org/reference/since/5.0.0/) | The `template` and `template_lock` arguments were added. |
| [4.7.0](https://developer.wordpress.org/reference/since/4.7.0/) | Introduced `show_in_rest`, `rest_base` and `rest_controller_class` arguments to register the post type in REST API. |
| [4.6.0](https://developer.wordpress.org/reference/since/4.6.0/) | Post type object returned is now an instance of `WP_Post_Type`. |
| [4.4.0](https://developer.wordpress.org/reference/since/4.4.0/) | The `show_ui` argument is now enforced on the post type listing screen and post editing screen. |
| [3.0.0](https://developer.wordpress.org/reference/since/3.0.0/) | The `show_ui` argument is now enforced on the new post screen. |
| [2.9.0](https://developer.wordpress.org/reference/since/2.9.0/) | Introduced. |
| programming_docs |
wordpress wp_get_unapproved_comment_author_email(): string wp\_get\_unapproved\_comment\_author\_email(): string
=====================================================
Gets unapproved comment author’s email.
Used to allow the commenter to see their pending comment.
string The unapproved comment author's email (when supplied).
File: `wp-includes/comment.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/comment.php/)
```
function wp_get_unapproved_comment_author_email() {
$commenter_email = '';
if ( ! empty( $_GET['unapproved'] ) && ! empty( $_GET['moderation-hash'] ) ) {
$comment_id = (int) $_GET['unapproved'];
$comment = get_comment( $comment_id );
if ( $comment && hash_equals( $_GET['moderation-hash'], wp_hash( $comment->comment_date_gmt ) ) ) {
// The comment will only be viewable by the comment author for 10 minutes.
$comment_preview_expires = strtotime( $comment->comment_date_gmt . '+10 minutes' );
if ( time() < $comment_preview_expires ) {
$commenter_email = $comment->comment_author_email;
}
}
}
if ( ! $commenter_email ) {
$commenter = wp_get_current_commenter();
$commenter_email = $commenter['comment_author_email'];
}
return $commenter_email;
}
```
| Uses | Description |
| --- | --- |
| [wp\_hash()](wp_hash) wp-includes/pluggable.php | Gets hash of given string. |
| [wp\_get\_current\_commenter()](wp_get_current_commenter) wp-includes/comment.php | Gets current commenter’s name, email, and URL. |
| [get\_comment()](get_comment) wp-includes/comment.php | Retrieves comment data given a comment ID or comment object. |
| Used By | Description |
| --- | --- |
| [build\_comment\_query\_vars\_from\_block()](build_comment_query_vars_from_block) wp-includes/blocks.php | Helper function that constructs a comment query vars array from the passed block properties. |
| [wp\_list\_comments()](wp_list_comments) wp-includes/comment-template.php | Displays a list of comments. |
| [comments\_template()](comments_template) wp-includes/comment-template.php | Loads the comment template specified in $file. |
| [get\_page\_of\_comment()](get_page_of_comment) wp-includes/comment.php | Calculates what page number a comment will appear on for comment paging. |
| Version | Description |
| --- | --- |
| [5.7.0](https://developer.wordpress.org/reference/since/5.7.0/) | The window within which the author email for an unapproved comment can be retrieved was extended to 10 minutes. |
| [5.1.0](https://developer.wordpress.org/reference/since/5.1.0/) | Introduced. |
wordpress wp_parse_auth_cookie( string $cookie = '', string $scheme = '' ): string[]|false wp\_parse\_auth\_cookie( string $cookie = '', string $scheme = '' ): string[]|false
===================================================================================
Parses a cookie into its components.
`$cookie` string Optional Authentication cookie. Default: `''`
`$scheme` string Optional The cookie scheme to use: `'auth'`, `'secure_auth'`, or `'logged_in'`. Default: `''`
string[]|false Authentication cookie components. None of the components should be assumed to be valid as they come directly from a client-provided cookie value. If the cookie value is malformed, false is returned.
* `username`stringUser's username.
* `expiration`stringThe time the cookie expires as a UNIX timestamp.
* `token`stringUser's session token used.
* `hmac`stringThe security hash for the cookie.
* `scheme`stringThe cookie scheme to use.
File: `wp-includes/pluggable.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/pluggable.php/)
```
function wp_parse_auth_cookie( $cookie = '', $scheme = '' ) {
if ( empty( $cookie ) ) {
switch ( $scheme ) {
case 'auth':
$cookie_name = AUTH_COOKIE;
break;
case 'secure_auth':
$cookie_name = SECURE_AUTH_COOKIE;
break;
case 'logged_in':
$cookie_name = LOGGED_IN_COOKIE;
break;
default:
if ( is_ssl() ) {
$cookie_name = SECURE_AUTH_COOKIE;
$scheme = 'secure_auth';
} else {
$cookie_name = AUTH_COOKIE;
$scheme = 'auth';
}
}
if ( empty( $_COOKIE[ $cookie_name ] ) ) {
return false;
}
$cookie = $_COOKIE[ $cookie_name ];
}
$cookie_elements = explode( '|', $cookie );
if ( count( $cookie_elements ) !== 4 ) {
return false;
}
list( $username, $expiration, $token, $hmac ) = $cookie_elements;
return compact( 'username', 'expiration', 'token', 'hmac', 'scheme' );
}
```
| Uses | Description |
| --- | --- |
| [is\_ssl()](is_ssl) wp-includes/load.php | Determines if SSL is used. |
| Used By | Description |
| --- | --- |
| [wp\_get\_session\_token()](wp_get_session_token) wp-includes/user.php | Retrieves the current session token from the logged\_in cookie. |
| [wp\_validate\_auth\_cookie()](wp_validate_auth_cookie) wp-includes/pluggable.php | Validates authentication cookie. |
| [wp\_update\_user()](wp_update_user) wp-includes/user.php | Updates a user in the database. |
| Version | Description |
| --- | --- |
| [4.0.0](https://developer.wordpress.org/reference/since/4.0.0/) | The `$token` element was added to the return value. |
| [2.7.0](https://developer.wordpress.org/reference/since/2.7.0/) | Introduced. |
wordpress wp_nav_menu_item_link_meta_box() wp\_nav\_menu\_item\_link\_meta\_box()
======================================
Displays a meta box for the custom links menu item.
File: `wp-admin/includes/nav-menu.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/nav-menu.php/)
```
function wp_nav_menu_item_link_meta_box() {
global $_nav_menu_placeholder, $nav_menu_selected_id;
$_nav_menu_placeholder = 0 > $_nav_menu_placeholder ? $_nav_menu_placeholder - 1 : -1;
?>
<div class="customlinkdiv" id="customlinkdiv">
<input type="hidden" value="custom" name="menu-item[<?php echo $_nav_menu_placeholder; ?>][menu-item-type]" />
<p id="menu-item-url-wrap" class="wp-clearfix">
<label class="howto" for="custom-menu-item-url"><?php _e( 'URL' ); ?></label>
<input id="custom-menu-item-url" name="menu-item[<?php echo $_nav_menu_placeholder; ?>][menu-item-url]" type="text"<?php wp_nav_menu_disabled_check( $nav_menu_selected_id ); ?> class="code menu-item-textbox form-required" placeholder="https://" />
</p>
<p id="menu-item-name-wrap" class="wp-clearfix">
<label class="howto" for="custom-menu-item-name"><?php _e( 'Link Text' ); ?></label>
<input id="custom-menu-item-name" name="menu-item[<?php echo $_nav_menu_placeholder; ?>][menu-item-title]" type="text"<?php wp_nav_menu_disabled_check( $nav_menu_selected_id ); ?> class="regular-text menu-item-textbox" />
</p>
<p class="button-controls wp-clearfix">
<span class="add-to-menu">
<input type="submit"<?php wp_nav_menu_disabled_check( $nav_menu_selected_id ); ?> class="button submit-add-to-menu right" value="<?php esc_attr_e( 'Add to Menu' ); ?>" name="add-custom-menu-item" id="submit-customlinkdiv" />
<span class="spinner"></span>
</span>
</p>
</div><!-- /.customlinkdiv -->
<?php
}
```
| Uses | Description |
| --- | --- |
| [wp\_nav\_menu\_disabled\_check()](wp_nav_menu_disabled_check) wp-admin/includes/nav-menu.php | Check whether to disable the Menu Locations meta box submit button and inputs. |
| [esc\_attr\_e()](esc_attr_e) wp-includes/l10n.php | Displays translated text that has been escaped for safe use in an attribute. |
| [\_e()](_e) wp-includes/l10n.php | Displays translated text. |
| Version | Description |
| --- | --- |
| [3.0.0](https://developer.wordpress.org/reference/since/3.0.0/) | Introduced. |
wordpress _flatten_blocks( array $blocks ): array \_flatten\_blocks( array $blocks ): array
=========================================
This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.
Returns an array containing the references of the passed blocks and their inner blocks.
`$blocks` array Required array of blocks. array block references to the passed blocks and their inner blocks.
File: `wp-includes/block-template-utils.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/block-template-utils.php/)
```
function _flatten_blocks( &$blocks ) {
$all_blocks = array();
$queue = array();
foreach ( $blocks as &$block ) {
$queue[] = &$block;
}
while ( count( $queue ) > 0 ) {
$block = &$queue[0];
array_shift( $queue );
$all_blocks[] = &$block;
if ( ! empty( $block['innerBlocks'] ) ) {
foreach ( $block['innerBlocks'] as &$inner_block ) {
$queue[] = &$inner_block;
}
}
}
return $all_blocks;
}
```
| Used By | Description |
| --- | --- |
| [\_inject\_theme\_attribute\_in\_block\_template\_content()](_inject_theme_attribute_in_block_template_content) wp-includes/block-template-utils.php | Parses wp\_template content and injects the active theme’s stylesheet as a theme attribute into each wp\_template\_part |
| [\_remove\_theme\_attribute\_in\_block\_template\_content()](_remove_theme_attribute_in_block_template_content) wp-includes/block-template-utils.php | Parses a block template and removes the theme attribute from each template part. |
| Version | Description |
| --- | --- |
| [5.9.0](https://developer.wordpress.org/reference/since/5.9.0/) | Introduced. |
wordpress rest_handle_deprecated_argument( string $function, string $message, string $version ) rest\_handle\_deprecated\_argument( string $function, string $message, string $version )
========================================================================================
Handles [\_deprecated\_argument()](_deprecated_argument) errors.
`$function` string Required The function that was called. `$message` string Required A message regarding the change. `$version` string Required Version. File: `wp-includes/rest-api.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/rest-api.php/)
```
function rest_handle_deprecated_argument( $function, $message, $version ) {
if ( ! WP_DEBUG || headers_sent() ) {
return;
}
if ( $message ) {
/* translators: 1: Function name, 2: WordPress version number, 3: Error message. */
$string = sprintf( __( '%1$s (since %2$s; %3$s)' ), $function, $version, $message );
} else {
/* translators: 1: Function name, 2: WordPress version number. */
$string = sprintf( __( '%1$s (since %2$s; no alternative available)' ), $function, $version );
}
header( sprintf( 'X-WP-DeprecatedParam: %s', $string ) );
}
```
| Uses | Description |
| --- | --- |
| [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. |
| Version | Description |
| --- | --- |
| [4.4.0](https://developer.wordpress.org/reference/since/4.4.0/) | Introduced. |
wordpress default_password_nag() default\_password\_nag()
========================
File: `wp-admin/includes/user.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/user.php/)
```
function default_password_nag() {
global $pagenow;
// Short-circuit it.
if ( 'profile.php' === $pagenow || ! get_user_option( 'default_password_nag' ) ) {
return;
}
echo '<div class="error default-password-nag">';
echo '<p>';
echo '<strong>' . __( 'Notice:' ) . '</strong> ';
_e( 'You’re using the auto-generated password for your account. Would you like to change it?' );
echo '</p><p>';
printf( '<a href="%s">' . __( 'Yes, take me to my profile page' ) . '</a> | ', get_edit_profile_url() . '#password' );
printf( '<a href="%s" id="default-password-nag-no">' . __( 'No thanks, do not remind me again' ) . '</a>', '?default_password_nag=0' );
echo '</p></div>';
}
```
| Uses | Description |
| --- | --- |
| [get\_edit\_profile\_url()](get_edit_profile_url) wp-includes/link-template.php | Retrieves the URL to the user’s profile editor. |
| [get\_user\_option()](get_user_option) wp-includes/user.php | Retrieves user option that can be either per Site or per Network. |
| [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. |
| [\_e()](_e) wp-includes/l10n.php | Displays translated text. |
| Version | Description |
| --- | --- |
| [2.8.0](https://developer.wordpress.org/reference/since/2.8.0/) | Introduced. |
wordpress _wp_relative_upload_path( string $path ): string \_wp\_relative\_upload\_path( string $path ): string
====================================================
This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.
Returns relative path to an uploaded file.
The path is relative to the current upload dir.
`$path` string Required Full path to the file. string Relative path on success, unchanged path on failure.
File: `wp-includes/post.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/post.php/)
```
function _wp_relative_upload_path( $path ) {
$new_path = $path;
$uploads = wp_get_upload_dir();
if ( 0 === strpos( $new_path, $uploads['basedir'] ) ) {
$new_path = str_replace( $uploads['basedir'], '', $new_path );
$new_path = ltrim( $new_path, '/' );
}
/**
* Filters the relative path to an uploaded file.
*
* @since 2.9.0
*
* @param string $new_path Relative path to the file.
* @param string $path Full path to the file.
*/
return apply_filters( '_wp_relative_upload_path', $new_path, $path );
}
```
[apply\_filters( '\_wp\_relative\_upload\_path', string $new\_path, string $path )](../hooks/_wp_relative_upload_path)
Filters the relative path to an uploaded file.
| Uses | Description |
| --- | --- |
| [wp\_get\_upload\_dir()](wp_get_upload_dir) wp-includes/functions.php | Retrieves uploads directory information. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| Used By | Description |
| --- | --- |
| [WP\_REST\_Attachments\_Controller::edit\_media\_item()](../classes/wp_rest_attachments_controller/edit_media_item) wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php | Applies edits to a media item and creates a new attachment record. |
| [\_wp\_image\_meta\_replace\_original()](_wp_image_meta_replace_original) wp-admin/includes/image.php | Updates the attached file and image meta data when the original image was edited. |
| [wp\_create\_image\_subsizes()](wp_create_image_subsizes) wp-admin/includes/image.php | Creates image sub-sizes, adds the new data to the image meta `sizes` array, and updates the image metadata. |
| [wp\_restore\_image()](wp_restore_image) wp-admin/includes/image-edit.php | Restores the metadata for a given attachment. |
| [wp\_save\_image()](wp_save_image) wp-admin/includes/image-edit.php | Saves image to post, along with enqueued changes in `$_REQUEST['history']`. |
| [update\_attached\_file()](update_attached_file) wp-includes/post.php | Updates attachment file path based on attachment ID. |
| Version | Description |
| --- | --- |
| [2.9.0](https://developer.wordpress.org/reference/since/2.9.0/) | Introduced. |
wordpress is_active_sidebar( string|int $index ): bool is\_active\_sidebar( string|int $index ): bool
==============================================
Determines whether a sidebar contains widgets.
For more information on this and similar theme functions, check out the [Conditional Tags](https://developer.wordpress.org/themes/basics/conditional-tags/) article in the Theme Developer Handbook.
`$index` string|int Required Sidebar name, id or number to check. bool True if the sidebar has widgets, false otherwise.
File: `wp-includes/widgets.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/widgets.php/)
```
function is_active_sidebar( $index ) {
$index = ( is_int( $index ) ) ? "sidebar-$index" : sanitize_title( $index );
$sidebars_widgets = wp_get_sidebars_widgets();
$is_active_sidebar = ! empty( $sidebars_widgets[ $index ] );
/**
* Filters whether a dynamic sidebar is considered "active".
*
* @since 3.9.0
*
* @param bool $is_active_sidebar Whether or not the sidebar should be considered "active".
* In other words, whether the sidebar contains any widgets.
* @param int|string $index Index, name, or ID of the dynamic sidebar.
*/
return apply_filters( 'is_active_sidebar', $is_active_sidebar, $index );
}
```
[apply\_filters( 'is\_active\_sidebar', bool $is\_active\_sidebar, int|string $index )](../hooks/is_active_sidebar)
Filters whether a dynamic sidebar is considered “active”.
| Uses | Description |
| --- | --- |
| [sanitize\_title()](sanitize_title) wp-includes/formatting.php | Sanitizes a string into a slug, which can be used in URLs or HTML attributes. |
| [wp\_get\_sidebars\_widgets()](wp_get_sidebars_widgets) wp-includes/widgets.php | Retrieve full list of sidebars and their widget instance IDs. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| Version | Description |
| --- | --- |
| [2.8.0](https://developer.wordpress.org/reference/since/2.8.0/) | Introduced. |
wordpress the_date( string $format = '', string $before = '', string $after = '', bool $echo = true ): string|void the\_date( string $format = '', string $before = '', string $after = '', bool $echo = true ): string|void
=========================================================================================================
Displays or retrieves the date the current post was written (once per date)
Will only output the date if the current post’s date is different from the previous one output.
i.e. Only one date listing will show per day worth of posts shown in the loop, even if the function is called several times for each post.
HTML output can be filtered with ‘the\_date’.
Date string output can be filtered with ‘get\_the\_date’.
`$format` string Optional PHP date format. Defaults to the `'date_format'` option. Default: `''`
`$before` string Optional Output before the date. Default: `''`
`$after` string Optional Output after the date. Default: `''`
`$echo` bool Optional Whether to echo the date or return it. Default: `true`
string|void String if retrieving.
File: `wp-includes/general-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/general-template.php/)
```
function the_date( $format = '', $before = '', $after = '', $echo = true ) {
global $currentday, $previousday;
$the_date = '';
if ( is_new_day() ) {
$the_date = $before . get_the_date( $format ) . $after;
$previousday = $currentday;
}
/**
* Filters the date a post was published for display.
*
* @since 0.71
*
* @param string $the_date The formatted date string.
* @param string $format PHP date format.
* @param string $before HTML output before the date.
* @param string $after HTML output after the date.
*/
$the_date = apply_filters( 'the_date', $the_date, $format, $before, $after );
if ( $echo ) {
echo $the_date;
} else {
return $the_date;
}
}
```
[apply\_filters( 'the\_date', string $the\_date, string $format, string $before, string $after )](../hooks/the_date)
Filters the date a post was published for display.
| Uses | Description |
| --- | --- |
| [get\_the\_date()](get_the_date) wp-includes/general-template.php | Retrieves the date on which the post was written. |
| [is\_new\_day()](is_new_day) wp-includes/functions.php | Determines whether the publish date of the current post in the loop is different from the publish date of the previous post in the loop. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| Version | Description |
| --- | --- |
| [0.71](https://developer.wordpress.org/reference/since/0.71/) | Introduced. |
| programming_docs |
wordpress set_transient( string $transient, mixed $value, int $expiration ): bool set\_transient( string $transient, mixed $value, int $expiration ): bool
========================================================================
Sets/updates the value of a transient.
You do not need to serialize values. If the value needs to be serialized, then it will be serialized before it is set.
`$transient` string Required Transient name. Expected to not be SQL-escaped.
Must be 172 characters or fewer in length. `$value` mixed Required Transient value. Must be serializable if non-scalar.
Expected to not be SQL-escaped. `$expiration` int Optional Time until expiration in seconds. Default 0 (no expiration). bool True if the value was set, false otherwise.
For parameter `$transient`, if memcached is not enabled the name should be 172 characters or less in length as WordPress will prefix your name with “\_transient\_” or “\_transient\_timeout\_” in the options table (depending on whether it expires or not). Longer key names will silently fail. See [Trac #15058](https://core.trac.wordpress.org/ticket/15058).
If a transient exists, this function will update the transient’s expiration time.
NB: transients that never expire are autoloaded, whereas transients with an expiration time are not autoloaded. Consider this when adding transients that may not be needed on every page, and thus do not need to be autoloaded, impacting page performance.
WordPress provides some constants for specifying time in seconds. Instead of multiplying out integers, see [Transients\_API#Using\_Time\_Constants](https://codex.wordpress.org/Transients_API#Using_Time_Constants "Transients API").
Transient key names are limited to 191 characters due to the database schema in the wp\_options table ( option\_name: varchar(191) ).
In WordPress versions previous to 4.4, the length limitation was 45 in set\_transient (now 172) and 64 in the database (now 191).
File: `wp-includes/option.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/option.php/)
```
function set_transient( $transient, $value, $expiration = 0 ) {
$expiration = (int) $expiration;
/**
* Filters a specific transient before its value is set.
*
* The dynamic portion of the hook name, `$transient`, refers to the transient name.
*
* @since 3.0.0
* @since 4.2.0 The `$expiration` parameter was added.
* @since 4.4.0 The `$transient` parameter was added.
*
* @param mixed $value New value of transient.
* @param int $expiration Time until expiration in seconds.
* @param string $transient Transient name.
*/
$value = apply_filters( "pre_set_transient_{$transient}", $value, $expiration, $transient );
/**
* Filters the expiration for a transient before its value is set.
*
* The dynamic portion of the hook name, `$transient`, refers to the transient name.
*
* @since 4.4.0
*
* @param int $expiration Time until expiration in seconds. Use 0 for no expiration.
* @param mixed $value New value of transient.
* @param string $transient Transient name.
*/
$expiration = apply_filters( "expiration_of_transient_{$transient}", $expiration, $value, $transient );
if ( wp_using_ext_object_cache() || wp_installing() ) {
$result = wp_cache_set( $transient, $value, 'transient', $expiration );
} else {
$transient_timeout = '_transient_timeout_' . $transient;
$transient_option = '_transient_' . $transient;
if ( false === get_option( $transient_option ) ) {
$autoload = 'yes';
if ( $expiration ) {
$autoload = 'no';
add_option( $transient_timeout, time() + $expiration, '', 'no' );
}
$result = add_option( $transient_option, $value, '', $autoload );
} else {
// If expiration is requested, but the transient has no timeout option,
// delete, then re-create transient rather than update.
$update = true;
if ( $expiration ) {
if ( false === get_option( $transient_timeout ) ) {
delete_option( $transient_option );
add_option( $transient_timeout, time() + $expiration, '', 'no' );
$result = add_option( $transient_option, $value, '', 'no' );
$update = false;
} else {
update_option( $transient_timeout, time() + $expiration );
}
}
if ( $update ) {
$result = update_option( $transient_option, $value );
}
}
}
if ( $result ) {
/**
* Fires after the value for a specific transient has been set.
*
* The dynamic portion of the hook name, `$transient`, refers to the transient name.
*
* @since 3.0.0
* @since 3.6.0 The `$value` and `$expiration` parameters were added.
* @since 4.4.0 The `$transient` parameter was added.
*
* @param mixed $value Transient value.
* @param int $expiration Time until expiration in seconds.
* @param string $transient The name of the transient.
*/
do_action( "set_transient_{$transient}", $value, $expiration, $transient );
/**
* Fires after the value for a transient has been set.
*
* @since 3.0.0
* @since 3.6.0 The `$value` and `$expiration` parameters were added.
*
* @param string $transient The name of the transient.
* @param mixed $value Transient value.
* @param int $expiration Time until expiration in seconds.
*/
do_action( 'setted_transient', $transient, $value, $expiration );
}
return $result;
}
```
[apply\_filters( "expiration\_of\_transient\_{$transient}", int $expiration, mixed $value, string $transient )](../hooks/expiration_of_transient_transient)
Filters the expiration for a transient before its value is set.
[apply\_filters( "pre\_set\_transient\_{$transient}", mixed $value, int $expiration, string $transient )](../hooks/pre_set_transient_transient)
Filters a specific transient before its value is set.
[do\_action( 'setted\_transient', string $transient, mixed $value, int $expiration )](../hooks/setted_transient)
Fires after the value for a transient has been set.
[do\_action( "set\_transient\_{$transient}", mixed $value, int $expiration, string $transient )](../hooks/set_transient_transient)
Fires after the value for a specific transient has been set.
| Uses | Description |
| --- | --- |
| [wp\_installing()](wp_installing) wp-includes/load.php | Check or set whether WordPress is in “installation” mode. |
| [wp\_cache\_set()](wp_cache_set) wp-includes/cache.php | Saves the data to the cache. |
| [wp\_using\_ext\_object\_cache()](wp_using_ext_object_cache) wp-includes/load.php | Toggle `$_wp_using_ext_object_cache` on and off without directly touching global. |
| [add\_option()](add_option) wp-includes/option.php | Adds a new option. |
| [delete\_option()](delete_option) wp-includes/option.php | Removes option by name. Prevents removal of protected WordPress options. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| [do\_action()](do_action) wp-includes/plugin.php | Calls the callback functions that have been added to an action hook. |
| [update\_option()](update_option) wp-includes/option.php | Updates the value of an option that was already added. |
| [get\_option()](get_option) wp-includes/option.php | Retrieves an option value based on an option name. |
| Used By | Description |
| --- | --- |
| [wp\_get\_global\_styles\_svg\_filters()](wp_get_global_styles_svg_filters) wp-includes/global-styles-and-settings.php | Returns a string containing the SVGs to be referenced as filters (duotone). |
| [wp\_get\_global\_stylesheet()](wp_get_global_stylesheet) wp-includes/global-styles-and-settings.php | Returns the stylesheet resulting of merging core, theme, and user data. |
| [clean\_dirsize\_cache()](clean_dirsize_cache) wp-includes/functions.php | Cleans directory size cache used by [recurse\_dirsize()](recurse_dirsize) . |
| [WP\_Site\_Health::wp\_cron\_scheduled\_check()](../classes/wp_site_health/wp_cron_scheduled_check) wp-admin/includes/class-wp-site-health.php | Runs the scheduled event to check and update the latest site health status for the website. |
| [wp\_ajax\_health\_check\_site\_status\_result()](wp_ajax_health_check_site_status_result) wp-admin/includes/ajax-actions.php | Ajax handler for site health check to update the result status. |
| [wp\_edit\_theme\_plugin\_file()](wp_edit_theme_plugin_file) wp-admin/includes/file.php | Attempts to edit a file for a theme or plugin. |
| [WP\_oEmbed\_Controller::get\_proxy\_item()](../classes/wp_oembed_controller/get_proxy_item) wp-includes/class-wp-oembed-controller.php | Callback for the proxy API endpoint. |
| [install\_themes\_feature\_list()](install_themes_feature_list) wp-admin/includes/theme-install.php | Retrieves the list of WordPress theme features (aka theme tags). |
| [wp\_dashboard\_cached\_rss\_widget()](wp_dashboard_cached_rss_widget) wp-admin/includes/dashboard.php | Checks to see if all of the feed url in $check\_urls are cached. |
| [wp\_dashboard\_plugins\_output()](wp_dashboard_plugins_output) wp-admin/includes/deprecated.php | Display plugins text for the WordPress news widget. |
| [spawn\_cron()](spawn_cron) wp-includes/cron.php | Sends a request to run cron through HTTP request that doesn’t halt page loading. |
| [wp\_rand()](wp_rand) wp-includes/pluggable.php | Generates a random non-negative number. |
| [WP\_Feed\_Cache\_Transient::save()](../classes/wp_feed_cache_transient/save) wp-includes/class-wp-feed-cache-transient.php | Sets the transient. |
| [WP\_Feed\_Cache\_Transient::touch()](../classes/wp_feed_cache_transient/touch) wp-includes/class-wp-feed-cache-transient.php | Sets mod transient. |
| [wp\_maybe\_generate\_attachment\_metadata()](wp_maybe_generate_attachment_metadata) wp-includes/media.php | Maybe attempts to generate attachment metadata, if missing. |
| [recurse\_dirsize()](recurse_dirsize) wp-includes/functions.php | Gets the size of a directory recursively. |
| [is\_multi\_author()](is_multi_author) wp-includes/author-template.php | Determines whether this site has more than one author. |
| [RSSCache::set()](../classes/rsscache/set) wp-includes/rss.php | |
| Version | Description |
| --- | --- |
| [2.8.0](https://developer.wordpress.org/reference/since/2.8.0/) | Introduced. |
wordpress get_post_permalink( int|WP_Post $post, bool $leavename = false, bool $sample = false ): string|false get\_post\_permalink( int|WP\_Post $post, bool $leavename = false, bool $sample = false ): string|false
=======================================================================================================
Retrieves the permalink for a post of a custom post type.
`$post` int|[WP\_Post](../classes/wp_post) Optional Post ID or post object. Default is the global `$post`. `$leavename` bool Optional Whether to keep post name. Default: `false`
`$sample` bool Optional Is it a sample permalink. Default: `false`
string|false The post permalink URL. False if the post does not exist.
**Basic Usage**
```
<?php get_post_permalink( $id, $leavename, $sample ); ?>
```
See also [get\_permalink()](get_permalink) .
File: `wp-includes/link-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/link-template.php/)
```
function get_post_permalink( $post = 0, $leavename = false, $sample = false ) {
global $wp_rewrite;
$post = get_post( $post );
if ( ! $post ) {
return false;
}
$post_link = $wp_rewrite->get_extra_permastruct( $post->post_type );
$slug = $post->post_name;
$force_plain_link = wp_force_plain_post_permalink( $post );
$post_type = get_post_type_object( $post->post_type );
if ( $post_type->hierarchical ) {
$slug = get_page_uri( $post );
}
if ( ! empty( $post_link ) && ( ! $force_plain_link || $sample ) ) {
if ( ! $leavename ) {
$post_link = str_replace( "%$post->post_type%", $slug, $post_link );
}
$post_link = home_url( user_trailingslashit( $post_link ) );
} else {
if ( $post_type->query_var && ( isset( $post->post_status ) && ! $force_plain_link ) ) {
$post_link = add_query_arg( $post_type->query_var, $slug, '' );
} else {
$post_link = add_query_arg(
array(
'post_type' => $post->post_type,
'p' => $post->ID,
),
''
);
}
$post_link = home_url( $post_link );
}
/**
* Filters the permalink for a post of a custom post type.
*
* @since 3.0.0
*
* @param string $post_link The post's permalink.
* @param WP_Post $post The post in question.
* @param bool $leavename Whether to keep the post name.
* @param bool $sample Is it a sample permalink.
*/
return apply_filters( 'post_type_link', $post_link, $post, $leavename, $sample );
}
```
[apply\_filters( 'post\_type\_link', string $post\_link, WP\_Post $post, bool $leavename, bool $sample )](../hooks/post_type_link)
Filters the permalink for a post of a custom post type.
| Uses | Description |
| --- | --- |
| [wp\_force\_plain\_post\_permalink()](wp_force_plain_post_permalink) wp-includes/link-template.php | Determine whether post should always use a plain permalink structure. |
| [user\_trailingslashit()](user_trailingslashit) wp-includes/link-template.php | Retrieves a trailing-slashed string if the site is set for adding trailing slashes. |
| [get\_page\_uri()](get_page_uri) wp-includes/post.php | Builds the URI path for a page. |
| [WP\_Rewrite::get\_extra\_permastruct()](../classes/wp_rewrite/get_extra_permastruct) wp-includes/class-wp-rewrite.php | Retrieves an extra permalink structure by name. |
| [add\_query\_arg()](add_query_arg) wp-includes/functions.php | Retrieves a modified URL query string. |
| [home\_url()](home_url) wp-includes/link-template.php | Retrieves the URL for the current site where the front end is accessible. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| [get\_post()](get_post) wp-includes/post.php | Retrieves post data given a post ID or post object. |
| [get\_post\_type\_object()](get_post_type_object) wp-includes/post.php | Retrieves a post type object by name. |
| Used By | Description |
| --- | --- |
| [get\_permalink()](get_permalink) wp-includes/link-template.php | Retrieves the full permalink for the current post or post ID. |
| Version | Description |
| --- | --- |
| [6.1.0](https://developer.wordpress.org/reference/since/6.1.0/) | Returns false if the post does not exist. |
| [3.0.0](https://developer.wordpress.org/reference/since/3.0.0/) | Introduced. |
wordpress wp_update_comment( array $commentarr, bool $wp_error = false ): int|false|WP_Error wp\_update\_comment( array $commentarr, bool $wp\_error = false ): int|false|WP\_Error
======================================================================================
Updates an existing comment in the database.
Filters the comment and makes sure certain fields are valid before updating.
`$commentarr` array Required Contains information on the comment. `$wp_error` bool Optional Whether to return a [WP\_Error](../classes/wp_error) on failure. Default: `false`
int|false|[WP\_Error](../classes/wp_error) The value 1 if the comment was updated, 0 if not updated.
False or a [WP\_Error](../classes/wp_error) object on failure.
See [get\_comment()](get_comment) for a list of valid attributes for $commentarr
File: `wp-includes/comment.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/comment.php/)
```
function wp_update_comment( $commentarr, $wp_error = false ) {
global $wpdb;
// First, get all of the original fields.
$comment = get_comment( $commentarr['comment_ID'], ARRAY_A );
if ( empty( $comment ) ) {
if ( $wp_error ) {
return new WP_Error( 'invalid_comment_id', __( 'Invalid comment ID.' ) );
} else {
return false;
}
}
// Make sure that the comment post ID is valid (if specified).
if ( ! empty( $commentarr['comment_post_ID'] ) && ! get_post( $commentarr['comment_post_ID'] ) ) {
if ( $wp_error ) {
return new WP_Error( 'invalid_post_id', __( 'Invalid post ID.' ) );
} else {
return false;
}
}
$filter_comment = false;
if ( ! has_filter( 'pre_comment_content', 'wp_filter_kses' ) ) {
$filter_comment = ! user_can( isset( $comment['user_id'] ) ? $comment['user_id'] : 0, 'unfiltered_html' );
}
if ( $filter_comment ) {
add_filter( 'pre_comment_content', 'wp_filter_kses' );
}
// Escape data pulled from DB.
$comment = wp_slash( $comment );
$old_status = $comment['comment_approved'];
// Merge old and new fields with new fields overwriting old ones.
$commentarr = array_merge( $comment, $commentarr );
$commentarr = wp_filter_comment( $commentarr );
if ( $filter_comment ) {
remove_filter( 'pre_comment_content', 'wp_filter_kses' );
}
// Now extract the merged array.
$data = wp_unslash( $commentarr );
/**
* Filters the comment content before it is updated in the database.
*
* @since 1.5.0
*
* @param string $comment_content The comment data.
*/
$data['comment_content'] = apply_filters( 'comment_save_pre', $data['comment_content'] );
$data['comment_date_gmt'] = get_gmt_from_date( $data['comment_date'] );
if ( ! isset( $data['comment_approved'] ) ) {
$data['comment_approved'] = 1;
} elseif ( 'hold' === $data['comment_approved'] ) {
$data['comment_approved'] = 0;
} elseif ( 'approve' === $data['comment_approved'] ) {
$data['comment_approved'] = 1;
}
$comment_id = $data['comment_ID'];
$comment_post_id = $data['comment_post_ID'];
/**
* Filters the comment data immediately before it is updated in the database.
*
* Note: data being passed to the filter is already unslashed.
*
* @since 4.7.0
* @since 5.5.0 Returning a WP_Error value from the filter will short-circuit comment update
* and allow skipping further processing.
*
* @param array|WP_Error $data The new, processed comment data, or WP_Error.
* @param array $comment The old, unslashed comment data.
* @param array $commentarr The new, raw comment data.
*/
$data = apply_filters( 'wp_update_comment_data', $data, $comment, $commentarr );
// Do not carry on on failure.
if ( is_wp_error( $data ) ) {
if ( $wp_error ) {
return $data;
} else {
return false;
}
}
$keys = array(
'comment_post_ID',
'comment_author',
'comment_author_email',
'comment_author_url',
'comment_author_IP',
'comment_date',
'comment_date_gmt',
'comment_content',
'comment_karma',
'comment_approved',
'comment_agent',
'comment_type',
'comment_parent',
'user_id',
);
$data = wp_array_slice_assoc( $data, $keys );
$result = $wpdb->update( $wpdb->comments, $data, array( 'comment_ID' => $comment_id ) );
if ( false === $result ) {
if ( $wp_error ) {
return new WP_Error( 'db_update_error', __( 'Could not update comment in the database.' ), $wpdb->last_error );
} else {
return false;
}
}
// If metadata is provided, store it.
if ( isset( $commentarr['comment_meta'] ) && is_array( $commentarr['comment_meta'] ) ) {
foreach ( $commentarr['comment_meta'] as $meta_key => $meta_value ) {
update_comment_meta( $comment_id, $meta_key, $meta_value );
}
}
clean_comment_cache( $comment_id );
wp_update_comment_count( $comment_post_id );
/**
* Fires immediately after a comment is updated in the database.
*
* The hook also fires immediately before comment status transition hooks are fired.
*
* @since 1.2.0
* @since 4.6.0 Added the `$data` parameter.
*
* @param int $comment_id The comment ID.
* @param array $data Comment data.
*/
do_action( 'edit_comment', $comment_id, $data );
$comment = get_comment( $comment_id );
wp_transition_comment_status( $comment->comment_approved, $old_status, $comment );
return $result;
}
```
[apply\_filters( 'comment\_save\_pre', string $comment\_content )](../hooks/comment_save_pre)
Filters the comment content before it is updated in the database.
[do\_action( 'edit\_comment', int $comment\_id, array $data )](../hooks/edit_comment)
Fires immediately after a comment is updated in the database.
[apply\_filters( 'wp\_update\_comment\_data', array|WP\_Error $data, array $comment, array $commentarr )](../hooks/wp_update_comment_data)
Filters the comment data immediately before it is updated in the database.
| Uses | Description |
| --- | --- |
| [user\_can()](user_can) wp-includes/capabilities.php | Returns whether a particular user has the specified capability. |
| [clean\_comment\_cache()](clean_comment_cache) wp-includes/comment.php | Removes a comment from the object cache. |
| [get\_gmt\_from\_date()](get_gmt_from_date) wp-includes/formatting.php | Given a date in the timezone of the site, returns that date in UTC. |
| [wp\_array\_slice\_assoc()](wp_array_slice_assoc) wp-includes/functions.php | Extracts a slice of an array, given a list of keys. |
| [has\_filter()](has_filter) wp-includes/plugin.php | Checks if any filter has been registered for a hook. |
| [update\_comment\_meta()](update_comment_meta) wp-includes/comment.php | Updates comment meta field based on comment ID. |
| [remove\_filter()](remove_filter) wp-includes/plugin.php | Removes a callback function from a filter hook. |
| [wp\_transition\_comment\_status()](wp_transition_comment_status) wp-includes/comment.php | Calls hooks for when a comment status transition occurs. |
| [wp\_filter\_comment()](wp_filter_comment) wp-includes/comment.php | Filters and sanitizes comment data. |
| [wp\_update\_comment\_count()](wp_update_comment_count) wp-includes/comment.php | Updates the comment count for post(s). |
| [wpdb::update()](../classes/wpdb/update) wp-includes/class-wpdb.php | Updates a row in the table. |
| [is\_wp\_error()](is_wp_error) wp-includes/load.php | Checks whether the given variable is a WordPress Error. |
| [get\_comment()](get_comment) wp-includes/comment.php | Retrieves comment data given a comment ID or comment object. |
| [do\_action()](do_action) wp-includes/plugin.php | Calls the callback functions that have been added to an action hook. |
| [get\_post()](get_post) wp-includes/post.php | Retrieves post data given a post ID or post object. |
| [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| [add\_filter()](add_filter) wp-includes/plugin.php | Adds a callback function to a filter hook. |
| [wp\_unslash()](wp_unslash) wp-includes/formatting.php | Removes slashes from a string or recursively removes slashes from strings within an array. |
| [wp\_slash()](wp_slash) wp-includes/formatting.php | Adds slashes to a string or recursively adds slashes to strings within an array. |
| [WP\_Error::\_\_construct()](../classes/wp_error/__construct) wp-includes/class-wp-error.php | Initializes the error. |
| Used By | Description |
| --- | --- |
| [WP\_REST\_Comments\_Controller::update\_item()](../classes/wp_rest_comments_controller/update_item) wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php | Updates a comment. |
| [edit\_comment()](edit_comment) wp-admin/includes/comment.php | Updates a comment with values provided in $\_POST. |
| [wp\_xmlrpc\_server::wp\_editComment()](../classes/wp_xmlrpc_server/wp_editcomment) wp-includes/class-wp-xmlrpc-server.php | Edit comment. |
| Version | Description |
| --- | --- |
| [5.5.0](https://developer.wordpress.org/reference/since/5.5.0/) | The return values for an invalid comment or post ID were changed to false instead of 0. |
| [4.9.0](https://developer.wordpress.org/reference/since/4.9.0/) | Add updating comment meta during comment update. |
| [2.0.0](https://developer.wordpress.org/reference/since/2.0.0/) | Introduced. |
| programming_docs |
wordpress get_theme_mods(): array get\_theme\_mods(): array
=========================
Retrieves all theme modifications.
array Theme modifications.
This function will update the options for theme mods which were created in older WordPress versions that used the deprecated mods\_$theme\_name option key to now use [theme\_mod\_$name](../hooks/theme_mod_name).
File: `wp-includes/theme.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/theme.php/)
```
function get_theme_mods() {
$theme_slug = get_option( 'stylesheet' );
$mods = get_option( "theme_mods_$theme_slug" );
if ( false === $mods ) {
$theme_name = get_option( 'current_theme' );
if ( false === $theme_name ) {
$theme_name = wp_get_theme()->get( 'Name' );
}
$mods = get_option( "mods_$theme_name" ); // Deprecated location.
if ( is_admin() && false !== $mods ) {
update_option( "theme_mods_$theme_slug", $mods );
delete_option( "mods_$theme_name" );
}
}
if ( ! is_array( $mods ) ) {
$mods = array();
}
return $mods;
}
```
| Uses | Description |
| --- | --- |
| [WP\_Theme::get()](../classes/wp_theme/get) wp-includes/class-wp-theme.php | Gets a raw, unformatted theme header. |
| [delete\_option()](delete_option) wp-includes/option.php | Removes option by name. Prevents removal of protected WordPress options. |
| [wp\_get\_theme()](wp_get_theme) wp-includes/theme.php | Gets a [WP\_Theme](../classes/wp_theme) object for a theme. |
| [is\_admin()](is_admin) wp-includes/load.php | Determines whether the current request is for an administrative interface page. |
| [update\_option()](update_option) wp-includes/option.php | Updates the value of an option that was already added. |
| [get\_option()](get_option) wp-includes/option.php | Retrieves an option value based on an option name. |
| Used By | Description |
| --- | --- |
| [get\_media\_states()](get_media_states) wp-admin/includes/template.php | Retrieves an array of media states from an attachment. |
| [set\_theme\_mod()](set_theme_mod) wp-includes/theme.php | Updates theme modification value for the active theme. |
| [remove\_theme\_mod()](remove_theme_mod) wp-includes/theme.php | Removes theme modification name from active theme list. |
| [get\_theme\_mod()](get_theme_mod) wp-includes/theme.php | Retrieves theme modification value for the active theme. |
| Version | Description |
| --- | --- |
| [5.9.0](https://developer.wordpress.org/reference/since/5.9.0/) | The return value is always an array. |
| [3.1.0](https://developer.wordpress.org/reference/since/3.1.0/) | Introduced. |
wordpress wpmu_new_site_admin_notification( int $site_id, int $user_id ): bool wpmu\_new\_site\_admin\_notification( int $site\_id, int $user\_id ): bool
==========================================================================
Notifies the Multisite network administrator that a new site was created.
Filter [‘send\_new\_site\_email’](../hooks/send_new_site_email) to disable or bypass.
Filter [‘new\_site\_email’](../hooks/new_site_email) to filter the contents.
`$site_id` int Required Site ID of the new site. `$user_id` int Required User ID of the administrator of the new site. bool Whether the email notification was sent.
File: `wp-includes/ms-functions.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/ms-functions.php/)
```
function wpmu_new_site_admin_notification( $site_id, $user_id ) {
$site = get_site( $site_id );
$user = get_userdata( $user_id );
$email = get_site_option( 'admin_email' );
if ( ! $site || ! $user || ! $email ) {
return false;
}
/**
* Filters whether to send an email to the Multisite network administrator when a new site is created.
*
* Return false to disable sending the email.
*
* @since 5.6.0
*
* @param bool $send Whether to send the email.
* @param WP_Site $site Site object of the new site.
* @param WP_User $user User object of the administrator of the new site.
*/
if ( ! apply_filters( 'send_new_site_email', true, $site, $user ) ) {
return false;
}
$switched_locale = false;
$network_admin = get_user_by( 'email', $email );
if ( $network_admin ) {
// If the network admin email address corresponds to a user, switch to their locale.
$switched_locale = switch_to_locale( get_user_locale( $network_admin ) );
} else {
// Otherwise switch to the locale of the current site.
$switched_locale = switch_to_locale( get_locale() );
}
$subject = sprintf(
/* translators: New site notification email subject. %s: Network title. */
__( '[%s] New Site Created' ),
get_network()->site_name
);
$message = sprintf(
/* translators: New site notification email. 1: User login, 2: Site URL, 3: Site title. */
__(
'New site created by %1$s
Address: %2$s
Name: %3$s'
),
$user->user_login,
get_site_url( $site->id ),
get_blog_option( $site->id, 'blogname' )
);
$header = sprintf(
'From: "%1$s" <%2$s>',
_x( 'Site Admin', 'email "From" field' ),
$email
);
$new_site_email = array(
'to' => $email,
'subject' => $subject,
'message' => $message,
'headers' => $header,
);
/**
* Filters the content of the email sent to the Multisite network administrator when a new site is created.
*
* Content should be formatted for transmission via wp_mail().
*
* @since 5.6.0
*
* @param array $new_site_email {
* Used to build wp_mail().
*
* @type string $to The email address of the recipient.
* @type string $subject The subject of the email.
* @type string $message The content of the email.
* @type string $headers Headers.
* }
* @param WP_Site $site Site object of the new site.
* @param WP_User $user User object of the administrator of the new site.
*/
$new_site_email = apply_filters( 'new_site_email', $new_site_email, $site, $user );
wp_mail(
$new_site_email['to'],
wp_specialchars_decode( $new_site_email['subject'] ),
$new_site_email['message'],
$new_site_email['headers']
);
if ( $switched_locale ) {
restore_previous_locale();
}
return true;
}
```
[apply\_filters( 'new\_site\_email', array $new\_site\_email, WP\_Site $site, WP\_User $user )](../hooks/new_site_email)
Filters the content of the email sent to the Multisite network administrator when a new site is created.
[apply\_filters( 'send\_new\_site\_email', bool $send, WP\_Site $site, WP\_User $user )](../hooks/send_new_site_email)
Filters whether to send an email to the Multisite network administrator when a new site is created.
| Uses | Description |
| --- | --- |
| [restore\_previous\_locale()](restore_previous_locale) wp-includes/l10n.php | Restores the translations according to the previous locale. |
| [switch\_to\_locale()](switch_to_locale) wp-includes/l10n.php | Switches the translations according to the given locale. |
| [get\_user\_locale()](get_user_locale) wp-includes/l10n.php | Retrieves the locale of a user. |
| [get\_network()](get_network) wp-includes/ms-network.php | Retrieves network data given a network ID or network object. |
| [get\_site()](get_site) wp-includes/ms-site.php | Retrieves site data given a site ID or site object. |
| [get\_locale()](get_locale) wp-includes/l10n.php | Retrieves the current locale. |
| [wp\_specialchars\_decode()](wp_specialchars_decode) wp-includes/formatting.php | Converts a number of HTML entities into their special characters. |
| [get\_user\_by()](get_user_by) wp-includes/pluggable.php | Retrieves user info by a given field. |
| [wp\_mail()](wp_mail) wp-includes/pluggable.php | Sends an email, similar to PHP’s mail function. |
| [get\_site\_url()](get_site_url) wp-includes/link-template.php | Retrieves the URL for a given site where WordPress application files (e.g. wp-blog-header.php or the wp-admin/ folder) are accessible. |
| [get\_blog\_option()](get_blog_option) wp-includes/ms-blogs.php | Retrieve option value for a given blog id based on name of option. |
| [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. |
| [\_x()](_x) wp-includes/l10n.php | Retrieves translated string with gettext context. |
| [get\_userdata()](get_userdata) wp-includes/pluggable.php | Retrieves user info by user ID. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| [get\_site\_option()](get_site_option) wp-includes/option.php | Retrieve an option value for the current network based on name of option. |
| Version | Description |
| --- | --- |
| [5.6.0](https://developer.wordpress.org/reference/since/5.6.0/) | Introduced. |
wordpress get_the_attachment_link( int $id, bool $fullsize = false, array $max_dims = false, bool $permalink = false ): string get\_the\_attachment\_link( int $id, bool $fullsize = false, array $max\_dims = false, bool $permalink = false ): string
========================================================================================================================
This function has been deprecated. Use [wp\_get\_attachment\_link()](wp_get_attachment_link) instead.
Retrieve HTML content of attachment image with link.
* [wp\_get\_attachment\_link()](wp_get_attachment_link)
`$id` int Optional Post ID. `$fullsize` bool Optional Whether to use full size image. Default: `false`
`$max_dims` array Optional Max image dimensions. Default: `false`
`$permalink` bool Optional Whether to include permalink to image. Default: `false`
string
File: `wp-includes/deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/deprecated.php/)
```
function get_the_attachment_link($id = 0, $fullsize = false, $max_dims = false, $permalink = false) {
_deprecated_function( __FUNCTION__, '2.5.0', 'wp_get_attachment_link()' );
$id = (int) $id;
$_post = get_post($id);
if ( ('attachment' != $_post->post_type) || !$url = wp_get_attachment_url($_post->ID) )
return __('Missing Attachment');
if ( $permalink )
$url = get_attachment_link($_post->ID);
$post_title = esc_attr($_post->post_title);
$innerHTML = get_attachment_innerHTML($_post->ID, $fullsize, $max_dims);
return "<a href='$url' title='$post_title'>$innerHTML</a>";
}
```
| Uses | Description |
| --- | --- |
| [get\_attachment\_innerHTML()](get_attachment_innerhtml) wp-includes/deprecated.php | Retrieve HTML content of image element. |
| [get\_attachment\_link()](get_attachment_link) wp-includes/link-template.php | Retrieves the permalink for an attachment. |
| [wp\_get\_attachment\_url()](wp_get_attachment_url) wp-includes/post.php | Retrieves the URL for an attachment. |
| [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. |
| [esc\_attr()](esc_attr) wp-includes/formatting.php | Escaping for HTML attributes. |
| [\_deprecated\_function()](_deprecated_function) wp-includes/functions.php | Marks a function as deprecated and inform when it has been used. |
| [get\_post()](get_post) wp-includes/post.php | Retrieves post data given a post ID or post object. |
| Version | Description |
| --- | --- |
| [2.5.0](https://developer.wordpress.org/reference/since/2.5.0/) | Use [wp\_get\_attachment\_link()](wp_get_attachment_link) |
| [2.0.0](https://developer.wordpress.org/reference/since/2.0.0/) | Introduced. |
wordpress allow_subdomain_install(): bool allow\_subdomain\_install(): bool
=================================
Allow subdomain installation
bool Whether subdomain installation is allowed
File: `wp-admin/includes/network.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/network.php/)
```
function allow_subdomain_install() {
$domain = preg_replace( '|https?://([^/]+)|', '$1', get_option( 'home' ) );
if ( parse_url( get_option( 'home' ), PHP_URL_PATH ) || 'localhost' === $domain || preg_match( '|^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$|', $domain ) ) {
return false;
}
return true;
}
```
| Uses | Description |
| --- | --- |
| [get\_option()](get_option) wp-includes/option.php | Retrieves an option value based on an option name. |
| Used By | Description |
| --- | --- |
| [network\_step1()](network_step1) wp-admin/includes/network.php | Prints step 1 for Network installation process. |
| [network\_step2()](network_step2) wp-admin/includes/network.php | Prints step 2 for Network installation process. |
| Version | Description |
| --- | --- |
| [3.0.0](https://developer.wordpress.org/reference/since/3.0.0/) | Introduced. |
wordpress comment_author_url( int|WP_Comment $comment_ID ) comment\_author\_url( int|WP\_Comment $comment\_ID )
====================================================
Displays the URL of the author of the current comment, not linked.
`$comment_ID` int|[WP\_Comment](../classes/wp_comment) Optional [WP\_Comment](../classes/wp_comment) or the ID of the comment for which to print the author's URL.
Default current comment. File: `wp-includes/comment-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/comment-template.php/)
```
function comment_author_url( $comment_ID = 0 ) {
$comment = get_comment( $comment_ID );
$author_url = get_comment_author_url( $comment );
/**
* Filters the comment author's URL for display.
*
* @since 1.2.0
* @since 4.1.0 The `$comment_ID` parameter was added.
*
* @param string $author_url The comment author's URL.
* @param string $comment_ID The comment ID as a numeric string.
*/
echo apply_filters( 'comment_url', $author_url, $comment->comment_ID );
}
```
[apply\_filters( 'comment\_url', string $author\_url, string $comment\_ID )](../hooks/comment_url)
Filters the comment author’s URL for display.
| Uses | Description |
| --- | --- |
| [get\_comment\_author\_url()](get_comment_author_url) wp-includes/comment-template.php | Retrieves the URL of the author of the current comment, not linked. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| [get\_comment()](get_comment) wp-includes/comment.php | Retrieves comment data given a comment ID or comment object. |
| Version | Description |
| --- | --- |
| [4.4.0](https://developer.wordpress.org/reference/since/4.4.0/) | Added the ability for `$comment_ID` to also accept a [WP\_Comment](../classes/wp_comment) object. |
| [0.71](https://developer.wordpress.org/reference/since/0.71/) | Introduced. |
wordpress get_edit_profile_url( int $user_id, string $scheme = 'admin' ): string get\_edit\_profile\_url( int $user\_id, string $scheme = 'admin' ): string
==========================================================================
Retrieves the URL to the user’s profile editor.
`$user_id` int Optional User ID. Defaults to current user. `$scheme` string Optional The scheme to use. Default is `'admin'`, which obeys [force\_ssl\_admin()](force_ssl_admin) and [is\_ssl()](is_ssl) . `'http'` or `'https'` can be passed to force those schemes. Default: `'admin'`
string Dashboard URL link with optional path appended.
File: `wp-includes/link-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/link-template.php/)
```
function get_edit_profile_url( $user_id = 0, $scheme = 'admin' ) {
$user_id = $user_id ? (int) $user_id : get_current_user_id();
if ( is_user_admin() ) {
$url = user_admin_url( 'profile.php', $scheme );
} elseif ( is_network_admin() ) {
$url = network_admin_url( 'profile.php', $scheme );
} else {
$url = get_dashboard_url( $user_id, 'profile.php', $scheme );
}
/**
* Filters the URL for a user's profile editor.
*
* @since 3.1.0
*
* @param string $url The complete URL including scheme and path.
* @param int $user_id The user ID.
* @param string $scheme Scheme to give the URL context. Accepts 'http', 'https', 'login',
* 'login_post', 'admin', 'relative' or null.
*/
return apply_filters( 'edit_profile_url', $url, $user_id, $scheme );
}
```
[apply\_filters( 'edit\_profile\_url', string $url, int $user\_id, string $scheme )](../hooks/edit_profile_url)
Filters the URL for a user’s profile editor.
| Uses | Description |
| --- | --- |
| [is\_user\_admin()](is_user_admin) wp-includes/load.php | Determines whether the current request is for a user admin screen. |
| [is\_network\_admin()](is_network_admin) wp-includes/load.php | Determines whether the current request is for the network administrative interface. |
| [get\_dashboard\_url()](get_dashboard_url) wp-includes/link-template.php | Retrieves the URL to the user’s dashboard. |
| [user\_admin\_url()](user_admin_url) wp-includes/link-template.php | Retrieves the URL to the admin area for the current user. |
| [network\_admin\_url()](network_admin_url) wp-includes/link-template.php | Retrieves the URL to the admin area for the network. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| [get\_current\_user\_id()](get_current_user_id) wp-includes/user.php | Gets the current user’s ID. |
| Used By | Description |
| --- | --- |
| [WP\_Widget\_Custom\_HTML::add\_help\_text()](../classes/wp_widget_custom_html/add_help_text) wp-includes/widgets/class-wp-widget-custom-html.php | Add help text to widgets admin screen. |
| [default\_password\_nag()](default_password_nag) wp-admin/includes/user.php | |
| [WP\_Customize\_Manager::register\_controls()](../classes/wp_customize_manager/register_controls) wp-includes/class-wp-customize-manager.php | Registers some default controls. |
| [get\_edit\_user\_link()](get_edit_user_link) wp-includes/link-template.php | Retrieves the edit user link. |
| [wp\_admin\_bar\_my\_account\_item()](wp_admin_bar_my_account_item) wp-includes/admin-bar.php | Adds the “My Account” item. |
| [wp\_admin\_bar\_my\_account\_menu()](wp_admin_bar_my_account_menu) wp-includes/admin-bar.php | Adds the “My Account” submenu items. |
| Version | Description |
| --- | --- |
| [3.1.0](https://developer.wordpress.org/reference/since/3.1.0/) | Introduced. |
wordpress redirect_guess_404_permalink(): string|false redirect\_guess\_404\_permalink(): string|false
===============================================
Attempts to guess the correct URL for a 404 request based on query vars.
string|false The correct URL if one is found. False on failure.
File: `wp-includes/canonical.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/canonical.php/)
```
function redirect_guess_404_permalink() {
global $wpdb;
/**
* Filters whether to attempt to guess a redirect URL for a 404 request.
*
* Returning a false value from the filter will disable the URL guessing
* and return early without performing a redirect.
*
* @since 5.5.0
*
* @param bool $do_redirect_guess Whether to attempt to guess a redirect URL
* for a 404 request. Default true.
*/
if ( false === apply_filters( 'do_redirect_guess_404_permalink', true ) ) {
return false;
}
/**
* Short-circuits the redirect URL guessing for 404 requests.
*
* Returning a non-null value from the filter will effectively short-circuit
* the URL guessing, returning the passed value instead.
*
* @since 5.5.0
*
* @param null|string|false $pre Whether to short-circuit guessing the redirect for a 404.
* Default null to continue with the URL guessing.
*/
$pre = apply_filters( 'pre_redirect_guess_404_permalink', null );
if ( null !== $pre ) {
return $pre;
}
if ( get_query_var( 'name' ) ) {
/**
* Filters whether to perform a strict guess for a 404 redirect.
*
* Returning a truthy value from the filter will redirect only exact post_name matches.
*
* @since 5.5.0
*
* @param bool $strict_guess Whether to perform a strict guess. Default false (loose guess).
*/
$strict_guess = apply_filters( 'strict_redirect_guess_404_permalink', false );
if ( $strict_guess ) {
$where = $wpdb->prepare( 'post_name = %s', get_query_var( 'name' ) );
} else {
$where = $wpdb->prepare( 'post_name LIKE %s', $wpdb->esc_like( get_query_var( 'name' ) ) . '%' );
}
// If any of post_type, year, monthnum, or day are set, use them to refine the query.
if ( get_query_var( 'post_type' ) ) {
if ( is_array( get_query_var( 'post_type' ) ) ) {
// phpcs:ignore WordPress.DB.PreparedSQLPlaceholders.UnfinishedPrepare
$where .= " AND post_type IN ('" . join( "', '", esc_sql( get_query_var( 'post_type' ) ) ) . "')";
} else {
$where .= $wpdb->prepare( ' AND post_type = %s', get_query_var( 'post_type' ) );
}
} else {
$where .= " AND post_type IN ('" . implode( "', '", get_post_types( array( 'public' => true ) ) ) . "')";
}
if ( get_query_var( 'year' ) ) {
$where .= $wpdb->prepare( ' AND YEAR(post_date) = %d', get_query_var( 'year' ) );
}
if ( get_query_var( 'monthnum' ) ) {
$where .= $wpdb->prepare( ' AND MONTH(post_date) = %d', get_query_var( 'monthnum' ) );
}
if ( get_query_var( 'day' ) ) {
$where .= $wpdb->prepare( ' AND DAYOFMONTH(post_date) = %d', get_query_var( 'day' ) );
}
$publicly_viewable_statuses = array_filter( get_post_stati(), 'is_post_status_viewable' );
// phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared
$post_id = $wpdb->get_var( "SELECT ID FROM $wpdb->posts WHERE $where AND post_status IN ('" . implode( "', '", esc_sql( $publicly_viewable_statuses ) ) . "')" );
if ( ! $post_id ) {
return false;
}
if ( get_query_var( 'feed' ) ) {
return get_post_comments_feed_link( $post_id, get_query_var( 'feed' ) );
} elseif ( get_query_var( 'page' ) > 1 ) {
return trailingslashit( get_permalink( $post_id ) ) . user_trailingslashit( get_query_var( 'page' ), 'single_paged' );
} else {
return get_permalink( $post_id );
}
}
return false;
}
```
[apply\_filters( 'do\_redirect\_guess\_404\_permalink', bool $do\_redirect\_guess )](../hooks/do_redirect_guess_404_permalink)
Filters whether to attempt to guess a redirect URL for a 404 request.
[apply\_filters( 'pre\_redirect\_guess\_404\_permalink', null|string|false $pre )](../hooks/pre_redirect_guess_404_permalink)
Short-circuits the redirect URL guessing for 404 requests.
[apply\_filters( 'strict\_redirect\_guess\_404\_permalink', bool $strict\_guess )](../hooks/strict_redirect_guess_404_permalink)
Filters whether to perform a strict guess for a 404 redirect.
| Uses | Description |
| --- | --- |
| [wpdb::esc\_like()](../classes/wpdb/esc_like) wp-includes/class-wpdb.php | First half of escaping for `LIKE` special characters `%` and `_` before preparing for SQL. |
| [esc\_sql()](esc_sql) wp-includes/formatting.php | Escapes data for use in a MySQL query. |
| [get\_query\_var()](get_query_var) wp-includes/query.php | Retrieves the value of a query variable in the [WP\_Query](../classes/wp_query) class. |
| [get\_post\_comments\_feed\_link()](get_post_comments_feed_link) wp-includes/link-template.php | Retrieves the permalink for the post comments feed. |
| [user\_trailingslashit()](user_trailingslashit) wp-includes/link-template.php | Retrieves a trailing-slashed string if the site is set for adding trailing slashes. |
| [get\_post\_stati()](get_post_stati) wp-includes/post.php | Gets a list of post statuses. |
| [trailingslashit()](trailingslashit) wp-includes/formatting.php | Appends a trailing slash. |
| [get\_permalink()](get_permalink) wp-includes/link-template.php | Retrieves the full permalink for the current post or post ID. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| [get\_post\_types()](get_post_types) wp-includes/post.php | Gets a list of all registered post type objects. |
| [wpdb::get\_var()](../classes/wpdb/get_var) wp-includes/class-wpdb.php | Retrieves one variable from the database. |
| [wpdb::prepare()](../classes/wpdb/prepare) wp-includes/class-wpdb.php | Prepares a SQL query for safe execution. |
| Used By | Description |
| --- | --- |
| [redirect\_canonical()](redirect_canonical) wp-includes/canonical.php | Redirects incoming links to the proper URL based on the site url. |
| Version | Description |
| --- | --- |
| [2.3.0](https://developer.wordpress.org/reference/since/2.3.0/) | Introduced. |
| programming_docs |
wordpress wp_mediaelement_fallback( string $url ): string wp\_mediaelement\_fallback( string $url ): string
=================================================
Provides a No-JS Flash fallback as a last resort for audio / video.
`$url` string Required The media element URL. string Fallback HTML.
File: `wp-includes/media.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/media.php/)
```
function wp_mediaelement_fallback( $url ) {
/**
* Filters the Mediaelement fallback output for no-JS.
*
* @since 3.6.0
*
* @param string $output Fallback output for no-JS.
* @param string $url Media file URL.
*/
return apply_filters( 'wp_mediaelement_fallback', sprintf( '<a href="%1$s">%1$s</a>', esc_url( $url ) ), $url );
}
```
[apply\_filters( 'wp\_mediaelement\_fallback', string $output, string $url )](../hooks/wp_mediaelement_fallback)
Filters the Mediaelement fallback output for no-JS.
| Uses | Description |
| --- | --- |
| [esc\_url()](esc_url) wp-includes/formatting.php | Checks and cleans a URL. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| Used By | Description |
| --- | --- |
| [wp\_video\_shortcode()](wp_video_shortcode) wp-includes/media.php | Builds the Video shortcode output. |
| [wp\_audio\_shortcode()](wp_audio_shortcode) wp-includes/media.php | Builds the Audio shortcode output. |
| Version | Description |
| --- | --- |
| [3.6.0](https://developer.wordpress.org/reference/since/3.6.0/) | Introduced. |
wordpress wp_get_network( object|int $network ): WP_Network|false wp\_get\_network( object|int $network ): WP\_Network|false
==========================================================
This function has been deprecated. Use [get\_network()](get_network) instead.
Retrieves an object containing information about the requested network.
* [get\_network()](get_network)
`$network` object|int Required The network's database row or ID. [WP\_Network](../classes/wp_network)|false Object containing network information if found, false if not.
File: `wp-includes/ms-load.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/ms-load.php/)
```
function wp_get_network( $network ) {
_deprecated_function( __FUNCTION__, '4.7.0', 'get_network()' );
$network = get_network( $network );
if ( null === $network ) {
return false;
}
return $network;
}
```
| Uses | Description |
| --- | --- |
| [get\_network()](get_network) wp-includes/ms-network.php | Retrieves network data given a network ID or network object. |
| [\_deprecated\_function()](_deprecated_function) wp-includes/functions.php | Marks a function as deprecated and inform when it has been used. |
| Version | Description |
| --- | --- |
| [4.7.0](https://developer.wordpress.org/reference/since/4.7.0/) | Use [get\_network()](get_network) |
| [3.9.0](https://developer.wordpress.org/reference/since/3.9.0/) | Introduced. |
wordpress populate_network_meta( int $network_id, array $meta = array() ) populate\_network\_meta( int $network\_id, array $meta = array() )
==================================================================
Creates WordPress network meta and sets the default values.
`$network_id` int Required Network ID to populate meta for. `$meta` array Optional Custom meta $key => $value pairs to use. Default: `array()`
File: `wp-admin/includes/schema.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/schema.php/)
```
function populate_network_meta( $network_id, array $meta = array() ) {
global $wpdb, $wp_db_version;
$network_id = (int) $network_id;
$email = ! empty( $meta['admin_email'] ) ? $meta['admin_email'] : '';
$subdomain_install = isset( $meta['subdomain_install'] ) ? (int) $meta['subdomain_install'] : 0;
// If a user with the provided email does not exist, default to the current user as the new network admin.
$site_user = ! empty( $email ) ? get_user_by( 'email', $email ) : false;
if ( false === $site_user ) {
$site_user = wp_get_current_user();
}
if ( empty( $email ) ) {
$email = $site_user->user_email;
}
$template = get_option( 'template' );
$stylesheet = get_option( 'stylesheet' );
$allowed_themes = array( $stylesheet => true );
if ( $template != $stylesheet ) {
$allowed_themes[ $template ] = true;
}
if ( WP_DEFAULT_THEME != $stylesheet && WP_DEFAULT_THEME != $template ) {
$allowed_themes[ WP_DEFAULT_THEME ] = true;
}
// If WP_DEFAULT_THEME doesn't exist, also include the latest core default theme.
if ( ! wp_get_theme( WP_DEFAULT_THEME )->exists() ) {
$core_default = WP_Theme::get_core_default_theme();
if ( $core_default ) {
$allowed_themes[ $core_default->get_stylesheet() ] = true;
}
}
if ( function_exists( 'clean_network_cache' ) ) {
clean_network_cache( $network_id );
} else {
wp_cache_delete( $network_id, 'networks' );
}
if ( ! is_multisite() ) {
$site_admins = array( $site_user->user_login );
$users = get_users(
array(
'fields' => array( 'user_login' ),
'role' => 'administrator',
)
);
if ( $users ) {
foreach ( $users as $user ) {
$site_admins[] = $user->user_login;
}
$site_admins = array_unique( $site_admins );
}
} else {
$site_admins = get_site_option( 'site_admins' );
}
/* translators: Do not translate USERNAME, SITE_NAME, BLOG_URL, PASSWORD: those are placeholders. */
$welcome_email = __(
'Howdy USERNAME,
Your new SITE_NAME site has been successfully set up at:
BLOG_URL
You can log in to the administrator account with the following information:
Username: USERNAME
Password: PASSWORD
Log in here: BLOG_URLwp-login.php
We hope you enjoy your new site. Thanks!
--The Team @ SITE_NAME'
);
$misc_exts = array(
// Images.
'jpg',
'jpeg',
'png',
'gif',
'webp',
// Video.
'mov',
'avi',
'mpg',
'3gp',
'3g2',
// "audio".
'midi',
'mid',
// Miscellaneous.
'pdf',
'doc',
'ppt',
'odt',
'pptx',
'docx',
'pps',
'ppsx',
'xls',
'xlsx',
'key',
);
$audio_exts = wp_get_audio_extensions();
$video_exts = wp_get_video_extensions();
$upload_filetypes = array_unique( array_merge( $misc_exts, $audio_exts, $video_exts ) );
$sitemeta = array(
'site_name' => __( 'My Network' ),
'admin_email' => $email,
'admin_user_id' => $site_user->ID,
'registration' => 'none',
'upload_filetypes' => implode( ' ', $upload_filetypes ),
'blog_upload_space' => 100,
'fileupload_maxk' => 1500,
'site_admins' => $site_admins,
'allowedthemes' => $allowed_themes,
'illegal_names' => array( 'www', 'web', 'root', 'admin', 'main', 'invite', 'administrator', 'files' ),
'wpmu_upgrade_site' => $wp_db_version,
'welcome_email' => $welcome_email,
/* translators: %s: Site link. */
'first_post' => __( 'Welcome to %s. This is your first post. Edit or delete it, then start writing!' ),
// @todo - Network admins should have a method of editing the network siteurl (used for cookie hash).
'siteurl' => get_option( 'siteurl' ) . '/',
'add_new_users' => '0',
'upload_space_check_disabled' => is_multisite() ? get_site_option( 'upload_space_check_disabled' ) : '1',
'subdomain_install' => $subdomain_install,
'ms_files_rewriting' => is_multisite() ? get_site_option( 'ms_files_rewriting' ) : '0',
'user_count' => get_site_option( 'user_count' ),
'initial_db_version' => get_option( 'initial_db_version' ),
'active_sitewide_plugins' => array(),
'WPLANG' => get_locale(),
);
if ( ! $subdomain_install ) {
$sitemeta['illegal_names'][] = 'blog';
}
$sitemeta = wp_parse_args( $meta, $sitemeta );
/**
* Filters meta for a network on creation.
*
* @since 3.7.0
*
* @param array $sitemeta Associative array of network meta keys and values to be inserted.
* @param int $network_id ID of network to populate.
*/
$sitemeta = apply_filters( 'populate_network_meta', $sitemeta, $network_id );
$insert = '';
foreach ( $sitemeta as $meta_key => $meta_value ) {
if ( is_array( $meta_value ) ) {
$meta_value = serialize( $meta_value );
}
if ( ! empty( $insert ) ) {
$insert .= ', ';
}
$insert .= $wpdb->prepare( '( %d, %s, %s)', $network_id, $meta_key, $meta_value );
}
$wpdb->query( "INSERT INTO $wpdb->sitemeta ( site_id, meta_key, meta_value ) VALUES " . $insert ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared
}
```
[apply\_filters( 'populate\_network\_meta', array $sitemeta, int $network\_id )](../hooks/populate_network_meta)
Filters meta for a network on creation.
| Uses | Description |
| --- | --- |
| [clean\_network\_cache()](clean_network_cache) wp-includes/ms-network.php | Removes a network from the object cache. |
| [wp\_cache\_delete()](wp_cache_delete) wp-includes/cache.php | Removes the cache contents matching key and group. |
| [wpdb::query()](../classes/wpdb/query) wp-includes/class-wpdb.php | Performs a database query, using current database connection. |
| [wp\_get\_audio\_extensions()](wp_get_audio_extensions) wp-includes/media.php | Returns a filtered list of supported audio formats. |
| [get\_locale()](get_locale) wp-includes/l10n.php | Retrieves the current locale. |
| [get\_user\_by()](get_user_by) wp-includes/pluggable.php | Retrieves user info by a given field. |
| [wp\_get\_current\_user()](wp_get_current_user) wp-includes/pluggable.php | Retrieves the current user object. |
| [wp\_get\_video\_extensions()](wp_get_video_extensions) wp-includes/media.php | Returns a filtered list of supported video formats. |
| [WP\_Theme::get\_core\_default\_theme()](../classes/wp_theme/get_core_default_theme) wp-includes/class-wp-theme.php | Determines the latest WordPress default theme that is installed. |
| [get\_users()](get_users) wp-includes/user.php | Retrieves list of users matching criteria. |
| [get\_option()](get_option) wp-includes/option.php | Retrieves an option value based on an option name. |
| [wp\_parse\_args()](wp_parse_args) wp-includes/functions.php | Merges user defined arguments into defaults array. |
| [get\_site\_option()](get_site_option) wp-includes/option.php | Retrieve an option value for the current network based on name of option. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| [is\_multisite()](is_multisite) wp-includes/load.php | If Multisite is enabled. |
| [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. |
| [wp\_get\_theme()](wp_get_theme) wp-includes/theme.php | Gets a [WP\_Theme](../classes/wp_theme) object for a theme. |
| [wpdb::prepare()](../classes/wpdb/prepare) wp-includes/class-wpdb.php | Prepares a SQL query for safe execution. |
| Used By | Description |
| --- | --- |
| [populate\_network()](populate_network) wp-admin/includes/schema.php | Populate network settings. |
| Version | Description |
| --- | --- |
| [5.1.0](https://developer.wordpress.org/reference/since/5.1.0/) | Introduced. |
wordpress get_site_icon_url( int $size = 512, string $url = '', int $blog_id ): string get\_site\_icon\_url( int $size = 512, string $url = '', int $blog\_id ): string
================================================================================
Returns the Site Icon URL.
`$size` int Optional Size of the site icon. Default 512 (pixels). Default: `512`
`$url` string Optional Fallback url if no site icon is found. Default: `''`
`$blog_id` int Optional ID of the blog to get the site icon for. Default current blog. string Site Icon URL.
File: `wp-includes/general-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/general-template.php/)
```
function get_site_icon_url( $size = 512, $url = '', $blog_id = 0 ) {
$switched_blog = false;
if ( is_multisite() && ! empty( $blog_id ) && get_current_blog_id() !== (int) $blog_id ) {
switch_to_blog( $blog_id );
$switched_blog = true;
}
$site_icon_id = get_option( 'site_icon' );
if ( $site_icon_id ) {
if ( $size >= 512 ) {
$size_data = 'full';
} else {
$size_data = array( $size, $size );
}
$url = wp_get_attachment_image_url( $site_icon_id, $size_data );
}
if ( $switched_blog ) {
restore_current_blog();
}
/**
* Filters the site icon URL.
*
* @since 4.4.0
*
* @param string $url Site icon URL.
* @param int $size Size of the site icon.
* @param int $blog_id ID of the blog to get the site icon for.
*/
return apply_filters( 'get_site_icon_url', $url, $size, $blog_id );
}
```
[apply\_filters( 'get\_site\_icon\_url', string $url, int $size, int $blog\_id )](../hooks/get_site_icon_url)
Filters the site icon URL.
| Uses | Description |
| --- | --- |
| [wp\_get\_attachment\_image\_url()](wp_get_attachment_image_url) wp-includes/media.php | Gets the URL of an image attachment. |
| [switch\_to\_blog()](switch_to_blog) wp-includes/ms-blogs.php | Switch the current blog. |
| [restore\_current\_blog()](restore_current_blog) wp-includes/ms-blogs.php | Restore the current blog, after calling [switch\_to\_blog()](switch_to_blog) . |
| [is\_multisite()](is_multisite) wp-includes/load.php | If Multisite is enabled. |
| [get\_current\_blog\_id()](get_current_blog_id) wp-includes/load.php | Retrieve the current site ID. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| [get\_option()](get_option) wp-includes/option.php | Retrieves an option value based on an option name. |
| Used By | Description |
| --- | --- |
| [WP\_REST\_Server::add\_site\_icon\_to\_index()](../classes/wp_rest_server/add_site_icon_to_index) wp-includes/rest-api/class-wp-rest-server.php | Exposes the site icon through the WordPress REST API. |
| [do\_favicon()](do_favicon) wp-includes/functions.php | Displays the favicon.ico file content. |
| [the\_embed\_site\_title()](the_embed_site_title) wp-includes/embed.php | Prints the necessary markup for the site title in an embed template. |
| [wp\_site\_icon()](wp_site_icon) wp-includes/general-template.php | Displays site icon meta tags. |
| [site\_icon\_url()](site_icon_url) wp-includes/general-template.php | Displays the Site Icon URL. |
| [has\_site\_icon()](has_site_icon) wp-includes/general-template.php | Determines whether the site has a Site Icon. |
| [atom\_site\_icon()](atom_site_icon) wp-includes/feed.php | Displays Site Icon in atom feeds. |
| [rss2\_site\_icon()](rss2_site_icon) wp-includes/feed.php | Displays Site Icon in RSS2. |
| [wp\_admin\_bar\_my\_sites\_menu()](wp_admin_bar_my_sites_menu) wp-includes/admin-bar.php | Adds the “My Sites/[Site Name]” menu and all submenus. |
| Version | Description |
| --- | --- |
| [4.3.0](https://developer.wordpress.org/reference/since/4.3.0/) | Introduced. |
wordpress wp_migrate_old_typography_shape( array $metadata ): array wp\_migrate\_old\_typography\_shape( array $metadata ): array
=============================================================
Converts typography keys declared under `supports.*` to `supports.typography.*`.
Displays a `_doing_it_wrong()` notice when a block using the older format is detected.
`$metadata` array Required Metadata for registering a block type. array Filtered metadata for registering a block type.
File: `wp-includes/blocks.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/blocks.php/)
```
function wp_migrate_old_typography_shape( $metadata ) {
if ( ! isset( $metadata['supports'] ) ) {
return $metadata;
}
$typography_keys = array(
'__experimentalFontFamily',
'__experimentalFontStyle',
'__experimentalFontWeight',
'__experimentalLetterSpacing',
'__experimentalTextDecoration',
'__experimentalTextTransform',
'fontSize',
'lineHeight',
);
foreach ( $typography_keys as $typography_key ) {
$support_for_key = _wp_array_get( $metadata['supports'], array( $typography_key ), null );
if ( null !== $support_for_key ) {
_doing_it_wrong(
'register_block_type_from_metadata()',
sprintf(
/* translators: 1: Block type, 2: Typography supports key, e.g: fontSize, lineHeight, etc. 3: block.json, 4: Old metadata key, 5: New metadata key. */
__( 'Block "%1$s" is declaring %2$s support in %3$s file under %4$s. %2$s support is now declared under %5$s.' ),
$metadata['name'],
"<code>$typography_key</code>",
'<code>block.json</code>',
"<code>supports.$typography_key</code>",
"<code>supports.typography.$typography_key</code>"
),
'5.8.0'
);
_wp_array_set( $metadata['supports'], array( 'typography', $typography_key ), $support_for_key );
unset( $metadata['supports'][ $typography_key ] );
}
}
return $metadata;
}
```
| Uses | Description |
| --- | --- |
| [\_wp\_array\_set()](_wp_array_set) wp-includes/functions.php | Sets an array in depth based on a path of keys. |
| [\_wp\_array\_get()](_wp_array_get) wp-includes/functions.php | Accesses an array in depth based on a path of keys. |
| [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. |
| [\_doing\_it\_wrong()](_doing_it_wrong) wp-includes/functions.php | Marks something as being incorrectly called. |
| Version | Description |
| --- | --- |
| [5.8.0](https://developer.wordpress.org/reference/since/5.8.0/) | Introduced. |
wordpress check_comment( string $author, string $email, string $url, string $comment, string $user_ip, string $user_agent, string $comment_type ): bool check\_comment( string $author, string $email, string $url, string $comment, string $user\_ip, string $user\_agent, string $comment\_type ): bool
=================================================================================================================================================
Checks whether a comment passes internal checks to be allowed to add.
If manual comment moderation is set in the administration, then all checks, regardless of their type and substance, will fail and the function will return false.
If the number of links exceeds the amount in the administration, then the check fails. If any of the parameter contents contain any disallowed words, then the check fails.
If the comment author was approved before, then the comment is automatically approved.
If all checks pass, the function will return true.
`$author` string Required Comment author name. `$email` string Required Comment author email. `$url` string Required Comment author URL. `$comment` string Required Content of the comment. `$user_ip` string Required Comment author IP address. `$user_agent` string Required Comment author User-Agent. `$comment_type` string Required Comment type, either user-submitted comment, trackback, or pingback. bool If all checks pass, true, otherwise false.
Returns `false` if in [Comment\_Moderation](https://wordpress.org/support/article/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](https://wordpress.org/support/article/glossary/#trackback)` or `[pingback](https://wordpress.org/support/article/glossary/#pingback)` and part of the `[blogroll](https://wordpress.org/support/article/glossary/#blogroll)`, or
\* `$author` and `$email` parameters have been approved previously.
Returns `true` in all other cases.
File: `wp-includes/comment.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/comment.php/)
```
function check_comment( $author, $email, $url, $comment, $user_ip, $user_agent, $comment_type ) {
global $wpdb;
// If manual moderation is enabled, skip all checks and return false.
if ( 1 == get_option( 'comment_moderation' ) ) {
return false;
}
/** This filter is documented in wp-includes/comment-template.php */
$comment = apply_filters( 'comment_text', $comment, null, array() );
// Check for the number of external links if a max allowed number is set.
$max_links = get_option( 'comment_max_links' );
if ( $max_links ) {
$num_links = preg_match_all( '/<a [^>]*href/i', $comment, $out );
/**
* Filters the number of links found in a comment.
*
* @since 3.0.0
* @since 4.7.0 Added the `$comment` parameter.
*
* @param int $num_links The number of links found.
* @param string $url Comment author's URL. Included in allowed links total.
* @param string $comment Content of the comment.
*/
$num_links = apply_filters( 'comment_max_links_url', $num_links, $url, $comment );
/*
* If the number of links in the comment exceeds the allowed amount,
* fail the check by returning false.
*/
if ( $num_links >= $max_links ) {
return false;
}
}
$mod_keys = trim( get_option( 'moderation_keys' ) );
// If moderation 'keys' (keywords) are set, process them.
if ( ! empty( $mod_keys ) ) {
$words = explode( "\n", $mod_keys );
foreach ( (array) $words as $word ) {
$word = trim( $word );
// Skip empty lines.
if ( empty( $word ) ) {
continue;
}
/*
* Do some escaping magic so that '#' (number of) characters in the spam
* words don't break things:
*/
$word = preg_quote( $word, '#' );
/*
* Check the comment fields for moderation keywords. If any are found,
* fail the check for the given field by returning false.
*/
$pattern = "#$word#i";
if ( preg_match( $pattern, $author ) ) {
return false;
}
if ( preg_match( $pattern, $email ) ) {
return false;
}
if ( preg_match( $pattern, $url ) ) {
return false;
}
if ( preg_match( $pattern, $comment ) ) {
return false;
}
if ( preg_match( $pattern, $user_ip ) ) {
return false;
}
if ( preg_match( $pattern, $user_agent ) ) {
return false;
}
}
}
/*
* Check if the option to approve comments by previously-approved authors is enabled.
*
* If it is enabled, check whether the comment author has a previously-approved comment,
* as well as whether there are any moderation keywords (if set) present in the author
* email address. If both checks pass, return true. Otherwise, return false.
*/
if ( 1 == get_option( 'comment_previously_approved' ) ) {
if ( 'trackback' !== $comment_type && 'pingback' !== $comment_type && '' !== $author && '' !== $email ) {
$comment_user = get_user_by( 'email', wp_unslash( $email ) );
if ( ! empty( $comment_user->ID ) ) {
$ok_to_comment = $wpdb->get_var( $wpdb->prepare( "SELECT comment_approved FROM $wpdb->comments WHERE user_id = %d AND comment_approved = '1' LIMIT 1", $comment_user->ID ) );
} else {
// expected_slashed ($author, $email)
$ok_to_comment = $wpdb->get_var( $wpdb->prepare( "SELECT comment_approved FROM $wpdb->comments WHERE comment_author = %s AND comment_author_email = %s and comment_approved = '1' LIMIT 1", $author, $email ) );
}
if ( ( 1 == $ok_to_comment ) &&
( empty( $mod_keys ) || false === strpos( $email, $mod_keys ) ) ) {
return true;
} else {
return false;
}
} else {
return false;
}
}
return true;
}
```
[apply\_filters( 'comment\_max\_links\_url', int $num\_links, string $url, string $comment )](../hooks/comment_max_links_url)
Filters the number of links found in a comment.
[apply\_filters( 'comment\_text', string $comment\_text, WP\_Comment|null $comment, array $args )](../hooks/comment_text)
Filters the text of a comment to be displayed.
| Uses | Description |
| --- | --- |
| [get\_user\_by()](get_user_by) wp-includes/pluggable.php | Retrieves user info by a given field. |
| [wp\_unslash()](wp_unslash) wp-includes/formatting.php | Removes slashes from a string or recursively removes slashes from strings within an array. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| [get\_option()](get_option) wp-includes/option.php | Retrieves an option value based on an option name. |
| [wpdb::get\_var()](../classes/wpdb/get_var) wp-includes/class-wpdb.php | Retrieves one variable from the database. |
| [wpdb::prepare()](../classes/wpdb/prepare) wp-includes/class-wpdb.php | Prepares a SQL query for safe execution. |
| Used By | Description |
| --- | --- |
| [wp\_allow\_comment()](wp_allow_comment) wp-includes/comment.php | Validates whether this comment is allowed to be made. |
| Version | Description |
| --- | --- |
| [1.2.0](https://developer.wordpress.org/reference/since/1.2.0/) | Introduced. |
| programming_docs |
wordpress clean_dirsize_cache( string $path ) clean\_dirsize\_cache( string $path )
=====================================
Cleans directory size cache used by [recurse\_dirsize()](recurse_dirsize) .
Removes the current directory and all parent directories from the `dirsize_cache` transient.
`$path` string Required Full path of a directory or file. File: `wp-includes/functions.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/functions.php/)
```
function clean_dirsize_cache( $path ) {
if ( ! is_string( $path ) || empty( $path ) ) {
trigger_error(
sprintf(
/* translators: 1: Function name, 2: A variable type, like "boolean" or "integer". */
__( '%1$s only accepts a non-empty path string, received %2$s.' ),
'<code>clean_dirsize_cache()</code>',
'<code>' . gettype( $path ) . '</code>'
)
);
return;
}
$directory_cache = get_transient( 'dirsize_cache' );
if ( empty( $directory_cache ) ) {
return;
}
if (
strpos( $path, '/' ) === false &&
strpos( $path, '\\' ) === false
) {
unset( $directory_cache[ $path ] );
set_transient( 'dirsize_cache', $directory_cache );
return;
}
$last_path = null;
$path = untrailingslashit( $path );
unset( $directory_cache[ $path ] );
while (
$last_path !== $path &&
DIRECTORY_SEPARATOR !== $path &&
'.' !== $path &&
'..' !== $path
) {
$last_path = $path;
$path = dirname( $path );
unset( $directory_cache[ $path ] );
}
set_transient( 'dirsize_cache', $directory_cache );
}
```
| Uses | Description |
| --- | --- |
| [get\_transient()](get_transient) wp-includes/option.php | Retrieves the value of a transient. |
| [untrailingslashit()](untrailingslashit) wp-includes/formatting.php | Removes trailing forward slashes and backslashes if they exist. |
| [set\_transient()](set_transient) wp-includes/option.php | Sets/updates the value of a transient. |
| [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. |
| Used By | Description |
| --- | --- |
| [\_wp\_handle\_upload()](_wp_handle_upload) wp-admin/includes/file.php | Handles PHP uploads in WordPress. |
| [wp\_upload\_bits()](wp_upload_bits) wp-includes/functions.php | Creates a file in the upload folder with given content. |
| [wp\_delete\_attachment()](wp_delete_attachment) wp-includes/post.php | Trashes or deletes an attachment. |
| Version | Description |
| --- | --- |
| [5.9.0](https://developer.wordpress.org/reference/since/5.9.0/) | Added input validation with a notice for invalid input. |
| [5.6.0](https://developer.wordpress.org/reference/since/5.6.0/) | Introduced. |
wordpress walk_category_tree( mixed $args ): string walk\_category\_tree( mixed $args ): string
===========================================
Retrieves HTML list content for category list.
* [Walker::walk()](../classes/walker/walk): for parameters and return description.
`$args` mixed Required Elements array, maximum hierarchical depth and optional additional arguments. string
File: `wp-includes/category-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/category-template.php/)
```
function walk_category_tree( ...$args ) {
// The user's options are the third parameter.
if ( empty( $args[2]['walker'] ) || ! ( $args[2]['walker'] instanceof Walker ) ) {
$walker = new Walker_Category;
} else {
/**
* @var Walker $walker
*/
$walker = $args[2]['walker'];
}
return $walker->walk( ...$args );
}
```
| Uses | Description |
| --- | --- |
| [Walker::walk()](../classes/walker/walk) wp-includes/class-wp-walker.php | Displays array of elements hierarchically. |
| Used By | Description |
| --- | --- |
| [wp\_list\_categories()](wp_list_categories) wp-includes/category-template.php | Displays or retrieves the HTML list of categories. |
| Version | Description |
| --- | --- |
| [5.3.0](https://developer.wordpress.org/reference/since/5.3.0/) | Formalized the existing `...$args` parameter by adding it to the function signature. |
| [2.1.0](https://developer.wordpress.org/reference/since/2.1.0/) | Introduced. |
wordpress walk_page_dropdown_tree( mixed $args ): string walk\_page\_dropdown\_tree( mixed $args ): string
=================================================
Retrieves HTML dropdown (select) content for page list.
* [Walker\_PageDropdown::walk()](../classes/walker_pagedropdown/walk): for parameters and return description.
`$args` mixed Required Elements array, maximum hierarchical depth and optional additional arguments. string
File: `wp-includes/post-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/post-template.php/)
```
function walk_page_dropdown_tree( ...$args ) {
if ( empty( $args[2]['walker'] ) ) { // The user's options are the third parameter.
$walker = new Walker_PageDropdown;
} else {
/**
* @var Walker $walker
*/
$walker = $args[2]['walker'];
}
return $walker->walk( ...$args );
}
```
| Uses | Description |
| --- | --- |
| [Walker::walk()](../classes/walker/walk) wp-includes/class-wp-walker.php | Displays array of elements hierarchically. |
| Used By | Description |
| --- | --- |
| [wp\_dropdown\_pages()](wp_dropdown_pages) wp-includes/post-template.php | Retrieves or displays a list of pages as a dropdown (select list). |
| Version | Description |
| --- | --- |
| [5.3.0](https://developer.wordpress.org/reference/since/5.3.0/) | Formalized the existing `...$args` parameter by adding it to the function signature. |
| [2.1.0](https://developer.wordpress.org/reference/since/2.1.0/) | Introduced. |
wordpress wp_after_insert_post( int|WP_Post $post, bool $update, null|WP_Post $post_before ) wp\_after\_insert\_post( int|WP\_Post $post, bool $update, null|WP\_Post $post\_before )
========================================================================================
Fires actions after a post, its terms and meta data has been saved.
`$post` int|[WP\_Post](../classes/wp_post) Required The post ID or object that has been saved. `$update` bool Required Whether this is an existing post being updated. `$post_before` null|[WP\_Post](../classes/wp_post) Required Null for new posts, the [WP\_Post](../classes/wp_post) object prior to the update for updated posts. File: `wp-includes/post.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/post.php/)
```
function wp_after_insert_post( $post, $update, $post_before ) {
$post = get_post( $post );
if ( ! $post ) {
return;
}
$post_id = $post->ID;
/**
* Fires once a post, its terms and meta data has been saved.
*
* @since 5.6.0
*
* @param int $post_id Post ID.
* @param WP_Post $post Post object.
* @param bool $update Whether this is an existing post being updated.
* @param null|WP_Post $post_before Null for new posts, the WP_Post object prior
* to the update for updated posts.
*/
do_action( 'wp_after_insert_post', $post_id, $post, $update, $post_before );
}
```
[do\_action( 'wp\_after\_insert\_post', int $post\_id, WP\_Post $post, bool $update, null|WP\_Post $post\_before )](../hooks/wp_after_insert_post)
Fires once a post, its terms and meta data has been saved.
| Uses | Description |
| --- | --- |
| [do\_action()](do_action) wp-includes/plugin.php | Calls the callback functions that have been added to an action hook. |
| [get\_post()](get_post) wp-includes/post.php | Retrieves post data given a post ID or post object. |
| Used By | Description |
| --- | --- |
| [WP\_REST\_Menu\_Items\_Controller::create\_item()](../classes/wp_rest_menu_items_controller/create_item) wp-includes/rest-api/endpoints/class-wp-rest-menu-items-controller.php | Creates a single post. |
| [WP\_REST\_Menu\_Items\_Controller::update\_item()](../classes/wp_rest_menu_items_controller/update_item) wp-includes/rest-api/endpoints/class-wp-rest-menu-items-controller.php | Updates a single nav menu item. |
| [WP\_REST\_Global\_Styles\_Controller::update\_item()](../classes/wp_rest_global_styles_controller/update_item) wp-includes/rest-api/endpoints/class-wp-rest-global-styles-controller.php | Updates a single global style config. |
| [WP\_REST\_Templates\_Controller::update\_item()](../classes/wp_rest_templates_controller/update_item) wp-includes/rest-api/endpoints/class-wp-rest-templates-controller.php | Updates a single template. |
| [WP\_REST\_Templates\_Controller::create\_item()](../classes/wp_rest_templates_controller/create_item) wp-includes/rest-api/endpoints/class-wp-rest-templates-controller.php | Creates a single template. |
| [WP\_Customize\_Manager::trash\_changeset\_post()](../classes/wp_customize_manager/trash_changeset_post) wp-includes/class-wp-customize-manager.php | Trashes or deletes a changeset post. |
| [WP\_REST\_Attachments\_Controller::create\_item()](../classes/wp_rest_attachments_controller/create_item) wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php | Creates a single attachment. |
| [WP\_REST\_Attachments\_Controller::update\_item()](../classes/wp_rest_attachments_controller/update_item) wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php | Updates a single attachment. |
| [WP\_REST\_Posts\_Controller::create\_item()](../classes/wp_rest_posts_controller/create_item) wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php | Creates a single post. |
| [WP\_REST\_Posts\_Controller::update\_item()](../classes/wp_rest_posts_controller/update_item) wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php | Updates a single post. |
| [get\_default\_post\_to\_edit()](get_default_post_to_edit) wp-admin/includes/post.php | Returns default post information to use when populating the “Write Post” form. |
| [wp\_publish\_post()](wp_publish_post) wp-includes/post.php | Publishes a post by transitioning the post status. |
| [wp\_insert\_post()](wp_insert_post) wp-includes/post.php | Inserts or update a post. |
| Version | Description |
| --- | --- |
| [5.6.0](https://developer.wordpress.org/reference/since/5.6.0/) | Introduced. |
wordpress wp_styles(): WP_Styles wp\_styles(): WP\_Styles
========================
Initialize $wp\_styles if it has not been set.
[WP\_Styles](../classes/wp_styles) [WP\_Styles](../classes/wp_styles) instance.
File: `wp-includes/functions.wp-styles.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/functions-wp-styles.php/)
```
function wp_styles() {
global $wp_styles;
if ( ! ( $wp_styles instanceof WP_Styles ) ) {
$wp_styles = new WP_Styles();
}
return $wp_styles;
}
```
| Uses | Description |
| --- | --- |
| [WP\_Styles::\_\_construct()](../classes/wp_styles/__construct) wp-includes/class-wp-styles.php | Constructor. |
| Used By | Description |
| --- | --- |
| [\_wp\_get\_iframed\_editor\_assets()](_wp_get_iframed_editor_assets) wp-includes/block-editor.php | Collect the block editor assets that need to be loaded into the editor’s iframe. |
| [wp\_maybe\_inline\_styles()](wp_maybe_inline_styles) wp-includes/script-loader.php | Allows small styles to be inlined. |
| [wp\_admin\_css()](wp_admin_css) wp-includes/general-template.php | Enqueues or directly prints a stylesheet link to the specified CSS file. |
| [wp\_print\_styles()](wp_print_styles) wp-includes/functions.wp-styles.php | Display styles that are in the $handles queue. |
| [wp\_add\_inline\_style()](wp_add_inline_style) wp-includes/functions.wp-styles.php | Add extra CSS styles to a registered stylesheet. |
| [wp\_register\_style()](wp_register_style) wp-includes/functions.wp-styles.php | Register a CSS stylesheet. |
| [wp\_deregister\_style()](wp_deregister_style) wp-includes/functions.wp-styles.php | Remove a registered stylesheet. |
| [wp\_enqueue\_style()](wp_enqueue_style) wp-includes/functions.wp-styles.php | Enqueue a CSS stylesheet. |
| [wp\_dequeue\_style()](wp_dequeue_style) wp-includes/functions.wp-styles.php | Remove a previously enqueued CSS stylesheet. |
| [wp\_style\_is()](wp_style_is) wp-includes/functions.wp-styles.php | Check whether a CSS stylesheet has been added to the queue. |
| [wp\_style\_add\_data()](wp_style_add_data) wp-includes/functions.wp-styles.php | Add metadata to a CSS stylesheet. |
| [print\_admin\_styles()](print_admin_styles) wp-includes/script-loader.php | Prints the styles queue in the HTML head on admin pages. |
| Version | Description |
| --- | --- |
| [4.2.0](https://developer.wordpress.org/reference/since/4.2.0/) | Introduced. |
wordpress is_textdomain_loaded( string $domain ): bool is\_textdomain\_loaded( string $domain ): bool
==============================================
Determines whether there are translations for the text domain.
`$domain` string Required Text domain. Unique identifier for retrieving translated strings. bool Whether there are translations.
File: `wp-includes/l10n.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/l10n.php/)
```
function is_textdomain_loaded( $domain ) {
global $l10n;
return isset( $l10n[ $domain ] );
}
```
| Used By | Description |
| --- | --- |
| [\_get\_plugin\_data\_markup\_translate()](_get_plugin_data_markup_translate) wp-admin/includes/plugin.php | Sanitizes plugin data, optionally adds markup, optionally translates. |
| [WP\_Theme::load\_textdomain()](../classes/wp_theme/load_textdomain) wp-includes/class-wp-theme.php | Loads the theme’s textdomain. |
| Version | Description |
| --- | --- |
| [3.0.0](https://developer.wordpress.org/reference/since/3.0.0/) | Introduced. |
wordpress do_all_trackbacks() do\_all\_trackbacks()
=====================
Performs all trackbacks.
File: `wp-includes/comment.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/comment.php/)
```
function do_all_trackbacks() {
$trackbacks = get_posts(
array(
'post_type' => get_post_types(),
'suppress_filters' => false,
'nopaging' => true,
'meta_key' => '_trackbackme',
'fields' => 'ids',
)
);
foreach ( $trackbacks as $trackback ) {
delete_post_meta( $trackback, '_trackbackme' );
do_trackbacks( $trackback );
}
}
```
| Uses | Description |
| --- | --- |
| [get\_posts()](get_posts) wp-includes/post.php | Retrieves an array of the latest posts, or posts matching the given criteria. |
| [delete\_post\_meta()](delete_post_meta) wp-includes/post.php | Deletes a post meta field for the given post ID. |
| [do\_trackbacks()](do_trackbacks) wp-includes/comment.php | Performs trackbacks. |
| [get\_post\_types()](get_post_types) wp-includes/post.php | Gets a list of all registered post type objects. |
| Version | Description |
| --- | --- |
| [5.6.0](https://developer.wordpress.org/reference/since/5.6.0/) | Introduced. |
wordpress get_comment_to_edit( int $id ): WP_Comment|false get\_comment\_to\_edit( int $id ): WP\_Comment|false
====================================================
Returns a [WP\_Comment](../classes/wp_comment) object based on comment ID.
`$id` int Required ID of comment to retrieve. [WP\_Comment](../classes/wp_comment)|false Comment if found. False on failure.
File: `wp-admin/includes/comment.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/comment.php/)
```
function get_comment_to_edit( $id ) {
$comment = get_comment( $id );
if ( ! $comment ) {
return false;
}
$comment->comment_ID = (int) $comment->comment_ID;
$comment->comment_post_ID = (int) $comment->comment_post_ID;
$comment->comment_content = format_to_edit( $comment->comment_content );
/**
* Filters the comment content before editing.
*
* @since 2.0.0
*
* @param string $comment_content Comment content.
*/
$comment->comment_content = apply_filters( 'comment_edit_pre', $comment->comment_content );
$comment->comment_author = format_to_edit( $comment->comment_author );
$comment->comment_author_email = format_to_edit( $comment->comment_author_email );
$comment->comment_author_url = format_to_edit( $comment->comment_author_url );
$comment->comment_author_url = esc_url( $comment->comment_author_url );
return $comment;
}
```
[apply\_filters( 'comment\_edit\_pre', string $comment\_content )](../hooks/comment_edit_pre)
Filters the comment content before editing.
| Uses | Description |
| --- | --- |
| [format\_to\_edit()](format_to_edit) wp-includes/formatting.php | Acts on text which is about to be edited. |
| [esc\_url()](esc_url) wp-includes/formatting.php | Checks and cleans a URL. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| [get\_comment()](get_comment) wp-includes/comment.php | Retrieves comment data given a comment ID or comment object. |
| Version | Description |
| --- | --- |
| [2.0.0](https://developer.wordpress.org/reference/since/2.0.0/) | Introduced. |
wordpress get_author_template(): string get\_author\_template(): string
===============================
Retrieves path of author template in current or parent template.
The hierarchy for this template looks like:
1. author-{nicename}.php
2. author-{id}.php
3. author.php
An example of this is:
1. author-john.php
2. author-1.php
3. author.php
The template hierarchy and template path are filterable via the [‘$type\_template\_hierarchy’](../hooks/type_template_hierarchy) and [‘$type\_template’](../hooks/type_template) dynamic hooks, where `$type` is ‘author’.
* [get\_query\_template()](get_query_template)
string Full path to author template file.
File: `wp-includes/template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/template.php/)
```
function get_author_template() {
$author = get_queried_object();
$templates = array();
if ( $author instanceof WP_User ) {
$templates[] = "author-{$author->user_nicename}.php";
$templates[] = "author-{$author->ID}.php";
}
$templates[] = 'author.php';
return get_query_template( 'author', $templates );
}
```
| Uses | Description |
| --- | --- |
| [get\_queried\_object()](get_queried_object) wp-includes/query.php | Retrieves the currently queried object. |
| [get\_query\_template()](get_query_template) wp-includes/template.php | Retrieves path to a template. |
| Version | Description |
| --- | --- |
| [1.5.0](https://developer.wordpress.org/reference/since/1.5.0/) | Introduced. |
wordpress wp_send_json( mixed $response, int $status_code = null, int $options ) wp\_send\_json( mixed $response, int $status\_code = null, int $options )
=========================================================================
Sends a JSON response back to an Ajax request.
`$response` mixed Required Variable (usually an array or object) to encode as JSON, then print and die. `$status_code` int Optional The HTTP status code to output. Default: `null`
`$options` int Optional Options to be passed to json\_encode(). Default 0. File: `wp-includes/functions.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/functions.php/)
```
function wp_send_json( $response, $status_code = null, $options = 0 ) {
if ( defined( 'REST_REQUEST' ) && REST_REQUEST ) {
_doing_it_wrong(
__FUNCTION__,
sprintf(
/* translators: 1: WP_REST_Response, 2: WP_Error */
__( 'Return a %1$s or %2$s object from your callback when using the REST API.' ),
'WP_REST_Response',
'WP_Error'
),
'5.5.0'
);
}
if ( ! headers_sent() ) {
header( 'Content-Type: application/json; charset=' . get_option( 'blog_charset' ) );
if ( null !== $status_code ) {
status_header( $status_code );
}
}
echo wp_json_encode( $response, $options );
if ( wp_doing_ajax() ) {
wp_die(
'',
'',
array(
'response' => null,
)
);
} else {
die;
}
}
```
| Uses | Description |
| --- | --- |
| [wp\_doing\_ajax()](wp_doing_ajax) wp-includes/load.php | Determines whether the current request is a WordPress Ajax request. |
| [status\_header()](status_header) wp-includes/functions.php | Sets HTTP status header. |
| [wp\_json\_encode()](wp_json_encode) wp-includes/functions.php | Encodes a variable into JSON, with some sanity checks. |
| [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. |
| [\_doing\_it\_wrong()](_doing_it_wrong) wp-includes/functions.php | Marks something as being incorrectly called. |
| [wp\_die()](wp_die) wp-includes/functions.php | Kills WordPress execution and displays HTML page with an error message. |
| [get\_option()](get_option) wp-includes/option.php | Retrieves an option value based on an option name. |
| Used By | Description |
| --- | --- |
| [wp\_ajax\_heartbeat()](wp_ajax_heartbeat) wp-admin/includes/ajax-actions.php | Ajax handler for the Heartbeat API. |
| [wp\_ajax\_nopriv\_heartbeat()](wp_ajax_nopriv_heartbeat) wp-admin/includes/ajax-actions.php | Ajax handler for the Heartbeat API in the no-privilege context. |
| [wp\_send\_json\_success()](wp_send_json_success) wp-includes/functions.php | Sends a JSON response back to an Ajax request, indicating success. |
| [wp\_send\_json\_error()](wp_send_json_error) wp-includes/functions.php | Sends a JSON response back to an Ajax request, indicating failure. |
| Version | Description |
| --- | --- |
| [5.6.0](https://developer.wordpress.org/reference/since/5.6.0/) | The `$options` parameter was added. |
| [4.7.0](https://developer.wordpress.org/reference/since/4.7.0/) | The `$status_code` parameter was added. |
| [3.5.0](https://developer.wordpress.org/reference/since/3.5.0/) | Introduced. |
| programming_docs |
wordpress add_post_type_support( string $post_type, string|array $feature, mixed $args ) add\_post\_type\_support( string $post\_type, string|array $feature, mixed $args )
==================================================================================
Registers support of certain features for a post type.
All core features are directly associated with a functional area of the edit screen, such as the editor or a meta box. Features include: ‘title’, ‘editor’, ‘comments’, ‘revisions’, ‘trackbacks’, ‘author’, ‘excerpt’, ‘page-attributes’, ‘thumbnail’, ‘custom-fields’, and ‘post-formats’.
Additionally, the ‘revisions’ feature dictates whether the post type will store revisions, and the ‘comments’ feature dictates whether the comments count will show on the edit screen.
A third, optional parameter can also be passed along with a feature to provide additional information about supporting that feature.
Example usage:
```
add_post_type_support( 'my_post_type', 'comments' );
add_post_type_support( 'my_post_type', array(
'author', 'excerpt',
) );
add_post_type_support( 'my_post_type', 'my_feature', array(
'field' => 'value',
) );
```
`$post_type` string Required The post type for which to add the feature. `$feature` string|array Required The feature being added, accepts an array of feature strings or a single string. `$args` mixed Optional extra arguments to pass along with certain features. The function should be called using the [init](https://codex.wordpress.org/Plugin_API/Action_Reference/init "Plugin API/Action Reference/init") action [hook](https://wordpress.org/support/article/glossary/ "Glossary"), like in the above example. To show the “Featured Image” meta box in mulsite installation, make sure you update the allowed upload file types, in Network Admin, [Network Admin Settings SubPanel#Upload\_Settings](https://wordpress.org/support/article/network-admin-settings-screen/ "Network Admin Settings SubPanel"), Media upload buttons options. Default is off. File: `wp-includes/post.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/post.php/)
```
function add_post_type_support( $post_type, $feature, ...$args ) {
global $_wp_post_type_features;
$features = (array) $feature;
foreach ( $features as $feature ) {
if ( $args ) {
$_wp_post_type_features[ $post_type ][ $feature ] = $args;
} else {
$_wp_post_type_features[ $post_type ][ $feature ] = true;
}
}
}
```
| Used By | Description |
| --- | --- |
| [\_enable\_content\_editor\_for\_navigation\_post\_type()](_enable_content_editor_for_navigation_post_type) wp-admin/includes/post.php | This callback enables content editor for wp\_navigation type posts. |
| [WP\_Post\_Type::add\_supports()](../classes/wp_post_type/add_supports) wp-includes/class-wp-post-type.php | Sets the features support for the post type. |
| [create\_initial\_post\_types()](create_initial_post_types) wp-includes/post.php | Creates the initial post types when ‘init’ action is fired. |
| Version | Description |
| --- | --- |
| [5.3.0](https://developer.wordpress.org/reference/since/5.3.0/) | Formalized the existing and already documented `...$args` parameter by adding it to the function signature. |
| [3.0.0](https://developer.wordpress.org/reference/since/3.0.0/) | Introduced. |
wordpress is_front_page(): bool is\_front\_page(): bool
=======================
Determines whether the query is for the front page of the site.
This is for what is displayed at your site’s main URL.
Depends on the site’s "Front page displays" Reading Settings ‘show\_on\_front’ and ‘page\_on\_front’.
If you set a static page for the front page of your site, this function will return true when viewing that page.
Otherwise the same as @see [is\_home()](is_home)
For more information on this and similar theme functions, check out the [Conditional Tags](https://developer.wordpress.org/themes/basics/conditional-tags/) article in the Theme Developer Handbook.
bool Whether the query is for the front page of the site.
File: `wp-includes/query.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/query.php/)
```
function is_front_page() {
global $wp_query;
if ( ! isset( $wp_query ) ) {
_doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the query is run. Before then, they always return false.' ), '3.1.0' );
return false;
}
return $wp_query->is_front_page();
}
```
| Uses | Description |
| --- | --- |
| [WP\_Query::is\_front\_page()](../classes/wp_query/is_front_page) wp-includes/class-wp-query.php | Is the query for the front page of the site? |
| [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. |
| [\_doing\_it\_wrong()](_doing_it_wrong) wp-includes/functions.php | Marks something as being incorrectly called. |
| Used By | Description |
| --- | --- |
| [get\_custom\_logo()](get_custom_logo) wp-includes/general-template.php | Returns a custom logo, linked to home unless the theme supports removing the link on the home page. |
| [wp\_get\_document\_title()](wp_get_document_title) wp-includes/general-template.php | Returns document title for the current page. |
| [wp\_title()](wp_title) wp-includes/general-template.php | Displays or retrieves page title for all areas of blog. |
| [\_wp\_menu\_item\_classes\_by\_context()](_wp_menu_item_classes_by_context) wp-includes/nav-menu-template.php | Adds the class property classes for the current context, if applicable. |
| [wp\_page\_menu()](wp_page_menu) wp-includes/post-template.php | Displays or retrieves a list of pages with an optional home link. |
| [get\_body\_class()](get_body_class) wp-includes/post-template.php | Retrieves an array of the class names for the body element. |
| [redirect\_canonical()](redirect_canonical) wp-includes/canonical.php | Redirects incoming links to the proper URL based on the site url. |
| Version | Description |
| --- | --- |
| [2.5.0](https://developer.wordpress.org/reference/since/2.5.0/) | Introduced. |
wordpress sanitize_mime_type( string $mime_type ): string sanitize\_mime\_type( string $mime\_type ): string
==================================================
Sanitizes a mime type
`$mime_type` string Required Mime type. string Sanitized mime type.
File: `wp-includes/formatting.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/formatting.php/)
```
function sanitize_mime_type( $mime_type ) {
$sani_mime_type = preg_replace( '/[^-+*.a-zA-Z0-9\/]/', '', $mime_type );
/**
* Filters a mime type following sanitization.
*
* @since 3.1.3
*
* @param string $sani_mime_type The sanitized mime type.
* @param string $mime_type The mime type prior to sanitization.
*/
return apply_filters( 'sanitize_mime_type', $sani_mime_type, $mime_type );
}
```
[apply\_filters( 'sanitize\_mime\_type', string $sani\_mime\_type, string $mime\_type )](../hooks/sanitize_mime_type)
Filters a mime type following sanitization.
| Uses | Description |
| --- | --- |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| Version | Description |
| --- | --- |
| [3.1.3](https://developer.wordpress.org/reference/since/3.1.3/) | Introduced. |
wordpress rest_validate_number_value_from_schema( mixed $value, array $args, string $param ): true|WP_Error rest\_validate\_number\_value\_from\_schema( mixed $value, array $args, string $param ): true|WP\_Error
=======================================================================================================
Validates a number value based on a schema.
`$value` mixed Required The value to validate. `$args` array Required Schema array to use for validation. `$param` string Required The parameter name, used in error messages. true|[WP\_Error](../classes/wp_error)
File: `wp-includes/rest-api.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/rest-api.php/)
```
function rest_validate_number_value_from_schema( $value, $args, $param ) {
if ( ! is_numeric( $value ) ) {
return new WP_Error(
'rest_invalid_type',
/* translators: 1: Parameter, 2: Type name. */
sprintf( __( '%1$s is not of type %2$s.' ), $param, $args['type'] ),
array( 'param' => $param )
);
}
if ( isset( $args['multipleOf'] ) && fmod( $value, $args['multipleOf'] ) !== 0.0 ) {
return new WP_Error(
'rest_invalid_multiple',
/* translators: 1: Parameter, 2: Multiplier. */
sprintf( __( '%1$s must be a multiple of %2$s.' ), $param, $args['multipleOf'] )
);
}
if ( isset( $args['minimum'] ) && ! isset( $args['maximum'] ) ) {
if ( ! empty( $args['exclusiveMinimum'] ) && $value <= $args['minimum'] ) {
return new WP_Error(
'rest_out_of_bounds',
/* translators: 1: Parameter, 2: Minimum number. */
sprintf( __( '%1$s must be greater than %2$d' ), $param, $args['minimum'] )
);
}
if ( empty( $args['exclusiveMinimum'] ) && $value < $args['minimum'] ) {
return new WP_Error(
'rest_out_of_bounds',
/* translators: 1: Parameter, 2: Minimum number. */
sprintf( __( '%1$s must be greater than or equal to %2$d' ), $param, $args['minimum'] )
);
}
}
if ( isset( $args['maximum'] ) && ! isset( $args['minimum'] ) ) {
if ( ! empty( $args['exclusiveMaximum'] ) && $value >= $args['maximum'] ) {
return new WP_Error(
'rest_out_of_bounds',
/* translators: 1: Parameter, 2: Maximum number. */
sprintf( __( '%1$s must be less than %2$d' ), $param, $args['maximum'] )
);
}
if ( empty( $args['exclusiveMaximum'] ) && $value > $args['maximum'] ) {
return new WP_Error(
'rest_out_of_bounds',
/* translators: 1: Parameter, 2: Maximum number. */
sprintf( __( '%1$s must be less than or equal to %2$d' ), $param, $args['maximum'] )
);
}
}
if ( isset( $args['minimum'], $args['maximum'] ) ) {
if ( ! empty( $args['exclusiveMinimum'] ) && ! empty( $args['exclusiveMaximum'] ) ) {
if ( $value >= $args['maximum'] || $value <= $args['minimum'] ) {
return new WP_Error(
'rest_out_of_bounds',
sprintf(
/* translators: 1: Parameter, 2: Minimum number, 3: Maximum number. */
__( '%1$s must be between %2$d (exclusive) and %3$d (exclusive)' ),
$param,
$args['minimum'],
$args['maximum']
)
);
}
}
if ( ! empty( $args['exclusiveMinimum'] ) && empty( $args['exclusiveMaximum'] ) ) {
if ( $value > $args['maximum'] || $value <= $args['minimum'] ) {
return new WP_Error(
'rest_out_of_bounds',
sprintf(
/* translators: 1: Parameter, 2: Minimum number, 3: Maximum number. */
__( '%1$s must be between %2$d (exclusive) and %3$d (inclusive)' ),
$param,
$args['minimum'],
$args['maximum']
)
);
}
}
if ( ! empty( $args['exclusiveMaximum'] ) && empty( $args['exclusiveMinimum'] ) ) {
if ( $value >= $args['maximum'] || $value < $args['minimum'] ) {
return new WP_Error(
'rest_out_of_bounds',
sprintf(
/* translators: 1: Parameter, 2: Minimum number, 3: Maximum number. */
__( '%1$s must be between %2$d (inclusive) and %3$d (exclusive)' ),
$param,
$args['minimum'],
$args['maximum']
)
);
}
}
if ( empty( $args['exclusiveMinimum'] ) && empty( $args['exclusiveMaximum'] ) ) {
if ( $value > $args['maximum'] || $value < $args['minimum'] ) {
return new WP_Error(
'rest_out_of_bounds',
sprintf(
/* translators: 1: Parameter, 2: Minimum number, 3: Maximum number. */
__( '%1$s must be between %2$d (inclusive) and %3$d (inclusive)' ),
$param,
$args['minimum'],
$args['maximum']
)
);
}
}
}
return true;
}
```
| Uses | Description |
| --- | --- |
| [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. |
| [WP\_Error::\_\_construct()](../classes/wp_error/__construct) wp-includes/class-wp-error.php | Initializes the error. |
| Used By | Description |
| --- | --- |
| [rest\_validate\_integer\_value\_from\_schema()](rest_validate_integer_value_from_schema) wp-includes/rest-api.php | Validates an integer value based on a schema. |
| [rest\_validate\_value\_from\_schema()](rest_validate_value_from_schema) wp-includes/rest-api.php | Validate a value based on a schema. |
| Version | Description |
| --- | --- |
| [5.7.0](https://developer.wordpress.org/reference/since/5.7.0/) | Introduced. |
wordpress maybe_add_column( string $table_name, string $column_name, string $create_ddl ): bool maybe\_add\_column( string $table\_name, string $column\_name, string $create\_ddl ): bool
==========================================================================================
Adds column to a database table, if it doesn’t already exist.
`$table_name` string Required Database table name. `$column_name` string Required Table column name. `$create_ddl` string Required SQL statement to add column. bool True on success or if the column already exists. False on failure.
File: `wp-admin/includes/upgrade.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/upgrade.php/)
```
function maybe_add_column( $table_name, $column_name, $create_ddl ) {
global $wpdb;
foreach ( $wpdb->get_col( "DESC $table_name", 0 ) as $column ) {
if ( $column === $column_name ) {
return true;
}
}
// Didn't find it, so try to create it.
$wpdb->query( $create_ddl );
// We cannot directly tell that whether this succeeded!
foreach ( $wpdb->get_col( "DESC $table_name", 0 ) as $column ) {
if ( $column === $column_name ) {
return true;
}
}
return false;
}
```
| Uses | Description |
| --- | --- |
| [wpdb::get\_col()](../classes/wpdb/get_col) wp-includes/class-wpdb.php | Retrieves one column from the database. |
| [wpdb::query()](../classes/wpdb/query) wp-includes/class-wpdb.php | Performs a database query, using current database connection. |
| Version | Description |
| --- | --- |
| [1.3.0](https://developer.wordpress.org/reference/since/1.3.0/) | Introduced. |
wordpress wp_update_term_count_now( array $terms, string $taxonomy ): true wp\_update\_term\_count\_now( array $terms, string $taxonomy ): true
====================================================================
Performs term count update immediately.
`$terms` array Required The term\_taxonomy\_id of terms to update. `$taxonomy` string Required The context of the term. true Always true when complete.
File: `wp-includes/taxonomy.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/taxonomy.php/)
```
function wp_update_term_count_now( $terms, $taxonomy ) {
$terms = array_map( 'intval', $terms );
$taxonomy = get_taxonomy( $taxonomy );
if ( ! empty( $taxonomy->update_count_callback ) ) {
call_user_func( $taxonomy->update_count_callback, $terms, $taxonomy );
} else {
$object_types = (array) $taxonomy->object_type;
foreach ( $object_types as &$object_type ) {
if ( 0 === strpos( $object_type, 'attachment:' ) ) {
list( $object_type ) = explode( ':', $object_type );
}
}
if ( array_filter( $object_types, 'post_type_exists' ) == $object_types ) {
// Only post types are attached to this taxonomy.
_update_post_term_count( $terms, $taxonomy );
} else {
// Default count updater.
_update_generic_term_count( $terms, $taxonomy );
}
}
clean_term_cache( $terms, '', false );
return true;
}
```
| Uses | Description |
| --- | --- |
| [\_update\_post\_term\_count()](_update_post_term_count) wp-includes/taxonomy.php | Updates term count based on object types of the current taxonomy. |
| [\_update\_generic\_term\_count()](_update_generic_term_count) wp-includes/taxonomy.php | Updates term count based on number of objects. |
| [clean\_term\_cache()](clean_term_cache) wp-includes/taxonomy.php | Removes all of the term IDs from the cache. |
| [get\_taxonomy()](get_taxonomy) wp-includes/taxonomy.php | Retrieves the taxonomy object of $taxonomy. |
| Used By | Description |
| --- | --- |
| [wp\_update\_term\_count()](wp_update_term_count) wp-includes/taxonomy.php | Updates the amount of terms in taxonomy. |
| Version | Description |
| --- | --- |
| [2.5.0](https://developer.wordpress.org/reference/since/2.5.0/) | Introduced. |
wordpress wp_dashboard_quota(): true|void wp\_dashboard\_quota(): true|void
=================================
Displays file upload quota on dashboard.
Runs on the [‘activity\_box\_end’](../hooks/activity_box_end) hook in [wp\_dashboard\_right\_now()](wp_dashboard_right_now) .
true|void True if not multisite, user can't upload files, or the space check option is disabled.
File: `wp-admin/includes/dashboard.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/dashboard.php/)
```
function wp_dashboard_quota() {
if ( ! is_multisite() || ! current_user_can( 'upload_files' )
|| get_site_option( 'upload_space_check_disabled' )
) {
return true;
}
$quota = get_space_allowed();
$used = get_space_used();
if ( $used > $quota ) {
$percentused = '100';
} else {
$percentused = ( $used / $quota ) * 100;
}
$used_class = ( $percentused >= 70 ) ? ' warning' : '';
$used = round( $used, 2 );
$percentused = number_format( $percentused );
?>
<h3 class="mu-storage"><?php _e( 'Storage Space' ); ?></h3>
<div class="mu-storage">
<ul>
<li class="storage-count">
<?php
$text = sprintf(
/* translators: %s: Number of megabytes. */
__( '%s MB Space Allowed' ),
number_format_i18n( $quota )
);
printf(
'<a href="%1$s">%2$s <span class="screen-reader-text">(%3$s)</span></a>',
esc_url( admin_url( 'upload.php' ) ),
$text,
__( 'Manage Uploads' )
);
?>
</li><li class="storage-count <?php echo $used_class; ?>">
<?php
$text = sprintf(
/* translators: 1: Number of megabytes, 2: Percentage. */
__( '%1$s MB (%2$s%%) Space Used' ),
number_format_i18n( $used, 2 ),
$percentused
);
printf(
'<a href="%1$s" class="musublink">%2$s <span class="screen-reader-text">(%3$s)</span></a>',
esc_url( admin_url( 'upload.php' ) ),
$text,
__( 'Manage Uploads' )
);
?>
</li>
</ul>
</div>
<?php
}
```
| Uses | Description |
| --- | --- |
| [get\_space\_allowed()](get_space_allowed) wp-includes/ms-functions.php | Returns the upload quota for the current blog. |
| [get\_space\_used()](get_space_used) wp-includes/ms-functions.php | Returns the space used by the current site. |
| [current\_user\_can()](current_user_can) wp-includes/capabilities.php | Returns whether the current user has the specified capability. |
| [\_e()](_e) wp-includes/l10n.php | Displays translated text. |
| [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. |
| [esc\_url()](esc_url) wp-includes/formatting.php | Checks and cleans a URL. |
| [is\_multisite()](is_multisite) wp-includes/load.php | If Multisite is enabled. |
| [number\_format\_i18n()](number_format_i18n) wp-includes/functions.php | Converts float number to format based on the locale. |
| [admin\_url()](admin_url) wp-includes/link-template.php | Retrieves the URL to the admin area for the current site. |
| [get\_site\_option()](get_site_option) wp-includes/option.php | Retrieve an option value for the current network based on name of option. |
| Version | Description |
| --- | --- |
| [3.0.0](https://developer.wordpress.org/reference/since/3.0.0/) | Introduced. |
wordpress wp_privacy_anonymize_ip( string $ip_addr, bool $ipv6_fallback = false ): string wp\_privacy\_anonymize\_ip( string $ip\_addr, bool $ipv6\_fallback = false ): string
====================================================================================
Returns an anonymized IPv4 or IPv6 address.
`$ip_addr` string Required The IPv4 or IPv6 address to be anonymized. `$ipv6_fallback` bool Optional Whether to return the original IPv6 address if the needed functions to anonymize it are not present. Default false, return `::` (unspecified address). Default: `false`
string The anonymized IP address.
File: `wp-includes/functions.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/functions.php/)
```
function wp_privacy_anonymize_ip( $ip_addr, $ipv6_fallback = false ) {
if ( empty( $ip_addr ) ) {
return '0.0.0.0';
}
// Detect what kind of IP address this is.
$ip_prefix = '';
$is_ipv6 = substr_count( $ip_addr, ':' ) > 1;
$is_ipv4 = ( 3 === substr_count( $ip_addr, '.' ) );
if ( $is_ipv6 && $is_ipv4 ) {
// IPv6 compatibility mode, temporarily strip the IPv6 part, and treat it like IPv4.
$ip_prefix = '::ffff:';
$ip_addr = preg_replace( '/^\[?[0-9a-f:]*:/i', '', $ip_addr );
$ip_addr = str_replace( ']', '', $ip_addr );
$is_ipv6 = false;
}
if ( $is_ipv6 ) {
// IPv6 addresses will always be enclosed in [] if there's a port.
$left_bracket = strpos( $ip_addr, '[' );
$right_bracket = strpos( $ip_addr, ']' );
$percent = strpos( $ip_addr, '%' );
$netmask = 'ffff:ffff:ffff:ffff:0000:0000:0000:0000';
// Strip the port (and [] from IPv6 addresses), if they exist.
if ( false !== $left_bracket && false !== $right_bracket ) {
$ip_addr = substr( $ip_addr, $left_bracket + 1, $right_bracket - $left_bracket - 1 );
} elseif ( false !== $left_bracket || false !== $right_bracket ) {
// The IP has one bracket, but not both, so it's malformed.
return '::';
}
// Strip the reachability scope.
if ( false !== $percent ) {
$ip_addr = substr( $ip_addr, 0, $percent );
}
// No invalid characters should be left.
if ( preg_match( '/[^0-9a-f:]/i', $ip_addr ) ) {
return '::';
}
// Partially anonymize the IP by reducing it to the corresponding network ID.
if ( function_exists( 'inet_pton' ) && function_exists( 'inet_ntop' ) ) {
$ip_addr = inet_ntop( inet_pton( $ip_addr ) & inet_pton( $netmask ) );
if ( false === $ip_addr ) {
return '::';
}
} elseif ( ! $ipv6_fallback ) {
return '::';
}
} elseif ( $is_ipv4 ) {
// Strip any port and partially anonymize the IP.
$last_octet_position = strrpos( $ip_addr, '.' );
$ip_addr = substr( $ip_addr, 0, $last_octet_position ) . '.0';
} else {
return '0.0.0.0';
}
// Restore the IPv6 prefix to compatibility mode addresses.
return $ip_prefix . $ip_addr;
}
```
| Used By | Description |
| --- | --- |
| [wp\_privacy\_anonymize\_data()](wp_privacy_anonymize_data) wp-includes/functions.php | Returns uniform “anonymous” data by type. |
| [WP\_Community\_Events::get\_unsafe\_client\_ip()](../classes/wp_community_events/get_unsafe_client_ip) wp-admin/includes/class-wp-community-events.php | Determines the user’s actual IP address and attempts to partially anonymize an IP address by converting it to a network ID. |
| Version | Description |
| --- | --- |
| [4.9.6](https://developer.wordpress.org/reference/since/4.9.6/) | Introduced. |
| programming_docs |
wordpress wp_kses_check_attr_val( string $value, string $vless, string $checkname, mixed $checkvalue ): bool wp\_kses\_check\_attr\_val( string $value, string $vless, string $checkname, mixed $checkvalue ): bool
======================================================================================================
Performs different checks for attribute values.
The currently implemented checks are "maxlen", "minlen", "maxval", "minval", and "valueless".
`$value` string Required Attribute value. `$vless` string Required Whether the attribute is valueless. Use `'y'` or `'n'`. `$checkname` string Required What $checkvalue is checking for. `$checkvalue` mixed Required What constraint the value should pass. bool Whether check passes.
File: `wp-includes/kses.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/kses.php/)
```
function wp_kses_check_attr_val( $value, $vless, $checkname, $checkvalue ) {
$ok = true;
switch ( strtolower( $checkname ) ) {
case 'maxlen':
/*
* The maxlen check makes sure that the attribute value has a length not
* greater than the given value. This can be used to avoid Buffer Overflows
* in WWW clients and various Internet servers.
*/
if ( strlen( $value ) > $checkvalue ) {
$ok = false;
}
break;
case 'minlen':
/*
* The minlen check makes sure that the attribute value has a length not
* smaller than the given value.
*/
if ( strlen( $value ) < $checkvalue ) {
$ok = false;
}
break;
case 'maxval':
/*
* The maxval check does two things: it checks that the attribute value is
* an integer from 0 and up, without an excessive amount of zeroes or
* whitespace (to avoid Buffer Overflows). It also checks that the attribute
* value is not greater than the given value.
* This check can be used to avoid Denial of Service attacks.
*/
if ( ! preg_match( '/^\s{0,6}[0-9]{1,6}\s{0,6}$/', $value ) ) {
$ok = false;
}
if ( $value > $checkvalue ) {
$ok = false;
}
break;
case 'minval':
/*
* The minval check makes sure that the attribute value is a positive integer,
* and that it is not smaller than the given value.
*/
if ( ! preg_match( '/^\s{0,6}[0-9]{1,6}\s{0,6}$/', $value ) ) {
$ok = false;
}
if ( $value < $checkvalue ) {
$ok = false;
}
break;
case 'valueless':
/*
* The valueless check makes sure if the attribute has a value
* (like `<a href="blah">`) or not (`<option selected>`). If the given value
* is a "y" or a "Y", the attribute must not have a value.
* If the given value is an "n" or an "N", the attribute must have a value.
*/
if ( strtolower( $checkvalue ) != $vless ) {
$ok = false;
}
break;
case 'values':
/*
* The values check is used when you want to make sure that the attribute
* has one of the given values.
*/
if ( false === array_search( strtolower( $value ), $checkvalue, true ) ) {
$ok = false;
}
break;
case 'value_callback':
/*
* The value_callback check is used when you want to make sure that the attribute
* value is accepted by the callback function.
*/
if ( ! call_user_func( $checkvalue, $value ) ) {
$ok = false;
}
break;
} // End switch.
return $ok;
}
```
| Used By | Description |
| --- | --- |
| [wp\_kses\_attr\_check()](wp_kses_attr_check) wp-includes/kses.php | Determines whether an attribute is allowed. |
| Version | Description |
| --- | --- |
| [1.0.0](https://developer.wordpress.org/reference/since/1.0.0/) | Introduced. |
wordpress rest_get_best_type_for_value( mixed $value, array $types ): string rest\_get\_best\_type\_for\_value( mixed $value, array $types ): string
=======================================================================
Gets the best type for a value.
`$value` mixed Required The value to check. `$types` array Required The list of possible types. string The best matching type, an empty string if no types match.
File: `wp-includes/rest-api.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/rest-api.php/)
```
function rest_get_best_type_for_value( $value, $types ) {
static $checks = array(
'array' => 'rest_is_array',
'object' => 'rest_is_object',
'integer' => 'rest_is_integer',
'number' => 'is_numeric',
'boolean' => 'rest_is_boolean',
'string' => 'is_string',
'null' => 'is_null',
);
// Both arrays and objects allow empty strings to be converted to their types.
// But the best answer for this type is a string.
if ( '' === $value && in_array( 'string', $types, true ) ) {
return 'string';
}
foreach ( $types as $type ) {
if ( isset( $checks[ $type ] ) && $checks[ $type ]( $value ) ) {
return $type;
}
}
return '';
}
```
| Used By | Description |
| --- | --- |
| [rest\_handle\_multi\_type\_schema()](rest_handle_multi_type_schema) wp-includes/rest-api.php | Handles getting the best type for a multi-type schema. |
| Version | Description |
| --- | --- |
| [5.5.0](https://developer.wordpress.org/reference/since/5.5.0/) | Introduced. |
wordpress wp_refresh_post_lock( array $response, array $data, string $screen_id ): array wp\_refresh\_post\_lock( array $response, array $data, string $screen\_id ): array
==================================================================================
Checks lock status on the New/Edit Post screen and refresh the lock.
`$response` array Required The Heartbeat response. `$data` array Required The $\_POST data sent. `$screen_id` string Required The screen ID. array The Heartbeat response.
File: `wp-admin/includes/misc.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/misc.php/)
```
function wp_refresh_post_lock( $response, $data, $screen_id ) {
if ( array_key_exists( 'wp-refresh-post-lock', $data ) ) {
$received = $data['wp-refresh-post-lock'];
$send = array();
$post_id = absint( $received['post_id'] );
if ( ! $post_id ) {
return $response;
}
if ( ! current_user_can( 'edit_post', $post_id ) ) {
return $response;
}
$user_id = wp_check_post_lock( $post_id );
$user = get_userdata( $user_id );
if ( $user ) {
$error = array(
'name' => $user->display_name,
/* translators: %s: User's display name. */
'text' => sprintf( __( '%s has taken over and is currently editing.' ), $user->display_name ),
);
if ( get_option( 'show_avatars' ) ) {
$error['avatar_src'] = get_avatar_url( $user->ID, array( 'size' => 64 ) );
$error['avatar_src_2x'] = get_avatar_url( $user->ID, array( 'size' => 128 ) );
}
$send['lock_error'] = $error;
} else {
$new_lock = wp_set_post_lock( $post_id );
if ( $new_lock ) {
$send['new_lock'] = implode( ':', $new_lock );
}
}
$response['wp-refresh-post-lock'] = $send;
}
return $response;
}
```
| Uses | Description |
| --- | --- |
| [get\_avatar\_url()](get_avatar_url) wp-includes/link-template.php | Retrieves the avatar URL. |
| [wp\_check\_post\_lock()](wp_check_post_lock) wp-admin/includes/post.php | Determines whether the post is currently being edited by another user. |
| [wp\_set\_post\_lock()](wp_set_post_lock) wp-admin/includes/post.php | Marks the post as currently being edited by the current user. |
| [current\_user\_can()](current_user_can) wp-includes/capabilities.php | Returns whether the current user has the specified capability. |
| [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. |
| [get\_userdata()](get_userdata) wp-includes/pluggable.php | Retrieves user info by user ID. |
| [absint()](absint) wp-includes/functions.php | Converts a value to non-negative integer. |
| [get\_option()](get_option) wp-includes/option.php | Retrieves an option value based on an option name. |
| Version | Description |
| --- | --- |
| [3.6.0](https://developer.wordpress.org/reference/since/3.6.0/) | Introduced. |
wordpress rest_validate_null_value_from_schema( mixed $value, string $param ): true|WP_Error rest\_validate\_null\_value\_from\_schema( mixed $value, string $param ): true|WP\_Error
========================================================================================
Validates a null value based on a schema.
`$value` mixed Required The value to validate. `$param` string Required The parameter name, used in error messages. true|[WP\_Error](../classes/wp_error)
File: `wp-includes/rest-api.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/rest-api.php/)
```
function rest_validate_null_value_from_schema( $value, $param ) {
if ( null !== $value ) {
return new WP_Error(
'rest_invalid_type',
/* translators: 1: Parameter, 2: Type name. */
sprintf( __( '%1$s is not of type %2$s.' ), $param, 'null' ),
array( 'param' => $param )
);
}
return true;
}
```
| Uses | Description |
| --- | --- |
| [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. |
| [WP\_Error::\_\_construct()](../classes/wp_error/__construct) wp-includes/class-wp-error.php | Initializes the error. |
| Used By | Description |
| --- | --- |
| [rest\_validate\_value\_from\_schema()](rest_validate_value_from_schema) wp-includes/rest-api.php | Validate a value based on a schema. |
| Version | Description |
| --- | --- |
| [5.7.0](https://developer.wordpress.org/reference/since/5.7.0/) | Introduced. |
wordpress do_feed() do\_feed()
==========
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.
File: `wp-includes/functions.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/functions.php/)
```
function do_feed() {
global $wp_query;
$feed = get_query_var( 'feed' );
// Remove the pad, if present.
$feed = preg_replace( '/^_+/', '', $feed );
if ( '' === $feed || 'feed' === $feed ) {
$feed = get_default_feed();
}
if ( ! has_action( "do_feed_{$feed}" ) ) {
wp_die( __( '<strong>Error:</strong> This is not a valid feed template.' ), '', array( 'response' => 404 ) );
}
/**
* Fires once the given feed is loaded.
*
* The dynamic portion of the hook name, `$feed`, refers to the feed template name.
*
* Possible hook names include:
*
* - `do_feed_atom`
* - `do_feed_rdf`
* - `do_feed_rss`
* - `do_feed_rss2`
*
* @since 2.1.0
* @since 4.4.0 The `$feed` parameter was added.
*
* @param bool $is_comment_feed Whether the feed is a comment feed.
* @param string $feed The feed name.
*/
do_action( "do_feed_{$feed}", $wp_query->is_comment_feed, $feed );
}
```
[do\_action( "do\_feed\_{$feed}", bool $is\_comment\_feed, string $feed )](../hooks/do_feed_feed)
Fires once the given feed is loaded.
| Uses | Description |
| --- | --- |
| [get\_query\_var()](get_query_var) wp-includes/query.php | Retrieves the value of a query variable in the [WP\_Query](../classes/wp_query) class. |
| [has\_action()](has_action) wp-includes/plugin.php | Checks if any action has been registered for a hook. |
| [get\_default\_feed()](get_default_feed) wp-includes/feed.php | Retrieves the default feed. |
| [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. |
| [wp\_die()](wp_die) wp-includes/functions.php | Kills WordPress execution and displays HTML page with an error message. |
| [do\_action()](do_action) wp-includes/plugin.php | Calls the callback functions that have been added to an action hook. |
| Version | Description |
| --- | --- |
| [2.1.0](https://developer.wordpress.org/reference/since/2.1.0/) | Introduced. |
wordpress wp_generate_tag_cloud( WP_Term[] $tags, string|array $args = '' ): string|string[] wp\_generate\_tag\_cloud( WP\_Term[] $tags, string|array $args = '' ): string|string[]
======================================================================================
Generates a tag cloud (heatmap) from provided data.
`$tags` [WP\_Term](../classes/wp_term)[] Required Array of [WP\_Term](../classes/wp_term) objects to generate the tag cloud for. `$args` string|array Optional Array or string of arguments for generating a tag cloud.
* `smallest`intSmallest font size used to display tags. Paired with the value of `$unit`, to determine CSS text size unit. Default 8 (pt).
* `largest`intLargest font size used to display tags. Paired with the value of `$unit`, to determine CSS text size unit. Default 22 (pt).
* `unit`stringCSS text size unit to use with the `$smallest` and `$largest` values. Accepts any valid CSS text size unit. Default `'pt'`.
* `number`intThe number of tags to return. Accepts any positive integer or zero to return all.
Default 0.
* `format`stringFormat to display the tag cloud in. Accepts `'flat'` (tags separated with spaces), `'list'` (tags displayed in an unordered list), or `'array'` (returns an array).
Default `'flat'`.
* `separator`stringHTML or text to separate the tags. Default "n" (newline).
* `orderby`stringValue to order tags by. Accepts `'name'` or `'count'`.
Default `'name'`. The ['tag\_cloud\_sort'](../hooks/tag_cloud_sort) filter can also affect how tags are sorted.
* `order`stringHow to order the tags. Accepts `'ASC'` (ascending), `'DESC'` (descending), or `'RAND'` (random). Default `'ASC'`.
* `filter`int|boolWhether to enable filtering of the final output via ['wp\_generate\_tag\_cloud'](../hooks/wp_generate_tag_cloud). Default 1.
* `topic_count_text`arrayNooped plural text from [\_n\_noop()](_n_noop) to supply to tag counts. Default null.
* `topic_count_text_callback`callableCallback used to generate nooped plural text for tag counts based on the count. Default null.
* `topic_count_scale_callback`callableCallback used to determine the tag count scaling value. Default [default\_topic\_count\_scale()](default_topic_count_scale) .
* `show_count`bool|intWhether to display the tag counts. Default 0. Accepts 0, 1, or their bool equivalents.
Default: `''`
string|string[] Tag cloud as a string or an array, depending on `'format'` argument.
File: `wp-includes/category-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/category-template.php/)
```
function wp_generate_tag_cloud( $tags, $args = '' ) {
$defaults = array(
'smallest' => 8,
'largest' => 22,
'unit' => 'pt',
'number' => 0,
'format' => 'flat',
'separator' => "\n",
'orderby' => 'name',
'order' => 'ASC',
'topic_count_text' => null,
'topic_count_text_callback' => null,
'topic_count_scale_callback' => 'default_topic_count_scale',
'filter' => 1,
'show_count' => 0,
);
$args = wp_parse_args( $args, $defaults );
$return = ( 'array' === $args['format'] ) ? array() : '';
if ( empty( $tags ) ) {
return $return;
}
// Juggle topic counts.
if ( isset( $args['topic_count_text'] ) ) {
// First look for nooped plural support via topic_count_text.
$translate_nooped_plural = $args['topic_count_text'];
} elseif ( ! empty( $args['topic_count_text_callback'] ) ) {
// Look for the alternative callback style. Ignore the previous default.
if ( 'default_topic_count_text' === $args['topic_count_text_callback'] ) {
/* translators: %s: Number of items (tags). */
$translate_nooped_plural = _n_noop( '%s item', '%s items' );
} else {
$translate_nooped_plural = false;
}
} elseif ( isset( $args['single_text'] ) && isset( $args['multiple_text'] ) ) {
// If no callback exists, look for the old-style single_text and multiple_text arguments.
// phpcs:ignore WordPress.WP.I18n.NonSingularStringLiteralSingle,WordPress.WP.I18n.NonSingularStringLiteralPlural
$translate_nooped_plural = _n_noop( $args['single_text'], $args['multiple_text'] );
} else {
// This is the default for when no callback, plural, or argument is passed in.
/* translators: %s: Number of items (tags). */
$translate_nooped_plural = _n_noop( '%s item', '%s items' );
}
/**
* Filters how the items in a tag cloud are sorted.
*
* @since 2.8.0
*
* @param WP_Term[] $tags Ordered array of terms.
* @param array $args An array of tag cloud arguments.
*/
$tags_sorted = apply_filters( 'tag_cloud_sort', $tags, $args );
if ( empty( $tags_sorted ) ) {
return $return;
}
if ( $tags_sorted !== $tags ) {
$tags = $tags_sorted;
unset( $tags_sorted );
} else {
if ( 'RAND' === $args['order'] ) {
shuffle( $tags );
} else {
// SQL cannot save you; this is a second (potentially different) sort on a subset of data.
if ( 'name' === $args['orderby'] ) {
uasort( $tags, '_wp_object_name_sort_cb' );
} else {
uasort( $tags, '_wp_object_count_sort_cb' );
}
if ( 'DESC' === $args['order'] ) {
$tags = array_reverse( $tags, true );
}
}
}
if ( $args['number'] > 0 ) {
$tags = array_slice( $tags, 0, $args['number'] );
}
$counts = array();
$real_counts = array(); // For the alt tag.
foreach ( (array) $tags as $key => $tag ) {
$real_counts[ $key ] = $tag->count;
$counts[ $key ] = call_user_func( $args['topic_count_scale_callback'], $tag->count );
}
$min_count = min( $counts );
$spread = max( $counts ) - $min_count;
if ( $spread <= 0 ) {
$spread = 1;
}
$font_spread = $args['largest'] - $args['smallest'];
if ( $font_spread < 0 ) {
$font_spread = 1;
}
$font_step = $font_spread / $spread;
$aria_label = false;
/*
* Determine whether to output an 'aria-label' attribute with the tag name and count.
* When tags have a different font size, they visually convey an important information
* that should be available to assistive technologies too. On the other hand, sometimes
* themes set up the Tag Cloud to display all tags with the same font size (setting
* the 'smallest' and 'largest' arguments to the same value).
* In order to always serve the same content to all users, the 'aria-label' gets printed out:
* - when tags have a different size
* - when the tag count is displayed (for example when users check the checkbox in the
* Tag Cloud widget), regardless of the tags font size
*/
if ( $args['show_count'] || 0 !== $font_spread ) {
$aria_label = true;
}
// Assemble the data that will be used to generate the tag cloud markup.
$tags_data = array();
foreach ( $tags as $key => $tag ) {
$tag_id = isset( $tag->id ) ? $tag->id : $key;
$count = $counts[ $key ];
$real_count = $real_counts[ $key ];
if ( $translate_nooped_plural ) {
$formatted_count = sprintf( translate_nooped_plural( $translate_nooped_plural, $real_count ), number_format_i18n( $real_count ) );
} else {
$formatted_count = call_user_func( $args['topic_count_text_callback'], $real_count, $tag, $args );
}
$tags_data[] = array(
'id' => $tag_id,
'url' => ( '#' !== $tag->link ) ? $tag->link : '#',
'role' => ( '#' !== $tag->link ) ? '' : ' role="button"',
'name' => $tag->name,
'formatted_count' => $formatted_count,
'slug' => $tag->slug,
'real_count' => $real_count,
'class' => 'tag-cloud-link tag-link-' . $tag_id,
'font_size' => $args['smallest'] + ( $count - $min_count ) * $font_step,
'aria_label' => $aria_label ? sprintf( ' aria-label="%1$s (%2$s)"', esc_attr( $tag->name ), esc_attr( $formatted_count ) ) : '',
'show_count' => $args['show_count'] ? '<span class="tag-link-count"> (' . $real_count . ')</span>' : '',
);
}
/**
* Filters the data used to generate the tag cloud.
*
* @since 4.3.0
*
* @param array[] $tags_data An array of term data arrays for terms used to generate the tag cloud.
*/
$tags_data = apply_filters( 'wp_generate_tag_cloud_data', $tags_data );
$a = array();
// Generate the output links array.
foreach ( $tags_data as $key => $tag_data ) {
$class = $tag_data['class'] . ' tag-link-position-' . ( $key + 1 );
$a[] = sprintf(
'<a href="%1$s"%2$s class="%3$s" style="font-size: %4$s;"%5$s>%6$s%7$s</a>',
esc_url( $tag_data['url'] ),
$tag_data['role'],
esc_attr( $class ),
esc_attr( str_replace( ',', '.', $tag_data['font_size'] ) . $args['unit'] ),
$tag_data['aria_label'],
esc_html( $tag_data['name'] ),
$tag_data['show_count']
);
}
switch ( $args['format'] ) {
case 'array':
$return =& $a;
break;
case 'list':
/*
* Force role="list", as some browsers (sic: Safari 10) don't expose to assistive
* technologies the default role when the list is styled with `list-style: none`.
* Note: this is redundant but doesn't harm.
*/
$return = "<ul class='wp-tag-cloud' role='list'>\n\t<li>";
$return .= implode( "</li>\n\t<li>", $a );
$return .= "</li>\n</ul>\n";
break;
default:
$return = implode( $args['separator'], $a );
break;
}
if ( $args['filter'] ) {
/**
* Filters the generated output of a tag cloud.
*
* The filter is only evaluated if a true value is passed
* to the $filter argument in wp_generate_tag_cloud().
*
* @since 2.3.0
*
* @see wp_generate_tag_cloud()
*
* @param string[]|string $return String containing the generated HTML tag cloud output
* or an array of tag links if the 'format' argument
* equals 'array'.
* @param WP_Term[] $tags An array of terms used in the tag cloud.
* @param array $args An array of wp_generate_tag_cloud() arguments.
*/
return apply_filters( 'wp_generate_tag_cloud', $return, $tags, $args );
} else {
return $return;
}
}
```
[apply\_filters( 'tag\_cloud\_sort', WP\_Term[] $tags, array $args )](../hooks/tag_cloud_sort)
Filters how the items in a tag cloud are sorted.
[apply\_filters( 'wp\_generate\_tag\_cloud', string[]|string $return, WP\_Term[] $tags, array $args )](../hooks/wp_generate_tag_cloud)
Filters the generated output of a tag cloud.
[apply\_filters( 'wp\_generate\_tag\_cloud\_data', array[] $tags\_data )](../hooks/wp_generate_tag_cloud_data)
Filters the data used to generate the tag cloud.
| Uses | Description |
| --- | --- |
| [\_n\_noop()](_n_noop) wp-includes/l10n.php | Registers plural strings in POT file, but does not translate them. |
| [translate\_nooped\_plural()](translate_nooped_plural) wp-includes/l10n.php | Translates and returns the singular or plural form of a string that’s been registered with [\_n\_noop()](_n_noop) or [\_nx\_noop()](_nx_noop) . |
| [esc\_attr()](esc_attr) wp-includes/formatting.php | Escaping for HTML attributes. |
| [esc\_url()](esc_url) wp-includes/formatting.php | Checks and cleans a URL. |
| [esc\_html()](esc_html) wp-includes/formatting.php | Escaping for HTML blocks. |
| [wp\_parse\_args()](wp_parse_args) wp-includes/functions.php | Merges user defined arguments into defaults array. |
| [number\_format\_i18n()](number_format_i18n) wp-includes/functions.php | Converts float number to format based on the locale. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| Used By | Description |
| --- | --- |
| [install\_dashboard()](install_dashboard) wp-admin/includes/plugin-install.php | Displays the Featured tab of Add Plugins screen. |
| [wp\_ajax\_get\_tagcloud()](wp_ajax_get_tagcloud) wp-admin/includes/ajax-actions.php | Ajax handler for getting a tagcloud. |
| [wp\_tag\_cloud()](wp_tag_cloud) wp-includes/category-template.php | Displays a tag cloud. |
| Version | Description |
| --- | --- |
| [4.8.0](https://developer.wordpress.org/reference/since/4.8.0/) | Added the `show_count` argument. |
| [2.3.0](https://developer.wordpress.org/reference/since/2.3.0/) | Introduced. |
| programming_docs |
wordpress wp_default_scripts( WP_Scripts $scripts ) wp\_default\_scripts( WP\_Scripts $scripts )
============================================
Registers all WordPress scripts.
Localizes some of them.
args order: `$scripts->add( 'handle', 'url', 'dependencies', 'query-string', 1 );` when last arg === 1 queues the script for the footer
`$scripts` [WP\_Scripts](../classes/wp_scripts) Required [WP\_Scripts](../classes/wp_scripts) object. File: `wp-includes/script-loader.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/script-loader.php/)
```
function wp_default_scripts( $scripts ) {
$suffix = wp_scripts_get_suffix();
$dev_suffix = wp_scripts_get_suffix( 'dev' );
$guessurl = site_url();
if ( ! $guessurl ) {
$guessed_url = true;
$guessurl = wp_guess_url();
}
$scripts->base_url = $guessurl;
$scripts->content_url = defined( 'WP_CONTENT_URL' ) ? WP_CONTENT_URL : '';
$scripts->default_version = get_bloginfo( 'version' );
$scripts->default_dirs = array( '/wp-admin/js/', '/wp-includes/js/' );
$scripts->add( 'utils', "/wp-includes/js/utils$suffix.js" );
did_action( 'init' ) && $scripts->localize(
'utils',
'userSettings',
array(
'url' => (string) SITECOOKIEPATH,
'uid' => (string) get_current_user_id(),
'time' => (string) time(),
'secure' => (string) ( 'https' === parse_url( site_url(), PHP_URL_SCHEME ) ),
)
);
$scripts->add( 'common', "/wp-admin/js/common$suffix.js", array( 'jquery', 'hoverIntent', 'utils' ), false, 1 );
$scripts->set_translations( 'common' );
$scripts->add( 'wp-sanitize', "/wp-includes/js/wp-sanitize$suffix.js", array(), false, 1 );
$scripts->add( 'sack', "/wp-includes/js/tw-sack$suffix.js", array(), '1.6.1', 1 );
$scripts->add( 'quicktags', "/wp-includes/js/quicktags$suffix.js", array(), false, 1 );
did_action( 'init' ) && $scripts->localize(
'quicktags',
'quicktagsL10n',
array(
'closeAllOpenTags' => __( 'Close all open tags' ),
'closeTags' => __( 'close tags' ),
'enterURL' => __( 'Enter the URL' ),
'enterImageURL' => __( 'Enter the URL of the image' ),
'enterImageDescription' => __( 'Enter a description of the image' ),
'textdirection' => __( 'text direction' ),
'toggleTextdirection' => __( 'Toggle Editor Text Direction' ),
'dfw' => __( 'Distraction-free writing mode' ),
'strong' => __( 'Bold' ),
'strongClose' => __( 'Close bold tag' ),
'em' => __( 'Italic' ),
'emClose' => __( 'Close italic tag' ),
'link' => __( 'Insert link' ),
'blockquote' => __( 'Blockquote' ),
'blockquoteClose' => __( 'Close blockquote tag' ),
'del' => __( 'Deleted text (strikethrough)' ),
'delClose' => __( 'Close deleted text tag' ),
'ins' => __( 'Inserted text' ),
'insClose' => __( 'Close inserted text tag' ),
'image' => __( 'Insert image' ),
'ul' => __( 'Bulleted list' ),
'ulClose' => __( 'Close bulleted list tag' ),
'ol' => __( 'Numbered list' ),
'olClose' => __( 'Close numbered list tag' ),
'li' => __( 'List item' ),
'liClose' => __( 'Close list item tag' ),
'code' => __( 'Code' ),
'codeClose' => __( 'Close code tag' ),
'more' => __( 'Insert Read More tag' ),
)
);
$scripts->add( 'colorpicker', "/wp-includes/js/colorpicker$suffix.js", array( 'prototype' ), '3517m' );
$scripts->add( 'editor', "/wp-admin/js/editor$suffix.js", array( 'utils', 'jquery' ), false, 1 );
$scripts->add( 'clipboard', "/wp-includes/js/clipboard$suffix.js", array(), '2.0.11', 1 );
$scripts->add( 'wp-ajax-response', "/wp-includes/js/wp-ajax-response$suffix.js", array( 'jquery', 'wp-a11y' ), false, 1 );
did_action( 'init' ) && $scripts->localize(
'wp-ajax-response',
'wpAjax',
array(
'noPerm' => __( 'Sorry, you are not allowed to do that.' ),
'broken' => __( 'Something went wrong.' ),
)
);
$scripts->add( 'wp-api-request', "/wp-includes/js/api-request$suffix.js", array( 'jquery' ), false, 1 );
// `wpApiSettings` is also used by `wp-api`, which depends on this script.
did_action( 'init' ) && $scripts->localize(
'wp-api-request',
'wpApiSettings',
array(
'root' => sanitize_url( get_rest_url() ),
'nonce' => wp_installing() ? '' : wp_create_nonce( 'wp_rest' ),
'versionString' => 'wp/v2/',
)
);
$scripts->add( 'wp-pointer', "/wp-includes/js/wp-pointer$suffix.js", array( 'jquery-ui-core' ), false, 1 );
$scripts->set_translations( 'wp-pointer' );
$scripts->add( 'autosave', "/wp-includes/js/autosave$suffix.js", array( 'heartbeat' ), false, 1 );
$scripts->add( 'heartbeat', "/wp-includes/js/heartbeat$suffix.js", array( 'jquery', 'wp-hooks' ), false, 1 );
did_action( 'init' ) && $scripts->localize(
'heartbeat',
'heartbeatSettings',
/**
* Filters the Heartbeat settings.
*
* @since 3.6.0
*
* @param array $settings Heartbeat settings array.
*/
apply_filters( 'heartbeat_settings', array() )
);
$scripts->add( 'wp-auth-check', "/wp-includes/js/wp-auth-check$suffix.js", array( 'heartbeat' ), false, 1 );
$scripts->set_translations( 'wp-auth-check' );
$scripts->add( 'wp-lists', "/wp-includes/js/wp-lists$suffix.js", array( 'wp-ajax-response', 'jquery-color' ), false, 1 );
// WordPress no longer uses or bundles Prototype or script.aculo.us. These are now pulled from an external source.
$scripts->add( 'prototype', 'https://ajax.googleapis.com/ajax/libs/prototype/1.7.1.0/prototype.js', array(), '1.7.1' );
$scripts->add( 'scriptaculous-root', 'https://ajax.googleapis.com/ajax/libs/scriptaculous/1.9.0/scriptaculous.js', array( 'prototype' ), '1.9.0' );
$scripts->add( 'scriptaculous-builder', 'https://ajax.googleapis.com/ajax/libs/scriptaculous/1.9.0/builder.js', array( 'scriptaculous-root' ), '1.9.0' );
$scripts->add( 'scriptaculous-dragdrop', 'https://ajax.googleapis.com/ajax/libs/scriptaculous/1.9.0/dragdrop.js', array( 'scriptaculous-builder', 'scriptaculous-effects' ), '1.9.0' );
$scripts->add( 'scriptaculous-effects', 'https://ajax.googleapis.com/ajax/libs/scriptaculous/1.9.0/effects.js', array( 'scriptaculous-root' ), '1.9.0' );
$scripts->add( 'scriptaculous-slider', 'https://ajax.googleapis.com/ajax/libs/scriptaculous/1.9.0/slider.js', array( 'scriptaculous-effects' ), '1.9.0' );
$scripts->add( 'scriptaculous-sound', 'https://ajax.googleapis.com/ajax/libs/scriptaculous/1.9.0/sound.js', array( 'scriptaculous-root' ), '1.9.0' );
$scripts->add( 'scriptaculous-controls', 'https://ajax.googleapis.com/ajax/libs/scriptaculous/1.9.0/controls.js', array( 'scriptaculous-root' ), '1.9.0' );
$scripts->add( 'scriptaculous', false, array( 'scriptaculous-dragdrop', 'scriptaculous-slider', 'scriptaculous-controls' ) );
// Not used in core, replaced by Jcrop.js.
$scripts->add( 'cropper', '/wp-includes/js/crop/cropper.js', array( 'scriptaculous-dragdrop' ) );
// jQuery.
// The unminified jquery.js and jquery-migrate.js are included to facilitate debugging.
$scripts->add( 'jquery', false, array( 'jquery-core', 'jquery-migrate' ), '3.6.1' );
$scripts->add( 'jquery-core', "/wp-includes/js/jquery/jquery$suffix.js", array(), '3.6.1' );
$scripts->add( 'jquery-migrate', "/wp-includes/js/jquery/jquery-migrate$suffix.js", array(), '3.3.2' );
// Full jQuery UI.
// The build process in 1.12.1 has changed significantly.
// In order to keep backwards compatibility, and to keep the optimized loading,
// the source files were flattened and included with some modifications for AMD loading.
// A notable change is that 'jquery-ui-core' now contains 'jquery-ui-position' and 'jquery-ui-widget'.
$scripts->add( 'jquery-ui-core', "/wp-includes/js/jquery/ui/core$suffix.js", array( 'jquery' ), '1.13.2', 1 );
$scripts->add( 'jquery-effects-core', "/wp-includes/js/jquery/ui/effect$suffix.js", array( 'jquery' ), '1.13.2', 1 );
$scripts->add( 'jquery-effects-blind', "/wp-includes/js/jquery/ui/effect-blind$suffix.js", array( 'jquery-effects-core' ), '1.13.2', 1 );
$scripts->add( 'jquery-effects-bounce', "/wp-includes/js/jquery/ui/effect-bounce$suffix.js", array( 'jquery-effects-core' ), '1.13.2', 1 );
$scripts->add( 'jquery-effects-clip', "/wp-includes/js/jquery/ui/effect-clip$suffix.js", array( 'jquery-effects-core' ), '1.13.2', 1 );
$scripts->add( 'jquery-effects-drop', "/wp-includes/js/jquery/ui/effect-drop$suffix.js", array( 'jquery-effects-core' ), '1.13.2', 1 );
$scripts->add( 'jquery-effects-explode', "/wp-includes/js/jquery/ui/effect-explode$suffix.js", array( 'jquery-effects-core' ), '1.13.2', 1 );
$scripts->add( 'jquery-effects-fade', "/wp-includes/js/jquery/ui/effect-fade$suffix.js", array( 'jquery-effects-core' ), '1.13.2', 1 );
$scripts->add( 'jquery-effects-fold', "/wp-includes/js/jquery/ui/effect-fold$suffix.js", array( 'jquery-effects-core' ), '1.13.2', 1 );
$scripts->add( 'jquery-effects-highlight', "/wp-includes/js/jquery/ui/effect-highlight$suffix.js", array( 'jquery-effects-core' ), '1.13.2', 1 );
$scripts->add( 'jquery-effects-puff', "/wp-includes/js/jquery/ui/effect-puff$suffix.js", array( 'jquery-effects-core', 'jquery-effects-scale' ), '1.13.2', 1 );
$scripts->add( 'jquery-effects-pulsate', "/wp-includes/js/jquery/ui/effect-pulsate$suffix.js", array( 'jquery-effects-core' ), '1.13.2', 1 );
$scripts->add( 'jquery-effects-scale', "/wp-includes/js/jquery/ui/effect-scale$suffix.js", array( 'jquery-effects-core', 'jquery-effects-size' ), '1.13.2', 1 );
$scripts->add( 'jquery-effects-shake', "/wp-includes/js/jquery/ui/effect-shake$suffix.js", array( 'jquery-effects-core' ), '1.13.2', 1 );
$scripts->add( 'jquery-effects-size', "/wp-includes/js/jquery/ui/effect-size$suffix.js", array( 'jquery-effects-core' ), '1.13.2', 1 );
$scripts->add( 'jquery-effects-slide', "/wp-includes/js/jquery/ui/effect-slide$suffix.js", array( 'jquery-effects-core' ), '1.13.2', 1 );
$scripts->add( 'jquery-effects-transfer', "/wp-includes/js/jquery/ui/effect-transfer$suffix.js", array( 'jquery-effects-core' ), '1.13.2', 1 );
// Widgets
$scripts->add( 'jquery-ui-accordion', "/wp-includes/js/jquery/ui/accordion$suffix.js", array( 'jquery-ui-core' ), '1.13.2', 1 );
$scripts->add( 'jquery-ui-autocomplete', "/wp-includes/js/jquery/ui/autocomplete$suffix.js", array( 'jquery-ui-menu', 'wp-a11y' ), '1.13.2', 1 );
$scripts->add( 'jquery-ui-button', "/wp-includes/js/jquery/ui/button$suffix.js", array( 'jquery-ui-core', 'jquery-ui-controlgroup', 'jquery-ui-checkboxradio' ), '1.13.2', 1 );
$scripts->add( 'jquery-ui-datepicker', "/wp-includes/js/jquery/ui/datepicker$suffix.js", array( 'jquery-ui-core' ), '1.13.2', 1 );
$scripts->add( 'jquery-ui-dialog', "/wp-includes/js/jquery/ui/dialog$suffix.js", array( 'jquery-ui-resizable', 'jquery-ui-draggable', 'jquery-ui-button' ), '1.13.2', 1 );
$scripts->add( 'jquery-ui-menu', "/wp-includes/js/jquery/ui/menu$suffix.js", array( 'jquery-ui-core' ), '1.13.2', 1 );
$scripts->add( 'jquery-ui-mouse', "/wp-includes/js/jquery/ui/mouse$suffix.js", array( 'jquery-ui-core' ), '1.13.2', 1 );
$scripts->add( 'jquery-ui-progressbar', "/wp-includes/js/jquery/ui/progressbar$suffix.js", array( 'jquery-ui-core' ), '1.13.2', 1 );
$scripts->add( 'jquery-ui-selectmenu', "/wp-includes/js/jquery/ui/selectmenu$suffix.js", array( 'jquery-ui-menu' ), '1.13.2', 1 );
$scripts->add( 'jquery-ui-slider', "/wp-includes/js/jquery/ui/slider$suffix.js", array( 'jquery-ui-mouse' ), '1.13.2', 1 );
$scripts->add( 'jquery-ui-spinner', "/wp-includes/js/jquery/ui/spinner$suffix.js", array( 'jquery-ui-button' ), '1.13.2', 1 );
$scripts->add( 'jquery-ui-tabs', "/wp-includes/js/jquery/ui/tabs$suffix.js", array( 'jquery-ui-core' ), '1.13.2', 1 );
$scripts->add( 'jquery-ui-tooltip', "/wp-includes/js/jquery/ui/tooltip$suffix.js", array( 'jquery-ui-core' ), '1.13.2', 1 );
// New in 1.12.1
$scripts->add( 'jquery-ui-checkboxradio', "/wp-includes/js/jquery/ui/checkboxradio$suffix.js", array( 'jquery-ui-core' ), '1.13.2', 1 );
$scripts->add( 'jquery-ui-controlgroup', "/wp-includes/js/jquery/ui/controlgroup$suffix.js", array( 'jquery-ui-core' ), '1.13.2', 1 );
// Interactions
$scripts->add( 'jquery-ui-draggable', "/wp-includes/js/jquery/ui/draggable$suffix.js", array( 'jquery-ui-mouse' ), '1.13.2', 1 );
$scripts->add( 'jquery-ui-droppable', "/wp-includes/js/jquery/ui/droppable$suffix.js", array( 'jquery-ui-draggable' ), '1.13.2', 1 );
$scripts->add( 'jquery-ui-resizable', "/wp-includes/js/jquery/ui/resizable$suffix.js", array( 'jquery-ui-mouse' ), '1.13.2', 1 );
$scripts->add( 'jquery-ui-selectable', "/wp-includes/js/jquery/ui/selectable$suffix.js", array( 'jquery-ui-mouse' ), '1.13.2', 1 );
$scripts->add( 'jquery-ui-sortable', "/wp-includes/js/jquery/ui/sortable$suffix.js", array( 'jquery-ui-mouse' ), '1.13.2', 1 );
// As of 1.12.1 `jquery-ui-position` and `jquery-ui-widget` are part of `jquery-ui-core`.
// Listed here for back-compat.
$scripts->add( 'jquery-ui-position', false, array( 'jquery-ui-core' ), '1.13.2', 1 );
$scripts->add( 'jquery-ui-widget', false, array( 'jquery-ui-core' ), '1.13.2', 1 );
// Strings for 'jquery-ui-autocomplete' live region messages.
did_action( 'init' ) && $scripts->localize(
'jquery-ui-autocomplete',
'uiAutocompleteL10n',
array(
'noResults' => __( 'No results found.' ),
/* translators: Number of results found when using jQuery UI Autocomplete. */
'oneResult' => __( '1 result found. Use up and down arrow keys to navigate.' ),
/* translators: %d: Number of results found when using jQuery UI Autocomplete. */
'manyResults' => __( '%d results found. Use up and down arrow keys to navigate.' ),
'itemSelected' => __( 'Item selected.' ),
)
);
// Deprecated, not used in core, most functionality is included in jQuery 1.3.
$scripts->add( 'jquery-form', "/wp-includes/js/jquery/jquery.form$suffix.js", array( 'jquery' ), '4.3.0', 1 );
// jQuery plugins.
$scripts->add( 'jquery-color', '/wp-includes/js/jquery/jquery.color.min.js', array( 'jquery' ), '2.2.0', 1 );
$scripts->add( 'schedule', '/wp-includes/js/jquery/jquery.schedule.js', array( 'jquery' ), '20m', 1 );
$scripts->add( 'jquery-query', '/wp-includes/js/jquery/jquery.query.js', array( 'jquery' ), '2.2.3', 1 );
$scripts->add( 'jquery-serialize-object', '/wp-includes/js/jquery/jquery.serialize-object.js', array( 'jquery' ), '0.2-wp', 1 );
$scripts->add( 'jquery-hotkeys', "/wp-includes/js/jquery/jquery.hotkeys$suffix.js", array( 'jquery' ), '0.0.2m', 1 );
$scripts->add( 'jquery-table-hotkeys', "/wp-includes/js/jquery/jquery.table-hotkeys$suffix.js", array( 'jquery', 'jquery-hotkeys' ), false, 1 );
$scripts->add( 'jquery-touch-punch', '/wp-includes/js/jquery/jquery.ui.touch-punch.js', array( 'jquery-ui-core', 'jquery-ui-mouse' ), '0.2.2', 1 );
// Not used any more, registered for backward compatibility.
$scripts->add( 'suggest', "/wp-includes/js/jquery/suggest$suffix.js", array( 'jquery' ), '1.1-20110113', 1 );
// Masonry v2 depended on jQuery. v3 does not. The older jquery-masonry handle is a shiv.
// It sets jQuery as a dependency, as the theme may have been implicitly loading it this way.
$scripts->add( 'imagesloaded', '/wp-includes/js/imagesloaded.min.js', array(), '4.1.4', 1 );
$scripts->add( 'masonry', '/wp-includes/js/masonry.min.js', array( 'imagesloaded' ), '4.2.2', 1 );
$scripts->add( 'jquery-masonry', '/wp-includes/js/jquery/jquery.masonry.min.js', array( 'jquery', 'masonry' ), '3.1.2b', 1 );
$scripts->add( 'thickbox', '/wp-includes/js/thickbox/thickbox.js', array( 'jquery' ), '3.1-20121105', 1 );
did_action( 'init' ) && $scripts->localize(
'thickbox',
'thickboxL10n',
array(
'next' => __( 'Next >' ),
'prev' => __( '< Prev' ),
'image' => __( 'Image' ),
'of' => __( 'of' ),
'close' => __( 'Close' ),
'noiframes' => __( 'This feature requires inline frames. You have iframes disabled or your browser does not support them.' ),
'loadingAnimation' => includes_url( 'js/thickbox/loadingAnimation.gif' ),
)
);
// Not used in core, replaced by imgAreaSelect.
$scripts->add( 'jcrop', '/wp-includes/js/jcrop/jquery.Jcrop.min.js', array( 'jquery' ), '0.9.15' );
$scripts->add( 'swfobject', '/wp-includes/js/swfobject.js', array(), '2.2-20120417' );
// Error messages for Plupload.
$uploader_l10n = array(
'queue_limit_exceeded' => __( 'You have attempted to queue too many files.' ),
/* translators: %s: File name. */
'file_exceeds_size_limit' => __( '%s exceeds the maximum upload size for this site.' ),
'zero_byte_file' => __( 'This file is empty. Please try another.' ),
'invalid_filetype' => __( 'Sorry, you are not allowed to upload this file type.' ),
'not_an_image' => __( 'This file is not an image. Please try another.' ),
'image_memory_exceeded' => __( 'Memory exceeded. Please try another smaller file.' ),
'image_dimensions_exceeded' => __( 'This is larger than the maximum size. Please try another.' ),
'default_error' => __( 'An error occurred in the upload. Please try again later.' ),
'missing_upload_url' => __( 'There was a configuration error. Please contact the server administrator.' ),
'upload_limit_exceeded' => __( 'You may only upload 1 file.' ),
'http_error' => __( 'Unexpected response from the server. The file may have been uploaded successfully. Check in the Media Library or reload the page.' ),
'http_error_image' => __( 'The server cannot process the image. This can happen if the server is busy or does not have enough resources to complete the task. Uploading a smaller image may help. Suggested maximum size is 2560 pixels.' ),
'upload_failed' => __( 'Upload failed.' ),
/* translators: 1: Opening link tag, 2: Closing link tag. */
'big_upload_failed' => __( 'Please try uploading this file with the %1$sbrowser uploader%2$s.' ),
/* translators: %s: File name. */
'big_upload_queued' => __( '%s exceeds the maximum upload size for the multi-file uploader when used in your browser.' ),
'io_error' => __( 'IO error.' ),
'security_error' => __( 'Security error.' ),
'file_cancelled' => __( 'File canceled.' ),
'upload_stopped' => __( 'Upload stopped.' ),
'dismiss' => __( 'Dismiss' ),
'crunching' => __( 'Crunching…' ),
'deleted' => __( 'moved to the Trash.' ),
/* translators: %s: File name. */
'error_uploading' => __( '“%s” has failed to upload.' ),
'unsupported_image' => __( 'This image cannot be displayed in a web browser. For best results convert it to JPEG before uploading.' ),
'noneditable_image' => __( 'This image cannot be processed by the web server. Convert it to JPEG or PNG before uploading.' ),
'file_url_copied' => __( 'The file URL has been copied to your clipboard' ),
);
$scripts->add( 'moxiejs', "/wp-includes/js/plupload/moxie$suffix.js", array(), '1.3.5' );
$scripts->add( 'plupload', "/wp-includes/js/plupload/plupload$suffix.js", array( 'moxiejs' ), '2.1.9' );
// Back compat handles:
foreach ( array( 'all', 'html5', 'flash', 'silverlight', 'html4' ) as $handle ) {
$scripts->add( "plupload-$handle", false, array( 'plupload' ), '2.1.1' );
}
$scripts->add( 'plupload-handlers', "/wp-includes/js/plupload/handlers$suffix.js", array( 'clipboard', 'jquery', 'plupload', 'underscore', 'wp-a11y', 'wp-i18n' ) );
did_action( 'init' ) && $scripts->localize( 'plupload-handlers', 'pluploadL10n', $uploader_l10n );
$scripts->add( 'wp-plupload', "/wp-includes/js/plupload/wp-plupload$suffix.js", array( 'plupload', 'jquery', 'json2', 'media-models' ), false, 1 );
did_action( 'init' ) && $scripts->localize( 'wp-plupload', 'pluploadL10n', $uploader_l10n );
// Keep 'swfupload' for back-compat.
$scripts->add( 'swfupload', '/wp-includes/js/swfupload/swfupload.js', array(), '2201-20110113' );
$scripts->add( 'swfupload-all', false, array( 'swfupload' ), '2201' );
$scripts->add( 'swfupload-handlers', "/wp-includes/js/swfupload/handlers$suffix.js", array( 'swfupload-all', 'jquery' ), '2201-20110524' );
did_action( 'init' ) && $scripts->localize( 'swfupload-handlers', 'swfuploadL10n', $uploader_l10n );
$scripts->add( 'comment-reply', "/wp-includes/js/comment-reply$suffix.js", array(), false, 1 );
$scripts->add( 'json2', "/wp-includes/js/json2$suffix.js", array(), '2015-05-03' );
did_action( 'init' ) && $scripts->add_data( 'json2', 'conditional', 'lt IE 8' );
$scripts->add( 'underscore', "/wp-includes/js/underscore$dev_suffix.js", array(), '1.13.4', 1 );
$scripts->add( 'backbone', "/wp-includes/js/backbone$dev_suffix.js", array( 'underscore', 'jquery' ), '1.4.1', 1 );
$scripts->add( 'wp-util', "/wp-includes/js/wp-util$suffix.js", array( 'underscore', 'jquery' ), false, 1 );
did_action( 'init' ) && $scripts->localize(
'wp-util',
'_wpUtilSettings',
array(
'ajax' => array(
'url' => admin_url( 'admin-ajax.php', 'relative' ),
),
)
);
$scripts->add( 'wp-backbone', "/wp-includes/js/wp-backbone$suffix.js", array( 'backbone', 'wp-util' ), false, 1 );
$scripts->add( 'revisions', "/wp-admin/js/revisions$suffix.js", array( 'wp-backbone', 'jquery-ui-slider', 'hoverIntent' ), false, 1 );
$scripts->add( 'imgareaselect', "/wp-includes/js/imgareaselect/jquery.imgareaselect$suffix.js", array( 'jquery' ), false, 1 );
$scripts->add( 'mediaelement', false, array( 'jquery', 'mediaelement-core', 'mediaelement-migrate' ), '4.2.17', 1 );
$scripts->add( 'mediaelement-core', "/wp-includes/js/mediaelement/mediaelement-and-player$suffix.js", array(), '4.2.17', 1 );
$scripts->add( 'mediaelement-migrate', "/wp-includes/js/mediaelement/mediaelement-migrate$suffix.js", array(), false, 1 );
did_action( 'init' ) && $scripts->add_inline_script(
'mediaelement-core',
sprintf(
'var mejsL10n = %s;',
wp_json_encode(
array(
'language' => strtolower( strtok( determine_locale(), '_-' ) ),
'strings' => array(
'mejs.download-file' => __( 'Download File' ),
'mejs.install-flash' => __( 'You are using a browser that does not have Flash player enabled or installed. Please turn on your Flash player plugin or download the latest version from https://get.adobe.com/flashplayer/' ),
'mejs.fullscreen' => __( 'Fullscreen' ),
'mejs.play' => __( 'Play' ),
'mejs.pause' => __( 'Pause' ),
'mejs.time-slider' => __( 'Time Slider' ),
'mejs.time-help-text' => __( 'Use Left/Right Arrow keys to advance one second, Up/Down arrows to advance ten seconds.' ),
'mejs.live-broadcast' => __( 'Live Broadcast' ),
'mejs.volume-help-text' => __( 'Use Up/Down Arrow keys to increase or decrease volume.' ),
'mejs.unmute' => __( 'Unmute' ),
'mejs.mute' => __( 'Mute' ),
'mejs.volume-slider' => __( 'Volume Slider' ),
'mejs.video-player' => __( 'Video Player' ),
'mejs.audio-player' => __( 'Audio Player' ),
'mejs.captions-subtitles' => __( 'Captions/Subtitles' ),
'mejs.captions-chapters' => __( 'Chapters' ),
'mejs.none' => __( 'None' ),
'mejs.afrikaans' => __( 'Afrikaans' ),
'mejs.albanian' => __( 'Albanian' ),
'mejs.arabic' => __( 'Arabic' ),
'mejs.belarusian' => __( 'Belarusian' ),
'mejs.bulgarian' => __( 'Bulgarian' ),
'mejs.catalan' => __( 'Catalan' ),
'mejs.chinese' => __( 'Chinese' ),
'mejs.chinese-simplified' => __( 'Chinese (Simplified)' ),
'mejs.chinese-traditional' => __( 'Chinese (Traditional)' ),
'mejs.croatian' => __( 'Croatian' ),
'mejs.czech' => __( 'Czech' ),
'mejs.danish' => __( 'Danish' ),
'mejs.dutch' => __( 'Dutch' ),
'mejs.english' => __( 'English' ),
'mejs.estonian' => __( 'Estonian' ),
'mejs.filipino' => __( 'Filipino' ),
'mejs.finnish' => __( 'Finnish' ),
'mejs.french' => __( 'French' ),
'mejs.galician' => __( 'Galician' ),
'mejs.german' => __( 'German' ),
'mejs.greek' => __( 'Greek' ),
'mejs.haitian-creole' => __( 'Haitian Creole' ),
'mejs.hebrew' => __( 'Hebrew' ),
'mejs.hindi' => __( 'Hindi' ),
'mejs.hungarian' => __( 'Hungarian' ),
'mejs.icelandic' => __( 'Icelandic' ),
'mejs.indonesian' => __( 'Indonesian' ),
'mejs.irish' => __( 'Irish' ),
'mejs.italian' => __( 'Italian' ),
'mejs.japanese' => __( 'Japanese' ),
'mejs.korean' => __( 'Korean' ),
'mejs.latvian' => __( 'Latvian' ),
'mejs.lithuanian' => __( 'Lithuanian' ),
'mejs.macedonian' => __( 'Macedonian' ),
'mejs.malay' => __( 'Malay' ),
'mejs.maltese' => __( 'Maltese' ),
'mejs.norwegian' => __( 'Norwegian' ),
'mejs.persian' => __( 'Persian' ),
'mejs.polish' => __( 'Polish' ),
'mejs.portuguese' => __( 'Portuguese' ),
'mejs.romanian' => __( 'Romanian' ),
'mejs.russian' => __( 'Russian' ),
'mejs.serbian' => __( 'Serbian' ),
'mejs.slovak' => __( 'Slovak' ),
'mejs.slovenian' => __( 'Slovenian' ),
'mejs.spanish' => __( 'Spanish' ),
'mejs.swahili' => __( 'Swahili' ),
'mejs.swedish' => __( 'Swedish' ),
'mejs.tagalog' => __( 'Tagalog' ),
'mejs.thai' => __( 'Thai' ),
'mejs.turkish' => __( 'Turkish' ),
'mejs.ukrainian' => __( 'Ukrainian' ),
'mejs.vietnamese' => __( 'Vietnamese' ),
'mejs.welsh' => __( 'Welsh' ),
'mejs.yiddish' => __( 'Yiddish' ),
),
)
)
),
'before'
);
$scripts->add( 'mediaelement-vimeo', '/wp-includes/js/mediaelement/renderers/vimeo.min.js', array( 'mediaelement' ), '4.2.17', 1 );
$scripts->add( 'wp-mediaelement', "/wp-includes/js/mediaelement/wp-mediaelement$suffix.js", array( 'mediaelement' ), false, 1 );
$mejs_settings = array(
'pluginPath' => includes_url( 'js/mediaelement/', 'relative' ),
'classPrefix' => 'mejs-',
'stretching' => 'responsive',
);
did_action( 'init' ) && $scripts->localize(
'mediaelement',
'_wpmejsSettings',
/**
* Filters the MediaElement configuration settings.
*
* @since 4.4.0
*
* @param array $mejs_settings MediaElement settings array.
*/
apply_filters( 'mejs_settings', $mejs_settings )
);
$scripts->add( 'wp-codemirror', '/wp-includes/js/codemirror/codemirror.min.js', array(), '5.29.1-alpha-ee20357' );
$scripts->add( 'csslint', '/wp-includes/js/codemirror/csslint.js', array(), '1.0.5' );
$scripts->add( 'esprima', '/wp-includes/js/codemirror/esprima.js', array(), '4.0.0' );
$scripts->add( 'jshint', '/wp-includes/js/codemirror/fakejshint.js', array( 'esprima' ), '2.9.5' );
$scripts->add( 'jsonlint', '/wp-includes/js/codemirror/jsonlint.js', array(), '1.6.2' );
$scripts->add( 'htmlhint', '/wp-includes/js/codemirror/htmlhint.js', array(), '0.9.14-xwp' );
$scripts->add( 'htmlhint-kses', '/wp-includes/js/codemirror/htmlhint-kses.js', array( 'htmlhint' ) );
$scripts->add( 'code-editor', "/wp-admin/js/code-editor$suffix.js", array( 'jquery', 'wp-codemirror', 'underscore' ) );
$scripts->add( 'wp-theme-plugin-editor', "/wp-admin/js/theme-plugin-editor$suffix.js", array( 'common', 'wp-util', 'wp-sanitize', 'jquery', 'jquery-ui-core', 'wp-a11y', 'underscore' ) );
$scripts->set_translations( 'wp-theme-plugin-editor' );
$scripts->add( 'wp-playlist', "/wp-includes/js/mediaelement/wp-playlist$suffix.js", array( 'wp-util', 'backbone', 'mediaelement' ), false, 1 );
$scripts->add( 'zxcvbn-async', "/wp-includes/js/zxcvbn-async$suffix.js", array(), '1.0' );
did_action( 'init' ) && $scripts->localize(
'zxcvbn-async',
'_zxcvbnSettings',
array(
'src' => empty( $guessed_url ) ? includes_url( '/js/zxcvbn.min.js' ) : $scripts->base_url . '/wp-includes/js/zxcvbn.min.js',
)
);
$scripts->add( 'password-strength-meter', "/wp-admin/js/password-strength-meter$suffix.js", array( 'jquery', 'zxcvbn-async' ), false, 1 );
did_action( 'init' ) && $scripts->localize(
'password-strength-meter',
'pwsL10n',
array(
'unknown' => _x( 'Password strength unknown', 'password strength' ),
'short' => _x( 'Very weak', 'password strength' ),
'bad' => _x( 'Weak', 'password strength' ),
'good' => _x( 'Medium', 'password strength' ),
'strong' => _x( 'Strong', 'password strength' ),
'mismatch' => _x( 'Mismatch', 'password mismatch' ),
)
);
$scripts->set_translations( 'password-strength-meter' );
$scripts->add( 'application-passwords', "/wp-admin/js/application-passwords$suffix.js", array( 'jquery', 'wp-util', 'wp-api-request', 'wp-date', 'wp-i18n', 'wp-hooks' ), false, 1 );
$scripts->set_translations( 'application-passwords' );
$scripts->add( 'auth-app', "/wp-admin/js/auth-app$suffix.js", array( 'jquery', 'wp-api-request', 'wp-i18n', 'wp-hooks' ), false, 1 );
$scripts->set_translations( 'auth-app' );
$scripts->add( 'user-profile', "/wp-admin/js/user-profile$suffix.js", array( 'jquery', 'password-strength-meter', 'wp-util' ), false, 1 );
$scripts->set_translations( 'user-profile' );
$user_id = isset( $_GET['user_id'] ) ? (int) $_GET['user_id'] : 0;
did_action( 'init' ) && $scripts->localize(
'user-profile',
'userProfileL10n',
array(
'user_id' => $user_id,
'nonce' => wp_installing() ? '' : wp_create_nonce( 'reset-password-for-' . $user_id ),
)
);
$scripts->add( 'language-chooser', "/wp-admin/js/language-chooser$suffix.js", array( 'jquery' ), false, 1 );
$scripts->add( 'user-suggest', "/wp-admin/js/user-suggest$suffix.js", array( 'jquery-ui-autocomplete' ), false, 1 );
$scripts->add( 'admin-bar', "/wp-includes/js/admin-bar$suffix.js", array( 'hoverintent-js' ), false, 1 );
$scripts->add( 'wplink', "/wp-includes/js/wplink$suffix.js", array( 'jquery', 'wp-a11y' ), false, 1 );
did_action( 'init' ) && $scripts->localize(
'wplink',
'wpLinkL10n',
array(
'title' => __( 'Insert/edit link' ),
'update' => __( 'Update' ),
'save' => __( 'Add Link' ),
'noTitle' => __( '(no title)' ),
'noMatchesFound' => __( 'No results found.' ),
'linkSelected' => __( 'Link selected.' ),
'linkInserted' => __( 'Link inserted.' ),
/* translators: Minimum input length in characters to start searching posts in the "Insert/edit link" modal. */
'minInputLength' => (int) _x( '3', 'minimum input length for searching post links' ),
)
);
$scripts->add( 'wpdialogs', "/wp-includes/js/wpdialog$suffix.js", array( 'jquery-ui-dialog' ), false, 1 );
$scripts->add( 'word-count', "/wp-admin/js/word-count$suffix.js", array(), false, 1 );
$scripts->add( 'media-upload', "/wp-admin/js/media-upload$suffix.js", array( 'thickbox', 'shortcode' ), false, 1 );
$scripts->add( 'hoverIntent', "/wp-includes/js/hoverIntent$suffix.js", array( 'jquery' ), '1.10.2', 1 );
// JS-only version of hoverintent (no dependencies).
$scripts->add( 'hoverintent-js', '/wp-includes/js/hoverintent-js.min.js', array(), '2.2.1', 1 );
$scripts->add( 'customize-base', "/wp-includes/js/customize-base$suffix.js", array( 'jquery', 'json2', 'underscore' ), false, 1 );
$scripts->add( 'customize-loader', "/wp-includes/js/customize-loader$suffix.js", array( 'customize-base' ), false, 1 );
$scripts->add( 'customize-preview', "/wp-includes/js/customize-preview$suffix.js", array( 'wp-a11y', 'customize-base' ), false, 1 );
$scripts->add( 'customize-models', '/wp-includes/js/customize-models.js', array( 'underscore', 'backbone' ), false, 1 );
$scripts->add( 'customize-views', '/wp-includes/js/customize-views.js', array( 'jquery', 'underscore', 'imgareaselect', 'customize-models', 'media-editor', 'media-views' ), false, 1 );
$scripts->add( 'customize-controls', "/wp-admin/js/customize-controls$suffix.js", array( 'customize-base', 'wp-a11y', 'wp-util', 'jquery-ui-core' ), false, 1 );
did_action( 'init' ) && $scripts->localize(
'customize-controls',
'_wpCustomizeControlsL10n',
array(
'activate' => __( 'Activate & Publish' ),
'save' => __( 'Save & Publish' ), // @todo Remove as not required.
'publish' => __( 'Publish' ),
'published' => __( 'Published' ),
'saveDraft' => __( 'Save Draft' ),
'draftSaved' => __( 'Draft Saved' ),
'updating' => __( 'Updating' ),
'schedule' => _x( 'Schedule', 'customizer changeset action/button label' ),
'scheduled' => _x( 'Scheduled', 'customizer changeset status' ),
'invalid' => __( 'Invalid' ),
'saveBeforeShare' => __( 'Please save your changes in order to share the preview.' ),
'futureDateError' => __( 'You must supply a future date to schedule.' ),
'saveAlert' => __( 'The changes you made will be lost if you navigate away from this page.' ),
'saved' => __( 'Saved' ),
'cancel' => __( 'Cancel' ),
'close' => __( 'Close' ),
'action' => __( 'Action' ),
'discardChanges' => __( 'Discard changes' ),
'cheatin' => __( 'Something went wrong.' ),
'notAllowedHeading' => __( 'You need a higher level of permission.' ),
'notAllowed' => __( 'Sorry, you are not allowed to customize this site.' ),
'previewIframeTitle' => __( 'Site Preview' ),
'loginIframeTitle' => __( 'Session expired' ),
'collapseSidebar' => _x( 'Hide Controls', 'label for hide controls button without length constraints' ),
'expandSidebar' => _x( 'Show Controls', 'label for hide controls button without length constraints' ),
'untitledBlogName' => __( '(Untitled)' ),
'unknownRequestFail' => __( 'Looks like something’s gone wrong. Wait a couple seconds, and then try again.' ),
'themeDownloading' => __( 'Downloading your new theme…' ),
'themePreviewWait' => __( 'Setting up your live preview. This may take a bit.' ),
'revertingChanges' => __( 'Reverting unpublished changes…' ),
'trashConfirm' => __( 'Are you sure you want to discard your unpublished changes?' ),
/* translators: %s: Display name of the user who has taken over the changeset in customizer. */
'takenOverMessage' => __( '%s has taken over and is currently customizing.' ),
/* translators: %s: URL to the Customizer to load the autosaved version. */
'autosaveNotice' => __( 'There is a more recent autosave of your changes than the one you are previewing. <a href="%s">Restore the autosave</a>' ),
'videoHeaderNotice' => __( 'This theme does not support video headers on this page. Navigate to the front page or another page that supports video headers.' ),
// Used for overriding the file types allowed in Plupload.
'allowedFiles' => __( 'Allowed Files' ),
'customCssError' => array(
/* translators: %d: Error count. */
'singular' => _n( 'There is %d error which must be fixed before you can save.', 'There are %d errors which must be fixed before you can save.', 1 ),
/* translators: %d: Error count. */
'plural' => _n( 'There is %d error which must be fixed before you can save.', 'There are %d errors which must be fixed before you can save.', 2 ),
// @todo This is lacking, as some languages have a dedicated dual form. For proper handling of plurals in JS, see #20491.
),
'pageOnFrontError' => __( 'Homepage and posts page must be different.' ),
'saveBlockedError' => array(
/* translators: %s: Number of invalid settings. */
'singular' => _n( 'Unable to save due to %s invalid setting.', 'Unable to save due to %s invalid settings.', 1 ),
/* translators: %s: Number of invalid settings. */
'plural' => _n( 'Unable to save due to %s invalid setting.', 'Unable to save due to %s invalid settings.', 2 ),
// @todo This is lacking, as some languages have a dedicated dual form. For proper handling of plurals in JS, see #20491.
),
'scheduleDescription' => __( 'Schedule your customization changes to publish ("go live") at a future date.' ),
'themePreviewUnavailable' => __( 'Sorry, you cannot preview new themes when you have changes scheduled or saved as a draft. Please publish your changes, or wait until they publish to preview new themes.' ),
'themeInstallUnavailable' => sprintf(
/* translators: %s: URL to Add Themes admin screen. */
__( 'You will not be able to install new themes from here yet since your install requires SFTP credentials. For now, please <a href="%s">add themes in the admin</a>.' ),
esc_url( admin_url( 'theme-install.php' ) )
),
'publishSettings' => __( 'Publish Settings' ),
'invalidDate' => __( 'Invalid date.' ),
'invalidValue' => __( 'Invalid value.' ),
'blockThemeNotification' => sprintf(
/* translators: 1: Link to Site Editor documentation on HelpHub, 2: HTML button. */
__( 'Hurray! Your theme supports Full Site Editing with blocks. <a href="%1$s">Tell me more</a>. %2$s' ),
__( 'https://wordpress.org/support/article/site-editor/' ),
sprintf(
'<button type="button" data-action="%1$s" class="button switch-to-editor">%2$s</button>',
esc_url( admin_url( 'site-editor.php' ) ),
__( 'Use Site Editor' )
)
),
)
);
$scripts->add( 'customize-selective-refresh', "/wp-includes/js/customize-selective-refresh$suffix.js", array( 'jquery', 'wp-util', 'customize-preview' ), false, 1 );
$scripts->add( 'customize-widgets', "/wp-admin/js/customize-widgets$suffix.js", array( 'jquery', 'jquery-ui-sortable', 'jquery-ui-droppable', 'wp-backbone', 'customize-controls' ), false, 1 );
$scripts->add( 'customize-preview-widgets', "/wp-includes/js/customize-preview-widgets$suffix.js", array( 'jquery', 'wp-util', 'customize-preview', 'customize-selective-refresh' ), false, 1 );
$scripts->add( 'customize-nav-menus', "/wp-admin/js/customize-nav-menus$suffix.js", array( 'jquery', 'wp-backbone', 'customize-controls', 'accordion', 'nav-menu', 'wp-sanitize' ), false, 1 );
$scripts->add( 'customize-preview-nav-menus', "/wp-includes/js/customize-preview-nav-menus$suffix.js", array( 'jquery', 'wp-util', 'customize-preview', 'customize-selective-refresh' ), false, 1 );
$scripts->add( 'wp-custom-header', "/wp-includes/js/wp-custom-header$suffix.js", array( 'wp-a11y' ), false, 1 );
$scripts->add( 'accordion', "/wp-admin/js/accordion$suffix.js", array( 'jquery' ), false, 1 );
$scripts->add( 'shortcode', "/wp-includes/js/shortcode$suffix.js", array( 'underscore' ), false, 1 );
$scripts->add( 'media-models', "/wp-includes/js/media-models$suffix.js", array( 'wp-backbone' ), false, 1 );
did_action( 'init' ) && $scripts->localize(
'media-models',
'_wpMediaModelsL10n',
array(
'settings' => array(
'ajaxurl' => admin_url( 'admin-ajax.php', 'relative' ),
'post' => array( 'id' => 0 ),
),
)
);
$scripts->add( 'wp-embed', "/wp-includes/js/wp-embed$suffix.js", array(), false, 1 );
// To enqueue media-views or media-editor, call wp_enqueue_media().
// Both rely on numerous settings, styles, and templates to operate correctly.
$scripts->add( 'media-views', "/wp-includes/js/media-views$suffix.js", array( 'utils', 'media-models', 'wp-plupload', 'jquery-ui-sortable', 'wp-mediaelement', 'wp-api-request', 'wp-a11y', 'clipboard' ), false, 1 );
$scripts->set_translations( 'media-views' );
$scripts->add( 'media-editor', "/wp-includes/js/media-editor$suffix.js", array( 'shortcode', 'media-views' ), false, 1 );
$scripts->set_translations( 'media-editor' );
$scripts->add( 'media-audiovideo', "/wp-includes/js/media-audiovideo$suffix.js", array( 'media-editor' ), false, 1 );
$scripts->add( 'mce-view', "/wp-includes/js/mce-view$suffix.js", array( 'shortcode', 'jquery', 'media-views', 'media-audiovideo' ), false, 1 );
$scripts->add( 'wp-api', "/wp-includes/js/wp-api$suffix.js", array( 'jquery', 'backbone', 'underscore', 'wp-api-request' ), false, 1 );
if ( is_admin() ) {
$scripts->add( 'admin-tags', "/wp-admin/js/tags$suffix.js", array( 'jquery', 'wp-ajax-response' ), false, 1 );
$scripts->set_translations( 'admin-tags' );
$scripts->add( 'admin-comments', "/wp-admin/js/edit-comments$suffix.js", array( 'wp-lists', 'quicktags', 'jquery-query' ), false, 1 );
$scripts->set_translations( 'admin-comments' );
did_action( 'init' ) && $scripts->localize(
'admin-comments',
'adminCommentsSettings',
array(
'hotkeys_highlight_first' => isset( $_GET['hotkeys_highlight_first'] ),
'hotkeys_highlight_last' => isset( $_GET['hotkeys_highlight_last'] ),
)
);
$scripts->add( 'xfn', "/wp-admin/js/xfn$suffix.js", array( 'jquery' ), false, 1 );
$scripts->add( 'postbox', "/wp-admin/js/postbox$suffix.js", array( 'jquery-ui-sortable', 'wp-a11y' ), false, 1 );
$scripts->set_translations( 'postbox' );
$scripts->add( 'tags-box', "/wp-admin/js/tags-box$suffix.js", array( 'jquery', 'tags-suggest' ), false, 1 );
$scripts->set_translations( 'tags-box' );
$scripts->add( 'tags-suggest', "/wp-admin/js/tags-suggest$suffix.js", array( 'jquery-ui-autocomplete', 'wp-a11y' ), false, 1 );
$scripts->set_translations( 'tags-suggest' );
$scripts->add( 'post', "/wp-admin/js/post$suffix.js", array( 'suggest', 'wp-lists', 'postbox', 'tags-box', 'underscore', 'word-count', 'wp-a11y', 'wp-sanitize', 'clipboard' ), false, 1 );
$scripts->set_translations( 'post' );
$scripts->add( 'editor-expand', "/wp-admin/js/editor-expand$suffix.js", array( 'jquery', 'underscore' ), false, 1 );
$scripts->add( 'link', "/wp-admin/js/link$suffix.js", array( 'wp-lists', 'postbox' ), false, 1 );
$scripts->add( 'comment', "/wp-admin/js/comment$suffix.js", array( 'jquery', 'postbox' ), false, 1 );
$scripts->set_translations( 'comment' );
$scripts->add( 'admin-gallery', "/wp-admin/js/gallery$suffix.js", array( 'jquery-ui-sortable' ) );
$scripts->add( 'admin-widgets', "/wp-admin/js/widgets$suffix.js", array( 'jquery-ui-sortable', 'jquery-ui-draggable', 'jquery-ui-droppable', 'wp-a11y' ), false, 1 );
$scripts->set_translations( 'admin-widgets' );
$scripts->add( 'media-widgets', "/wp-admin/js/widgets/media-widgets$suffix.js", array( 'jquery', 'media-models', 'media-views', 'wp-api-request' ) );
$scripts->add_inline_script( 'media-widgets', 'wp.mediaWidgets.init();', 'after' );
$scripts->add( 'media-audio-widget', "/wp-admin/js/widgets/media-audio-widget$suffix.js", array( 'media-widgets', 'media-audiovideo' ) );
$scripts->add( 'media-image-widget', "/wp-admin/js/widgets/media-image-widget$suffix.js", array( 'media-widgets' ) );
$scripts->add( 'media-gallery-widget', "/wp-admin/js/widgets/media-gallery-widget$suffix.js", array( 'media-widgets' ) );
$scripts->add( 'media-video-widget', "/wp-admin/js/widgets/media-video-widget$suffix.js", array( 'media-widgets', 'media-audiovideo', 'wp-api-request' ) );
$scripts->add( 'text-widgets', "/wp-admin/js/widgets/text-widgets$suffix.js", array( 'jquery', 'backbone', 'editor', 'wp-util', 'wp-a11y' ) );
$scripts->add( 'custom-html-widgets', "/wp-admin/js/widgets/custom-html-widgets$suffix.js", array( 'jquery', 'backbone', 'wp-util', 'jquery-ui-core', 'wp-a11y' ) );
$scripts->add( 'theme', "/wp-admin/js/theme$suffix.js", array( 'wp-backbone', 'wp-a11y', 'customize-base' ), false, 1 );
$scripts->add( 'inline-edit-post', "/wp-admin/js/inline-edit-post$suffix.js", array( 'jquery', 'tags-suggest', 'wp-a11y' ), false, 1 );
$scripts->set_translations( 'inline-edit-post' );
$scripts->add( 'inline-edit-tax', "/wp-admin/js/inline-edit-tax$suffix.js", array( 'jquery', 'wp-a11y' ), false, 1 );
$scripts->set_translations( 'inline-edit-tax' );
$scripts->add( 'plugin-install', "/wp-admin/js/plugin-install$suffix.js", array( 'jquery', 'jquery-ui-core', 'thickbox' ), false, 1 );
$scripts->set_translations( 'plugin-install' );
$scripts->add( 'site-health', "/wp-admin/js/site-health$suffix.js", array( 'clipboard', 'jquery', 'wp-util', 'wp-a11y', 'wp-api-request', 'wp-url', 'wp-i18n', 'wp-hooks' ), false, 1 );
$scripts->set_translations( 'site-health' );
$scripts->add( 'privacy-tools', "/wp-admin/js/privacy-tools$suffix.js", array( 'jquery', 'wp-a11y' ), false, 1 );
$scripts->set_translations( 'privacy-tools' );
$scripts->add( 'updates', "/wp-admin/js/updates$suffix.js", array( 'common', 'jquery', 'wp-util', 'wp-a11y', 'wp-sanitize', 'wp-i18n' ), false, 1 );
$scripts->set_translations( 'updates' );
did_action( 'init' ) && $scripts->localize(
'updates',
'_wpUpdatesSettings',
array(
'ajax_nonce' => wp_installing() ? '' : wp_create_nonce( 'updates' ),
)
);
$scripts->add( 'farbtastic', '/wp-admin/js/farbtastic.js', array( 'jquery' ), '1.2' );
$scripts->add( 'iris', '/wp-admin/js/iris.min.js', array( 'jquery-ui-draggable', 'jquery-ui-slider', 'jquery-touch-punch' ), '1.1.1', 1 );
$scripts->add( 'wp-color-picker', "/wp-admin/js/color-picker$suffix.js", array( 'iris' ), false, 1 );
$scripts->set_translations( 'wp-color-picker' );
$scripts->add( 'dashboard', "/wp-admin/js/dashboard$suffix.js", array( 'jquery', 'admin-comments', 'postbox', 'wp-util', 'wp-a11y', 'wp-date' ), false, 1 );
$scripts->set_translations( 'dashboard' );
$scripts->add( 'list-revisions', "/wp-includes/js/wp-list-revisions$suffix.js" );
$scripts->add( 'media-grid', "/wp-includes/js/media-grid$suffix.js", array( 'media-editor' ), false, 1 );
$scripts->add( 'media', "/wp-admin/js/media$suffix.js", array( 'jquery', 'clipboard', 'wp-i18n', 'wp-a11y' ), false, 1 );
$scripts->set_translations( 'media' );
$scripts->add( 'image-edit', "/wp-admin/js/image-edit$suffix.js", array( 'jquery', 'jquery-ui-core', 'json2', 'imgareaselect', 'wp-a11y' ), false, 1 );
$scripts->set_translations( 'image-edit' );
$scripts->add( 'set-post-thumbnail', "/wp-admin/js/set-post-thumbnail$suffix.js", array( 'jquery' ), false, 1 );
$scripts->set_translations( 'set-post-thumbnail' );
/*
* Navigation Menus: Adding underscore as a dependency to utilize _.debounce
* see https://core.trac.wordpress.org/ticket/42321
*/
$scripts->add( 'nav-menu', "/wp-admin/js/nav-menu$suffix.js", array( 'jquery-ui-sortable', 'jquery-ui-draggable', 'jquery-ui-droppable', 'wp-lists', 'postbox', 'json2', 'underscore' ) );
$scripts->set_translations( 'nav-menu' );
$scripts->add( 'custom-header', '/wp-admin/js/custom-header.js', array( 'jquery-masonry' ), false, 1 );
$scripts->add( 'custom-background', "/wp-admin/js/custom-background$suffix.js", array( 'wp-color-picker', 'media-views' ), false, 1 );
$scripts->add( 'media-gallery', "/wp-admin/js/media-gallery$suffix.js", array( 'jquery' ), false, 1 );
$scripts->add( 'svg-painter', '/wp-admin/js/svg-painter.js', array( 'jquery' ), false, 1 );
}
}
```
[apply\_filters( 'heartbeat\_settings', array $settings )](../hooks/heartbeat_settings)
Filters the Heartbeat settings.
[apply\_filters( 'mejs\_settings', array $mejs\_settings )](../hooks/mejs_settings)
Filters the MediaElement configuration settings.
| Uses | Description |
| --- | --- |
| [determine\_locale()](determine_locale) wp-includes/l10n.php | Determines the current locale desired for the request. |
| [wp\_guess\_url()](wp_guess_url) wp-includes/functions.php | Guesses the URL for the site. |
| [get\_rest\_url()](get_rest_url) wp-includes/rest-api.php | Retrieves the URL to a REST endpoint on a site. |
| [wp\_installing()](wp_installing) wp-includes/load.php | Check or set whether WordPress is in “installation” mode. |
| [did\_action()](did_action) wp-includes/plugin.php | Retrieves the number of times an action has been fired during the current request. |
| [site\_url()](site_url) wp-includes/link-template.php | Retrieves the URL for the current site where WordPress application files (e.g. wp-blog-header.php or the wp-admin/ folder) are accessible. |
| [\_n()](_n) wp-includes/l10n.php | Translates and retrieves the singular or plural form based on the supplied number. |
| [wp\_create\_nonce()](wp_create_nonce) wp-includes/pluggable.php | Creates a cryptographic token tied to a specific action, user, user session, and window of time. |
| [wp\_scripts\_get\_suffix()](wp_scripts_get_suffix) wp-includes/script-loader.php | Returns the suffix that can be used for the scripts. |
| [sanitize\_url()](sanitize_url) wp-includes/formatting.php | Sanitizes a URL for database or redirect usage. |
| [includes\_url()](includes_url) wp-includes/link-template.php | Retrieves the URL to the includes directory. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| [admin\_url()](admin_url) wp-includes/link-template.php | Retrieves the URL to the admin area for the current site. |
| [get\_bloginfo()](get_bloginfo) wp-includes/general-template.php | Retrieves information about the current site. |
| [is\_admin()](is_admin) wp-includes/load.php | Determines whether the current request is for an administrative interface page. |
| [esc\_url()](esc_url) wp-includes/formatting.php | Checks and cleans a URL. |
| [\_x()](_x) wp-includes/l10n.php | Retrieves translated string with gettext context. |
| [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. |
| [wp\_json\_encode()](wp_json_encode) wp-includes/functions.php | Encodes a variable into JSON, with some sanity checks. |
| [get\_current\_user\_id()](get_current_user_id) wp-includes/user.php | Gets the current user’s ID. |
| Version | Description |
| --- | --- |
| [2.6.0](https://developer.wordpress.org/reference/since/2.6.0/) | Introduced. |
| programming_docs |
wordpress get_transient( string $transient ): mixed get\_transient( string $transient ): mixed
==========================================
Retrieves the value of a transient.
If the transient does not exist, does not have a value, or has expired, then the return value will be false.
`$transient` string Required Transient name. Expected to not be SQL-escaped. mixed Value of transient.
$transient parameter should be 172 characters or less in length as WordPress will prefix your name with “\_transient\_” or “\_transient\_timeout\_” in the options table (depending on whether it expires or not). Longer key names will silently fail. See [Trac #15058](https://core.trac.wordpress.org/ticket/15058).
Returned value is the value of transient. If the transient does not exist, does not have a value, or has expired, then get\_transient will return false. This should be checked using the identity operator ( === ) instead of the normal equality operator, because an integer value of zero (or other “empty” data) could be the data you’re wanting to store. Because of this “false” value, transients should not be used to hold plain boolean values. Put them into an array or convert them to integers instead.
File: `wp-includes/option.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/option.php/)
```
function get_transient( $transient ) {
/**
* Filters the value of an existing transient before it is retrieved.
*
* The dynamic portion of the hook name, `$transient`, refers to the transient name.
*
* Returning a value other than false from the filter will short-circuit retrieval
* and return that value instead.
*
* @since 2.8.0
* @since 4.4.0 The `$transient` parameter was added
*
* @param mixed $pre_transient The default value to return if the transient does not exist.
* Any value other than false will short-circuit the retrieval
* of the transient, and return that value.
* @param string $transient Transient name.
*/
$pre = apply_filters( "pre_transient_{$transient}", false, $transient );
if ( false !== $pre ) {
return $pre;
}
if ( wp_using_ext_object_cache() || wp_installing() ) {
$value = wp_cache_get( $transient, 'transient' );
} else {
$transient_option = '_transient_' . $transient;
if ( ! wp_installing() ) {
// If option is not in alloptions, it is not autoloaded and thus has a timeout.
$alloptions = wp_load_alloptions();
if ( ! isset( $alloptions[ $transient_option ] ) ) {
$transient_timeout = '_transient_timeout_' . $transient;
$timeout = get_option( $transient_timeout );
if ( false !== $timeout && $timeout < time() ) {
delete_option( $transient_option );
delete_option( $transient_timeout );
$value = false;
}
}
}
if ( ! isset( $value ) ) {
$value = get_option( $transient_option );
}
}
/**
* Filters an existing transient's value.
*
* The dynamic portion of the hook name, `$transient`, refers to the transient name.
*
* @since 2.8.0
* @since 4.4.0 The `$transient` parameter was added
*
* @param mixed $value Value of transient.
* @param string $transient Transient name.
*/
return apply_filters( "transient_{$transient}", $value, $transient );
}
```
[apply\_filters( "pre\_transient\_{$transient}", mixed $pre\_transient, string $transient )](../hooks/pre_transient_transient)
Filters the value of an existing transient before it is retrieved.
[apply\_filters( "transient\_{$transient}", mixed $value, string $transient )](../hooks/transient_transient)
Filters an existing transient’s value.
| Uses | Description |
| --- | --- |
| [wp\_installing()](wp_installing) wp-includes/load.php | Check or set whether WordPress is in “installation” mode. |
| [wp\_using\_ext\_object\_cache()](wp_using_ext_object_cache) wp-includes/load.php | Toggle `$_wp_using_ext_object_cache` on and off without directly touching global. |
| [wp\_load\_alloptions()](wp_load_alloptions) wp-includes/option.php | Loads and caches all autoloaded options, if available or all options. |
| [delete\_option()](delete_option) wp-includes/option.php | Removes option by name. Prevents removal of protected WordPress options. |
| [wp\_cache\_get()](wp_cache_get) wp-includes/cache.php | Retrieves the cache contents from the cache by key and group. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| [get\_option()](get_option) wp-includes/option.php | Retrieves an option value based on an option name. |
| Used By | Description |
| --- | --- |
| [wp\_get\_global\_styles\_svg\_filters()](wp_get_global_styles_svg_filters) wp-includes/global-styles-and-settings.php | Returns a string containing the SVGs to be referenced as filters (duotone). |
| [wp\_get\_global\_stylesheet()](wp_get_global_stylesheet) wp-includes/global-styles-and-settings.php | Returns the stylesheet resulting of merging core, theme, and user data. |
| [clean\_dirsize\_cache()](clean_dirsize_cache) wp-includes/functions.php | Cleans directory size cache used by [recurse\_dirsize()](recurse_dirsize) . |
| [wp\_dashboard\_site\_health()](wp_dashboard_site_health) wp-admin/includes/dashboard.php | Displays the Site Health Status widget. |
| [WP\_Site\_Health::enqueue\_scripts()](../classes/wp_site_health/enqueue_scripts) wp-admin/includes/class-wp-site-health.php | Enqueues the site health scripts. |
| [wp\_start\_scraping\_edited\_file\_errors()](wp_start_scraping_edited_file_errors) wp-includes/load.php | Start scraping edited file errors. |
| [WP\_oEmbed\_Controller::get\_proxy\_item()](../classes/wp_oembed_controller/get_proxy_item) wp-includes/class-wp-oembed-controller.php | Callback for the proxy API endpoint. |
| [install\_themes\_feature\_list()](install_themes_feature_list) wp-admin/includes/theme-install.php | Retrieves the list of WordPress theme features (aka theme tags). |
| [wp\_dashboard\_cached\_rss\_widget()](wp_dashboard_cached_rss_widget) wp-admin/includes/dashboard.php | Checks to see if all of the feed url in $check\_urls are cached. |
| [wp\_dashboard\_plugins\_output()](wp_dashboard_plugins_output) wp-admin/includes/deprecated.php | Display plugins text for the WordPress news widget. |
| [get\_settings\_errors()](get_settings_errors) wp-admin/includes/template.php | Fetches settings errors registered by [add\_settings\_error()](add_settings_error) . |
| [spawn\_cron()](spawn_cron) wp-includes/cron.php | Sends a request to run cron through HTTP request that doesn’t halt page loading. |
| [wp\_rand()](wp_rand) wp-includes/pluggable.php | Generates a random non-negative number. |
| [WP\_Feed\_Cache\_Transient::load()](../classes/wp_feed_cache_transient/load) wp-includes/class-wp-feed-cache-transient.php | Gets the transient. |
| [WP\_Feed\_Cache\_Transient::mtime()](../classes/wp_feed_cache_transient/mtime) wp-includes/class-wp-feed-cache-transient.php | Gets mod transient. |
| [wp\_maybe\_generate\_attachment\_metadata()](wp_maybe_generate_attachment_metadata) wp-includes/media.php | Maybe attempts to generate attachment metadata, if missing. |
| [recurse\_dirsize()](recurse_dirsize) wp-includes/functions.php | Gets the size of a directory recursively. |
| [is\_multi\_author()](is_multi_author) wp-includes/author-template.php | Determines whether this site has more than one author. |
| [RSSCache::get()](../classes/rsscache/get) wp-includes/rss.php | |
| [RSSCache::check\_cache()](../classes/rsscache/check_cache) wp-includes/rss.php | |
| Version | Description |
| --- | --- |
| [2.8.0](https://developer.wordpress.org/reference/since/2.8.0/) | Introduced. |
wordpress wp_new_comment_notify_postauthor( int $comment_ID ): bool wp\_new\_comment\_notify\_postauthor( int $comment\_ID ): bool
==============================================================
Sends a notification of a new comment to the post author.
`$comment_ID` int Required Comment ID. bool True on success, false on failure.
File: `wp-includes/comment.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/comment.php/)
```
function wp_new_comment_notify_postauthor( $comment_ID ) {
$comment = get_comment( $comment_ID );
$maybe_notify = get_option( 'comments_notify' );
/**
* Filters whether to send the post author new comment notification emails,
* overriding the site setting.
*
* @since 4.4.0
*
* @param bool $maybe_notify Whether to notify the post author about the new comment.
* @param int $comment_ID The ID of the comment for the notification.
*/
$maybe_notify = apply_filters( 'notify_post_author', $maybe_notify, $comment_ID );
/*
* wp_notify_postauthor() checks if notifying the author of their own comment.
* By default, it won't, but filters can override this.
*/
if ( ! $maybe_notify ) {
return false;
}
// Only send notifications for approved comments.
if ( ! isset( $comment->comment_approved ) || '1' != $comment->comment_approved ) {
return false;
}
return wp_notify_postauthor( $comment_ID );
}
```
[apply\_filters( 'notify\_post\_author', bool $maybe\_notify, int $comment\_ID )](../hooks/notify_post_author)
Filters whether to send the post author new comment notification emails, overriding the site setting.
| Uses | Description |
| --- | --- |
| [wp\_notify\_postauthor()](wp_notify_postauthor) wp-includes/pluggable.php | Notifies an author (and/or others) of a comment/trackback/pingback on a post. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| [get\_option()](get_option) wp-includes/option.php | Retrieves an option value based on an option name. |
| [get\_comment()](get_comment) wp-includes/comment.php | Retrieves comment data given a comment ID or comment object. |
| Version | Description |
| --- | --- |
| [4.4.0](https://developer.wordpress.org/reference/since/4.4.0/) | Introduced. |
wordpress get_date_from_gmt( string $string, string $format = 'Y-m-d H:i:s' ): string get\_date\_from\_gmt( string $string, string $format = 'Y-m-d H:i:s' ): string
==============================================================================
Given a date in UTC or GMT timezone, returns that date in the timezone of the site.
Requires a date in the Y-m-d H:i:s format.
Default return format of ‘Y-m-d H:i:s’ can be overridden using the `$format` parameter.
`$string` string Required The date to be converted, in UTC or GMT timezone. `$format` string Optional The format string for the returned date. Default: `'Y-m-d H:i:s'`
string Formatted version of the date, in the site's timezone.
File: `wp-includes/formatting.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/formatting.php/)
```
function get_date_from_gmt( $string, $format = 'Y-m-d H:i:s' ) {
$datetime = date_create( $string, new DateTimeZone( 'UTC' ) );
if ( false === $datetime ) {
return gmdate( $format, 0 );
}
return $datetime->setTimezone( wp_timezone() )->format( $format );
}
```
| Uses | Description |
| --- | --- |
| [wp\_timezone()](wp_timezone) wp-includes/functions.php | Retrieves the timezone of the site as a `DateTimeZone` object. |
| Used By | Description |
| --- | --- |
| [wp\_resolve\_post\_date()](wp_resolve_post_date) wp-includes/post.php | Uses wp\_checkdate to return a valid Gregorian-calendar value for post\_date. |
| [WP\_Customize\_Manager::save\_changeset\_post()](../classes/wp_customize_manager/save_changeset_post) wp-includes/class-wp-customize-manager.php | Saves the post for the loaded changeset. |
| [rest\_get\_date\_with\_gmt()](rest_get_date_with_gmt) wp-includes/rest-api.php | Parses a date into both its local and UTC equivalent, in MySQL datetime format. |
| [wp\_xmlrpc\_server::wp\_editComment()](../classes/wp_xmlrpc_server/wp_editcomment) wp-includes/class-wp-xmlrpc-server.php | Edit comment. |
| Version | Description |
| --- | --- |
| [1.2.0](https://developer.wordpress.org/reference/since/1.2.0/) | Introduced. |
wordpress _wp_menu_item_classes_by_context( array $menu_items ) \_wp\_menu\_item\_classes\_by\_context( array $menu\_items )
============================================================
This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.
Adds the class property classes for the current context, if applicable.
`$menu_items` array Required The current menu item objects to which to add the class property information. File: `wp-includes/nav-menu-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/nav-menu-template.php/)
```
function _wp_menu_item_classes_by_context( &$menu_items ) {
global $wp_query, $wp_rewrite;
$queried_object = $wp_query->get_queried_object();
$queried_object_id = (int) $wp_query->queried_object_id;
$active_object = '';
$active_ancestor_item_ids = array();
$active_parent_item_ids = array();
$active_parent_object_ids = array();
$possible_taxonomy_ancestors = array();
$possible_object_parents = array();
$home_page_id = (int) get_option( 'page_for_posts' );
if ( $wp_query->is_singular && ! empty( $queried_object->post_type ) && ! is_post_type_hierarchical( $queried_object->post_type ) ) {
foreach ( (array) get_object_taxonomies( $queried_object->post_type ) as $taxonomy ) {
if ( is_taxonomy_hierarchical( $taxonomy ) ) {
$term_hierarchy = _get_term_hierarchy( $taxonomy );
$terms = wp_get_object_terms( $queried_object_id, $taxonomy, array( 'fields' => 'ids' ) );
if ( is_array( $terms ) ) {
$possible_object_parents = array_merge( $possible_object_parents, $terms );
$term_to_ancestor = array();
foreach ( (array) $term_hierarchy as $anc => $descs ) {
foreach ( (array) $descs as $desc ) {
$term_to_ancestor[ $desc ] = $anc;
}
}
foreach ( $terms as $desc ) {
do {
$possible_taxonomy_ancestors[ $taxonomy ][] = $desc;
if ( isset( $term_to_ancestor[ $desc ] ) ) {
$_desc = $term_to_ancestor[ $desc ];
unset( $term_to_ancestor[ $desc ] );
$desc = $_desc;
} else {
$desc = 0;
}
} while ( ! empty( $desc ) );
}
}
}
}
} elseif ( ! empty( $queried_object->taxonomy ) && is_taxonomy_hierarchical( $queried_object->taxonomy ) ) {
$term_hierarchy = _get_term_hierarchy( $queried_object->taxonomy );
$term_to_ancestor = array();
foreach ( (array) $term_hierarchy as $anc => $descs ) {
foreach ( (array) $descs as $desc ) {
$term_to_ancestor[ $desc ] = $anc;
}
}
$desc = $queried_object->term_id;
do {
$possible_taxonomy_ancestors[ $queried_object->taxonomy ][] = $desc;
if ( isset( $term_to_ancestor[ $desc ] ) ) {
$_desc = $term_to_ancestor[ $desc ];
unset( $term_to_ancestor[ $desc ] );
$desc = $_desc;
} else {
$desc = 0;
}
} while ( ! empty( $desc ) );
}
$possible_object_parents = array_filter( $possible_object_parents );
$front_page_url = home_url();
$front_page_id = (int) get_option( 'page_on_front' );
$privacy_policy_page_id = (int) get_option( 'wp_page_for_privacy_policy' );
foreach ( (array) $menu_items as $key => $menu_item ) {
$menu_items[ $key ]->current = false;
$classes = (array) $menu_item->classes;
$classes[] = 'menu-item';
$classes[] = 'menu-item-type-' . $menu_item->type;
$classes[] = 'menu-item-object-' . $menu_item->object;
// This menu item is set as the 'Front Page'.
if ( 'post_type' === $menu_item->type && $front_page_id === (int) $menu_item->object_id ) {
$classes[] = 'menu-item-home';
}
// This menu item is set as the 'Privacy Policy Page'.
if ( 'post_type' === $menu_item->type && $privacy_policy_page_id === (int) $menu_item->object_id ) {
$classes[] = 'menu-item-privacy-policy';
}
// If the menu item corresponds to a taxonomy term for the currently queried non-hierarchical post object.
if ( $wp_query->is_singular && 'taxonomy' === $menu_item->type
&& in_array( (int) $menu_item->object_id, $possible_object_parents, true )
) {
$active_parent_object_ids[] = (int) $menu_item->object_id;
$active_parent_item_ids[] = (int) $menu_item->db_id;
$active_object = $queried_object->post_type;
// If the menu item corresponds to the currently queried post or taxonomy object.
} elseif (
$menu_item->object_id == $queried_object_id
&& (
( ! empty( $home_page_id ) && 'post_type' === $menu_item->type
&& $wp_query->is_home && $home_page_id == $menu_item->object_id )
|| ( 'post_type' === $menu_item->type && $wp_query->is_singular )
|| ( 'taxonomy' === $menu_item->type
&& ( $wp_query->is_category || $wp_query->is_tag || $wp_query->is_tax )
&& $queried_object->taxonomy == $menu_item->object )
)
) {
$classes[] = 'current-menu-item';
$menu_items[ $key ]->current = true;
$_anc_id = (int) $menu_item->db_id;
while (
( $_anc_id = (int) get_post_meta( $_anc_id, '_menu_item_menu_item_parent', true ) )
&& ! in_array( $_anc_id, $active_ancestor_item_ids, true )
) {
$active_ancestor_item_ids[] = $_anc_id;
}
if ( 'post_type' === $menu_item->type && 'page' === $menu_item->object ) {
// Back compat classes for pages to match wp_page_menu().
$classes[] = 'page_item';
$classes[] = 'page-item-' . $menu_item->object_id;
$classes[] = 'current_page_item';
}
$active_parent_item_ids[] = (int) $menu_item->menu_item_parent;
$active_parent_object_ids[] = (int) $menu_item->post_parent;
$active_object = $menu_item->object;
// If the menu item corresponds to the currently queried post type archive.
} elseif (
'post_type_archive' === $menu_item->type
&& is_post_type_archive( array( $menu_item->object ) )
) {
$classes[] = 'current-menu-item';
$menu_items[ $key ]->current = true;
$_anc_id = (int) $menu_item->db_id;
while (
( $_anc_id = (int) get_post_meta( $_anc_id, '_menu_item_menu_item_parent', true ) )
&& ! in_array( $_anc_id, $active_ancestor_item_ids, true )
) {
$active_ancestor_item_ids[] = $_anc_id;
}
$active_parent_item_ids[] = (int) $menu_item->menu_item_parent;
// If the menu item corresponds to the currently requested URL.
} elseif ( 'custom' === $menu_item->object && isset( $_SERVER['HTTP_HOST'] ) ) {
$_root_relative_current = untrailingslashit( $_SERVER['REQUEST_URI'] );
// If it's the customize page then it will strip the query var off the URL before entering the comparison block.
if ( is_customize_preview() ) {
$_root_relative_current = strtok( untrailingslashit( $_SERVER['REQUEST_URI'] ), '?' );
}
$current_url = set_url_scheme( 'http://' . $_SERVER['HTTP_HOST'] . $_root_relative_current );
$raw_item_url = strpos( $menu_item->url, '#' ) ? substr( $menu_item->url, 0, strpos( $menu_item->url, '#' ) ) : $menu_item->url;
$item_url = set_url_scheme( untrailingslashit( $raw_item_url ) );
$_indexless_current = untrailingslashit( preg_replace( '/' . preg_quote( $wp_rewrite->index, '/' ) . '$/', '', $current_url ) );
$matches = array(
$current_url,
urldecode( $current_url ),
$_indexless_current,
urldecode( $_indexless_current ),
$_root_relative_current,
urldecode( $_root_relative_current ),
);
if ( $raw_item_url && in_array( $item_url, $matches, true ) ) {
$classes[] = 'current-menu-item';
$menu_items[ $key ]->current = true;
$_anc_id = (int) $menu_item->db_id;
while (
( $_anc_id = (int) get_post_meta( $_anc_id, '_menu_item_menu_item_parent', true ) )
&& ! in_array( $_anc_id, $active_ancestor_item_ids, true )
) {
$active_ancestor_item_ids[] = $_anc_id;
}
if ( in_array( home_url(), array( untrailingslashit( $current_url ), untrailingslashit( $_indexless_current ) ), true ) ) {
// Back compat for home link to match wp_page_menu().
$classes[] = 'current_page_item';
}
$active_parent_item_ids[] = (int) $menu_item->menu_item_parent;
$active_parent_object_ids[] = (int) $menu_item->post_parent;
$active_object = $menu_item->object;
// Give front page item the 'current-menu-item' class when extra query arguments are involved.
} elseif ( $item_url == $front_page_url && is_front_page() ) {
$classes[] = 'current-menu-item';
}
if ( untrailingslashit( $item_url ) == home_url() ) {
$classes[] = 'menu-item-home';
}
}
// Back-compat with wp_page_menu(): add "current_page_parent" to static home page link for any non-page query.
if ( ! empty( $home_page_id ) && 'post_type' === $menu_item->type
&& empty( $wp_query->is_page ) && $home_page_id == $menu_item->object_id
) {
$classes[] = 'current_page_parent';
}
$menu_items[ $key ]->classes = array_unique( $classes );
}
$active_ancestor_item_ids = array_filter( array_unique( $active_ancestor_item_ids ) );
$active_parent_item_ids = array_filter( array_unique( $active_parent_item_ids ) );
$active_parent_object_ids = array_filter( array_unique( $active_parent_object_ids ) );
// Set parent's class.
foreach ( (array) $menu_items as $key => $parent_item ) {
$classes = (array) $parent_item->classes;
$menu_items[ $key ]->current_item_ancestor = false;
$menu_items[ $key ]->current_item_parent = false;
if (
isset( $parent_item->type )
&& (
// Ancestral post object.
(
'post_type' === $parent_item->type
&& ! empty( $queried_object->post_type )
&& is_post_type_hierarchical( $queried_object->post_type )
&& in_array( (int) $parent_item->object_id, $queried_object->ancestors, true )
&& $parent_item->object != $queried_object->ID
) ||
// Ancestral term.
(
'taxonomy' === $parent_item->type
&& isset( $possible_taxonomy_ancestors[ $parent_item->object ] )
&& in_array( (int) $parent_item->object_id, $possible_taxonomy_ancestors[ $parent_item->object ], true )
&& (
! isset( $queried_object->term_id ) ||
$parent_item->object_id != $queried_object->term_id
)
)
)
) {
if ( ! empty( $queried_object->taxonomy ) ) {
$classes[] = 'current-' . $queried_object->taxonomy . '-ancestor';
} else {
$classes[] = 'current-' . $queried_object->post_type . '-ancestor';
}
}
if ( in_array( (int) $parent_item->db_id, $active_ancestor_item_ids, true ) ) {
$classes[] = 'current-menu-ancestor';
$menu_items[ $key ]->current_item_ancestor = true;
}
if ( in_array( (int) $parent_item->db_id, $active_parent_item_ids, true ) ) {
$classes[] = 'current-menu-parent';
$menu_items[ $key ]->current_item_parent = true;
}
if ( in_array( (int) $parent_item->object_id, $active_parent_object_ids, true ) ) {
$classes[] = 'current-' . $active_object . '-parent';
}
if ( 'post_type' === $parent_item->type && 'page' === $parent_item->object ) {
// Back compat classes for pages to match wp_page_menu().
if ( in_array( 'current-menu-parent', $classes, true ) ) {
$classes[] = 'current_page_parent';
}
if ( in_array( 'current-menu-ancestor', $classes, true ) ) {
$classes[] = 'current_page_ancestor';
}
}
$menu_items[ $key ]->classes = array_unique( $classes );
}
}
```
| Uses | Description |
| --- | --- |
| [is\_customize\_preview()](is_customize_preview) wp-includes/theme.php | Whether the site is being previewed in the Customizer. |
| [untrailingslashit()](untrailingslashit) wp-includes/formatting.php | Removes trailing forward slashes and backslashes if they exist. |
| [WP\_Query::get\_queried\_object()](../classes/wp_query/get_queried_object) wp-includes/class-wp-query.php | Retrieves the currently queried object. |
| [is\_front\_page()](is_front_page) wp-includes/query.php | Determines whether the query is for the front page of the site. |
| [is\_post\_type\_archive()](is_post_type_archive) wp-includes/query.php | Determines whether the query is for an existing post type archive page. |
| [\_get\_term\_hierarchy()](_get_term_hierarchy) wp-includes/taxonomy.php | Retrieves children of taxonomy as term IDs. |
| [wp\_get\_object\_terms()](wp_get_object_terms) wp-includes/taxonomy.php | Retrieves the terms associated with the given object(s), in the supplied taxonomies. |
| [get\_object\_taxonomies()](get_object_taxonomies) wp-includes/taxonomy.php | Returns the names or objects of the taxonomies which are registered for the requested object or object type, such as a post object or post type name. |
| [is\_taxonomy\_hierarchical()](is_taxonomy_hierarchical) wp-includes/taxonomy.php | Determines whether the taxonomy object is hierarchical. |
| [set\_url\_scheme()](set_url_scheme) wp-includes/link-template.php | Sets the scheme for a URL. |
| [is\_post\_type\_hierarchical()](is_post_type_hierarchical) wp-includes/post.php | Determines whether the post type is hierarchical. |
| [home\_url()](home_url) wp-includes/link-template.php | Retrieves the URL for the current site where the front end is accessible. |
| [get\_option()](get_option) wp-includes/option.php | Retrieves an option value based on an option name. |
| [get\_post\_meta()](get_post_meta) wp-includes/post.php | Retrieves a post meta field for the given post ID. |
| Used By | Description |
| --- | --- |
| [wp\_nav\_menu()](wp_nav_menu) wp-includes/nav-menu-template.php | Displays a navigation menu. |
| Version | Description |
| --- | --- |
| [3.0.0](https://developer.wordpress.org/reference/since/3.0.0/) | Introduced. |
| programming_docs |
wordpress wp_kses_post( string $data ): string wp\_kses\_post( string $data ): string
======================================
Sanitizes 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.
This function expects unslashed data.
`$data` string Required Post content to filter. string Filtered post content with allowed HTML tags and attributes intact.
File: `wp-includes/kses.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/kses.php/)
```
function wp_kses_post( $data ) {
return wp_kses( $data, 'post' );
}
```
| Uses | Description |
| --- | --- |
| [wp\_kses()](wp_kses) wp-includes/kses.php | Filters text content and strips out disallowed HTML. |
| Used By | Description |
| --- | --- |
| [WP\_Site\_Health::get\_test\_page\_cache()](../classes/wp_site_health/get_test_page_cache) wp-admin/includes/class-wp-site-health.php | Tests if a full page cache is available. |
| [WP\_Widget\_Block::update()](../classes/wp_widget_block/update) wp-includes/widgets/class-wp-widget-block.php | Handles updating settings for the current Block widget instance. |
| [WP\_REST\_Pattern\_Directory\_Controller::prepare\_item\_for\_response()](../classes/wp_rest_pattern_directory_controller/prepare_item_for_response) wp-includes/rest-api/endpoints/class-wp-rest-pattern-directory-controller.php | Prepare a raw block pattern before it gets output in a REST API response. |
| [WP\_Widget\_Custom\_HTML::update()](../classes/wp_widget_custom_html/update) wp-includes/widgets/class-wp-widget-custom-html.php | Handles updating settings for the current Custom HTML widget instance. |
| [do\_settings\_sections()](do_settings_sections) wp-admin/includes/template.php | Prints out all settings sections added to a particular settings page. |
| [wp\_add\_id3\_tag\_data()](wp_add_id3_tag_data) wp-admin/includes/media.php | Parses ID3v2, ID3v1, and getID3 comments to extract usable data. |
| [WP\_Widget\_Text::update()](../classes/wp_widget_text/update) wp-includes/widgets/class-wp-widget-text.php | Handles updating settings for the current Text widget instance. |
| [WP\_SimplePie\_Sanitize\_KSES::sanitize()](../classes/wp_simplepie_sanitize_kses/sanitize) wp-includes/class-wp-simplepie-sanitize-kses.php | WordPress SimplePie sanitization using KSES. |
| [WP\_Customize\_Widgets::sanitize\_widget\_instance()](../classes/wp_customize_widgets/sanitize_widget_instance) wp-includes/class-wp-customize-widgets.php | Sanitizes a widget instance. |
| Version | Description |
| --- | --- |
| [2.9.0](https://developer.wordpress.org/reference/since/2.9.0/) | Introduced. |
wordpress wpmu_delete_blog( int $blog_id, bool $drop = false ) wpmu\_delete\_blog( int $blog\_id, bool $drop = false )
=======================================================
Delete a site.
`$blog_id` int Required Site ID. `$drop` bool Optional True if site's database tables should be dropped. Default: `false`
File: `wp-admin/includes/ms.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/ms.php/)
```
function wpmu_delete_blog( $blog_id, $drop = false ) {
global $wpdb;
$blog_id = (int) $blog_id;
$switch = false;
if ( get_current_blog_id() !== $blog_id ) {
$switch = true;
switch_to_blog( $blog_id );
}
$blog = get_site( $blog_id );
$current_network = get_network();
// If a full blog object is not available, do not destroy anything.
if ( $drop && ! $blog ) {
$drop = false;
}
// Don't destroy the initial, main, or root blog.
if ( $drop
&& ( 1 === $blog_id || is_main_site( $blog_id )
|| ( $blog->path === $current_network->path && $blog->domain === $current_network->domain ) )
) {
$drop = false;
}
$upload_path = trim( get_option( 'upload_path' ) );
// If ms_files_rewriting is enabled and upload_path is empty, wp_upload_dir is not reliable.
if ( $drop && get_site_option( 'ms_files_rewriting' ) && empty( $upload_path ) ) {
$drop = false;
}
if ( $drop ) {
wp_delete_site( $blog_id );
} else {
/** This action is documented in wp-includes/ms-blogs.php */
do_action_deprecated( 'delete_blog', array( $blog_id, false ), '5.1.0' );
$users = get_users(
array(
'blog_id' => $blog_id,
'fields' => 'ids',
)
);
// Remove users from this blog.
if ( ! empty( $users ) ) {
foreach ( $users as $user_id ) {
remove_user_from_blog( $user_id, $blog_id );
}
}
update_blog_status( $blog_id, 'deleted', 1 );
/** This action is documented in wp-includes/ms-blogs.php */
do_action_deprecated( 'deleted_blog', array( $blog_id, false ), '5.1.0' );
}
if ( $switch ) {
restore_current_blog();
}
}
```
[do\_action\_deprecated( 'deleted\_blog', int $site\_id, bool $drop )](../hooks/deleted_blog)
Fires after the site is deleted from the network.
[do\_action\_deprecated( 'delete\_blog', int $site\_id, bool $drop )](../hooks/delete_blog)
Fires before a site is deleted.
| Uses | Description |
| --- | --- |
| [wp\_delete\_site()](wp_delete_site) wp-includes/ms-site.php | Deletes a site from the database. |
| [get\_network()](get_network) wp-includes/ms-network.php | Retrieves network data given a network ID or network object. |
| [get\_site()](get_site) wp-includes/ms-site.php | Retrieves site data given a site ID or site object. |
| [do\_action\_deprecated()](do_action_deprecated) wp-includes/plugin.php | Fires functions attached to a deprecated action hook. |
| [is\_main\_site()](is_main_site) wp-includes/functions.php | Determines whether a site is the main site of the current network. |
| [get\_users()](get_users) wp-includes/user.php | Retrieves list of users matching criteria. |
| [remove\_user\_from\_blog()](remove_user_from_blog) wp-includes/ms-functions.php | Removes a user from a blog. |
| [switch\_to\_blog()](switch_to_blog) wp-includes/ms-blogs.php | Switch the current blog. |
| [update\_blog\_status()](update_blog_status) wp-includes/ms-blogs.php | Update a blog details field. |
| [restore\_current\_blog()](restore_current_blog) wp-includes/ms-blogs.php | Restore the current blog, after calling [switch\_to\_blog()](switch_to_blog) . |
| [get\_current\_blog\_id()](get_current_blog_id) wp-includes/load.php | Retrieve the current site ID. |
| [get\_site\_option()](get_site_option) wp-includes/option.php | Retrieve an option value for the current network based on name of option. |
| [get\_option()](get_option) wp-includes/option.php | Retrieves an option value based on an option name. |
| Version | Description |
| --- | --- |
| [5.1.0](https://developer.wordpress.org/reference/since/5.1.0/) | Use [wp\_delete\_site()](wp_delete_site) internally to delete the site row from the database. |
| [3.0.0](https://developer.wordpress.org/reference/since/3.0.0/) | Introduced. |
wordpress is_single( int|string|int[]|string[] $post = '' ): bool is\_single( int|string|int[]|string[] $post = '' ): bool
========================================================
Determines whether the query is for an existing single post.
Works for any post type, except attachments and pages
If the $post parameter is specified, this function will additionally check if the query is for one of the Posts specified.
For more information on this and similar theme functions, check out the [Conditional Tags](https://developer.wordpress.org/themes/basics/conditional-tags/) article in the Theme Developer Handbook.
* [is\_page()](is_page)
* [is\_singular()](is_singular)
`$post` int|string|int[]|string[] Optional Post ID, title, slug, or array of such to check against. Default: `''`
bool Whether the query is for an existing single post.
* See Also: [is\_singular()](is_singular)
* Although [is\_single()](is_single) will usually return true for attachments, this behavior should not be relied upon. It is possible for $is\_page and $is\_attachment to be true at the same time, and in that case $is\_single will be false. For this reason, you should use [is\_attachment()](is_attachment) || [is\_single()](is_single) if you want to include attachments, or use [is\_singular()](is_singular) if you want to include pages too.
File: `wp-includes/query.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/query.php/)
```
function is_single( $post = '' ) {
global $wp_query;
if ( ! isset( $wp_query ) ) {
_doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the query is run. Before then, they always return false.' ), '3.1.0' );
return false;
}
return $wp_query->is_single( $post );
}
```
| Uses | Description |
| --- | --- |
| [WP\_Query::is\_single()](../classes/wp_query/is_single) wp-includes/class-wp-query.php | Is the query for an existing single post? |
| [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. |
| [\_doing\_it\_wrong()](_doing_it_wrong) wp-includes/functions.php | Marks something as being incorrectly called. |
| Used By | Description |
| --- | --- |
| [wp\_title()](wp_title) wp-includes/general-template.php | Displays or retrieves page title for all areas of blog. |
| [get\_next\_posts\_page\_link()](get_next_posts_page_link) wp-includes/link-template.php | Retrieves the next posts page link. |
| [get\_next\_posts\_link()](get_next_posts_link) wp-includes/link-template.php | Retrieves the next posts page link. |
| [get\_previous\_posts\_page\_link()](get_previous_posts_page_link) wp-includes/link-template.php | Retrieves the previous posts page link. |
| [get\_previous\_posts\_link()](get_previous_posts_link) wp-includes/link-template.php | Retrieves the previous posts page link. |
| [adjacent\_posts\_rel\_link\_wp\_head()](adjacent_posts_rel_link_wp_head) wp-includes/link-template.php | Displays relational links for the posts adjacent to the current post for single post pages. |
| [get\_boundary\_post()](get_boundary_post) wp-includes/link-template.php | Retrieves the boundary post. |
| [get\_body\_class()](get_body_class) wp-includes/post-template.php | Retrieves an array of the class names for the body element. |
| [redirect\_canonical()](redirect_canonical) wp-includes/canonical.php | Redirects incoming links to the proper URL based on the site url. |
| [comments\_template()](comments_template) wp-includes/comment-template.php | Loads the comment template specified in $file. |
| Version | Description |
| --- | --- |
| [1.5.0](https://developer.wordpress.org/reference/since/1.5.0/) | Introduced. |
wordpress add_dashboard_page( string $page_title, string $menu_title, string $capability, string $menu_slug, callable $callback = '', int $position = null ): string|false add\_dashboard\_page( string $page\_title, string $menu\_title, string $capability, string $menu\_slug, callable $callback = '', int $position = null ): string|false
=====================================================================================================================================================================
Adds a submenu page to the Dashboard main menu.
This function takes a capability which will be used to determine whether or not a page is included in the menu.
The function which is hooked in to handle the output of the page must check that the user has the required capability as well.
`$page_title` string Required The text to be displayed in the title tags of the page when the menu is selected. `$menu_title` string Required The text to be used for the menu. `$capability` string Required The capability required for this menu to be displayed to the user. `$menu_slug` string Required The slug name to refer to this menu by (should be unique for this menu). `$callback` callable Optional The function to be called to output the content for this page. Default: `''`
`$position` int Optional The position in the menu order this item should appear. Default: `null`
string|false The resulting page's hook\_suffix, or false if the user does not have the capability required.
This function is a simple wrapper for a call to [add\_submenu\_page()](add_submenu_page) , passing the received arguments and specifying 'index.php' as the $parent\_slug argument. This means the new page will be added as a sub-menu to the *Dashboard* menu.
The $capability parameter is used to determine whether or not the page is included in the menu based on the [Roles and Capabilities](https://wordpress.org/support/article/roles-and-capabilities/ "Roles and Capabilities")) of the current user.
The function handling the output of the options page should also verify the user’s capabilities.
If you’re running into the »You do not have sufficient permissions to access this page.« message on a `wp_die()` screen, then you’ve hooked too early. The hook you should use is `admin_menu`.
File: `wp-admin/includes/plugin.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/plugin.php/)
```
function add_dashboard_page( $page_title, $menu_title, $capability, $menu_slug, $callback = '', $position = null ) {
return add_submenu_page( 'index.php', $page_title, $menu_title, $capability, $menu_slug, $callback, $position );
}
```
| Uses | Description |
| --- | --- |
| [add\_submenu\_page()](add_submenu_page) wp-admin/includes/plugin.php | Adds a submenu page. |
| Version | Description |
| --- | --- |
| [5.3.0](https://developer.wordpress.org/reference/since/5.3.0/) | Added the `$position` parameter. |
| [2.7.0](https://developer.wordpress.org/reference/since/2.7.0/) | Introduced. |
wordpress wp_remove_targeted_link_rel_filters() wp\_remove\_targeted\_link\_rel\_filters()
==========================================
Removes all filters modifying the rel attribute of targeted links.
File: `wp-includes/formatting.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/formatting.php/)
```
function wp_remove_targeted_link_rel_filters() {
$filters = array(
'title_save_pre',
'content_save_pre',
'excerpt_save_pre',
'content_filtered_save_pre',
'pre_comment_content',
'pre_term_description',
'pre_link_description',
'pre_link_notes',
'pre_user_description',
);
foreach ( $filters as $filter ) {
remove_filter( $filter, 'wp_targeted_link_rel' );
}
}
```
| Uses | Description |
| --- | --- |
| [remove\_filter()](remove_filter) wp-includes/plugin.php | Removes a callback function from a filter hook. |
| Version | Description |
| --- | --- |
| [5.1.0](https://developer.wordpress.org/reference/since/5.1.0/) | Introduced. |
wordpress get_edit_term_link( int|WP_Term|object $term, string $taxonomy = '', string $object_type = '' ): string|null get\_edit\_term\_link( int|WP\_Term|object $term, string $taxonomy = '', string $object\_type = '' ): string|null
=================================================================================================================
Retrieves the URL for editing a given term.
`$term` int|[WP\_Term](../classes/wp_term)|object Required The ID or term object whose edit link will be retrieved. `$taxonomy` string Optional Taxonomy. Defaults to the taxonomy of the term identified by `$term`. Default: `''`
`$object_type` string Optional The object type. Used to highlight the proper post type menu on the linked page. Defaults to the first object\_type associated with the taxonomy. Default: `''`
string|null The edit term link URL for the given term, or null on failure.
File: `wp-includes/link-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/link-template.php/)
```
function get_edit_term_link( $term, $taxonomy = '', $object_type = '' ) {
$term = get_term( $term, $taxonomy );
if ( ! $term || is_wp_error( $term ) ) {
return;
}
$tax = get_taxonomy( $term->taxonomy );
$term_id = $term->term_id;
if ( ! $tax || ! current_user_can( 'edit_term', $term_id ) ) {
return;
}
$args = array(
'taxonomy' => $taxonomy,
'tag_ID' => $term_id,
);
if ( $object_type ) {
$args['post_type'] = $object_type;
} elseif ( ! empty( $tax->object_type ) ) {
$args['post_type'] = reset( $tax->object_type );
}
if ( $tax->show_ui ) {
$location = add_query_arg( $args, admin_url( 'term.php' ) );
} else {
$location = '';
}
/**
* Filters the edit link for a term.
*
* @since 3.1.0
*
* @param string $location The edit link.
* @param int $term_id Term ID.
* @param string $taxonomy Taxonomy name.
* @param string $object_type The object type.
*/
return apply_filters( 'get_edit_term_link', $location, $term_id, $taxonomy, $object_type );
}
```
[apply\_filters( 'get\_edit\_term\_link', string $location, int $term\_id, string $taxonomy, string $object\_type )](../hooks/get_edit_term_link)
Filters the edit link for a term.
| Uses | Description |
| --- | --- |
| [current\_user\_can()](current_user_can) wp-includes/capabilities.php | Returns whether the current user has the specified capability. |
| [add\_query\_arg()](add_query_arg) wp-includes/functions.php | Retrieves a modified URL query string. |
| [get\_term()](get_term) wp-includes/taxonomy.php | Gets all term data from database by term ID. |
| [get\_taxonomy()](get_taxonomy) wp-includes/taxonomy.php | Retrieves the taxonomy object of $taxonomy. |
| [admin\_url()](admin_url) wp-includes/link-template.php | Retrieves the URL to the admin area for the current site. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| [is\_wp\_error()](is_wp_error) wp-includes/load.php | Checks whether the given variable is a WordPress Error. |
| Used By | Description |
| --- | --- |
| [WP\_Terms\_List\_Table::handle\_row\_actions()](../classes/wp_terms_list_table/handle_row_actions) wp-admin/includes/class-wp-terms-list-table.php | Generates and displays row action links. |
| [WP\_Terms\_List\_Table::column\_name()](../classes/wp_terms_list_table/column_name) wp-admin/includes/class-wp-terms-list-table.php | |
| [wp\_tag\_cloud()](wp_tag_cloud) wp-includes/category-template.php | Displays a tag cloud. |
| [get\_edit\_tag\_link()](get_edit_tag_link) wp-includes/link-template.php | Retrieves the edit link for a tag. |
| [edit\_term\_link()](edit_term_link) wp-includes/link-template.php | Displays or retrieves the edit term link with formatting. |
| [wp\_admin\_bar\_edit\_menu()](wp_admin_bar_edit_menu) wp-includes/admin-bar.php | Provides an edit link for posts and terms. |
| Version | Description |
| --- | --- |
| [4.5.0](https://developer.wordpress.org/reference/since/4.5.0/) | The `$taxonomy` parameter was made optional. |
| [3.1.0](https://developer.wordpress.org/reference/since/3.1.0/) | Introduced. |
wordpress populate_network( int $network_id = 1, string $domain = '', string $email = '', string $site_name = '', string $path = '/', bool $subdomain_install = false ): bool|WP_Error populate\_network( int $network\_id = 1, string $domain = '', string $email = '', string $site\_name = '', string $path = '/', bool $subdomain\_install = false ): bool|WP\_Error
=================================================================================================================================================================================
Populate network settings.
`$network_id` int Optional ID of network to populate. Default: `1`
`$domain` string Optional The domain name for the network. Example: "example.com". Default: `''`
`$email` string Optional Email address for the network administrator. Default: `''`
`$site_name` string Optional The name of the network. Default: `''`
`$path` string Optional The path to append to the network's domain name. Default `'/'`. Default: `'/'`
`$subdomain_install` bool Optional Whether the network is a subdomain installation or a subdirectory installation.
Default false, meaning the network is a subdirectory installation. Default: `false`
bool|[WP\_Error](../classes/wp_error) True on success, or [WP\_Error](../classes/wp_error) on warning (with the installation otherwise successful, so the error code must be checked) or failure.
File: `wp-admin/includes/schema.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/schema.php/)
```
function populate_network( $network_id = 1, $domain = '', $email = '', $site_name = '', $path = '/', $subdomain_install = false ) {
global $wpdb, $current_site, $wp_rewrite;
$errors = new WP_Error();
if ( '' === $domain ) {
$errors->add( 'empty_domain', __( 'You must provide a domain name.' ) );
}
if ( '' === $site_name ) {
$errors->add( 'empty_sitename', __( 'You must provide a name for your network of sites.' ) );
}
// Check for network collision.
$network_exists = false;
if ( is_multisite() ) {
if ( get_network( (int) $network_id ) ) {
$errors->add( 'siteid_exists', __( 'The network already exists.' ) );
}
} else {
if ( $network_id == $wpdb->get_var( $wpdb->prepare( "SELECT id FROM $wpdb->site WHERE id = %d", $network_id ) ) ) {
$errors->add( 'siteid_exists', __( 'The network already exists.' ) );
}
}
if ( ! is_email( $email ) ) {
$errors->add( 'invalid_email', __( 'You must provide a valid email address.' ) );
}
if ( $errors->has_errors() ) {
return $errors;
}
if ( 1 == $network_id ) {
$wpdb->insert(
$wpdb->site,
array(
'domain' => $domain,
'path' => $path,
)
);
$network_id = $wpdb->insert_id;
} else {
$wpdb->insert(
$wpdb->site,
array(
'domain' => $domain,
'path' => $path,
'id' => $network_id,
)
);
}
populate_network_meta(
$network_id,
array(
'admin_email' => $email,
'site_name' => $site_name,
'subdomain_install' => $subdomain_install,
)
);
$site_user = get_userdata( (int) $wpdb->get_var( $wpdb->prepare( "SELECT meta_value FROM $wpdb->sitemeta WHERE meta_key = %s AND site_id = %d", 'admin_user_id', $network_id ) ) );
/*
* When upgrading from single to multisite, assume the current site will
* become the main site of the network. When using populate_network()
* to create another network in an existing multisite environment, skip
* these steps since the main site of the new network has not yet been
* created.
*/
if ( ! is_multisite() ) {
$current_site = new stdClass;
$current_site->domain = $domain;
$current_site->path = $path;
$current_site->site_name = ucfirst( $domain );
$wpdb->insert(
$wpdb->blogs,
array(
'site_id' => $network_id,
'blog_id' => 1,
'domain' => $domain,
'path' => $path,
'registered' => current_time( 'mysql' ),
)
);
$current_site->blog_id = $wpdb->insert_id;
update_user_meta( $site_user->ID, 'source_domain', $domain );
update_user_meta( $site_user->ID, 'primary_blog', $current_site->blog_id );
// Unable to use update_network_option() while populating the network.
$wpdb->insert(
$wpdb->sitemeta,
array(
'site_id' => $network_id,
'meta_key' => 'main_site',
'meta_value' => $current_site->blog_id,
)
);
if ( $subdomain_install ) {
$wp_rewrite->set_permalink_structure( '/%year%/%monthnum%/%day%/%postname%/' );
} else {
$wp_rewrite->set_permalink_structure( '/blog/%year%/%monthnum%/%day%/%postname%/' );
}
flush_rewrite_rules();
if ( ! $subdomain_install ) {
return true;
}
$vhost_ok = false;
$errstr = '';
$hostname = substr( md5( time() ), 0, 6 ) . '.' . $domain; // Very random hostname!
$page = wp_remote_get(
'http://' . $hostname,
array(
'timeout' => 5,
'httpversion' => '1.1',
)
);
if ( is_wp_error( $page ) ) {
$errstr = $page->get_error_message();
} elseif ( 200 == wp_remote_retrieve_response_code( $page ) ) {
$vhost_ok = true;
}
if ( ! $vhost_ok ) {
$msg = '<p><strong>' . __( 'Warning! Wildcard DNS may not be configured correctly!' ) . '</strong></p>';
$msg .= '<p>' . sprintf(
/* translators: %s: Host name. */
__( 'The installer attempted to contact a random hostname (%s) on your domain.' ),
'<code>' . $hostname . '</code>'
);
if ( ! empty( $errstr ) ) {
/* translators: %s: Error message. */
$msg .= ' ' . sprintf( __( 'This resulted in an error message: %s' ), '<code>' . $errstr . '</code>' );
}
$msg .= '</p>';
$msg .= '<p>' . sprintf(
/* translators: %s: Asterisk symbol (*). */
__( 'To use a subdomain configuration, you must have a wildcard entry in your DNS. This usually means adding a %s hostname record pointing at your web server in your DNS configuration tool.' ),
'<code>*</code>'
) . '</p>';
$msg .= '<p>' . __( 'You can still use your site but any subdomain you create may not be accessible. If you know your DNS is correct, ignore this message.' ) . '</p>';
return new WP_Error( 'no_wildcard_dns', $msg );
}
}
return true;
}
```
| Uses | Description |
| --- | --- |
| [populate\_network\_meta()](populate_network_meta) wp-admin/includes/schema.php | Creates WordPress network meta and sets the default values. |
| [get\_network()](get_network) wp-includes/ms-network.php | Retrieves network data given a network ID or network object. |
| [wpdb::insert()](../classes/wpdb/insert) wp-includes/class-wpdb.php | Inserts a row into the table. |
| [flush\_rewrite\_rules()](flush_rewrite_rules) wp-includes/rewrite.php | Removes rewrite rules and then recreate rewrite rules. |
| [WP\_Rewrite::set\_permalink\_structure()](../classes/wp_rewrite/set_permalink_structure) wp-includes/class-wp-rewrite.php | Sets the main permalink structure for the site. |
| [update\_user\_meta()](update_user_meta) wp-includes/user.php | Updates user meta field based on user ID. |
| [wp\_remote\_retrieve\_response\_code()](wp_remote_retrieve_response_code) wp-includes/http.php | Retrieve only the response code from the raw response. |
| [wp\_remote\_get()](wp_remote_get) wp-includes/http.php | Performs an HTTP request using the GET method and returns its response. |
| [current\_time()](current_time) wp-includes/functions.php | Retrieves the current time based on specified type. |
| [is\_email()](is_email) wp-includes/formatting.php | Verifies that an email is valid. |
| [is\_multisite()](is_multisite) wp-includes/load.php | If Multisite is enabled. |
| [get\_userdata()](get_userdata) wp-includes/pluggable.php | Retrieves user info by user ID. |
| [wpdb::get\_var()](../classes/wpdb/get_var) wp-includes/class-wpdb.php | Retrieves one variable from the database. |
| [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. |
| [wpdb::prepare()](../classes/wpdb/prepare) wp-includes/class-wpdb.php | Prepares a SQL query for safe execution. |
| [is\_wp\_error()](is_wp_error) wp-includes/load.php | Checks whether the given variable is a WordPress Error. |
| [WP\_Error::\_\_construct()](../classes/wp_error/__construct) wp-includes/class-wp-error.php | Initializes the error. |
| Version | Description |
| --- | --- |
| [3.0.0](https://developer.wordpress.org/reference/since/3.0.0/) | Introduced. |
| programming_docs |
wordpress is_favicon(): bool is\_favicon(): bool
===================
Is the query for the favicon.ico file?
bool Whether the query is for the favicon.ico file.
File: `wp-includes/query.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/query.php/)
```
function is_favicon() {
global $wp_query;
if ( ! isset( $wp_query ) ) {
_doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the query is run. Before then, they always return false.' ), '3.1.0' );
return false;
}
return $wp_query->is_favicon();
}
```
| Uses | Description |
| --- | --- |
| [WP\_Query::is\_favicon()](../classes/wp_query/is_favicon) wp-includes/class-wp-query.php | Is the query for the favicon.ico file? |
| [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. |
| [\_doing\_it\_wrong()](_doing_it_wrong) wp-includes/functions.php | Marks something as being incorrectly called. |
| Used By | Description |
| --- | --- |
| [WP::handle\_404()](../classes/wp/handle_404) wp-includes/class-wp.php | Set the Headers for 404, if nothing is found for requested URL. |
| [redirect\_canonical()](redirect_canonical) wp-includes/canonical.php | Redirects incoming links to the proper URL based on the site url. |
| Version | Description |
| --- | --- |
| [5.4.0](https://developer.wordpress.org/reference/since/5.4.0/) | Introduced. |
wordpress wp_mail( string|string[] $to, string $subject, string $message, string|string[] $headers = '', string|string[] $attachments = array() ): bool wp\_mail( string|string[] $to, string $subject, string $message, string|string[] $headers = '', string|string[] $attachments = array() ): bool
==============================================================================================================================================
Sends an email, similar to PHP’s mail function.
A true return value does not automatically mean that the user received the email successfully. It just only means that the method used was able to process the request without any errors.
The default content type is `text/plain` which does not allow using HTML.
However, you can set the content type of the email by using the [‘wp\_mail\_content\_type’](../hooks/wp_mail_content_type) filter.
The default charset is based on the charset used on the blog. The charset can be set using the [‘wp\_mail\_charset’](../hooks/wp_mail_charset) filter.
`$to` string|string[] Required Array or comma-separated list of email addresses to send message. `$subject` string Required Email subject. `$message` string Required Message contents. `$headers` string|string[] Optional Additional headers. Default: `''`
`$attachments` string|string[] Optional Paths to files to attach. Default: `array()`
bool Whether the email was sent successfully.
```
wp_mail( $to, $subject, $message, $headers, $attachments );
```
Optional filters ‘[wp\_mail\_from](../hooks/wp_mail_from)‘ and ‘[wp\_mail\_from\_name](../hooks/wp_mail_from_name)‘ are run on the sender email address and name. The return values are reassembled into a ‘from’ address like ‘”Example User” ‘ If only ‘[wp\_mail\_from](../hooks/wp_mail_from)‘ returns a value, then just the email address will be used with no name.
The default content type is ‘text/plain’ which does not allow using HTML. You can set the content type of the email either by using the [‘wp\_mail\_content\_type](../hooks/wp_mail_content_type)‘ filter ( see example below), or by including a header like “Content-type: text/html”. Be careful to reset ‘wp\_mail\_content\_type’ back to ‘text/plain’ after you send your message, though, because failing to do so could lead to unexpected problems with e-mails from WP or plugins/themes.
The default charset is based on the charset used on the blog. The charset can be set using the ‘[wp\_mail\_charset](../hooks/wp_mail_charset)‘ filter.
* A true return value does not automatically mean that the user received the email successfully.
* For this function to work, the settings `SMTP` and `smtp_port` (default: 25) need to be set in your php.ini file.
* The function is available after the hook [`'plugins_loaded'`](../hooks/plugins_loaded "Plugin API/Action Reference/plugins loaded").
* The filenames in the `$attachments` attribute have to be filesystem paths.
All email addresses supplied to [wp\_mail()](wp_mail) as the $to parameter must comply with [RFC 2822](http://www.faqs.org/rfcs/rfc2822.html). Some valid examples:
* [email protected]
* [email protected], [email protected]
* User <[email protected]>
* User <[email protected]>, Another User <[email protected]>
The same applies to Cc: and Bcc: fields in $headers, but as noted in the next section, it’s better to push multiple addresses into an array instead of listing them on a single line. Either address format, with or without the user name, may be used.
To set the “From:” email address to something other than the WordPress default sender, or to add “Cc:” and/or “Bcc:” recipients, you must use the $headers argument.
$headers can be a string or an array, but it may be easiest to use in the array form. To use it, push a string onto the array, starting with “From:”, “Bcc:” or “Cc:” (note the use of the “:”), followed by a valid email address.
When you are using the array form, you do not need to supply line breaks ("\n" or "\r\n"). Although the function can handle multiple emails per line, it may simply be easier to push each email address separately onto the $headers array. The function will figure it out and will build the proper Mime header automagically. Just don’t forget that each string you push must have the header type as the first part of the string (“From:”, “Cc:” or “Bcc:”)
File: `wp-includes/pluggable.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/pluggable.php/)
```
function wp_mail( $to, $subject, $message, $headers = '', $attachments = array() ) {
// Compact the input, apply the filters, and extract them back out.
/**
* Filters the wp_mail() arguments.
*
* @since 2.2.0
*
* @param array $args {
* Array of the `wp_mail()` arguments.
*
* @type string|string[] $to Array or comma-separated list of email addresses to send message.
* @type string $subject Email subject.
* @type string $message Message contents.
* @type string|string[] $headers Additional headers.
* @type string|string[] $attachments Paths to files to attach.
* }
*/
$atts = apply_filters( 'wp_mail', compact( 'to', 'subject', 'message', 'headers', 'attachments' ) );
/**
* Filters whether to preempt sending an email.
*
* Returning a non-null value will short-circuit {@see wp_mail()}, returning
* that value instead. A boolean return value should be used to indicate whether
* the email was successfully sent.
*
* @since 5.7.0
*
* @param null|bool $return Short-circuit return value.
* @param array $atts {
* Array of the `wp_mail()` arguments.
*
* @type string|string[] $to Array or comma-separated list of email addresses to send message.
* @type string $subject Email subject.
* @type string $message Message contents.
* @type string|string[] $headers Additional headers.
* @type string|string[] $attachments Paths to files to attach.
* }
*/
$pre_wp_mail = apply_filters( 'pre_wp_mail', null, $atts );
if ( null !== $pre_wp_mail ) {
return $pre_wp_mail;
}
if ( isset( $atts['to'] ) ) {
$to = $atts['to'];
}
if ( ! is_array( $to ) ) {
$to = explode( ',', $to );
}
if ( isset( $atts['subject'] ) ) {
$subject = $atts['subject'];
}
if ( isset( $atts['message'] ) ) {
$message = $atts['message'];
}
if ( isset( $atts['headers'] ) ) {
$headers = $atts['headers'];
}
if ( isset( $atts['attachments'] ) ) {
$attachments = $atts['attachments'];
}
if ( ! is_array( $attachments ) ) {
$attachments = explode( "\n", str_replace( "\r\n", "\n", $attachments ) );
}
global $phpmailer;
// (Re)create it, if it's gone missing.
if ( ! ( $phpmailer instanceof PHPMailer\PHPMailer\PHPMailer ) ) {
require_once ABSPATH . WPINC . '/PHPMailer/PHPMailer.php';
require_once ABSPATH . WPINC . '/PHPMailer/SMTP.php';
require_once ABSPATH . WPINC . '/PHPMailer/Exception.php';
$phpmailer = new PHPMailer\PHPMailer\PHPMailer( true );
$phpmailer::$validator = static function ( $email ) {
return (bool) is_email( $email );
};
}
// Headers.
$cc = array();
$bcc = array();
$reply_to = array();
if ( empty( $headers ) ) {
$headers = array();
} else {
if ( ! is_array( $headers ) ) {
// Explode the headers out, so this function can take
// both string headers and an array of headers.
$tempheaders = explode( "\n", str_replace( "\r\n", "\n", $headers ) );
} else {
$tempheaders = $headers;
}
$headers = array();
// If it's actually got contents.
if ( ! empty( $tempheaders ) ) {
// Iterate through the raw headers.
foreach ( (array) $tempheaders as $header ) {
if ( strpos( $header, ':' ) === false ) {
if ( false !== stripos( $header, 'boundary=' ) ) {
$parts = preg_split( '/boundary=/i', trim( $header ) );
$boundary = trim( str_replace( array( "'", '"' ), '', $parts[1] ) );
}
continue;
}
// Explode them out.
list( $name, $content ) = explode( ':', trim( $header ), 2 );
// Cleanup crew.
$name = trim( $name );
$content = trim( $content );
switch ( strtolower( $name ) ) {
// Mainly for legacy -- process a "From:" header if it's there.
case 'from':
$bracket_pos = strpos( $content, '<' );
if ( false !== $bracket_pos ) {
// Text before the bracketed email is the "From" name.
if ( $bracket_pos > 0 ) {
$from_name = substr( $content, 0, $bracket_pos );
$from_name = str_replace( '"', '', $from_name );
$from_name = trim( $from_name );
}
$from_email = substr( $content, $bracket_pos + 1 );
$from_email = str_replace( '>', '', $from_email );
$from_email = trim( $from_email );
// Avoid setting an empty $from_email.
} elseif ( '' !== trim( $content ) ) {
$from_email = trim( $content );
}
break;
case 'content-type':
if ( strpos( $content, ';' ) !== false ) {
list( $type, $charset_content ) = explode( ';', $content );
$content_type = trim( $type );
if ( false !== stripos( $charset_content, 'charset=' ) ) {
$charset = trim( str_replace( array( 'charset=', '"' ), '', $charset_content ) );
} elseif ( false !== stripos( $charset_content, 'boundary=' ) ) {
$boundary = trim( str_replace( array( 'BOUNDARY=', 'boundary=', '"' ), '', $charset_content ) );
$charset = '';
}
// Avoid setting an empty $content_type.
} elseif ( '' !== trim( $content ) ) {
$content_type = trim( $content );
}
break;
case 'cc':
$cc = array_merge( (array) $cc, explode( ',', $content ) );
break;
case 'bcc':
$bcc = array_merge( (array) $bcc, explode( ',', $content ) );
break;
case 'reply-to':
$reply_to = array_merge( (array) $reply_to, explode( ',', $content ) );
break;
default:
// Add it to our grand headers array.
$headers[ trim( $name ) ] = trim( $content );
break;
}
}
}
}
// Empty out the values that may be set.
$phpmailer->clearAllRecipients();
$phpmailer->clearAttachments();
$phpmailer->clearCustomHeaders();
$phpmailer->clearReplyTos();
$phpmailer->Body = '';
$phpmailer->AltBody = '';
// Set "From" name and email.
// If we don't have a name from the input headers.
if ( ! isset( $from_name ) ) {
$from_name = 'WordPress';
}
/*
* If we don't have an email from the input headers, default to wordpress@$sitename
* Some hosts will block outgoing mail from this address if it doesn't exist,
* but there's no easy alternative. Defaulting to admin_email might appear to be
* another option, but some hosts may refuse to relay mail from an unknown domain.
* See https://core.trac.wordpress.org/ticket/5007.
*/
if ( ! isset( $from_email ) ) {
// Get the site domain and get rid of www.
$sitename = wp_parse_url( network_home_url(), PHP_URL_HOST );
$from_email = 'wordpress@';
if ( null !== $sitename ) {
if ( 'www.' === substr( $sitename, 0, 4 ) ) {
$sitename = substr( $sitename, 4 );
}
$from_email .= $sitename;
}
}
/**
* Filters the email address to send from.
*
* @since 2.2.0
*
* @param string $from_email Email address to send from.
*/
$from_email = apply_filters( 'wp_mail_from', $from_email );
/**
* Filters the name to associate with the "from" email address.
*
* @since 2.3.0
*
* @param string $from_name Name associated with the "from" email address.
*/
$from_name = apply_filters( 'wp_mail_from_name', $from_name );
try {
$phpmailer->setFrom( $from_email, $from_name, false );
} catch ( PHPMailer\PHPMailer\Exception $e ) {
$mail_error_data = compact( 'to', 'subject', 'message', 'headers', 'attachments' );
$mail_error_data['phpmailer_exception_code'] = $e->getCode();
/** This filter is documented in wp-includes/pluggable.php */
do_action( 'wp_mail_failed', new WP_Error( 'wp_mail_failed', $e->getMessage(), $mail_error_data ) );
return false;
}
// Set mail's subject and body.
$phpmailer->Subject = $subject;
$phpmailer->Body = $message;
// Set destination addresses, using appropriate methods for handling addresses.
$address_headers = compact( 'to', 'cc', 'bcc', 'reply_to' );
foreach ( $address_headers as $address_header => $addresses ) {
if ( empty( $addresses ) ) {
continue;
}
foreach ( (array) $addresses as $address ) {
try {
// Break $recipient into name and address parts if in the format "Foo <[email protected]>".
$recipient_name = '';
if ( preg_match( '/(.*)<(.+)>/', $address, $matches ) ) {
if ( count( $matches ) == 3 ) {
$recipient_name = $matches[1];
$address = $matches[2];
}
}
switch ( $address_header ) {
case 'to':
$phpmailer->addAddress( $address, $recipient_name );
break;
case 'cc':
$phpmailer->addCc( $address, $recipient_name );
break;
case 'bcc':
$phpmailer->addBcc( $address, $recipient_name );
break;
case 'reply_to':
$phpmailer->addReplyTo( $address, $recipient_name );
break;
}
} catch ( PHPMailer\PHPMailer\Exception $e ) {
continue;
}
}
}
// Set to use PHP's mail().
$phpmailer->isMail();
// Set Content-Type and charset.
// If we don't have a content-type from the input headers.
if ( ! isset( $content_type ) ) {
$content_type = 'text/plain';
}
/**
* Filters the wp_mail() content type.
*
* @since 2.3.0
*
* @param string $content_type Default wp_mail() content type.
*/
$content_type = apply_filters( 'wp_mail_content_type', $content_type );
$phpmailer->ContentType = $content_type;
// Set whether it's plaintext, depending on $content_type.
if ( 'text/html' === $content_type ) {
$phpmailer->isHTML( true );
}
// If we don't have a charset from the input headers.
if ( ! isset( $charset ) ) {
$charset = get_bloginfo( 'charset' );
}
/**
* Filters the default wp_mail() charset.
*
* @since 2.3.0
*
* @param string $charset Default email charset.
*/
$phpmailer->CharSet = apply_filters( 'wp_mail_charset', $charset );
// Set custom headers.
if ( ! empty( $headers ) ) {
foreach ( (array) $headers as $name => $content ) {
// Only add custom headers not added automatically by PHPMailer.
if ( ! in_array( $name, array( 'MIME-Version', 'X-Mailer' ), true ) ) {
try {
$phpmailer->addCustomHeader( sprintf( '%1$s: %2$s', $name, $content ) );
} catch ( PHPMailer\PHPMailer\Exception $e ) {
continue;
}
}
}
if ( false !== stripos( $content_type, 'multipart' ) && ! empty( $boundary ) ) {
$phpmailer->addCustomHeader( sprintf( 'Content-Type: %s; boundary="%s"', $content_type, $boundary ) );
}
}
if ( ! empty( $attachments ) ) {
foreach ( $attachments as $attachment ) {
try {
$phpmailer->addAttachment( $attachment );
} catch ( PHPMailer\PHPMailer\Exception $e ) {
continue;
}
}
}
/**
* Fires after PHPMailer is initialized.
*
* @since 2.2.0
*
* @param PHPMailer $phpmailer The PHPMailer instance (passed by reference).
*/
do_action_ref_array( 'phpmailer_init', array( &$phpmailer ) );
$mail_data = compact( 'to', 'subject', 'message', 'headers', 'attachments' );
// Send!
try {
$send = $phpmailer->send();
/**
* Fires after PHPMailer has successfully sent an email.
*
* The firing of this action does not necessarily mean that the recipient(s) received the
* email successfully. It only means that the `send` method above was able to
* process the request without any errors.
*
* @since 5.9.0
*
* @param array $mail_data {
* An array containing the email recipient(s), subject, message, headers, and attachments.
*
* @type string[] $to Email addresses to send message.
* @type string $subject Email subject.
* @type string $message Message contents.
* @type string[] $headers Additional headers.
* @type string[] $attachments Paths to files to attach.
* }
*/
do_action( 'wp_mail_succeeded', $mail_data );
return $send;
} catch ( PHPMailer\PHPMailer\Exception $e ) {
$mail_data['phpmailer_exception_code'] = $e->getCode();
/**
* Fires after a PHPMailer\PHPMailer\Exception is caught.
*
* @since 4.4.0
*
* @param WP_Error $error A WP_Error object with the PHPMailer\PHPMailer\Exception message, and an array
* containing the mail recipient, subject, message, headers, and attachments.
*/
do_action( 'wp_mail_failed', new WP_Error( 'wp_mail_failed', $e->getMessage(), $mail_data ) );
return false;
}
}
```
[do\_action\_ref\_array( 'phpmailer\_init', PHPMailer $phpmailer )](../hooks/phpmailer_init)
Fires after PHPMailer is initialized.
[apply\_filters( 'pre\_wp\_mail', null|bool $return, array $atts )](../hooks/pre_wp_mail)
Filters whether to preempt sending an email.
[apply\_filters( 'wp\_mail', array $args )](../hooks/wp_mail)
Filters the [wp\_mail()](wp_mail) arguments.
[apply\_filters( 'wp\_mail\_charset', string $charset )](../hooks/wp_mail_charset)
Filters the default [wp\_mail()](wp_mail) charset.
[apply\_filters( 'wp\_mail\_content\_type', string $content\_type )](../hooks/wp_mail_content_type)
Filters the [wp\_mail()](wp_mail) content type.
[do\_action( 'wp\_mail\_failed', WP\_Error $error )](../hooks/wp_mail_failed)
Fires after a PHPMailer\PHPMailer\Exception is caught.
[apply\_filters( 'wp\_mail\_from', string $from\_email )](../hooks/wp_mail_from)
Filters the email address to send from.
[apply\_filters( 'wp\_mail\_from\_name', string $from\_name )](../hooks/wp_mail_from_name)
Filters the name to associate with the “from” email address.
[do\_action( 'wp\_mail\_succeeded', array $mail\_data )](../hooks/wp_mail_succeeded)
Fires after PHPMailer has successfully sent an email.
| Uses | Description |
| --- | --- |
| [stripos()](stripos) wp-includes/class-pop3.php | |
| [wp\_parse\_url()](wp_parse_url) wp-includes/http.php | A wrapper for PHP’s parse\_url() function that handles consistency in the return values across PHP versions. |
| [is\_email()](is_email) wp-includes/formatting.php | Verifies that an email is valid. |
| [network\_home\_url()](network_home_url) wp-includes/link-template.php | Retrieves the home URL for the current network. |
| [do\_action\_ref\_array()](do_action_ref_array) wp-includes/plugin.php | Calls the callback functions that have been added to an action hook, specifying arguments in an array. |
| [get\_bloginfo()](get_bloginfo) wp-includes/general-template.php | Retrieves information about the current site. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| [do\_action()](do_action) wp-includes/plugin.php | Calls the callback functions that have been added to an action hook. |
| [WP\_Error::\_\_construct()](../classes/wp_error/__construct) wp-includes/class-wp-error.php | Initializes the error. |
| Used By | Description |
| --- | --- |
| [wpmu\_new\_site\_admin\_notification()](wpmu_new_site_admin_notification) wp-includes/ms-functions.php | Notifies the Multisite network administrator that a new site was created. |
| [WP\_Automatic\_Updater::send\_plugin\_theme\_email()](../classes/wp_automatic_updater/send_plugin_theme_email) wp-admin/includes/class-wp-automatic-updater.php | Sends an email upon the completion or failure of a plugin or theme background update. |
| [WP\_Recovery\_Mode\_Email\_Service::send\_recovery\_mode\_email()](../classes/wp_recovery_mode_email_service/send_recovery_mode_email) wp-includes/class-wp-recovery-mode-email-service.php | Sends the Recovery Mode email to the site admin email address. |
| [\_wp\_privacy\_send\_request\_confirmation\_notification()](_wp_privacy_send_request_confirmation_notification) wp-includes/user.php | Notifies the site administrator via email when a request is confirmed. |
| [\_wp\_privacy\_send\_erasure\_fulfillment\_notification()](_wp_privacy_send_erasure_fulfillment_notification) wp-includes/user.php | Notifies the user when their erasure request is fulfilled. |
| [wp\_send\_user\_request()](wp_send_user_request) wp-includes/user.php | Send a confirmation request email to confirm an action. |
| [wp\_privacy\_send\_personal\_data\_export\_email()](wp_privacy_send_personal_data_export_email) wp-admin/includes/privacy-tools.php | Send an email to the user with a link to the personal data export file |
| [wp\_site\_admin\_email\_change\_notification()](wp_site_admin_email_change_notification) wp-includes/functions.php | Sends an email to the old site admin email address when the site admin email address changes. |
| [update\_network\_option\_new\_admin\_email()](update_network_option_new_admin_email) wp-includes/ms-functions.php | Sends a confirmation request email when a change of network admin email address is attempted. |
| [wp\_network\_admin\_email\_change\_notification()](wp_network_admin_email_change_notification) wp-includes/ms-functions.php | Sends an email to the old network admin email address when the network admin email address changes. |
| [retrieve\_password()](retrieve_password) wp-includes/user.php | Handles sending a password retrieval email to a user. |
| [WP\_Automatic\_Updater::send\_email()](../classes/wp_automatic_updater/send_email) wp-admin/includes/class-wp-automatic-updater.php | Sends an email upon the completion or failure of a background core update. |
| [WP\_Automatic\_Updater::send\_debug\_email()](../classes/wp_automatic_updater/send_debug_email) wp-admin/includes/class-wp-automatic-updater.php | Prepares and sends an email of a full log of background update results, useful for debugging and geekery. |
| [update\_option\_new\_admin\_email()](update_option_new_admin_email) wp-admin/includes/misc.php | Sends a confirmation request email when a change of site admin email address is attempted. |
| [send\_confirmation\_on\_profile\_email()](send_confirmation_on_profile_email) wp-includes/user.php | Sends a confirmation request email when a change of user email address is attempted. |
| [wp\_new\_blog\_notification()](wp_new_blog_notification) wp-admin/includes/upgrade.php | Notifies the site admin that the installation of WordPress is complete. |
| [wp\_password\_change\_notification()](wp_password_change_notification) wp-includes/pluggable.php | Notifies the blog admin of a user changing password, normally via email. |
| [wp\_new\_user\_notification()](wp_new_user_notification) wp-includes/pluggable.php | Emails login credentials to a newly-registered user. |
| [wp\_notify\_postauthor()](wp_notify_postauthor) wp-includes/pluggable.php | Notifies an author (and/or others) of a comment/trackback/pingback on a post. |
| [wp\_notify\_moderator()](wp_notify_moderator) wp-includes/pluggable.php | Notifies the moderator of the site about a new comment that is awaiting approval. |
| [wp\_update\_user()](wp_update_user) wp-includes/user.php | Updates a user in the database. |
| [wpmu\_welcome\_user\_notification()](wpmu_welcome_user_notification) wp-includes/ms-functions.php | Notifies a user that their account activation has been successful. |
| [newblog\_notify\_siteadmin()](newblog_notify_siteadmin) wp-includes/ms-functions.php | Notifies the network admin that a new site has been activated. |
| [newuser\_notify\_siteadmin()](newuser_notify_siteadmin) wp-includes/ms-functions.php | Notifies the network admin that a new user has been activated. |
| [wpmu\_welcome\_notification()](wpmu_welcome_notification) wp-includes/ms-functions.php | Notifies the site administrator that their site activation was successful. |
| [wpmu\_signup\_blog\_notification()](wpmu_signup_blog_notification) wp-includes/ms-functions.php | Sends a confirmation request email to a user when they sign up for a new site. The new site will not become active until the confirmation link is clicked. |
| [wpmu\_signup\_user\_notification()](wpmu_signup_user_notification) wp-includes/ms-functions.php | Sends a confirmation request email to a user when they sign up for a new user account (without signing up for a site at the same time). The user account will not become active until the confirmation link is clicked. |
| Version | Description |
| --- | --- |
| [5.5.0](https://developer.wordpress.org/reference/since/5.5.0/) | [is\_email()](is_email) is used for email validation, instead of PHPMailer's default validator. |
| [1.2.1](https://developer.wordpress.org/reference/since/1.2.1/) | Introduced. |
| programming_docs |
wordpress sanitize_html_class( string $class, string $fallback = '' ): string sanitize\_html\_class( string $class, string $fallback = '' ): string
=====================================================================
Sanitizes an HTML classname to ensure it only contains valid characters.
Strips the string down to A-Z,a-z,0-9,\_,-. If this results in an empty string then it will return the alternative value supplied.
`$class` string Required The classname to be sanitized `$fallback` string Optional The value to return if the sanitization ends up as an empty string.
Defaults to an empty string. Default: `''`
string The sanitized value
File: `wp-includes/formatting.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/formatting.php/)
```
function sanitize_html_class( $class, $fallback = '' ) {
// Strip out any %-encoded octets.
$sanitized = preg_replace( '|%[a-fA-F0-9][a-fA-F0-9]|', '', $class );
// Limit to A-Z, a-z, 0-9, '_', '-'.
$sanitized = preg_replace( '/[^A-Za-z0-9_-]/', '', $sanitized );
if ( '' === $sanitized && $fallback ) {
return sanitize_html_class( $fallback );
}
/**
* Filters a sanitized HTML class string.
*
* @since 2.8.0
*
* @param string $sanitized The sanitized HTML class.
* @param string $class HTML class before sanitization.
* @param string $fallback The fallback string.
*/
return apply_filters( 'sanitize_html_class', $sanitized, $class, $fallback );
}
```
[apply\_filters( 'sanitize\_html\_class', string $sanitized, string $class, string $fallback )](../hooks/sanitize_html_class)
Filters a sanitized HTML class string.
| Uses | Description |
| --- | --- |
| [sanitize\_html\_class()](sanitize_html_class) wp-includes/formatting.php | Sanitizes an HTML classname to ensure it only contains valid characters. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| Used By | Description |
| --- | --- |
| [WP\_Theme\_JSON::remove\_insecure\_settings()](../classes/wp_theme_json/remove_insecure_settings) wp-includes/class-wp-theme-json.php | Processes a setting node and returns the same node without the insecure settings. |
| [WP\_Media\_List\_Table::column\_title()](../classes/wp_media_list_table/column_title) wp-admin/includes/class-wp-media-list-table.php | Handles the title column output. |
| [\_navigation\_markup()](_navigation_markup) wp-includes/link-template.php | Wraps passed links in navigational markup. |
| [login\_header()](login_header) wp-login.php | Output the login page header. |
| [WP\_Screen::add\_help\_tab()](../classes/wp_screen/add_help_tab) wp-admin/includes/class-wp-screen.php | Adds a help tab to the contextual help for the screen. |
| [WP\_Plugin\_Install\_List\_Table::display\_rows()](../classes/wp_plugin_install_list_table/display_rows) wp-admin/includes/class-wp-plugin-install-list-table.php | |
| [iframe\_header()](iframe_header) wp-admin/includes/template.php | Generic Iframe header for use with Thickbox. |
| [attachment\_submitbox\_metadata()](attachment_submitbox_metadata) wp-admin/includes/media.php | Displays non-editable attachment metadata in the publish meta box. |
| [\_wp\_menu\_output()](_wp_menu_output) wp-admin/menu-header.php | Display menu. |
| [sanitize\_html\_class()](sanitize_html_class) wp-includes/formatting.php | Sanitizes an HTML classname to ensure it only contains valid characters. |
| [get\_post\_class()](get_post_class) wp-includes/post-template.php | Retrieves an array of the class names for the post container element. |
| [get\_body\_class()](get_body_class) wp-includes/post-template.php | Retrieves an array of the class names for the body element. |
| [gallery\_shortcode()](gallery_shortcode) wp-includes/media.php | Builds the Gallery shortcode output. |
| [img\_caption\_shortcode()](img_caption_shortcode) wp-includes/media.php | Builds the Caption shortcode output. |
| [get\_comment\_class()](get_comment_class) wp-includes/comment-template.php | Returns the classes for the comment div as an array. |
| [\_WP\_Editors::editor\_settings()](../classes/_wp_editors/editor_settings) wp-includes/class-wp-editor.php | |
| Version | Description |
| --- | --- |
| [2.8.0](https://developer.wordpress.org/reference/since/2.8.0/) | Introduced. |
wordpress _excerpt_render_inner_blocks( array $parsed_block, array $allowed_blocks ): string \_excerpt\_render\_inner\_blocks( array $parsed\_block, array $allowed\_blocks ): string
========================================================================================
This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.
Renders inner blocks from the allowed wrapper blocks for generating an excerpt.
`$parsed_block` array Required The parsed block. `$allowed_blocks` array Required The list of allowed inner blocks. string The rendered inner blocks.
File: `wp-includes/blocks.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/blocks.php/)
```
function _excerpt_render_inner_blocks( $parsed_block, $allowed_blocks ) {
$output = '';
foreach ( $parsed_block['innerBlocks'] as $inner_block ) {
if ( ! in_array( $inner_block['blockName'], $allowed_blocks, true ) ) {
continue;
}
if ( empty( $inner_block['innerBlocks'] ) ) {
$output .= render_block( $inner_block );
} else {
$output .= _excerpt_render_inner_blocks( $inner_block, $allowed_blocks );
}
}
return $output;
}
```
| Uses | Description |
| --- | --- |
| [\_excerpt\_render\_inner\_blocks()](_excerpt_render_inner_blocks) wp-includes/blocks.php | Renders inner blocks from the allowed wrapper blocks for generating an excerpt. |
| [render\_block()](render_block) wp-includes/blocks.php | Renders a single block into a HTML string. |
| Used By | Description |
| --- | --- |
| [\_excerpt\_render\_inner\_blocks()](_excerpt_render_inner_blocks) wp-includes/blocks.php | Renders inner blocks from the allowed wrapper blocks for generating an excerpt. |
| [\_excerpt\_render\_inner\_columns\_blocks()](_excerpt_render_inner_columns_blocks) wp-includes/deprecated.php | Render inner blocks from the `core/columns` block for generating an excerpt. |
| [excerpt\_remove\_blocks()](excerpt_remove_blocks) wp-includes/blocks.php | Parses blocks out of a content string, and renders those appropriate for the excerpt. |
| Version | Description |
| --- | --- |
| [5.8.0](https://developer.wordpress.org/reference/since/5.8.0/) | Introduced. |
wordpress have_posts(): bool have\_posts(): bool
===================
Determines whether current WordPress query has posts to loop over.
bool True if posts are available, false if end of the loop.
This function checks whether there are more posts available in the main [WP\_Query](../classes/wp_query) object to loop over. It calls `[have\_posts()](../classes/wp_query/have_posts)` method on the global `$wp_query` object.
If there are no more posts in the loop, it will trigger the [`loop_end`](../hooks/loop_end) action and then call call [`rewind_posts()`](../classes/wp_query/rewind_posts) method.
File: `wp-includes/query.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/query.php/)
```
function have_posts() {
global $wp_query;
if ( ! isset( $wp_query ) ) {
return false;
}
return $wp_query->have_posts();
}
```
| Uses | Description |
| --- | --- |
| [WP\_Query::have\_posts()](../classes/wp_query/have_posts) wp-includes/class-wp-query.php | Determines whether there are more posts available in the loop. |
| Used By | Description |
| --- | --- |
| [WP\_Media\_List\_Table::has\_items()](../classes/wp_media_list_table/has_items) wp-admin/includes/class-wp-media-list-table.php | |
| [WP\_Media\_List\_Table::display\_rows()](../classes/wp_media_list_table/display_rows) wp-admin/includes/class-wp-media-list-table.php | |
| [WP\_Posts\_List\_Table::has\_items()](../classes/wp_posts_list_table/has_items) wp-admin/includes/class-wp-posts-list-table.php | |
| Version | Description |
| --- | --- |
| [1.5.0](https://developer.wordpress.org/reference/since/1.5.0/) | Introduced. |
wordpress wp_recovery_mode(): WP_Recovery_Mode wp\_recovery\_mode(): WP\_Recovery\_Mode
========================================
Access the WordPress Recovery Mode instance.
[WP\_Recovery\_Mode](../classes/wp_recovery_mode)
File: `wp-includes/error-protection.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/error-protection.php/)
```
function wp_recovery_mode() {
static $wp_recovery_mode;
if ( ! $wp_recovery_mode ) {
$wp_recovery_mode = new WP_Recovery_Mode();
}
return $wp_recovery_mode;
}
```
| Uses | Description |
| --- | --- |
| [WP\_Recovery\_Mode::\_\_construct()](../classes/wp_recovery_mode/__construct) wp-includes/class-wp-recovery-mode.php | [WP\_Recovery\_Mode](../classes/wp_recovery_mode) constructor. |
| Used By | Description |
| --- | --- |
| [wp\_is\_recovery\_mode()](wp_is_recovery_mode) wp-includes/load.php | Is WordPress in Recovery Mode. |
| [WP\_Fatal\_Error\_Handler::display\_default\_error\_template()](../classes/wp_fatal_error_handler/display_default_error_template) wp-includes/class-wp-fatal-error-handler.php | Displays the default PHP error template. |
| [WP\_Fatal\_Error\_Handler::handle()](../classes/wp_fatal_error_handler/handle) wp-includes/class-wp-fatal-error-handler.php | Runs the shutdown handler. |
| [WP\_Paused\_Extensions\_Storage::get\_option\_name()](../classes/wp_paused_extensions_storage/get_option_name) wp-includes/class-wp-paused-extensions-storage.php | Get the option name for storing paused extensions. |
| Version | Description |
| --- | --- |
| [5.2.0](https://developer.wordpress.org/reference/since/5.2.0/) | Introduced. |
wordpress wp_update_post( array|object $postarr = array(), bool $wp_error = false, bool $fire_after_hooks = true ): int|WP_Error wp\_update\_post( array|object $postarr = array(), bool $wp\_error = false, bool $fire\_after\_hooks = true ): int|WP\_Error
============================================================================================================================
Updates 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.
`$postarr` array|object Optional Post data. Arrays are expected to be escaped, objects are not. See [wp\_insert\_post()](wp_insert_post) for accepted arguments.
Default array. More Arguments from wp\_insert\_post( ... $postarr ) An array of elements that make up a post to update or insert.
* `ID`intThe post ID. If equal to something other than 0, the post with that ID will be updated. Default 0.
* `post_author`intThe ID of the user who added the post. Default is the current user ID.
* `post_date`stringThe date of the post. Default is the current time.
* `post_date_gmt`stringThe date of the post in the GMT timezone. Default is the value of `$post_date`.
* `post_content`stringThe post content. Default empty.
* `post_content_filtered`stringThe filtered post content. Default empty.
* `post_title`stringThe post title. Default empty.
* `post_excerpt`stringThe post excerpt. Default empty.
* `post_status`stringThe post status. Default `'draft'`.
* `post_type`stringThe post type. Default `'post'`.
* `comment_status`stringWhether the post can accept comments. Accepts `'open'` or `'closed'`.
Default is the value of `'default_comment_status'` option.
* `ping_status`stringWhether the post can accept pings. Accepts `'open'` or `'closed'`.
Default is the value of `'default_ping_status'` option.
* `post_password`stringThe password to access the post. Default empty.
* `post_name`stringThe post name. Default is the sanitized post title when creating a new post.
* `to_ping`stringSpace or carriage return-separated list of URLs to ping.
Default empty.
* `pinged`stringSpace or carriage return-separated list of URLs that have been pinged. Default empty.
* `post_modified`stringThe date when the post was last modified. Default is the current time.
* `post_modified_gmt`stringThe date when the post was last modified in the GMT timezone. Default is the current time.
* `post_parent`intSet this for the post it belongs to, if any. Default 0.
* `menu_order`intThe order the post should be displayed in. Default 0.
* `post_mime_type`stringThe mime type of the post. Default empty.
* `guid`stringGlobal Unique ID for referencing the post. Default empty.
* `import_id`intThe post ID to be used when inserting a new post.
If specified, must not match any existing post ID. Default 0.
* `post_category`int[]Array of category IDs.
Defaults to value of the `'default_category'` option.
* `tags_input`arrayArray of tag names, slugs, or IDs. Default empty.
* `tax_input`arrayAn array of taxonomy terms keyed by their taxonomy name.
If the taxonomy is hierarchical, the term list needs to be either an array of term IDs or a comma-separated string of IDs.
If the taxonomy is non-hierarchical, the term list can be an array that contains term names or slugs, or a comma-separated string of names or slugs. This is because, in hierarchical taxonomy, child terms can have the same names with different parent terms, so the only way to connect them is using ID. Default empty.
* `meta_input`arrayArray of post meta values keyed by their post meta key. Default empty.
* `page_template`stringPage template to use.
Default: `array()`
`$wp_error` bool Optional Whether to return a [WP\_Error](../classes/wp_error) on failure. Default: `false`
`$fire_after_hooks` bool Optional Whether to fire the after insert hooks. Default: `true`
int|[WP\_Error](../classes/wp_error) The post ID on success. The value 0 or [WP\_Error](../classes/wp_error) on failure.
File: `wp-includes/post.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/post.php/)
```
function wp_update_post( $postarr = array(), $wp_error = false, $fire_after_hooks = true ) {
if ( is_object( $postarr ) ) {
// Non-escaped post was passed.
$postarr = get_object_vars( $postarr );
$postarr = wp_slash( $postarr );
}
// First, get all of the original fields.
$post = get_post( $postarr['ID'], ARRAY_A );
if ( is_null( $post ) ) {
if ( $wp_error ) {
return new WP_Error( 'invalid_post', __( 'Invalid post ID.' ) );
}
return 0;
}
// Escape data pulled from DB.
$post = wp_slash( $post );
// Passed post category list overwrites existing category list if not empty.
if ( isset( $postarr['post_category'] ) && is_array( $postarr['post_category'] )
&& count( $postarr['post_category'] ) > 0
) {
$post_cats = $postarr['post_category'];
} else {
$post_cats = $post['post_category'];
}
// Drafts shouldn't be assigned a date unless explicitly done so by the user.
if ( isset( $post['post_status'] )
&& in_array( $post['post_status'], array( 'draft', 'pending', 'auto-draft' ), true )
&& empty( $postarr['edit_date'] ) && ( '0000-00-00 00:00:00' === $post['post_date_gmt'] )
) {
$clear_date = true;
} else {
$clear_date = false;
}
// Merge old and new fields with new fields overwriting old ones.
$postarr = array_merge( $post, $postarr );
$postarr['post_category'] = $post_cats;
if ( $clear_date ) {
$postarr['post_date'] = current_time( 'mysql' );
$postarr['post_date_gmt'] = '';
}
if ( 'attachment' === $postarr['post_type'] ) {
return wp_insert_attachment( $postarr, false, 0, $wp_error );
}
// Discard 'tags_input' parameter if it's the same as existing post tags.
if ( isset( $postarr['tags_input'] ) && is_object_in_taxonomy( $postarr['post_type'], 'post_tag' ) ) {
$tags = get_the_terms( $postarr['ID'], 'post_tag' );
$tag_names = array();
if ( $tags && ! is_wp_error( $tags ) ) {
$tag_names = wp_list_pluck( $tags, 'name' );
}
if ( $postarr['tags_input'] === $tag_names ) {
unset( $postarr['tags_input'] );
}
}
return wp_insert_post( $postarr, $wp_error, $fire_after_hooks );
}
```
| Uses | Description |
| --- | --- |
| [get\_the\_terms()](get_the_terms) wp-includes/category-template.php | Retrieves the terms of the taxonomy that are attached to the post. |
| [wp\_list\_pluck()](wp_list_pluck) wp-includes/functions.php | Plucks a certain field out of each object or array in an array. |
| [current\_time()](current_time) wp-includes/functions.php | Retrieves the current time based on specified type. |
| [is\_object\_in\_taxonomy()](is_object_in_taxonomy) wp-includes/taxonomy.php | Determines if the given object type is associated with the given taxonomy. |
| [wp\_insert\_attachment()](wp_insert_attachment) wp-includes/post.php | Inserts an attachment. |
| [wp\_insert\_post()](wp_insert_post) wp-includes/post.php | Inserts or update a post. |
| [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. |
| [wp\_slash()](wp_slash) wp-includes/formatting.php | Adds slashes to a string or recursively adds slashes to strings within an array. |
| [get\_post()](get_post) wp-includes/post.php | Retrieves post data given a post ID or post object. |
| [is\_wp\_error()](is_wp_error) wp-includes/load.php | Checks whether the given variable is a WordPress Error. |
| [WP\_Error::\_\_construct()](../classes/wp_error/__construct) wp-includes/class-wp-error.php | Initializes the error. |
| Used By | Description |
| --- | --- |
| [WP\_REST\_Global\_Styles\_Controller::update\_item()](../classes/wp_rest_global_styles_controller/update_item) wp-includes/rest-api/endpoints/class-wp-rest-global-styles-controller.php | Updates a single global style config. |
| [wp\_set\_unique\_slug\_on\_create\_template\_part()](wp_set_unique_slug_on_create_template_part) wp-includes/theme-templates.php | Sets a custom slug when creating auto-draft template parts. |
| [WP\_REST\_Templates\_Controller::update\_item()](../classes/wp_rest_templates_controller/update_item) wp-includes/rest-api/endpoints/class-wp-rest-templates-controller.php | Updates a single template. |
| [WP\_REST\_Autosaves\_Controller::create\_item()](../classes/wp_rest_autosaves_controller/create_item) wp-includes/rest-api/endpoints/class-wp-rest-autosaves-controller.php | Creates, updates or deletes an autosave revision. |
| [WP\_REST\_Autosaves\_Controller::create\_post\_autosave()](../classes/wp_rest_autosaves_controller/create_post_autosave) wp-includes/rest-api/endpoints/class-wp-rest-autosaves-controller.php | Creates autosave for the specified post. |
| [wp\_generate\_user\_request\_key()](wp_generate_user_request_key) wp-includes/user.php | Returns a confirmation key for a user action and stores the hashed version for future comparison. |
| [\_wp\_privacy\_account\_request\_confirmed()](_wp_privacy_account_request_confirmed) wp-includes/user.php | Updates log when privacy request is confirmed. |
| [\_wp\_privacy\_completed\_request()](_wp_privacy_completed_request) wp-admin/includes/privacy-tools.php | Marks a request as completed by the admin and logs the current timestamp. |
| [\_wp\_personal\_data\_cleanup\_requests()](_wp_personal_data_cleanup_requests) wp-admin/includes/privacy-tools.php | Cleans up failed and expired requests before displaying the list table. |
| [WP\_Customize\_Manager::save\_changeset\_post()](../classes/wp_customize_manager/save_changeset_post) wp-includes/class-wp-customize-manager.php | Saves the post for the loaded changeset. |
| [wp\_update\_custom\_css\_post()](wp_update_custom_css_post) wp-includes/theme.php | Updates the `custom_css` post for a given theme. |
| [WP\_REST\_Posts\_Controller::update\_item()](../classes/wp_rest_posts_controller/update_item) wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php | Updates a single post. |
| [WP\_Customize\_Nav\_Menus::save\_nav\_menus\_created\_posts()](../classes/wp_customize_nav_menus/save_nav_menus_created_posts) wp-includes/class-wp-customize-nav-menus.php | Publishes the auto-draft posts that were created for nav menu items. |
| [media\_upload\_form\_handler()](media_upload_form_handler) wp-admin/includes/media.php | Handles form submissions for the legacy media uploader. |
| [wp\_create\_post\_autosave()](wp_create_post_autosave) wp-admin/includes/post.php | Creates autosave data for the specified post from `$_POST` data. |
| [\_fix\_attachment\_links()](_fix_attachment_links) wp-admin/includes/post.php | Replaces hrefs of attachment anchors with up-to-date permalinks. |
| [edit\_post()](edit_post) wp-admin/includes/post.php | Updates an existing post with values provided in `$_POST`. |
| [bulk\_edit\_posts()](bulk_edit_posts) wp-admin/includes/post.php | Processes the post data for the bulk editing of posts. |
| [wp\_ajax\_save\_attachment\_order()](wp_ajax_save_attachment_order) wp-admin/includes/ajax-actions.php | Ajax handler for saving the attachment order. |
| [wp\_ajax\_send\_attachment\_to\_editor()](wp_ajax_send_attachment_to_editor) wp-admin/includes/ajax-actions.php | Ajax handler for sending an attachment to the editor. |
| [wp\_ajax\_save\_attachment()](wp_ajax_save_attachment) wp-admin/includes/ajax-actions.php | Ajax handler for updating attachment attributes. |
| [wp\_ajax\_save\_attachment\_compat()](wp_ajax_save_attachment_compat) wp-admin/includes/ajax-actions.php | Ajax handler for saving backward compatible attachment attributes. |
| [WP\_Embed::shortcode()](../classes/wp_embed/shortcode) wp-includes/class-wp-embed.php | The [do\_shortcode()](do_shortcode) callback function. |
| [wp\_check\_post\_hierarchy\_for\_loops()](wp_check_post_hierarchy_for_loops) wp-includes/post.php | Checks the given subset of the post hierarchy for hierarchy loops. |
| [wp\_trash\_post()](wp_trash_post) wp-includes/post.php | Moves a post or page to the Trash |
| [wp\_untrash\_post()](wp_untrash_post) wp-includes/post.php | Restores a post from the Trash. |
| [wp\_restore\_post\_revision()](wp_restore_post_revision) wp-includes/revision.php | Restores a post to the specified revision. |
| [wp\_update\_nav\_menu\_item()](wp_update_nav_menu_item) wp-includes/nav-menu.php | Saves the properties of a menu item or create a new one. |
| [wp\_xmlrpc\_server::mt\_publishPost()](../classes/wp_xmlrpc_server/mt_publishpost) wp-includes/class-wp-xmlrpc-server.php | Sets a post’s publish status to ‘publish’. |
| [wp\_xmlrpc\_server::mw\_editPost()](../classes/wp_xmlrpc_server/mw_editpost) wp-includes/class-wp-xmlrpc-server.php | Edit a post. |
| [wp\_xmlrpc\_server::blogger\_editPost()](../classes/wp_xmlrpc_server/blogger_editpost) wp-includes/class-wp-xmlrpc-server.php | Edit a post. |
| [wp\_xmlrpc\_server::\_insert\_post()](../classes/wp_xmlrpc_server/_insert_post) wp-includes/class-wp-xmlrpc-server.php | Helper method for wp\_newPost() and wp\_editPost(), containing shared logic. |
| Version | Description |
| --- | --- |
| [5.6.0](https://developer.wordpress.org/reference/since/5.6.0/) | Added the `$fire_after_hooks` parameter. |
| [3.5.0](https://developer.wordpress.org/reference/since/3.5.0/) | Added the `$wp_error` parameter to allow a [WP\_Error](../classes/wp_error) to be returned on failure. |
| [1.0.0](https://developer.wordpress.org/reference/since/1.0.0/) | Introduced. |
| programming_docs |
wordpress the_author_aim() the\_author\_aim()
==================
This function has been deprecated. Use [the\_author\_meta()](the_author_meta) instead.
Display the AIM address of the author of the current post.
* [the\_author\_meta()](the_author_meta)
File: `wp-includes/deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/deprecated.php/)
```
function the_author_aim() {
_deprecated_function( __FUNCTION__, '2.8.0', 'the_author_meta(\'aim\')' );
the_author_meta('aim');
}
```
| Uses | Description |
| --- | --- |
| [the\_author\_meta()](the_author_meta) wp-includes/author-template.php | Outputs the field from the user’s DB object. Defaults to current post’s author. |
| [\_deprecated\_function()](_deprecated_function) wp-includes/functions.php | Marks a function as deprecated and inform when it has been used. |
| Version | Description |
| --- | --- |
| [2.8.0](https://developer.wordpress.org/reference/since/2.8.0/) | Use the\_author\_meta(`'aim'`) |
| [0.71](https://developer.wordpress.org/reference/since/0.71/) | Introduced. |
wordpress options_general_add_js() options\_general\_add\_js()
===========================
Display JavaScript on the page.
File: `wp-admin/includes/options.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/options.php/)
```
function options_general_add_js() {
?>
<script type="text/javascript">
jQuery( function($) {
var $siteName = $( '#wp-admin-bar-site-name' ).children( 'a' ).first(),
homeURL = ( <?php echo wp_json_encode( get_home_url() ); ?> || '' ).replace( /^(https?:\/\/)?(www\.)?/, '' );
$( '#blogname' ).on( 'input', function() {
var title = $.trim( $( this ).val() ) || homeURL;
// Truncate to 40 characters.
if ( 40 < title.length ) {
title = title.substring( 0, 40 ) + '\u2026';
}
$siteName.text( title );
});
$( 'input[name="date_format"]' ).on( 'click', function() {
if ( 'date_format_custom_radio' !== $(this).attr( 'id' ) )
$( 'input[name="date_format_custom"]' ).val( $( this ).val() ).closest( 'fieldset' ).find( '.example' ).text( $( this ).parent( 'label' ).children( '.format-i18n' ).text() );
});
$( 'input[name="date_format_custom"]' ).on( 'click input', function() {
$( '#date_format_custom_radio' ).prop( 'checked', true );
});
$( 'input[name="time_format"]' ).on( 'click', function() {
if ( 'time_format_custom_radio' !== $(this).attr( 'id' ) )
$( 'input[name="time_format_custom"]' ).val( $( this ).val() ).closest( 'fieldset' ).find( '.example' ).text( $( this ).parent( 'label' ).children( '.format-i18n' ).text() );
});
$( 'input[name="time_format_custom"]' ).on( 'click input', function() {
$( '#time_format_custom_radio' ).prop( 'checked', true );
});
$( 'input[name="date_format_custom"], input[name="time_format_custom"]' ).on( 'input', function() {
var format = $( this ),
fieldset = format.closest( 'fieldset' ),
example = fieldset.find( '.example' ),
spinner = fieldset.find( '.spinner' );
// Debounce the event callback while users are typing.
clearTimeout( $.data( this, 'timer' ) );
$( this ).data( 'timer', setTimeout( function() {
// If custom date is not empty.
if ( format.val() ) {
spinner.addClass( 'is-active' );
$.post( ajaxurl, {
action: 'date_format_custom' === format.attr( 'name' ) ? 'date_format' : 'time_format',
date : format.val()
}, function( d ) { spinner.removeClass( 'is-active' ); example.text( d ); } );
}
}, 500 ) );
} );
var languageSelect = $( '#WPLANG' );
$( 'form' ).on( 'submit', function() {
// Don't show a spinner for English and installed languages,
// as there is nothing to download.
if ( ! languageSelect.find( 'option:selected' ).data( 'installed' ) ) {
$( '#submit', this ).after( '<span class="spinner language-install-spinner is-active" />' );
}
});
} );
</script>
<?php
}
```
| Uses | Description |
| --- | --- |
| [get\_home\_url()](get_home_url) wp-includes/link-template.php | Retrieves the URL for a given site where the front end is accessible. |
| [wp\_json\_encode()](wp_json_encode) wp-includes/functions.php | Encodes a variable into JSON, with some sanity checks. |
| Version | Description |
| --- | --- |
| [3.5.0](https://developer.wordpress.org/reference/since/3.5.0/) | Introduced. |
wordpress is_protected_meta( string $meta_key, string $meta_type = '' ): bool is\_protected\_meta( string $meta\_key, string $meta\_type = '' ): bool
=======================================================================
Determines whether a meta key is considered protected.
`$meta_key` string Required Metadata key. `$meta_type` string Optional Type of object metadata is for. Accepts `'post'`, `'comment'`, `'term'`, `'user'`, or any other object type with an associated meta table. Default: `''`
bool Whether the meta key is considered protected.
File: `wp-includes/meta.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/meta.php/)
```
function is_protected_meta( $meta_key, $meta_type = '' ) {
$sanitized_key = preg_replace( "/[^\x20-\x7E\p{L}]/", '', $meta_key );
$protected = strlen( $sanitized_key ) > 0 && ( '_' === $sanitized_key[0] );
/**
* Filters whether a meta key is considered protected.
*
* @since 3.2.0
*
* @param bool $protected Whether the key is considered protected.
* @param string $meta_key Metadata key.
* @param string $meta_type Type of object metadata is for. Accepts 'post', 'comment', 'term', 'user',
* or any other object type with an associated meta table.
*/
return apply_filters( 'is_protected_meta', $protected, $meta_key, $meta_type );
}
```
[apply\_filters( 'is\_protected\_meta', bool $protected, string $meta\_key, string $meta\_type )](../hooks/is_protected_meta)
Filters whether a meta key is considered protected.
| Uses | Description |
| --- | --- |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| Used By | Description |
| --- | --- |
| [the\_meta()](the_meta) wp-includes/post-template.php | Displays a list of post custom fields. |
| [\_list\_meta\_row()](_list_meta_row) wp-admin/includes/template.php | Outputs a single row of public meta data in the Custom Fields meta box. |
| [meta\_form()](meta_form) wp-admin/includes/template.php | Prints the form in the Custom Fields meta box. |
| [add\_meta()](add_meta) wp-admin/includes/post.php | Adds post meta data defined in the `$_POST` superglobal for a post with given ID. |
| [edit\_post()](edit_post) wp-admin/includes/post.php | Updates an existing post with values provided in `$_POST`. |
| [wp\_ajax\_add\_meta()](wp_ajax_add_meta) wp-admin/includes/ajax-actions.php | Ajax handler for adding meta. |
| [wp\_ajax\_delete\_meta()](wp_ajax_delete_meta) wp-admin/includes/ajax-actions.php | Ajax handler for deleting meta. |
| [post\_custom\_meta\_box()](post_custom_meta_box) wp-admin/includes/meta-boxes.php | Displays custom fields form fields. |
| [map\_meta\_cap()](map_meta_cap) wp-includes/capabilities.php | Maps a capability to the primitive capabilities required of the given user to satisfy the capability being checked. |
| [register\_meta()](register_meta) wp-includes/meta.php | Registers a meta key. |
| Version | Description |
| --- | --- |
| [3.1.3](https://developer.wordpress.org/reference/since/3.1.3/) | Introduced. |
wordpress current_theme_supports( string $feature, mixed $args ): bool current\_theme\_supports( string $feature, mixed $args ): bool
==============================================================
Checks a theme’s support for a given feature.
Example usage:
```
current_theme_supports( 'custom-logo' );
current_theme_supports( 'html5', 'comment-form' );
```
`$feature` string Required The feature being checked. See [add\_theme\_support()](add_theme_support) for the list of possible values. More Arguments from add\_theme\_support( ... $feature ) The feature being added. Likely core values include:
* `'admin-bar'`
* `'align-wide'`
* `'automatic-feed-links'`
* `'core-block-patterns'`
* `'custom-background'`
* `'custom-header'`
* `'custom-line-height'`
* `'custom-logo'`
* `'customize-selective-refresh-widgets'`
* `'custom-spacing'`
* `'custom-units'`
* `'dark-editor-style'`
* `'disable-custom-colors'`
* `'disable-custom-font-sizes'`
* `'editor-color-palette'`
* `'editor-gradient-presets'`
* `'editor-font-sizes'`
* `'editor-styles'`
* `'featured-content'`
* `'html5'`
* `'menus'`
* `'post-formats'`
* `'post-thumbnails'`
* `'responsive-embeds'`
* `'starter-content'`
* `'title-tag'`
* `'wp-block-styles'`
* `'widgets'`
* `'widgets-block-editor'`
`$args` mixed Optional extra arguments to be checked against certain features. bool True if the active theme supports the feature, false otherwise.
File: `wp-includes/theme.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/theme.php/)
```
function current_theme_supports( $feature, ...$args ) {
global $_wp_theme_features;
if ( 'custom-header-uploads' === $feature ) {
return current_theme_supports( 'custom-header', 'uploads' );
}
if ( ! isset( $_wp_theme_features[ $feature ] ) ) {
return false;
}
// If no args passed then no extra checks need to be performed.
if ( ! $args ) {
/** This filter is documented in wp-includes/theme.php */
return apply_filters( "current_theme_supports-{$feature}", true, $args, $_wp_theme_features[ $feature ] ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
}
switch ( $feature ) {
case 'post-thumbnails':
/*
* post-thumbnails can be registered for only certain content/post types
* by passing an array of types to add_theme_support().
* If no array was passed, then any type is accepted.
*/
if ( true === $_wp_theme_features[ $feature ] ) { // Registered for all types.
return true;
}
$content_type = $args[0];
return in_array( $content_type, $_wp_theme_features[ $feature ][0], true );
case 'html5':
case 'post-formats':
/*
* Specific post formats can be registered by passing an array of types
* to add_theme_support().
*
* Specific areas of HTML5 support *must* be passed via an array to add_theme_support().
*/
$type = $args[0];
return in_array( $type, $_wp_theme_features[ $feature ][0], true );
case 'custom-logo':
case 'custom-header':
case 'custom-background':
// Specific capabilities can be registered by passing an array to add_theme_support().
return ( isset( $_wp_theme_features[ $feature ][0][ $args[0] ] ) && $_wp_theme_features[ $feature ][0][ $args[0] ] );
}
/**
* Filters whether the active theme supports a specific feature.
*
* The dynamic portion of the hook name, `$feature`, refers to the specific
* theme feature. See add_theme_support() for the list of possible values.
*
* @since 3.4.0
*
* @param bool $supports Whether the active theme supports the given feature. Default true.
* @param array $args Array of arguments for the feature.
* @param string $feature The theme feature.
*/
return apply_filters( "current_theme_supports-{$feature}", true, $args, $_wp_theme_features[ $feature ] ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
}
```
[apply\_filters( "current\_theme\_supports-{$feature}", bool $supports, array $args, string $feature )](../hooks/current_theme_supports-feature)
Filters whether the active theme supports a specific feature.
| Uses | Description |
| --- | --- |
| [current\_theme\_supports()](current_theme_supports) wp-includes/theme.php | Checks a theme’s support for a given feature. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| Used By | Description |
| --- | --- |
| [WP\_Theme\_JSON::get\_layout\_styles()](../classes/wp_theme_json/get_layout_styles) wp-includes/class-wp-theme-json.php | Gets the CSS layout rules for a particular block from theme.json layout definitions. |
| [\_wp\_get\_iframed\_editor\_assets()](_wp_get_iframed_editor_assets) wp-includes/block-editor.php | Collect the block editor assets that need to be loaded into the editor’s iframe. |
| [\_add\_default\_theme\_supports()](_add_default_theme_supports) wp-includes/theme.php | Adds default theme supports for block themes when the ‘setup\_theme’ action fires. |
| [\_add\_template\_loader\_filters()](_add_template_loader_filters) wp-includes/block-template.php | Adds necessary filters to use ‘wp\_template’ posts instead of theme template files. |
| [WP\_Theme\_JSON\_Resolver::get\_theme\_data()](../classes/wp_theme_json_resolver/get_theme_data) wp-includes/class-wp-theme-json-resolver.php | Returns the theme’s data. |
| [the\_block\_template\_skip\_link()](the_block_template_skip_link) wp-includes/theme-templates.php | Prints the skip-link script & styles. |
| [get\_block\_editor\_settings()](get_block_editor_settings) wp-includes/block-editor.php | Returns the contextualized block editor settings for a selected editor context. |
| [get\_block\_editor\_theme\_styles()](get_block_editor_theme_styles) wp-includes/block-editor.php | Creates an array of theme styles to load into the block editor. |
| [locate\_block\_template()](locate_block_template) wp-includes/block-template.php | Finds a block template with equal or higher specificity than a given PHP template file. |
| [wp\_get\_inline\_script\_tag()](wp_get_inline_script_tag) wp-includes/script-loader.php | Wraps inline JavaScript in tag. |
| [wp\_sanitize\_script\_attributes()](wp_sanitize_script_attributes) wp-includes/script-loader.php | Sanitizes an attributes array into an attributes string to be placed inside a tag. |
| [wp\_get\_script\_tag()](wp_get_script_tag) wp-includes/script-loader.php | Formats loader tags. |
| [get\_media\_states()](get_media_states) wp-admin/includes/template.php | Retrieves an array of media states from an attachment. |
| [WP\_REST\_Themes\_Controller::prepare\_item\_for\_response()](../classes/wp_rest_themes_controller/prepare_item_for_response) wp-includes/rest-api/endpoints/class-wp-rest-themes-controller.php | Prepares a single theme output for response. |
| [wp\_common\_block\_scripts\_and\_styles()](wp_common_block_scripts_and_styles) wp-includes/script-loader.php | Handles the enqueueing of block scripts and styles that are common to both the editor and the front-end. |
| [register\_and\_do\_post\_meta\_boxes()](register_and_do_post_meta_boxes) wp-admin/includes/meta-boxes.php | Registers the default post meta boxes, and runs the `do_meta_boxes` actions. |
| [WP\_Customize\_Nav\_Menu\_Locations\_Control::content\_template()](../classes/wp_customize_nav_menu_locations_control/content_template) wp-includes/customize/class-wp-customize-nav-menu-locations-control.php | JS/Underscore template for the control UI. |
| [WP\_Theme::get\_post\_templates()](../classes/wp_theme/get_post_templates) wp-includes/class-wp-theme.php | Returns the theme’s post templates. |
| [wp\_custom\_css\_cb()](wp_custom_css_cb) wp-includes/theme.php | Renders the Custom CSS style element. |
| [\_custom\_logo\_header\_styles()](_custom_logo_header_styles) wp-includes/theme.php | Adds CSS to hide header text for custom logo, based on Customizer setting. |
| [WP\_Customize\_Widgets::customize\_dynamic\_partial\_args()](../classes/wp_customize_widgets/customize_dynamic_partial_args) wp-includes/class-wp-customize-widgets.php | Filters arguments for dynamic widget partials. |
| [WP\_Customize\_Widgets::selective\_refresh\_init()](../classes/wp_customize_widgets/selective_refresh_init) wp-includes/class-wp-customize-widgets.php | Adds hooks for selective refresh. |
| [WP\_Customize\_Widgets::get\_selective\_refreshable\_widgets()](../classes/wp_customize_widgets/get_selective_refreshable_widgets) wp-includes/class-wp-customize-widgets.php | List whether each registered widget can be use selective refresh. |
| [print\_embed\_styles()](print_embed_styles) wp-includes/embed.php | Prints the CSS in the embed iframe header. |
| [WP\_Customize\_Nav\_Menus::customize\_register()](../classes/wp_customize_nav_menus/customize_register) wp-includes/class-wp-customize-nav-menus.php | Adds the customizer settings and controls. |
| [WP\_Customize\_Nav\_Menus::available\_item\_types()](../classes/wp_customize_nav_menus/available_item_types) wp-includes/class-wp-customize-nav-menus.php | Returns an array of all the available item types. |
| [print\_emoji\_styles()](print_emoji_styles) wp-includes/formatting.php | Prints the important emoji-related styles. |
| [WP\_Customize\_Panel::check\_capabilities()](../classes/wp_customize_panel/check_capabilities) wp-includes/class-wp-customize-panel.php | Checks required user capabilities and whether the theme has the feature support required by the panel. |
| [wp\_generate\_attachment\_metadata()](wp_generate_attachment_metadata) wp-admin/includes/image.php | Generates attachment meta data and create image sub-sizes for images. |
| [get\_media\_item()](get_media_item) wp-admin/includes/media.php | Retrieves HTML form for modifying the image attachment. |
| [get\_default\_post\_to\_edit()](get_default_post_to_edit) wp-admin/includes/post.php | Returns default post information to use when populating the “Write Post” form. |
| [post\_format\_meta\_box()](post_format_meta_box) wp-admin/includes/meta-boxes.php | Displays post format form elements. |
| [WP\_Posts\_List\_Table::inline\_edit()](../classes/wp_posts_list_table/inline_edit) wp-admin/includes/class-wp-posts-list-table.php | Outputs the hidden row displayed when inline editing |
| [Custom\_Image\_Header::get\_header\_dimensions()](../classes/custom_image_header/get_header_dimensions) wp-admin/includes/class-custom-image-header.php | Calculate width and height based on what the currently selected theme supports. |
| [Custom\_Image\_Header::ajax\_header\_crop()](../classes/custom_image_header/ajax_header_crop) wp-admin/includes/class-custom-image-header.php | Gets attachment uploaded by Media Manager, crops it, then saves it as a new object. Returns JSON-encoded object details. |
| [Custom\_Image\_Header::step\_1()](../classes/custom_image_header/step_1) wp-admin/includes/class-custom-image-header.php | Display first step of custom header image page. |
| [Custom\_Image\_Header::step\_2()](../classes/custom_image_header/step_2) wp-admin/includes/class-custom-image-header.php | Display second step of custom header image page. |
| [Custom\_Image\_Header::step\_3()](../classes/custom_image_header/step_3) wp-admin/includes/class-custom-image-header.php | Display third step of custom header image page. |
| [Custom\_Image\_Header::js\_includes()](../classes/custom_image_header/js_includes) wp-admin/includes/class-custom-image-header.php | Set up the enqueue for the JavaScript files. |
| [Custom\_Image\_Header::css\_includes()](../classes/custom_image_header/css_includes) wp-admin/includes/class-custom-image-header.php | Set up the enqueue for the CSS files |
| [Custom\_Image\_Header::js()](../classes/custom_image_header/js) wp-admin/includes/class-custom-image-header.php | Execute JavaScript depending on step. |
| [Custom\_Image\_Header::js\_1()](../classes/custom_image_header/js_1) wp-admin/includes/class-custom-image-header.php | Display JavaScript based on Step 1 and 3. |
| [Custom\_Image\_Header::js\_2()](../classes/custom_image_header/js_2) wp-admin/includes/class-custom-image-header.php | Display JavaScript based on Step 2. |
| [Custom\_Background::admin\_page()](../classes/custom_background/admin_page) wp-admin/includes/class-custom-background.php | Displays the custom background page. |
| [WP\_Customize\_Manager::register\_controls()](../classes/wp_customize_manager/register_controls) wp-includes/class-wp-customize-manager.php | Registers some default controls. |
| [WP\_Styles::\_\_construct()](../classes/wp_styles/__construct) wp-includes/class-wp-styles.php | Constructor. |
| [wp\_customize\_support\_script()](wp_customize_support_script) wp-includes/theme.php | Prints a script to check whether or not the Customizer is supported, and apply either the no-customize-support or customize-support class to the body. |
| [\_custom\_background\_cb()](_custom_background_cb) wp-includes/theme.php | Default custom background callback. |
| [remove\_editor\_styles()](remove_editor_styles) wp-includes/theme.php | Removes all visual editor stylesheets. |
| [\_custom\_header\_background\_just\_in\_time()](_custom_header_background_just_in_time) wp-includes/theme.php | Registers the internal custom header and background routines. |
| [current\_theme\_supports()](current_theme_supports) wp-includes/theme.php | Checks a theme’s support for a given feature. |
| [require\_if\_theme\_supports()](require_if_theme_supports) wp-includes/theme.php | Checks a theme’s support for a given feature before loading the functions which implement it. |
| [display\_header\_text()](display_header_text) wp-includes/theme.php | Whether to display the header text. |
| [\_get\_random\_header\_data()](_get_random_header_data) wp-includes/theme.php | Gets random header image data from registered images in theme. |
| [get\_custom\_header()](get_custom_header) wp-includes/theme.php | Gets the header image data. |
| [locale\_stylesheet()](locale_stylesheet) wp-includes/theme.php | Displays localized stylesheet link element. |
| [feed\_links()](feed_links) wp-includes/general-template.php | Displays the links to the general feeds. |
| [get\_search\_form()](get_search_form) wp-includes/general-template.php | Displays search form. |
| [wp\_widgets\_add\_menu()](wp_widgets_add_menu) wp-includes/functions.php | Appends the Widgets menu to the themes main menu. |
| [WP\_Nav\_Menu\_Widget::widget()](../classes/wp_nav_menu_widget/widget) wp-includes/widgets/class-wp-nav-menu-widget.php | Outputs the content for the current Navigation Menu widget instance. |
| [WP\_Widget\_Tag\_Cloud::widget()](../classes/wp_widget_tag_cloud/widget) wp-includes/widgets/class-wp-widget-tag-cloud.php | Outputs the content for the current Tag Cloud widget instance. |
| [WP\_Widget\_RSS::widget()](../classes/wp_widget_rss/widget) wp-includes/widgets/class-wp-widget-rss.php | Outputs the content for the current RSS widget instance. |
| [WP\_Widget\_Recent\_Comments::recent\_comments\_style()](../classes/wp_widget_recent_comments/recent_comments_style) wp-includes/widgets/class-wp-widget-recent-comments.php | Outputs the default styles for the Recent Comments widget. |
| [WP\_Widget\_Recent\_Comments::widget()](../classes/wp_widget_recent_comments/widget) wp-includes/widgets/class-wp-widget-recent-comments.php | Outputs the content for the current Recent Comments widget instance. |
| [WP\_Widget\_Recent\_Posts::widget()](../classes/wp_widget_recent_posts/widget) wp-includes/widgets/class-wp-widget-recent-posts.php | Outputs the content for the current Recent Posts widget instance. |
| [WP\_Widget\_Categories::widget()](../classes/wp_widget_categories/widget) wp-includes/widgets/class-wp-widget-categories.php | Outputs the content for the current Categories widget instance. |
| [WP\_Widget\_Meta::widget()](../classes/wp_widget_meta/widget) wp-includes/widgets/class-wp-widget-meta.php | Outputs the content for the current Meta widget instance. |
| [WP\_Widget\_Archives::widget()](../classes/wp_widget_archives/widget) wp-includes/widgets/class-wp-widget-archives.php | Outputs the content for the current Archives widget instance. |
| [WP\_Widget\_Pages::widget()](../classes/wp_widget_pages/widget) wp-includes/widgets/class-wp-widget-pages.php | Outputs the content for the current Pages widget instance. |
| [WP\_Customize\_Section::check\_capabilities()](../classes/wp_customize_section/check_capabilities) wp-includes/class-wp-customize-section.php | Checks required user capabilities and whether the theme has the feature support required by the section. |
| [create\_initial\_taxonomies()](create_initial_taxonomies) wp-includes/taxonomy.php | Creates the initial taxonomies. |
| [WP\_Admin\_Bar::initialize()](../classes/wp_admin_bar/initialize) wp-includes/class-wp-admin-bar.php | Initializes the admin bar. |
| [wp\_admin\_bar\_appearance\_menu()](wp_admin_bar_appearance_menu) wp-includes/admin-bar.php | Adds appearance submenu items to the “Site Name” menu. |
| [wp\_admin\_bar\_header()](wp_admin_bar_header) wp-includes/admin-bar.php | Prints style and scripts for the admin bar. |
| [\_admin\_bar\_bump\_cb()](_admin_bar_bump_cb) wp-includes/admin-bar.php | Prints default admin bar callback. |
| [WP\_Customize\_Setting::check\_capabilities()](../classes/wp_customize_setting/check_capabilities) wp-includes/class-wp-customize-setting.php | Validate user capabilities whether the theme supports the setting. |
| [get\_post\_class()](get_post_class) wp-includes/post-template.php | Retrieves an array of the class names for the post container element. |
| [get\_body\_class()](get_body_class) wp-includes/post-template.php | Retrieves an array of the class names for the body element. |
| [wp\_enqueue\_media()](wp_enqueue_media) wp-includes/media.php | Enqueues all scripts, styles, settings, and templates necessary to use all media JS APIs. |
| [gallery\_shortcode()](gallery_shortcode) wp-includes/media.php | Builds the Gallery shortcode output. |
| [img\_caption\_shortcode()](img_caption_shortcode) wp-includes/media.php | Builds the Caption shortcode output. |
| [wp\_insert\_post()](wp_insert_post) wp-includes/post.php | Inserts or update a post. |
| [WP\_Scripts::init()](../classes/wp_scripts/init) wp-includes/class-wp-scripts.php | Initialize the class. |
| [wp\_xmlrpc\_server::wp\_getPostFormats()](../classes/wp_xmlrpc_server/wp_getpostformats) wp-includes/class-wp-xmlrpc-server.php | Retrieves a list of post formats used by the site. |
| [wp\_xmlrpc\_server::\_prepare\_post()](../classes/wp_xmlrpc_server/_prepare_post) wp-includes/class-wp-xmlrpc-server.php | Prepares post data for return in an XML-RPC object. |
| [wp\_xmlrpc\_server::initialise\_blog\_option\_info()](../classes/wp_xmlrpc_server/initialise_blog_option_info) wp-includes/class-wp-xmlrpc-server.php | Set up blog options property. |
| [WP\_Customize\_Header\_Image\_Control::render\_content()](../classes/wp_customize_header_image_control/render_content) wp-includes/customize/class-wp-customize-header-image-control.php | |
| [wp\_list\_comments()](wp_list_comments) wp-includes/comment-template.php | Displays a list of comments. |
| [comment\_form()](comment_form) wp-includes/comment-template.php | Outputs a complete commenting form for use within a template. |
| [WP\_Customize\_Widgets::get\_setting\_args()](../classes/wp_customize_widgets/get_setting_args) wp-includes/class-wp-customize-widgets.php | Retrieves common arguments to supply when constructing a Customizer setting. |
| Version | Description |
| --- | --- |
| [5.3.0](https://developer.wordpress.org/reference/since/5.3.0/) | Formalized the existing and already documented `...$args` parameter by adding it to the function signature. |
| [2.9.0](https://developer.wordpress.org/reference/since/2.9.0/) | Introduced. |
| programming_docs |
wordpress preview_theme_ob_filter_callback( array $matches ): string preview\_theme\_ob\_filter\_callback( array $matches ): string
==============================================================
This function has been deprecated.
This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.
Manipulates preview theme links in order to control and maintain location.
Callback function for preg\_replace\_callback() to accept and filter matches.
`$matches` array Required string
File: `wp-includes/deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/deprecated.php/)
```
function preview_theme_ob_filter_callback( $matches ) {
_deprecated_function( __FUNCTION__, '4.3.0' );
return '';
}
```
| Uses | Description |
| --- | --- |
| [\_deprecated\_function()](_deprecated_function) wp-includes/functions.php | Marks a function as deprecated and inform when it has been used. |
| Version | Description |
| --- | --- |
| [4.3.0](https://developer.wordpress.org/reference/since/4.3.0/) | This function has been deprecated. |
| [2.6.0](https://developer.wordpress.org/reference/since/2.6.0/) | Introduced. |
wordpress wp_tag_cloud( array|string $args = '' ): void|string|string[] wp\_tag\_cloud( array|string $args = '' ): void|string|string[]
===============================================================
Displays a tag cloud.
Outputs 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.
`$args` array|string Optional Array or string of arguments for displaying a tag cloud. See [wp\_generate\_tag\_cloud()](wp_generate_tag_cloud) and [get\_terms()](get_terms) for the full lists of arguments that can be passed in `$args`.
* `number`intThe number of tags to display. Accepts any positive integer or zero to return all. Default 45.
* `link`stringWhether to display term editing links or term permalinks.
Accepts `'edit'` and `'view'`. Default `'view'`.
* `post_type`stringThe post type. Used to highlight the proper post type menu on the linked edit page. Defaults to the first post type associated with the taxonomy.
* `echo`boolWhether or not to echo the return value. Default true.
More Arguments from wp\_generate\_tag\_cloud( ... $args ) Array or string of arguments for generating a tag cloud.
* `smallest`intSmallest font size used to display tags. Paired with the value of `$unit`, to determine CSS text size unit. Default 8 (pt).
* `largest`intLargest font size used to display tags. Paired with the value of `$unit`, to determine CSS text size unit. Default 22 (pt).
* `unit`stringCSS text size unit to use with the `$smallest` and `$largest` values. Accepts any valid CSS text size unit. Default `'pt'`.
* `number`intThe number of tags to return. Accepts any positive integer or zero to return all.
Default 0.
* `format`stringFormat to display the tag cloud in. Accepts `'flat'` (tags separated with spaces), `'list'` (tags displayed in an unordered list), or `'array'` (returns an array).
Default `'flat'`.
* `separator`stringHTML or text to separate the tags. Default "n" (newline).
* `orderby`stringValue to order tags by. Accepts `'name'` or `'count'`.
Default `'name'`. The ['tag\_cloud\_sort'](../hooks/tag_cloud_sort) filter can also affect how tags are sorted.
* `order`stringHow to order the tags. Accepts `'ASC'` (ascending), `'DESC'` (descending), or `'RAND'` (random). Default `'ASC'`.
* `filter`int|boolWhether to enable filtering of the final output via ['wp\_generate\_tag\_cloud'](../hooks/wp_generate_tag_cloud). Default 1.
* `topic_count_text`arrayNooped plural text from [\_n\_noop()](_n_noop) to supply to tag counts. Default null.
* `topic_count_text_callback`callableCallback used to generate nooped plural text for tag counts based on the count. Default null.
* `topic_count_scale_callback`callableCallback used to determine the tag count scaling value. Default [default\_topic\_count\_scale()](default_topic_count_scale) .
* `show_count`bool|intWhether to display the tag counts. Default 0. Accepts 0, 1, or their bool equivalents.
Default: `''`
void|string|string[] Void if `'echo'` argument is true, or on failure. Otherwise, tag cloud as a string or an array, depending on `'format'` argument.
File: `wp-includes/category-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/category-template.php/)
```
function wp_tag_cloud( $args = '' ) {
$defaults = array(
'smallest' => 8,
'largest' => 22,
'unit' => 'pt',
'number' => 45,
'format' => 'flat',
'separator' => "\n",
'orderby' => 'name',
'order' => 'ASC',
'exclude' => '',
'include' => '',
'link' => 'view',
'taxonomy' => 'post_tag',
'post_type' => '',
'echo' => true,
'show_count' => 0,
);
$args = wp_parse_args( $args, $defaults );
$tags = get_terms(
array_merge(
$args,
array(
'orderby' => 'count',
'order' => 'DESC',
)
)
); // Always query top tags.
if ( empty( $tags ) || is_wp_error( $tags ) ) {
return;
}
foreach ( $tags as $key => $tag ) {
if ( 'edit' === $args['link'] ) {
$link = get_edit_term_link( $tag, $tag->taxonomy, $args['post_type'] );
} else {
$link = get_term_link( $tag, $tag->taxonomy );
}
if ( is_wp_error( $link ) ) {
return;
}
$tags[ $key ]->link = $link;
$tags[ $key ]->id = $tag->term_id;
}
// Here's where those top tags get sorted according to $args.
$return = wp_generate_tag_cloud( $tags, $args );
/**
* Filters the tag cloud output.
*
* @since 2.3.0
*
* @param string|string[] $return Tag cloud as a string or an array, depending on 'format' argument.
* @param array $args An array of tag cloud arguments. See wp_tag_cloud()
* for information on accepted arguments.
*/
$return = apply_filters( 'wp_tag_cloud', $return, $args );
if ( 'array' === $args['format'] || empty( $args['echo'] ) ) {
return $return;
}
echo $return;
}
```
[apply\_filters( 'wp\_tag\_cloud', string|string[] $return, array $args )](../hooks/wp_tag_cloud)
Filters the tag cloud output.
| Uses | Description |
| --- | --- |
| [wp\_generate\_tag\_cloud()](wp_generate_tag_cloud) wp-includes/category-template.php | Generates a tag cloud (heatmap) from provided data. |
| [get\_term\_link()](get_term_link) wp-includes/taxonomy.php | Generates a permalink for a taxonomy term archive. |
| [get\_terms()](get_terms) wp-includes/taxonomy.php | Retrieves the terms in a given taxonomy or list of taxonomies. |
| [get\_edit\_term\_link()](get_edit_term_link) wp-includes/link-template.php | Retrieves the URL for editing a given term. |
| [wp\_parse\_args()](wp_parse_args) wp-includes/functions.php | Merges user defined arguments into defaults array. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| [is\_wp\_error()](is_wp_error) wp-includes/load.php | Checks whether the given variable is a WordPress Error. |
| Used By | Description |
| --- | --- |
| [WP\_Widget\_Tag\_Cloud::widget()](../classes/wp_widget_tag_cloud/widget) wp-includes/widgets/class-wp-widget-tag-cloud.php | Outputs the content for the current Tag Cloud widget instance. |
| Version | Description |
| --- | --- |
| [4.8.0](https://developer.wordpress.org/reference/since/4.8.0/) | Added the `show_count` argument. |
| [2.8.0](https://developer.wordpress.org/reference/since/2.8.0/) | Added the `taxonomy` argument. |
| [2.3.0](https://developer.wordpress.org/reference/since/2.3.0/) | Introduced. |
wordpress get_wp_title_rss( string $deprecated = '–' ): string get\_wp\_title\_rss( string $deprecated = '–' ): string
=======================================================
Retrieves the blog title for the feed title.
`$deprecated` string Optional Unused. Default: `'–'`
string The document title.
File: `wp-includes/feed.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/feed.php/)
```
function get_wp_title_rss( $deprecated = '–' ) {
if ( '–' !== $deprecated ) {
/* translators: %s: 'document_title_separator' filter name. */
_deprecated_argument( __FUNCTION__, '4.4.0', sprintf( __( 'Use the %s filter instead.' ), '<code>document_title_separator</code>' ) );
}
/**
* Filters the blog title for use as the feed title.
*
* @since 2.2.0
* @since 4.4.0 The `$sep` parameter was deprecated and renamed to `$deprecated`.
*
* @param string $title The current blog title.
* @param string $deprecated Unused.
*/
return apply_filters( 'get_wp_title_rss', wp_get_document_title(), $deprecated );
}
```
[apply\_filters( 'get\_wp\_title\_rss', string $title, string $deprecated )](../hooks/get_wp_title_rss)
Filters the blog title for use as the feed title.
| Uses | Description |
| --- | --- |
| [wp\_get\_document\_title()](wp_get_document_title) wp-includes/general-template.php | Returns document title for the current page. |
| [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. |
| [\_deprecated\_argument()](_deprecated_argument) wp-includes/functions.php | Marks a function argument as deprecated and inform when it has been used. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| Used By | Description |
| --- | --- |
| [rss2\_site\_icon()](rss2_site_icon) wp-includes/feed.php | Displays Site Icon in RSS2. |
| [wp\_title\_rss()](wp_title_rss) wp-includes/feed.php | Displays the blog title for display of the feed title. |
| Version | Description |
| --- | --- |
| [4.4.0](https://developer.wordpress.org/reference/since/4.4.0/) | The optional `$sep` parameter was deprecated and renamed to `$deprecated`. |
| [2.2.0](https://developer.wordpress.org/reference/since/2.2.0/) | Introduced. |
wordpress wp_delete_category( int $cat_ID ): bool|int|WP_Error wp\_delete\_category( int $cat\_ID ): bool|int|WP\_Error
========================================================
Deletes one existing category.
`$cat_ID` int Required Category term ID. bool|int|[WP\_Error](../classes/wp_error) Returns true if completes delete action; false if term doesn't exist; Zero on attempted deletion of default Category; [WP\_Error](../classes/wp_error) object is also a possibility.
File: `wp-includes/taxonomy.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/taxonomy.php/)
```
function wp_delete_category( $cat_ID ) {
return wp_delete_term( $cat_ID, 'category' );
}
```
| Uses | Description |
| --- | --- |
| [wp\_delete\_term()](wp_delete_term) wp-includes/taxonomy.php | Removes a term from the database. |
| Version | Description |
| --- | --- |
| [2.0.0](https://developer.wordpress.org/reference/since/2.0.0/) | Introduced. |
wordpress wp_nonce_url( string $actionurl, int|string $action = -1, string $name = '_wpnonce' ): string wp\_nonce\_url( string $actionurl, int|string $action = -1, string $name = '\_wpnonce' ): string
================================================================================================
Retrieves URL with nonce added to URL query.
`$actionurl` string Required URL to add nonce action. `$action` int|string Optional Nonce action name. Default: `-1`
`$name` string Optional Nonce name. Default `'_wpnonce'`. Default: `'_wpnonce'`
string Escaped URL with nonce action added.
File: `wp-includes/functions.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/functions.php/)
```
function wp_nonce_url( $actionurl, $action = -1, $name = '_wpnonce' ) {
$actionurl = str_replace( '&', '&', $actionurl );
return esc_html( add_query_arg( $name, wp_create_nonce( $action ), $actionurl ) );
}
```
| Uses | Description |
| --- | --- |
| [wp\_create\_nonce()](wp_create_nonce) wp-includes/pluggable.php | Creates a cryptographic token tied to a specific action, user, user session, and window of time. |
| [esc\_html()](esc_html) wp-includes/formatting.php | Escaping for HTML blocks. |
| [add\_query\_arg()](add_query_arg) wp-includes/functions.php | Retrieves a modified URL query string. |
| Used By | Description |
| --- | --- |
| [core\_auto\_updates\_settings()](core_auto_updates_settings) wp-admin/update-core.php | Display WordPress auto-updates settings. |
| [Plugin\_Installer\_Skin::do\_overwrite()](../classes/plugin_installer_skin/do_overwrite) wp-admin/includes/class-plugin-installer-skin.php | Check if the plugin can be overwritten and output the HTML for overwriting a plugin on upload. |
| [Theme\_Installer\_Skin::do\_overwrite()](../classes/theme_installer_skin/do_overwrite) wp-admin/includes/class-theme-installer-skin.php | Check if the theme can be overwritten and output the HTML for overwriting a theme on upload. |
| [WP\_MS\_Themes\_List\_Table::column\_autoupdates()](../classes/wp_ms_themes_list_table/column_autoupdates) wp-admin/includes/class-wp-ms-themes-list-table.php | Handles the auto-updates column output. |
| [WP\_Privacy\_Data\_Removal\_Requests\_List\_Table::column\_email()](../classes/wp_privacy_data_removal_requests_list_table/column_email) wp-admin/includes/class-wp-privacy-data-removal-requests-list-table.php | Actions column. |
| [WP\_Privacy\_Data\_Removal\_Requests\_List\_Table::column\_next\_steps()](../classes/wp_privacy_data_removal_requests_list_table/column_next_steps) wp-admin/includes/class-wp-privacy-data-removal-requests-list-table.php | Next steps column. |
| [WP\_Privacy\_Data\_Export\_Requests\_List\_Table::column\_email()](../classes/wp_privacy_data_export_requests_list_table/column_email) wp-admin/includes/class-wp-privacy-data-export-requests-list-table.php | Actions column. |
| [WP\_Privacy\_Data\_Export\_Requests\_List\_Table::column\_next\_steps()](../classes/wp_privacy_data_export_requests_list_table/column_next_steps) wp-admin/includes/class-wp-privacy-data-export-requests-list-table.php | Displays the next steps column. |
| [wp\_admin\_bar\_recovery\_mode\_menu()](wp_admin_bar_recovery_mode_menu) wp-includes/admin-bar.php | Adds a link to exit recovery mode when Recovery Mode is active. |
| [wp\_recovery\_mode\_nag()](wp_recovery_mode_nag) wp-admin/includes/update.php | Displays a notice when the user is in recovery mode. |
| [WP\_Site\_Health::get\_test\_https\_status()](../classes/wp_site_health/get_test_https_status) wp-admin/includes/class-wp-site-health.php | Tests if the site is serving content over HTTPS. |
| [do\_block\_editor\_incompatible\_meta\_box()](do_block_editor_incompatible_meta_box) wp-admin/includes/template.php | Renders a “fake” meta box with an information message, shown on the block editor, when an incompatible meta box is found. |
| [wp\_load\_press\_this()](wp_load_press_this) wp-admin/press-this.php | |
| [wp\_ajax\_delete\_plugin()](wp_ajax_delete_plugin) wp-admin/includes/ajax-actions.php | Ajax handler for deleting a plugin. |
| [wp\_ajax\_delete\_theme()](wp_ajax_delete_theme) wp-admin/includes/ajax-actions.php | Ajax handler for deleting a theme. |
| [WP\_Posts\_List\_Table::handle\_row\_actions()](../classes/wp_posts_list_table/handle_row_actions) wp-admin/includes/class-wp-posts-list-table.php | Generates and displays row action links. |
| [WP\_Links\_List\_Table::handle\_row\_actions()](../classes/wp_links_list_table/handle_row_actions) wp-admin/includes/class-wp-links-list-table.php | Generates and displays row action links. |
| [WP\_MS\_Themes\_List\_Table::column\_name()](../classes/wp_ms_themes_list_table/column_name) wp-admin/includes/class-wp-ms-themes-list-table.php | Handles the name column output. |
| [WP\_MS\_Sites\_List\_Table::handle\_row\_actions()](../classes/wp_ms_sites_list_table/handle_row_actions) wp-admin/includes/class-wp-ms-sites-list-table.php | Generates and displays row action links. |
| [WP\_Terms\_List\_Table::handle\_row\_actions()](../classes/wp_terms_list_table/handle_row_actions) wp-admin/includes/class-wp-terms-list-table.php | Generates and displays row action links. |
| [WP\_MS\_Users\_List\_Table::handle\_row\_actions()](../classes/wp_ms_users_list_table/handle_row_actions) wp-admin/includes/class-wp-ms-users-list-table.php | Generates and displays row action links. |
| [wp\_prepare\_themes\_for\_js()](wp_prepare_themes_for_js) wp-admin/includes/theme.php | Prepares themes for JavaScript. |
| [delete\_theme()](delete_theme) wp-admin/includes/theme.php | Removes a theme. |
| [get\_theme\_update\_available()](get_theme_update_available) wp-admin/includes/theme.php | Retrieves the update link if there is a theme update available. |
| [WP\_Plugins\_List\_Table::single\_row()](../classes/wp_plugins_list_table/single_row) wp-admin/includes/class-wp-plugins-list-table.php | |
| [Theme\_Upgrader\_Skin::after()](../classes/theme_upgrader_skin/after) wp-admin/includes/class-theme-upgrader-skin.php | Action to perform following a single theme update. |
| [Plugin\_Installer\_Skin::after()](../classes/plugin_installer_skin/after) wp-admin/includes/class-plugin-installer-skin.php | Action to perform following a plugin install. |
| [Theme\_Installer\_Skin::after()](../classes/theme_installer_skin/after) wp-admin/includes/class-theme-installer-skin.php | Action to perform following a single theme install. |
| [Plugin\_Upgrader\_Skin::after()](../classes/plugin_upgrader_skin/after) wp-admin/includes/class-plugin-upgrader-skin.php | Action to perform following a single plugin update. |
| [WP\_Upgrader\_Skin::request\_filesystem\_credentials()](../classes/wp_upgrader_skin/request_filesystem_credentials) wp-admin/includes/class-wp-upgrader-skin.php | Displays a form to the user to request for their FTP/SSH details in order to connect to the filesystem. |
| [WP\_Theme\_Install\_List\_Table::install\_theme\_info()](../classes/wp_theme_install_list_table/install_theme_info) wp-admin/includes/class-wp-theme-install-list-table.php | Prints the info for a theme (to be used in the theme installer modal). |
| [WP\_Theme\_Install\_List\_Table::single\_row()](../classes/wp_theme_install_list_table/single_row) wp-admin/includes/class-wp-theme-install-list-table.php | Prints a theme from the WordPress.org API. |
| [wp\_plugin\_update\_row()](wp_plugin_update_row) wp-admin/includes/update.php | Displays update information for a plugin. |
| [wp\_theme\_update\_row()](wp_theme_update_row) wp-admin/includes/update.php | Displays update information for a theme. |
| [install\_plugin\_install\_status()](install_plugin_install_status) wp-admin/includes/plugin-install.php | Determines the status we can perform on a plugin. |
| [wp\_dashboard\_plugins\_output()](wp_dashboard_plugins_output) wp-admin/includes/deprecated.php | Display plugins text for the WordPress news widget. |
| [delete\_plugins()](delete_plugins) wp-admin/includes/plugin.php | Removes directory and files of a plugin for a list of plugins. |
| [wp\_import\_upload\_form()](wp_import_upload_form) wp-admin/includes/template.php | Outputs the form used by the importers to accept the data to be imported. |
| [WP\_Themes\_List\_Table::display\_rows()](../classes/wp_themes_list_table/display_rows) wp-admin/includes/class-wp-themes-list-table.php | |
| [WP\_Users\_List\_Table::single\_row()](../classes/wp_users_list_table/single_row) wp-admin/includes/class-wp-users-list-table.php | Generate HTML for a single row on the users.php admin panel. |
| [get\_media\_item()](get_media_item) wp-admin/includes/media.php | Retrieves HTML form for modifying the image attachment. |
| [\_admin\_notice\_post\_locked()](_admin_notice_post_locked) wp-admin/includes/post.php | Outputs the HTML for the notice to say that someone else is editing or has taken over editing of this post. |
| [wp\_prepare\_revisions\_for\_js()](wp_prepare_revisions_for_js) wp-admin/includes/revision.php | Prepare revisions for JavaScript. |
| [link\_submit\_meta\_box()](link_submit_meta_box) wp-admin/includes/meta-boxes.php | Displays link create form fields. |
| [wp\_link\_manager\_disabled\_message()](wp_link_manager_disabled_message) wp-admin/includes/bookmark.php | Outputs the ‘disabled’ message for the WordPress Link Manager. |
| [WP\_Media\_List\_Table::\_get\_row\_actions()](../classes/wp_media_list_table/_get_row_actions) wp-admin/includes/class-wp-media-list-table.php | |
| [Walker\_Nav\_Menu\_Edit::start\_el()](../classes/walker_nav_menu_edit/start_el) wp-admin/includes/class-walker-nav-menu-edit.php | Start the element output. |
| [do\_core\_upgrade()](do_core_upgrade) wp-admin/update-core.php | Upgrade WordPress core display. |
| [do\_dismiss\_core\_update()](do_dismiss_core_update) wp-admin/update-core.php | Dismiss a core update. |
| [do\_undismiss\_core\_update()](do_undismiss_core_update) wp-admin/update-core.php | Undismiss a core update. |
| [wp\_logout\_url()](wp_logout_url) wp-includes/general-template.php | Retrieves the logout URL. |
| [get\_delete\_post\_link()](get_delete_post_link) wp-includes/link-template.php | Retrieves the delete posts link for post. |
| Version | Description |
| --- | --- |
| [2.0.4](https://developer.wordpress.org/reference/since/2.0.4/) | Introduced. |
| programming_docs |
wordpress update_postmeta_cache( int[] $post_ids ): array|false update\_postmeta\_cache( int[] $post\_ids ): array|false
========================================================
Updates metadata cache for a 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.
`$post_ids` int[] Required Array of post IDs. array|false An array of metadata on success, false if there is nothing to update.
File: `wp-includes/post.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/post.php/)
```
function update_postmeta_cache( $post_ids ) {
return update_meta_cache( 'post', $post_ids );
}
```
| Uses | Description |
| --- | --- |
| [update\_meta\_cache()](update_meta_cache) wp-includes/meta.php | Updates the metadata cache for the specified objects. |
| Used By | Description |
| --- | --- |
| [update\_post\_caches()](update_post_caches) wp-includes/post.php | Updates post, term, and metadata caches for a list of post objects. |
| Version | Description |
| --- | --- |
| [2.1.0](https://developer.wordpress.org/reference/since/2.1.0/) | Introduced. |
wordpress drop_index( string $table, string $index ): true drop\_index( string $table, string $index ): true
=================================================
Drops a specified index from a table.
`$table` string Required Database table name. `$index` string Required Index name to drop. true True, when finished.
File: `wp-admin/includes/upgrade.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/upgrade.php/)
```
function drop_index( $table, $index ) {
global $wpdb;
$wpdb->hide_errors();
$wpdb->query( "ALTER TABLE `$table` DROP INDEX `$index`" );
// Now we need to take out all the extra ones we may have created.
for ( $i = 0; $i < 25; $i++ ) {
$wpdb->query( "ALTER TABLE `$table` DROP INDEX `{$index}_$i`" );
}
$wpdb->show_errors();
return true;
}
```
| Uses | Description |
| --- | --- |
| [wpdb::query()](../classes/wpdb/query) wp-includes/class-wpdb.php | Performs a database query, using current database connection. |
| [wpdb::hide\_errors()](../classes/wpdb/hide_errors) wp-includes/class-wpdb.php | Disables showing of database errors. |
| [wpdb::show\_errors()](../classes/wpdb/show_errors) wp-includes/class-wpdb.php | Enables showing of database errors. |
| Used By | Description |
| --- | --- |
| [add\_clean\_index()](add_clean_index) wp-admin/includes/upgrade.php | Adds an index to a specified table. |
| Version | Description |
| --- | --- |
| [1.0.1](https://developer.wordpress.org/reference/since/1.0.1/) | Introduced. |
wordpress _split_str_by_whitespace( string $string, int $goal ): array \_split\_str\_by\_whitespace( string $string, int $goal ): array
================================================================
This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.
Breaks a string into chunks by splitting at whitespace characters.
The length of each returned chunk is as close to the specified length goal as possible, with the caveat that each chunk includes its trailing delimiter.
Chunks longer than the goal are guaranteed to not have any inner whitespace.
Joining the returned chunks with empty delimiters reconstructs the input string losslessly.
Input string must have no null characters (or eventual transformations on output chunks must not care about null characters)
```
_split_str_by_whitespace( "1234 67890 1234 67890a cd 1234 890 123456789 1234567890a 45678 1 3 5 7 90 ", 10 ) ==
array (
0 => '1234 67890 ', // 11 characters: Perfect split.
1 => '1234 ', // 5 characters: '1234 67890a' was too long.
2 => '67890a cd ', // 10 characters: '67890a cd 1234' was too long.
3 => '1234 890 ', // 11 characters: Perfect split.
4 => '123456789 ', // 10 characters: '123456789 1234567890a' was too long.
5 => '1234567890a ', // 12 characters: Too long, but no inner whitespace on which to split.
6 => ' 45678 ', // 11 characters: Perfect split.
7 => '1 3 5 7 90 ', // 11 characters: End of $string.
);
```
`$string` string Required The string to split. `$goal` int Required The desired chunk length. array Numeric array of chunks.
File: `wp-includes/formatting.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/formatting.php/)
```
function _split_str_by_whitespace( $string, $goal ) {
$chunks = array();
$string_nullspace = strtr( $string, "\r\n\t\v\f ", "\000\000\000\000\000\000" );
while ( $goal < strlen( $string_nullspace ) ) {
$pos = strrpos( substr( $string_nullspace, 0, $goal + 1 ), "\000" );
if ( false === $pos ) {
$pos = strpos( $string_nullspace, "\000", $goal + 1 );
if ( false === $pos ) {
break;
}
}
$chunks[] = substr( $string, 0, $pos + 1 );
$string = substr( $string, $pos + 1 );
$string_nullspace = substr( $string_nullspace, $pos + 1 );
}
if ( $string ) {
$chunks[] = $string;
}
return $chunks;
}
```
| Used By | Description |
| --- | --- |
| [make\_clickable()](make_clickable) wp-includes/formatting.php | Converts plaintext URI to HTML links. |
| Version | Description |
| --- | --- |
| [3.4.0](https://developer.wordpress.org/reference/since/3.4.0/) | Introduced. |
wordpress is_header_video_active(): bool is\_header\_video\_active(): bool
=================================
Checks whether the custom header video is eligible to show on the current page.
bool True if the custom header video should be shown. False if not.
File: `wp-includes/theme.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/theme.php/)
```
function is_header_video_active() {
if ( ! get_theme_support( 'custom-header', 'video' ) ) {
return false;
}
$video_active_cb = get_theme_support( 'custom-header', 'video-active-callback' );
if ( empty( $video_active_cb ) || ! is_callable( $video_active_cb ) ) {
$show_video = true;
} else {
$show_video = call_user_func( $video_active_cb );
}
/**
* Filters whether the custom header video is eligible to show on the current page.
*
* @since 4.7.0
*
* @param bool $show_video Whether the custom header video should be shown. Returns the value
* of the theme setting for the `custom-header`'s `video-active-callback`.
* If no callback is set, the default value is that of `is_front_page()`.
*/
return apply_filters( 'is_header_video_active', $show_video );
}
```
[apply\_filters( 'is\_header\_video\_active', bool $show\_video )](../hooks/is_header_video_active)
Filters whether the custom header video is eligible to show on the current page.
| Uses | Description |
| --- | --- |
| [get\_theme\_support()](get_theme_support) wp-includes/theme.php | Gets the theme support arguments passed when registering that support. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| Used By | Description |
| --- | --- |
| [the\_custom\_header\_markup()](the_custom_header_markup) wp-includes/theme.php | Prints the markup for a custom header. |
| [has\_custom\_header()](has_custom_header) wp-includes/theme.php | Checks whether a custom header is set or not. |
| Version | Description |
| --- | --- |
| [4.7.0](https://developer.wordpress.org/reference/since/4.7.0/) | Introduced. |
wordpress wp_underscore_audio_template() wp\_underscore\_audio\_template()
=================================
Outputs the markup for a audio tag to be used in an Underscore template when data.model is passed.
File: `wp-includes/media-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/media-template.php/)
```
function wp_underscore_audio_template() {
$audio_types = wp_get_audio_extensions();
?>
<audio style="visibility: hidden"
controls
class="wp-audio-shortcode"
width="{{ _.isUndefined( data.model.width ) ? 400 : data.model.width }}"
preload="{{ _.isUndefined( data.model.preload ) ? 'none' : data.model.preload }}"
<#
<?php
foreach ( array( 'autoplay', 'loop' ) as $attr ) :
?>
if ( ! _.isUndefined( data.model.<?php echo $attr; ?> ) && data.model.<?php echo $attr; ?> ) {
#> <?php echo $attr; ?><#
}
<?php endforeach; ?>#>
>
<# if ( ! _.isEmpty( data.model.src ) ) { #>
<source src="{{ data.model.src }}" type="{{ wp.media.view.settings.embedMimes[ data.model.src.split('.').pop() ] }}" />
<# } #>
<?php
foreach ( $audio_types as $type ) :
?>
<# if ( ! _.isEmpty( data.model.<?php echo $type; ?> ) ) { #>
<source src="{{ data.model.<?php echo $type; ?> }}" type="{{ wp.media.view.settings.embedMimes[ '<?php echo $type; ?>' ] }}" />
<# } #>
<?php
endforeach;
?>
</audio>
<?php
}
```
| Uses | Description |
| --- | --- |
| [wp\_get\_audio\_extensions()](wp_get_audio_extensions) wp-includes/media.php | Returns a filtered list of supported audio formats. |
| Used By | Description |
| --- | --- |
| [WP\_Widget\_Media\_Audio::render\_control\_template\_scripts()](../classes/wp_widget_media_audio/render_control_template_scripts) wp-includes/widgets/class-wp-widget-media-audio.php | Render form template scripts. |
| [wp\_print\_media\_templates()](wp_print_media_templates) wp-includes/media-template.php | Prints the templates used in the media manager. |
| Version | Description |
| --- | --- |
| [3.9.0](https://developer.wordpress.org/reference/since/3.9.0/) | Introduced. |
wordpress wp_using_ext_object_cache( bool $using = null ): bool wp\_using\_ext\_object\_cache( bool $using = null ): bool
=========================================================
Toggle `$_wp_using_ext_object_cache` on and off without directly touching global.
`$using` bool Optional Whether external object cache is being used. Default: `null`
bool The current `'using'` setting.
File: `wp-includes/load.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/load.php/)
```
function wp_using_ext_object_cache( $using = null ) {
global $_wp_using_ext_object_cache;
$current_using = $_wp_using_ext_object_cache;
if ( null !== $using ) {
$_wp_using_ext_object_cache = $using;
}
return $current_using;
}
```
| Used By | Description |
| --- | --- |
| [WP\_Site\_Health::get\_test\_persistent\_object\_cache()](../classes/wp_site_health/get_test_persistent_object_cache) wp-admin/includes/class-wp-site-health.php | Tests if the site uses persistent object cache and recommends to use it if not. |
| [delete\_expired\_transients()](delete_expired_transients) wp-includes/option.php | Deletes all expired transients. |
| [WP\_Network::get\_by\_path()](../classes/wp_network/get_by_path) wp-includes/class-wp-network.php | Retrieves the closest matching network for a domain and path. |
| [wp\_start\_object\_cache()](wp_start_object_cache) wp-includes/load.php | Start the WordPress object cache. |
| [set\_site\_transient()](set_site_transient) wp-includes/option.php | Sets/updates the value of a site transient. |
| [delete\_site\_transient()](delete_site_transient) wp-includes/option.php | Deletes a site transient. |
| [get\_site\_transient()](get_site_transient) wp-includes/option.php | Retrieves the value of a site transient. |
| [get\_transient()](get_transient) wp-includes/option.php | Retrieves the value of a transient. |
| [set\_transient()](set_transient) wp-includes/option.php | Sets/updates the value of a transient. |
| [wp\_load\_core\_site\_options()](wp_load_core_site_options) wp-includes/option.php | Loads and caches certain often requested site options if [is\_multisite()](is_multisite) and a persistent cache is not being used. |
| [delete\_transient()](delete_transient) wp-includes/option.php | Deletes a transient. |
| Version | Description |
| --- | --- |
| [3.7.0](https://developer.wordpress.org/reference/since/3.7.0/) | Introduced. |
wordpress wp_rel_nofollow( string $text ): string wp\_rel\_nofollow( string $text ): string
=========================================
Adds `rel="nofollow"` string to all HTML A elements in content.
`$text` string Required Content that may contain HTML A elements. string Converted content.
File: `wp-includes/formatting.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/formatting.php/)
```
function wp_rel_nofollow( $text ) {
// This is a pre-save filter, so text is already escaped.
$text = stripslashes( $text );
$text = preg_replace_callback(
'|<a (.+?)>|i',
static function( $matches ) {
return wp_rel_callback( $matches, 'nofollow' );
},
$text
);
return wp_slash( $text );
}
```
| Uses | Description |
| --- | --- |
| [wp\_rel\_callback()](wp_rel_callback) wp-includes/formatting.php | Callback to add a rel attribute to HTML A element. |
| [wp\_slash()](wp_slash) wp-includes/formatting.php | Adds slashes to a string or recursively adds slashes to strings within an array. |
| Version | Description |
| --- | --- |
| [1.5.0](https://developer.wordpress.org/reference/since/1.5.0/) | Introduced. |
wordpress get_the_title_rss(): string get\_the\_title\_rss(): string
==============================
Retrieves the current post title for the feed.
string Current post title.
File: `wp-includes/feed.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/feed.php/)
```
function get_the_title_rss() {
$title = get_the_title();
/**
* Filters the post title for use in a feed.
*
* @since 1.2.0
*
* @param string $title The current post title.
*/
return apply_filters( 'the_title_rss', $title );
}
```
[apply\_filters( 'the\_title\_rss', string $title )](../hooks/the_title_rss)
Filters the post title for use in a feed.
| Uses | Description |
| --- | --- |
| [get\_the\_title()](get_the_title) wp-includes/post-template.php | Retrieves the post title. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| Used By | Description |
| --- | --- |
| [the\_title\_rss()](the_title_rss) wp-includes/feed.php | Displays the post title in the feed. |
| Version | Description |
| --- | --- |
| [2.0.0](https://developer.wordpress.org/reference/since/2.0.0/) | Introduced. |
wordpress wp_ajax_wp_link_ajax() wp\_ajax\_wp\_link\_ajax()
==========================
Ajax handler for internal linking.
File: `wp-admin/includes/ajax-actions.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/ajax-actions.php/)
```
function wp_ajax_wp_link_ajax() {
check_ajax_referer( 'internal-linking', '_ajax_linking_nonce' );
$args = array();
if ( isset( $_POST['search'] ) ) {
$args['s'] = wp_unslash( $_POST['search'] );
}
if ( isset( $_POST['term'] ) ) {
$args['s'] = wp_unslash( $_POST['term'] );
}
$args['pagenum'] = ! empty( $_POST['page'] ) ? absint( $_POST['page'] ) : 1;
if ( ! class_exists( '_WP_Editors', false ) ) {
require ABSPATH . WPINC . '/class-wp-editor.php';
}
$results = _WP_Editors::wp_link_query( $args );
if ( ! isset( $results ) ) {
wp_die( 0 );
}
echo wp_json_encode( $results );
echo "\n";
wp_die();
}
```
| Uses | Description |
| --- | --- |
| [\_WP\_Editors::wp\_link\_query()](../classes/_wp_editors/wp_link_query) wp-includes/class-wp-editor.php | Performs post queries for internal linking. |
| [wp\_json\_encode()](wp_json_encode) wp-includes/functions.php | Encodes a variable into JSON, with some sanity checks. |
| [wp\_unslash()](wp_unslash) wp-includes/formatting.php | Removes slashes from a string or recursively removes slashes from strings within an array. |
| [check\_ajax\_referer()](check_ajax_referer) wp-includes/pluggable.php | Verifies the Ajax request to prevent processing requests external of the blog. |
| [absint()](absint) wp-includes/functions.php | Converts a value to non-negative integer. |
| [wp\_die()](wp_die) wp-includes/functions.php | Kills WordPress execution and displays HTML page with an error message. |
| Version | Description |
| --- | --- |
| [3.1.0](https://developer.wordpress.org/reference/since/3.1.0/) | Introduced. |
wordpress sanitize_hex_color_no_hash( string $color ): string|null sanitize\_hex\_color\_no\_hash( string $color ): string|null
============================================================
Sanitizes a hex color without a hash. Use [sanitize\_hex\_color()](sanitize_hex_color) when possible.
Saving hex colors without a hash puts the burden of adding the hash on the UI, which makes it difficult to use or upgrade to other color types such as rgba, hsl, rgb, and HTML color names.
Returns either ”, a 3 or 6 digit hex color (without a #), or null.
`$color` string Required string|null
File: `wp-includes/formatting.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/formatting.php/)
```
function sanitize_hex_color_no_hash( $color ) {
$color = ltrim( $color, '#' );
if ( '' === $color ) {
return '';
}
return sanitize_hex_color( '#' . $color ) ? $color : null;
}
```
| Uses | Description |
| --- | --- |
| [sanitize\_hex\_color()](sanitize_hex_color) wp-includes/formatting.php | Sanitizes a hex color. |
| Used By | Description |
| --- | --- |
| [WP\_Customize\_Manager::\_sanitize\_header\_textcolor()](../classes/wp_customize_manager/_sanitize_header_textcolor) wp-includes/class-wp-customize-manager.php | Callback for validating the header\_textcolor value. |
| [maybe\_hash\_hex\_color()](maybe_hash_hex_color) wp-includes/formatting.php | Ensures that any hex color is properly hashed. |
| Version | Description |
| --- | --- |
| [3.4.0](https://developer.wordpress.org/reference/since/3.4.0/) | Introduced. |
wordpress get_next_post( bool $in_same_term = false, int[]|string $excluded_terms = '', string $taxonomy = 'category' ): WP_Post|null|string get\_next\_post( bool $in\_same\_term = false, int[]|string $excluded\_terms = '', string $taxonomy = 'category' ): WP\_Post|null|string
========================================================================================================================================
Retrieves the next post that is adjacent to the current post.
`$in_same_term` bool Optional Whether post should be in a same taxonomy term. Default: `false`
`$excluded_terms` int[]|string Optional Array or comma-separated list of excluded term IDs. Default: `''`
`$taxonomy` string Optional Taxonomy, if $in\_same\_term is true. Default `'category'`. Default: `'category'`
[WP\_Post](../classes/wp_post)|null|string Post object if successful. Null if global $post is not set. Empty string if no corresponding post exists.
File: `wp-includes/link-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/link-template.php/)
```
function get_next_post( $in_same_term = false, $excluded_terms = '', $taxonomy = 'category' ) {
return get_adjacent_post( $in_same_term, $excluded_terms, false, $taxonomy );
}
```
| Uses | Description |
| --- | --- |
| [get\_adjacent\_post()](get_adjacent_post) wp-includes/link-template.php | Retrieves the adjacent post. |
| Used By | Description |
| --- | --- |
| [next\_post()](next_post) wp-includes/deprecated.php | Prints link to the next post. |
| Version | Description |
| --- | --- |
| [1.5.0](https://developer.wordpress.org/reference/since/1.5.0/) | Introduced. |
| programming_docs |
wordpress wp_list_filter( array $list, array $args = array(), string $operator = 'AND' ): array wp\_list\_filter( array $list, array $args = array(), string $operator = 'AND' ): array
=======================================================================================
Filters a list of objects, based on a set of key => value arguments.
Retrieves the objects from the list that match the given arguments.
Key represents property name, and value represents property value.
If an object has more properties than those specified in arguments, that will not disqualify it. When using the ‘AND’ operator, any missing properties will disqualify it.
If you want to retrieve a particular field from all matching objects, use [wp\_filter\_object\_list()](wp_filter_object_list) instead.
`$list` array Required An array of objects to filter. `$args` array Optional An array of key => value arguments to match against each object. Default: `array()`
`$operator` string Optional The logical operation to perform. `'AND'` means all elements from the array must match. `'OR'` means only one element needs to match. `'NOT'` means no elements may match. Default `'AND'`. Default: `'AND'`
array Array of found values.
File: `wp-includes/functions.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/functions.php/)
```
function wp_list_filter( $list, $args = array(), $operator = 'AND' ) {
return wp_filter_object_list( $list, $args, $operator );
}
```
| Uses | Description |
| --- | --- |
| [wp\_filter\_object\_list()](wp_filter_object_list) wp-includes/functions.php | Filters a list of objects, based on a set of key => value arguments. |
| Used By | Description |
| --- | --- |
| [WP\_REST\_Menu\_Items\_Controller::prepare\_item\_for\_response()](../classes/wp_rest_menu_items_controller/prepare_item_for_response) wp-includes/rest-api/endpoints/class-wp-rest-menu-items-controller.php | Prepares a single post output for response. |
| [WP\_REST\_Menu\_Items\_Controller::get\_item\_schema()](../classes/wp_rest_menu_items_controller/get_item_schema) wp-includes/rest-api/endpoints/class-wp-rest-menu-items-controller.php | Retrieves the term’s schema, conforming to JSON Schema. |
| [WP\_REST\_Posts\_Controller::prepare\_tax\_query()](../classes/wp_rest_posts_controller/prepare_tax_query) wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php | Prepares the ‘tax\_query’ for a collection of posts. |
| [WP\_REST\_Posts\_Controller::prepare\_taxonomy\_limit\_schema()](../classes/wp_rest_posts_controller/prepare_taxonomy_limit_schema) wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php | Prepares the collection schema for including and excluding items by terms. |
| [WP\_REST\_Posts\_Controller::get\_available\_actions()](../classes/wp_rest_posts_controller/get_available_actions) wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php | Gets the link relations available for the post and current user. |
| [WP\_REST\_Posts\_Controller::get\_schema\_links()](../classes/wp_rest_posts_controller/get_schema_links) wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php | Retrieves Link Description Objects that should be added to the Schema for the posts collection. |
| [WP\_REST\_Posts\_Controller::get\_item\_schema()](../classes/wp_rest_posts_controller/get_item_schema) wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php | Retrieves the post’s schema, conforming to JSON Schema. |
| [WP\_REST\_Posts\_Controller::prepare\_item\_for\_response()](../classes/wp_rest_posts_controller/prepare_item_for_response) wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php | Prepares a single post output for response. |
| [WP\_REST\_Posts\_Controller::handle\_terms()](../classes/wp_rest_posts_controller/handle_terms) wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php | Updates the post’s terms from a REST request. |
| [WP\_REST\_Posts\_Controller::check\_assign\_terms\_permission()](../classes/wp_rest_posts_controller/check_assign_terms_permission) wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php | Checks whether current user can assign all terms sent with the current request. |
| [WP\_REST\_Post\_Types\_Controller::prepare\_item\_for\_response()](../classes/wp_rest_post_types_controller/prepare_item_for_response) wp-includes/rest-api/endpoints/class-wp-rest-post-types-controller.php | Prepares a post type object for serialization. |
| [WP\_REST\_Response::remove\_link()](../classes/wp_rest_response/remove_link) wp-includes/rest-api/class-wp-rest-response.php | Removes a link from the response. |
| [WP\_REST\_Server::get\_routes()](../classes/wp_rest_server/get_routes) wp-includes/rest-api/class-wp-rest-server.php | Retrieves the route map. |
| [WP\_Automatic\_Updater::send\_debug\_email()](../classes/wp_automatic_updater/send_debug_email) wp-admin/includes/class-wp-automatic-updater.php | Prepares and sends an email of a full log of background update results, useful for debugging and geekery. |
| [\_access\_denied\_splash()](_access_denied_splash) wp-admin/includes/ms.php | Displays an access denied message when a user tries to view a site’s dashboard they do not have access to. |
| Version | Description |
| --- | --- |
| [5.9.0](https://developer.wordpress.org/reference/since/5.9.0/) | Converted into a wrapper for `wp_filter_object_list()`. |
| [4.7.0](https://developer.wordpress.org/reference/since/4.7.0/) | Uses `WP_List_Util` class. |
| [3.1.0](https://developer.wordpress.org/reference/since/3.1.0/) | Introduced. |
wordpress rest_default_additional_properties_to_false( array $schema ): array rest\_default\_additional\_properties\_to\_false( array $schema ): array
========================================================================
Sets the “additionalProperties” to false by default for all object definitions in the schema.
`$schema` array Required The schema to modify. array The modified schema.
File: `wp-includes/rest-api.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/rest-api.php/)
```
function rest_default_additional_properties_to_false( $schema ) {
$type = (array) $schema['type'];
if ( in_array( 'object', $type, true ) ) {
if ( isset( $schema['properties'] ) ) {
foreach ( $schema['properties'] as $key => $child_schema ) {
$schema['properties'][ $key ] = rest_default_additional_properties_to_false( $child_schema );
}
}
if ( isset( $schema['patternProperties'] ) ) {
foreach ( $schema['patternProperties'] as $key => $child_schema ) {
$schema['patternProperties'][ $key ] = rest_default_additional_properties_to_false( $child_schema );
}
}
if ( ! isset( $schema['additionalProperties'] ) ) {
$schema['additionalProperties'] = false;
}
}
if ( in_array( 'array', $type, true ) ) {
if ( isset( $schema['items'] ) ) {
$schema['items'] = rest_default_additional_properties_to_false( $schema['items'] );
}
}
return $schema;
}
```
| Uses | Description |
| --- | --- |
| [rest\_default\_additional\_properties\_to\_false()](rest_default_additional_properties_to_false) wp-includes/rest-api.php | Sets the “additionalProperties” to false by default for all object definitions in the schema. |
| Used By | Description |
| --- | --- |
| [register\_theme\_feature()](register_theme_feature) wp-includes/theme.php | Registers a theme feature for use in [add\_theme\_support()](add_theme_support) . |
| [rest\_default\_additional\_properties\_to\_false()](rest_default_additional_properties_to_false) wp-includes/rest-api.php | Sets the “additionalProperties” to false by default for all object definitions in the schema. |
| [WP\_REST\_Meta\_Fields::default\_additional\_properties\_to\_false()](../classes/wp_rest_meta_fields/default_additional_properties_to_false) wp-includes/rest-api/fields/class-wp-rest-meta-fields.php | Recursively add additionalProperties = false to all objects in a schema if no additionalProperties setting is specified. |
| [WP\_REST\_Settings\_Controller::set\_additional\_properties\_to\_false()](../classes/wp_rest_settings_controller/set_additional_properties_to_false) wp-includes/rest-api/endpoints/class-wp-rest-settings-controller.php | Recursively add additionalProperties = false to all objects in a schema if no additionalProperties setting is specified. |
| [WP\_REST\_Meta\_Fields::get\_registered\_fields()](../classes/wp_rest_meta_fields/get_registered_fields) wp-includes/rest-api/fields/class-wp-rest-meta-fields.php | Retrieves all the registered meta fields. |
| [WP\_REST\_Settings\_Controller::get\_registered\_options()](../classes/wp_rest_settings_controller/get_registered_options) wp-includes/rest-api/endpoints/class-wp-rest-settings-controller.php | Retrieves all of the registered options for the Settings API. |
| Version | Description |
| --- | --- |
| [5.6.0](https://developer.wordpress.org/reference/since/5.6.0/) | Support the "patternProperties" keyword. |
| [5.5.0](https://developer.wordpress.org/reference/since/5.5.0/) | Introduced. |
wordpress get_translations_for_domain( string $domain ): Translations|NOOP_Translations get\_translations\_for\_domain( string $domain ): Translations|NOOP\_Translations
=================================================================================
Returns the Translations instance for a text domain.
If there isn’t one, returns empty Translations instance.
`$domain` string Required Text domain. Unique identifier for retrieving translated strings. Translations|[NOOP\_Translations](../classes/noop_translations) A Translations instance.
File: `wp-includes/l10n.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/l10n.php/)
```
function get_translations_for_domain( $domain ) {
global $l10n;
if ( isset( $l10n[ $domain ] ) || ( _load_textdomain_just_in_time( $domain ) && isset( $l10n[ $domain ] ) ) ) {
return $l10n[ $domain ];
}
static $noop_translations = null;
if ( null === $noop_translations ) {
$noop_translations = new NOOP_Translations;
}
return $noop_translations;
}
```
| Uses | Description |
| --- | --- |
| [\_load\_textdomain\_just\_in\_time()](_load_textdomain_just_in_time) wp-includes/l10n.php | Loads plugin and theme text domains just-in-time. |
| Used By | Description |
| --- | --- |
| [WP\_Locale\_Switcher::load\_translations()](../classes/wp_locale_switcher/load_translations) wp-includes/class-wp-locale-switcher.php | Load translations for a given locale. |
| [translate()](translate) wp-includes/l10n.php | Retrieves the translation of $text. |
| [translate\_with\_gettext\_context()](translate_with_gettext_context) wp-includes/l10n.php | Retrieves the translation of $text in the context defined in $context. |
| [\_n()](_n) wp-includes/l10n.php | Translates and retrieves the singular or plural form based on the supplied number. |
| [\_nx()](_nx) wp-includes/l10n.php | Translates and retrieves the singular or plural form based on the supplied number, with gettext context. |
| Version | Description |
| --- | --- |
| [2.8.0](https://developer.wordpress.org/reference/since/2.8.0/) | Introduced. |
wordpress make_db_current_silent( string $tables = 'all' ) make\_db\_current\_silent( string $tables = 'all' )
===================================================
Updates the database tables to a new schema, but without displaying results.
By default, updates all the tables to use the latest defined schema, but can also be used to update a specific set of tables in [wp\_get\_db\_schema()](wp_get_db_schema) .
* [make\_db\_current()](make_db_current)
`$tables` string Optional Which set of tables to update. Default is `'all'`. Default: `'all'`
File: `wp-admin/includes/upgrade.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/upgrade.php/)
```
function make_db_current_silent( $tables = 'all' ) {
dbDelta( $tables );
}
```
| Uses | Description |
| --- | --- |
| [dbDelta()](dbdelta) wp-admin/includes/upgrade.php | Modifies the database based on specified SQL statements. |
| Used By | Description |
| --- | --- |
| [wp\_initialize\_site()](wp_initialize_site) wp-includes/ms-site.php | Runs the initialization routine for a given site. |
| [wp\_upgrade()](wp_upgrade) wp-admin/includes/upgrade.php | Runs WordPress Upgrade functions. |
| [wp\_install()](wp_install) wp-admin/includes/upgrade.php | Installs the site. |
| [install\_blog()](install_blog) wp-includes/ms-deprecated.php | Install an empty blog. |
| Version | Description |
| --- | --- |
| [1.5.0](https://developer.wordpress.org/reference/since/1.5.0/) | Introduced. |
wordpress get_usernumposts( int $userid ): int get\_usernumposts( int $userid ): int
=====================================
This function has been deprecated. Use [count\_user\_posts()](count_user_posts) instead.
Retrieves the number of posts a user has written.
* [count\_user\_posts()](count_user_posts)
`$userid` int Required User to count posts for. int Number of posts the given user has written.
File: `wp-includes/deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/deprecated.php/)
```
function get_usernumposts( $userid ) {
_deprecated_function( __FUNCTION__, '3.0.0', 'count_user_posts()' );
return count_user_posts( $userid );
}
```
| Uses | Description |
| --- | --- |
| [count\_user\_posts()](count_user_posts) wp-includes/user.php | Gets the number of posts a user has written. |
| [\_deprecated\_function()](_deprecated_function) wp-includes/functions.php | Marks a function as deprecated and inform when it has been used. |
| Version | Description |
| --- | --- |
| [3.0.0](https://developer.wordpress.org/reference/since/3.0.0/) | Use [count\_user\_posts()](count_user_posts) |
| [0.71](https://developer.wordpress.org/reference/since/0.71/) | Introduced. |
wordpress set_current_user( int|null $id, string $name = '' ): WP_User set\_current\_user( int|null $id, string $name = '' ): WP\_User
===============================================================
This function has been deprecated. Use [wp\_set\_current\_user()](wp_set_current_user) 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.
* [wp\_set\_current\_user()](wp_set_current_user)
`$id` int|null Required User ID. `$name` string Optional The user's username Default: `''`
[WP\_User](../classes/wp_user) returns [wp\_set\_current\_user()](wp_set_current_user)
File: `wp-includes/pluggable-deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/pluggable-deprecated.php/)
```
function set_current_user($id, $name = '') {
_deprecated_function( __FUNCTION__, '3.0.0', 'wp_set_current_user()' );
return wp_set_current_user($id, $name);
}
```
| Uses | Description |
| --- | --- |
| [wp\_set\_current\_user()](wp_set_current_user) wp-includes/pluggable.php | Changes the current user by ID or name. |
| [\_deprecated\_function()](_deprecated_function) wp-includes/functions.php | Marks a function as deprecated and inform when it has been used. |
| Version | Description |
| --- | --- |
| [3.0.0](https://developer.wordpress.org/reference/since/3.0.0/) | Use [wp\_set\_current\_user()](wp_set_current_user) |
| [2.0.1](https://developer.wordpress.org/reference/since/2.0.1/) | Introduced. |
wordpress clean_user_cache( WP_User|int $user ) clean\_user\_cache( WP\_User|int $user )
========================================
Cleans all user caches.
`$user` [WP\_User](../classes/wp_user)|int Required User object or ID to be cleaned from the cache File: `wp-includes/user.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/user.php/)
```
function clean_user_cache( $user ) {
if ( is_numeric( $user ) ) {
$user = new WP_User( $user );
}
if ( ! $user->exists() ) {
return;
}
wp_cache_delete( $user->ID, 'users' );
wp_cache_delete( $user->user_login, 'userlogins' );
wp_cache_delete( $user->user_nicename, 'userslugs' );
if ( ! empty( $user->user_email ) ) {
wp_cache_delete( $user->user_email, 'useremail' );
}
/**
* Fires immediately after the given user's cache is cleaned.
*
* @since 4.4.0
*
* @param int $user_id User ID.
* @param WP_User $user User object.
*/
do_action( 'clean_user_cache', $user->ID, $user );
}
```
[do\_action( 'clean\_user\_cache', int $user\_id, WP\_User $user )](../hooks/clean_user_cache)
Fires immediately after the given user’s cache is cleaned.
| Uses | Description |
| --- | --- |
| [WP\_User::\_\_construct()](../classes/wp_user/__construct) wp-includes/class-wp-user.php | Constructor. |
| [wp\_cache\_delete()](wp_cache_delete) wp-includes/cache.php | Removes the cache contents matching key and group. |
| [do\_action()](do_action) wp-includes/plugin.php | Calls the callback functions that have been added to an action hook. |
| Used By | Description |
| --- | --- |
| [wpmu\_delete\_user()](wpmu_delete_user) wp-admin/includes/ms.php | Delete a user from the network and remove from all sites. |
| [refresh\_user\_details()](refresh_user_details) wp-admin/includes/ms.php | Cleans the user cache for a specific user. |
| [update\_user\_status()](update_user_status) wp-includes/ms-deprecated.php | Update the status of a user in the database. |
| [wp\_delete\_user()](wp_delete_user) wp-admin/includes/user.php | Remove user and optionally reassign posts and links to another user. |
| [wp\_set\_password()](wp_set_password) wp-includes/pluggable.php | Updates the user’s password with a new encrypted one. |
| [delete\_usermeta()](delete_usermeta) wp-includes/deprecated.php | Remove user meta data. |
| [update\_usermeta()](update_usermeta) wp-includes/deprecated.php | Update metadata of user. |
| [wp\_update\_user()](wp_update_user) wp-includes/user.php | Updates a user in the database. |
| [wp\_insert\_user()](wp_insert_user) wp-includes/user.php | Inserts a user into the database. |
| [add\_user\_to\_blog()](add_user_to_blog) wp-includes/ms-functions.php | Adds a user to a blog, along with specifying the user’s role. |
| Version | Description |
| --- | --- |
| [4.4.0](https://developer.wordpress.org/reference/since/4.4.0/) | `'clean_user_cache'` action was added. |
| [3.0.0](https://developer.wordpress.org/reference/since/3.0.0/) | Introduced. |
wordpress comments_open( int|WP_Post $post = null ): bool comments\_open( int|WP\_Post $post = null ): bool
=================================================
Determines whether the current post is open for comments.
For more information on this and similar theme functions, check out the [Conditional Tags](https://developer.wordpress.org/themes/basics/conditional-tags/) article in the Theme Developer Handbook.
`$post` int|[WP\_Post](../classes/wp_post) Optional Post ID or [WP\_Post](../classes/wp_post) object. Default current post. Default: `null`
bool True if the comments are open.
File: `wp-includes/comment-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/comment-template.php/)
```
function comments_open( $post = null ) {
$_post = get_post( $post );
$post_id = $_post ? $_post->ID : 0;
$open = ( $_post && ( 'open' === $_post->comment_status ) );
/**
* Filters whether the current post is open for comments.
*
* @since 2.5.0
*
* @param bool $open Whether the current post is open for comments.
* @param int $post_id The post ID.
*/
return apply_filters( 'comments_open', $open, $post_id );
}
```
[apply\_filters( 'comments\_open', bool $open, int $post\_id )](../hooks/comments_open)
Filters whether the current post is open for comments.
| Uses | Description |
| --- | --- |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| [get\_post()](get_post) wp-includes/post.php | Retrieves post data given a post ID or post object. |
| Used By | Description |
| --- | --- |
| [register\_and\_do\_post\_meta\_boxes()](register_and_do_post_meta_boxes) wp-admin/includes/meta-boxes.php | Registers the default post meta boxes, and runs the `do_meta_boxes` actions. |
| [WP\_REST\_Comments\_Controller::create\_item\_permissions\_check()](../classes/wp_rest_comments_controller/create_item_permissions_check) wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php | Checks if a given request has access to create a comment. |
| [print\_embed\_comments\_button()](print_embed_comments_button) wp-includes/embed.php | Prints the necessary markup for the embed comments button. |
| [wp\_handle\_comment\_submission()](wp_handle_comment_submission) wp-includes/comment.php | Handles the submission of a comment, usually posted to wp-comments-post.php via a comment form. |
| [feed\_links\_extra()](feed_links_extra) wp-includes/general-template.php | Displays the links to the extra feeds such as category feeds. |
| [wp\_xmlrpc\_server::wp\_newComment()](../classes/wp_xmlrpc_server/wp_newcomment) wp-includes/class-wp-xmlrpc-server.php | Create new comment. |
| [wp\_xmlrpc\_server::\_prepare\_page()](../classes/wp_xmlrpc_server/_prepare_page) wp-includes/class-wp-xmlrpc-server.php | Prepares page data for return in an XML-RPC object. |
| [get\_post\_reply\_link()](get_post_reply_link) wp-includes/comment-template.php | Retrieves HTML content for reply to post link. |
| [comment\_form()](comment_form) wp-includes/comment-template.php | Outputs a complete commenting form for use within a template. |
| [comments\_popup\_link()](comments_popup_link) wp-includes/comment-template.php | Displays the link to the comments for the current post ID. |
| [get\_comment\_reply\_link()](get_comment_reply_link) wp-includes/comment-template.php | Retrieves HTML content for reply to comment link. |
| Version | Description |
| --- | --- |
| [1.5.0](https://developer.wordpress.org/reference/since/1.5.0/) | Introduced. |
| programming_docs |
wordpress get_current_theme(): string get\_current\_theme(): string
=============================
This function has been deprecated. Use [wp\_get\_theme()](wp_get_theme) instead.
Retrieve current theme name.
* [wp\_get\_theme()](wp_get_theme)
string
File: `wp-includes/deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/deprecated.php/)
```
function get_current_theme() {
_deprecated_function( __FUNCTION__, '3.4.0', 'wp_get_theme()' );
if ( $theme = get_option( 'current_theme' ) )
return $theme;
return wp_get_theme()->get('Name');
}
```
| Uses | Description |
| --- | --- |
| [WP\_Theme::get()](../classes/wp_theme/get) wp-includes/class-wp-theme.php | Gets a raw, unformatted theme header. |
| [wp\_get\_theme()](wp_get_theme) wp-includes/theme.php | Gets a [WP\_Theme](../classes/wp_theme) object for a theme. |
| [\_deprecated\_function()](_deprecated_function) wp-includes/functions.php | Marks a function as deprecated and inform when it has been used. |
| [get\_option()](get_option) wp-includes/option.php | Retrieves an option value based on an option name. |
| Version | Description |
| --- | --- |
| [3.4.0](https://developer.wordpress.org/reference/since/3.4.0/) | Use [wp\_get\_theme()](wp_get_theme) |
| [1.5.0](https://developer.wordpress.org/reference/since/1.5.0/) | Introduced. |
wordpress has_post_format( string|string[] $format = array(), WP_Post|int|null $post = null ): bool has\_post\_format( string|string[] $format = array(), WP\_Post|int|null $post = null ): bool
============================================================================================
Check if a post has any of the given formats, or any format.
`$format` string|string[] Optional The format or formats to check. Default: `array()`
`$post` [WP\_Post](../classes/wp_post)|int|null Optional The post to check. Defaults to the current post in the loop. Default: `null`
bool True if the post has any of the given formats (or any format, if no format specified), false otherwise.
##### Usage:
```
$format = has_post_format($format, $post_id);
```
File: `wp-includes/post-formats.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/post-formats.php/)
```
function has_post_format( $format = array(), $post = null ) {
$prefixed = array();
if ( $format ) {
foreach ( (array) $format as $single ) {
$prefixed[] = 'post-format-' . sanitize_key( $single );
}
}
return has_term( $prefixed, 'post_format', $post );
}
```
| Uses | Description |
| --- | --- |
| [has\_term()](has_term) wp-includes/category-template.php | Checks if the current post has any of given terms. |
| [sanitize\_key()](sanitize_key) wp-includes/formatting.php | Sanitizes a string key. |
| Version | Description |
| --- | --- |
| [3.1.0](https://developer.wordpress.org/reference/since/3.1.0/) | Introduced. |
wordpress get_sitemap_url( string $name, string $subtype_name = '', int $page = 1 ): string|false get\_sitemap\_url( string $name, string $subtype\_name = '', int $page = 1 ): string|false
==========================================================================================
Retrieves the full URL for a sitemap.
`$name` string Required The sitemap name. `$subtype_name` string Optional The sitemap subtype name. Default: `''`
`$page` int Optional The page of the sitemap. Default: `1`
string|false The sitemap URL or false if the sitemap doesn't exist.
File: `wp-includes/sitemaps.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/sitemaps.php/)
```
function get_sitemap_url( $name, $subtype_name = '', $page = 1 ) {
$sitemaps = wp_sitemaps_get_server();
if ( ! $sitemaps ) {
return false;
}
if ( 'index' === $name ) {
return $sitemaps->index->get_index_url();
}
$provider = $sitemaps->registry->get_provider( $name );
if ( ! $provider ) {
return false;
}
if ( $subtype_name && ! in_array( $subtype_name, array_keys( $provider->get_object_subtypes() ), true ) ) {
return false;
}
$page = absint( $page );
if ( 0 >= $page ) {
$page = 1;
}
return $provider->get_sitemap_url( $subtype_name, $page );
}
```
| Uses | Description |
| --- | --- |
| [wp\_sitemaps\_get\_server()](wp_sitemaps_get_server) wp-includes/sitemaps.php | Retrieves the current Sitemaps server instance. |
| [absint()](absint) wp-includes/functions.php | Converts a value to non-negative integer. |
| Used By | Description |
| --- | --- |
| [redirect\_canonical()](redirect_canonical) wp-includes/canonical.php | Redirects incoming links to the proper URL based on the site url. |
| Version | Description |
| --- | --- |
| [5.5.1](https://developer.wordpress.org/reference/since/5.5.1/) | Introduced. |
wordpress wp_admin_css_uri( string $file = 'wp-admin' ): string wp\_admin\_css\_uri( string $file = 'wp-admin' ): string
========================================================
Displays the URL of a WordPress admin CSS file.
* [WP\_Styles::\_css\_href()](../classes/wp_styles/_css_href): and its [‘style\_loader\_src’](../hooks/style_loader_src) filter.
`$file` string Optional file relative to wp-admin/ without its ".css" extension. Default: `'wp-admin'`
string
File: `wp-includes/general-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/general-template.php/)
```
function wp_admin_css_uri( $file = 'wp-admin' ) {
if ( defined( 'WP_INSTALLING' ) ) {
$_file = "./$file.css";
} else {
$_file = admin_url( "$file.css" );
}
$_file = add_query_arg( 'version', get_bloginfo( 'version' ), $_file );
/**
* Filters the URI of a WordPress admin CSS file.
*
* @since 2.3.0
*
* @param string $_file Relative path to the file with query arguments attached.
* @param string $file Relative path to the file, minus its ".css" extension.
*/
return apply_filters( 'wp_admin_css_uri', $_file, $file );
}
```
[apply\_filters( 'wp\_admin\_css\_uri', string $\_file, string $file )](../hooks/wp_admin_css_uri)
Filters the URI of a WordPress admin CSS file.
| Uses | Description |
| --- | --- |
| [get\_bloginfo()](get_bloginfo) wp-includes/general-template.php | Retrieves information about the current site. |
| [add\_query\_arg()](add_query_arg) wp-includes/functions.php | Retrieves a modified URL query string. |
| [admin\_url()](admin_url) wp-includes/link-template.php | Retrieves the URL to the admin area for the current site. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| Used By | Description |
| --- | --- |
| [wp\_admin\_css()](wp_admin_css) wp-includes/general-template.php | Enqueues or directly prints a stylesheet link to the specified CSS file. |
| Version | Description |
| --- | --- |
| [2.3.0](https://developer.wordpress.org/reference/since/2.3.0/) | Introduced. |
wordpress convert_chars( string $content, string $deprecated = '' ): string convert\_chars( string $content, string $deprecated = '' ): string
==================================================================
Converts lone & characters into `&` (a.k.a. `&`)
`$content` string Required String of characters to be converted. `$deprecated` string Optional Not used. Default: `''`
string Converted string.
File: `wp-includes/formatting.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/formatting.php/)
```
function convert_chars( $content, $deprecated = '' ) {
if ( ! empty( $deprecated ) ) {
_deprecated_argument( __FUNCTION__, '0.71' );
}
if ( strpos( $content, '&' ) !== false ) {
$content = preg_replace( '/&([^#])(?![a-z1-4]{1,8};)/i', '&$1', $content );
}
return $content;
}
```
| Uses | Description |
| --- | --- |
| [\_deprecated\_argument()](_deprecated_argument) wp-includes/functions.php | Marks a function argument as deprecated and inform when it has been used. |
| Used By | Description |
| --- | --- |
| [atom\_site\_icon()](atom_site_icon) wp-includes/feed.php | Displays Site Icon in atom feeds. |
| [rss2\_site\_icon()](rss2_site_icon) wp-includes/feed.php | Displays Site Icon in RSS2. |
| [wp\_richedit\_pre()](wp_richedit_pre) wp-includes/deprecated.php | Formats text for the rich text editor. |
| [get\_bloginfo\_rss()](get_bloginfo_rss) wp-includes/feed.php | Retrieves RSS container for the bloginfo function. |
| Version | Description |
| --- | --- |
| [0.71](https://developer.wordpress.org/reference/since/0.71/) | Introduced. |
wordpress has_post_thumbnail( int|WP_Post $post = null ): bool has\_post\_thumbnail( int|WP\_Post $post = null ): bool
=======================================================
Determines whether a post has an image attached.
For more information on this and similar theme functions, check out the [Conditional Tags](https://developer.wordpress.org/themes/basics/conditional-tags/) article in the Theme Developer Handbook.
`$post` int|[WP\_Post](../classes/wp_post) Optional Post ID or [WP\_Post](../classes/wp_post) object. Default is global `$post`. Default: `null`
bool Whether the post has an image attached.
File: `wp-includes/post-thumbnail-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/post-thumbnail-template.php/)
```
function has_post_thumbnail( $post = null ) {
$thumbnail_id = get_post_thumbnail_id( $post );
$has_thumbnail = (bool) $thumbnail_id;
/**
* Filters whether a post has a post thumbnail.
*
* @since 5.1.0
*
* @param bool $has_thumbnail true if the post has a post thumbnail, otherwise false.
* @param int|WP_Post|null $post Post ID or WP_Post object. Default is global `$post`.
* @param int|false $thumbnail_id Post thumbnail ID or false if the post does not exist.
*/
return (bool) apply_filters( 'has_post_thumbnail', $has_thumbnail, $post, $thumbnail_id );
}
```
[apply\_filters( 'has\_post\_thumbnail', bool $has\_thumbnail, int|WP\_Post|null $post, int|false $thumbnail\_id )](../hooks/has_post_thumbnail)
Filters whether a post has a post thumbnail.
| Uses | Description |
| --- | --- |
| [get\_post\_thumbnail\_id()](get_post_thumbnail_id) wp-includes/post-thumbnail-template.php | Retrieves the post thumbnail ID. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| Used By | Description |
| --- | --- |
| [get\_oembed\_response\_data\_rich()](get_oembed_response_data_rich) wp-includes/embed.php | Filters the oEmbed response data to return an iframe embed code. |
| [prepend\_attachment()](prepend_attachment) wp-includes/post-template.php | Wraps attachment in paragraph tag before content. |
| [get\_post\_class()](get_post_class) wp-includes/post-template.php | Retrieves an array of the class names for the post container element. |
| Version | Description |
| --- | --- |
| [4.4.0](https://developer.wordpress.org/reference/since/4.4.0/) | `$post` can be a post ID or [WP\_Post](../classes/wp_post) object. |
| [2.9.0](https://developer.wordpress.org/reference/since/2.9.0/) | Introduced. |
wordpress wp_setup_nav_menu_item( object $menu_item ): object wp\_setup\_nav\_menu\_item( object $menu\_item ): object
========================================================
Decorates a menu item object with the shared navigation menu item properties.
Properties:
* ID: The term\_id if the menu item represents a taxonomy term.
* attr\_title: The title attribute of the link element for this menu item.
* classes: The array of class attribute values for the link element of this menu item.
* db\_id: The DB ID of this item as a nav\_menu\_item object, if it exists (0 if it doesn’t exist).
* description: The description of this menu item.
* menu\_item\_parent: The DB ID of the nav\_menu\_item that is this item’s menu parent, if any. 0 otherwise.
* object: The type of object originally represented, such as ‘category’, ‘post’, or ‘attachment’.
* object\_id: The DB ID of the original object this menu item represents, e.g. ID for posts and term\_id for categories.
* post\_parent: The DB ID of the original object’s parent object, if any (0 otherwise).
* post\_title: A "no title" label if menu item represents a post that lacks a title.
* target: The target attribute of the link element for this menu item.
* title: The title of this menu item.
* type: The family of objects originally represented, such as ‘post\_type’ or ‘taxonomy’.
* type\_label: The singular label used to describe this type of menu item.
* url: The URL to which this menu item points.
* xfn: The XFN relationship expressed in the link of this menu item.
* \_invalid: Whether the menu item represents an object that no longer exists.
`$menu_item` object Required The menu item to modify. object The menu item with standard menu item properties.
File: `wp-includes/nav-menu.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/nav-menu.php/)
```
function wp_setup_nav_menu_item( $menu_item ) {
if ( isset( $menu_item->post_type ) ) {
if ( 'nav_menu_item' === $menu_item->post_type ) {
$menu_item->db_id = (int) $menu_item->ID;
$menu_item->menu_item_parent = ! isset( $menu_item->menu_item_parent ) ? get_post_meta( $menu_item->ID, '_menu_item_menu_item_parent', true ) : $menu_item->menu_item_parent;
$menu_item->object_id = ! isset( $menu_item->object_id ) ? get_post_meta( $menu_item->ID, '_menu_item_object_id', true ) : $menu_item->object_id;
$menu_item->object = ! isset( $menu_item->object ) ? get_post_meta( $menu_item->ID, '_menu_item_object', true ) : $menu_item->object;
$menu_item->type = ! isset( $menu_item->type ) ? get_post_meta( $menu_item->ID, '_menu_item_type', true ) : $menu_item->type;
if ( 'post_type' === $menu_item->type ) {
$object = get_post_type_object( $menu_item->object );
if ( $object ) {
$menu_item->type_label = $object->labels->singular_name;
// Denote post states for special pages (only in the admin).
if ( function_exists( 'get_post_states' ) ) {
$menu_post = get_post( $menu_item->object_id );
$post_states = get_post_states( $menu_post );
if ( $post_states ) {
$menu_item->type_label = wp_strip_all_tags( implode( ', ', $post_states ) );
}
}
} else {
$menu_item->type_label = $menu_item->object;
$menu_item->_invalid = true;
}
if ( 'trash' === get_post_status( $menu_item->object_id ) ) {
$menu_item->_invalid = true;
}
$original_object = get_post( $menu_item->object_id );
if ( $original_object ) {
$menu_item->url = get_permalink( $original_object->ID );
/** This filter is documented in wp-includes/post-template.php */
$original_title = apply_filters( 'the_title', $original_object->post_title, $original_object->ID );
} else {
$menu_item->url = '';
$original_title = '';
$menu_item->_invalid = true;
}
if ( '' === $original_title ) {
/* translators: %d: ID of a post. */
$original_title = sprintf( __( '#%d (no title)' ), $menu_item->object_id );
}
$menu_item->title = ( '' === $menu_item->post_title ) ? $original_title : $menu_item->post_title;
} elseif ( 'post_type_archive' === $menu_item->type ) {
$object = get_post_type_object( $menu_item->object );
if ( $object ) {
$menu_item->title = ( '' === $menu_item->post_title ) ? $object->labels->archives : $menu_item->post_title;
$post_type_description = $object->description;
} else {
$post_type_description = '';
$menu_item->_invalid = true;
}
$menu_item->type_label = __( 'Post Type Archive' );
$post_content = wp_trim_words( $menu_item->post_content, 200 );
$post_type_description = ( '' === $post_content ) ? $post_type_description : $post_content;
$menu_item->url = get_post_type_archive_link( $menu_item->object );
} elseif ( 'taxonomy' === $menu_item->type ) {
$object = get_taxonomy( $menu_item->object );
if ( $object ) {
$menu_item->type_label = $object->labels->singular_name;
} else {
$menu_item->type_label = $menu_item->object;
$menu_item->_invalid = true;
}
$original_object = get_term( (int) $menu_item->object_id, $menu_item->object );
if ( $original_object && ! is_wp_error( $original_object ) ) {
$menu_item->url = get_term_link( (int) $menu_item->object_id, $menu_item->object );
$original_title = $original_object->name;
} else {
$menu_item->url = '';
$original_title = '';
$menu_item->_invalid = true;
}
if ( '' === $original_title ) {
/* translators: %d: ID of a term. */
$original_title = sprintf( __( '#%d (no title)' ), $menu_item->object_id );
}
$menu_item->title = ( '' === $menu_item->post_title ) ? $original_title : $menu_item->post_title;
} else {
$menu_item->type_label = __( 'Custom Link' );
$menu_item->title = $menu_item->post_title;
$menu_item->url = ! isset( $menu_item->url ) ? get_post_meta( $menu_item->ID, '_menu_item_url', true ) : $menu_item->url;
}
$menu_item->target = ! isset( $menu_item->target ) ? get_post_meta( $menu_item->ID, '_menu_item_target', true ) : $menu_item->target;
/**
* Filters a navigation menu item's title attribute.
*
* @since 3.0.0
*
* @param string $item_title The menu item title attribute.
*/
$menu_item->attr_title = ! isset( $menu_item->attr_title ) ? apply_filters( 'nav_menu_attr_title', $menu_item->post_excerpt ) : $menu_item->attr_title;
if ( ! isset( $menu_item->description ) ) {
/**
* Filters a navigation menu item's description.
*
* @since 3.0.0
*
* @param string $description The menu item description.
*/
$menu_item->description = apply_filters( 'nav_menu_description', wp_trim_words( $menu_item->post_content, 200 ) );
}
$menu_item->classes = ! isset( $menu_item->classes ) ? (array) get_post_meta( $menu_item->ID, '_menu_item_classes', true ) : $menu_item->classes;
$menu_item->xfn = ! isset( $menu_item->xfn ) ? get_post_meta( $menu_item->ID, '_menu_item_xfn', true ) : $menu_item->xfn;
} else {
$menu_item->db_id = 0;
$menu_item->menu_item_parent = 0;
$menu_item->object_id = (int) $menu_item->ID;
$menu_item->type = 'post_type';
$object = get_post_type_object( $menu_item->post_type );
$menu_item->object = $object->name;
$menu_item->type_label = $object->labels->singular_name;
if ( '' === $menu_item->post_title ) {
/* translators: %d: ID of a post. */
$menu_item->post_title = sprintf( __( '#%d (no title)' ), $menu_item->ID );
}
$menu_item->title = $menu_item->post_title;
$menu_item->url = get_permalink( $menu_item->ID );
$menu_item->target = '';
/** This filter is documented in wp-includes/nav-menu.php */
$menu_item->attr_title = apply_filters( 'nav_menu_attr_title', '' );
/** This filter is documented in wp-includes/nav-menu.php */
$menu_item->description = apply_filters( 'nav_menu_description', '' );
$menu_item->classes = array();
$menu_item->xfn = '';
}
} elseif ( isset( $menu_item->taxonomy ) ) {
$menu_item->ID = $menu_item->term_id;
$menu_item->db_id = 0;
$menu_item->menu_item_parent = 0;
$menu_item->object_id = (int) $menu_item->term_id;
$menu_item->post_parent = (int) $menu_item->parent;
$menu_item->type = 'taxonomy';
$object = get_taxonomy( $menu_item->taxonomy );
$menu_item->object = $object->name;
$menu_item->type_label = $object->labels->singular_name;
$menu_item->title = $menu_item->name;
$menu_item->url = get_term_link( $menu_item, $menu_item->taxonomy );
$menu_item->target = '';
$menu_item->attr_title = '';
$menu_item->description = get_term_field( 'description', $menu_item->term_id, $menu_item->taxonomy );
$menu_item->classes = array();
$menu_item->xfn = '';
}
/**
* Filters a navigation menu item object.
*
* @since 3.0.0
*
* @param object $menu_item The menu item object.
*/
return apply_filters( 'wp_setup_nav_menu_item', $menu_item );
}
```
[apply\_filters( 'nav\_menu\_attr\_title', string $item\_title )](../hooks/nav_menu_attr_title)
Filters a navigation menu item’s title attribute.
[apply\_filters( 'nav\_menu\_description', string $description )](../hooks/nav_menu_description)
Filters a navigation menu item’s description.
[apply\_filters( 'the\_title', string $post\_title, int $post\_id )](../hooks/the_title)
Filters the post title.
[apply\_filters( 'wp\_setup\_nav\_menu\_item', object $menu\_item )](../hooks/wp_setup_nav_menu_item)
Filters a navigation menu item object.
| Uses | Description |
| --- | --- |
| [get\_post\_states()](get_post_states) wp-admin/includes/template.php | Retrieves an array of post states from a post. |
| [wp\_strip\_all\_tags()](wp_strip_all_tags) wp-includes/formatting.php | Properly strips all HTML tags including script and style |
| [wp\_trim\_words()](wp_trim_words) wp-includes/formatting.php | Trims text to a certain number of words. |
| [get\_term\_link()](get_term_link) wp-includes/taxonomy.php | Generates a permalink for a taxonomy term archive. |
| [get\_term\_field()](get_term_field) wp-includes/taxonomy.php | Gets sanitized term field. |
| [get\_post\_type\_archive\_link()](get_post_type_archive_link) wp-includes/link-template.php | Retrieves the permalink for a post type archive. |
| [get\_post\_status()](get_post_status) wp-includes/post.php | Retrieves the post status based on the post ID. |
| [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. |
| [get\_taxonomy()](get_taxonomy) wp-includes/taxonomy.php | Retrieves the taxonomy object of $taxonomy. |
| [get\_term()](get_term) wp-includes/taxonomy.php | Gets all term data from database by term ID. |
| [get\_permalink()](get_permalink) wp-includes/link-template.php | Retrieves the full permalink for the current post or post ID. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| [get\_post\_meta()](get_post_meta) wp-includes/post.php | Retrieves a post meta field for the given post ID. |
| [get\_post\_type\_object()](get_post_type_object) wp-includes/post.php | Retrieves a post type object by name. |
| [get\_post()](get_post) wp-includes/post.php | Retrieves post data given a post ID or post object. |
| [is\_wp\_error()](is_wp_error) wp-includes/load.php | Checks whether the given variable is a WordPress Error. |
| Used By | Description |
| --- | --- |
| [WP\_REST\_Menu\_Items\_Controller::get\_nav\_menu\_item()](../classes/wp_rest_menu_items_controller/get_nav_menu_item) wp-includes/rest-api/endpoints/class-wp-rest-menu-items-controller.php | Gets the nav menu item, if the ID is valid. |
| [WP\_Customize\_Nav\_Menu\_Item\_Setting::value()](../classes/wp_customize_nav_menu_item_setting/value) wp-includes/customize/class-wp-customize-nav-menu-item-setting.php | Get the instance data for a given nav\_menu\_item setting. |
| [wp\_ajax\_add\_menu\_item()](wp_ajax_add_menu_item) wp-admin/includes/ajax-actions.php | Ajax handler for adding a menu item. |
| Version | Description |
| --- | --- |
| [3.0.0](https://developer.wordpress.org/reference/since/3.0.0/) | Introduced. |
| programming_docs |
wordpress wp_add_post_tags( int $post_id, string|array $tags = '' ): array|false|WP_Error wp\_add\_post\_tags( int $post\_id, string|array $tags = '' ): array|false|WP\_Error
====================================================================================
Adds tags to a post.
* [wp\_set\_post\_tags()](wp_set_post_tags)
`$post_id` int Optional The Post ID. Does not default to the ID of the global $post. `$tags` string|array Optional An array of tags to set for the post, or a string of tags separated by commas. Default: `''`
array|false|[WP\_Error](../classes/wp_error) Array of affected term IDs. [WP\_Error](../classes/wp_error) or false on failure.
File: `wp-includes/post.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/post.php/)
```
function wp_add_post_tags( $post_id = 0, $tags = '' ) {
return wp_set_post_tags( $post_id, $tags, true );
}
```
| Uses | Description |
| --- | --- |
| [wp\_set\_post\_tags()](wp_set_post_tags) wp-includes/post.php | Sets the tags for a post. |
| Version | Description |
| --- | --- |
| [2.3.0](https://developer.wordpress.org/reference/since/2.3.0/) | Introduced. |
wordpress install_popular_tags( array $args = array() ): array|WP_Error install\_popular\_tags( array $args = array() ): array|WP\_Error
================================================================
Retrieves popular WordPress plugin tags.
`$args` array Optional Default: `array()`
array|[WP\_Error](../classes/wp_error)
File: `wp-admin/includes/plugin-install.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/plugin-install.php/)
```
function install_popular_tags( $args = array() ) {
$key = md5( serialize( $args ) );
$tags = get_site_transient( 'poptags_' . $key );
if ( false !== $tags ) {
return $tags;
}
$tags = plugins_api( 'hot_tags', $args );
if ( is_wp_error( $tags ) ) {
return $tags;
}
set_site_transient( 'poptags_' . $key, $tags, 3 * HOUR_IN_SECONDS );
return $tags;
}
```
| Uses | Description |
| --- | --- |
| [plugins\_api()](plugins_api) wp-admin/includes/plugin-install.php | Retrieves plugin installer pages from the WordPress.org Plugins API. |
| [set\_site\_transient()](set_site_transient) wp-includes/option.php | Sets/updates the value of a site transient. |
| [get\_site\_transient()](get_site_transient) wp-includes/option.php | Retrieves the value of a site transient. |
| [is\_wp\_error()](is_wp_error) wp-includes/load.php | Checks whether the given variable is a WordPress Error. |
| Used By | Description |
| --- | --- |
| [install\_dashboard()](install_dashboard) wp-admin/includes/plugin-install.php | Displays the Featured tab of Add Plugins screen. |
| Version | Description |
| --- | --- |
| [2.7.0](https://developer.wordpress.org/reference/since/2.7.0/) | Introduced. |
wordpress get_random_header_image(): string get\_random\_header\_image(): string
====================================
Gets random header image URL from registered images in theme.
string Path to header image.
File: `wp-includes/theme.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/theme.php/)
```
function get_random_header_image() {
$random_image = _get_random_header_data();
if ( empty( $random_image->url ) ) {
return '';
}
return $random_image->url;
}
```
| Uses | Description |
| --- | --- |
| [\_get\_random\_header\_data()](_get_random_header_data) wp-includes/theme.php | Gets random header image data from registered images in theme. |
| Used By | Description |
| --- | --- |
| [get\_header\_image()](get_header_image) wp-includes/theme.php | Retrieves header image for custom header. |
| [is\_random\_header\_image()](is_random_header_image) wp-includes/theme.php | Checks if random header image is in use. |
| Version | Description |
| --- | --- |
| [3.2.0](https://developer.wordpress.org/reference/since/3.2.0/) | Introduced. |
wordpress add_rewrite_rule( string $regex, string|array $query, string $after = 'bottom' ) add\_rewrite\_rule( string $regex, string|array $query, string $after = 'bottom' )
==================================================================================
Adds a rewrite rule that transforms a URL structure to a set of query vars.
Any value in the $after parameter that isn’t ‘bottom’ will result in the rule being placed at the top of the rewrite rules.
`$regex` string Required Regular expression to match request against. `$query` string|array Required The corresponding query vars for this rewrite rule. `$after` string Optional Priority of the new rule. Accepts `'top'` or `'bottom'`. Default `'bottom'`. Default: `'bottom'`
[add\_rewrite\_rule()](add_rewrite_rule) allows you to specify additional rewrite rules for WordPress. It is most commonly used in conjunction with [add\_rewrite\_tag()](add_rewrite_tag) (which allows WordPress to recognize custom post/get variables).
File: `wp-includes/rewrite.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/rewrite.php/)
```
function add_rewrite_rule( $regex, $query, $after = 'bottom' ) {
global $wp_rewrite;
$wp_rewrite->add_rule( $regex, $query, $after );
}
```
| Uses | Description |
| --- | --- |
| [WP\_Rewrite::add\_rule()](../classes/wp_rewrite/add_rule) wp-includes/class-wp-rewrite.php | Adds a rewrite rule that transforms a URL structure to a set of query vars. |
| Used By | Description |
| --- | --- |
| [WP\_Sitemaps::register\_rewrites()](../classes/wp_sitemaps/register_rewrites) wp-includes/sitemaps/class-wp-sitemaps.php | Registers sitemap rewrite tags and routing rules. |
| [WP\_Post\_Type::add\_rewrite\_rules()](../classes/wp_post_type/add_rewrite_rules) wp-includes/class-wp-post-type.php | Adds the necessary rewrite rules for the post type. |
| [rest\_api\_register\_rewrites()](rest_api_register_rewrites) wp-includes/rest-api.php | Adds REST rewrite rules. |
| Version | Description |
| --- | --- |
| [4.4.0](https://developer.wordpress.org/reference/since/4.4.0/) | Array support was added to the `$query` parameter. |
| [2.1.0](https://developer.wordpress.org/reference/since/2.1.0/) | Introduced. |
wordpress wp_register( string $before = '<li>', string $after = '</li>', bool $echo = true ): void|string wp\_register( string $before = '<li>', string $after = '</li>', bool $echo = true ): void|string
================================================================================================
Displays the Registration or Admin link.
Display a link which allows the user to navigate to the registration page if not logged in and registration is enabled or to the dashboard if logged in.
`$before` string Optional Text to output before the link. Default `<li>`. Default: `'<li>'`
`$after` string Optional Text to output after the link. Default `</li>`. Default: `'</li>'`
`$echo` bool Optional Default to echo and not return the link. Default: `true`
void|string Void if `$echo` argument is true, registration or admin link if `$echo` is false.
The “Register” link is not offered if the [Administration](https://wordpress.org/support/article/administration-screens/ "Administration Panels") > [Settings](https://wordpress.org/support/article/administration-screens/ "Administration Panels") > [General](https://wordpress.org/support/article/settings-general-screen/ "Settings General SubPanel") > **Membership: Anyone can register** box is not checked.
File: `wp-includes/general-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/general-template.php/)
```
function wp_register( $before = '<li>', $after = '</li>', $echo = true ) {
if ( ! is_user_logged_in() ) {
if ( get_option( 'users_can_register' ) ) {
$link = $before . '<a href="' . esc_url( wp_registration_url() ) . '">' . __( 'Register' ) . '</a>' . $after;
} else {
$link = '';
}
} elseif ( current_user_can( 'read' ) ) {
$link = $before . '<a href="' . admin_url() . '">' . __( 'Site Admin' ) . '</a>' . $after;
} else {
$link = '';
}
/**
* Filters the HTML link to the Registration or Admin page.
*
* Users are sent to the admin page if logged-in, or the registration page
* if enabled and logged-out.
*
* @since 1.5.0
*
* @param string $link The HTML code for the link to the Registration or Admin page.
*/
$link = apply_filters( 'register', $link );
if ( $echo ) {
echo $link;
} else {
return $link;
}
}
```
[apply\_filters( 'register', string $link )](../hooks/register)
Filters the HTML link to the Registration or Admin page.
| Uses | Description |
| --- | --- |
| [wp\_registration\_url()](wp_registration_url) wp-includes/general-template.php | Returns the URL that allows the user to register on the site. |
| [current\_user\_can()](current_user_can) wp-includes/capabilities.php | Returns whether the current user has the specified capability. |
| [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. |
| [esc\_url()](esc_url) wp-includes/formatting.php | Checks and cleans a URL. |
| [is\_user\_logged\_in()](is_user_logged_in) wp-includes/pluggable.php | Determines whether the current visitor is a logged in user. |
| [admin\_url()](admin_url) wp-includes/link-template.php | Retrieves the URL to the admin area for the current site. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| [get\_option()](get_option) wp-includes/option.php | Retrieves an option value based on an option name. |
| Used By | Description |
| --- | --- |
| [WP\_Widget\_Meta::widget()](../classes/wp_widget_meta/widget) wp-includes/widgets/class-wp-widget-meta.php | Outputs the content for the current Meta widget instance. |
| Version | Description |
| --- | --- |
| [1.5.0](https://developer.wordpress.org/reference/since/1.5.0/) | Introduced. |
wordpress the_excerpt_rss() the\_excerpt\_rss()
===================
Displays the post excerpt for the feed.
File: `wp-includes/feed.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/feed.php/)
```
function the_excerpt_rss() {
$output = get_the_excerpt();
/**
* Filters the post excerpt for a feed.
*
* @since 1.2.0
*
* @param string $output The current post excerpt.
*/
echo apply_filters( 'the_excerpt_rss', $output );
}
```
[apply\_filters( 'the\_excerpt\_rss', string $output )](../hooks/the_excerpt_rss)
Filters the post excerpt for a feed.
| Uses | Description |
| --- | --- |
| [get\_the\_excerpt()](get_the_excerpt) wp-includes/post-template.php | Retrieves the post excerpt. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| Version | Description |
| --- | --- |
| [0.71](https://developer.wordpress.org/reference/since/0.71/) | Introduced. |
wordpress edit_post_link( string $text = null, string $before = '', string $after = '', int|WP_Post $post, string $class = 'post-edit-link' ) edit\_post\_link( string $text = null, string $before = '', string $after = '', int|WP\_Post $post, string $class = 'post-edit-link' )
======================================================================================================================================
Displays the edit post link for post.
`$text` string Optional Anchor text. If null, default is 'Edit This'. Default: `null`
`$before` string Optional Display before edit link. Default: `''`
`$after` string Optional Display after edit link. Default: `''`
`$post` int|[WP\_Post](../classes/wp_post) Optional Post ID or post object. Default is the global `$post`. `$class` string Optional Add custom class to link. Default `'post-edit-link'`. Default: `'post-edit-link'`
Displays a link to edit the current post, if a user is logged in and allowed to edit the post. Can be used within [The Loop](https://codex.wordpress.org/The_Loop "The Loop") or outside of it. If outside the loop, you’ll need to pass the post ID. Can be used with pages, posts, attachments, and revisions.
Use [get\_edit\_post\_link](https://codex.wordpress.org/Template_Tags/get_edit_post_link "Template Tags/get edit post link") to retrieve the url.
File: `wp-includes/link-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/link-template.php/)
```
function edit_post_link( $text = null, $before = '', $after = '', $post = 0, $class = 'post-edit-link' ) {
$post = get_post( $post );
if ( ! $post ) {
return;
}
$url = get_edit_post_link( $post->ID );
if ( ! $url ) {
return;
}
if ( null === $text ) {
$text = __( 'Edit This' );
}
$link = '<a class="' . esc_attr( $class ) . '" href="' . esc_url( $url ) . '">' . $text . '</a>';
/**
* Filters the post edit link anchor tag.
*
* @since 2.3.0
*
* @param string $link Anchor tag for the edit link.
* @param int $post_id Post ID.
* @param string $text Anchor text.
*/
echo $before . apply_filters( 'edit_post_link', $link, $post->ID, $text ) . $after;
}
```
[apply\_filters( 'edit\_post\_link', string $link, int $post\_id, string $text )](../hooks/edit_post_link)
Filters the post edit link anchor tag.
| Uses | Description |
| --- | --- |
| [get\_edit\_post\_link()](get_edit_post_link) wp-includes/link-template.php | Retrieves the edit post link for post. |
| [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. |
| [esc\_attr()](esc_attr) wp-includes/formatting.php | Escaping for HTML attributes. |
| [esc\_url()](esc_url) wp-includes/formatting.php | Checks and cleans a URL. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| [get\_post()](get_post) wp-includes/post.php | Retrieves post data given a post ID or post object. |
| Version | Description |
| --- | --- |
| [4.4.0](https://developer.wordpress.org/reference/since/4.4.0/) | The `$class` argument was added. |
| [1.0.0](https://developer.wordpress.org/reference/since/1.0.0/) | Introduced. |
wordpress _update_term_count_on_transition_post_status( string $new_status, string $old_status, WP_Post $post ) \_update\_term\_count\_on\_transition\_post\_status( string $new\_status, string $old\_status, WP\_Post $post )
===============================================================================================================
This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.
Updates the custom taxonomies’ term counts when a post’s status is changed.
For example, default posts term counts (for custom taxonomies) don’t include private / draft posts.
`$new_status` string Required New post status. `$old_status` string Required Old post status. `$post` [WP\_Post](../classes/wp_post) Required Post object. File: `wp-includes/post.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/post.php/)
```
function _update_term_count_on_transition_post_status( $new_status, $old_status, $post ) {
// Update counts for the post's terms.
foreach ( (array) get_object_taxonomies( $post->post_type ) as $taxonomy ) {
$tt_ids = wp_get_object_terms( $post->ID, $taxonomy, array( 'fields' => 'tt_ids' ) );
wp_update_term_count( $tt_ids, $taxonomy );
}
}
```
| Uses | Description |
| --- | --- |
| [wp\_update\_term\_count()](wp_update_term_count) wp-includes/taxonomy.php | Updates the amount of terms in taxonomy. |
| [wp\_get\_object\_terms()](wp_get_object_terms) wp-includes/taxonomy.php | Retrieves the terms associated with the given object(s), in the supplied taxonomies. |
| [get\_object\_taxonomies()](get_object_taxonomies) wp-includes/taxonomy.php | Returns the names or objects of the taxonomies which are registered for the requested object or object type, such as a post object or post type name. |
| Version | Description |
| --- | --- |
| [3.3.0](https://developer.wordpress.org/reference/since/3.3.0/) | Introduced. |
wordpress _wp_ajax_menu_quick_search( array $request = array() ) \_wp\_ajax\_menu\_quick\_search( array $request = array() )
===========================================================
Prints the appropriate response to a menu quick search.
`$request` array Optional The unsanitized request values. Default: `array()`
File: `wp-admin/includes/nav-menu.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/nav-menu.php/)
```
function _wp_ajax_menu_quick_search( $request = array() ) {
$args = array();
$type = isset( $request['type'] ) ? $request['type'] : '';
$object_type = isset( $request['object_type'] ) ? $request['object_type'] : '';
$query = isset( $request['q'] ) ? $request['q'] : '';
$response_format = isset( $request['response-format'] ) ? $request['response-format'] : '';
if ( ! $response_format || ! in_array( $response_format, array( 'json', 'markup' ), true ) ) {
$response_format = 'json';
}
if ( 'markup' === $response_format ) {
$args['walker'] = new Walker_Nav_Menu_Checklist;
}
if ( 'get-post-item' === $type ) {
if ( post_type_exists( $object_type ) ) {
if ( isset( $request['ID'] ) ) {
$object_id = (int) $request['ID'];
if ( 'markup' === $response_format ) {
echo walk_nav_menu_tree( array_map( 'wp_setup_nav_menu_item', array( get_post( $object_id ) ) ), 0, (object) $args );
} elseif ( 'json' === $response_format ) {
echo wp_json_encode(
array(
'ID' => $object_id,
'post_title' => get_the_title( $object_id ),
'post_type' => get_post_type( $object_id ),
)
);
echo "\n";
}
}
} elseif ( taxonomy_exists( $object_type ) ) {
if ( isset( $request['ID'] ) ) {
$object_id = (int) $request['ID'];
if ( 'markup' === $response_format ) {
echo walk_nav_menu_tree( array_map( 'wp_setup_nav_menu_item', array( get_term( $object_id, $object_type ) ) ), 0, (object) $args );
} elseif ( 'json' === $response_format ) {
$post_obj = get_term( $object_id, $object_type );
echo wp_json_encode(
array(
'ID' => $object_id,
'post_title' => $post_obj->name,
'post_type' => $object_type,
)
);
echo "\n";
}
}
}
} elseif ( preg_match( '/quick-search-(posttype|taxonomy)-([a-zA-Z_-]*\b)/', $type, $matches ) ) {
if ( 'posttype' === $matches[1] && get_post_type_object( $matches[2] ) ) {
$post_type_obj = _wp_nav_menu_meta_box_object( get_post_type_object( $matches[2] ) );
$args = array_merge(
$args,
array(
'no_found_rows' => true,
'update_post_meta_cache' => false,
'update_post_term_cache' => false,
'posts_per_page' => 10,
'post_type' => $matches[2],
's' => $query,
)
);
if ( isset( $post_type_obj->_default_query ) ) {
$args = array_merge( $args, (array) $post_type_obj->_default_query );
}
$search_results_query = new WP_Query( $args );
if ( ! $search_results_query->have_posts() ) {
return;
}
while ( $search_results_query->have_posts() ) {
$post = $search_results_query->next_post();
if ( 'markup' === $response_format ) {
$var_by_ref = $post->ID;
echo walk_nav_menu_tree( array_map( 'wp_setup_nav_menu_item', array( get_post( $var_by_ref ) ) ), 0, (object) $args );
} elseif ( 'json' === $response_format ) {
echo wp_json_encode(
array(
'ID' => $post->ID,
'post_title' => get_the_title( $post->ID ),
'post_type' => $matches[2],
)
);
echo "\n";
}
}
} elseif ( 'taxonomy' === $matches[1] ) {
$terms = get_terms(
array(
'taxonomy' => $matches[2],
'name__like' => $query,
'number' => 10,
'hide_empty' => false,
)
);
if ( empty( $terms ) || is_wp_error( $terms ) ) {
return;
}
foreach ( (array) $terms as $term ) {
if ( 'markup' === $response_format ) {
echo walk_nav_menu_tree( array_map( 'wp_setup_nav_menu_item', array( $term ) ), 0, (object) $args );
} elseif ( 'json' === $response_format ) {
echo wp_json_encode(
array(
'ID' => $term->term_id,
'post_title' => $term->name,
'post_type' => $matches[2],
)
);
echo "\n";
}
}
}
}
}
```
| Uses | Description |
| --- | --- |
| [Walker\_Nav\_Menu\_Checklist::\_\_construct()](../classes/walker_nav_menu_checklist/__construct) wp-admin/includes/class-walker-nav-menu-checklist.php | |
| [\_wp\_nav\_menu\_meta\_box\_object()](_wp_nav_menu_meta_box_object) wp-admin/includes/nav-menu.php | Adds custom arguments to some of the meta box object types. |
| [WP\_Query::\_\_construct()](../classes/wp_query/__construct) wp-includes/class-wp-query.php | Constructor. |
| [get\_terms()](get_terms) wp-includes/taxonomy.php | Retrieves the terms in a given taxonomy or list of taxonomies. |
| [taxonomy\_exists()](taxonomy_exists) wp-includes/taxonomy.php | Determines whether the taxonomy name exists. |
| [walk\_nav\_menu\_tree()](walk_nav_menu_tree) wp-includes/nav-menu-template.php | Retrieves the HTML list content for nav menu items. |
| [get\_the\_title()](get_the_title) wp-includes/post-template.php | Retrieves the post title. |
| [post\_type\_exists()](post_type_exists) wp-includes/post.php | Determines whether a post type is registered. |
| [get\_post\_type()](get_post_type) wp-includes/post.php | Retrieves the post type of the current post or of a given post. |
| [wp\_json\_encode()](wp_json_encode) wp-includes/functions.php | Encodes a variable into JSON, with some sanity checks. |
| [get\_term()](get_term) wp-includes/taxonomy.php | Gets all term data from database by term ID. |
| [get\_post()](get_post) wp-includes/post.php | Retrieves post data given a post ID or post object. |
| [get\_post\_type\_object()](get_post_type_object) wp-includes/post.php | Retrieves a post type object by name. |
| [is\_wp\_error()](is_wp_error) wp-includes/load.php | Checks whether the given variable is a WordPress Error. |
| Used By | Description |
| --- | --- |
| [wp\_ajax\_menu\_quick\_search()](wp_ajax_menu_quick_search) wp-admin/includes/ajax-actions.php | Ajax handler for menu quick searching. |
| Version | Description |
| --- | --- |
| [3.0.0](https://developer.wordpress.org/reference/since/3.0.0/) | Introduced. |
| programming_docs |
wordpress image_make_intermediate_size( string $file, int $width, int $height, bool $crop = false ): array|false image\_make\_intermediate\_size( string $file, int $width, int $height, bool $crop = false ): array|false
=========================================================================================================
Resizes an image to make a thumbnail or intermediate size.
The returned array has the file size, the image width, and image height. The [‘image\_make\_intermediate\_size’](../hooks/image_make_intermediate_size) filter can be used to hook in and change the values of the returned array. The only parameter is the resized file path.
`$file` string Required File path. `$width` int Required Image width. `$height` int Required Image height. `$crop` bool Optional Whether to crop image to specified width and height or resize.
Default: `false`
array|false Metadata array on success. False if no image was created.
File: `wp-includes/media.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/media.php/)
```
function image_make_intermediate_size( $file, $width, $height, $crop = false ) {
if ( $width || $height ) {
$editor = wp_get_image_editor( $file );
if ( is_wp_error( $editor ) || is_wp_error( $editor->resize( $width, $height, $crop ) ) ) {
return false;
}
$resized_file = $editor->save();
if ( ! is_wp_error( $resized_file ) && $resized_file ) {
unset( $resized_file['path'] );
return $resized_file;
}
}
return false;
}
```
| Uses | Description |
| --- | --- |
| [wp\_get\_image\_editor()](wp_get_image_editor) wp-includes/media.php | Returns a [WP\_Image\_Editor](../classes/wp_image_editor) instance and loads file into it. |
| [is\_wp\_error()](is_wp_error) wp-includes/load.php | Checks whether the given variable is a WordPress Error. |
| Version | Description |
| --- | --- |
| [2.5.0](https://developer.wordpress.org/reference/since/2.5.0/) | Introduced. |
wordpress wp_generate_uuid4(): string wp\_generate\_uuid4(): string
=============================
Generates a random UUID (version 4).
string UUID.
File: `wp-includes/functions.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/functions.php/)
```
function wp_generate_uuid4() {
return sprintf(
'%04x%04x-%04x-%04x-%04x-%04x%04x%04x',
mt_rand( 0, 0xffff ),
mt_rand( 0, 0xffff ),
mt_rand( 0, 0xffff ),
mt_rand( 0, 0x0fff ) | 0x4000,
mt_rand( 0, 0x3fff ) | 0x8000,
mt_rand( 0, 0xffff ),
mt_rand( 0, 0xffff ),
mt_rand( 0, 0xffff )
);
}
```
| Used By | Description |
| --- | --- |
| [WP\_Application\_Passwords::create\_new\_application\_password()](../classes/wp_application_passwords/create_new_application_password) wp-includes/class-wp-application-passwords.php | Creates a new application password. |
| [WP\_Application\_Passwords::get\_user\_application\_passwords()](../classes/wp_application_passwords/get_user_application_passwords) wp-includes/class-wp-application-passwords.php | Gets a user’s application passwords. |
| [WP\_Customize\_Manager::establish\_loaded\_changeset()](../classes/wp_customize_manager/establish_loaded_changeset) wp-includes/class-wp-customize-manager.php | Establishes the loaded changeset. |
| [WP\_Customize\_Manager::\_publish\_changeset\_values()](../classes/wp_customize_manager/_publish_changeset_values) wp-includes/class-wp-customize-manager.php | Publishes the values of a changeset. |
| [WP\_Customize\_Manager::save\_changeset\_post()](../classes/wp_customize_manager/save_changeset_post) wp-includes/class-wp-customize-manager.php | Saves the post for the loaded changeset. |
| [WP\_Customize\_Manager::save()](../classes/wp_customize_manager/save) wp-includes/class-wp-customize-manager.php | Handles customize\_save WP Ajax request to save/update a changeset. |
| [WP\_Customize\_Manager::\_\_construct()](../classes/wp_customize_manager/__construct) wp-includes/class-wp-customize-manager.php | Constructor. |
| Version | Description |
| --- | --- |
| [4.7.0](https://developer.wordpress.org/reference/since/4.7.0/) | Introduced. |
wordpress wp_get_schedules(): array[] wp\_get\_schedules(): array[]
=============================
Retrieve supported event recurrence schedules.
The default supported recurrences are ‘hourly’, ‘twicedaily’, ‘daily’, and ‘weekly’.
A plugin may add more by hooking into the [‘cron\_schedules’](../hooks/cron_schedules) filter.
The filter accepts an array of arrays. The outer array has a key that is the name of the schedule, for example ‘monthly’. 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 `HOUR_IN_SECONDS` (60 *60 or 3600). For ‘monthly’, the value would be `MONTH_IN_SECONDS` (30* 24 *60* 60 or 2592000).
The ‘display’ is the description. For the ‘monthly’ key, the ‘display’ would be `__( 'Once Monthly' )`.
For your plugin, you will be passed an array. You can easily add your schedule by doing the following.
```
// Filter parameter variable name is 'array'.
$array['monthly'] = array(
'interval' => MONTH_IN_SECONDS,
'display' => __( 'Once Monthly' )
);
```
array[]
Example Return Values:
```
Array
(
[hourly] => Array
(
[interval] => 3600
[display] => Once Hourly
)
[twicedaily] => Array
(
[interval] => 43200
[display] => Twice Daily
)
[daily] => Array
(
[interval] => 86400
[display] => Once Daily
)
)
```
File: `wp-includes/cron.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/cron.php/)
```
function wp_get_schedules() {
$schedules = array(
'hourly' => array(
'interval' => HOUR_IN_SECONDS,
'display' => __( 'Once Hourly' ),
),
'twicedaily' => array(
'interval' => 12 * HOUR_IN_SECONDS,
'display' => __( 'Twice Daily' ),
),
'daily' => array(
'interval' => DAY_IN_SECONDS,
'display' => __( 'Once Daily' ),
),
'weekly' => array(
'interval' => WEEK_IN_SECONDS,
'display' => __( 'Once Weekly' ),
),
);
/**
* Filters the non-default cron schedules.
*
* @since 2.1.0
*
* @param array[] $new_schedules An array of non-default cron schedule arrays. Default empty.
*/
return array_merge( apply_filters( 'cron_schedules', array() ), $schedules );
}
```
[apply\_filters( 'cron\_schedules', array[] $new\_schedules )](../hooks/cron_schedules)
Filters the non-default cron schedules.
| Uses | Description |
| --- | --- |
| [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| Used By | Description |
| --- | --- |
| [\_wp\_cron()](_wp_cron) wp-includes/cron.php | Run scheduled callbacks or spawn cron for all scheduled events. |
| [WP\_Site\_Health::wp\_schedule\_test\_init()](../classes/wp_site_health/wp_schedule_test_init) wp-admin/includes/class-wp-site-health.php | Initiates the WP\_Cron schedule test cases. |
| [wp\_schedule\_event()](wp_schedule_event) wp-includes/cron.php | Schedules a recurring event. |
| [wp\_reschedule\_event()](wp_reschedule_event) wp-includes/cron.php | Reschedules a recurring event. |
| Version | Description |
| --- | --- |
| [5.4.0](https://developer.wordpress.org/reference/since/5.4.0/) | The `'weekly'` schedule was added. |
| [2.1.0](https://developer.wordpress.org/reference/since/2.1.0/) | Introduced. |
wordpress rest_get_route_for_post( int|WP_Post $post ): string rest\_get\_route\_for\_post( int|WP\_Post $post ): string
=========================================================
Gets the REST API route for a post.
`$post` int|[WP\_Post](../classes/wp_post) Required Post ID or post object. string The route path with a leading slash for the given post, or an empty string if there is not a route.
File: `wp-includes/rest-api.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/rest-api.php/)
```
function rest_get_route_for_post( $post ) {
$post = get_post( $post );
if ( ! $post instanceof WP_Post ) {
return '';
}
$post_type_route = rest_get_route_for_post_type_items( $post->post_type );
if ( ! $post_type_route ) {
return '';
}
$route = sprintf( '%s/%d', $post_type_route, $post->ID );
/**
* Filters the REST API route for a post.
*
* @since 5.5.0
*
* @param string $route The route path.
* @param WP_Post $post The post object.
*/
return apply_filters( 'rest_route_for_post', $route, $post );
}
```
[apply\_filters( 'rest\_route\_for\_post', string $route, WP\_Post $post )](../hooks/rest_route_for_post)
Filters the REST API route for a post.
| Uses | Description |
| --- | --- |
| [rest\_get\_route\_for\_post\_type\_items()](rest_get_route_for_post_type_items) wp-includes/rest-api.php | Gets the REST API route for a post type. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| [get\_post()](get_post) wp-includes/post.php | Retrieves post data given a post ID or post object. |
| Used By | Description |
| --- | --- |
| [WP\_REST\_Server::add\_image\_to\_index()](../classes/wp_rest_server/add_image_to_index) wp-includes/rest-api/class-wp-rest-server.php | Exposes an image through the WordPress REST API. |
| [WP\_REST\_Menu\_Items\_Controller::prepare\_links()](../classes/wp_rest_menu_items_controller/prepare_links) wp-includes/rest-api/endpoints/class-wp-rest-menu-items-controller.php | Prepares links for the request. |
| [WP\_REST\_Templates\_Controller::prepare\_links()](../classes/wp_rest_templates_controller/prepare_links) wp-includes/rest-api/endpoints/class-wp-rest-templates-controller.php | Prepares links for the request. |
| [rest\_get\_queried\_resource\_route()](rest_get_queried_resource_route) wp-includes/rest-api.php | Gets the REST route for the currently queried object. |
| [WP\_REST\_Post\_Search\_Handler::prepare\_item\_links()](../classes/wp_rest_post_search_handler/prepare_item_links) wp-includes/rest-api/search/class-wp-rest-post-search-handler.php | Prepares links for the search result of a given ID. |
| [WP\_REST\_Post\_Search\_Handler::detect\_rest\_item\_route()](../classes/wp_rest_post_search_handler/detect_rest_item_route) wp-includes/rest-api/search/class-wp-rest-post-search-handler.php | Attempts to detect the route to access a single item. |
| [WP\_REST\_Revisions\_Controller::prepare\_item\_for\_response()](../classes/wp_rest_revisions_controller/prepare_item_for_response) wp-includes/rest-api/endpoints/class-wp-rest-revisions-controller.php | Prepares the revision for the REST response. |
| [WP\_REST\_Posts\_Controller::prepare\_links()](../classes/wp_rest_posts_controller/prepare_links) wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php | Prepares links for the request. |
| [WP\_REST\_Posts\_Controller::create\_item()](../classes/wp_rest_posts_controller/create_item) wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php | Creates a single post. |
| [WP\_REST\_Comments\_Controller::prepare\_links()](../classes/wp_rest_comments_controller/prepare_links) wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php | Prepares links for the request. |
| Version | Description |
| --- | --- |
| [5.5.0](https://developer.wordpress.org/reference/since/5.5.0/) | Introduced. |
wordpress wp_is_maintenance_mode(): bool wp\_is\_maintenance\_mode(): bool
=================================
Check if maintenance mode is enabled.
Checks for a file in the WordPress root directory named ".maintenance".
This file will contain the variable $upgrading, set to the time the file was created. If the file was created less than 10 minutes ago, WordPress is in maintenance mode.
bool True if maintenance mode is enabled, false otherwise.
File: `wp-includes/load.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/load.php/)
```
function wp_is_maintenance_mode() {
global $upgrading;
if ( ! file_exists( ABSPATH . '.maintenance' ) || wp_installing() ) {
return false;
}
require ABSPATH . '.maintenance';
// If the $upgrading timestamp is older than 10 minutes, consider maintenance over.
if ( ( time() - $upgrading ) >= 10 * MINUTE_IN_SECONDS ) {
return false;
}
/**
* Filters whether to enable maintenance mode.
*
* This filter runs before it can be used by plugins. It is designed for
* non-web runtimes. If this filter returns true, maintenance mode will be
* active and the request will end. If false, the request will be allowed to
* continue processing even if maintenance mode should be active.
*
* @since 4.6.0
*
* @param bool $enable_checks Whether to enable maintenance mode. Default true.
* @param int $upgrading The timestamp set in the .maintenance file.
*/
if ( ! apply_filters( 'enable_maintenance_mode', true, $upgrading ) ) {
return false;
}
return true;
}
```
[apply\_filters( 'enable\_maintenance\_mode', bool $enable\_checks, int $upgrading )](../hooks/enable_maintenance_mode)
Filters whether to enable maintenance mode.
| Uses | Description |
| --- | --- |
| [wp\_installing()](wp_installing) wp-includes/load.php | Check or set whether WordPress is in “installation” mode. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| Used By | Description |
| --- | --- |
| [WP\_Fatal\_Error\_Handler::handle()](../classes/wp_fatal_error_handler/handle) wp-includes/class-wp-fatal-error-handler.php | Runs the shutdown handler. |
| [wp\_maintenance()](wp_maintenance) wp-includes/load.php | Die with a maintenance message when conditions are met. |
| Version | Description |
| --- | --- |
| [5.5.0](https://developer.wordpress.org/reference/since/5.5.0/) | Introduced. |
wordpress _wp_register_meta_args_allowed_list( array $args, array $default_args ): array \_wp\_register\_meta\_args\_allowed\_list( array $args, array $default\_args ): array
=====================================================================================
This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.
Filters out `register_meta()` args based on an allowed list.
`register_meta()` args may change over time, so requiring the allowed list to be explicitly turned off is a warranty seal of sorts.
`$args` array Required Arguments from `register_meta()`. `$default_args` array Required Default arguments for `register_meta()`. array Filtered arguments.
File: `wp-includes/meta.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/meta.php/)
```
function _wp_register_meta_args_allowed_list( $args, $default_args ) {
return array_intersect_key( $args, $default_args );
}
```
| Used By | Description |
| --- | --- |
| [\_wp\_register\_meta\_args\_whitelist()](_wp_register_meta_args_whitelist) wp-includes/deprecated.php | Filters out `register_meta()` args based on an allowed list. |
| Version | Description |
| --- | --- |
| [5.5.0](https://developer.wordpress.org/reference/since/5.5.0/) | Introduced. |
wordpress wp_insert_post( array $postarr, bool $wp_error = false, bool $fire_after_hooks = true ): int|WP_Error wp\_insert\_post( array $postarr, bool $wp\_error = false, bool $fire\_after\_hooks = true ): int|WP\_Error
===========================================================================================================
Inserts or update a post.
If the $postarr parameter has ‘ID’ set to a value, then post will be updated.
You can set the post date manually, by 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.
* [sanitize\_post()](sanitize_post)
`$postarr` array Required An array of elements that make up a post to update or insert.
* `ID`intThe post ID. If equal to something other than 0, the post with that ID will be updated. Default 0.
* `post_author`intThe ID of the user who added the post. Default is the current user ID.
* `post_date`stringThe date of the post. Default is the current time.
* `post_date_gmt`stringThe date of the post in the GMT timezone. Default is the value of `$post_date`.
* `post_content`stringThe post content. Default empty.
* `post_content_filtered`stringThe filtered post content. Default empty.
* `post_title`stringThe post title. Default empty.
* `post_excerpt`stringThe post excerpt. Default empty.
* `post_status`stringThe post status. Default `'draft'`.
* `post_type`stringThe post type. Default `'post'`.
* `comment_status`stringWhether the post can accept comments. Accepts `'open'` or `'closed'`.
Default is the value of `'default_comment_status'` option.
* `ping_status`stringWhether the post can accept pings. Accepts `'open'` or `'closed'`.
Default is the value of `'default_ping_status'` option.
* `post_password`stringThe password to access the post. Default empty.
* `post_name`stringThe post name. Default is the sanitized post title when creating a new post.
* `to_ping`stringSpace or carriage return-separated list of URLs to ping.
Default empty.
* `pinged`stringSpace or carriage return-separated list of URLs that have been pinged. Default empty.
* `post_modified`stringThe date when the post was last modified. Default is the current time.
* `post_modified_gmt`stringThe date when the post was last modified in the GMT timezone. Default is the current time.
* `post_parent`intSet this for the post it belongs to, if any. Default 0.
* `menu_order`intThe order the post should be displayed in. Default 0.
* `post_mime_type`stringThe mime type of the post. Default empty.
* `guid`stringGlobal Unique ID for referencing the post. Default empty.
* `import_id`intThe post ID to be used when inserting a new post.
If specified, must not match any existing post ID. Default 0.
* `post_category`int[]Array of category IDs.
Defaults to value of the `'default_category'` option.
* `tags_input`arrayArray of tag names, slugs, or IDs. Default empty.
* `tax_input`arrayAn array of taxonomy terms keyed by their taxonomy name.
If the taxonomy is hierarchical, the term list needs to be either an array of term IDs or a comma-separated string of IDs.
If the taxonomy is non-hierarchical, the term list can be an array that contains term names or slugs, or a comma-separated string of names or slugs. This is because, in hierarchical taxonomy, child terms can have the same names with different parent terms, so the only way to connect them is using ID. Default empty.
* `meta_input`arrayArray of post meta values keyed by their post meta key. Default empty.
* `page_template`stringPage template to use.
`$wp_error` bool Optional Whether to return a [WP\_Error](../classes/wp_error) on failure. Default: `false`
`$fire_after_hooks` bool Optional Whether to fire the after insert hooks. Default: `true`
int|[WP\_Error](../classes/wp_error) The post ID on success. The value 0 or [WP\_Error](../classes/wp_error) on failure.
```
wp_insert_post( $post, $wp_error );
```
* post\_title and post\_content are required
* post\_status: If providing a post\_status of ‘future’ you must specify the post\_date in order for WordPress to know when to publish your post. See also [Post Status Transitions](https://codex.wordpress.org/Post_Status_Transitions "Post Status Transitions").
* post\_category: Equivalent to calling [wp\_set\_post\_categories()](wp_set_post_categories) .
* tags\_input: Equivalent to calling [wp\_set\_post\_tags()](wp_set_post_tags) .
* tax\_input: Equivalent to calling [wp\_set\_post\_terms()](wp_set_post_terms) for each custom taxonomy in the array. If the current user doesn’t have the capability to work with a taxonomy, then you must use [wp\_set\_object\_terms()](wp_set_object_terms) instead.
* page\_template: If post\_type is ‘page’, will attempt to set the [page template](https://codex.wordpress.org/Page_Templates "Page Templates"). On failure, the function will return either a [WP\_Error](../classes/wp_error) or 0, and stop before the final actions are called. If the post\_type is not ‘page’, the parameter is ignored. You can set the page template for a non-page by calling [update\_post\_meta()](update_post_meta) with a key of ‘\_wp\_page\_template’.
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.
See also: [wp\_set\_post\_terms()](wp_set_post_terms)
[wp\_insert\_post()](wp_insert_post) passes data through [sanitize\_post()](sanitize_post) , which itself handles all necessary sanitization and validation (kses, etc.).
As such, you don’t need to worry about that.
You may wish, however, to remove HTML, JavaScript, and PHP tags from the post\_title and any other fields. Surprisingly, WordPress does not do this automatically. This can be easily done by using the [wp\_strip\_all\_tags()](wp_strip_all_tags) function and is especially useful when building front-end post submission forms.
```
// Create post object
$my_post = array(
'post_title' => wp_strip_all_tags( $_POST['post_title'] ),
'post_content' => $_POST['post_content'],
'post_status' => 'publish',
'post_author' => 1,
'post_category' => array( 8,39 )
);
// Insert the post into the database
wp_insert_post( $my_post );
```
File: `wp-includes/post.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/post.php/)
```
function wp_insert_post( $postarr, $wp_error = false, $fire_after_hooks = true ) {
global $wpdb;
// Capture original pre-sanitized array for passing into filters.
$unsanitized_postarr = $postarr;
$user_id = get_current_user_id();
$defaults = array(
'post_author' => $user_id,
'post_content' => '',
'post_content_filtered' => '',
'post_title' => '',
'post_excerpt' => '',
'post_status' => 'draft',
'post_type' => 'post',
'comment_status' => '',
'ping_status' => '',
'post_password' => '',
'to_ping' => '',
'pinged' => '',
'post_parent' => 0,
'menu_order' => 0,
'guid' => '',
'import_id' => 0,
'context' => '',
'post_date' => '',
'post_date_gmt' => '',
);
$postarr = wp_parse_args( $postarr, $defaults );
unset( $postarr['filter'] );
$postarr = sanitize_post( $postarr, 'db' );
// Are we updating or creating?
$post_ID = 0;
$update = false;
$guid = $postarr['guid'];
if ( ! empty( $postarr['ID'] ) ) {
$update = true;
// Get the post ID and GUID.
$post_ID = $postarr['ID'];
$post_before = get_post( $post_ID );
if ( is_null( $post_before ) ) {
if ( $wp_error ) {
return new WP_Error( 'invalid_post', __( 'Invalid post ID.' ) );
}
return 0;
}
$guid = get_post_field( 'guid', $post_ID );
$previous_status = get_post_field( 'post_status', $post_ID );
} else {
$previous_status = 'new';
$post_before = null;
}
$post_type = empty( $postarr['post_type'] ) ? 'post' : $postarr['post_type'];
$post_title = $postarr['post_title'];
$post_content = $postarr['post_content'];
$post_excerpt = $postarr['post_excerpt'];
if ( isset( $postarr['post_name'] ) ) {
$post_name = $postarr['post_name'];
} elseif ( $update ) {
// For an update, don't modify the post_name if it wasn't supplied as an argument.
$post_name = $post_before->post_name;
}
$maybe_empty = 'attachment' !== $post_type
&& ! $post_content && ! $post_title && ! $post_excerpt
&& post_type_supports( $post_type, 'editor' )
&& post_type_supports( $post_type, 'title' )
&& post_type_supports( $post_type, 'excerpt' );
/**
* Filters whether the post should be considered "empty".
*
* The post is considered "empty" if both:
* 1. The post type supports the title, editor, and excerpt fields
* 2. The title, editor, and excerpt fields are all empty
*
* Returning a truthy value from the filter will effectively short-circuit
* the new post being inserted and return 0. If $wp_error is true, a WP_Error
* will be returned instead.
*
* @since 3.3.0
*
* @param bool $maybe_empty Whether the post should be considered "empty".
* @param array $postarr Array of post data.
*/
if ( apply_filters( 'wp_insert_post_empty_content', $maybe_empty, $postarr ) ) {
if ( $wp_error ) {
return new WP_Error( 'empty_content', __( 'Content, title, and excerpt are empty.' ) );
} else {
return 0;
}
}
$post_status = empty( $postarr['post_status'] ) ? 'draft' : $postarr['post_status'];
if ( 'attachment' === $post_type && ! in_array( $post_status, array( 'inherit', 'private', 'trash', 'auto-draft' ), true ) ) {
$post_status = 'inherit';
}
if ( ! empty( $postarr['post_category'] ) ) {
// Filter out empty terms.
$post_category = array_filter( $postarr['post_category'] );
} elseif ( $update && ! isset( $postarr['post_category'] ) ) {
$post_category = $post_before->post_category;
}
// Make sure we set a valid category.
if ( empty( $post_category ) || 0 === count( $post_category ) || ! is_array( $post_category ) ) {
// 'post' requires at least one category.
if ( 'post' === $post_type && 'auto-draft' !== $post_status ) {
$post_category = array( get_option( 'default_category' ) );
} else {
$post_category = array();
}
}
/*
* Don't allow contributors to set the post slug for pending review posts.
*
* For new posts check the primitive capability, for updates check the meta capability.
*/
if ( 'pending' === $post_status ) {
$post_type_object = get_post_type_object( $post_type );
if ( ! $update && $post_type_object && ! current_user_can( $post_type_object->cap->publish_posts ) ) {
$post_name = '';
} elseif ( $update && ! current_user_can( 'publish_post', $post_ID ) ) {
$post_name = '';
}
}
/*
* Create a valid post name. Drafts and pending posts are allowed to have
* an empty post name.
*/
if ( empty( $post_name ) ) {
if ( ! in_array( $post_status, array( 'draft', 'pending', 'auto-draft' ), true ) ) {
$post_name = sanitize_title( $post_title );
} else {
$post_name = '';
}
} else {
// On updates, we need to check to see if it's using the old, fixed sanitization context.
$check_name = sanitize_title( $post_name, '', 'old-save' );
if ( $update && strtolower( urlencode( $post_name ) ) == $check_name && get_post_field( 'post_name', $post_ID ) == $check_name ) {
$post_name = $check_name;
} else { // new post, or slug has changed.
$post_name = sanitize_title( $post_name );
}
}
/*
* Resolve the post date from any provided post date or post date GMT strings;
* if none are provided, the date will be set to now.
*/
$post_date = wp_resolve_post_date( $postarr['post_date'], $postarr['post_date_gmt'] );
if ( ! $post_date ) {
if ( $wp_error ) {
return new WP_Error( 'invalid_date', __( 'Invalid date.' ) );
} else {
return 0;
}
}
if ( empty( $postarr['post_date_gmt'] ) || '0000-00-00 00:00:00' === $postarr['post_date_gmt'] ) {
if ( ! in_array( $post_status, get_post_stati( array( 'date_floating' => true ) ), true ) ) {
$post_date_gmt = get_gmt_from_date( $post_date );
} else {
$post_date_gmt = '0000-00-00 00:00:00';
}
} else {
$post_date_gmt = $postarr['post_date_gmt'];
}
if ( $update || '0000-00-00 00:00:00' === $post_date ) {
$post_modified = current_time( 'mysql' );
$post_modified_gmt = current_time( 'mysql', 1 );
} else {
$post_modified = $post_date;
$post_modified_gmt = $post_date_gmt;
}
if ( 'attachment' !== $post_type ) {
$now = gmdate( 'Y-m-d H:i:s' );
if ( 'publish' === $post_status ) {
if ( strtotime( $post_date_gmt ) - strtotime( $now ) >= MINUTE_IN_SECONDS ) {
$post_status = 'future';
}
} elseif ( 'future' === $post_status ) {
if ( strtotime( $post_date_gmt ) - strtotime( $now ) < MINUTE_IN_SECONDS ) {
$post_status = 'publish';
}
}
}
// Comment status.
if ( empty( $postarr['comment_status'] ) ) {
if ( $update ) {
$comment_status = 'closed';
} else {
$comment_status = get_default_comment_status( $post_type );
}
} else {
$comment_status = $postarr['comment_status'];
}
// These variables are needed by compact() later.
$post_content_filtered = $postarr['post_content_filtered'];
$post_author = isset( $postarr['post_author'] ) ? $postarr['post_author'] : $user_id;
$ping_status = empty( $postarr['ping_status'] ) ? get_default_comment_status( $post_type, 'pingback' ) : $postarr['ping_status'];
$to_ping = isset( $postarr['to_ping'] ) ? sanitize_trackback_urls( $postarr['to_ping'] ) : '';
$pinged = isset( $postarr['pinged'] ) ? $postarr['pinged'] : '';
$import_id = isset( $postarr['import_id'] ) ? $postarr['import_id'] : 0;
/*
* The 'wp_insert_post_parent' filter expects all variables to be present.
* Previously, these variables would have already been extracted
*/
if ( isset( $postarr['menu_order'] ) ) {
$menu_order = (int) $postarr['menu_order'];
} else {
$menu_order = 0;
}
$post_password = isset( $postarr['post_password'] ) ? $postarr['post_password'] : '';
if ( 'private' === $post_status ) {
$post_password = '';
}
if ( isset( $postarr['post_parent'] ) ) {
$post_parent = (int) $postarr['post_parent'];
} else {
$post_parent = 0;
}
$new_postarr = array_merge(
array(
'ID' => $post_ID,
),
compact( array_diff( array_keys( $defaults ), array( 'context', 'filter' ) ) )
);
/**
* Filters the post parent -- used to check for and prevent hierarchy loops.
*
* @since 3.1.0
*
* @param int $post_parent Post parent ID.
* @param int $post_ID Post ID.
* @param array $new_postarr Array of parsed post data.
* @param array $postarr Array of sanitized, but otherwise unmodified post data.
*/
$post_parent = apply_filters( 'wp_insert_post_parent', $post_parent, $post_ID, $new_postarr, $postarr );
/*
* If the post is being untrashed and it has a desired slug stored in post meta,
* reassign it.
*/
if ( 'trash' === $previous_status && 'trash' !== $post_status ) {
$desired_post_slug = get_post_meta( $post_ID, '_wp_desired_post_slug', true );
if ( $desired_post_slug ) {
delete_post_meta( $post_ID, '_wp_desired_post_slug' );
$post_name = $desired_post_slug;
}
}
// If a trashed post has the desired slug, change it and let this post have it.
if ( 'trash' !== $post_status && $post_name ) {
/**
* Filters whether or not to add a `__trashed` suffix to trashed posts that match the name of the updated post.
*
* @since 5.4.0
*
* @param bool $add_trashed_suffix Whether to attempt to add the suffix.
* @param string $post_name The name of the post being updated.
* @param int $post_ID Post ID.
*/
$add_trashed_suffix = apply_filters( 'add_trashed_suffix_to_trashed_posts', true, $post_name, $post_ID );
if ( $add_trashed_suffix ) {
wp_add_trashed_suffix_to_post_name_for_trashed_posts( $post_name, $post_ID );
}
}
// When trashing an existing post, change its slug to allow non-trashed posts to use it.
if ( 'trash' === $post_status && 'trash' !== $previous_status && 'new' !== $previous_status ) {
$post_name = wp_add_trashed_suffix_to_post_name_for_post( $post_ID );
}
$post_name = wp_unique_post_slug( $post_name, $post_ID, $post_status, $post_type, $post_parent );
// Don't unslash.
$post_mime_type = isset( $postarr['post_mime_type'] ) ? $postarr['post_mime_type'] : '';
// Expected_slashed (everything!).
$data = compact(
'post_author',
'post_date',
'post_date_gmt',
'post_content',
'post_content_filtered',
'post_title',
'post_excerpt',
'post_status',
'post_type',
'comment_status',
'ping_status',
'post_password',
'post_name',
'to_ping',
'pinged',
'post_modified',
'post_modified_gmt',
'post_parent',
'menu_order',
'post_mime_type',
'guid'
);
$emoji_fields = array( 'post_title', 'post_content', 'post_excerpt' );
foreach ( $emoji_fields as $emoji_field ) {
if ( isset( $data[ $emoji_field ] ) ) {
$charset = $wpdb->get_col_charset( $wpdb->posts, $emoji_field );
if ( 'utf8' === $charset ) {
$data[ $emoji_field ] = wp_encode_emoji( $data[ $emoji_field ] );
}
}
}
if ( 'attachment' === $post_type ) {
/**
* Filters attachment post data before it is updated in or added to the database.
*
* @since 3.9.0
* @since 5.4.1 The `$unsanitized_postarr` parameter was added.
* @since 6.0.0 The `$update` parameter was added.
*
* @param array $data An array of slashed, sanitized, and processed attachment post data.
* @param array $postarr An array of slashed and sanitized attachment post data, but not processed.
* @param array $unsanitized_postarr An array of slashed yet *unsanitized* and unprocessed attachment post data
* as originally passed to wp_insert_post().
* @param bool $update Whether this is an existing attachment post being updated.
*/
$data = apply_filters( 'wp_insert_attachment_data', $data, $postarr, $unsanitized_postarr, $update );
} else {
/**
* Filters slashed post data just before it is inserted into the database.
*
* @since 2.7.0
* @since 5.4.1 The `$unsanitized_postarr` parameter was added.
* @since 6.0.0 The `$update` parameter was added.
*
* @param array $data An array of slashed, sanitized, and processed post data.
* @param array $postarr An array of sanitized (and slashed) but otherwise unmodified post data.
* @param array $unsanitized_postarr An array of slashed yet *unsanitized* and unprocessed post data as
* originally passed to wp_insert_post().
* @param bool $update Whether this is an existing post being updated.
*/
$data = apply_filters( 'wp_insert_post_data', $data, $postarr, $unsanitized_postarr, $update );
}
$data = wp_unslash( $data );
$where = array( 'ID' => $post_ID );
if ( $update ) {
/**
* Fires immediately before an existing post is updated in the database.
*
* @since 2.5.0
*
* @param int $post_ID Post ID.
* @param array $data Array of unslashed post data.
*/
do_action( 'pre_post_update', $post_ID, $data );
if ( false === $wpdb->update( $wpdb->posts, $data, $where ) ) {
if ( $wp_error ) {
if ( 'attachment' === $post_type ) {
$message = __( 'Could not update attachment in the database.' );
} else {
$message = __( 'Could not update post in the database.' );
}
return new WP_Error( 'db_update_error', $message, $wpdb->last_error );
} else {
return 0;
}
}
} else {
// If there is a suggested ID, use it if not already present.
if ( ! empty( $import_id ) ) {
$import_id = (int) $import_id;
if ( ! $wpdb->get_var( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE ID = %d", $import_id ) ) ) {
$data['ID'] = $import_id;
}
}
if ( false === $wpdb->insert( $wpdb->posts, $data ) ) {
if ( $wp_error ) {
if ( 'attachment' === $post_type ) {
$message = __( 'Could not insert attachment into the database.' );
} else {
$message = __( 'Could not insert post into the database.' );
}
return new WP_Error( 'db_insert_error', $message, $wpdb->last_error );
} else {
return 0;
}
}
$post_ID = (int) $wpdb->insert_id;
// Use the newly generated $post_ID.
$where = array( 'ID' => $post_ID );
}
if ( empty( $data['post_name'] ) && ! in_array( $data['post_status'], array( 'draft', 'pending', 'auto-draft' ), true ) ) {
$data['post_name'] = wp_unique_post_slug( sanitize_title( $data['post_title'], $post_ID ), $post_ID, $data['post_status'], $post_type, $post_parent );
$wpdb->update( $wpdb->posts, array( 'post_name' => $data['post_name'] ), $where );
clean_post_cache( $post_ID );
}
if ( is_object_in_taxonomy( $post_type, 'category' ) ) {
wp_set_post_categories( $post_ID, $post_category );
}
if ( isset( $postarr['tags_input'] ) && is_object_in_taxonomy( $post_type, 'post_tag' ) ) {
wp_set_post_tags( $post_ID, $postarr['tags_input'] );
}
// Add default term for all associated custom taxonomies.
if ( 'auto-draft' !== $post_status ) {
foreach ( get_object_taxonomies( $post_type, 'object' ) as $taxonomy => $tax_object ) {
if ( ! empty( $tax_object->default_term ) ) {
// Filter out empty terms.
if ( isset( $postarr['tax_input'][ $taxonomy ] ) && is_array( $postarr['tax_input'][ $taxonomy ] ) ) {
$postarr['tax_input'][ $taxonomy ] = array_filter( $postarr['tax_input'][ $taxonomy ] );
}
// Passed custom taxonomy list overwrites the existing list if not empty.
$terms = wp_get_object_terms( $post_ID, $taxonomy, array( 'fields' => 'ids' ) );
if ( ! empty( $terms ) && empty( $postarr['tax_input'][ $taxonomy ] ) ) {
$postarr['tax_input'][ $taxonomy ] = $terms;
}
if ( empty( $postarr['tax_input'][ $taxonomy ] ) ) {
$default_term_id = get_option( 'default_term_' . $taxonomy );
if ( ! empty( $default_term_id ) ) {
$postarr['tax_input'][ $taxonomy ] = array( (int) $default_term_id );
}
}
}
}
}
// New-style support for all custom taxonomies.
if ( ! empty( $postarr['tax_input'] ) ) {
foreach ( $postarr['tax_input'] as $taxonomy => $tags ) {
$taxonomy_obj = get_taxonomy( $taxonomy );
if ( ! $taxonomy_obj ) {
/* translators: %s: Taxonomy name. */
_doing_it_wrong( __FUNCTION__, sprintf( __( 'Invalid taxonomy: %s.' ), $taxonomy ), '4.4.0' );
continue;
}
// array = hierarchical, string = non-hierarchical.
if ( is_array( $tags ) ) {
$tags = array_filter( $tags );
}
if ( current_user_can( $taxonomy_obj->cap->assign_terms ) ) {
wp_set_post_terms( $post_ID, $tags, $taxonomy );
}
}
}
if ( ! empty( $postarr['meta_input'] ) ) {
foreach ( $postarr['meta_input'] as $field => $value ) {
update_post_meta( $post_ID, $field, $value );
}
}
$current_guid = get_post_field( 'guid', $post_ID );
// Set GUID.
if ( ! $update && '' === $current_guid ) {
$wpdb->update( $wpdb->posts, array( 'guid' => get_permalink( $post_ID ) ), $where );
}
if ( 'attachment' === $postarr['post_type'] ) {
if ( ! empty( $postarr['file'] ) ) {
update_attached_file( $post_ID, $postarr['file'] );
}
if ( ! empty( $postarr['context'] ) ) {
add_post_meta( $post_ID, '_wp_attachment_context', $postarr['context'], true );
}
}
// Set or remove featured image.
if ( isset( $postarr['_thumbnail_id'] ) ) {
$thumbnail_support = current_theme_supports( 'post-thumbnails', $post_type ) && post_type_supports( $post_type, 'thumbnail' ) || 'revision' === $post_type;
if ( ! $thumbnail_support && 'attachment' === $post_type && $post_mime_type ) {
if ( wp_attachment_is( 'audio', $post_ID ) ) {
$thumbnail_support = post_type_supports( 'attachment:audio', 'thumbnail' ) || current_theme_supports( 'post-thumbnails', 'attachment:audio' );
} elseif ( wp_attachment_is( 'video', $post_ID ) ) {
$thumbnail_support = post_type_supports( 'attachment:video', 'thumbnail' ) || current_theme_supports( 'post-thumbnails', 'attachment:video' );
}
}
if ( $thumbnail_support ) {
$thumbnail_id = (int) $postarr['_thumbnail_id'];
if ( -1 === $thumbnail_id ) {
delete_post_thumbnail( $post_ID );
} else {
set_post_thumbnail( $post_ID, $thumbnail_id );
}
}
}
clean_post_cache( $post_ID );
$post = get_post( $post_ID );
if ( ! empty( $postarr['page_template'] ) ) {
$post->page_template = $postarr['page_template'];
$page_templates = wp_get_theme()->get_page_templates( $post );
if ( 'default' !== $postarr['page_template'] && ! isset( $page_templates[ $postarr['page_template'] ] ) ) {
if ( $wp_error ) {
return new WP_Error( 'invalid_page_template', __( 'Invalid page template.' ) );
}
update_post_meta( $post_ID, '_wp_page_template', 'default' );
} else {
update_post_meta( $post_ID, '_wp_page_template', $postarr['page_template'] );
}
}
if ( 'attachment' !== $postarr['post_type'] ) {
wp_transition_post_status( $data['post_status'], $previous_status, $post );
} else {
if ( $update ) {
/**
* Fires once an existing attachment has been updated.
*
* @since 2.0.0
*
* @param int $post_ID Attachment ID.
*/
do_action( 'edit_attachment', $post_ID );
$post_after = get_post( $post_ID );
/**
* Fires once an existing attachment has been updated.
*
* @since 4.4.0
*
* @param int $post_ID Post ID.
* @param WP_Post $post_after Post object following the update.
* @param WP_Post $post_before Post object before the update.
*/
do_action( 'attachment_updated', $post_ID, $post_after, $post_before );
} else {
/**
* Fires once an attachment has been added.
*
* @since 2.0.0
*
* @param int $post_ID Attachment ID.
*/
do_action( 'add_attachment', $post_ID );
}
return $post_ID;
}
if ( $update ) {
/**
* Fires once an existing post has been updated.
*
* The dynamic portion of the hook name, `$post->post_type`, refers to
* the post type slug.
*
* Possible hook names include:
*
* - `edit_post_post`
* - `edit_post_page`
*
* @since 5.1.0
*
* @param int $post_ID Post ID.
* @param WP_Post $post Post object.
*/
do_action( "edit_post_{$post->post_type}", $post_ID, $post );
/**
* Fires once an existing post has been updated.
*
* @since 1.2.0
*
* @param int $post_ID Post ID.
* @param WP_Post $post Post object.
*/
do_action( 'edit_post', $post_ID, $post );
$post_after = get_post( $post_ID );
/**
* Fires once an existing post has been updated.
*
* @since 3.0.0
*
* @param int $post_ID Post ID.
* @param WP_Post $post_after Post object following the update.
* @param WP_Post $post_before Post object before the update.
*/
do_action( 'post_updated', $post_ID, $post_after, $post_before );
}
/**
* Fires once a post has been saved.
*
* The dynamic portion of the hook name, `$post->post_type`, refers to
* the post type slug.
*
* Possible hook names include:
*
* - `save_post_post`
* - `save_post_page`
*
* @since 3.7.0
*
* @param int $post_ID Post ID.
* @param WP_Post $post Post object.
* @param bool $update Whether this is an existing post being updated.
*/
do_action( "save_post_{$post->post_type}", $post_ID, $post, $update );
/**
* Fires once a post has been saved.
*
* @since 1.5.0
*
* @param int $post_ID Post ID.
* @param WP_Post $post Post object.
* @param bool $update Whether this is an existing post being updated.
*/
do_action( 'save_post', $post_ID, $post, $update );
/**
* Fires once a post has been saved.
*
* @since 2.0.0
*
* @param int $post_ID Post ID.
* @param WP_Post $post Post object.
* @param bool $update Whether this is an existing post being updated.
*/
do_action( 'wp_insert_post', $post_ID, $post, $update );
if ( $fire_after_hooks ) {
wp_after_insert_post( $post, $update, $post_before );
}
return $post_ID;
}
```
[do\_action( 'add\_attachment', int $post\_ID )](../hooks/add_attachment)
Fires once an attachment has been added.
[apply\_filters( 'add\_trashed\_suffix\_to\_trashed\_posts', bool $add\_trashed\_suffix, string $post\_name, int $post\_ID )](../hooks/add_trashed_suffix_to_trashed_posts)
Filters whether or not to add a `__trashed` suffix to trashed posts that match the name of the updated post.
[do\_action( 'attachment\_updated', int $post\_ID, WP\_Post $post\_after, WP\_Post $post\_before )](../hooks/attachment_updated)
Fires once an existing attachment has been updated.
[do\_action( 'edit\_attachment', int $post\_ID )](../hooks/edit_attachment)
Fires once an existing attachment has been updated.
[do\_action( 'edit\_post', int $post\_ID, WP\_Post $post )](../hooks/edit_post)
Fires once an existing post has been updated.
[do\_action( "edit\_post\_{$post->post\_type}", int $post\_ID, WP\_Post $post )](../hooks/edit_post_post-post_type)
Fires once an existing post has been updated.
[do\_action( 'post\_updated', int $post\_ID, WP\_Post $post\_after, WP\_Post $post\_before )](../hooks/post_updated)
Fires once an existing post has been updated.
[do\_action( 'pre\_post\_update', int $post\_ID, array $data )](../hooks/pre_post_update)
Fires immediately before an existing post is updated in the database.
[do\_action( 'save\_post', int $post\_ID, WP\_Post $post, bool $update )](../hooks/save_post)
Fires once a post has been saved.
[do\_action( "save\_post\_{$post->post\_type}", int $post\_ID, WP\_Post $post, bool $update )](../hooks/save_post_post-post_type)
Fires once a post has been saved.
[apply\_filters( 'wp\_insert\_attachment\_data', array $data, array $postarr, array $unsanitized\_postarr, bool $update )](../hooks/wp_insert_attachment_data)
Filters attachment post data before it is updated in or added to the database.
[do\_action( 'wp\_insert\_post', int $post\_ID, WP\_Post $post, bool $update )](../hooks/wp_insert_post)
Fires once a post has been saved.
[apply\_filters( 'wp\_insert\_post\_data', array $data, array $postarr, array $unsanitized\_postarr, bool $update )](../hooks/wp_insert_post_data)
Filters slashed post data just before it is inserted into the database.
[apply\_filters( 'wp\_insert\_post\_empty\_content', bool $maybe\_empty, array $postarr )](../hooks/wp_insert_post_empty_content)
Filters whether the post should be considered “empty”.
[apply\_filters( 'wp\_insert\_post\_parent', int $post\_parent, int $post\_ID, array $new\_postarr, array $postarr )](../hooks/wp_insert_post_parent)
Filters the post parent — used to check for and prevent hierarchy loops.
| Uses | Description |
| --- | --- |
| [wp\_resolve\_post\_date()](wp_resolve_post_date) wp-includes/post.php | Uses wp\_checkdate to return a valid Gregorian-calendar value for post\_date. |
| [delete\_post\_meta()](delete_post_meta) wp-includes/post.php | Deletes a post meta field for the given post ID. |
| [wp\_get\_object\_terms()](wp_get_object_terms) wp-includes/taxonomy.php | Retrieves the terms associated with the given object(s), in the supplied taxonomies. |
| [get\_object\_taxonomies()](get_object_taxonomies) wp-includes/taxonomy.php | Returns the names or objects of the taxonomies which are registered for the requested object or object type, such as a post object or post type name. |
| [get\_post\_field()](get_post_field) wp-includes/post.php | Retrieves data from a post field based on Post ID. |
| [add\_post\_meta()](add_post_meta) wp-includes/post.php | Adds a meta field to the given post. |
| [wp\_after\_insert\_post()](wp_after_insert_post) wp-includes/post.php | Fires actions after a post, its terms and meta data has been saved. |
| [update\_post\_meta()](update_post_meta) wp-includes/post.php | Updates a post meta field based on the given post ID. |
| [clean\_post\_cache()](clean_post_cache) wp-includes/post.php | Will clean the post in the cache. |
| [post\_type\_supports()](post_type_supports) wp-includes/post.php | Checks a post type’s support for a given feature. |
| [delete\_post\_thumbnail()](delete_post_thumbnail) wp-includes/post.php | Removes the thumbnail (featured image) from the given post. |
| [set\_post\_thumbnail()](set_post_thumbnail) wp-includes/post.php | Sets the post thumbnail (featured image) for the given post. |
| [wp\_unique\_post\_slug()](wp_unique_post_slug) wp-includes/post.php | Computes a unique slug for the post, when given the desired slug and some post details. |
| [wp\_set\_post\_categories()](wp_set_post_categories) wp-includes/post.php | Sets categories for a post. |
| [wp\_set\_post\_tags()](wp_set_post_tags) wp-includes/post.php | Sets the tags for a post. |
| [wp\_set\_post\_terms()](wp_set_post_terms) wp-includes/post.php | Sets the terms for a post. |
| [wp\_transition\_post\_status()](wp_transition_post_status) wp-includes/post.php | Fires actions related to the transitioning of a post’s status. |
| [is\_object\_in\_taxonomy()](is_object_in_taxonomy) wp-includes/taxonomy.php | Determines if the given object type is associated with the given taxonomy. |
| [current\_time()](current_time) wp-includes/functions.php | Retrieves the current time based on specified type. |
| [sanitize\_post()](sanitize_post) wp-includes/post.php | Sanitizes every post field. |
| [get\_default\_comment\_status()](get_default_comment_status) wp-includes/comment.php | Gets the default comment status for a post type. |
| [WP\_Theme::get\_page\_templates()](../classes/wp_theme/get_page_templates) wp-includes/class-wp-theme.php | Returns the theme’s post templates for a given post type. |
| [sanitize\_title()](sanitize_title) wp-includes/formatting.php | Sanitizes a string into a slug, which can be used in URLs or HTML attributes. |
| [get\_gmt\_from\_date()](get_gmt_from_date) wp-includes/formatting.php | Given a date in the timezone of the site, returns that date in UTC. |
| [wp\_add\_trashed\_suffix\_to\_post\_name\_for\_trashed\_posts()](wp_add_trashed_suffix_to_post_name_for_trashed_posts) wp-includes/post.php | Adds a suffix if any trashed posts have a given slug. |
| [update\_attached\_file()](update_attached_file) wp-includes/post.php | Updates attachment file path based on attachment ID. |
| [sanitize\_trackback\_urls()](sanitize_trackback_urls) wp-includes/formatting.php | Sanitizes space or carriage return separated URLs that are used to send trackbacks. |
| [wpdb::update()](../classes/wpdb/update) wp-includes/class-wpdb.php | Updates a row in the table. |
| [get\_post\_stati()](get_post_stati) wp-includes/post.php | Gets a list of post statuses. |
| [wpdb::insert()](../classes/wpdb/insert) wp-includes/class-wpdb.php | Inserts a row into the table. |
| [wp\_add\_trashed\_suffix\_to\_post\_name\_for\_post()](wp_add_trashed_suffix_to_post_name_for_post) wp-includes/post.php | Adds a trashed suffix for a given post. |
| [wp\_attachment\_is()](wp_attachment_is) wp-includes/post.php | Verifies an attachment is of a given type. |
| [wp\_encode\_emoji()](wp_encode_emoji) wp-includes/formatting.php | Converts emoji characters to their equivalent HTML entity. |
| [wpdb::get\_col\_charset()](../classes/wpdb/get_col_charset) wp-includes/class-wpdb.php | Retrieves the character set for the given column. |
| [get\_post\_type\_object()](get_post_type_object) wp-includes/post.php | Retrieves a post type object by name. |
| [wpdb::prepare()](../classes/wpdb/prepare) wp-includes/class-wpdb.php | Prepares a SQL query for safe execution. |
| [get\_post()](get_post) wp-includes/post.php | Retrieves post data given a post ID or post object. |
| [wpdb::get\_var()](../classes/wpdb/get_var) wp-includes/class-wpdb.php | Retrieves one variable from the database. |
| [do\_action()](do_action) wp-includes/plugin.php | Calls the callback functions that have been added to an action hook. |
| [get\_post\_meta()](get_post_meta) wp-includes/post.php | Retrieves a post meta field for the given post ID. |
| [get\_current\_user\_id()](get_current_user_id) wp-includes/user.php | Gets the current user’s ID. |
| [get\_option()](get_option) wp-includes/option.php | Retrieves an option value based on an option name. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| [get\_permalink()](get_permalink) wp-includes/link-template.php | Retrieves the full permalink for the current post or post ID. |
| [get\_taxonomy()](get_taxonomy) wp-includes/taxonomy.php | Retrieves the taxonomy object of $taxonomy. |
| [wp\_parse\_args()](wp_parse_args) wp-includes/functions.php | Merges user defined arguments into defaults array. |
| [\_doing\_it\_wrong()](_doing_it_wrong) wp-includes/functions.php | Marks something as being incorrectly called. |
| [wp\_unslash()](wp_unslash) wp-includes/formatting.php | Removes slashes from a string or recursively removes slashes from strings within an array. |
| [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. |
| [wp\_get\_theme()](wp_get_theme) wp-includes/theme.php | Gets a [WP\_Theme](../classes/wp_theme) object for a theme. |
| [current\_theme\_supports()](current_theme_supports) wp-includes/theme.php | Checks a theme’s support for a given feature. |
| [current\_user\_can()](current_user_can) wp-includes/capabilities.php | Returns whether the current user has the specified capability. |
| [WP\_Error::\_\_construct()](../classes/wp_error/__construct) wp-includes/class-wp-error.php | Initializes the error. |
| Used By | Description |
| --- | --- |
| [WP\_Theme\_JSON\_Resolver::get\_user\_data\_from\_wp\_global\_styles()](../classes/wp_theme_json_resolver/get_user_data_from_wp_global_styles) wp-includes/class-wp-theme-json-resolver.php | Returns the custom post type that contains the user’s origin config for the active theme or a void array if none are found. |
| [WP\_REST\_Templates\_Controller::update\_item()](../classes/wp_rest_templates_controller/update_item) wp-includes/rest-api/endpoints/class-wp-rest-templates-controller.php | Updates a single template. |
| [WP\_REST\_Templates\_Controller::create\_item()](../classes/wp_rest_templates_controller/create_item) wp-includes/rest-api/endpoints/class-wp-rest-templates-controller.php | Creates a single template. |
| [wp\_create\_user\_request()](wp_create_user_request) wp-includes/user.php | Creates and logs a user request to perform a specific action. |
| [WP\_Customize\_Manager::save\_changeset\_post()](../classes/wp_customize_manager/save_changeset_post) wp-includes/class-wp-customize-manager.php | Saves the post for the loaded changeset. |
| [wp\_update\_custom\_css\_post()](wp_update_custom_css_post) wp-includes/theme.php | Updates the `custom_css` post for a given theme. |
| [WP\_REST\_Posts\_Controller::create\_item()](../classes/wp_rest_posts_controller/create_item) wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php | Creates a single post. |
| [WP\_Customize\_Nav\_Menus::insert\_auto\_draft\_post()](../classes/wp_customize_nav_menus/insert_auto_draft_post) wp-includes/class-wp-customize-nav-menus.php | Adds a new `auto-draft` post. |
| [wp\_write\_post()](wp_write_post) wp-admin/includes/post.php | Creates a new post from the “Write Post” form using `$_POST` information. |
| [get\_default\_post\_to\_edit()](get_default_post_to_edit) wp-admin/includes/post.php | Returns default post information to use when populating the “Write Post” form. |
| [WP\_Embed::shortcode()](../classes/wp_embed/shortcode) wp-includes/class-wp-embed.php | The [do\_shortcode()](do_shortcode) callback function. |
| [wp\_insert\_attachment()](wp_insert_attachment) wp-includes/post.php | Inserts an attachment. |
| [wp\_update\_post()](wp_update_post) wp-includes/post.php | Updates a post with new post data. |
| [\_wp\_put\_post\_revision()](_wp_put_post_revision) wp-includes/revision.php | Inserts post data into the posts table as a post revision. |
| [wp\_update\_nav\_menu\_item()](wp_update_nav_menu_item) wp-includes/nav-menu.php | Saves the properties of a menu item or create a new one. |
| [wp\_xmlrpc\_server::blogger\_newPost()](../classes/wp_xmlrpc_server/blogger_newpost) wp-includes/class-wp-xmlrpc-server.php | Creates new post. |
| [wp\_xmlrpc\_server::mw\_newPost()](../classes/wp_xmlrpc_server/mw_newpost) wp-includes/class-wp-xmlrpc-server.php | Create a new post. |
| [wp\_xmlrpc\_server::\_insert\_post()](../classes/wp_xmlrpc_server/_insert_post) wp-includes/class-wp-xmlrpc-server.php | Helper method for wp\_newPost() and wp\_editPost(), containing shared logic. |
| Version | Description |
| --- | --- |
| [5.6.0](https://developer.wordpress.org/reference/since/5.6.0/) | Added the `$fire_after_hooks` parameter. |
| [4.4.0](https://developer.wordpress.org/reference/since/4.4.0/) | A `'meta_input'` array can now be passed to `$postarr` to add post meta data. |
| [4.2.0](https://developer.wordpress.org/reference/since/4.2.0/) | Support was added for encoding emoji in the post title, content, and excerpt. |
| [2.6.0](https://developer.wordpress.org/reference/since/2.6.0/) | Added the `$wp_error` parameter to allow a [WP\_Error](../classes/wp_error) to be returned on failure. |
| [1.0.0](https://developer.wordpress.org/reference/since/1.0.0/) | Introduced. |
| programming_docs |
wordpress rest_validate_json_schema_pattern( string $pattern, string $value ): bool rest\_validate\_json\_schema\_pattern( string $pattern, string $value ): bool
=============================================================================
Validates if the JSON Schema pattern matches a value.
`$pattern` string Required The pattern to match against. `$value` string Required The value to check. bool True if the pattern matches the given value, false otherwise.
File: `wp-includes/rest-api.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/rest-api.php/)
```
function rest_validate_json_schema_pattern( $pattern, $value ) {
$escaped_pattern = str_replace( '#', '\\#', $pattern );
return 1 === preg_match( '#' . $escaped_pattern . '#u', $value );
}
```
| Used By | Description |
| --- | --- |
| [rest\_validate\_string\_value\_from\_schema()](rest_validate_string_value_from_schema) wp-includes/rest-api.php | Validates a string value based on a schema. |
| [rest\_find\_matching\_pattern\_property\_schema()](rest_find_matching_pattern_property_schema) wp-includes/rest-api.php | Finds the schema for a property using the patternProperties keyword. |
| Version | Description |
| --- | --- |
| [5.6.0](https://developer.wordpress.org/reference/since/5.6.0/) | Introduced. |
wordpress wp_credits( string $version = '', string $locale = '' ): array|false wp\_credits( string $version = '', string $locale = '' ): array|false
=====================================================================
Retrieve the contributor credits.
`$version` string Optional WordPress version. Defaults to the current version. Default: `''`
`$locale` string Optional WordPress locale. Defaults to the current user's locale. Default: `''`
array|false A list of all of the contributors, or false on error.
File: `wp-admin/includes/credits.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/credits.php/)
```
function wp_credits( $version = '', $locale = '' ) {
if ( ! $version ) {
// Include an unmodified $wp_version.
require ABSPATH . WPINC . '/version.php';
$version = $wp_version;
}
if ( ! $locale ) {
$locale = get_user_locale();
}
$results = get_site_transient( 'wordpress_credits_' . $locale );
if ( ! is_array( $results )
|| false !== strpos( $version, '-' )
|| ( isset( $results['data']['version'] ) && strpos( $version, $results['data']['version'] ) !== 0 )
) {
$url = "http://api.wordpress.org/core/credits/1.1/?version={$version}&locale={$locale}";
$options = array( 'user-agent' => 'WordPress/' . $version . '; ' . home_url( '/' ) );
if ( wp_http_supports( array( 'ssl' ) ) ) {
$url = set_url_scheme( $url, 'https' );
}
$response = wp_remote_get( $url, $options );
if ( is_wp_error( $response ) || 200 !== wp_remote_retrieve_response_code( $response ) ) {
return false;
}
$results = json_decode( wp_remote_retrieve_body( $response ), true );
if ( ! is_array( $results ) ) {
return false;
}
set_site_transient( 'wordpress_credits_' . $locale, $results, DAY_IN_SECONDS );
}
return $results;
}
```
| Uses | Description |
| --- | --- |
| [get\_user\_locale()](get_user_locale) wp-includes/l10n.php | Retrieves the locale of a user. |
| [set\_url\_scheme()](set_url_scheme) wp-includes/link-template.php | Sets the scheme for a URL. |
| [wp\_http\_supports()](wp_http_supports) wp-includes/http.php | Determines if there is an HTTP Transport that can process this request. |
| [wp\_remote\_get()](wp_remote_get) wp-includes/http.php | Performs an HTTP request using the GET method and returns its response. |
| [wp\_remote\_retrieve\_response\_code()](wp_remote_retrieve_response_code) wp-includes/http.php | Retrieve only the response code from the raw response. |
| [wp\_remote\_retrieve\_body()](wp_remote_retrieve_body) wp-includes/http.php | Retrieve only the body from the raw response. |
| [set\_site\_transient()](set_site_transient) wp-includes/option.php | Sets/updates the value of a site transient. |
| [get\_site\_transient()](get_site_transient) wp-includes/option.php | Retrieves the value of a site transient. |
| [home\_url()](home_url) wp-includes/link-template.php | Retrieves the URL for the current site where the front end is accessible. |
| [is\_wp\_error()](is_wp_error) wp-includes/load.php | Checks whether the given variable is a WordPress Error. |
| Version | Description |
| --- | --- |
| [5.6.0](https://developer.wordpress.org/reference/since/5.6.0/) | Added the `$version` and `$locale` parameters. |
| [3.2.0](https://developer.wordpress.org/reference/since/3.2.0/) | Introduced. |
wordpress selected( mixed $selected, mixed $current = true, bool $echo = true ): string selected( mixed $selected, mixed $current = true, bool $echo = true ): string
=============================================================================
Outputs the HTML selected attribute.
Compares the first two arguments and if identical marks as selected.
`$selected` mixed Required One of the values to compare. `$current` mixed Optional The other value to compare if not just true.
Default: `true`
`$echo` bool Optional Whether to echo or just return the string.
Default: `true`
string HTML attribute or empty string.
File: `wp-includes/general-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/general-template.php/)
```
function selected( $selected, $current = true, $echo = true ) {
return __checked_selected_helper( $selected, $current, $echo, 'selected' );
}
```
| Uses | Description |
| --- | --- |
| [\_\_checked\_selected\_helper()](__checked_selected_helper) wp-includes/general-template.php | Private helper function for checked, selected, disabled and readonly. |
| Used By | Description |
| --- | --- |
| [WP\_Comments\_List\_Table::comment\_type\_dropdown()](../classes/wp_comments_list_table/comment_type_dropdown) wp-admin/includes/class-wp-comments-list-table.php | Displays a comment type drop-down for filtering on the Comments list table. |
| [WP\_Posts\_List\_Table::formats\_dropdown()](../classes/wp_posts_list_table/formats_dropdown) wp-admin/includes/class-wp-posts-list-table.php | Displays a formats drop-down for filtering items. |
| [WP\_Customize\_Nav\_Menu\_Location\_Control::render\_content()](../classes/wp_customize_nav_menu_location_control/render_content) wp-includes/customize/class-wp-customize-nav-menu-location-control.php | Render content just like a normal select control. |
| [wp\_dropdown\_languages()](wp_dropdown_languages) wp-includes/l10n.php | Displays or returns a Language selector. |
| [install\_theme\_search\_form()](install_theme_search_form) wp-admin/includes/theme-install.php | Displays search form for searching themes. |
| [WP\_List\_Table::months\_dropdown()](../classes/wp_list_table/months_dropdown) wp-admin/includes/class-wp-list-table.php | Displays a dropdown for filtering items in the list table by month. |
| [mu\_dropdown\_languages()](mu_dropdown_languages) wp-admin/includes/ms.php | Generates and displays a drop-down of available languages. |
| [choose\_primary\_blog()](choose_primary_blog) wp-admin/includes/ms.php | Handles the display of choosing a user’s primary site. |
| [install\_search\_form()](install_search_form) wp-admin/includes/plugin-install.php | Displays a search form for searching plugins. |
| [touch\_time()](touch_time) wp-admin/includes/template.php | Prints out HTML form date elements for editing post or comment publish date. |
| [page\_template\_dropdown()](page_template_dropdown) wp-admin/includes/template.php | Prints out option HTML elements for the page templates drop-down. |
| [parent\_dropdown()](parent_dropdown) wp-admin/includes/template.php | Prints out option HTML elements for the page parents drop-down. |
| [media\_upload\_library\_form()](media_upload_library_form) wp-admin/includes/media.php | Outputs the legacy media upload form for the media library. |
| [post\_submit\_meta\_box()](post_submit_meta_box) wp-admin/includes/meta-boxes.php | Displays post submit form fields. |
| [WP\_Media\_List\_Table::get\_views()](../classes/wp_media_list_table/get_views) wp-admin/includes/class-wp-media-list-table.php | |
| [Custom\_Background::admin\_page()](../classes/custom_background/admin_page) wp-admin/includes/class-custom-background.php | Displays the custom background page. |
| [wp\_dropdown\_categories()](wp_dropdown_categories) wp-includes/category-template.php | Displays or retrieves the HTML dropdown list of categories. |
| [WP\_Nav\_Menu\_Widget::form()](../classes/wp_nav_menu_widget/form) wp-includes/widgets/class-wp-nav-menu-widget.php | Outputs the settings form for the Navigation Menu widget. |
| [WP\_Widget\_Tag\_Cloud::form()](../classes/wp_widget_tag_cloud/form) wp-includes/widgets/class-wp-widget-tag-cloud.php | Outputs the Tag Cloud widget settings form. |
| [WP\_Widget\_Links::form()](../classes/wp_widget_links/form) wp-includes/widgets/class-wp-widget-links.php | Outputs the settings form for the Links widget. |
| [WP\_Widget\_Pages::form()](../classes/wp_widget_pages/form) wp-includes/widgets/class-wp-widget-pages.php | Outputs the settings form for the Pages widget. |
| [wp\_widget\_rss\_form()](wp_widget_rss_form) wp-includes/widgets.php | Display RSS widget options form. |
| [wp\_dropdown\_users()](wp_dropdown_users) wp-includes/user.php | Creates dropdown HTML content of users. |
| [WP\_Customize\_Control::render\_content()](../classes/wp_customize_control/render_content) wp-includes/class-wp-customize-control.php | Render the control’s content. |
| [wp\_print\_media\_templates()](wp_print_media_templates) wp-includes/media-template.php | Prints the templates used in the media manager. |
| Version | Description |
| --- | --- |
| [1.0.0](https://developer.wordpress.org/reference/since/1.0.0/) | Introduced. |
wordpress wp_print_footer_scripts() wp\_print\_footer\_scripts()
============================
Hooks to print the scripts and styles in the footer.
File: `wp-includes/script-loader.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/script-loader.php/)
```
function wp_print_footer_scripts() {
/**
* Fires when footer scripts are printed.
*
* @since 2.8.0
*/
do_action( 'wp_print_footer_scripts' );
}
```
[do\_action( 'wp\_print\_footer\_scripts' )](../hooks/wp_print_footer_scripts)
Fires when footer scripts are printed.
| Uses | Description |
| --- | --- |
| [do\_action()](do_action) wp-includes/plugin.php | Calls the callback functions that have been added to an action hook. |
| Version | Description |
| --- | --- |
| [2.8.0](https://developer.wordpress.org/reference/since/2.8.0/) | Introduced. |
wordpress wp_is_using_https(): bool wp\_is\_using\_https(): bool
============================
Checks whether the website is using HTTPS.
This is based on whether both the home and site URL are using HTTPS.
* [wp\_is\_home\_url\_using\_https()](wp_is_home_url_using_https)
* [wp\_is\_site\_url\_using\_https()](wp_is_site_url_using_https)
bool True if using HTTPS, false otherwise.
File: `wp-includes/https-detection.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/https-detection.php/)
```
function wp_is_using_https() {
if ( ! wp_is_home_url_using_https() ) {
return false;
}
return wp_is_site_url_using_https();
}
```
| Uses | Description |
| --- | --- |
| [wp\_is\_home\_url\_using\_https()](wp_is_home_url_using_https) wp-includes/https-detection.php | Checks whether the current site URL is using HTTPS. |
| [wp\_is\_site\_url\_using\_https()](wp_is_site_url_using_https) wp-includes/https-detection.php | Checks whether the current site’s URL where WordPress is stored is using HTTPS. |
| Used By | Description |
| --- | --- |
| [wp\_should\_replace\_insecure\_home\_url()](wp_should_replace_insecure_home_url) wp-includes/https-migration.php | Checks whether WordPress should replace old HTTP URLs to the site with their HTTPS counterpart. |
| [wp\_update\_urls\_to\_https()](wp_update_urls_to_https) wp-includes/https-migration.php | Update the ‘home’ and ‘siteurl’ option to use the HTTPS variant of their URL. |
| [WP\_Site\_Health::get\_test\_https\_status()](../classes/wp_site_health/get_test_https_status) wp-admin/includes/class-wp-site-health.php | Tests if the site is serving content over HTTPS. |
| Version | Description |
| --- | --- |
| [5.7.0](https://developer.wordpress.org/reference/since/5.7.0/) | Introduced. |
wordpress update_usermeta( int $user_id, string $meta_key, mixed $meta_value ): bool update\_usermeta( int $user\_id, string $meta\_key, mixed $meta\_value ): bool
==============================================================================
This function has been deprecated. Use [update\_user\_meta()](update_user_meta) instead.
Update metadata of user.
There is no need to serialize values, they will be serialized if it is needed. The metadata key can only be a string with underscores. All else will be removed.
Will remove the metadata, if the meta value is empty.
* [update\_user\_meta()](update_user_meta)
`$user_id` int Required User ID `$meta_key` string Required Metadata key. `$meta_value` mixed Required Metadata value. bool True on successful update, false on failure.
File: `wp-includes/deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/deprecated.php/)
```
function update_usermeta( $user_id, $meta_key, $meta_value ) {
_deprecated_function( __FUNCTION__, '3.0.0', 'update_user_meta()' );
global $wpdb;
if ( !is_numeric( $user_id ) )
return false;
$meta_key = preg_replace('|[^a-z0-9_]|i', '', $meta_key);
/** @todo Might need fix because usermeta data is assumed to be already escaped */
if ( is_string($meta_value) )
$meta_value = stripslashes($meta_value);
$meta_value = maybe_serialize($meta_value);
if (empty($meta_value)) {
return delete_usermeta($user_id, $meta_key);
}
$cur = $wpdb->get_row( $wpdb->prepare("SELECT * FROM $wpdb->usermeta WHERE user_id = %d AND meta_key = %s", $user_id, $meta_key) );
if ( $cur )
do_action( 'update_usermeta', $cur->umeta_id, $user_id, $meta_key, $meta_value );
if ( !$cur )
$wpdb->insert($wpdb->usermeta, compact('user_id', 'meta_key', 'meta_value') );
elseif ( $cur->meta_value != $meta_value )
$wpdb->update($wpdb->usermeta, compact('meta_value'), compact('user_id', 'meta_key') );
else
return false;
clean_user_cache( $user_id );
wp_cache_delete( $user_id, 'user_meta' );
if ( !$cur )
do_action( 'added_usermeta', $wpdb->insert_id, $user_id, $meta_key, $meta_value );
else
do_action( 'updated_usermeta', $cur->umeta_id, $user_id, $meta_key, $meta_value );
return true;
}
```
| Uses | Description |
| --- | --- |
| [wp\_cache\_delete()](wp_cache_delete) wp-includes/cache.php | Removes the cache contents matching key and group. |
| [delete\_usermeta()](delete_usermeta) wp-includes/deprecated.php | Remove user meta data. |
| [maybe\_serialize()](maybe_serialize) wp-includes/functions.php | Serializes data, if needed. |
| [clean\_user\_cache()](clean_user_cache) wp-includes/user.php | Cleans all user caches. |
| [wpdb::get\_row()](../classes/wpdb/get_row) wp-includes/class-wpdb.php | Retrieves one row from the database. |
| [wpdb::insert()](../classes/wpdb/insert) wp-includes/class-wpdb.php | Inserts a row into the table. |
| [wpdb::update()](../classes/wpdb/update) wp-includes/class-wpdb.php | Updates a row in the table. |
| [\_deprecated\_function()](_deprecated_function) wp-includes/functions.php | Marks a function as deprecated and inform when it has been used. |
| [do\_action()](do_action) wp-includes/plugin.php | Calls the callback functions that have been added to an action hook. |
| [wpdb::prepare()](../classes/wpdb/prepare) wp-includes/class-wpdb.php | Prepares a SQL query for safe execution. |
| Version | Description |
| --- | --- |
| [3.0.0](https://developer.wordpress.org/reference/since/3.0.0/) | Use [update\_user\_meta()](update_user_meta) |
| [2.0.0](https://developer.wordpress.org/reference/since/2.0.0/) | Introduced. |
wordpress submit_button( string $text = null, string $type = 'primary', string $name = 'submit', bool $wrap = true, array|string $other_attributes = null ) submit\_button( string $text = null, string $type = 'primary', string $name = 'submit', bool $wrap = true, array|string $other\_attributes = null )
===================================================================================================================================================
Echoes a submit button, with provided text and appropriate class(es).
* [get\_submit\_button()](get_submit_button)
`$text` string Optional The text of the button (defaults to 'Save Changes') Default: `null`
`$type` string Optional The type and CSS class(es) of the button. Core values include `'primary'`, `'small'`, and `'large'`. Default `'primary'`. Default: `'primary'`
`$name` string Optional The HTML name of the submit button. Defaults to "submit". If no id attribute is given in $other\_attributes below, $name will be used as the button's id. Default: `'submit'`
`$wrap` bool Optional True if the output button should be wrapped in a paragraph tag, false otherwise. Defaults to true. Default: `true`
`$other_attributes` array|string Optional Other attributes that should be output with the button, mapping attributes to their values, such as setting tabindex to 1, etc.
These key/value attribute pairs will be output as attribute="value", where attribute is the key. Other attributes can also be provided as a string such as `'tabindex="1"'`, though the array format is preferred. Default: `null`
This function cannot be used on the front end of the site, it is only available when loading the administration screens.
Parametr `$type` can be a single value, or a space separated list of values, or an array of values. The values determine the HTML classes of the button.
* If $type is ‘delete’, the classes are ‘button-secondary delete’.
* Otherwise the first class is ‘button’, followed by any of these in order of appearance:
+ type value ‘primary’ makes class ‘button-primary’
+ type value ‘small’ makes class ‘button-small’
+ type value ‘large’ makes class ‘button-large’
+ type value ‘secondary’ or ‘button-secondary’ is ignored (the ‘button’ class has the styling)
+ any other type value ‘foo’ makes the class ‘foo’
For example, the default $type ‘primary’ results in a button with HTML classes ‘button button-primary’.
This function does not return a value. The HTML for the button is output directly to the browser.
Uses the related function [get\_submit\_button()](get_submit_button) , which returns the button as a string instead of echoing it. It has a different default $type, 'primary large', resulting in the HTML classes 'button button-primary button-large'.
File: `wp-admin/includes/template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/template.php/)
```
function submit_button( $text = null, $type = 'primary', $name = 'submit', $wrap = true, $other_attributes = null ) {
echo get_submit_button( $text, $type, $name, $wrap, $other_attributes );
}
```
| Uses | Description |
| --- | --- |
| [get\_submit\_button()](get_submit_button) wp-admin/includes/template.php | Returns a submit button, with provided text and appropriate class. |
| Used By | Description |
| --- | --- |
| [WP\_MS\_Sites\_List\_Table::extra\_tablenav()](../classes/wp_ms_sites_list_table/extra_tablenav) wp-admin/includes/class-wp-ms-sites-list-table.php | Extra controls to be displayed between bulk actions and pagination. |
| [wp\_print\_community\_events\_markup()](wp_print_community_events_markup) wp-admin/includes/dashboard.php | Prints the markup for the Community Events section of the Events and News Dashboard widget. |
| [WP\_Plugins\_List\_Table::search\_box()](../classes/wp_plugins_list_table/search_box) wp-admin/includes/class-wp-plugins-list-table.php | Displays the search box. |
| [network\_step1()](network_step1) wp-admin/includes/network.php | Prints step 1 for Network installation process. |
| [display\_setup\_form()](display_setup_form) wp-admin/install.php | Displays installer setup form. |
| [WP\_Screen::render\_screen\_options()](../classes/wp_screen/render_screen_options) wp-admin/includes/class-wp-screen.php | Renders the screen options tab. |
| [WP\_Plugins\_List\_Table::extra\_tablenav()](../classes/wp_plugins_list_table/extra_tablenav) wp-admin/includes/class-wp-plugins-list-table.php | |
| [WP\_Links\_List\_Table::extra\_tablenav()](../classes/wp_links_list_table/extra_tablenav) wp-admin/includes/class-wp-links-list-table.php | |
| [install\_theme\_search\_form()](install_theme_search_form) wp-admin/includes/theme-install.php | Displays search form for searching themes. |
| [install\_themes\_dashboard()](install_themes_dashboard) wp-admin/includes/theme-install.php | Displays tags filter for themes. |
| [install\_themes\_upload()](install_themes_upload) wp-admin/includes/theme-install.php | Displays a form to upload themes from zip files. |
| [WP\_List\_Table::search\_box()](../classes/wp_list_table/search_box) wp-admin/includes/class-wp-list-table.php | Displays the search box. |
| [WP\_List\_Table::bulk\_actions()](../classes/wp_list_table/bulk_actions) wp-admin/includes/class-wp-list-table.php | Displays the bulk actions dropdown. |
| [install\_search\_form()](install_search_form) wp-admin/includes/plugin-install.php | Displays a search form for searching plugins. |
| [install\_plugins\_upload()](install_plugins_upload) wp-admin/includes/plugin-install.php | Displays a form to upload plugins from zip files. |
| [\_wp\_dashboard\_control\_callback()](_wp_dashboard_control_callback) wp-admin/includes/dashboard.php | Outputs controls for the current dashboard widget. |
| [wp\_network\_dashboard\_right\_now()](wp_network_dashboard_right_now) wp-admin/includes/dashboard.php | |
| [wp\_dashboard\_quick\_press()](wp_dashboard_quick_press) wp-admin/includes/dashboard.php | The Quick Draft widget display and creation of drafts. |
| [find\_posts\_div()](find_posts_div) wp-admin/includes/template.php | Outputs the modal window used for attaching media to posts or pages in the media-listing screen. |
| [meta\_form()](meta_form) wp-admin/includes/template.php | Prints the form in the Custom Fields meta box. |
| [wp\_import\_upload\_form()](wp_import_upload_form) wp-admin/includes/template.php | Outputs the form used by the importers to accept the data to be imported. |
| [WP\_Users\_List\_Table::extra\_tablenav()](../classes/wp_users_list_table/extra_tablenav) wp-admin/includes/class-wp-users-list-table.php | Output the controls to allow user roles to be changed in bulk. |
| [media\_upload\_type\_form()](media_upload_type_form) wp-admin/includes/media.php | Outputs the legacy media upload form for a given media type. |
| [media\_upload\_gallery\_form()](media_upload_gallery_form) wp-admin/includes/media.php | Adds gallery form to upload iframe. |
| [media\_upload\_library\_form()](media_upload_library_form) wp-admin/includes/media.php | Outputs the legacy media upload form for the media library. |
| [media\_upload\_form()](media_upload_form) wp-admin/includes/media.php | Outputs the legacy media upload form. |
| [link\_submit\_meta\_box()](link_submit_meta_box) wp-admin/includes/meta-boxes.php | Displays link create form fields. |
| [post\_submit\_meta\_box()](post_submit_meta_box) wp-admin/includes/meta-boxes.php | Displays post submit form fields. |
| [attachment\_submit\_meta\_box()](attachment_submit_meta_box) wp-admin/includes/meta-boxes.php | Displays attachment submit form fields. |
| [WP\_Media\_List\_Table::extra\_tablenav()](../classes/wp_media_list_table/extra_tablenav) wp-admin/includes/class-wp-media-list-table.php | |
| [WP\_Comments\_List\_Table::extra\_tablenav()](../classes/wp_comments_list_table/extra_tablenav) wp-admin/includes/class-wp-comments-list-table.php | |
| [wp\_nav\_menu\_item\_post\_type\_meta\_box()](wp_nav_menu_item_post_type_meta_box) wp-admin/includes/nav-menu.php | Displays a meta box for a post type menu item. |
| [wp\_nav\_menu\_item\_taxonomy\_meta\_box()](wp_nav_menu_item_taxonomy_meta_box) wp-admin/includes/nav-menu.php | Displays a meta box for a taxonomy menu item. |
| [request\_filesystem\_credentials()](request_filesystem_credentials) wp-admin/includes/file.php | Displays a form to the user to request for their FTP/SSH details in order to connect to the filesystem. |
| [WP\_Posts\_List\_Table::inline\_edit()](../classes/wp_posts_list_table/inline_edit) wp-admin/includes/class-wp-posts-list-table.php | Outputs the hidden row displayed when inline editing |
| [wp\_widget\_control()](wp_widget_control) wp-admin/includes/widgets.php | Meta widget used to display the control form for a widget. |
| [WP\_Posts\_List\_Table::extra\_tablenav()](../classes/wp_posts_list_table/extra_tablenav) wp-admin/includes/class-wp-posts-list-table.php | |
| [Custom\_Image\_Header::step\_1()](../classes/custom_image_header/step_1) wp-admin/includes/class-custom-image-header.php | Display first step of custom header image page. |
| [Custom\_Image\_Header::step\_2()](../classes/custom_image_header/step_2) wp-admin/includes/class-custom-image-header.php | Display second step of custom header image page. |
| [confirm\_delete\_users()](confirm_delete_users) wp-admin/includes/ms.php | |
| [list\_core\_update()](list_core_update) wp-admin/update-core.php | Lists available core updates. |
| [Custom\_Background::admin\_page()](../classes/custom_background/admin_page) wp-admin/includes/class-custom-background.php | Displays the custom background page. |
| Version | Description |
| --- | --- |
| [3.1.0](https://developer.wordpress.org/reference/since/3.1.0/) | Introduced. |
| programming_docs |
wordpress wp_dashboard_events_news() wp\_dashboard\_events\_news()
=============================
Renders the Events and News dashboard widget.
File: `wp-admin/includes/dashboard.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/dashboard.php/)
```
function wp_dashboard_events_news() {
wp_print_community_events_markup();
?>
<div class="wordpress-news hide-if-no-js">
<?php wp_dashboard_primary(); ?>
</div>
<p class="community-events-footer">
<?php
printf(
'<a href="%1$s" target="_blank">%2$s <span class="screen-reader-text">%3$s</span><span aria-hidden="true" class="dashicons dashicons-external"></span></a>',
'https://make.wordpress.org/community/meetups-landing-page',
__( 'Meetups' ),
/* translators: Accessibility text. */
__( '(opens in a new tab)' )
);
?>
|
<?php
printf(
'<a href="%1$s" target="_blank">%2$s <span class="screen-reader-text">%3$s</span><span aria-hidden="true" class="dashicons dashicons-external"></span></a>',
'https://central.wordcamp.org/schedule/',
__( 'WordCamps' ),
/* translators: Accessibility text. */
__( '(opens in a new tab)' )
);
?>
|
<?php
printf(
'<a href="%1$s" target="_blank">%2$s <span class="screen-reader-text">%3$s</span><span aria-hidden="true" class="dashicons dashicons-external"></span></a>',
/* translators: If a Rosetta site exists (e.g. https://es.wordpress.org/news/), then use that. Otherwise, leave untranslated. */
esc_url( _x( 'https://wordpress.org/news/', 'Events and News dashboard widget' ) ),
__( 'News' ),
/* translators: Accessibility text. */
__( '(opens in a new tab)' )
);
?>
</p>
<?php
}
```
| Uses | Description |
| --- | --- |
| [wp\_print\_community\_events\_markup()](wp_print_community_events_markup) wp-admin/includes/dashboard.php | Prints the markup for the Community Events section of the Events and News Dashboard widget. |
| [wp\_dashboard\_primary()](wp_dashboard_primary) wp-admin/includes/dashboard.php | ‘WordPress Events and News’ dashboard widget. |
| [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. |
| [\_x()](_x) wp-includes/l10n.php | Retrieves translated string with gettext context. |
| [esc\_url()](esc_url) wp-includes/formatting.php | Checks and cleans a URL. |
| Version | Description |
| --- | --- |
| [4.8.0](https://developer.wordpress.org/reference/since/4.8.0/) | Introduced. |
wordpress wp_kses_no_null( string $string, array $options = null ): string wp\_kses\_no\_null( string $string, array $options = null ): string
===================================================================
Removes any invalid control characters in a text string.
Also removes any instance of the `\0` string.
`$string` string Required Content to filter null characters from. `$options` array Optional Set `'slash_zero'` => `'keep'` when `''` is allowed. Default is `'remove'`. Default: `null`
string Filtered content.
File: `wp-includes/kses.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/kses.php/)
```
function wp_kses_no_null( $string, $options = null ) {
if ( ! isset( $options['slash_zero'] ) ) {
$options = array( 'slash_zero' => 'remove' );
}
$string = preg_replace( '/[\x00-\x08\x0B\x0C\x0E-\x1F]/', '', $string );
if ( 'remove' === $options['slash_zero'] ) {
$string = preg_replace( '/\\\\+0+/', '', $string );
}
return $string;
}
```
| Used By | Description |
| --- | --- |
| [wp\_kses\_one\_attr()](wp_kses_one_attr) wp-includes/kses.php | Filters one HTML attribute and ensures its value is allowed. |
| [wp\_sanitize\_redirect()](wp_sanitize_redirect) wp-includes/pluggable.php | Sanitizes a URL for use in a redirect. |
| [safecss\_filter\_attr()](safecss_filter_attr) wp-includes/kses.php | Filters an inline style attribute and removes disallowed rules. |
| [wp\_kses\_bad\_protocol()](wp_kses_bad_protocol) wp-includes/kses.php | Sanitizes a string and removed disallowed URL protocols. |
| [wp\_kses()](wp_kses) wp-includes/kses.php | Filters text content and strips out disallowed HTML. |
| [get\_the\_content()](get_the_content) wp-includes/post-template.php | Retrieves the post content. |
| Version | Description |
| --- | --- |
| [1.0.0](https://developer.wordpress.org/reference/since/1.0.0/) | Introduced. |
wordpress _wp_ajax_delete_comment_response( int $comment_id, int $delta = -1 ) \_wp\_ajax\_delete\_comment\_response( int $comment\_id, int $delta = -1 )
==========================================================================
This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.
Sends back current comment total and new page links if they need to be updated.
Contrary to normal success Ajax response ("1"), die with time() on success.
`$comment_id` int Required `$delta` int Optional Default: `-1`
File: `wp-admin/includes/ajax-actions.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/ajax-actions.php/)
```
function _wp_ajax_delete_comment_response( $comment_id, $delta = -1 ) {
$total = isset( $_POST['_total'] ) ? (int) $_POST['_total'] : 0;
$per_page = isset( $_POST['_per_page'] ) ? (int) $_POST['_per_page'] : 0;
$page = isset( $_POST['_page'] ) ? (int) $_POST['_page'] : 0;
$url = isset( $_POST['_url'] ) ? sanitize_url( $_POST['_url'] ) : '';
// JS didn't send us everything we need to know. Just die with success message.
if ( ! $total || ! $per_page || ! $page || ! $url ) {
$time = time();
$comment = get_comment( $comment_id );
$comment_status = '';
$comment_link = '';
if ( $comment ) {
$comment_status = $comment->comment_approved;
}
if ( 1 === (int) $comment_status ) {
$comment_link = get_comment_link( $comment );
}
$counts = wp_count_comments();
$x = new WP_Ajax_Response(
array(
'what' => 'comment',
// Here for completeness - not used.
'id' => $comment_id,
'supplemental' => array(
'status' => $comment_status,
'postId' => $comment ? $comment->comment_post_ID : '',
'time' => $time,
'in_moderation' => $counts->moderated,
'i18n_comments_text' => sprintf(
/* translators: %s: Number of comments. */
_n( '%s Comment', '%s Comments', $counts->approved ),
number_format_i18n( $counts->approved )
),
'i18n_moderation_text' => sprintf(
/* translators: %s: Number of comments. */
_n( '%s Comment in moderation', '%s Comments in moderation', $counts->moderated ),
number_format_i18n( $counts->moderated )
),
'comment_link' => $comment_link,
),
)
);
$x->send();
}
$total += $delta;
if ( $total < 0 ) {
$total = 0;
}
// Only do the expensive stuff on a page-break, and about 1 other time per page.
if ( 0 == $total % $per_page || 1 == mt_rand( 1, $per_page ) ) {
$post_id = 0;
// What type of comment count are we looking for?
$status = 'all';
$parsed = parse_url( $url );
if ( isset( $parsed['query'] ) ) {
parse_str( $parsed['query'], $query_vars );
if ( ! empty( $query_vars['comment_status'] ) ) {
$status = $query_vars['comment_status'];
}
if ( ! empty( $query_vars['p'] ) ) {
$post_id = (int) $query_vars['p'];
}
if ( ! empty( $query_vars['comment_type'] ) ) {
$type = $query_vars['comment_type'];
}
}
if ( empty( $type ) ) {
// Only use the comment count if not filtering by a comment_type.
$comment_count = wp_count_comments( $post_id );
// We're looking for a known type of comment count.
if ( isset( $comment_count->$status ) ) {
$total = $comment_count->$status;
}
}
// Else use the decremented value from above.
}
// The time since the last comment count.
$time = time();
$comment = get_comment( $comment_id );
$counts = wp_count_comments();
$x = new WP_Ajax_Response(
array(
'what' => 'comment',
'id' => $comment_id,
'supplemental' => array(
'status' => $comment ? $comment->comment_approved : '',
'postId' => $comment ? $comment->comment_post_ID : '',
/* translators: %s: Number of comments. */
'total_items_i18n' => sprintf( _n( '%s item', '%s items', $total ), number_format_i18n( $total ) ),
'total_pages' => ceil( $total / $per_page ),
'total_pages_i18n' => number_format_i18n( ceil( $total / $per_page ) ),
'total' => $total,
'time' => $time,
'in_moderation' => $counts->moderated,
'i18n_moderation_text' => sprintf(
/* translators: %s: Number of comments. */
_n( '%s Comment in moderation', '%s Comments in moderation', $counts->moderated ),
number_format_i18n( $counts->moderated )
),
),
)
);
$x->send();
}
```
| Uses | Description |
| --- | --- |
| [\_n()](_n) wp-includes/l10n.php | Translates and retrieves the singular or plural form based on the supplied number. |
| [sanitize\_url()](sanitize_url) wp-includes/formatting.php | Sanitizes a URL for database or redirect usage. |
| [WP\_Ajax\_Response::\_\_construct()](../classes/wp_ajax_response/__construct) wp-includes/class-wp-ajax-response.php | Constructor – Passes args to [WP\_Ajax\_Response::add()](../classes/wp_ajax_response/add). |
| [get\_comment\_link()](get_comment_link) wp-includes/comment-template.php | Retrieves the link to a given comment. |
| [wp\_count\_comments()](wp_count_comments) wp-includes/comment.php | Retrieves the total comment counts for the whole site or a single post. |
| [number\_format\_i18n()](number_format_i18n) wp-includes/functions.php | Converts float number to format based on the locale. |
| [get\_comment()](get_comment) wp-includes/comment.php | Retrieves comment data given a comment ID or comment object. |
| Used By | Description |
| --- | --- |
| [wp\_ajax\_delete\_comment()](wp_ajax_delete_comment) wp-admin/includes/ajax-actions.php | Ajax handler for deleting a comment. |
| [wp\_ajax\_dim\_comment()](wp_ajax_dim_comment) wp-admin/includes/ajax-actions.php | Ajax handler to dim a comment. |
| Version | Description |
| --- | --- |
| [2.7.0](https://developer.wordpress.org/reference/since/2.7.0/) | Introduced. |
wordpress wp_doing_ajax(): bool wp\_doing\_ajax(): bool
=======================
Determines whether the current request is a WordPress Ajax request.
bool True if it's a WordPress Ajax request, false otherwise.
File: `wp-includes/load.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/load.php/)
```
function wp_doing_ajax() {
/**
* Filters whether the current request is a WordPress Ajax request.
*
* @since 4.7.0
*
* @param bool $wp_doing_ajax Whether the current request is a WordPress Ajax request.
*/
return apply_filters( 'wp_doing_ajax', defined( 'DOING_AJAX' ) && DOING_AJAX );
}
```
[apply\_filters( 'wp\_doing\_ajax', bool $wp\_doing\_ajax )](../hooks/wp_doing_ajax)
Filters whether the current request is a WordPress Ajax request.
| Uses | Description |
| --- | --- |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| Used By | Description |
| --- | --- |
| [is\_protected\_endpoint()](is_protected_endpoint) wp-includes/load.php | Determines whether we are currently on an endpoint that should be protected against WSODs. |
| [is\_protected\_ajax\_action()](is_protected_ajax_action) wp-includes/load.php | Determines whether we are currently handling an Ajax action that should be protected against WSODs. |
| [wp\_check\_comment\_flood()](wp_check_comment_flood) wp-includes/comment.php | Checks whether comment flooding is occurring. |
| [WP\_Comments\_List\_Table::handle\_row\_actions()](../classes/wp_comments_list_table/handle_row_actions) wp-admin/includes/class-wp-comments-list-table.php | Generates and displays row actions links. |
| [WP\_Terms\_List\_Table::handle\_row\_actions()](../classes/wp_terms_list_table/handle_row_actions) wp-admin/includes/class-wp-terms-list-table.php | Generates and displays row action links. |
| [themes\_api()](themes_api) wp-admin/includes/theme.php | Retrieves theme installer pages from the WordPress.org Themes API. |
| [WP\_List\_Table::set\_pagination\_args()](../classes/wp_list_table/set_pagination_args) wp-admin/includes/class-wp-list-table.php | An internal method that sets all the necessary pagination arguments |
| [check\_upload\_size()](check_upload_size) wp-admin/includes/ms.php | Determine if uploaded file exceeds space quota. |
| [wp\_dashboard\_cached\_rss\_widget()](wp_dashboard_cached_rss_widget) wp-admin/includes/dashboard.php | Checks to see if all of the feed url in $check\_urls are cached. |
| [WP\_Comments\_List\_Table::prepare\_items()](../classes/wp_comments_list_table/prepare_items) wp-admin/includes/class-wp-comments-list-table.php | |
| [WP\_Terms\_List\_Table::column\_name()](../classes/wp_terms_list_table/column_name) wp-admin/includes/class-wp-terms-list-table.php | |
| [WP\_Customize\_Manager::doing\_ajax()](../classes/wp_customize_manager/doing_ajax) wp-includes/class-wp-customize-manager.php | Returns true if it’s an Ajax request. |
| [\_wp\_customize\_include()](_wp_customize_include) wp-includes/theme.php | Includes and instantiates the [WP\_Customize\_Manager](../classes/wp_customize_manager) class. |
| [check\_ajax\_referer()](check_ajax_referer) wp-includes/pluggable.php | Verifies the Ajax request to prevent processing requests external of the blog. |
| [wp\_validate\_auth\_cookie()](wp_validate_auth_cookie) wp-includes/pluggable.php | Validates authentication cookie. |
| [wp\_debug\_mode()](wp_debug_mode) wp-includes/load.php | Set PHP error reporting based on WordPress debug settings. |
| [wp\_send\_json()](wp_send_json) wp-includes/functions.php | Sends a JSON response back to an Ajax request. |
| [wp\_die()](wp_die) wp-includes/functions.php | Kills WordPress execution and displays HTML page with an error message. |
| [WP\_Ajax\_Response::send()](../classes/wp_ajax_response/send) wp-includes/class-wp-ajax-response.php | Display XML formatted responses. |
| [wp\_user\_settings()](wp_user_settings) wp-includes/option.php | Saves and restores user interface settings stored in a cookie. |
| [wp\_allow\_comment()](wp_allow_comment) wp-includes/comment.php | Validates whether this comment is allowed to be made. |
| Version | Description |
| --- | --- |
| [4.7.0](https://developer.wordpress.org/reference/since/4.7.0/) | Introduced. |
wordpress media_upload_library(): string|null media\_upload\_library(): string|null
=====================================
Retrieves the legacy media library form in an iframe.
string|null
File: `wp-admin/includes/media.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/media.php/)
```
function media_upload_library() {
$errors = array();
if ( ! empty( $_POST ) ) {
$return = media_upload_form_handler();
if ( is_string( $return ) ) {
return $return;
}
if ( is_array( $return ) ) {
$errors = $return;
}
}
return wp_iframe( 'media_upload_library_form', $errors );
}
```
| Uses | Description |
| --- | --- |
| [media\_upload\_form\_handler()](media_upload_form_handler) wp-admin/includes/media.php | Handles form submissions for the legacy media uploader. |
| [wp\_iframe()](wp_iframe) wp-admin/includes/media.php | Outputs the iframe to display the media upload page. |
| Version | Description |
| --- | --- |
| [2.5.0](https://developer.wordpress.org/reference/since/2.5.0/) | Introduced. |
wordpress rest_validate_enum( mixed $value, array $args, string $param ): true|WP_Error rest\_validate\_enum( mixed $value, array $args, string $param ): true|WP\_Error
================================================================================
Validates that the given value is a member of the JSON Schema “enum”.
`$value` mixed Required The value to validate. `$args` array Required The schema array to use. `$param` string Required The parameter name, used in error messages. true|[WP\_Error](../classes/wp_error) True if the "enum" contains the value or a [WP\_Error](../classes/wp_error) instance otherwise.
File: `wp-includes/rest-api.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/rest-api.php/)
```
function rest_validate_enum( $value, $args, $param ) {
$sanitized_value = rest_sanitize_value_from_schema( $value, $args, $param );
if ( is_wp_error( $sanitized_value ) ) {
return $sanitized_value;
}
foreach ( $args['enum'] as $enum_value ) {
if ( rest_are_values_equal( $sanitized_value, $enum_value ) ) {
return true;
}
}
$encoded_enum_values = array();
foreach ( $args['enum'] as $enum_value ) {
$encoded_enum_values[] = is_scalar( $enum_value ) ? $enum_value : wp_json_encode( $enum_value );
}
if ( count( $encoded_enum_values ) === 1 ) {
/* translators: 1: Parameter, 2: Valid values. */
return new WP_Error( 'rest_not_in_enum', wp_sprintf( __( '%1$s is not %2$s.' ), $param, $encoded_enum_values[0] ) );
}
/* translators: 1: Parameter, 2: List of valid values. */
return new WP_Error( 'rest_not_in_enum', wp_sprintf( __( '%1$s is not one of %2$l.' ), $param, $encoded_enum_values ) );
}
```
| Uses | Description |
| --- | --- |
| [rest\_are\_values\_equal()](rest_are_values_equal) wp-includes/rest-api.php | Checks the equality of two values, following JSON Schema semantics. |
| [rest\_sanitize\_value\_from\_schema()](rest_sanitize_value_from_schema) wp-includes/rest-api.php | Sanitize a value based on a schema. |
| [wp\_sprintf()](wp_sprintf) wp-includes/formatting.php | WordPress implementation of PHP sprintf() with filters. |
| [wp\_json\_encode()](wp_json_encode) wp-includes/functions.php | Encodes a variable into JSON, with some sanity checks. |
| [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. |
| [is\_wp\_error()](is_wp_error) wp-includes/load.php | Checks whether the given variable is a WordPress Error. |
| [WP\_Error::\_\_construct()](../classes/wp_error/__construct) wp-includes/class-wp-error.php | Initializes the error. |
| Used By | Description |
| --- | --- |
| [rest\_validate\_value\_from\_schema()](rest_validate_value_from_schema) wp-includes/rest-api.php | Validate a value based on a schema. |
| Version | Description |
| --- | --- |
| [5.7.0](https://developer.wordpress.org/reference/since/5.7.0/) | Introduced. |
wordpress translate_user_role( string $name, string $domain = 'default' ): string translate\_user\_role( string $name, string $domain = 'default' ): string
=========================================================================
Translates role name.
Since the role names are in the database and not in the source there are dummy gettext calls to get them into the POT file and this function properly translates them back.
The [before\_last\_bar()](before_last_bar) call is needed, because older installations keep the roles using the old context format: ‘Role name|User role’ and just skipping the content after the last bar is easier than fixing them in the DB. New installations won’t suffer from that problem.
`$name` string Required The role name. `$domain` string Optional Text domain. Unique identifier for retrieving translated strings.
Default `'default'`. Default: `'default'`
string Translated role name on success, original name on failure.
File: `wp-includes/l10n.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/l10n.php/)
```
function translate_user_role( $name, $domain = 'default' ) {
return translate_with_gettext_context( before_last_bar( $name ), 'User role', $domain );
}
```
| Uses | Description |
| --- | --- |
| [translate\_with\_gettext\_context()](translate_with_gettext_context) wp-includes/l10n.php | Retrieves the translation of $text in the context defined in $context. |
| [before\_last\_bar()](before_last_bar) wp-includes/l10n.php | Removes last item on a pipe-delimited string. |
| Used By | Description |
| --- | --- |
| [WP\_Users\_List\_Table::get\_role\_list()](../classes/wp_users_list_table/get_role_list) wp-admin/includes/class-wp-users-list-table.php | Returns an array of translated user role names for a given user object. |
| [wp\_dropdown\_roles()](wp_dropdown_roles) wp-admin/includes/template.php | Prints out option HTML elements for role selectors. |
| [WP\_Users\_List\_Table::get\_views()](../classes/wp_users_list_table/get_views) wp-admin/includes/class-wp-users-list-table.php | Return an associative array listing all the views that can be used with this table. |
| [admin\_created\_user\_email()](admin_created_user_email) wp-admin/includes/user.php | |
| Version | Description |
| --- | --- |
| [5.2.0](https://developer.wordpress.org/reference/since/5.2.0/) | Added the `$domain` parameter. |
| [2.8.0](https://developer.wordpress.org/reference/since/2.8.0/) | Introduced. |
| programming_docs |
wordpress wp_theme_get_element_class_name( string $element ): string wp\_theme\_get\_element\_class\_name( string $element ): string
===============================================================
Given an element name, returns a class name.
Alias of [WP\_Theme\_JSON::get\_element\_class\_name()](../classes/wp_theme_json/get_element_class_name) .
`$element` string Required The name of the element. string The name of the class.
File: `wp-includes/theme.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/theme.php/)
```
function wp_theme_get_element_class_name( $element ) {
return WP_Theme_JSON::get_element_class_name( $element );
}
```
| Uses | Description |
| --- | --- |
| [WP\_Theme\_JSON::get\_element\_class\_name()](../classes/wp_theme_json/get_element_class_name) wp-includes/class-wp-theme-json.php | Returns a class name by an element name. |
| Version | Description |
| --- | --- |
| [6.1.0](https://developer.wordpress.org/reference/since/6.1.0/) | Introduced. |
wordpress wp_widget_description( int|string $id ): string|void wp\_widget\_description( int|string $id ): string|void
======================================================
Retrieve description for widget.
When registering widgets, the options can also include ‘description’ that describes the widget for display on the widget administration panel or in the theme.
`$id` int|string Required Widget ID. string|void Widget description, if available.
File: `wp-includes/widgets.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/widgets.php/)
```
function wp_widget_description( $id ) {
if ( ! is_scalar( $id ) ) {
return;
}
global $wp_registered_widgets;
if ( isset( $wp_registered_widgets[ $id ]['description'] ) ) {
return esc_html( $wp_registered_widgets[ $id ]['description'] );
}
}
```
| Uses | Description |
| --- | --- |
| [esc\_html()](esc_html) wp-includes/formatting.php | Escaping for HTML blocks. |
| Used By | Description |
| --- | --- |
| [wp\_widget\_control()](wp_widget_control) wp-admin/includes/widgets.php | Meta widget used to display the control form for a widget. |
| Version | Description |
| --- | --- |
| [2.5.0](https://developer.wordpress.org/reference/since/2.5.0/) | Introduced. |
wordpress do_core_upgrade( bool $reinstall = false ) do\_core\_upgrade( bool $reinstall = false )
============================================
Upgrade WordPress core display.
`$reinstall` bool Optional Default: `false`
File: `wp-admin/update-core.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/update-core.php/)
```
function do_core_upgrade( $reinstall = false ) {
global $wp_filesystem;
require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
if ( $reinstall ) {
$url = 'update-core.php?action=do-core-reinstall';
} else {
$url = 'update-core.php?action=do-core-upgrade';
}
$url = wp_nonce_url( $url, 'upgrade-core' );
$version = isset( $_POST['version'] ) ? $_POST['version'] : false;
$locale = isset( $_POST['locale'] ) ? $_POST['locale'] : 'en_US';
$update = find_core_update( $version, $locale );
if ( ! $update ) {
return;
}
// Allow relaxed file ownership writes for User-initiated upgrades when the API specifies
// that it's safe to do so. This only happens when there are no new files to create.
$allow_relaxed_file_ownership = ! $reinstall && isset( $update->new_files ) && ! $update->new_files;
?>
<div class="wrap">
<h1><?php _e( 'Update WordPress' ); ?></h1>
<?php
$credentials = request_filesystem_credentials( $url, '', false, ABSPATH, array( 'version', 'locale' ), $allow_relaxed_file_ownership );
if ( false === $credentials ) {
echo '</div>';
return;
}
if ( ! WP_Filesystem( $credentials, ABSPATH, $allow_relaxed_file_ownership ) ) {
// Failed to connect. Error and request again.
request_filesystem_credentials( $url, '', true, ABSPATH, array( 'version', 'locale' ), $allow_relaxed_file_ownership );
echo '</div>';
return;
}
if ( $wp_filesystem->errors->has_errors() ) {
foreach ( $wp_filesystem->errors->get_error_messages() as $message ) {
show_message( $message );
}
echo '</div>';
return;
}
if ( $reinstall ) {
$update->response = 'reinstall';
}
add_filter( 'update_feedback', 'show_message' );
$upgrader = new Core_Upgrader();
$result = $upgrader->upgrade(
$update,
array(
'allow_relaxed_file_ownership' => $allow_relaxed_file_ownership,
)
);
if ( is_wp_error( $result ) ) {
show_message( $result );
if ( 'up_to_date' != $result->get_error_code() && 'locked' != $result->get_error_code() ) {
show_message( __( 'Installation failed.' ) );
}
echo '</div>';
return;
}
show_message( __( 'WordPress updated successfully.' ) );
show_message(
'<span class="hide-if-no-js">' . sprintf(
/* translators: 1: WordPress version, 2: URL to About screen. */
__( 'Welcome to WordPress %1$s. You will be redirected to the About WordPress screen. If not, click <a href="%2$s">here</a>.' ),
$result,
esc_url( self_admin_url( 'about.php?updated' ) )
) . '</span>'
);
show_message(
'<span class="hide-if-js">' . sprintf(
/* translators: 1: WordPress version, 2: URL to About screen. */
__( 'Welcome to WordPress %1$s. <a href="%2$s">Learn more</a>.' ),
$result,
esc_url( self_admin_url( 'about.php?updated' ) )
) . '</span>'
);
?>
</div>
<script type="text/javascript">
window.location = '<?php echo esc_url( self_admin_url( 'about.php?updated' ) ); ?>';
</script>
<?php
}
```
| Uses | Description |
| --- | --- |
| [show\_message()](show_message) wp-admin/includes/misc.php | Displays the given administration message. |
| [find\_core\_update()](find_core_update) wp-admin/includes/update.php | Finds the available update for WordPress core. |
| [request\_filesystem\_credentials()](request_filesystem_credentials) wp-admin/includes/file.php | Displays a form to the user to request for their FTP/SSH details in order to connect to the filesystem. |
| [WP\_Filesystem()](wp_filesystem) wp-admin/includes/file.php | Initializes and connects the WordPress Filesystem Abstraction classes. |
| [self\_admin\_url()](self_admin_url) wp-includes/link-template.php | Retrieves the URL to the admin area for either the current site or the network depending on context. |
| [\_e()](_e) wp-includes/l10n.php | Displays translated text. |
| [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. |
| [esc\_url()](esc_url) wp-includes/formatting.php | Checks and cleans a URL. |
| [wp\_nonce\_url()](wp_nonce_url) wp-includes/functions.php | Retrieves URL with nonce added to URL query. |
| [add\_filter()](add_filter) wp-includes/plugin.php | Adds a callback function to a filter hook. |
| [is\_wp\_error()](is_wp_error) wp-includes/load.php | Checks whether the given variable is a WordPress Error. |
| Version | Description |
| --- | --- |
| [2.7.0](https://developer.wordpress.org/reference/since/2.7.0/) | Introduced. |
wordpress add_rewrite_tag( string $tag, string $regex, string $query = '' ) add\_rewrite\_tag( string $tag, string $regex, string $query = '' )
===================================================================
Adds a new rewrite tag (like %postname%).
The `$query` parameter is optional. If it is omitted you must ensure that you call this on, or before, the [‘init’](../hooks/init) hook. This is because `$query` defaults to `$tag=`, and for this to work a new query var has to be added.
`$tag` string Required Name of the new rewrite tag. `$regex` string Required Regular expression to substitute the tag for in rewrite rules. `$query` string Optional String to append to the rewritten query. Must end in `'='`. Default: `''`
This function can be used to make WordPress aware of custom querystring variables. Generally, it’s used in combination with [add\_rewrite\_rule()](add_rewrite_rule) to create rewrite rules for pages with custom templates.
If you use this function to declare a rewrite tag that already exists, the existing tag will be *overwritten*.
This function *must* be called on [init](../hooks/init "Plugin API/Action Reference/init") or earlier.
* Gets a query var name by stripping the % signs from the name of the tag: trim($tag, ‘%’)
* Calls $[wp\_rewrite::add\_rewrite\_tag()](../classes/wp_rewrite/add_rewrite_tag) with the name, generated QV name and regex.
* Adds the QV as a query var (again, this could be done by filtering query\_vars but it might be nicer to add a function to the WP class that stores ‘extra’ QVs like above)
File: `wp-includes/rewrite.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/rewrite.php/)
```
function add_rewrite_tag( $tag, $regex, $query = '' ) {
// Validate the tag's name.
if ( strlen( $tag ) < 3 || '%' !== $tag[0] || '%' !== $tag[ strlen( $tag ) - 1 ] ) {
return;
}
global $wp_rewrite, $wp;
if ( empty( $query ) ) {
$qv = trim( $tag, '%' );
$wp->add_query_var( $qv );
$query = $qv . '=';
}
$wp_rewrite->add_rewrite_tag( $tag, $regex, $query );
}
```
| Uses | Description |
| --- | --- |
| [WP::add\_query\_var()](../classes/wp/add_query_var) wp-includes/class-wp.php | Adds a query variable to the list of public query variables. |
| [WP\_Rewrite::add\_rewrite\_tag()](../classes/wp_rewrite/add_rewrite_tag) wp-includes/class-wp-rewrite.php | Adds or updates existing rewrite tags (e.g. %postname%). |
| Used By | Description |
| --- | --- |
| [WP\_Sitemaps::register\_rewrites()](../classes/wp_sitemaps/register_rewrites) wp-includes/sitemaps/class-wp-sitemaps.php | Registers sitemap rewrite tags and routing rules. |
| [WP\_Taxonomy::add\_rewrite\_rules()](../classes/wp_taxonomy/add_rewrite_rules) wp-includes/class-wp-taxonomy.php | Adds the necessary rewrite rules for the taxonomy. |
| [WP\_Post\_Type::add\_rewrite\_rules()](../classes/wp_post_type/add_rewrite_rules) wp-includes/class-wp-post-type.php | Adds the necessary rewrite rules for the post type. |
| Version | Description |
| --- | --- |
| [2.1.0](https://developer.wordpress.org/reference/since/2.1.0/) | Introduced. |
wordpress _maybe_update_core() \_maybe\_update\_core()
=======================
Determines whether core should be updated.
File: `wp-includes/update.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/update.php/)
```
function _maybe_update_core() {
// Include an unmodified $wp_version.
require ABSPATH . WPINC . '/version.php';
$current = get_site_transient( 'update_core' );
if ( isset( $current->last_checked, $current->version_checked )
&& 12 * HOUR_IN_SECONDS > ( time() - $current->last_checked )
&& $current->version_checked === $wp_version
) {
return;
}
wp_version_check();
}
```
| Uses | Description |
| --- | --- |
| [wp\_version\_check()](wp_version_check) wp-includes/update.php | Checks WordPress version against the newest version. |
| [get\_site\_transient()](get_site_transient) wp-includes/option.php | Retrieves the value of a site transient. |
| Version | Description |
| --- | --- |
| [2.8.0](https://developer.wordpress.org/reference/since/2.8.0/) | Introduced. |
wordpress add_network_option( int $network_id, string $option, mixed $value ): bool add\_network\_option( int $network\_id, string $option, mixed $value ): bool
============================================================================
Adds a new network option.
Existing options will not be updated.
* [add\_option()](add_option)
`$network_id` int Required ID of the network. Can be null to default to the current network ID. `$option` string Required Name of the option to add. Expected to not be SQL-escaped. `$value` mixed Required Option value, can be anything. Expected to not be SQL-escaped. bool True if the option was added, false otherwise.
File: `wp-includes/option.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/option.php/)
```
function add_network_option( $network_id, $option, $value ) {
global $wpdb;
if ( $network_id && ! is_numeric( $network_id ) ) {
return false;
}
$network_id = (int) $network_id;
// Fallback to the current network if a network ID is not specified.
if ( ! $network_id ) {
$network_id = get_current_network_id();
}
wp_protect_special_option( $option );
/**
* Filters the value of a specific network option before it is added.
*
* The dynamic portion of the hook name, `$option`, refers to the option name.
*
* @since 2.9.0 As 'pre_add_site_option_' . $key
* @since 3.0.0
* @since 4.4.0 The `$option` parameter was added.
* @since 4.7.0 The `$network_id` parameter was added.
*
* @param mixed $value Value of network option.
* @param string $option Option name.
* @param int $network_id ID of the network.
*/
$value = apply_filters( "pre_add_site_option_{$option}", $value, $option, $network_id );
$notoptions_key = "$network_id:notoptions";
if ( ! is_multisite() ) {
$result = add_option( $option, $value, '', 'no' );
} else {
$cache_key = "$network_id:$option";
// Make sure the option doesn't already exist.
// We can check the 'notoptions' cache before we ask for a DB query.
$notoptions = wp_cache_get( $notoptions_key, 'site-options' );
if ( ! is_array( $notoptions ) || ! isset( $notoptions[ $option ] ) ) {
if ( false !== get_network_option( $network_id, $option, false ) ) {
return false;
}
}
$value = sanitize_option( $option, $value );
$serialized_value = maybe_serialize( $value );
$result = $wpdb->insert(
$wpdb->sitemeta,
array(
'site_id' => $network_id,
'meta_key' => $option,
'meta_value' => $serialized_value,
)
);
if ( ! $result ) {
return false;
}
wp_cache_set( $cache_key, $value, 'site-options' );
// This option exists now.
$notoptions = wp_cache_get( $notoptions_key, 'site-options' ); // Yes, again... we need it to be fresh.
if ( is_array( $notoptions ) && isset( $notoptions[ $option ] ) ) {
unset( $notoptions[ $option ] );
wp_cache_set( $notoptions_key, $notoptions, 'site-options' );
}
}
if ( $result ) {
/**
* Fires after a specific network option has been successfully added.
*
* The dynamic portion of the hook name, `$option`, refers to the option name.
*
* @since 2.9.0 As "add_site_option_{$key}"
* @since 3.0.0
* @since 4.7.0 The `$network_id` parameter was added.
*
* @param string $option Name of the network option.
* @param mixed $value Value of the network option.
* @param int $network_id ID of the network.
*/
do_action( "add_site_option_{$option}", $option, $value, $network_id );
/**
* Fires after a network option has been successfully added.
*
* @since 3.0.0
* @since 4.7.0 The `$network_id` parameter was added.
*
* @param string $option Name of the network option.
* @param mixed $value Value of the network option.
* @param int $network_id ID of the network.
*/
do_action( 'add_site_option', $option, $value, $network_id );
return true;
}
return false;
}
```
[do\_action( 'add\_site\_option', string $option, mixed $value, int $network\_id )](../hooks/add_site_option)
Fires after a network option has been successfully added.
[do\_action( "add\_site\_option\_{$option}", string $option, mixed $value, int $network\_id )](../hooks/add_site_option_option)
Fires after a specific network option has been successfully added.
[apply\_filters( "pre\_add\_site\_option\_{$option}", mixed $value, string $option, int $network\_id )](../hooks/pre_add_site_option_option)
Filters the value of a specific network option before it is added.
| Uses | Description |
| --- | --- |
| [get\_current\_network\_id()](get_current_network_id) wp-includes/load.php | Retrieves the current network ID. |
| [get\_network\_option()](get_network_option) wp-includes/option.php | Retrieves a network’s option value based on the option name. |
| [wp\_cache\_set()](wp_cache_set) wp-includes/cache.php | Saves the data to the cache. |
| [sanitize\_option()](sanitize_option) wp-includes/formatting.php | Sanitizes various option values based on the nature of the option. |
| [maybe\_serialize()](maybe_serialize) wp-includes/functions.php | Serializes data, if needed. |
| [add\_option()](add_option) wp-includes/option.php | Adds a new option. |
| [wp\_protect\_special\_option()](wp_protect_special_option) wp-includes/option.php | Protects WordPress special option from being modified. |
| [wpdb::insert()](../classes/wpdb/insert) wp-includes/class-wpdb.php | Inserts a row into the table. |
| [wp\_cache\_get()](wp_cache_get) wp-includes/cache.php | Retrieves the cache contents from the cache by key and group. |
| [is\_multisite()](is_multisite) wp-includes/load.php | If Multisite is enabled. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| [do\_action()](do_action) wp-includes/plugin.php | Calls the callback functions that have been added to an action hook. |
| Used By | Description |
| --- | --- |
| [update\_network\_option()](update_network_option) wp-includes/option.php | Updates the value of a network option that was already added. |
| [add\_site\_option()](add_site_option) wp-includes/option.php | Adds a new option for the current network. |
| Version | Description |
| --- | --- |
| [4.4.0](https://developer.wordpress.org/reference/since/4.4.0/) | Introduced. |
wordpress wp_cache_delete( int|string $key, string $group = '' ): bool wp\_cache\_delete( int|string $key, string $group = '' ): bool
==============================================================
Removes the cache contents matching key and group.
* [WP\_Object\_Cache::delete()](../classes/wp_object_cache/delete)
`$key` int|string Required What the contents in the cache are called. `$group` string Optional Where the cache contents are grouped. Default: `''`
bool True on successful removal, false on failure.
File: `wp-includes/cache.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/cache.php/)
```
function wp_cache_delete( $key, $group = '' ) {
global $wp_object_cache;
return $wp_object_cache->delete( $key, $group );
}
```
| Uses | Description |
| --- | --- |
| [WP\_Object\_Cache::delete()](../classes/wp_object_cache/delete) wp-includes/class-wp-object-cache.php | Removes the contents of the cache key in the group. |
| Used By | Description |
| --- | --- |
| [populate\_network\_meta()](populate_network_meta) wp-admin/includes/schema.php | Creates WordPress network meta and sets the default values. |
| [populate\_site\_meta()](populate_site_meta) wp-admin/includes/schema.php | Creates WordPress site meta and sets the default values. |
| [clean\_taxonomy\_cache()](clean_taxonomy_cache) wp-includes/taxonomy.php | Cleans the caches for a taxonomy. |
| [clean\_site\_details\_cache()](clean_site_details_cache) wp-includes/ms-blogs.php | Cleans the site details cache for a site. |
| [delete\_network\_option()](delete_network_option) wp-includes/option.php | Removes a network option by name. |
| [wp\_clean\_plugins\_cache()](wp_clean_plugins_cache) wp-admin/includes/plugin.php | Clears the plugins cache used by [get\_plugins()](get_plugins) and by default, the plugin updates cache. |
| [update\_core()](update_core) wp-admin/includes/update-core.php | Upgrades the core of WordPress. |
| [delete\_get\_calendar\_cache()](delete_get_calendar_cache) wp-includes/general-template.php | Purges the cached results of get\_calendar. |
| [delete\_usermeta()](delete_usermeta) wp-includes/deprecated.php | Remove user meta data. |
| [update\_usermeta()](update_usermeta) wp-includes/deprecated.php | Update metadata of user. |
| [WP\_Theme::cache\_delete()](../classes/wp_theme/cache_delete) wp-includes/class-wp-theme.php | Clears the cache for the theme. |
| [clean\_object\_term\_cache()](clean_object_term_cache) wp-includes/taxonomy.php | Removes the taxonomy relationship to terms from the cache. |
| [wp\_set\_object\_terms()](wp_set_object_terms) wp-includes/taxonomy.php | Creates term and taxonomy relationships. |
| [wp\_remove\_object\_terms()](wp_remove_object_terms) wp-includes/taxonomy.php | Removes term(s) associated with a given object. |
| [delete\_site\_transient()](delete_site_transient) wp-includes/option.php | Deletes a site transient. |
| [delete\_option()](delete_option) wp-includes/option.php | Removes option by name. Prevents removal of protected WordPress options. |
| [delete\_transient()](delete_transient) wp-includes/option.php | Deletes a transient. |
| [clean\_user\_cache()](clean_user_cache) wp-includes/user.php | Cleans all user caches. |
| [clean\_post\_cache()](clean_post_cache) wp-includes/post.php | Will clean the post in the cache. |
| [clean\_attachment\_cache()](clean_attachment_cache) wp-includes/post.php | Will clean the attachment in the cache. |
| [\_transition\_post\_status()](_transition_post_status) wp-includes/post.php | Hook for managing future post transitions to published. |
| [\_wp\_upgrade\_revisions\_of\_post()](_wp_upgrade_revisions_of_post) wp-includes/revision.php | Upgrades the revisions author, adds the current post as a revision and sets the revisions version to 1. |
| [clean\_bookmark\_cache()](clean_bookmark_cache) wp-includes/bookmark.php | Deletes the bookmark cache. |
| [add\_user\_to\_blog()](add_user_to_blog) wp-includes/ms-functions.php | Adds a user to a blog, along with specifying the user’s role. |
| [clean\_blog\_cache()](clean_blog_cache) wp-includes/ms-site.php | Clean the blog cache |
| [get\_blog\_details()](get_blog_details) wp-includes/ms-blogs.php | Retrieve the details for a blog from the blogs table and blog options. |
| [wp\_update\_comment\_count\_now()](wp_update_comment_count_now) wp-includes/comment.php | Updates the comment count for the post. |
| [update\_metadata\_by\_mid()](update_metadata_by_mid) wp-includes/meta.php | Updates metadata by meta ID. |
| [delete\_metadata\_by\_mid()](delete_metadata_by_mid) wp-includes/meta.php | Deletes metadata by meta ID. |
| [add\_metadata()](add_metadata) wp-includes/meta.php | Adds metadata for the specified object. |
| [update\_metadata()](update_metadata) wp-includes/meta.php | Updates metadata for the specified object. If no value already exists for the specified object ID and metadata key, the metadata will be added. |
| Version | Description |
| --- | --- |
| [2.0.0](https://developer.wordpress.org/reference/since/2.0.0/) | Introduced. |
| programming_docs |
wordpress delete_plugins( string[] $plugins, string $deprecated = '' ): bool|null|WP_Error delete\_plugins( string[] $plugins, string $deprecated = '' ): bool|null|WP\_Error
==================================================================================
Removes directory and files of a plugin for a list of plugins.
`$plugins` string[] Required List of plugin paths to delete, relative to the plugins directory. `$deprecated` string Optional Not used. Default: `''`
bool|null|[WP\_Error](../classes/wp_error) True on success, false if `$plugins` is empty, `WP_Error` on failure.
`null` if filesystem credentials are required to proceed.
File: `wp-admin/includes/plugin.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/plugin.php/)
```
function delete_plugins( $plugins, $deprecated = '' ) {
global $wp_filesystem;
if ( empty( $plugins ) ) {
return false;
}
$checked = array();
foreach ( $plugins as $plugin ) {
$checked[] = 'checked[]=' . $plugin;
}
$url = wp_nonce_url( 'plugins.php?action=delete-selected&verify-delete=1&' . implode( '&', $checked ), 'bulk-plugins' );
ob_start();
$credentials = request_filesystem_credentials( $url );
$data = ob_get_clean();
if ( false === $credentials ) {
if ( ! empty( $data ) ) {
require_once ABSPATH . 'wp-admin/admin-header.php';
echo $data;
require_once ABSPATH . 'wp-admin/admin-footer.php';
exit;
}
return;
}
if ( ! WP_Filesystem( $credentials ) ) {
ob_start();
// Failed to connect. Error and request again.
request_filesystem_credentials( $url, '', true );
$data = ob_get_clean();
if ( ! empty( $data ) ) {
require_once ABSPATH . 'wp-admin/admin-header.php';
echo $data;
require_once ABSPATH . 'wp-admin/admin-footer.php';
exit;
}
return;
}
if ( ! is_object( $wp_filesystem ) ) {
return new WP_Error( 'fs_unavailable', __( 'Could not access filesystem.' ) );
}
if ( is_wp_error( $wp_filesystem->errors ) && $wp_filesystem->errors->has_errors() ) {
return new WP_Error( 'fs_error', __( 'Filesystem error.' ), $wp_filesystem->errors );
}
// Get the base plugin folder.
$plugins_dir = $wp_filesystem->wp_plugins_dir();
if ( empty( $plugins_dir ) ) {
return new WP_Error( 'fs_no_plugins_dir', __( 'Unable to locate WordPress plugin directory.' ) );
}
$plugins_dir = trailingslashit( $plugins_dir );
$plugin_translations = wp_get_installed_translations( 'plugins' );
$errors = array();
foreach ( $plugins as $plugin_file ) {
// Run Uninstall hook.
if ( is_uninstallable_plugin( $plugin_file ) ) {
uninstall_plugin( $plugin_file );
}
/**
* Fires immediately before a plugin deletion attempt.
*
* @since 4.4.0
*
* @param string $plugin_file Path to the plugin file relative to the plugins directory.
*/
do_action( 'delete_plugin', $plugin_file );
$this_plugin_dir = trailingslashit( dirname( $plugins_dir . $plugin_file ) );
// If plugin is in its own directory, recursively delete the directory.
// Base check on if plugin includes directory separator AND that it's not the root plugin folder.
if ( strpos( $plugin_file, '/' ) && $this_plugin_dir !== $plugins_dir ) {
$deleted = $wp_filesystem->delete( $this_plugin_dir, true );
} else {
$deleted = $wp_filesystem->delete( $plugins_dir . $plugin_file );
}
/**
* Fires immediately after a plugin deletion attempt.
*
* @since 4.4.0
*
* @param string $plugin_file Path to the plugin file relative to the plugins directory.
* @param bool $deleted Whether the plugin deletion was successful.
*/
do_action( 'deleted_plugin', $plugin_file, $deleted );
if ( ! $deleted ) {
$errors[] = $plugin_file;
continue;
}
$plugin_slug = dirname( $plugin_file );
if ( 'hello.php' === $plugin_file ) {
$plugin_slug = 'hello-dolly';
}
// Remove language files, silently.
if ( '.' !== $plugin_slug && ! empty( $plugin_translations[ $plugin_slug ] ) ) {
$translations = $plugin_translations[ $plugin_slug ];
foreach ( $translations as $translation => $data ) {
$wp_filesystem->delete( WP_LANG_DIR . '/plugins/' . $plugin_slug . '-' . $translation . '.po' );
$wp_filesystem->delete( WP_LANG_DIR . '/plugins/' . $plugin_slug . '-' . $translation . '.mo' );
$json_translation_files = glob( WP_LANG_DIR . '/plugins/' . $plugin_slug . '-' . $translation . '-*.json' );
if ( $json_translation_files ) {
array_map( array( $wp_filesystem, 'delete' ), $json_translation_files );
}
}
}
}
// Remove deleted plugins from the plugin updates list.
$current = get_site_transient( 'update_plugins' );
if ( $current ) {
// Don't remove the plugins that weren't deleted.
$deleted = array_diff( $plugins, $errors );
foreach ( $deleted as $plugin_file ) {
unset( $current->response[ $plugin_file ] );
}
set_site_transient( 'update_plugins', $current );
}
if ( ! empty( $errors ) ) {
if ( 1 === count( $errors ) ) {
/* translators: %s: Plugin filename. */
$message = __( 'Could not fully remove the plugin %s.' );
} else {
/* translators: %s: Comma-separated list of plugin filenames. */
$message = __( 'Could not fully remove the plugins %s.' );
}
return new WP_Error( 'could_not_remove_plugin', sprintf( $message, implode( ', ', $errors ) ) );
}
return true;
}
```
[do\_action( 'deleted\_plugin', string $plugin\_file, bool $deleted )](../hooks/deleted_plugin)
Fires immediately after a plugin deletion attempt.
[do\_action( 'delete\_plugin', string $plugin\_file )](../hooks/delete_plugin)
Fires immediately before a plugin deletion attempt.
| Uses | Description |
| --- | --- |
| [is\_uninstallable\_plugin()](is_uninstallable_plugin) wp-admin/includes/plugin.php | Determines whether the plugin can be uninstalled. |
| [uninstall\_plugin()](uninstall_plugin) wp-admin/includes/plugin.php | Uninstalls a single plugin. |
| [request\_filesystem\_credentials()](request_filesystem_credentials) wp-admin/includes/file.php | Displays a form to the user to request for their FTP/SSH details in order to connect to the filesystem. |
| [WP\_Filesystem()](wp_filesystem) wp-admin/includes/file.php | Initializes and connects the WordPress Filesystem Abstraction classes. |
| [wp\_get\_installed\_translations()](wp_get_installed_translations) wp-includes/l10n.php | Gets installed translations. |
| [set\_site\_transient()](set_site_transient) wp-includes/option.php | Sets/updates the value of a site transient. |
| [get\_site\_transient()](get_site_transient) wp-includes/option.php | Retrieves the value of a site transient. |
| [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. |
| [trailingslashit()](trailingslashit) wp-includes/formatting.php | Appends a trailing slash. |
| [wp\_nonce\_url()](wp_nonce_url) wp-includes/functions.php | Retrieves URL with nonce added to URL query. |
| [do\_action()](do_action) wp-includes/plugin.php | Calls the callback functions that have been added to an action hook. |
| [is\_wp\_error()](is_wp_error) wp-includes/load.php | Checks whether the given variable is a WordPress Error. |
| [WP\_Error::\_\_construct()](../classes/wp_error/__construct) wp-includes/class-wp-error.php | Initializes the error. |
| Used By | Description |
| --- | --- |
| [WP\_REST\_Plugins\_Controller::delete\_item()](../classes/wp_rest_plugins_controller/delete_item) wp-includes/rest-api/endpoints/class-wp-rest-plugins-controller.php | Deletes one plugin from the site. |
| [wp\_ajax\_delete\_plugin()](wp_ajax_delete_plugin) wp-admin/includes/ajax-actions.php | Ajax handler for deleting a plugin. |
| Version | Description |
| --- | --- |
| [2.6.0](https://developer.wordpress.org/reference/since/2.6.0/) | Introduced. |
wordpress taxonomy_exists( string $taxonomy ): bool taxonomy\_exists( string $taxonomy ): bool
==========================================
Determines whether the taxonomy name exists.
Formerly [is\_taxonomy()](is_taxonomy) , introduced in 2.3.0.
For more information on this and similar theme functions, check out the [Conditional Tags](https://developer.wordpress.org/themes/basics/conditional-tags/) article in the Theme Developer Handbook.
`$taxonomy` string Required Name of taxonomy object. bool Whether the taxonomy exists.
File: `wp-includes/taxonomy.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/taxonomy.php/)
```
function taxonomy_exists( $taxonomy ) {
global $wp_taxonomies;
return is_string( $taxonomy ) && isset( $wp_taxonomies[ $taxonomy ] );
}
```
| Used By | Description |
| --- | --- |
| [unregister\_taxonomy()](unregister_taxonomy) wp-includes/taxonomy.php | Unregisters a taxonomy. |
| [WP\_Term::get\_instance()](../classes/wp_term/get_instance) wp-includes/class-wp-term.php | Retrieve [WP\_Term](../classes/wp_term) instance. |
| [WP\_Customize\_Nav\_Menu\_Item\_Setting::populate\_value()](../classes/wp_customize_nav_menu_item_setting/populate_value) wp-includes/customize/class-wp-customize-nav-menu-item-setting.php | Ensure that the value is fully populated with the necessary properties. |
| [WP\_Screen::get()](../classes/wp_screen/get) wp-admin/includes/class-wp-screen.php | Fetches a screen object. |
| [WP\_Terms\_List\_Table::\_\_construct()](../classes/wp_terms_list_table/__construct) wp-admin/includes/class-wp-terms-list-table.php | Constructor. |
| [\_wp\_ajax\_menu\_quick\_search()](_wp_ajax_menu_quick_search) wp-admin/includes/nav-menu.php | Prints the appropriate response to a menu quick search. |
| [wp\_list\_categories()](wp_list_categories) wp-includes/category-template.php | Displays or retrieves the HTML list of categories. |
| [is\_taxonomy()](is_taxonomy) wp-includes/deprecated.php | Checks that the taxonomy name exists. |
| [WP\_Widget\_Tag\_Cloud::\_get\_current\_taxonomy()](../classes/wp_widget_tag_cloud/_get_current_taxonomy) wp-includes/widgets/class-wp-widget-tag-cloud.php | Retrieves the taxonomy for the current Tag cloud widget instance. |
| [WP\_Tax\_Query::clean\_query()](../classes/wp_tax_query/clean_query) wp-includes/class-wp-tax-query.php | Validates a single query. |
| [wp\_update\_term()](wp_update_term) wp-includes/taxonomy.php | Updates term based on arguments provided. |
| [wp\_get\_object\_terms()](wp_get_object_terms) wp-includes/taxonomy.php | Retrieves the terms associated with the given object(s), in the supplied taxonomies. |
| [wp\_set\_object\_terms()](wp_set_object_terms) wp-includes/taxonomy.php | Creates term and taxonomy relationships. |
| [wp\_remove\_object\_terms()](wp_remove_object_terms) wp-includes/taxonomy.php | Removes term(s) associated with a given object. |
| [wp\_insert\_term()](wp_insert_term) wp-includes/taxonomy.php | Adds a new term to the database. |
| [wp\_count\_terms()](wp_count_terms) wp-includes/taxonomy.php | Counts how many terms are in taxonomy. |
| [get\_term\_children()](get_term_children) wp-includes/taxonomy.php | Merges all term children into a single array of their IDs. |
| [get\_term\_by()](get_term_by) wp-includes/taxonomy.php | Gets all term data from database by term field and data. |
| [get\_terms()](get_terms) wp-includes/taxonomy.php | Retrieves the terms in a given taxonomy or list of taxonomies. |
| [get\_taxonomy()](get_taxonomy) wp-includes/taxonomy.php | Retrieves the taxonomy object of $taxonomy. |
| [get\_objects\_in\_term()](get_objects_in_term) wp-includes/taxonomy.php | Retrieves object IDs of valid taxonomy and term. |
| [is\_taxonomy\_hierarchical()](is_taxonomy_hierarchical) wp-includes/taxonomy.php | Determines whether the taxonomy object is hierarchical. |
| [get\_term()](get_term) wp-includes/taxonomy.php | Gets all term data from database by term ID. |
| [get\_adjacent\_post()](get_adjacent_post) wp-includes/link-template.php | Retrieves the adjacent post. |
| [get\_boundary\_post()](get_boundary_post) wp-includes/link-template.php | Retrieves the boundary post. |
| [wp\_get\_nav\_menu\_items()](wp_get_nav_menu_items) wp-includes/nav-menu.php | Retrieves all menu items of a navigation menu. |
| [wp\_xmlrpc\_server::wp\_newTerm()](../classes/wp_xmlrpc_server/wp_newterm) wp-includes/class-wp-xmlrpc-server.php | Create a new term. |
| [wp\_xmlrpc\_server::wp\_editTerm()](../classes/wp_xmlrpc_server/wp_editterm) wp-includes/class-wp-xmlrpc-server.php | Edit a term. |
| [wp\_xmlrpc\_server::wp\_deleteTerm()](../classes/wp_xmlrpc_server/wp_deleteterm) wp-includes/class-wp-xmlrpc-server.php | Delete a term. |
| [wp\_xmlrpc\_server::wp\_getTerm()](../classes/wp_xmlrpc_server/wp_getterm) wp-includes/class-wp-xmlrpc-server.php | Retrieve a term. |
| [wp\_xmlrpc\_server::wp\_getTerms()](../classes/wp_xmlrpc_server/wp_getterms) wp-includes/class-wp-xmlrpc-server.php | Retrieve all terms for a taxonomy. |
| [wp\_xmlrpc\_server::wp\_getTaxonomy()](../classes/wp_xmlrpc_server/wp_gettaxonomy) wp-includes/class-wp-xmlrpc-server.php | Retrieve a taxonomy. |
| Version | Description |
| --- | --- |
| [3.0.0](https://developer.wordpress.org/reference/since/3.0.0/) | Introduced. |
wordpress paginate_links( string|array $args = '' ): string|string[]|void paginate\_links( string|array $args = '' ): string|string[]|void
================================================================
Retrieves paginated links for archive post pages.
Technically, the function can be used to create paginated link list for any area. The ‘base’ argument is used to reference the url, which will be used to create the paginated links. The ‘format’ argument is then used for replacing the page number. It is however, most likely and by default, to be used on the archive post pages.
The ‘type’ argument controls format of the returned value. The default is ‘plain’, which is just a string with the links separated by a newline character. The other possible values are either ‘array’ or ‘list’. The ‘array’ value will return an array of the paginated link list to offer full control of display. The ‘list’ value will place all of the paginated links in an unordered HTML list.
The ‘total’ argument is the total amount of pages and is an integer. The ‘current’ argument is the current page number and is also an integer.
An example of the ‘base’ argument is "[http://example.com/all\_posts.php%\_](#)%" and the ‘%\_%’ is required. The ‘%\_%’ will be replaced by the contents of in the ‘format’ argument. An example for the ‘format’ argument is "?page=%#%" and the ‘%#%’ is also required. The ‘%#%’ will be replaced with the page number.
You can include the previous and next links in the list by setting the ‘prev\_next’ argument to true, which it is by default. You can set the previous text, by using the ‘prev\_text’ argument. You can set the next text by setting the ‘next\_text’ argument.
If the ‘show\_all’ argument is set to true, then it will show all of the pages instead of a short list of the pages near the current page. By default, the ‘show\_all’ is set to false and controlled by the ‘end\_size’ and ‘mid\_size’ arguments. The ‘end\_size’ argument is how many numbers on either the start and the end list edges, by default is 1. The ‘mid\_size’ argument is how many numbers to either side of current page, but not including current page.
It is possible to add query vars to the link by using the ‘add\_args’ argument and see [add\_query\_arg()](add_query_arg) for more information.
The ‘before\_page\_number’ and ‘after\_page\_number’ arguments allow users to augment the links themselves. Typically this might be to add context to the numbered links so that screen reader users understand what the links are for.
The text strings are added before and after the page number – within the anchor tag.
`$args` string|array Optional Array or string of arguments for generating paginated links for archives.
* `base`stringBase of the paginated url.
* `format`stringFormat for the pagination structure.
* `total`intThe total amount of pages. Default is the value [WP\_Query](../classes/wp_query)'s `max_num_pages` or 1.
* `current`intThe current page number. Default is `'paged'` query var or 1.
* `aria_current`stringThe value for the aria-current attribute. Possible values are `'page'`, `'step'`, `'location'`, `'date'`, `'time'`, `'true'`, `'false'`. Default is `'page'`.
* `show_all`boolWhether to show all pages. Default false.
* `end_size`intHow many numbers on either the start and the end list edges.
Default 1.
* `mid_size`intHow many numbers to either side of the current pages. Default 2.
* `prev_next`boolWhether to include the previous and next links in the list. Default true.
* `prev_text`stringThe previous page text. Default '« Previous'.
* `next_text`stringThe next page text. Default 'Next »'.
* `type`stringControls format of the returned value. Possible values are `'plain'`, `'array'` and `'list'`. Default is `'plain'`.
* `add_args`arrayAn array of query args to add. Default false.
* `add_fragment`stringA string to append to each link.
* `before_page_number`stringA string to appear before the page number.
* `after_page_number`stringA string to append after the page number.
Default: `''`
string|string[]|void String of page links or array of page links, depending on `'type'` argument.
Void if total number of pages is less than 2.
File: `wp-includes/general-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/general-template.php/)
```
function paginate_links( $args = '' ) {
global $wp_query, $wp_rewrite;
// Setting up default values based on the current URL.
$pagenum_link = html_entity_decode( get_pagenum_link() );
$url_parts = explode( '?', $pagenum_link );
// Get max pages and current page out of the current query, if available.
$total = isset( $wp_query->max_num_pages ) ? $wp_query->max_num_pages : 1;
$current = get_query_var( 'paged' ) ? (int) get_query_var( 'paged' ) : 1;
// Append the format placeholder to the base URL.
$pagenum_link = trailingslashit( $url_parts[0] ) . '%_%';
// URL base depends on permalink settings.
$format = $wp_rewrite->using_index_permalinks() && ! strpos( $pagenum_link, 'index.php' ) ? 'index.php/' : '';
$format .= $wp_rewrite->using_permalinks() ? user_trailingslashit( $wp_rewrite->pagination_base . '/%#%', 'paged' ) : '?paged=%#%';
$defaults = array(
'base' => $pagenum_link, // http://example.com/all_posts.php%_% : %_% is replaced by format (below).
'format' => $format, // ?page=%#% : %#% is replaced by the page number.
'total' => $total,
'current' => $current,
'aria_current' => 'page',
'show_all' => false,
'prev_next' => true,
'prev_text' => __( '« Previous' ),
'next_text' => __( 'Next »' ),
'end_size' => 1,
'mid_size' => 2,
'type' => 'plain',
'add_args' => array(), // Array of query args to add.
'add_fragment' => '',
'before_page_number' => '',
'after_page_number' => '',
);
$args = wp_parse_args( $args, $defaults );
if ( ! is_array( $args['add_args'] ) ) {
$args['add_args'] = array();
}
// Merge additional query vars found in the original URL into 'add_args' array.
if ( isset( $url_parts[1] ) ) {
// Find the format argument.
$format = explode( '?', str_replace( '%_%', $args['format'], $args['base'] ) );
$format_query = isset( $format[1] ) ? $format[1] : '';
wp_parse_str( $format_query, $format_args );
// Find the query args of the requested URL.
wp_parse_str( $url_parts[1], $url_query_args );
// Remove the format argument from the array of query arguments, to avoid overwriting custom format.
foreach ( $format_args as $format_arg => $format_arg_value ) {
unset( $url_query_args[ $format_arg ] );
}
$args['add_args'] = array_merge( $args['add_args'], urlencode_deep( $url_query_args ) );
}
// Who knows what else people pass in $args.
$total = (int) $args['total'];
if ( $total < 2 ) {
return;
}
$current = (int) $args['current'];
$end_size = (int) $args['end_size']; // Out of bounds? Make it the default.
if ( $end_size < 1 ) {
$end_size = 1;
}
$mid_size = (int) $args['mid_size'];
if ( $mid_size < 0 ) {
$mid_size = 2;
}
$add_args = $args['add_args'];
$r = '';
$page_links = array();
$dots = false;
if ( $args['prev_next'] && $current && 1 < $current ) :
$link = str_replace( '%_%', 2 == $current ? '' : $args['format'], $args['base'] );
$link = str_replace( '%#%', $current - 1, $link );
if ( $add_args ) {
$link = add_query_arg( $add_args, $link );
}
$link .= $args['add_fragment'];
$page_links[] = sprintf(
'<a class="prev page-numbers" href="%s">%s</a>',
/**
* Filters the paginated links for the given archive pages.
*
* @since 3.0.0
*
* @param string $link The paginated link URL.
*/
esc_url( apply_filters( 'paginate_links', $link ) ),
$args['prev_text']
);
endif;
for ( $n = 1; $n <= $total; $n++ ) :
if ( $n == $current ) :
$page_links[] = sprintf(
'<span aria-current="%s" class="page-numbers current">%s</span>',
esc_attr( $args['aria_current'] ),
$args['before_page_number'] . number_format_i18n( $n ) . $args['after_page_number']
);
$dots = true;
else :
if ( $args['show_all'] || ( $n <= $end_size || ( $current && $n >= $current - $mid_size && $n <= $current + $mid_size ) || $n > $total - $end_size ) ) :
$link = str_replace( '%_%', 1 == $n ? '' : $args['format'], $args['base'] );
$link = str_replace( '%#%', $n, $link );
if ( $add_args ) {
$link = add_query_arg( $add_args, $link );
}
$link .= $args['add_fragment'];
$page_links[] = sprintf(
'<a class="page-numbers" href="%s">%s</a>',
/** This filter is documented in wp-includes/general-template.php */
esc_url( apply_filters( 'paginate_links', $link ) ),
$args['before_page_number'] . number_format_i18n( $n ) . $args['after_page_number']
);
$dots = true;
elseif ( $dots && ! $args['show_all'] ) :
$page_links[] = '<span class="page-numbers dots">' . __( '…' ) . '</span>';
$dots = false;
endif;
endif;
endfor;
if ( $args['prev_next'] && $current && $current < $total ) :
$link = str_replace( '%_%', $args['format'], $args['base'] );
$link = str_replace( '%#%', $current + 1, $link );
if ( $add_args ) {
$link = add_query_arg( $add_args, $link );
}
$link .= $args['add_fragment'];
$page_links[] = sprintf(
'<a class="next page-numbers" href="%s">%s</a>',
/** This filter is documented in wp-includes/general-template.php */
esc_url( apply_filters( 'paginate_links', $link ) ),
$args['next_text']
);
endif;
switch ( $args['type'] ) {
case 'array':
return $page_links;
case 'list':
$r .= "<ul class='page-numbers'>\n\t<li>";
$r .= implode( "</li>\n\t<li>", $page_links );
$r .= "</li>\n</ul>\n";
break;
default:
$r = implode( "\n", $page_links );
break;
}
/**
* Filters the HTML output of paginated links for archives.
*
* @since 5.7.0
*
* @param string $r HTML output.
* @param array $args An array of arguments. See paginate_links()
* for information on accepted arguments.
*/
$r = apply_filters( 'paginate_links_output', $r, $args );
return $r;
}
```
[apply\_filters( 'paginate\_links', string $link )](../hooks/paginate_links)
Filters the paginated links for the given archive pages.
[apply\_filters( 'paginate\_links\_output', string $r, array $args )](../hooks/paginate_links_output)
Filters the HTML output of paginated links for archives.
| Uses | Description |
| --- | --- |
| [wp\_parse\_str()](wp_parse_str) wp-includes/formatting.php | Parses a string into variables to be stored in an array. |
| [urlencode\_deep()](urlencode_deep) wp-includes/formatting.php | Navigates through an array, object, or scalar, and encodes the values to be used in a URL. |
| [get\_query\_var()](get_query_var) wp-includes/query.php | Retrieves the value of a query variable in the [WP\_Query](../classes/wp_query) class. |
| [get\_pagenum\_link()](get_pagenum_link) wp-includes/link-template.php | Retrieves the link for a page number. |
| [user\_trailingslashit()](user_trailingslashit) wp-includes/link-template.php | Retrieves a trailing-slashed string if the site is set for adding trailing slashes. |
| [WP\_Rewrite::using\_index\_permalinks()](../classes/wp_rewrite/using_index_permalinks) wp-includes/class-wp-rewrite.php | Determines whether permalinks are being used and rewrite module is not enabled. |
| [WP\_Rewrite::using\_permalinks()](../classes/wp_rewrite/using_permalinks) wp-includes/class-wp-rewrite.php | Determines whether permalinks are being used. |
| [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. |
| [esc\_url()](esc_url) wp-includes/formatting.php | Checks and cleans a URL. |
| [esc\_attr()](esc_attr) wp-includes/formatting.php | Escaping for HTML attributes. |
| [trailingslashit()](trailingslashit) wp-includes/formatting.php | Appends a trailing slash. |
| [wp\_parse\_args()](wp_parse_args) wp-includes/functions.php | Merges user defined arguments into defaults array. |
| [add\_query\_arg()](add_query_arg) wp-includes/functions.php | Retrieves a modified URL query string. |
| [number\_format\_i18n()](number_format_i18n) wp-includes/functions.php | Converts float number to format based on the locale. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| Used By | Description |
| --- | --- |
| [get\_the\_posts\_pagination()](get_the_posts_pagination) wp-includes/link-template.php | Retrieves a paginated navigation to next/previous set of posts, when applicable. |
| [WP\_User\_Search::do\_paging()](../classes/wp_user_search/do_paging) wp-admin/includes/deprecated.php | Handles paging for the user search query. |
| [media\_upload\_library\_form()](media_upload_library_form) wp-admin/includes/media.php | Outputs the legacy media upload form for the media library. |
| [wp\_nav\_menu\_item\_post\_type\_meta\_box()](wp_nav_menu_item_post_type_meta_box) wp-admin/includes/nav-menu.php | Displays a meta box for a post type menu item. |
| [wp\_nav\_menu\_item\_taxonomy\_meta\_box()](wp_nav_menu_item_taxonomy_meta_box) wp-admin/includes/nav-menu.php | Displays a meta box for a taxonomy menu item. |
| [paginate\_comments\_links()](paginate_comments_links) wp-includes/link-template.php | Displays or retrieves pagination links for the comments on the current post. |
| Version | Description |
| --- | --- |
| [4.9.0](https://developer.wordpress.org/reference/since/4.9.0/) | Added the `aria_current` argument. |
| [2.1.0](https://developer.wordpress.org/reference/since/2.1.0/) | Introduced. |
| programming_docs |
wordpress wp_restore_post_revision( int|WP_Post $revision, array $fields = null ): int|false|null wp\_restore\_post\_revision( int|WP\_Post $revision, array $fields = null ): int|false|null
===========================================================================================
Restores a post to the specified revision.
Can restore a past revision using all fields of the post revision, or only selected fields.
`$revision` int|[WP\_Post](../classes/wp_post) Required Revision ID or revision object. `$fields` array Optional What fields to restore from. Defaults to all. Default: `null`
int|false|null Null if error, false if no fields to restore, (int) post ID if success.
File: `wp-includes/revision.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/revision.php/)
```
function wp_restore_post_revision( $revision, $fields = null ) {
$revision = wp_get_post_revision( $revision, ARRAY_A );
if ( ! $revision ) {
return $revision;
}
if ( ! is_array( $fields ) ) {
$fields = array_keys( _wp_post_revision_fields( $revision ) );
}
$update = array();
foreach ( array_intersect( array_keys( $revision ), $fields ) as $field ) {
$update[ $field ] = $revision[ $field ];
}
if ( ! $update ) {
return false;
}
$update['ID'] = $revision['post_parent'];
$update = wp_slash( $update ); // Since data is from DB.
$post_id = wp_update_post( $update );
if ( ! $post_id || is_wp_error( $post_id ) ) {
return $post_id;
}
// Update last edit user.
update_post_meta( $post_id, '_edit_last', get_current_user_id() );
/**
* Fires after a post revision has been restored.
*
* @since 2.6.0
*
* @param int $post_id Post ID.
* @param int $revision_id Post revision ID.
*/
do_action( 'wp_restore_post_revision', $post_id, $revision['ID'] );
return $post_id;
}
```
[do\_action( 'wp\_restore\_post\_revision', int $post\_id, int $revision\_id )](../hooks/wp_restore_post_revision)
Fires after a post revision has been restored.
| Uses | Description |
| --- | --- |
| [wp\_update\_post()](wp_update_post) wp-includes/post.php | Updates a post with new post data. |
| [update\_post\_meta()](update_post_meta) wp-includes/post.php | Updates a post meta field based on the given post ID. |
| [wp\_get\_post\_revision()](wp_get_post_revision) wp-includes/revision.php | Gets a post revision. |
| [\_wp\_post\_revision\_fields()](_wp_post_revision_fields) wp-includes/revision.php | Determines which fields of posts are to be saved in revisions. |
| [wp\_slash()](wp_slash) wp-includes/formatting.php | Adds slashes to a string or recursively adds slashes to strings within an array. |
| [do\_action()](do_action) wp-includes/plugin.php | Calls the callback functions that have been added to an action hook. |
| [get\_current\_user\_id()](get_current_user_id) wp-includes/user.php | Gets the current user’s ID. |
| [is\_wp\_error()](is_wp_error) wp-includes/load.php | Checks whether the given variable is a WordPress Error. |
| Used By | Description |
| --- | --- |
| [wp\_xmlrpc\_server::wp\_restoreRevision()](../classes/wp_xmlrpc_server/wp_restorerevision) wp-includes/class-wp-xmlrpc-server.php | Restore a post revision |
| Version | Description |
| --- | --- |
| [2.6.0](https://developer.wordpress.org/reference/since/2.6.0/) | Introduced. |
wordpress _post_format_link( string $link, WP_Term $term, string $taxonomy ): string \_post\_format\_link( string $link, WP\_Term $term, string $taxonomy ): string
==============================================================================
This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.
Filters the post format term link to remove the format prefix.
`$link` string Required `$term` [WP\_Term](../classes/wp_term) Required `$taxonomy` string Required string
File: `wp-includes/post-formats.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/post-formats.php/)
```
function _post_format_link( $link, $term, $taxonomy ) {
global $wp_rewrite;
if ( 'post_format' !== $taxonomy ) {
return $link;
}
if ( $wp_rewrite->get_extra_permastruct( $taxonomy ) ) {
return str_replace( "/{$term->slug}", '/' . str_replace( 'post-format-', '', $term->slug ), $link );
} else {
$link = remove_query_arg( 'post_format', $link );
return add_query_arg( 'post_format', str_replace( 'post-format-', '', $term->slug ), $link );
}
}
```
| Uses | Description |
| --- | --- |
| [remove\_query\_arg()](remove_query_arg) wp-includes/functions.php | Removes an item or items from a query string. |
| [WP\_Rewrite::get\_extra\_permastruct()](../classes/wp_rewrite/get_extra_permastruct) wp-includes/class-wp-rewrite.php | Retrieves an extra permalink structure by name. |
| [add\_query\_arg()](add_query_arg) wp-includes/functions.php | Retrieves a modified URL query string. |
| Version | Description |
| --- | --- |
| [3.1.0](https://developer.wordpress.org/reference/since/3.1.0/) | Introduced. |
wordpress use_block_editor_for_post_type( string $post_type ): bool use\_block\_editor\_for\_post\_type( string $post\_type ): bool
===============================================================
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.
`$post_type` string Required The post type. bool Whether the post type can be edited with the block editor.
File: `wp-includes/post.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/post.php/)
```
function use_block_editor_for_post_type( $post_type ) {
if ( ! post_type_exists( $post_type ) ) {
return false;
}
if ( ! post_type_supports( $post_type, 'editor' ) ) {
return false;
}
$post_type_object = get_post_type_object( $post_type );
if ( $post_type_object && ! $post_type_object->show_in_rest ) {
return false;
}
/**
* Filters whether a post is able to be edited in the block editor.
*
* @since 5.0.0
*
* @param bool $use_block_editor Whether the post type can be edited or not. Default true.
* @param string $post_type The post type being checked.
*/
return apply_filters( 'use_block_editor_for_post_type', true, $post_type );
}
```
[apply\_filters( 'use\_block\_editor\_for\_post\_type', bool $use\_block\_editor, string $post\_type )](../hooks/use_block_editor_for_post_type)
Filters whether a post is able to be edited in the block editor.
| Uses | Description |
| --- | --- |
| [post\_type\_exists()](post_type_exists) wp-includes/post.php | Determines whether a post type is registered. |
| [post\_type\_supports()](post_type_supports) wp-includes/post.php | Checks a post type’s support for a given feature. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| [get\_post\_type\_object()](get_post_type_object) wp-includes/post.php | Retrieves a post type object by name. |
| Used By | Description |
| --- | --- |
| [use\_block\_editor\_for\_post()](use_block_editor_for_post) wp-includes/post.php | Returns whether the post can be edited in the block editor. |
| [WP\_Screen::get()](../classes/wp_screen/get) wp-admin/includes/class-wp-screen.php | Fetches a screen object. |
| Version | Description |
| --- | --- |
| [6.1.0](https://developer.wordpress.org/reference/since/6.1.0/) | Moved to wp-includes from wp-admin. |
| [5.0.0](https://developer.wordpress.org/reference/since/5.0.0/) | Introduced. |
wordpress get_dashboard_url( int $user_id, string $path = '', string $scheme = 'admin' ): string get\_dashboard\_url( int $user\_id, string $path = '', string $scheme = 'admin' ): string
=========================================================================================
Retrieves the URL to the user’s dashboard.
If a user does not belong to any site, the global user dashboard is used. If the user belongs to the current site, the dashboard for the current site is returned. If the user cannot edit the current site, the dashboard to the user’s primary site is returned.
`$user_id` int Optional User ID. Defaults to current user. `$path` string Optional path relative to the dashboard. Use only paths known to both site and user admins. Default: `''`
`$scheme` string Optional The scheme to use. Default is `'admin'`, which obeys [force\_ssl\_admin()](force_ssl_admin) and [is\_ssl()](is_ssl) . `'http'` or `'https'` can be passed to force those schemes. Default: `'admin'`
string Dashboard URL link with optional path appended.
File: `wp-includes/link-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/link-template.php/)
```
function get_dashboard_url( $user_id = 0, $path = '', $scheme = 'admin' ) {
$user_id = $user_id ? (int) $user_id : get_current_user_id();
$blogs = get_blogs_of_user( $user_id );
if ( is_multisite() && ! user_can( $user_id, 'manage_network' ) && empty( $blogs ) ) {
$url = user_admin_url( $path, $scheme );
} elseif ( ! is_multisite() ) {
$url = admin_url( $path, $scheme );
} else {
$current_blog = get_current_blog_id();
if ( $current_blog && ( user_can( $user_id, 'manage_network' ) || in_array( $current_blog, array_keys( $blogs ), true ) ) ) {
$url = admin_url( $path, $scheme );
} else {
$active = get_active_blog_for_user( $user_id );
if ( $active ) {
$url = get_admin_url( $active->blog_id, $path, $scheme );
} else {
$url = user_admin_url( $path, $scheme );
}
}
}
/**
* Filters the dashboard URL for a user.
*
* @since 3.1.0
*
* @param string $url The complete URL including scheme and path.
* @param int $user_id The user ID.
* @param string $path Path relative to the URL. Blank string if no path is specified.
* @param string $scheme Scheme to give the URL context. Accepts 'http', 'https', 'login',
* 'login_post', 'admin', 'relative' or null.
*/
return apply_filters( 'user_dashboard_url', $url, $user_id, $path, $scheme );
}
```
[apply\_filters( 'user\_dashboard\_url', string $url, int $user\_id, string $path, string $scheme )](../hooks/user_dashboard_url)
Filters the dashboard URL for a user.
| Uses | Description |
| --- | --- |
| [user\_can()](user_can) wp-includes/capabilities.php | Returns whether a particular user has the specified capability. |
| [user\_admin\_url()](user_admin_url) wp-includes/link-template.php | Retrieves the URL to the admin area for the current user. |
| [get\_admin\_url()](get_admin_url) wp-includes/link-template.php | Retrieves the URL to the admin area for a given site. |
| [get\_blogs\_of\_user()](get_blogs_of_user) wp-includes/user.php | Gets the sites a user belongs to. |
| [get\_active\_blog\_for\_user()](get_active_blog_for_user) wp-includes/ms-functions.php | Gets one of a user’s active blogs. |
| [is\_multisite()](is_multisite) wp-includes/load.php | If Multisite is enabled. |
| [get\_current\_blog\_id()](get_current_blog_id) wp-includes/load.php | Retrieve the current site ID. |
| [admin\_url()](admin_url) wp-includes/link-template.php | Retrieves the URL to the admin area for the current site. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| [get\_current\_user\_id()](get_current_user_id) wp-includes/user.php | Gets the current user’s ID. |
| Used By | Description |
| --- | --- |
| [wp\_admin\_bar\_dashboard\_view\_site\_menu()](wp_admin_bar_dashboard_view_site_menu) wp-includes/deprecated.php | Add the “Dashboard”/”Visit Site” menu. |
| [get\_edit\_profile\_url()](get_edit_profile_url) wp-includes/link-template.php | Retrieves the URL to the user’s profile editor. |
| [wp\_admin\_bar\_wp\_menu()](wp_admin_bar_wp_menu) wp-includes/admin-bar.php | Adds the WordPress logo menu. |
| [wp\_admin\_bar\_my\_account\_item()](wp_admin_bar_my_account_item) wp-includes/admin-bar.php | Adds the “My Account” item. |
| [wp\_admin\_bar\_my\_account\_menu()](wp_admin_bar_my_account_menu) wp-includes/admin-bar.php | Adds the “My Account” submenu items. |
| Version | Description |
| --- | --- |
| [3.1.0](https://developer.wordpress.org/reference/since/3.1.0/) | Introduced. |
wordpress _delete_option_fresh_site() \_delete\_option\_fresh\_site()
===============================
This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.
Deletes the fresh site option.
File: `wp-includes/functions.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/functions.php/)
```
function _delete_option_fresh_site() {
update_option( 'fresh_site', '0' );
}
```
| Uses | Description |
| --- | --- |
| [update\_option()](update_option) wp-includes/option.php | Updates the value of an option that was already added. |
| Version | Description |
| --- | --- |
| [4.7.0](https://developer.wordpress.org/reference/since/4.7.0/) | Introduced. |
wordpress wp_parse_slug_list( array|string $list ): string[] wp\_parse\_slug\_list( array|string $list ): string[]
=====================================================
Cleans up an array, comma- or space-separated list of slugs.
`$list` array|string Required List of slugs. string[] Sanitized array of slugs.
File: `wp-includes/functions.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/functions.php/)
```
function wp_parse_slug_list( $list ) {
$list = wp_parse_list( $list );
return array_unique( array_map( 'sanitize_title', $list ) );
}
```
| Uses | Description |
| --- | --- |
| [wp\_parse\_list()](wp_parse_list) wp-includes/functions.php | Converts a comma- or space-separated list of scalar values to an array. |
| Used By | Description |
| --- | --- |
| [WP\_REST\_Search\_Controller::sanitize\_subtypes()](../classes/wp_rest_search_controller/sanitize_subtypes) wp-includes/rest-api/endpoints/class-wp-rest-search-controller.php | Sanitizes the list of subtypes, to ensure only subtypes of the passed type are included. |
| [WP\_REST\_Themes\_Controller::sanitize\_theme\_status()](../classes/wp_rest_themes_controller/sanitize_theme_status) wp-includes/rest-api/endpoints/class-wp-rest-themes-controller.php | Sanitizes and validates the list of theme status. |
| [WP\_REST\_Posts\_Controller::sanitize\_post\_statuses()](../classes/wp_rest_posts_controller/sanitize_post_statuses) wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php | Sanitizes and validates the list of post statuses, including whether the user can query private statuses. |
| Version | Description |
| --- | --- |
| [5.1.0](https://developer.wordpress.org/reference/since/5.1.0/) | Refactored to use [wp\_parse\_list()](wp_parse_list) . |
| [4.7.0](https://developer.wordpress.org/reference/since/4.7.0/) | Introduced. |
wordpress parent_post_rel_link( string $title = '%title' ) parent\_post\_rel\_link( string $title = '%title' )
===================================================
This function has been deprecated.
Display relational link for parent item
`$title` string Optional Link title format. Default `'%title'`. Default: `'%title'`
File: `wp-includes/deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/deprecated.php/)
```
function parent_post_rel_link( $title = '%title' ) {
_deprecated_function( __FUNCTION__, '3.3.0' );
echo get_parent_post_rel_link($title);
}
```
| Uses | Description |
| --- | --- |
| [get\_parent\_post\_rel\_link()](get_parent_post_rel_link) wp-includes/deprecated.php | Get parent post relational link. |
| [\_deprecated\_function()](_deprecated_function) wp-includes/functions.php | Marks a function as deprecated and inform when it has been used. |
| Version | Description |
| --- | --- |
| [3.3.0](https://developer.wordpress.org/reference/since/3.3.0/) | This function has been deprecated. |
| [2.8.0](https://developer.wordpress.org/reference/since/2.8.0/) | Introduced. |
wordpress has_blocks( int|string|WP_Post|null $post = null ): bool has\_blocks( int|string|WP\_Post|null $post = null ): bool
==========================================================
Determines whether a post or content string has blocks.
This test optimizes for performance rather than strict accuracy, detecting the pattern of a block but not validating its structure. For strict accuracy, you should use the block parser on post content.
* [parse\_blocks()](parse_blocks)
`$post` int|string|[WP\_Post](../classes/wp_post)|null Optional Post content, post ID, or post object.
Defaults to global $post. Default: `null`
bool Whether the post has blocks.
File: `wp-includes/blocks.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/blocks.php/)
```
function has_blocks( $post = null ) {
if ( ! is_string( $post ) ) {
$wp_post = get_post( $post );
if ( ! $wp_post instanceof WP_Post ) {
return false;
}
$post = $wp_post->post_content;
}
return false !== strpos( (string) $post, '<!-- wp:' );
}
```
| Uses | Description |
| --- | --- |
| [get\_post()](get_post) wp-includes/post.php | Retrieves post data given a post ID or post object. |
| Used By | Description |
| --- | --- |
| [block\_version()](block_version) wp-includes/blocks.php | Returns the current version of the block format that the content string is using. |
| [do\_blocks()](do_blocks) wp-includes/blocks.php | Parses dynamic blocks out of `post_content` and re-renders them. |
| [has\_block()](has_block) wp-includes/blocks.php | Determines whether a $post or a string contains a specific block type. |
| [\_WP\_Editors::parse\_settings()](../classes/_wp_editors/parse_settings) wp-includes/class-wp-editor.php | Parse default arguments for the editor instance. |
| Version | Description |
| --- | --- |
| [5.0.0](https://developer.wordpress.org/reference/since/5.0.0/) | Introduced. |
wordpress do_robots() do\_robots()
============
Displays the default robots.txt file content.
File: `wp-includes/functions.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/functions.php/)
```
function do_robots() {
header( 'Content-Type: text/plain; charset=utf-8' );
/**
* Fires when displaying the robots.txt file.
*
* @since 2.1.0
*/
do_action( 'do_robotstxt' );
$output = "User-agent: *\n";
$public = get_option( 'blog_public' );
$site_url = parse_url( site_url() );
$path = ( ! empty( $site_url['path'] ) ) ? $site_url['path'] : '';
$output .= "Disallow: $path/wp-admin/\n";
$output .= "Allow: $path/wp-admin/admin-ajax.php\n";
/**
* Filters the robots.txt output.
*
* @since 3.0.0
*
* @param string $output The robots.txt output.
* @param bool $public Whether the site is considered "public".
*/
echo apply_filters( 'robots_txt', $output, $public );
}
```
[do\_action( 'do\_robotstxt' )](../hooks/do_robotstxt)
Fires when displaying the robots.txt file.
[apply\_filters( 'robots\_txt', string $output, bool $public )](../hooks/robots_txt)
Filters the robots.txt output.
| Uses | Description |
| --- | --- |
| [site\_url()](site_url) wp-includes/link-template.php | Retrieves the URL for the current site where WordPress application files (e.g. wp-blog-header.php or the wp-admin/ folder) are accessible. |
| [do\_action()](do_action) wp-includes/plugin.php | Calls the callback functions that have been added to an action hook. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| [get\_option()](get_option) wp-includes/option.php | Retrieves an option value based on an option name. |
| Version | Description |
| --- | --- |
| [5.3.0](https://developer.wordpress.org/reference/since/5.3.0/) | Remove the "Disallow: /" output if search engine visiblity is discouraged in favor of robots meta HTML tag via [wp\_robots\_no\_robots()](wp_robots_no_robots) filter callback. |
| [2.1.0](https://developer.wordpress.org/reference/since/2.1.0/) | Introduced. |
| programming_docs |
wordpress has_nav_menu( string $location ): bool has\_nav\_menu( string $location ): bool
========================================
Determines whether a registered nav menu location has a menu assigned to it.
`$location` string Required Menu location identifier. bool Whether location has a menu.
File: `wp-includes/nav-menu.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/nav-menu.php/)
```
function has_nav_menu( $location ) {
$has_nav_menu = false;
$registered_nav_menus = get_registered_nav_menus();
if ( isset( $registered_nav_menus[ $location ] ) ) {
$locations = get_nav_menu_locations();
$has_nav_menu = ! empty( $locations[ $location ] );
}
/**
* Filters whether a nav menu is assigned to the specified location.
*
* @since 4.3.0
*
* @param bool $has_nav_menu Whether there is a menu assigned to a location.
* @param string $location Menu location.
*/
return apply_filters( 'has_nav_menu', $has_nav_menu, $location );
}
```
[apply\_filters( 'has\_nav\_menu', bool $has\_nav\_menu, string $location )](../hooks/has_nav_menu)
Filters whether a nav menu is assigned to the specified location.
| Uses | Description |
| --- | --- |
| [get\_nav\_menu\_locations()](get_nav_menu_locations) wp-includes/nav-menu.php | Retrieves all registered navigation menu locations and the menus assigned to them. |
| [get\_registered\_nav\_menus()](get_registered_nav_menus) wp-includes/nav-menu.php | Retrieves all registered navigation menu locations in a theme. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| Version | Description |
| --- | --- |
| [3.0.0](https://developer.wordpress.org/reference/since/3.0.0/) | Introduced. |
wordpress maybe_disable_automattic_widgets() maybe\_disable\_automattic\_widgets()
=====================================
Disables the Automattic widgets plugin, which was merged into core.
File: `wp-admin/includes/upgrade.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/upgrade.php/)
```
function maybe_disable_automattic_widgets() {
$plugins = __get_option( 'active_plugins' );
foreach ( (array) $plugins as $plugin ) {
if ( 'widgets.php' === basename( $plugin ) ) {
array_splice( $plugins, array_search( $plugin, $plugins, true ), 1 );
update_option( 'active_plugins', $plugins );
break;
}
}
}
```
| Uses | Description |
| --- | --- |
| [update\_option()](update_option) wp-includes/option.php | Updates the value of an option that was already added. |
| Version | Description |
| --- | --- |
| [2.2.0](https://developer.wordpress.org/reference/since/2.2.0/) | Introduced. |
wordpress edit_form_image_editor( WP_Post $post ) edit\_form\_image\_editor( WP\_Post $post )
===========================================
Displays the image and editor in the post editor
`$post` [WP\_Post](../classes/wp_post) Required A post object. File: `wp-admin/includes/media.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/media.php/)
```
function edit_form_image_editor( $post ) {
$open = isset( $_GET['image-editor'] );
if ( $open ) {
require_once ABSPATH . 'wp-admin/includes/image-edit.php';
}
$thumb_url = false;
$attachment_id = (int) $post->ID;
if ( $attachment_id ) {
$thumb_url = wp_get_attachment_image_src( $attachment_id, array( 900, 450 ), true );
}
$alt_text = get_post_meta( $post->ID, '_wp_attachment_image_alt', true );
$att_url = wp_get_attachment_url( $post->ID );
?>
<div class="wp_attachment_holder wp-clearfix">
<?php
if ( wp_attachment_is_image( $post->ID ) ) :
$image_edit_button = '';
if ( wp_image_editor_supports( array( 'mime_type' => $post->post_mime_type ) ) ) {
$nonce = wp_create_nonce( "image_editor-$post->ID" );
$image_edit_button = "<input type='button' id='imgedit-open-btn-$post->ID' onclick='imageEdit.open( $post->ID, \"$nonce\" )' class='button' value='" . esc_attr__( 'Edit Image' ) . "' /> <span class='spinner'></span>";
}
$open_style = '';
$not_open_style = '';
if ( $open ) {
$open_style = ' style="display:none"';
} else {
$not_open_style = ' style="display:none"';
}
?>
<div class="imgedit-response" id="imgedit-response-<?php echo $attachment_id; ?>"></div>
<div<?php echo $open_style; ?> class="wp_attachment_image wp-clearfix" id="media-head-<?php echo $attachment_id; ?>">
<p id="thumbnail-head-<?php echo $attachment_id; ?>"><img class="thumbnail" src="<?php echo set_url_scheme( $thumb_url[0] ); ?>" style="max-width:100%" alt="" /></p>
<p><?php echo $image_edit_button; ?></p>
</div>
<div<?php echo $not_open_style; ?> class="image-editor" id="image-editor-<?php echo $attachment_id; ?>">
<?php
if ( $open ) {
wp_image_editor( $attachment_id );
}
?>
</div>
<?php
elseif ( $attachment_id && wp_attachment_is( 'audio', $post ) ) :
wp_maybe_generate_attachment_metadata( $post );
echo wp_audio_shortcode( array( 'src' => $att_url ) );
elseif ( $attachment_id && wp_attachment_is( 'video', $post ) ) :
wp_maybe_generate_attachment_metadata( $post );
$meta = wp_get_attachment_metadata( $attachment_id );
$w = ! empty( $meta['width'] ) ? min( $meta['width'], 640 ) : 0;
$h = ! empty( $meta['height'] ) ? $meta['height'] : 0;
if ( $h && $w < $meta['width'] ) {
$h = round( ( $meta['height'] * $w ) / $meta['width'] );
}
$attr = array( 'src' => $att_url );
if ( ! empty( $w ) && ! empty( $h ) ) {
$attr['width'] = $w;
$attr['height'] = $h;
}
$thumb_id = get_post_thumbnail_id( $attachment_id );
if ( ! empty( $thumb_id ) ) {
$attr['poster'] = wp_get_attachment_url( $thumb_id );
}
echo wp_video_shortcode( $attr );
elseif ( isset( $thumb_url[0] ) ) :
?>
<div class="wp_attachment_image wp-clearfix" id="media-head-<?php echo $attachment_id; ?>">
<p id="thumbnail-head-<?php echo $attachment_id; ?>">
<img class="thumbnail" src="<?php echo set_url_scheme( $thumb_url[0] ); ?>" style="max-width:100%" alt="" />
</p>
</div>
<?php
else :
/**
* Fires when an attachment type can't be rendered in the edit form.
*
* @since 4.6.0
*
* @param WP_Post $post A post object.
*/
do_action( 'wp_edit_form_attachment_display', $post );
endif;
?>
</div>
<div class="wp_attachment_details edit-form-section">
<?php if ( 'image' === substr( $post->post_mime_type, 0, 5 ) ) : ?>
<p class="attachment-alt-text">
<label for="attachment_alt"><strong><?php _e( 'Alternative Text' ); ?></strong></label><br />
<textarea class="widefat" name="_wp_attachment_image_alt" id="attachment_alt" aria-describedby="alt-text-description"><?php echo esc_attr( $alt_text ); ?></textarea>
</p>
<p class="attachment-alt-text-description" id="alt-text-description">
<?php
printf(
/* translators: 1: Link to tutorial, 2: Additional link attributes, 3: Accessibility text. */
__( '<a href="%1$s" %2$s>Learn how to describe the purpose of the image%3$s</a>. Leave empty if the image is purely decorative.' ),
esc_url( 'https://www.w3.org/WAI/tutorials/images/decision-tree' ),
'target="_blank" rel="noopener"',
sprintf(
'<span class="screen-reader-text"> %s</span>',
/* translators: Accessibility text. */
__( '(opens in a new tab)' )
)
);
?>
</p>
<?php endif; ?>
<p>
<label for="attachment_caption"><strong><?php _e( 'Caption' ); ?></strong></label><br />
<textarea class="widefat" name="excerpt" id="attachment_caption"><?php echo $post->post_excerpt; ?></textarea>
</p>
<?php
$quicktags_settings = array( 'buttons' => 'strong,em,link,block,del,ins,img,ul,ol,li,code,close' );
$editor_args = array(
'textarea_name' => 'content',
'textarea_rows' => 5,
'media_buttons' => false,
'tinymce' => false,
'quicktags' => $quicktags_settings,
);
?>
<label for="attachment_content" class="attachment-content-description"><strong><?php _e( 'Description' ); ?></strong>
<?php
if ( preg_match( '#^(audio|video)/#', $post->post_mime_type ) ) {
echo ': ' . __( 'Displayed on attachment pages.' );
}
?>
</label>
<?php wp_editor( format_to_edit( $post->post_content ), 'attachment_content', $editor_args ); ?>
</div>
<?php
$extras = get_compat_media_markup( $post->ID );
echo $extras['item'];
echo '<input type="hidden" id="image-edit-context" value="edit-attachment" />' . "\n";
}
```
[do\_action( 'wp\_edit\_form\_attachment\_display', WP\_Post $post )](../hooks/wp_edit_form_attachment_display)
Fires when an attachment type can’t be rendered in the edit form.
| Uses | Description |
| --- | --- |
| [wp\_attachment\_is()](wp_attachment_is) wp-includes/post.php | Verifies an attachment is of a given type. |
| [get\_post\_thumbnail\_id()](get_post_thumbnail_id) wp-includes/post-thumbnail-template.php | Retrieves the post thumbnail ID. |
| [wp\_get\_attachment\_metadata()](wp_get_attachment_metadata) wp-includes/post.php | Retrieves attachment metadata for attachment ID. |
| [wp\_get\_attachment\_url()](wp_get_attachment_url) wp-includes/post.php | Retrieves the URL for an attachment. |
| [wp\_attachment\_is\_image()](wp_attachment_is_image) wp-includes/post.php | Determines whether an attachment is an image. |
| [wp\_get\_attachment\_image\_src()](wp_get_attachment_image_src) wp-includes/media.php | Retrieves an image to represent an attachment. |
| [wp\_audio\_shortcode()](wp_audio_shortcode) wp-includes/media.php | Builds the Audio shortcode output. |
| [wp\_video\_shortcode()](wp_video_shortcode) wp-includes/media.php | Builds the Video shortcode output. |
| [wp\_image\_editor\_supports()](wp_image_editor_supports) wp-includes/media.php | Tests whether there is an editor that supports a given mime type or methods. |
| [wp\_maybe\_generate\_attachment\_metadata()](wp_maybe_generate_attachment_metadata) wp-includes/media.php | Maybe attempts to generate attachment metadata, if missing. |
| [set\_url\_scheme()](set_url_scheme) wp-includes/link-template.php | Sets the scheme for a URL. |
| [wp\_image\_editor()](wp_image_editor) wp-admin/includes/image-edit.php | Loads the WP image-editing interface. |
| [wp\_editor()](wp_editor) wp-includes/general-template.php | Renders an editor. |
| [wp\_create\_nonce()](wp_create_nonce) wp-includes/pluggable.php | Creates a cryptographic token tied to a specific action, user, user session, and window of time. |
| [format\_to\_edit()](format_to_edit) wp-includes/formatting.php | Acts on text which is about to be edited. |
| [esc\_attr\_\_()](esc_attr__) wp-includes/l10n.php | Retrieves the translation of $text and escapes it for safe use in an attribute. |
| [get\_compat\_media\_markup()](get_compat_media_markup) wp-admin/includes/media.php | |
| [do\_action()](do_action) wp-includes/plugin.php | Calls the callback functions that have been added to an action hook. |
| [esc\_url()](esc_url) wp-includes/formatting.php | Checks and cleans a URL. |
| [esc\_attr()](esc_attr) wp-includes/formatting.php | Escaping for HTML attributes. |
| [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. |
| [\_e()](_e) wp-includes/l10n.php | Displays translated text. |
| [get\_post\_meta()](get_post_meta) wp-includes/post.php | Retrieves a post meta field for the given post ID. |
| Version | Description |
| --- | --- |
| [3.5.0](https://developer.wordpress.org/reference/since/3.5.0/) | Introduced. |
wordpress _wp_build_title_and_description_for_single_post_type_block_template( string $post_type, string $slug, WP_Block_Template $template ): bool \_wp\_build\_title\_and\_description\_for\_single\_post\_type\_block\_template( string $post\_type, string $slug, WP\_Block\_Template $template ): bool
=======================================================================================================================================================
This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.
Builds the title and description of a post-specific template based on the underlying referenced post.
Mutates the underlying template object.
`$post_type` string Required Post type, e.g. page, post, product. `$slug` string Required Slug of the post, e.g. a-story-about-shoes. `$template` [WP\_Block\_Template](../classes/wp_block_template) Required Template to mutate adding the description and title computed. bool Returns true if the referenced post was found and false otherwise.
File: `wp-includes/block-template-utils.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/block-template-utils.php/)
```
function _wp_build_title_and_description_for_single_post_type_block_template( $post_type, $slug, WP_Block_Template $template ) {
$post_type_object = get_post_type_object( $post_type );
$default_args = array(
'post_type' => $post_type,
'post_status' => 'publish',
'posts_per_page' => 1,
'update_post_meta_cache' => false,
'update_post_term_cache' => false,
'ignore_sticky_posts' => true,
'no_found_rows' => true,
);
$args = array(
'name' => $slug,
);
$args = wp_parse_args( $args, $default_args );
$posts_query = new WP_Query( $args );
if ( empty( $posts_query->posts ) ) {
$template->title = sprintf(
/* translators: Custom template title in the Site Editor referencing a post that was not found. 1: Post type singular name, 2: Post type slug. */
__( 'Not found: %1$s (%2$s)' ),
$post_type_object->labels->singular_name,
$slug
);
return false;
}
$post_title = $posts_query->posts[0]->post_title;
$template->title = sprintf(
/* translators: Custom template title in the Site Editor. 1: Post type singular name, 2: Post title. */
__( '%1$s: %2$s' ),
$post_type_object->labels->singular_name,
$post_title
);
$template->description = sprintf(
/* translators: Custom template description in the Site Editor. %s: Post title. */
__( 'Template for %s' ),
$post_title
);
$args = array(
'title' => $post_title,
);
$args = wp_parse_args( $args, $default_args );
$posts_with_same_title_query = new WP_Query( $args );
if ( count( $posts_with_same_title_query->posts ) > 1 ) {
$template->title = sprintf(
/* translators: Custom template title in the Site Editor. 1: Template title, 2: Post type slug. */
__( '%1$s (%2$s)' ),
$template->title,
$slug
);
}
return true;
}
```
| Uses | Description |
| --- | --- |
| [WP\_Query::\_\_construct()](../classes/wp_query/__construct) wp-includes/class-wp-query.php | Constructor. |
| [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. |
| [wp\_parse\_args()](wp_parse_args) wp-includes/functions.php | Merges user defined arguments into defaults array. |
| [get\_post\_type\_object()](get_post_type_object) wp-includes/post.php | Retrieves a post type object by name. |
| Used By | Description |
| --- | --- |
| [\_build\_block\_template\_result\_from\_post()](_build_block_template_result_from_post) wp-includes/block-template-utils.php | Builds a unified template object based a post Object. |
| Version | Description |
| --- | --- |
| [6.1.0](https://developer.wordpress.org/reference/since/6.1.0/) | Introduced. |
wordpress update_network_option( int $network_id, string $option, mixed $value ): bool update\_network\_option( int $network\_id, string $option, mixed $value ): bool
===============================================================================
Updates the value of a network option that was already added.
* [update\_option()](update_option)
`$network_id` int Required ID of the network. Can be null to default to the current network ID. `$option` string Required Name of the option. Expected to not be SQL-escaped. `$value` mixed Required Option value. Expected to not be SQL-escaped. bool True if the value was updated, false otherwise.
File: `wp-includes/option.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/option.php/)
```
function update_network_option( $network_id, $option, $value ) {
global $wpdb;
if ( $network_id && ! is_numeric( $network_id ) ) {
return false;
}
$network_id = (int) $network_id;
// Fallback to the current network if a network ID is not specified.
if ( ! $network_id ) {
$network_id = get_current_network_id();
}
wp_protect_special_option( $option );
$old_value = get_network_option( $network_id, $option, false );
/**
* Filters a specific network option before its value is updated.
*
* The dynamic portion of the hook name, `$option`, refers to the option name.
*
* @since 2.9.0 As 'pre_update_site_option_' . $key
* @since 3.0.0
* @since 4.4.0 The `$option` parameter was added.
* @since 4.7.0 The `$network_id` parameter was added.
*
* @param mixed $value New value of the network option.
* @param mixed $old_value Old value of the network option.
* @param string $option Option name.
* @param int $network_id ID of the network.
*/
$value = apply_filters( "pre_update_site_option_{$option}", $value, $old_value, $option, $network_id );
/*
* If the new and old values are the same, no need to update.
*
* Unserialized values will be adequate in most cases. If the unserialized
* data differs, the (maybe) serialized data is checked to avoid
* unnecessary database calls for otherwise identical object instances.
*
* See https://core.trac.wordpress.org/ticket/44956
*/
if ( $value === $old_value || maybe_serialize( $value ) === maybe_serialize( $old_value ) ) {
return false;
}
if ( false === $old_value ) {
return add_network_option( $network_id, $option, $value );
}
$notoptions_key = "$network_id:notoptions";
$notoptions = wp_cache_get( $notoptions_key, 'site-options' );
if ( is_array( $notoptions ) && isset( $notoptions[ $option ] ) ) {
unset( $notoptions[ $option ] );
wp_cache_set( $notoptions_key, $notoptions, 'site-options' );
}
if ( ! is_multisite() ) {
$result = update_option( $option, $value, 'no' );
} else {
$value = sanitize_option( $option, $value );
$serialized_value = maybe_serialize( $value );
$result = $wpdb->update(
$wpdb->sitemeta,
array( 'meta_value' => $serialized_value ),
array(
'site_id' => $network_id,
'meta_key' => $option,
)
);
if ( $result ) {
$cache_key = "$network_id:$option";
wp_cache_set( $cache_key, $value, 'site-options' );
}
}
if ( $result ) {
/**
* Fires after the value of a specific network option has been successfully updated.
*
* The dynamic portion of the hook name, `$option`, refers to the option name.
*
* @since 2.9.0 As "update_site_option_{$key}"
* @since 3.0.0
* @since 4.7.0 The `$network_id` parameter was added.
*
* @param string $option Name of the network option.
* @param mixed $value Current value of the network option.
* @param mixed $old_value Old value of the network option.
* @param int $network_id ID of the network.
*/
do_action( "update_site_option_{$option}", $option, $value, $old_value, $network_id );
/**
* Fires after the value of a network option has been successfully updated.
*
* @since 3.0.0
* @since 4.7.0 The `$network_id` parameter was added.
*
* @param string $option Name of the network option.
* @param mixed $value Current value of the network option.
* @param mixed $old_value Old value of the network option.
* @param int $network_id ID of the network.
*/
do_action( 'update_site_option', $option, $value, $old_value, $network_id );
return true;
}
return false;
}
```
[apply\_filters( "pre\_update\_site\_option\_{$option}", mixed $value, mixed $old\_value, string $option, int $network\_id )](../hooks/pre_update_site_option_option)
Filters a specific network option before its value is updated.
[do\_action( 'update\_site\_option', string $option, mixed $value, mixed $old\_value, int $network\_id )](../hooks/update_site_option)
Fires after the value of a network option has been successfully updated.
[do\_action( "update\_site\_option\_{$option}", string $option, mixed $value, mixed $old\_value, int $network\_id )](../hooks/update_site_option_option)
Fires after the value of a specific network option has been successfully updated.
| Uses | Description |
| --- | --- |
| [get\_current\_network\_id()](get_current_network_id) wp-includes/load.php | Retrieves the current network ID. |
| [add\_network\_option()](add_network_option) wp-includes/option.php | Adds a new network option. |
| [get\_network\_option()](get_network_option) wp-includes/option.php | Retrieves a network’s option value based on the option name. |
| [wp\_cache\_set()](wp_cache_set) wp-includes/cache.php | Saves the data to the cache. |
| [sanitize\_option()](sanitize_option) wp-includes/formatting.php | Sanitizes various option values based on the nature of the option. |
| [maybe\_serialize()](maybe_serialize) wp-includes/functions.php | Serializes data, if needed. |
| [wp\_protect\_special\_option()](wp_protect_special_option) wp-includes/option.php | Protects WordPress special option from being modified. |
| [wpdb::update()](../classes/wpdb/update) wp-includes/class-wpdb.php | Updates a row in the table. |
| [wp\_cache\_get()](wp_cache_get) wp-includes/cache.php | Retrieves the cache contents from the cache by key and group. |
| [is\_multisite()](is_multisite) wp-includes/load.php | If Multisite is enabled. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| [do\_action()](do_action) wp-includes/plugin.php | Calls the callback functions that have been added to an action hook. |
| [update\_option()](update_option) wp-includes/option.php | Updates the value of an option that was already added. |
| Used By | Description |
| --- | --- |
| [wp\_update\_user\_counts()](wp_update_user_counts) wp-includes/user.php | Updates the total count of users on the site. |
| [WP\_Application\_Passwords::create\_new\_application\_password()](../classes/wp_application_passwords/create_new_application_password) wp-includes/class-wp-application-passwords.php | Creates a new application password. |
| [is\_site\_meta\_supported()](is_site_meta_supported) wp-includes/functions.php | Determines whether site meta is enabled. |
| [WP\_Network::get\_main\_site\_id()](../classes/wp_network/get_main_site_id) wp-includes/class-wp-network.php | Returns the main site ID for the network. |
| [update\_site\_option()](update_site_option) wp-includes/option.php | Updates the value of an option that was already added for the current network. |
| [wp\_update\_network\_site\_counts()](wp_update_network_site_counts) wp-includes/ms-functions.php | Updates the network-wide site count. |
| Version | Description |
| --- | --- |
| [4.4.0](https://developer.wordpress.org/reference/since/4.4.0/) | Introduced. |
| programming_docs |
wordpress remove_all_actions( string $hook_name, int|false $priority = false ): true remove\_all\_actions( string $hook\_name, int|false $priority = false ): true
=============================================================================
Removes all of the callback functions from an action hook.
`$hook_name` string Required The action to remove callbacks from. `$priority` int|false Optional The priority number to remove them from.
Default: `false`
true Always returns true.
Prior to Version 4.7
* You can’t call this function from within the hook you would like to remove actions from. For example adding an action to wp\_footer that calls `remove_all_actions('wp_footer')` will cause an infinite loop condition because the while loop suddenly doesn’t have a next value. In WordPress 3.8.1 you’ll get a warning message like:
`Warning: next() expects parameter 1 to be array, null given in wp-includes/plugin.php on line 431`
* You’ll just need to hook into a hook that’s called before the hook you wish to clear is called.
Since Version 4.7, these limitations have been addressed. Please refer to <https://wordpress.org/support/wordpress-version/version-4-7/#for-developers>
File: `wp-includes/plugin.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/plugin.php/)
```
function remove_all_actions( $hook_name, $priority = false ) {
return remove_all_filters( $hook_name, $priority );
}
```
| Uses | Description |
| --- | --- |
| [remove\_all\_filters()](remove_all_filters) wp-includes/plugin.php | Removes all of the callback functions from a filter hook. |
| Version | Description |
| --- | --- |
| [2.7.0](https://developer.wordpress.org/reference/since/2.7.0/) | Introduced. |
wordpress _make_url_clickable_cb( array $matches ): string \_make\_url\_clickable\_cb( array $matches ): string
====================================================
This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.
Callback to convert URI match to HTML A element.
This function was backported from 2.5.0 to 2.3.2. Regex callback for [make\_clickable()](make_clickable) .
`$matches` array Required Single Regex Match. string HTML A element with URI address.
File: `wp-includes/formatting.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/formatting.php/)
```
function _make_url_clickable_cb( $matches ) {
$url = $matches[2];
if ( ')' === $matches[3] && strpos( $url, '(' ) ) {
// If the trailing character is a closing parethesis, and the URL has an opening parenthesis in it,
// add the closing parenthesis to the URL. Then we can let the parenthesis balancer do its thing below.
$url .= $matches[3];
$suffix = '';
} else {
$suffix = $matches[3];
}
// Include parentheses in the URL only if paired.
while ( substr_count( $url, '(' ) < substr_count( $url, ')' ) ) {
$suffix = strrchr( $url, ')' ) . $suffix;
$url = substr( $url, 0, strrpos( $url, ')' ) );
}
$url = esc_url( $url );
if ( empty( $url ) ) {
return $matches[0];
}
if ( 'comment_text' === current_filter() ) {
$rel = 'nofollow ugc';
} else {
$rel = 'nofollow';
}
/**
* Filters the rel value that is added to URL matches converted to links.
*
* @since 5.3.0
*
* @param string $rel The rel value.
* @param string $url The matched URL being converted to a link tag.
*/
$rel = apply_filters( 'make_clickable_rel', $rel, $url );
$rel = esc_attr( $rel );
return $matches[1] . "<a href=\"$url\" rel=\"$rel\">$url</a>" . $suffix;
}
```
[apply\_filters( 'make\_clickable\_rel', string $rel, string $url )](../hooks/make_clickable_rel)
Filters the rel value that is added to URL matches converted to links.
| Uses | Description |
| --- | --- |
| [current\_filter()](current_filter) wp-includes/plugin.php | Retrieves the name of the current filter hook. |
| [esc\_url()](esc_url) wp-includes/formatting.php | Checks and cleans a URL. |
| [esc\_attr()](esc_attr) wp-includes/formatting.php | Escaping for HTML attributes. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| Version | Description |
| --- | --- |
| [2.3.2](https://developer.wordpress.org/reference/since/2.3.2/) | Introduced. |
wordpress wp_admin_viewport_meta() wp\_admin\_viewport\_meta()
===========================
Displays the viewport meta in the admin.
File: `wp-admin/includes/misc.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/misc.php/)
```
function wp_admin_viewport_meta() {
/**
* Filters the viewport meta in the admin.
*
* @since 5.5.0
*
* @param string $viewport_meta The viewport meta.
*/
$viewport_meta = apply_filters( 'admin_viewport_meta', 'width=device-width,initial-scale=1.0' );
if ( empty( $viewport_meta ) ) {
return;
}
echo '<meta name="viewport" content="' . esc_attr( $viewport_meta ) . '">';
}
```
[apply\_filters( 'admin\_viewport\_meta', string $viewport\_meta )](../hooks/admin_viewport_meta)
Filters the viewport meta in the admin.
| Uses | Description |
| --- | --- |
| [esc\_attr()](esc_attr) wp-includes/formatting.php | Escaping for HTML attributes. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| Version | Description |
| --- | --- |
| [5.5.0](https://developer.wordpress.org/reference/since/5.5.0/) | Introduced. |
wordpress wp_http_validate_url( string $url ): string|false wp\_http\_validate\_url( string $url ): string|false
====================================================
Validate a URL for safe use in the HTTP API.
`$url` string Required Request URL. string|false URL or false on failure.
File: `wp-includes/http.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/http.php/)
```
function wp_http_validate_url( $url ) {
if ( ! is_string( $url ) || '' === $url || is_numeric( $url ) ) {
return false;
}
$original_url = $url;
$url = wp_kses_bad_protocol( $url, array( 'http', 'https' ) );
if ( ! $url || strtolower( $url ) !== strtolower( $original_url ) ) {
return false;
}
$parsed_url = parse_url( $url );
if ( ! $parsed_url || empty( $parsed_url['host'] ) ) {
return false;
}
if ( isset( $parsed_url['user'] ) || isset( $parsed_url['pass'] ) ) {
return false;
}
if ( false !== strpbrk( $parsed_url['host'], ':#?[]' ) ) {
return false;
}
$parsed_home = parse_url( get_option( 'home' ) );
$same_host = isset( $parsed_home['host'] ) && strtolower( $parsed_home['host'] ) === strtolower( $parsed_url['host'] );
$host = trim( $parsed_url['host'], '.' );
if ( ! $same_host ) {
if ( preg_match( '#^(([1-9]?\d|1\d\d|25[0-5]|2[0-4]\d)\.){3}([1-9]?\d|1\d\d|25[0-5]|2[0-4]\d)$#', $host ) ) {
$ip = $host;
} else {
$ip = gethostbyname( $host );
if ( $ip === $host ) { // Error condition for gethostbyname().
return false;
}
}
if ( $ip ) {
$parts = array_map( 'intval', explode( '.', $ip ) );
if ( 127 === $parts[0] || 10 === $parts[0] || 0 === $parts[0]
|| ( 172 === $parts[0] && 16 <= $parts[1] && 31 >= $parts[1] )
|| ( 192 === $parts[0] && 168 === $parts[1] )
) {
// If host appears local, reject unless specifically allowed.
/**
* Check if HTTP request is external or not.
*
* Allows to change and allow external requests for the HTTP request.
*
* @since 3.6.0
*
* @param bool $external Whether HTTP request is external or not.
* @param string $host Host name of the requested URL.
* @param string $url Requested URL.
*/
if ( ! apply_filters( 'http_request_host_is_external', false, $host, $url ) ) {
return false;
}
}
}
}
if ( empty( $parsed_url['port'] ) ) {
return $url;
}
$port = $parsed_url['port'];
/**
* Controls the list of ports considered safe in HTTP API.
*
* Allows to change and allow external requests for the HTTP request.
*
* @since 5.9.0
*
* @param array $allowed_ports Array of integers for valid ports.
* @param string $host Host name of the requested URL.
* @param string $url Requested URL.
*/
$allowed_ports = apply_filters( 'http_allowed_safe_ports', array( 80, 443, 8080 ), $host, $url );
if ( is_array( $allowed_ports ) && in_array( $port, $allowed_ports, true ) ) {
return $url;
}
if ( $parsed_home && $same_host && isset( $parsed_home['port'] ) && $parsed_home['port'] === $port ) {
return $url;
}
return false;
}
```
[apply\_filters( 'http\_allowed\_safe\_ports', array $allowed\_ports, string $host, string $url )](../hooks/http_allowed_safe_ports)
Controls the list of ports considered safe in HTTP API.
[apply\_filters( 'http\_request\_host\_is\_external', bool $external, string $host, string $url )](../hooks/http_request_host_is_external)
Check if HTTP request is external or not.
| Uses | Description |
| --- | --- |
| [wp\_kses\_bad\_protocol()](wp_kses_bad_protocol) wp-includes/kses.php | Sanitizes a string and removed disallowed URL protocols. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| [get\_option()](get_option) wp-includes/option.php | Retrieves an option value based on an option name. |
| Used By | Description |
| --- | --- |
| [WP\_Http::validate\_redirects()](../classes/wp_http/validate_redirects) wp-includes/class-wp-http.php | Validate redirected URLs. |
| [WP\_Http::request()](../classes/wp_http/request) wp-includes/class-wp-http.php | Send an HTTP request to a URI. |
| [pingback\_ping\_source\_uri()](pingback_ping_source_uri) wp-includes/comment.php | Default filter attached to pingback\_ping\_source\_uri to validate the pingback’s Source URI. |
| Version | Description |
| --- | --- |
| [3.5.2](https://developer.wordpress.org/reference/since/3.5.2/) | Introduced. |
wordpress set_current_screen( string|WP_Screen $hook_name = '' ) set\_current\_screen( string|WP\_Screen $hook\_name = '' )
==========================================================
Set the current screen object
`$hook_name` string|[WP\_Screen](../classes/wp_screen) Optional The hook name (also known as the hook suffix) used to determine the screen, or an existing screen object. Default: `''`
File: `wp-admin/includes/screen.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/screen.php/)
```
function set_current_screen( $hook_name = '' ) {
WP_Screen::get( $hook_name )->set_current_screen();
}
```
| Uses | Description |
| --- | --- |
| [WP\_Screen::get()](../classes/wp_screen/get) wp-admin/includes/class-wp-screen.php | Fetches a screen object. |
| Used By | Description |
| --- | --- |
| [wp\_ajax\_search\_install\_plugins()](wp_ajax_search_install_plugins) wp-admin/includes/ajax-actions.php | Ajax handler for searching plugins to install. |
| [wp\_ajax\_search\_plugins()](wp_ajax_search_plugins) wp-admin/includes/ajax-actions.php | Ajax handler for searching plugins. |
| [wp\_ajax\_dashboard\_widgets()](wp_ajax_dashboard_widgets) wp-admin/includes/ajax-actions.php | Ajax handler for dashboard widgets. |
| Version | Description |
| --- | --- |
| [3.0.0](https://developer.wordpress.org/reference/since/3.0.0/) | Introduced. |
wordpress get_term_field( string $field, int|WP_Term $term, string $taxonomy = '', string $context = 'display' ): string|int|null|WP_Error get\_term\_field( string $field, int|WP\_Term $term, string $taxonomy = '', string $context = 'display' ): string|int|null|WP\_Error
====================================================================================================================================
Gets sanitized term field.
The function is for contextual reasons and for simplicity of usage.
* [sanitize\_term\_field()](sanitize_term_field)
`$field` string Required Term field to fetch. `$term` int|[WP\_Term](../classes/wp_term) Required Term ID or object. `$taxonomy` string Optional Taxonomy name. Default: `''`
`$context` string Optional How to sanitize term fields. Look at [sanitize\_term\_field()](sanitize_term_field) for available options.
Default `'display'`. More Arguments from sanitize\_term\_field( ... $context ) Context in which to sanitize the term field.
Accepts `'raw'`, `'edit'`, `'db'`, `'display'`, `'rss'`, `'attribute'`, or `'js'`. Default `'display'`. Default: `'display'`
string|int|null|[WP\_Error](../classes/wp_error) Will return an empty string if $term is not an object or if $field is not set in $term.
File: `wp-includes/taxonomy.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/taxonomy.php/)
```
function get_term_field( $field, $term, $taxonomy = '', $context = 'display' ) {
$term = get_term( $term, $taxonomy );
if ( is_wp_error( $term ) ) {
return $term;
}
if ( ! is_object( $term ) ) {
return '';
}
if ( ! isset( $term->$field ) ) {
return '';
}
return sanitize_term_field( $field, $term->$field, $term->term_id, $term->taxonomy, $context );
}
```
| Uses | Description |
| --- | --- |
| [sanitize\_term\_field()](sanitize_term_field) wp-includes/taxonomy.php | Sanitizes the field value in the term based on the context. |
| [get\_term()](get_term) wp-includes/taxonomy.php | Gets all term data from database by term ID. |
| [is\_wp\_error()](is_wp_error) wp-includes/load.php | Checks whether the given variable is a WordPress Error. |
| Used By | Description |
| --- | --- |
| [WP\_REST\_Menu\_Items\_Controller::prepare\_links()](../classes/wp_rest_menu_items_controller/prepare_links) wp-includes/rest-api/endpoints/class-wp-rest-menu-items-controller.php | Prepares links for the request. |
| [WP\_REST\_Menu\_Items\_Controller::prepare\_item\_for\_database()](../classes/wp_rest_menu_items_controller/prepare_item_for_database) wp-includes/rest-api/endpoints/class-wp-rest-menu-items-controller.php | Prepares a single post for create or update. |
| [WP\_Customize\_Nav\_Menu\_Item\_Setting::get\_original\_title()](../classes/wp_customize_nav_menu_item_setting/get_original_title) wp-includes/customize/class-wp-customize-nav-menu-item-setting.php | Get original title. |
| [term\_description()](term_description) wp-includes/category-template.php | Retrieves term description. |
| [wp\_setup\_nav\_menu\_item()](wp_setup_nav_menu_item) wp-includes/nav-menu.php | Decorates a menu item object with the shared navigation menu item properties. |
| [wp\_update\_nav\_menu\_item()](wp_update_nav_menu_item) wp-includes/nav-menu.php | Saves the properties of a menu item or create a new one. |
| Version | Description |
| --- | --- |
| [4.4.0](https://developer.wordpress.org/reference/since/4.4.0/) | The `$taxonomy` parameter was made optional. `$term` can also now accept a [WP\_Term](../classes/wp_term) object. |
| [2.3.0](https://developer.wordpress.org/reference/since/2.3.0/) | Introduced. |
wordpress wp_required_field_message(): string wp\_required\_field\_message(): string
======================================
Creates a message to explain required form fields.
string Message text and glyph wrapped in a `span` tag.
File: `wp-includes/general-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/general-template.php/)
```
function wp_required_field_message() {
$message = sprintf(
'<span class="required-field-message">%s</span>',
/* translators: %s: Asterisk symbol (*). */
sprintf( __( 'Required fields are marked %s' ), wp_required_field_indicator() )
);
/**
* Filters the message to explain required form fields.
*
* @since 6.1.0
*
* @param string $message Message text and glyph wrapped in a `span` tag.
*/
return apply_filters( 'wp_required_field_message', $message );
}
```
[apply\_filters( 'wp\_required\_field\_message', string $message )](../hooks/wp_required_field_message)
Filters the message to explain required form fields.
| Uses | Description |
| --- | --- |
| [wp\_required\_field\_indicator()](wp_required_field_indicator) wp-includes/general-template.php | Assigns a visual indicator for required form fields. |
| [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| Used By | Description |
| --- | --- |
| [wp\_media\_insert\_url\_form()](wp_media_insert_url_form) wp-admin/includes/media.php | Creates the form for external url. |
| [get\_media\_item()](get_media_item) wp-admin/includes/media.php | Retrieves HTML form for modifying the image attachment. |
| [get\_compat\_media\_markup()](get_compat_media_markup) wp-admin/includes/media.php | |
| [comment\_form()](comment_form) wp-includes/comment-template.php | Outputs a complete commenting form for use within a template. |
| Version | Description |
| --- | --- |
| [6.1.0](https://developer.wordpress.org/reference/since/6.1.0/) | Introduced. |
wordpress kses_remove_filters() kses\_remove\_filters()
=======================
Removes all KSES input form content filters.
A quick procedural method to removing all of the filters that KSES uses for content in WordPress Loop.
Does not remove the `kses_init()` function from [‘init’](../hooks/init) hook (priority is default). Also does not remove `kses_init()` function from [‘set\_current\_user’](../hooks/set_current_user) hook (priority is also default).
File: `wp-includes/kses.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/kses.php/)
```
function kses_remove_filters() {
// Normal filtering.
remove_filter( 'title_save_pre', 'wp_filter_kses' );
// Comment filtering.
remove_filter( 'pre_comment_content', 'wp_filter_post_kses' );
remove_filter( 'pre_comment_content', 'wp_filter_kses' );
// Global Styles filtering.
remove_filter( 'content_save_pre', 'wp_filter_global_styles_post', 9 );
remove_filter( 'content_filtered_save_pre', 'wp_filter_global_styles_post', 9 );
// Post filtering.
remove_filter( 'content_save_pre', 'wp_filter_post_kses' );
remove_filter( 'excerpt_save_pre', 'wp_filter_post_kses' );
remove_filter( 'content_filtered_save_pre', 'wp_filter_post_kses' );
}
```
| Uses | Description |
| --- | --- |
| [remove\_filter()](remove_filter) wp-includes/plugin.php | Removes a callback function from a filter hook. |
| Used By | Description |
| --- | --- |
| [wp\_handle\_comment\_submission()](wp_handle_comment_submission) wp-includes/comment.php | Handles the submission of a comment, usually posted to wp-comments-post.php via a comment form. |
| [wp\_ajax\_replyto\_comment()](wp_ajax_replyto_comment) wp-admin/includes/ajax-actions.php | Ajax handler for replying to a comment. |
| [kses\_init()](kses_init) wp-includes/kses.php | Sets up most of the KSES filters for input form content. |
| [WP\_Embed::shortcode()](../classes/wp_embed/shortcode) wp-includes/class-wp-embed.php | The [do\_shortcode()](do_shortcode) callback function. |
| Version | Description |
| --- | --- |
| [2.0.6](https://developer.wordpress.org/reference/since/2.0.6/) | Introduced. |
wordpress _wp_privacy_settings_filter_draft_page_titles( string $title, WP_Post $page ): string \_wp\_privacy\_settings\_filter\_draft\_page\_titles( string $title, WP\_Post $page ): string
=============================================================================================
This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.
Appends ‘(Draft)’ to draft page titles in the privacy page dropdown so that unpublished content is obvious.
`$title` string Required Page title. `$page` [WP\_Post](../classes/wp_post) Required Page data object. string Page title.
File: `wp-admin/includes/misc.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/misc.php/)
```
function _wp_privacy_settings_filter_draft_page_titles( $title, $page ) {
if ( 'draft' === $page->post_status && 'privacy' === get_current_screen()->id ) {
/* translators: %s: Page title. */
$title = sprintf( __( '%s (Draft)' ), $title );
}
return $title;
}
```
| Uses | Description |
| --- | --- |
| [get\_current\_screen()](get_current_screen) wp-admin/includes/screen.php | Get the current screen object |
| [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. |
| Version | Description |
| --- | --- |
| [4.9.8](https://developer.wordpress.org/reference/since/4.9.8/) | Introduced. |
| programming_docs |
wordpress wp_login_url( string $redirect = '', bool $force_reauth = false ): string wp\_login\_url( string $redirect = '', bool $force\_reauth = false ): string
============================================================================
Retrieves the login URL.
`$redirect` string Optional Path to redirect to on log in. Default: `''`
`$force_reauth` bool Optional Whether to force reauthorization, even if a cookie is present.
Default: `false`
string The login URL. Not HTML-encoded.
$redirect argument **must** be absolute, such as <http://example.com/mypage/>. For best results, use site\_url( ‘/mypage/ ‘ ).
File: `wp-includes/general-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/general-template.php/)
```
function wp_login_url( $redirect = '', $force_reauth = false ) {
$login_url = site_url( 'wp-login.php', 'login' );
if ( ! empty( $redirect ) ) {
$login_url = add_query_arg( 'redirect_to', urlencode( $redirect ), $login_url );
}
if ( $force_reauth ) {
$login_url = add_query_arg( 'reauth', '1', $login_url );
}
/**
* Filters the login URL.
*
* @since 2.8.0
* @since 4.2.0 The `$force_reauth` parameter was added.
*
* @param string $login_url The login URL. Not HTML-encoded.
* @param string $redirect The path to redirect to on login, if supplied.
* @param bool $force_reauth Whether to force reauthorization, even if a cookie is present.
*/
return apply_filters( 'login_url', $login_url, $redirect, $force_reauth );
}
```
[apply\_filters( 'login\_url', string $login\_url, string $redirect, bool $force\_reauth )](../hooks/login_url)
Filters the login URL.
| Uses | Description |
| --- | --- |
| [site\_url()](site_url) wp-includes/link-template.php | Retrieves the URL for the current site where WordPress application files (e.g. wp-blog-header.php or the wp-admin/ folder) are accessible. |
| [add\_query\_arg()](add_query_arg) wp-includes/functions.php | Retrieves a modified URL query string. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| Used By | Description |
| --- | --- |
| [is\_login()](is_login) wp-includes/load.php | Determines whether the current request is for the login screen. |
| [WP\_Recovery\_Mode\_Link\_Service::handle\_begin\_link()](../classes/wp_recovery_mode_link_service/handle_begin_link) wp-includes/class-wp-recovery-mode-link-service.php | Enters recovery mode when the user hits wp-login.php with a valid recovery mode link. |
| [WP\_Recovery\_Mode\_Link\_Service::get\_recovery\_mode\_begin\_url()](../classes/wp_recovery_mode_link_service/get_recovery_mode_begin_url) wp-includes/class-wp-recovery-mode-link-service.php | Gets a URL to begin recovery mode. |
| [wp\_admin\_bar\_recovery\_mode\_menu()](wp_admin_bar_recovery_mode_menu) wp-includes/admin-bar.php | Adds a link to exit recovery mode when Recovery Mode is active. |
| [wp\_recovery\_mode\_nag()](wp_recovery_mode_nag) wp-admin/includes/update.php | Displays a notice when the user is in recovery mode. |
| [wp\_send\_user\_request()](wp_send_user_request) wp-includes/user.php | Send a confirmation request email to confirm an action. |
| [WP\_Customize\_Manager::customize\_pane\_settings()](../classes/wp_customize_manager/customize_pane_settings) wp-includes/class-wp-customize-manager.php | Prints JavaScript settings for parent window. |
| [confirm\_another\_blog\_signup()](confirm_another_blog_signup) wp-signup.php | Shows a message confirming that the new site has been created. |
| [network\_step2()](network_step2) wp-admin/includes/network.php | Prints step 2 for Network installation process. |
| [wp\_new\_blog\_notification()](wp_new_blog_notification) wp-admin/includes/upgrade.php | Notifies the site admin that the installation of WordPress is complete. |
| [wp\_new\_user\_notification()](wp_new_user_notification) wp-includes/pluggable.php | Emails login credentials to a newly-registered user. |
| [auth\_redirect()](auth_redirect) wp-includes/pluggable.php | Checks if a user is logged in, if not it redirects them to the login page. |
| [wp\_loginout()](wp_loginout) wp-includes/general-template.php | Displays the Log In/Out link. |
| [wp\_auth\_check\_html()](wp_auth_check_html) wp-includes/functions.php | Outputs the HTML that shows the wp-login dialog when the user is no longer logged in. |
| [register\_new\_user()](register_new_user) wp-includes/user.php | Handles registering a new user. |
| [wp\_redirect\_admin\_locations()](wp_redirect_admin_locations) wp-includes/canonical.php | Redirects a variety of shorthand URLs to the admin. |
| [wpmu\_welcome\_user\_notification()](wpmu_welcome_user_notification) wp-includes/ms-functions.php | Notifies a user that their account activation has been successful. |
| [wpmu\_validate\_user\_signup()](wpmu_validate_user_signup) wp-includes/ms-functions.php | Sanitizes and validates data required for a user sign-up. |
| [wp\_xmlrpc\_server::initialise\_blog\_option\_info()](../classes/wp_xmlrpc_server/initialise_blog_option_info) wp-includes/class-wp-xmlrpc-server.php | Set up blog options property. |
| [get\_post\_reply\_link()](get_post_reply_link) wp-includes/comment-template.php | Retrieves HTML content for reply to post link. |
| [comment\_form()](comment_form) wp-includes/comment-template.php | Outputs a complete commenting form for use within a template. |
| [get\_comment\_reply\_link()](get_comment_reply_link) wp-includes/comment-template.php | Retrieves HTML content for reply to comment link. |
| Version | Description |
| --- | --- |
| [2.7.0](https://developer.wordpress.org/reference/since/2.7.0/) | Introduced. |
wordpress wp_redirect_admin_locations() wp\_redirect\_admin\_locations()
================================
Redirects a variety of shorthand URLs to the admin.
If a user visits example.com/admin, they’ll be redirected to /wp-admin.
Visiting /login redirects to /wp-login.php, and so on.
File: `wp-includes/canonical.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/canonical.php/)
```
function wp_redirect_admin_locations() {
global $wp_rewrite;
if ( ! ( is_404() && $wp_rewrite->using_permalinks() ) ) {
return;
}
$admins = array(
home_url( 'wp-admin', 'relative' ),
home_url( 'dashboard', 'relative' ),
home_url( 'admin', 'relative' ),
site_url( 'dashboard', 'relative' ),
site_url( 'admin', 'relative' ),
);
if ( in_array( untrailingslashit( $_SERVER['REQUEST_URI'] ), $admins, true ) ) {
wp_redirect( admin_url() );
exit;
}
$logins = array(
home_url( 'wp-login.php', 'relative' ),
home_url( 'login', 'relative' ),
site_url( 'login', 'relative' ),
);
if ( in_array( untrailingslashit( $_SERVER['REQUEST_URI'] ), $logins, true ) ) {
wp_redirect( wp_login_url() );
exit;
}
}
```
| Uses | Description |
| --- | --- |
| [untrailingslashit()](untrailingslashit) wp-includes/formatting.php | Removes trailing forward slashes and backslashes if they exist. |
| [wp\_redirect()](wp_redirect) wp-includes/pluggable.php | Redirects to another page. |
| [wp\_login\_url()](wp_login_url) wp-includes/general-template.php | Retrieves the login URL. |
| [is\_404()](is_404) wp-includes/query.php | Determines whether the query has resulted in a 404 (returns no results). |
| [site\_url()](site_url) wp-includes/link-template.php | Retrieves the URL for the current site where WordPress application files (e.g. wp-blog-header.php or the wp-admin/ folder) are accessible. |
| [WP\_Rewrite::using\_permalinks()](../classes/wp_rewrite/using_permalinks) wp-includes/class-wp-rewrite.php | Determines whether permalinks are being used. |
| [admin\_url()](admin_url) wp-includes/link-template.php | Retrieves the URL to the admin area for the current site. |
| [home\_url()](home_url) wp-includes/link-template.php | Retrieves the URL for the current site where the front end is accessible. |
| Version | Description |
| --- | --- |
| [3.4.0](https://developer.wordpress.org/reference/since/3.4.0/) | Introduced. |
wordpress get_the_taxonomies( int|WP_Post $post, array $args = array() ): string[] get\_the\_taxonomies( int|WP\_Post $post, array $args = array() ): string[]
===========================================================================
Retrieves all taxonomies associated with a post.
This function can be used within the loop. It will also return an array of the taxonomies with links to the taxonomy and name.
`$post` int|[WP\_Post](../classes/wp_post) Optional Post ID or [WP\_Post](../classes/wp_post) object. Default is global $post. `$args` array Optional Arguments about how to format the list of taxonomies.
* `template`stringTemplate for displaying a taxonomy label and list of terms.
Default is "Label: Terms."
* `term_template`stringTemplate for displaying a single term in the list. Default is the term name linked to its archive.
Default: `array()`
string[] List of taxonomies.
File: `wp-includes/taxonomy.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/taxonomy.php/)
```
function get_the_taxonomies( $post = 0, $args = array() ) {
$post = get_post( $post );
$args = wp_parse_args(
$args,
array(
/* translators: %s: Taxonomy label, %l: List of terms formatted as per $term_template. */
'template' => __( '%s: %l.' ),
'term_template' => '<a href="%1$s">%2$s</a>',
)
);
$taxonomies = array();
if ( ! $post ) {
return $taxonomies;
}
foreach ( get_object_taxonomies( $post ) as $taxonomy ) {
$t = (array) get_taxonomy( $taxonomy );
if ( empty( $t['label'] ) ) {
$t['label'] = $taxonomy;
}
if ( empty( $t['args'] ) ) {
$t['args'] = array();
}
if ( empty( $t['template'] ) ) {
$t['template'] = $args['template'];
}
if ( empty( $t['term_template'] ) ) {
$t['term_template'] = $args['term_template'];
}
$terms = get_object_term_cache( $post->ID, $taxonomy );
if ( false === $terms ) {
$terms = wp_get_object_terms( $post->ID, $taxonomy, $t['args'] );
}
$links = array();
foreach ( $terms as $term ) {
$links[] = wp_sprintf( $t['term_template'], esc_attr( get_term_link( $term ) ), $term->name );
}
if ( $links ) {
$taxonomies[ $taxonomy ] = wp_sprintf( $t['template'], $t['label'], $links, $terms );
}
}
return $taxonomies;
}
```
| Uses | Description |
| --- | --- |
| [wp\_sprintf()](wp_sprintf) wp-includes/formatting.php | WordPress implementation of PHP sprintf() with filters. |
| [get\_object\_term\_cache()](get_object_term_cache) wp-includes/taxonomy.php | Retrieves the cached term objects for the given object ID. |
| [get\_term\_link()](get_term_link) wp-includes/taxonomy.php | Generates a permalink for a taxonomy term archive. |
| [wp\_get\_object\_terms()](wp_get_object_terms) wp-includes/taxonomy.php | Retrieves the terms associated with the given object(s), in the supplied taxonomies. |
| [get\_object\_taxonomies()](get_object_taxonomies) wp-includes/taxonomy.php | Returns the names or objects of the taxonomies which are registered for the requested object or object type, such as a post object or post type name. |
| [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. |
| [esc\_attr()](esc_attr) wp-includes/formatting.php | Escaping for HTML attributes. |
| [wp\_parse\_args()](wp_parse_args) wp-includes/functions.php | Merges user defined arguments into defaults array. |
| [get\_taxonomy()](get_taxonomy) wp-includes/taxonomy.php | Retrieves the taxonomy object of $taxonomy. |
| [get\_post()](get_post) wp-includes/post.php | Retrieves post data given a post ID or post object. |
| Used By | Description |
| --- | --- |
| [the\_taxonomies()](the_taxonomies) wp-includes/taxonomy.php | Displays the taxonomies of a post with available options. |
| Version | Description |
| --- | --- |
| [2.5.0](https://developer.wordpress.org/reference/since/2.5.0/) | Introduced. |
wordpress _add_default_theme_supports() \_add\_default\_theme\_supports()
=================================
This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.
Adds default theme supports for block themes when the ‘setup\_theme’ action fires.
See [‘setup\_theme’](../hooks/setup_theme).
File: `wp-includes/theme.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/theme.php/)
```
function _add_default_theme_supports() {
if ( ! wp_is_block_theme() ) {
return;
}
add_theme_support( 'post-thumbnails' );
add_theme_support( 'responsive-embeds' );
add_theme_support( 'editor-styles' );
/*
* Makes block themes support HTML5 by default for the comment block and search form
* (which use default template functions) and `[caption]` and `[gallery]` shortcodes.
* Other blocks contain their own HTML5 markup.
*/
add_theme_support( 'html5', array( 'comment-form', 'comment-list', 'search-form', 'gallery', 'caption', 'style', 'script' ) );
add_theme_support( 'automatic-feed-links' );
add_filter( 'should_load_separate_core_block_assets', '__return_true' );
/*
* Remove the Customizer's Menus panel when block theme is active.
*/
add_filter(
'customize_panel_active',
static function ( $active, WP_Customize_Panel $panel ) {
if (
'nav_menus' === $panel->id &&
! current_theme_supports( 'menus' ) &&
! current_theme_supports( 'widgets' )
) {
$active = false;
}
return $active;
},
10,
2
);
}
```
| Uses | Description |
| --- | --- |
| [wp\_is\_block\_theme()](wp_is_block_theme) wp-includes/theme.php | Returns whether the active theme is a block-based theme or not. |
| [add\_theme\_support()](add_theme_support) wp-includes/theme.php | Registers theme support for a given feature. |
| [current\_theme\_supports()](current_theme_supports) wp-includes/theme.php | Checks a theme’s support for a given feature. |
| [add\_filter()](add_filter) wp-includes/plugin.php | Adds a callback function to a filter hook. |
| Version | Description |
| --- | --- |
| [5.9.0](https://developer.wordpress.org/reference/since/5.9.0/) | Introduced. |
wordpress js_escape( string $text ): string js\_escape( string $text ): string
==================================
This function has been deprecated. Use [esc\_js()](esc_js) instead.
Escape single quotes, specialchar double quotes, and fix line endings.
The filter [‘js\_escape’](../hooks/js_escape) is also applied by [esc\_js()](esc_js) .
* [esc\_js()](esc_js)
`$text` string Required The text to be escaped. string Escaped text.
File: `wp-includes/deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/deprecated.php/)
```
function js_escape( $text ) {
_deprecated_function( __FUNCTION__, '2.8.0', 'esc_js()' );
return esc_js( $text );
}
```
| Uses | Description |
| --- | --- |
| [esc\_js()](esc_js) wp-includes/formatting.php | Escapes single quotes, `"`, , `&`, and fixes line endings. |
| [\_deprecated\_function()](_deprecated_function) wp-includes/functions.php | Marks a function as deprecated and inform when it has been used. |
| Version | Description |
| --- | --- |
| [2.8.0](https://developer.wordpress.org/reference/since/2.8.0/) | Use [esc\_js()](esc_js) |
| [2.0.4](https://developer.wordpress.org/reference/since/2.0.4/) | Introduced. |
wordpress wp_nav_menu_setup() wp\_nav\_menu\_setup()
======================
Register nav menu meta boxes and advanced menu items.
File: `wp-admin/includes/nav-menu.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/nav-menu.php/)
```
function wp_nav_menu_setup() {
// Register meta boxes.
wp_nav_menu_post_type_meta_boxes();
add_meta_box( 'add-custom-links', __( 'Custom Links' ), 'wp_nav_menu_item_link_meta_box', 'nav-menus', 'side', 'default' );
wp_nav_menu_taxonomy_meta_boxes();
// Register advanced menu items (columns).
add_filter( 'manage_nav-menus_columns', 'wp_nav_menu_manage_columns' );
// If first time editing, disable advanced items by default.
if ( false === get_user_option( 'managenav-menuscolumnshidden' ) ) {
$user = wp_get_current_user();
update_user_meta(
$user->ID,
'managenav-menuscolumnshidden',
array(
0 => 'link-target',
1 => 'css-classes',
2 => 'xfn',
3 => 'description',
4 => 'title-attribute',
)
);
}
}
```
| Uses | Description |
| --- | --- |
| [add\_meta\_box()](add_meta_box) wp-admin/includes/template.php | Adds a meta box to one or more screens. |
| [wp\_nav\_menu\_post\_type\_meta\_boxes()](wp_nav_menu_post_type_meta_boxes) wp-admin/includes/nav-menu.php | Creates meta boxes for any post type menu item. |
| [wp\_nav\_menu\_taxonomy\_meta\_boxes()](wp_nav_menu_taxonomy_meta_boxes) wp-admin/includes/nav-menu.php | Creates meta boxes for any taxonomy menu item. |
| [wp\_get\_current\_user()](wp_get_current_user) wp-includes/pluggable.php | Retrieves the current user object. |
| [update\_user\_meta()](update_user_meta) wp-includes/user.php | Updates user meta field based on user ID. |
| [get\_user\_option()](get_user_option) wp-includes/user.php | Retrieves user option that can be either per Site or per Network. |
| [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. |
| [add\_filter()](add_filter) wp-includes/plugin.php | Adds a callback function to a filter hook. |
| Version | Description |
| --- | --- |
| [3.0.0](https://developer.wordpress.org/reference/since/3.0.0/) | Introduced. |
wordpress get_post_format( int|WP_Post|null $post = null ): string|false get\_post\_format( int|WP\_Post|null $post = null ): string|false
=================================================================
Retrieve the format slug for a post
`$post` int|[WP\_Post](../classes/wp_post)|null Optional Post ID or post object. Defaults to the current post in the loop. Default: `null`
string|false The format if successful. False otherwise.
This will usually be called in the [the loop](https://codex.wordpress.org/The_Loop "The Loop"), but can be used anywhere if a post ID is provided.
The set of currently defined formats are:
* aside
* chat
* gallery
* link
* image
* quote
* status
* video
* audio
Note also that the default format (i.e., a normal post) returns false, but this is also referred in some places as the ‘standard’ format. In some cases, developers may wish to do something like the following to maintain consistency:
```
$format = get_post_format() ? : 'standard';
```
File: `wp-includes/post-formats.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/post-formats.php/)
```
function get_post_format( $post = null ) {
$post = get_post( $post );
if ( ! $post ) {
return false;
}
if ( ! post_type_supports( $post->post_type, 'post-formats' ) ) {
return false;
}
$_format = get_the_terms( $post->ID, 'post_format' );
if ( empty( $_format ) ) {
return false;
}
$format = reset( $_format );
return str_replace( 'post-format-', '', $format->slug );
}
```
| Uses | Description |
| --- | --- |
| [get\_the\_terms()](get_the_terms) wp-includes/category-template.php | Retrieves the terms of the taxonomy that are attached to the post. |
| [post\_type\_supports()](post_type_supports) wp-includes/post.php | Checks a post type’s support for a given feature. |
| [get\_post()](get_post) wp-includes/post.php | Retrieves post data given a post ID or post object. |
| Used By | Description |
| --- | --- |
| [WP\_REST\_Posts\_Controller::prepare\_item\_for\_response()](../classes/wp_rest_posts_controller/prepare_item_for_response) wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php | Prepares a single post output for response. |
| [get\_embed\_template()](get_embed_template) wp-includes/template.php | Retrieves an embed template path in the current or parent template. |
| [get\_inline\_data()](get_inline_data) wp-admin/includes/template.php | Adds hidden fields with the data for use in the inline editor for posts and pages. |
| [post\_format\_meta\_box()](post_format_meta_box) wp-admin/includes/meta-boxes.php | Displays post format form elements. |
| [get\_post\_class()](get_post_class) wp-includes/post-template.php | Retrieves an array of the class names for the post container element. |
| [get\_body\_class()](get_body_class) wp-includes/post-template.php | Retrieves an array of the class names for the body element. |
| [wp\_xmlrpc\_server::mw\_getPost()](../classes/wp_xmlrpc_server/mw_getpost) wp-includes/class-wp-xmlrpc-server.php | Retrieve post. |
| [wp\_xmlrpc\_server::mw\_getRecentPosts()](../classes/wp_xmlrpc_server/mw_getrecentposts) wp-includes/class-wp-xmlrpc-server.php | Retrieve list of recent posts. |
| [wp\_xmlrpc\_server::\_prepare\_post()](../classes/wp_xmlrpc_server/_prepare_post) wp-includes/class-wp-xmlrpc-server.php | Prepares post data for return in an XML-RPC object. |
| [\_WP\_Editors::editor\_settings()](../classes/_wp_editors/editor_settings) wp-includes/class-wp-editor.php | |
| Version | Description |
| --- | --- |
| [3.1.0](https://developer.wordpress.org/reference/since/3.1.0/) | Introduced. |
| programming_docs |
wordpress export_wp( array $args = array() ) export\_wp( array $args = array() )
===================================
Generates the WXR export file for download.
Default behavior is to export all content, however, note that post content will only be exported for post types with the `can_export` argument enabled. Any posts with the ‘auto-draft’ status will be skipped.
`$args` array Optional Arguments for generating the WXR export file for download.
* `content`stringType of content to export. If set, only the post content of this post type will be exported. Accepts `'all'`, `'post'`, `'page'`, `'attachment'`, or a defined custom post. If an invalid custom post type is supplied, every post type for which `can_export` is enabled will be exported instead. If a valid custom post type is supplied but `can_export` is disabled, then `'posts'` will be exported instead. When `'all'` is supplied, only post types with `can_export` enabled will be exported. Default `'all'`.
* `author`stringAuthor to export content for. Only used when `$content` is `'post'`, `'page'`, or `'attachment'`. Accepts false (all) or a specific author ID. Default false (all).
* `category`stringCategory (slug) to export content for. Used only when `$content` is `'post'`. If set, only post content assigned to `$category` will be exported. Accepts false or a specific category slug. Default is false (all categories).
* `start_date`stringStart date to export content from. Expected date format is `'Y-m-d'`. Used only when `$content` is `'post'`, `'page'` or `'attachment'`. Default false (since the beginning of time).
* `end_date`stringEnd date to export content to. Expected date format is `'Y-m-d'`. Used only when `$content` is `'post'`, `'page'` or `'attachment'`. Default false (latest publish date).
* `status`stringPost status to export posts for. Used only when `$content` is `'post'` or `'page'`.
Accepts false (all statuses except `'auto-draft'`), or a specific status, i.e.
`'publish'`, `'pending'`, `'draft'`, `'auto-draft'`, `'future'`, `'private'`, `'inherit'`, or `'trash'`. Default false (all statuses except `'auto-draft'`).
Default: `array()`
File: `wp-admin/includes/export.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/export.php/)
```
function export_wp( $args = array() ) {
global $wpdb, $post;
$defaults = array(
'content' => 'all',
'author' => false,
'category' => false,
'start_date' => false,
'end_date' => false,
'status' => false,
);
$args = wp_parse_args( $args, $defaults );
/**
* Fires at the beginning of an export, before any headers are sent.
*
* @since 2.3.0
*
* @param array $args An array of export arguments.
*/
do_action( 'export_wp', $args );
$sitename = sanitize_key( get_bloginfo( 'name' ) );
if ( ! empty( $sitename ) ) {
$sitename .= '.';
}
$date = gmdate( 'Y-m-d' );
$wp_filename = $sitename . 'WordPress.' . $date . '.xml';
/**
* Filters the export filename.
*
* @since 4.4.0
*
* @param string $wp_filename The name of the file for download.
* @param string $sitename The site name.
* @param string $date Today's date, formatted.
*/
$filename = apply_filters( 'export_wp_filename', $wp_filename, $sitename, $date );
header( 'Content-Description: File Transfer' );
header( 'Content-Disposition: attachment; filename=' . $filename );
header( 'Content-Type: text/xml; charset=' . get_option( 'blog_charset' ), true );
if ( 'all' !== $args['content'] && post_type_exists( $args['content'] ) ) {
$ptype = get_post_type_object( $args['content'] );
if ( ! $ptype->can_export ) {
$args['content'] = 'post';
}
$where = $wpdb->prepare( "{$wpdb->posts}.post_type = %s", $args['content'] );
} else {
$post_types = get_post_types( array( 'can_export' => true ) );
$esses = array_fill( 0, count( $post_types ), '%s' );
// phpcs:ignore WordPress.DB.PreparedSQLPlaceholders.UnfinishedPrepare
$where = $wpdb->prepare( "{$wpdb->posts}.post_type IN (" . implode( ',', $esses ) . ')', $post_types );
}
if ( $args['status'] && ( 'post' === $args['content'] || 'page' === $args['content'] ) ) {
$where .= $wpdb->prepare( " AND {$wpdb->posts}.post_status = %s", $args['status'] );
} else {
$where .= " AND {$wpdb->posts}.post_status != 'auto-draft'";
}
$join = '';
if ( $args['category'] && 'post' === $args['content'] ) {
$term = term_exists( $args['category'], 'category' );
if ( $term ) {
$join = "INNER JOIN {$wpdb->term_relationships} ON ({$wpdb->posts}.ID = {$wpdb->term_relationships}.object_id)";
$where .= $wpdb->prepare( " AND {$wpdb->term_relationships}.term_taxonomy_id = %d", $term['term_taxonomy_id'] );
}
}
if ( in_array( $args['content'], array( 'post', 'page', 'attachment' ), true ) ) {
if ( $args['author'] ) {
$where .= $wpdb->prepare( " AND {$wpdb->posts}.post_author = %d", $args['author'] );
}
if ( $args['start_date'] ) {
$where .= $wpdb->prepare( " AND {$wpdb->posts}.post_date >= %s", gmdate( 'Y-m-d', strtotime( $args['start_date'] ) ) );
}
if ( $args['end_date'] ) {
$where .= $wpdb->prepare( " AND {$wpdb->posts}.post_date < %s", gmdate( 'Y-m-d', strtotime( '+1 month', strtotime( $args['end_date'] ) ) ) );
}
}
// Grab a snapshot of post IDs, just in case it changes during the export.
$post_ids = $wpdb->get_col( "SELECT ID FROM {$wpdb->posts} $join WHERE $where" );
/*
* Get the requested terms ready, empty unless posts filtered by category
* or all content.
*/
$cats = array();
$tags = array();
$terms = array();
if ( isset( $term ) && $term ) {
$cat = get_term( $term['term_id'], 'category' );
$cats = array( $cat->term_id => $cat );
unset( $term, $cat );
} elseif ( 'all' === $args['content'] ) {
$categories = (array) get_categories( array( 'get' => 'all' ) );
$tags = (array) get_tags( array( 'get' => 'all' ) );
$custom_taxonomies = get_taxonomies( array( '_builtin' => false ) );
$custom_terms = (array) get_terms(
array(
'taxonomy' => $custom_taxonomies,
'get' => 'all',
)
);
// Put categories in order with no child going before its parent.
while ( $cat = array_shift( $categories ) ) {
if ( ! $cat->parent || isset( $cats[ $cat->parent ] ) ) {
$cats[ $cat->term_id ] = $cat;
} else {
$categories[] = $cat;
}
}
// Put terms in order with no child going before its parent.
while ( $t = array_shift( $custom_terms ) ) {
if ( ! $t->parent || isset( $terms[ $t->parent ] ) ) {
$terms[ $t->term_id ] = $t;
} else {
$custom_terms[] = $t;
}
}
unset( $categories, $custom_taxonomies, $custom_terms );
}
/**
* Wraps given string in XML CDATA tag.
*
* @since 2.1.0
*
* @param string $str String to wrap in XML CDATA tag.
* @return string
*/
function wxr_cdata( $str ) {
if ( ! seems_utf8( $str ) ) {
$str = utf8_encode( $str );
}
// $str = ent2ncr(esc_html($str));
$str = '<![CDATA[' . str_replace( ']]>', ']]]]><![CDATA[>', $str ) . ']]>';
return $str;
}
/**
* Returns the URL of the site.
*
* @since 2.5.0
*
* @return string Site URL.
*/
function wxr_site_url() {
if ( is_multisite() ) {
// Multisite: the base URL.
return network_home_url();
} else {
// WordPress (single site): the blog URL.
return get_bloginfo_rss( 'url' );
}
}
/**
* Outputs a cat_name XML tag from a given category object.
*
* @since 2.1.0
*
* @param WP_Term $category Category Object.
*/
function wxr_cat_name( $category ) {
if ( empty( $category->name ) ) {
return;
}
echo '<wp:cat_name>' . wxr_cdata( $category->name ) . "</wp:cat_name>\n";
}
/**
* Outputs a category_description XML tag from a given category object.
*
* @since 2.1.0
*
* @param WP_Term $category Category Object.
*/
function wxr_category_description( $category ) {
if ( empty( $category->description ) ) {
return;
}
echo '<wp:category_description>' . wxr_cdata( $category->description ) . "</wp:category_description>\n";
}
/**
* Outputs a tag_name XML tag from a given tag object.
*
* @since 2.3.0
*
* @param WP_Term $tag Tag Object.
*/
function wxr_tag_name( $tag ) {
if ( empty( $tag->name ) ) {
return;
}
echo '<wp:tag_name>' . wxr_cdata( $tag->name ) . "</wp:tag_name>\n";
}
/**
* Outputs a tag_description XML tag from a given tag object.
*
* @since 2.3.0
*
* @param WP_Term $tag Tag Object.
*/
function wxr_tag_description( $tag ) {
if ( empty( $tag->description ) ) {
return;
}
echo '<wp:tag_description>' . wxr_cdata( $tag->description ) . "</wp:tag_description>\n";
}
/**
* Outputs a term_name XML tag from a given term object.
*
* @since 2.9.0
*
* @param WP_Term $term Term Object.
*/
function wxr_term_name( $term ) {
if ( empty( $term->name ) ) {
return;
}
echo '<wp:term_name>' . wxr_cdata( $term->name ) . "</wp:term_name>\n";
}
/**
* Outputs a term_description XML tag from a given term object.
*
* @since 2.9.0
*
* @param WP_Term $term Term Object.
*/
function wxr_term_description( $term ) {
if ( empty( $term->description ) ) {
return;
}
echo "\t\t<wp:term_description>" . wxr_cdata( $term->description ) . "</wp:term_description>\n";
}
/**
* Outputs term meta XML tags for a given term object.
*
* @since 4.6.0
*
* @param WP_Term $term Term object.
*/
function wxr_term_meta( $term ) {
global $wpdb;
$termmeta = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $wpdb->termmeta WHERE term_id = %d", $term->term_id ) );
foreach ( $termmeta as $meta ) {
/**
* Filters whether to selectively skip term meta used for WXR exports.
*
* Returning a truthy value from the filter will skip the current meta
* object from being exported.
*
* @since 4.6.0
*
* @param bool $skip Whether to skip the current piece of term meta. Default false.
* @param string $meta_key Current meta key.
* @param object $meta Current meta object.
*/
if ( ! apply_filters( 'wxr_export_skip_termmeta', false, $meta->meta_key, $meta ) ) {
printf( "\t\t<wp:termmeta>\n\t\t\t<wp:meta_key>%s</wp:meta_key>\n\t\t\t<wp:meta_value>%s</wp:meta_value>\n\t\t</wp:termmeta>\n", wxr_cdata( $meta->meta_key ), wxr_cdata( $meta->meta_value ) );
}
}
}
/**
* Outputs list of authors with posts.
*
* @since 3.1.0
*
* @global wpdb $wpdb WordPress database abstraction object.
*
* @param int[] $post_ids Optional. Array of post IDs to filter the query by.
*/
function wxr_authors_list( array $post_ids = null ) {
global $wpdb;
if ( ! empty( $post_ids ) ) {
$post_ids = array_map( 'absint', $post_ids );
$and = 'AND ID IN ( ' . implode( ', ', $post_ids ) . ')';
} else {
$and = '';
}
$authors = array();
$results = $wpdb->get_results( "SELECT DISTINCT post_author FROM $wpdb->posts WHERE post_status != 'auto-draft' $and" );
foreach ( (array) $results as $result ) {
$authors[] = get_userdata( $result->post_author );
}
$authors = array_filter( $authors );
foreach ( $authors as $author ) {
echo "\t<wp:author>";
echo '<wp:author_id>' . (int) $author->ID . '</wp:author_id>';
echo '<wp:author_login>' . wxr_cdata( $author->user_login ) . '</wp:author_login>';
echo '<wp:author_email>' . wxr_cdata( $author->user_email ) . '</wp:author_email>';
echo '<wp:author_display_name>' . wxr_cdata( $author->display_name ) . '</wp:author_display_name>';
echo '<wp:author_first_name>' . wxr_cdata( $author->first_name ) . '</wp:author_first_name>';
echo '<wp:author_last_name>' . wxr_cdata( $author->last_name ) . '</wp:author_last_name>';
echo "</wp:author>\n";
}
}
/**
* Outputs all navigation menu terms.
*
* @since 3.1.0
*/
function wxr_nav_menu_terms() {
$nav_menus = wp_get_nav_menus();
if ( empty( $nav_menus ) || ! is_array( $nav_menus ) ) {
return;
}
foreach ( $nav_menus as $menu ) {
echo "\t<wp:term>";
echo '<wp:term_id>' . (int) $menu->term_id . '</wp:term_id>';
echo '<wp:term_taxonomy>nav_menu</wp:term_taxonomy>';
echo '<wp:term_slug>' . wxr_cdata( $menu->slug ) . '</wp:term_slug>';
wxr_term_name( $menu );
echo "</wp:term>\n";
}
}
/**
* Outputs list of taxonomy terms, in XML tag format, associated with a post.
*
* @since 2.3.0
*/
function wxr_post_taxonomy() {
$post = get_post();
$taxonomies = get_object_taxonomies( $post->post_type );
if ( empty( $taxonomies ) ) {
return;
}
$terms = wp_get_object_terms( $post->ID, $taxonomies );
foreach ( (array) $terms as $term ) {
echo "\t\t<category domain=\"{$term->taxonomy}\" nicename=\"{$term->slug}\">" . wxr_cdata( $term->name ) . "</category>\n";
}
}
/**
* Determines whether to selectively skip post meta used for WXR exports.
*
* @since 3.3.0
*
* @param bool $return_me Whether to skip the current post meta. Default false.
* @param string $meta_key Meta key.
* @return bool
*/
function wxr_filter_postmeta( $return_me, $meta_key ) {
if ( '_edit_lock' === $meta_key ) {
$return_me = true;
}
return $return_me;
}
add_filter( 'wxr_export_skip_postmeta', 'wxr_filter_postmeta', 10, 2 );
echo '<?xml version="1.0" encoding="' . get_bloginfo( 'charset' ) . "\" ?>\n";
?>
<!-- This is a WordPress eXtended RSS file generated by WordPress as an export of your site. -->
<!-- It contains information about your site's posts, pages, comments, categories, and other content. -->
<!-- You may use this file to transfer that content from one site to another. -->
<!-- This file is not intended to serve as a complete backup of your site. -->
<!-- To import this information into a WordPress site follow these steps: -->
<!-- 1. Log in to that site as an administrator. -->
<!-- 2. Go to Tools: Import in the WordPress admin panel. -->
<!-- 3. Install the "WordPress" importer from the list. -->
<!-- 4. Activate & Run Importer. -->
<!-- 5. Upload this file using the form provided on that page. -->
<!-- 6. You will first be asked to map the authors in this export file to users -->
<!-- on the site. For each author, you may choose to map to an -->
<!-- existing user on the site or to create a new user. -->
<!-- 7. WordPress will then import each of the posts, pages, comments, categories, etc. -->
<!-- contained in this file into your site. -->
<?php the_generator( 'export' ); ?>
<rss version="2.0"
xmlns:excerpt="http://wordpress.org/export/<?php echo WXR_VERSION; ?>/excerpt/"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
xmlns:wfw="http://wellformedweb.org/CommentAPI/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:wp="http://wordpress.org/export/<?php echo WXR_VERSION; ?>/"
>
<channel>
<title><?php bloginfo_rss( 'name' ); ?></title>
<link><?php bloginfo_rss( 'url' ); ?></link>
<description><?php bloginfo_rss( 'description' ); ?></description>
<pubDate><?php echo gmdate( 'D, d M Y H:i:s +0000' ); ?></pubDate>
<language><?php bloginfo_rss( 'language' ); ?></language>
<wp:wxr_version><?php echo WXR_VERSION; ?></wp:wxr_version>
<wp:base_site_url><?php echo wxr_site_url(); ?></wp:base_site_url>
<wp:base_blog_url><?php bloginfo_rss( 'url' ); ?></wp:base_blog_url>
<?php wxr_authors_list( $post_ids ); ?>
<?php foreach ( $cats as $c ) : ?>
<wp:category>
<wp:term_id><?php echo (int) $c->term_id; ?></wp:term_id>
<wp:category_nicename><?php echo wxr_cdata( $c->slug ); ?></wp:category_nicename>
<wp:category_parent><?php echo wxr_cdata( $c->parent ? $cats[ $c->parent ]->slug : '' ); ?></wp:category_parent>
<?php
wxr_cat_name( $c );
wxr_category_description( $c );
wxr_term_meta( $c );
?>
</wp:category>
<?php endforeach; ?>
<?php foreach ( $tags as $t ) : ?>
<wp:tag>
<wp:term_id><?php echo (int) $t->term_id; ?></wp:term_id>
<wp:tag_slug><?php echo wxr_cdata( $t->slug ); ?></wp:tag_slug>
<?php
wxr_tag_name( $t );
wxr_tag_description( $t );
wxr_term_meta( $t );
?>
</wp:tag>
<?php endforeach; ?>
<?php foreach ( $terms as $t ) : ?>
<wp:term>
<wp:term_id><?php echo (int) $t->term_id; ?></wp:term_id>
<wp:term_taxonomy><?php echo wxr_cdata( $t->taxonomy ); ?></wp:term_taxonomy>
<wp:term_slug><?php echo wxr_cdata( $t->slug ); ?></wp:term_slug>
<wp:term_parent><?php echo wxr_cdata( $t->parent ? $terms[ $t->parent ]->slug : '' ); ?></wp:term_parent>
<?php
wxr_term_name( $t );
wxr_term_description( $t );
wxr_term_meta( $t );
?>
</wp:term>
<?php endforeach; ?>
<?php
if ( 'all' === $args['content'] ) {
wxr_nav_menu_terms();}
?>
<?php
/** This action is documented in wp-includes/feed-rss2.php */
do_action( 'rss2_head' );
?>
<?php
if ( $post_ids ) {
/**
* @global WP_Query $wp_query WordPress Query object.
*/
global $wp_query;
// Fake being in the loop.
$wp_query->in_the_loop = true;
// Fetch 20 posts at a time rather than loading the entire table into memory.
while ( $next_posts = array_splice( $post_ids, 0, 20 ) ) {
$where = 'WHERE ID IN (' . implode( ',', $next_posts ) . ')';
$posts = $wpdb->get_results( "SELECT * FROM {$wpdb->posts} $where" );
// Begin Loop.
foreach ( $posts as $post ) {
setup_postdata( $post );
/**
* Filters the post title used for WXR exports.
*
* @since 5.7.0
*
* @param string $post_title Title of the current post.
*/
$title = wxr_cdata( apply_filters( 'the_title_export', $post->post_title ) );
/**
* Filters the post content used for WXR exports.
*
* @since 2.5.0
*
* @param string $post_content Content of the current post.
*/
$content = wxr_cdata( apply_filters( 'the_content_export', $post->post_content ) );
/**
* Filters the post excerpt used for WXR exports.
*
* @since 2.6.0
*
* @param string $post_excerpt Excerpt for the current post.
*/
$excerpt = wxr_cdata( apply_filters( 'the_excerpt_export', $post->post_excerpt ) );
$is_sticky = is_sticky( $post->ID ) ? 1 : 0;
?>
<item>
<title><?php echo $title; ?></title>
<link><?php the_permalink_rss(); ?></link>
<pubDate><?php echo mysql2date( 'D, d M Y H:i:s +0000', get_post_time( 'Y-m-d H:i:s', true ), false ); ?></pubDate>
<dc:creator><?php echo wxr_cdata( get_the_author_meta( 'login' ) ); ?></dc:creator>
<guid isPermaLink="false"><?php the_guid(); ?></guid>
<description></description>
<content:encoded><?php echo $content; ?></content:encoded>
<excerpt:encoded><?php echo $excerpt; ?></excerpt:encoded>
<wp:post_id><?php echo (int) $post->ID; ?></wp:post_id>
<wp:post_date><?php echo wxr_cdata( $post->post_date ); ?></wp:post_date>
<wp:post_date_gmt><?php echo wxr_cdata( $post->post_date_gmt ); ?></wp:post_date_gmt>
<wp:post_modified><?php echo wxr_cdata( $post->post_modified ); ?></wp:post_modified>
<wp:post_modified_gmt><?php echo wxr_cdata( $post->post_modified_gmt ); ?></wp:post_modified_gmt>
<wp:comment_status><?php echo wxr_cdata( $post->comment_status ); ?></wp:comment_status>
<wp:ping_status><?php echo wxr_cdata( $post->ping_status ); ?></wp:ping_status>
<wp:post_name><?php echo wxr_cdata( $post->post_name ); ?></wp:post_name>
<wp:status><?php echo wxr_cdata( $post->post_status ); ?></wp:status>
<wp:post_parent><?php echo (int) $post->post_parent; ?></wp:post_parent>
<wp:menu_order><?php echo (int) $post->menu_order; ?></wp:menu_order>
<wp:post_type><?php echo wxr_cdata( $post->post_type ); ?></wp:post_type>
<wp:post_password><?php echo wxr_cdata( $post->post_password ); ?></wp:post_password>
<wp:is_sticky><?php echo (int) $is_sticky; ?></wp:is_sticky>
<?php if ( 'attachment' === $post->post_type ) : ?>
<wp:attachment_url><?php echo wxr_cdata( wp_get_attachment_url( $post->ID ) ); ?></wp:attachment_url>
<?php endif; ?>
<?php wxr_post_taxonomy(); ?>
<?php
$postmeta = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $wpdb->postmeta WHERE post_id = %d", $post->ID ) );
foreach ( $postmeta as $meta ) :
/**
* Filters whether to selectively skip post meta used for WXR exports.
*
* Returning a truthy value from the filter will skip the current meta
* object from being exported.
*
* @since 3.3.0
*
* @param bool $skip Whether to skip the current post meta. Default false.
* @param string $meta_key Current meta key.
* @param object $meta Current meta object.
*/
if ( apply_filters( 'wxr_export_skip_postmeta', false, $meta->meta_key, $meta ) ) {
continue;
}
?>
<wp:postmeta>
<wp:meta_key><?php echo wxr_cdata( $meta->meta_key ); ?></wp:meta_key>
<wp:meta_value><?php echo wxr_cdata( $meta->meta_value ); ?></wp:meta_value>
</wp:postmeta>
<?php
endforeach;
$_comments = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $wpdb->comments WHERE comment_post_ID = %d AND comment_approved <> 'spam'", $post->ID ) );
$comments = array_map( 'get_comment', $_comments );
foreach ( $comments as $c ) :
?>
<wp:comment>
<wp:comment_id><?php echo (int) $c->comment_ID; ?></wp:comment_id>
<wp:comment_author><?php echo wxr_cdata( $c->comment_author ); ?></wp:comment_author>
<wp:comment_author_email><?php echo wxr_cdata( $c->comment_author_email ); ?></wp:comment_author_email>
<wp:comment_author_url><?php echo sanitize_url( $c->comment_author_url ); ?></wp:comment_author_url>
<wp:comment_author_IP><?php echo wxr_cdata( $c->comment_author_IP ); ?></wp:comment_author_IP>
<wp:comment_date><?php echo wxr_cdata( $c->comment_date ); ?></wp:comment_date>
<wp:comment_date_gmt><?php echo wxr_cdata( $c->comment_date_gmt ); ?></wp:comment_date_gmt>
<wp:comment_content><?php echo wxr_cdata( $c->comment_content ); ?></wp:comment_content>
<wp:comment_approved><?php echo wxr_cdata( $c->comment_approved ); ?></wp:comment_approved>
<wp:comment_type><?php echo wxr_cdata( $c->comment_type ); ?></wp:comment_type>
<wp:comment_parent><?php echo (int) $c->comment_parent; ?></wp:comment_parent>
<wp:comment_user_id><?php echo (int) $c->user_id; ?></wp:comment_user_id>
<?php
$c_meta = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $wpdb->commentmeta WHERE comment_id = %d", $c->comment_ID ) );
foreach ( $c_meta as $meta ) :
/**
* Filters whether to selectively skip comment meta used for WXR exports.
*
* Returning a truthy value from the filter will skip the current meta
* object from being exported.
*
* @since 4.0.0
*
* @param bool $skip Whether to skip the current comment meta. Default false.
* @param string $meta_key Current meta key.
* @param object $meta Current meta object.
*/
if ( apply_filters( 'wxr_export_skip_commentmeta', false, $meta->meta_key, $meta ) ) {
continue;
}
?>
<wp:commentmeta>
<wp:meta_key><?php echo wxr_cdata( $meta->meta_key ); ?></wp:meta_key>
<wp:meta_value><?php echo wxr_cdata( $meta->meta_value ); ?></wp:meta_value>
</wp:commentmeta>
<?php endforeach; ?>
</wp:comment>
<?php endforeach; ?>
</item>
<?php
}
}
}
?>
</channel>
</rss>
<?php
}
```
[do\_action( 'export\_wp', array $args )](../hooks/export_wp)
Fires at the beginning of an export, before any headers are sent.
[apply\_filters( 'export\_wp\_filename', string $wp\_filename, string $sitename, string $date )](../hooks/export_wp_filename)
Filters the export filename.
[do\_action( 'rss2\_head' )](../hooks/rss2_head)
Fires at the end of the RSS2 Feed Header.
[apply\_filters( 'the\_content\_export', string $post\_content )](../hooks/the_content_export)
Filters the post content used for WXR exports.
[apply\_filters( 'the\_excerpt\_export', string $post\_excerpt )](../hooks/the_excerpt_export)
Filters the post excerpt used for WXR exports.
[apply\_filters( 'the\_title\_export', string $post\_title )](../hooks/the_title_export)
Filters the post title used for WXR exports.
[apply\_filters( 'wxr\_export\_skip\_commentmeta', bool $skip, string $meta\_key, object $meta )](../hooks/wxr_export_skip_commentmeta)
Filters whether to selectively skip comment meta used for WXR exports.
[apply\_filters( 'wxr\_export\_skip\_postmeta', bool $skip, string $meta\_key, object $meta )](../hooks/wxr_export_skip_postmeta)
Filters whether to selectively skip post meta used for WXR exports.
| Uses | Description |
| --- | --- |
| [wxr\_term\_meta()](wxr_term_meta) wp-admin/includes/export.php | Outputs term meta XML tags for a given term object. |
| [setup\_postdata()](setup_postdata) wp-includes/query.php | Set up global post data. |
| [wpdb::get\_col()](../classes/wpdb/get_col) wp-includes/class-wpdb.php | Retrieves one column from the database. |
| [get\_the\_author\_meta()](get_the_author_meta) wp-includes/author-template.php | Retrieves the requested data of the author of the current post. |
| [post\_type\_exists()](post_type_exists) wp-includes/post.php | Determines whether a post type is registered. |
| [is\_sticky()](is_sticky) wp-includes/post.php | Determines whether a post is sticky. |
| [wp\_get\_attachment\_url()](wp_get_attachment_url) wp-includes/post.php | Retrieves the URL for an attachment. |
| [the\_guid()](the_guid) wp-includes/post-template.php | Displays the Post Global Unique Identifier (guid). |
| [bloginfo\_rss()](bloginfo_rss) wp-includes/feed.php | Displays RSS container for the bloginfo function. |
| [the\_permalink\_rss()](the_permalink_rss) wp-includes/feed.php | Displays the permalink to the post for use in feeds. |
| [get\_taxonomies()](get_taxonomies) wp-includes/taxonomy.php | Retrieves a list of registered taxonomy names or objects. |
| [get\_terms()](get_terms) wp-includes/taxonomy.php | Retrieves the terms in a given taxonomy or list of taxonomies. |
| [term\_exists()](term_exists) wp-includes/taxonomy.php | Determines whether a taxonomy term exists. |
| [wxr\_post\_taxonomy()](wxr_post_taxonomy) wp-admin/includes/export.php | Outputs list of taxonomy terms, in XML tag format, associated with a post. |
| [get\_categories()](get_categories) wp-includes/category.php | Retrieves a list of category objects. |
| [get\_tags()](get_tags) wp-includes/category.php | Retrieves all post tags. |
| [mysql2date()](mysql2date) wp-includes/functions.php | Converts given MySQL date string into a different format. |
| [sanitize\_url()](sanitize_url) wp-includes/formatting.php | Sanitizes a URL for database or redirect usage. |
| [wxr\_tag\_description()](wxr_tag_description) wp-admin/includes/export.php | Outputs a tag\_description XML tag from a given tag object. |
| [wxr\_site\_url()](wxr_site_url) wp-admin/includes/export.php | Returns the URL of the site. |
| [wxr\_authors\_list()](wxr_authors_list) wp-admin/includes/export.php | Outputs list of authors with posts. |
| [wxr\_cdata()](wxr_cdata) wp-admin/includes/export.php | Wraps given string in XML CDATA tag. |
| [wxr\_cat\_name()](wxr_cat_name) wp-admin/includes/export.php | Outputs a cat\_name XML tag from a given category object. |
| [wxr\_category\_description()](wxr_category_description) wp-admin/includes/export.php | Outputs a category\_description XML tag from a given category object. |
| [wxr\_tag\_name()](wxr_tag_name) wp-admin/includes/export.php | Outputs a tag\_name XML tag from a given tag object. |
| [wxr\_term\_name()](wxr_term_name) wp-admin/includes/export.php | Outputs a term\_name XML tag from a given term object. |
| [wxr\_term\_description()](wxr_term_description) wp-admin/includes/export.php | Outputs a term\_description XML tag from a given term object. |
| [wxr\_nav\_menu\_terms()](wxr_nav_menu_terms) wp-admin/includes/export.php | Outputs all navigation menu terms. |
| [the\_generator()](the_generator) wp-includes/general-template.php | Displays the generator XML or Comment for RSS, ATOM, etc. |
| [get\_post\_time()](get_post_time) wp-includes/general-template.php | Retrieves the time at which the post was written. |
| [do\_action()](do_action) wp-includes/plugin.php | Calls the callback functions that have been added to an action hook. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| [add\_filter()](add_filter) wp-includes/plugin.php | Adds a callback function to a filter hook. |
| [get\_bloginfo()](get_bloginfo) wp-includes/general-template.php | Retrieves information about the current site. |
| [get\_option()](get_option) wp-includes/option.php | Retrieves an option value based on an option name. |
| [get\_term()](get_term) wp-includes/taxonomy.php | Gets all term data from database by term ID. |
| [sanitize\_key()](sanitize_key) wp-includes/formatting.php | Sanitizes a string key. |
| [get\_post\_type\_object()](get_post_type_object) wp-includes/post.php | Retrieves a post type object by name. |
| [get\_post\_types()](get_post_types) wp-includes/post.php | Gets a list of all registered post type objects. |
| [wp\_parse\_args()](wp_parse_args) wp-includes/functions.php | Merges user defined arguments into defaults array. |
| [wpdb::get\_results()](../classes/wpdb/get_results) wp-includes/class-wpdb.php | Retrieves an entire SQL result set from the database (i.e., many rows). |
| [wpdb::prepare()](../classes/wpdb/prepare) wp-includes/class-wpdb.php | Prepares a SQL query for safe execution. |
| Version | Description |
| --- | --- |
| [5.7.0](https://developer.wordpress.org/reference/since/5.7.0/) | Added the `post_modified` and `post_modified_gmt` fields to the export file. |
| [2.1.0](https://developer.wordpress.org/reference/since/2.1.0/) | Introduced. |
| programming_docs |
wordpress wp_lazy_loading_enabled( string $tag_name, string $context ): bool wp\_lazy\_loading\_enabled( string $tag\_name, string $context ): bool
======================================================================
Determines whether to add the `loading` attribute to the specified tag in the specified context.
`$tag_name` string Required The tag name. `$context` string Required Additional context, like the current filter name or the function name from where this was called. bool Whether to add the attribute.
File: `wp-includes/media.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/media.php/)
```
function wp_lazy_loading_enabled( $tag_name, $context ) {
// By default add to all 'img' and 'iframe' tags.
// See https://html.spec.whatwg.org/multipage/embedded-content.html#attr-img-loading
// See https://html.spec.whatwg.org/multipage/iframe-embed-object.html#attr-iframe-loading
$default = ( 'img' === $tag_name || 'iframe' === $tag_name );
/**
* Filters whether to add the `loading` attribute to the specified tag in the specified context.
*
* @since 5.5.0
*
* @param bool $default Default value.
* @param string $tag_name The tag name.
* @param string $context Additional context, like the current filter name
* or the function name from where this was called.
*/
return (bool) apply_filters( 'wp_lazy_loading_enabled', $default, $tag_name, $context );
}
```
[apply\_filters( 'wp\_lazy\_loading\_enabled', bool $default, string $tag\_name, string $context )](../hooks/wp_lazy_loading_enabled)
Filters whether to add the `loading` attribute to the specified tag in the specified context.
| Uses | Description |
| --- | --- |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| Used By | Description |
| --- | --- |
| [wp\_filter\_content\_tags()](wp_filter_content_tags) wp-includes/media.php | Filters specific tags in post content and modifies their markup. |
| [get\_avatar()](get_avatar) wp-includes/pluggable.php | Retrieves the avatar `<img>` tag for a user, email address, MD5 hash, comment, or post. |
| [WP\_Widget\_RSS::widget()](../classes/wp_widget_rss/widget) wp-includes/widgets/class-wp-widget-rss.php | Outputs the content for the current RSS widget instance. |
| [wp\_admin\_bar\_my\_sites\_menu()](wp_admin_bar_my_sites_menu) wp-includes/admin-bar.php | Adds the “My Sites/[Site Name]” menu and all submenus. |
| [wp\_get\_attachment\_image()](wp_get_attachment_image) wp-includes/media.php | Gets an HTML img element representing an image attachment. |
| Version | Description |
| --- | --- |
| [5.7.0](https://developer.wordpress.org/reference/since/5.7.0/) | Now returns `true` by default for `iframe` tags. |
| [5.5.0](https://developer.wordpress.org/reference/since/5.5.0/) | Introduced. |
wordpress wp_html_split( string $input ): string[] wp\_html\_split( string $input ): string[]
==========================================
Separates HTML elements and comments from the text.
`$input` string Required The text which has to be formatted. string[] Array of the formatted text.
File: `wp-includes/formatting.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/formatting.php/)
```
function wp_html_split( $input ) {
return preg_split( get_html_split_regex(), $input, -1, PREG_SPLIT_DELIM_CAPTURE );
}
```
| Uses | Description |
| --- | --- |
| [get\_html\_split\_regex()](get_html_split_regex) wp-includes/formatting.php | Retrieves the regular expression for an HTML element. |
| Used By | Description |
| --- | --- |
| [the\_block\_editor\_meta\_box\_post\_form\_hidden\_fields()](the_block_editor_meta_box_post_form_hidden_fields) wp-admin/includes/post.php | Renders the hidden form required for the meta boxes form. |
| [wp\_replace\_in\_html\_tags()](wp_replace_in_html_tags) wp-includes/formatting.php | Replaces characters or phrases within HTML elements only. |
| [do\_shortcodes\_in\_html\_tags()](do_shortcodes_in_html_tags) wp-includes/shortcodes.php | Searches only inside HTML elements for shortcodes and process them. |
| Version | Description |
| --- | --- |
| [4.2.4](https://developer.wordpress.org/reference/since/4.2.4/) | Introduced. |
wordpress parse_blocks( string $content ): array[] parse\_blocks( string $content ): array[]
=========================================
Parses blocks out of a content string.
`$content` string Required Post content. array[] Array of parsed block objects.
File: `wp-includes/blocks.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/blocks.php/)
```
function parse_blocks( $content ) {
/**
* Filter to allow plugins to replace the server-side block parser.
*
* @since 5.0.0
*
* @param string $parser_class Name of block parser class.
*/
$parser_class = apply_filters( 'block_parser_class', 'WP_Block_Parser' );
$parser = new $parser_class();
return $parser->parse( $content );
}
```
[apply\_filters( 'block\_parser\_class', string $parser\_class )](../hooks/block_parser_class)
Filter to allow plugins to replace the server-side block parser.
| Uses | Description |
| --- | --- |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| Used By | Description |
| --- | --- |
| [\_inject\_theme\_attribute\_in\_block\_template\_content()](_inject_theme_attribute_in_block_template_content) wp-includes/block-template-utils.php | Parses wp\_template content and injects the active theme’s stylesheet as a theme attribute into each wp\_template\_part |
| [\_remove\_theme\_attribute\_in\_block\_template\_content()](_remove_theme_attribute_in_block_template_content) wp-includes/block-template-utils.php | Parses a block template and removes the theme attribute from each template part. |
| [WP\_Widget\_Block::get\_dynamic\_classname()](../classes/wp_widget_block/get_dynamic_classname) wp-includes/widgets/class-wp-widget-block.php | Calculates the classname to use in the block widget’s container HTML. |
| [filter\_block\_content()](filter_block_content) wp-includes/blocks.php | Filters and sanitizes block content to remove non-allowable HTML from parsed block attribute values. |
| [do\_blocks()](do_blocks) wp-includes/blocks.php | Parses dynamic blocks out of `post_content` and re-renders them. |
| [excerpt\_remove\_blocks()](excerpt_remove_blocks) wp-includes/blocks.php | Parses blocks out of a content string, and renders those appropriate for the excerpt. |
| [get\_post\_galleries()](get_post_galleries) wp-includes/media.php | Retrieves galleries from the passed post’s content. |
| Version | Description |
| --- | --- |
| [5.0.0](https://developer.wordpress.org/reference/since/5.0.0/) | Introduced. |
wordpress media_upload_file(): null|string media\_upload\_file(): null|string
==================================
This function has been deprecated. Use [wp\_media\_upload\_handler()](wp_media_upload_handler) instead.
Handles uploading a generic file.
* [wp\_media\_upload\_handler()](wp_media_upload_handler)
null|string
File: `wp-admin/includes/deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/deprecated.php/)
```
function media_upload_file() {
_deprecated_function( __FUNCTION__, '3.3.0', 'wp_media_upload_handler()' );
return wp_media_upload_handler();
}
```
| Uses | Description |
| --- | --- |
| [wp\_media\_upload\_handler()](wp_media_upload_handler) wp-admin/includes/media.php | Handles the process of uploading media. |
| [\_deprecated\_function()](_deprecated_function) wp-includes/functions.php | Marks a function as deprecated and inform when it has been used. |
| Version | Description |
| --- | --- |
| [3.3.0](https://developer.wordpress.org/reference/since/3.3.0/) | Introduced. |
wordpress is_allowed_http_origin( string|null $origin = null ): string is\_allowed\_http\_origin( string|null $origin = null ): string
===============================================================
Determines if the HTTP origin is an authorized one.
`$origin` string|null Optional Origin URL. If not provided, the value of [get\_http\_origin()](get_http_origin) is used. Default: `null`
string Origin URL if allowed, empty string if not.
File: `wp-includes/http.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/http.php/)
```
function is_allowed_http_origin( $origin = null ) {
$origin_arg = $origin;
if ( null === $origin ) {
$origin = get_http_origin();
}
if ( $origin && ! in_array( $origin, get_allowed_http_origins(), true ) ) {
$origin = '';
}
/**
* Change the allowed HTTP origin result.
*
* @since 3.4.0
*
* @param string $origin Origin URL if allowed, empty string if not.
* @param string $origin_arg Original origin string passed into is_allowed_http_origin function.
*/
return apply_filters( 'allowed_http_origin', $origin, $origin_arg );
}
```
[apply\_filters( 'allowed\_http\_origin', string $origin, string $origin\_arg )](../hooks/allowed_http_origin)
Change the allowed HTTP origin result.
| Uses | Description |
| --- | --- |
| [get\_http\_origin()](get_http_origin) wp-includes/http.php | Get the HTTP Origin of the current request. |
| [get\_allowed\_http\_origins()](get_allowed_http_origins) wp-includes/http.php | Retrieve list of allowed HTTP origins. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| Used By | Description |
| --- | --- |
| [send\_origin\_headers()](send_origin_headers) wp-includes/http.php | Send Access-Control-Allow-Origin and related headers if the current request is from an allowed origin. |
| Version | Description |
| --- | --- |
| [3.4.0](https://developer.wordpress.org/reference/since/3.4.0/) | Introduced. |
wordpress get_page_uri( WP_Post|object|int $page ): string|false get\_page\_uri( WP\_Post|object|int $page ): string|false
=========================================================
Builds the URI path for a page.
Sub pages will be in the "directory" under the parent page post name.
`$page` [WP\_Post](../classes/wp_post)|object|int Optional Page ID or [WP\_Post](../classes/wp_post) object. Default is global $post. string|false Page URI, false on error.
If the page has parents, those are prepended to the URI to provide a full path. For example, a third level page might return a URI like this:
```
top-level-page/sub-page/current-page
```
This function will return a “slug” style URI regardless of whether [“pretty” Permalinks](https://wordpress.org/support/article/using-permalinks/ "Using Permalinks") are configured.
File: `wp-includes/post.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/post.php/)
```
function get_page_uri( $page = 0 ) {
if ( ! $page instanceof WP_Post ) {
$page = get_post( $page );
}
if ( ! $page ) {
return false;
}
$uri = $page->post_name;
foreach ( $page->ancestors as $parent ) {
$parent = get_post( $parent );
if ( $parent && $parent->post_name ) {
$uri = $parent->post_name . '/' . $uri;
}
}
/**
* Filters the URI for a page.
*
* @since 4.4.0
*
* @param string $uri Page URI.
* @param WP_Post $page Page object.
*/
return apply_filters( 'get_page_uri', $uri, $page );
}
```
[apply\_filters( 'get\_page\_uri', string $uri, WP\_Post $page )](../hooks/get_page_uri)
Filters the URI for a page.
| Uses | Description |
| --- | --- |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| [get\_post()](get_post) wp-includes/post.php | Retrieves post data given a post ID or post object. |
| Used By | Description |
| --- | --- |
| [get\_sample\_permalink()](get_sample_permalink) wp-admin/includes/post.php | Returns a sample permalink based on the post name. |
| [get\_post\_permalink()](get_post_permalink) wp-includes/link-template.php | Retrieves the permalink for a post of a custom post type. |
| [\_get\_page\_link()](_get_page_link) wp-includes/link-template.php | Retrieves the page permalink. |
| [WP\_Rewrite::page\_uri\_index()](../classes/wp_rewrite/page_uri_index) wp-includes/class-wp-rewrite.php | Retrieves all pages and attachments for pages URIs. |
| Version | Description |
| --- | --- |
| [4.6.0](https://developer.wordpress.org/reference/since/4.6.0/) | The `$page` parameter was made optional. |
| [1.5.0](https://developer.wordpress.org/reference/since/1.5.0/) | Introduced. |
wordpress strip_fragment_from_url( string $url ): string strip\_fragment\_from\_url( string $url ): string
=================================================
Strips the #fragment from a URL, if one is present.
`$url` string Required The URL to strip. string The altered URL.
File: `wp-includes/canonical.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/canonical.php/)
```
function strip_fragment_from_url( $url ) {
$parsed_url = wp_parse_url( $url );
if ( ! empty( $parsed_url['host'] ) ) {
$url = '';
if ( ! empty( $parsed_url['scheme'] ) ) {
$url = $parsed_url['scheme'] . ':';
}
$url .= '//' . $parsed_url['host'];
if ( ! empty( $parsed_url['port'] ) ) {
$url .= ':' . $parsed_url['port'];
}
if ( ! empty( $parsed_url['path'] ) ) {
$url .= $parsed_url['path'];
}
if ( ! empty( $parsed_url['query'] ) ) {
$url .= '?' . $parsed_url['query'];
}
}
return $url;
}
```
| Uses | Description |
| --- | --- |
| [wp\_parse\_url()](wp_parse_url) wp-includes/http.php | A wrapper for PHP’s parse\_url() function that handles consistency in the return values across PHP versions. |
| Used By | Description |
| --- | --- |
| [do\_enclose()](do_enclose) wp-includes/functions.php | Checks content for video and audio links to add as enclosures. |
| [redirect\_canonical()](redirect_canonical) wp-includes/canonical.php | Redirects incoming links to the proper URL based on the site url. |
| Version | Description |
| --- | --- |
| [4.4.0](https://developer.wordpress.org/reference/since/4.4.0/) | Introduced. |
wordpress wp_timezone(): DateTimeZone wp\_timezone(): DateTimeZone
============================
Retrieves the timezone of the site as a `DateTimeZone` object.
Timezone can be based on a PHP timezone string or a ±HH:MM offset.
DateTimeZone Timezone object.
File: `wp-includes/functions.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/functions.php/)
```
function wp_timezone() {
return new DateTimeZone( wp_timezone_string() );
}
```
| Uses | Description |
| --- | --- |
| [wp\_timezone\_string()](wp_timezone_string) wp-includes/functions.php | Retrieves the timezone of the site as a string. |
| Used By | Description |
| --- | --- |
| [current\_datetime()](current_datetime) wp-includes/functions.php | Retrieves the current time as an object using the site’s timezone. |
| [wp\_date()](wp_date) wp-includes/functions.php | Retrieves the date, in localized format. |
| [get\_post\_datetime()](get_post_datetime) wp-includes/general-template.php | Retrieves post published or modified time as a `DateTimeImmutable` object instance. |
| [get\_gmt\_from\_date()](get_gmt_from_date) wp-includes/formatting.php | Given a date in the timezone of the site, returns that date in UTC. |
| [get\_date\_from\_gmt()](get_date_from_gmt) wp-includes/formatting.php | Given a date in UTC or GMT timezone, returns that date in the timezone of the site. |
| [iso8601\_to\_datetime()](iso8601_to_datetime) wp-includes/formatting.php | Given an ISO 8601 (Ymd\TH:i:sO) date, returns a MySQL DateTime (Y-m-d H:i:s) format used by post\_date[\_gmt]. |
| [date\_i18n()](date_i18n) wp-includes/functions.php | Retrieves the date in localized format, based on a sum of Unix timestamp and timezone offset in seconds. |
| [mysql2date()](mysql2date) wp-includes/functions.php | Converts given MySQL date string into a different format. |
| [current\_time()](current_time) wp-includes/functions.php | Retrieves the current time based on specified type. |
| [WP\_Date\_Query::build\_mysql\_datetime()](../classes/wp_date_query/build_mysql_datetime) wp-includes/class-wp-date-query.php | Builds a MySQL format date/time based on some query parameters. |
| Version | Description |
| --- | --- |
| [5.3.0](https://developer.wordpress.org/reference/since/5.3.0/) | Introduced. |
wordpress get_the_author_email(): string get\_the\_author\_email(): string
=================================
This function has been deprecated. Use [get\_the\_author\_meta()](get_the_author_meta) instead.
Retrieve the email of the author of the current post.
* [get\_the\_author\_meta()](get_the_author_meta)
string The author's username.
File: `wp-includes/deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/deprecated.php/)
```
function get_the_author_email() {
_deprecated_function( __FUNCTION__, '2.8.0', 'get_the_author_meta(\'email\')' );
return get_the_author_meta('email');
}
```
| Uses | Description |
| --- | --- |
| [get\_the\_author\_meta()](get_the_author_meta) wp-includes/author-template.php | Retrieves the requested data of the author of the current post. |
| [\_deprecated\_function()](_deprecated_function) wp-includes/functions.php | Marks a function as deprecated and inform when it has been used. |
| Version | Description |
| --- | --- |
| [2.8.0](https://developer.wordpress.org/reference/since/2.8.0/) | Use [get\_the\_author\_meta()](get_the_author_meta) |
| [1.5.0](https://developer.wordpress.org/reference/since/1.5.0/) | Introduced. |
wordpress wp_new_comment( array $commentdata, bool $wp_error = false ): int|false|WP_Error wp\_new\_comment( array $commentdata, bool $wp\_error = false ): int|false|WP\_Error
====================================================================================
Adds a new comment to the database.
Filters new comment to ensure that the fields are sanitized and valid before inserting comment into database. Calls [‘comment\_post’](../hooks/comment_post) action with comment ID and whether comment is approved by WordPress. Also has [‘preprocess\_comment’](../hooks/preprocess_comment) filter for processing the comment data before the function handles it.
We use `REMOTE_ADDR` here directly. If you are behind a proxy, you should ensure that it is properly set, such as in wp-config.php, for your environment.
See <https://core.trac.wordpress.org/ticket/9235>
* [wp\_insert\_comment()](wp_insert_comment)
`$commentdata` array Required Comment data.
* `comment_author`stringThe name of the comment author.
* `comment_author_email`stringThe comment author email address.
* `comment_author_url`stringThe comment author URL.
* `comment_content`stringThe content of the comment.
* `comment_date`stringThe date the comment was submitted. Default is the current time.
* `comment_date_gmt`stringThe date the comment was submitted in the GMT timezone.
Default is `$comment_date` in the GMT timezone.
* `comment_type`stringComment type. Default `'comment'`.
* `comment_parent`intThe ID of this comment's parent, if any. Default 0.
* `comment_post_ID`intThe ID of the post that relates to the comment.
* `user_id`intThe ID of the user who submitted the comment. Default 0.
* `user_ID`intKept for backward-compatibility. Use `$user_id` instead.
* `comment_agent`stringComment author user agent. Default is the value of `'HTTP_USER_AGENT'` in the `$_SERVER` superglobal sent in the original request.
* `comment_author_IP`stringComment author IP address in IPv4 format. Default is the value of `'REMOTE_ADDR'` in the `$_SERVER` superglobal sent in the original request.
`$wp_error` bool Optional Should errors be returned as [WP\_Error](../classes/wp_error) objects instead of executing [wp\_die()](wp_die) ? More Arguments from wp\_die( ... $args ) Arguments to control behavior. If `$args` is an integer, then it is treated as the response code.
* `response`intThe HTTP response code. Default 200 for Ajax requests, 500 otherwise.
* `link_url`stringA URL to include a link to. Only works in combination with $link\_text.
Default empty string.
* `link_text`stringA label for the link to include. Only works in combination with $link\_url.
Default empty string.
* `back_link`boolWhether to include a link to go back. Default false.
* `text_direction`stringThe text direction. This is only useful internally, when WordPress is still loading and the site's locale is not set up yet. Accepts `'rtl'` and `'ltr'`.
Default is the value of [is\_rtl()](is_rtl) .
* `charset`stringCharacter set of the HTML output. Default `'utf-8'`.
* `code`stringError code to use. Default is `'wp_die'`, or the main error code if $message is a [WP\_Error](../classes/wp_error).
* `exit`boolWhether to exit the process after completion. Default true.
Default: `false`
int|false|[WP\_Error](../classes/wp_error) The ID of the comment on success, false or [WP\_Error](../classes/wp_error) on failure.
File: `wp-includes/comment.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/comment.php/)
```
function wp_new_comment( $commentdata, $wp_error = false ) {
global $wpdb;
/*
* Normalize `user_ID` to `user_id`, but pass the old key
* to the `preprocess_comment` filter for backward compatibility.
*/
if ( isset( $commentdata['user_ID'] ) ) {
$commentdata['user_ID'] = (int) $commentdata['user_ID'];
$commentdata['user_id'] = $commentdata['user_ID'];
} elseif ( isset( $commentdata['user_id'] ) ) {
$commentdata['user_id'] = (int) $commentdata['user_id'];
$commentdata['user_ID'] = $commentdata['user_id'];
}
$prefiltered_user_id = ( isset( $commentdata['user_id'] ) ) ? (int) $commentdata['user_id'] : 0;
if ( ! isset( $commentdata['comment_author_IP'] ) ) {
$commentdata['comment_author_IP'] = $_SERVER['REMOTE_ADDR'];
}
if ( ! isset( $commentdata['comment_agent'] ) ) {
$commentdata['comment_agent'] = isset( $_SERVER['HTTP_USER_AGENT'] ) ? $_SERVER['HTTP_USER_AGENT'] : '';
}
/**
* Filters a comment's data before it is sanitized and inserted into the database.
*
* @since 1.5.0
* @since 5.6.0 Comment data includes the `comment_agent` and `comment_author_IP` values.
*
* @param array $commentdata Comment data.
*/
$commentdata = apply_filters( 'preprocess_comment', $commentdata );
$commentdata['comment_post_ID'] = (int) $commentdata['comment_post_ID'];
// Normalize `user_ID` to `user_id` again, after the filter.
if ( isset( $commentdata['user_ID'] ) && $prefiltered_user_id !== (int) $commentdata['user_ID'] ) {
$commentdata['user_ID'] = (int) $commentdata['user_ID'];
$commentdata['user_id'] = $commentdata['user_ID'];
} elseif ( isset( $commentdata['user_id'] ) ) {
$commentdata['user_id'] = (int) $commentdata['user_id'];
$commentdata['user_ID'] = $commentdata['user_id'];
}
$commentdata['comment_parent'] = isset( $commentdata['comment_parent'] ) ? absint( $commentdata['comment_parent'] ) : 0;
$parent_status = ( $commentdata['comment_parent'] > 0 ) ? wp_get_comment_status( $commentdata['comment_parent'] ) : '';
$commentdata['comment_parent'] = ( 'approved' === $parent_status || 'unapproved' === $parent_status ) ? $commentdata['comment_parent'] : 0;
$commentdata['comment_author_IP'] = preg_replace( '/[^0-9a-fA-F:., ]/', '', $commentdata['comment_author_IP'] );
$commentdata['comment_agent'] = substr( $commentdata['comment_agent'], 0, 254 );
if ( empty( $commentdata['comment_date'] ) ) {
$commentdata['comment_date'] = current_time( 'mysql' );
}
if ( empty( $commentdata['comment_date_gmt'] ) ) {
$commentdata['comment_date_gmt'] = current_time( 'mysql', 1 );
}
if ( empty( $commentdata['comment_type'] ) ) {
$commentdata['comment_type'] = 'comment';
}
$commentdata = wp_filter_comment( $commentdata );
$commentdata['comment_approved'] = wp_allow_comment( $commentdata, $wp_error );
if ( is_wp_error( $commentdata['comment_approved'] ) ) {
return $commentdata['comment_approved'];
}
$comment_ID = wp_insert_comment( $commentdata );
if ( ! $comment_ID ) {
$fields = array( 'comment_author', 'comment_author_email', 'comment_author_url', 'comment_content' );
foreach ( $fields as $field ) {
if ( isset( $commentdata[ $field ] ) ) {
$commentdata[ $field ] = $wpdb->strip_invalid_text_for_column( $wpdb->comments, $field, $commentdata[ $field ] );
}
}
$commentdata = wp_filter_comment( $commentdata );
$commentdata['comment_approved'] = wp_allow_comment( $commentdata, $wp_error );
if ( is_wp_error( $commentdata['comment_approved'] ) ) {
return $commentdata['comment_approved'];
}
$comment_ID = wp_insert_comment( $commentdata );
if ( ! $comment_ID ) {
return false;
}
}
/**
* Fires immediately after a comment is inserted into the database.
*
* @since 1.2.0
* @since 4.5.0 The `$commentdata` parameter was added.
*
* @param int $comment_ID The comment ID.
* @param int|string $comment_approved 1 if the comment is approved, 0 if not, 'spam' if spam.
* @param array $commentdata Comment data.
*/
do_action( 'comment_post', $comment_ID, $commentdata['comment_approved'], $commentdata );
return $comment_ID;
}
```
[do\_action( 'comment\_post', int $comment\_ID, int|string $comment\_approved, array $commentdata )](../hooks/comment_post)
Fires immediately after a comment is inserted into the database.
[apply\_filters( 'preprocess\_comment', array $commentdata )](../hooks/preprocess_comment)
Filters a comment’s data before it is sanitized and inserted into the database.
| Uses | Description |
| --- | --- |
| [wpdb::strip\_invalid\_text\_for\_column()](../classes/wpdb/strip_invalid_text_for_column) wp-includes/class-wpdb.php | Strips any invalid characters from the string for a given table and column. |
| [current\_time()](current_time) wp-includes/functions.php | Retrieves the current time based on specified type. |
| [wp\_get\_comment\_status()](wp_get_comment_status) wp-includes/comment.php | Retrieves the status of a comment by comment ID. |
| [wp\_filter\_comment()](wp_filter_comment) wp-includes/comment.php | Filters and sanitizes comment data. |
| [wp\_insert\_comment()](wp_insert_comment) wp-includes/comment.php | Inserts a comment into the database. |
| [wp\_allow\_comment()](wp_allow_comment) wp-includes/comment.php | Validates whether this comment is allowed to be made. |
| [absint()](absint) wp-includes/functions.php | Converts a value to non-negative integer. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| [do\_action()](do_action) wp-includes/plugin.php | Calls the callback functions that have been added to an action hook. |
| [is\_wp\_error()](is_wp_error) wp-includes/load.php | Checks whether the given variable is a WordPress Error. |
| Used By | Description |
| --- | --- |
| [wp\_handle\_comment\_submission()](wp_handle_comment_submission) wp-includes/comment.php | Handles the submission of a comment, usually posted to wp-comments-post.php via a comment form. |
| [wp\_ajax\_replyto\_comment()](wp_ajax_replyto_comment) wp-admin/includes/ajax-actions.php | Ajax handler for replying to a comment. |
| [wp\_xmlrpc\_server::pingback\_ping()](../classes/wp_xmlrpc_server/pingback_ping) wp-includes/class-wp-xmlrpc-server.php | Retrieves a pingback and registers it. |
| [wp\_xmlrpc\_server::wp\_newComment()](../classes/wp_xmlrpc_server/wp_newcomment) wp-includes/class-wp-xmlrpc-server.php | Create new comment. |
| Version | Description |
| --- | --- |
| [5.5.0](https://developer.wordpress.org/reference/since/5.5.0/) | Introduced the `comment_type` argument. |
| [4.7.0](https://developer.wordpress.org/reference/since/4.7.0/) | The `$avoid_die` parameter was added, allowing the function to return a [WP\_Error](../classes/wp_error) object instead of dying. |
| [4.3.0](https://developer.wordpress.org/reference/since/4.3.0/) | Introduced the `comment_agent` and `comment_author_IP` arguments. |
| [1.5.0](https://developer.wordpress.org/reference/since/1.5.0/) | Introduced. |
| programming_docs |
wordpress is_robots(): bool is\_robots(): bool
==================
Is the query for the robots.txt file?
bool Whether the query is for the robots.txt file.
File: `wp-includes/query.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/query.php/)
```
function is_robots() {
global $wp_query;
if ( ! isset( $wp_query ) ) {
_doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the query is run. Before then, they always return false.' ), '3.1.0' );
return false;
}
return $wp_query->is_robots();
}
```
| Uses | Description |
| --- | --- |
| [WP\_Query::is\_robots()](../classes/wp_query/is_robots) wp-includes/class-wp-query.php | Is the query for the robots.txt file? |
| [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. |
| [\_doing\_it\_wrong()](_doing_it_wrong) wp-includes/functions.php | Marks something as being incorrectly called. |
| Used By | Description |
| --- | --- |
| [WP::handle\_404()](../classes/wp/handle_404) wp-includes/class-wp.php | Set the Headers for 404, if nothing is found for requested URL. |
| [redirect\_canonical()](redirect_canonical) wp-includes/canonical.php | Redirects incoming links to the proper URL based on the site url. |
| Version | Description |
| --- | --- |
| [2.1.0](https://developer.wordpress.org/reference/since/2.1.0/) | Introduced. |
wordpress wp_list_post_revisions( int|WP_Post $post, string $type = 'all' ) wp\_list\_post\_revisions( int|WP\_Post $post, string $type = 'all' )
=====================================================================
Displays a list of a post’s revisions.
Can output either a UL with edit links or a TABLE with diff interface, and restore action links.
`$post` int|[WP\_Post](../classes/wp_post) Optional Post ID or [WP\_Post](../classes/wp_post) object. Default is global $post. `$type` string Optional `'all'` (default), `'revision'` or `'autosave'` Default: `'all'`
File: `wp-includes/post-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/post-template.php/)
```
function wp_list_post_revisions( $post = 0, $type = 'all' ) {
$post = get_post( $post );
if ( ! $post ) {
return;
}
// $args array with (parent, format, right, left, type) deprecated since 3.6.
if ( is_array( $type ) ) {
$type = ! empty( $type['type'] ) ? $type['type'] : $type;
_deprecated_argument( __FUNCTION__, '3.6.0' );
}
$revisions = wp_get_post_revisions( $post->ID );
if ( ! $revisions ) {
return;
}
$rows = '';
foreach ( $revisions as $revision ) {
if ( ! current_user_can( 'read_post', $revision->ID ) ) {
continue;
}
$is_autosave = wp_is_post_autosave( $revision );
if ( ( 'revision' === $type && $is_autosave ) || ( 'autosave' === $type && ! $is_autosave ) ) {
continue;
}
$rows .= "\t<li>" . wp_post_revision_title_expanded( $revision ) . "</li>\n";
}
echo "<div class='hide-if-js'><p>" . __( 'JavaScript must be enabled to use this feature.' ) . "</p></div>\n";
echo "<ul class='post-revisions hide-if-no-js'>\n";
echo $rows;
echo '</ul>';
}
```
| Uses | Description |
| --- | --- |
| [wp\_post\_revision\_title\_expanded()](wp_post_revision_title_expanded) wp-includes/post-template.php | Retrieves formatted date timestamp of a revision (linked to that revisions’s page). |
| [wp\_get\_post\_revisions()](wp_get_post_revisions) wp-includes/revision.php | Returns all revisions of specified post. |
| [wp\_is\_post\_autosave()](wp_is_post_autosave) wp-includes/revision.php | Determines if the specified post is an autosave. |
| [current\_user\_can()](current_user_can) wp-includes/capabilities.php | Returns whether the current user has the specified capability. |
| [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. |
| [\_deprecated\_argument()](_deprecated_argument) wp-includes/functions.php | Marks a function argument as deprecated and inform when it has been used. |
| [get\_post()](get_post) wp-includes/post.php | Retrieves post data given a post ID or post object. |
| Used By | Description |
| --- | --- |
| [post\_revisions\_meta\_box()](post_revisions_meta_box) wp-admin/includes/meta-boxes.php | Displays list of revisions. |
| Version | Description |
| --- | --- |
| [2.6.0](https://developer.wordpress.org/reference/since/2.6.0/) | Introduced. |
wordpress is_trackback(): bool is\_trackback(): bool
=====================
Determines whether the query is for a trackback endpoint call.
For more information on this and similar theme functions, check out the [Conditional Tags](https://developer.wordpress.org/themes/basics/conditional-tags/) article in the Theme Developer Handbook.
bool Whether the query is for a trackback endpoint call.
File: `wp-includes/query.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/query.php/)
```
function is_trackback() {
global $wp_query;
if ( ! isset( $wp_query ) ) {
_doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the query is run. Before then, they always return false.' ), '3.1.0' );
return false;
}
return $wp_query->is_trackback();
}
```
| Uses | Description |
| --- | --- |
| [WP\_Query::is\_trackback()](../classes/wp_query/is_trackback) wp-includes/class-wp-query.php | Is the query for a trackback endpoint call? |
| [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. |
| [\_doing\_it\_wrong()](_doing_it_wrong) wp-includes/functions.php | Marks something as being incorrectly called. |
| Used By | Description |
| --- | --- |
| [wp\_die()](wp_die) wp-includes/functions.php | Kills WordPress execution and displays HTML page with an error message. |
| [redirect\_canonical()](redirect_canonical) wp-includes/canonical.php | Redirects incoming links to the proper URL based on the site url. |
| Version | Description |
| --- | --- |
| [1.5.0](https://developer.wordpress.org/reference/since/1.5.0/) | Introduced. |
wordpress update_home_siteurl( string $old_value, string $value ) update\_home\_siteurl( string $old\_value, string $value )
==========================================================
Flushes rewrite rules if siteurl, home or page\_on\_front changed.
`$old_value` string Required `$value` string Required File: `wp-admin/includes/misc.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/misc.php/)
```
function update_home_siteurl( $old_value, $value ) {
if ( wp_installing() ) {
return;
}
if ( is_multisite() && ms_is_switched() ) {
delete_option( 'rewrite_rules' );
} else {
flush_rewrite_rules();
}
}
```
| Uses | Description |
| --- | --- |
| [wp\_installing()](wp_installing) wp-includes/load.php | Check or set whether WordPress is in “installation” mode. |
| [delete\_option()](delete_option) wp-includes/option.php | Removes option by name. Prevents removal of protected WordPress options. |
| [flush\_rewrite\_rules()](flush_rewrite_rules) wp-includes/rewrite.php | Removes rewrite rules and then recreate rewrite rules. |
| [ms\_is\_switched()](ms_is_switched) wp-includes/ms-blogs.php | Determines if [switch\_to\_blog()](switch_to_blog) is in effect |
| [is\_multisite()](is_multisite) wp-includes/load.php | If Multisite is enabled. |
| Version | Description |
| --- | --- |
| [2.1.0](https://developer.wordpress.org/reference/since/2.1.0/) | Introduced. |
wordpress get_default_block_template_types(): array get\_default\_block\_template\_types(): array
=============================================
Returns a filtered list of default template types, containing their localized titles and descriptions.
array The default template types.
File: `wp-includes/block-template-utils.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/block-template-utils.php/)
```
function get_default_block_template_types() {
$default_template_types = array(
'index' => array(
'title' => _x( 'Index', 'Template name' ),
'description' => __( 'Displays posts.' ),
),
'home' => array(
'title' => _x( 'Home', 'Template name' ),
'description' => __( 'Displays posts on the homepage, or on the Posts page if a static homepage is set.' ),
),
'front-page' => array(
'title' => _x( 'Front Page', 'Template name' ),
'description' => __( 'Displays the homepage.' ),
),
'singular' => array(
'title' => _x( 'Singular', 'Template name' ),
'description' => __( 'Displays a single post or page.' ),
),
'single' => array(
'title' => _x( 'Single', 'Template name' ),
'description' => __( 'The default template for displaying any single post or attachment.' ),
),
'page' => array(
'title' => _x( 'Page', 'Template name' ),
'description' => __( 'Displays a single page.' ),
),
'archive' => array(
'title' => _x( 'Archive', 'Template name' ),
'description' => __( 'Displays post categories, tags, and other archives.' ),
),
'author' => array(
'title' => _x( 'Author', 'Template name' ),
'description' => __( 'Displays latest posts written by a single author.' ),
),
'category' => array(
'title' => _x( 'Category', 'Template name' ),
'description' => __( 'Displays latest posts from a single post category.' ),
),
'taxonomy' => array(
'title' => _x( 'Taxonomy', 'Template name' ),
'description' => __( 'Displays latest posts from a single post taxonomy.' ),
),
'date' => array(
'title' => _x( 'Date', 'Template name' ),
'description' => __( 'Displays posts from a specific date.' ),
),
'tag' => array(
'title' => _x( 'Tag', 'Template name' ),
'description' => __( 'Displays latest posts with a single post tag.' ),
),
'attachment' => array(
'title' => __( 'Media' ),
'description' => __( 'Displays individual media items or attachments.' ),
),
'search' => array(
'title' => _x( 'Search', 'Template name' ),
'description' => __( 'Displays search results.' ),
),
'privacy-policy' => array(
'title' => __( 'Privacy Policy' ),
'description' => __( 'Displays the privacy policy page.' ),
),
'404' => array(
'title' => _x( '404', 'Template name' ),
'description' => __( 'Displays when no content is found.' ),
),
);
/**
* Filters the list of template types.
*
* @since 5.9.0
*
* @param array $default_template_types An array of template types, formatted as [ slug => [ title, description ] ].
*/
return apply_filters( 'default_template_types', $default_template_types );
}
```
[apply\_filters( 'default\_template\_types', array $default\_template\_types )](../hooks/default_template_types)
Filters the list of template types.
| Uses | Description |
| --- | --- |
| [\_x()](_x) wp-includes/l10n.php | Retrieves translated string with gettext context. |
| [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| Used By | Description |
| --- | --- |
| [\_add\_template\_loader\_filters()](_add_template_loader_filters) wp-includes/block-template.php | Adds necessary filters to use ‘wp\_template’ posts instead of theme template files. |
| [\_build\_block\_template\_result\_from\_file()](_build_block_template_result_from_file) wp-includes/block-template-utils.php | Builds a unified template object based on a theme file. |
| [\_build\_block\_template\_result\_from\_post()](_build_block_template_result_from_post) wp-includes/block-template-utils.php | Builds a unified template object based a post Object. |
| Version | Description |
| --- | --- |
| [5.9.0](https://developer.wordpress.org/reference/since/5.9.0/) | Introduced. |
wordpress url_is_accessable_via_ssl( string $url ): bool url\_is\_accessable\_via\_ssl( string $url ): bool
==================================================
This function has been deprecated.
Determines if the URL can be accessed over SSL.
Determines if the URL can be accessed over SSL by using the WordPress HTTP API to access the URL using https as the scheme.
`$url` string Required The URL to test. bool Whether SSL access is available.
File: `wp-includes/deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/deprecated.php/)
```
function url_is_accessable_via_ssl( $url ) {
_deprecated_function( __FUNCTION__, '4.0.0' );
$response = wp_remote_get( set_url_scheme( $url, 'https' ) );
if ( !is_wp_error( $response ) ) {
$status = wp_remote_retrieve_response_code( $response );
if ( 200 == $status || 401 == $status ) {
return true;
}
}
return false;
}
```
| Uses | Description |
| --- | --- |
| [wp\_remote\_get()](wp_remote_get) wp-includes/http.php | Performs an HTTP request using the GET method and returns its response. |
| [set\_url\_scheme()](set_url_scheme) wp-includes/link-template.php | Sets the scheme for a URL. |
| [wp\_remote\_retrieve\_response\_code()](wp_remote_retrieve_response_code) wp-includes/http.php | Retrieve only the response code from the raw response. |
| [\_deprecated\_function()](_deprecated_function) wp-includes/functions.php | Marks a function as deprecated and inform when it has been used. |
| [is\_wp\_error()](is_wp_error) wp-includes/load.php | Checks whether the given variable is a WordPress Error. |
| Version | Description |
| --- | --- |
| [4.0.0](https://developer.wordpress.org/reference/since/4.0.0/) | This function has been deprecated. |
| [2.5.0](https://developer.wordpress.org/reference/since/2.5.0/) | Introduced. |
wordpress wp_get_code_editor_settings( array $args ): array|false wp\_get\_code\_editor\_settings( array $args ): array|false
===========================================================
Generates and returns code editor settings.
* [wp\_enqueue\_code\_editor()](wp_enqueue_code_editor)
`$args` array Required Args.
* `type`stringThe MIME type of the file to be edited.
* `file`stringFilename to be edited. Extension is used to sniff the type. Can be supplied as alternative to `$type` param.
* `theme`[WP\_Theme](../classes/wp_theme)Theme being edited when on the theme file editor.
* `plugin`stringPlugin being edited when on the plugin file editor.
* `codemirror`arrayAdditional CodeMirror setting overrides.
* `csslint`arrayCSSLint rule overrides.
* `jshint`arrayJSHint rule overrides.
* `htmlhint`arrayHTMLHint rule overrides.
array|false Settings for the code editor.
File: `wp-includes/general-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/general-template.php/)
```
function wp_get_code_editor_settings( $args ) {
$settings = array(
'codemirror' => array(
'indentUnit' => 4,
'indentWithTabs' => true,
'inputStyle' => 'contenteditable',
'lineNumbers' => true,
'lineWrapping' => true,
'styleActiveLine' => true,
'continueComments' => true,
'extraKeys' => array(
'Ctrl-Space' => 'autocomplete',
'Ctrl-/' => 'toggleComment',
'Cmd-/' => 'toggleComment',
'Alt-F' => 'findPersistent',
'Ctrl-F' => 'findPersistent',
'Cmd-F' => 'findPersistent',
),
'direction' => 'ltr', // Code is shown in LTR even in RTL languages.
'gutters' => array(),
),
'csslint' => array(
'errors' => true, // Parsing errors.
'box-model' => true,
'display-property-grouping' => true,
'duplicate-properties' => true,
'known-properties' => true,
'outline-none' => true,
),
'jshint' => array(
// The following are copied from <https://github.com/WordPress/wordpress-develop/blob/4.8.1/.jshintrc>.
'boss' => true,
'curly' => true,
'eqeqeq' => true,
'eqnull' => true,
'es3' => true,
'expr' => true,
'immed' => true,
'noarg' => true,
'nonbsp' => true,
'onevar' => true,
'quotmark' => 'single',
'trailing' => true,
'undef' => true,
'unused' => true,
'browser' => true,
'globals' => array(
'_' => false,
'Backbone' => false,
'jQuery' => false,
'JSON' => false,
'wp' => false,
),
),
'htmlhint' => array(
'tagname-lowercase' => true,
'attr-lowercase' => true,
'attr-value-double-quotes' => false,
'doctype-first' => false,
'tag-pair' => true,
'spec-char-escape' => true,
'id-unique' => true,
'src-not-empty' => true,
'attr-no-duplication' => true,
'alt-require' => true,
'space-tab-mixed-disabled' => 'tab',
'attr-unsafe-chars' => true,
),
);
$type = '';
if ( isset( $args['type'] ) ) {
$type = $args['type'];
// Remap MIME types to ones that CodeMirror modes will recognize.
if ( 'application/x-patch' === $type || 'text/x-patch' === $type ) {
$type = 'text/x-diff';
}
} elseif ( isset( $args['file'] ) && false !== strpos( basename( $args['file'] ), '.' ) ) {
$extension = strtolower( pathinfo( $args['file'], PATHINFO_EXTENSION ) );
foreach ( wp_get_mime_types() as $exts => $mime ) {
if ( preg_match( '!^(' . $exts . ')$!i', $extension ) ) {
$type = $mime;
break;
}
}
// Supply any types that are not matched by wp_get_mime_types().
if ( empty( $type ) ) {
switch ( $extension ) {
case 'conf':
$type = 'text/nginx';
break;
case 'css':
$type = 'text/css';
break;
case 'diff':
case 'patch':
$type = 'text/x-diff';
break;
case 'html':
case 'htm':
$type = 'text/html';
break;
case 'http':
$type = 'message/http';
break;
case 'js':
$type = 'text/javascript';
break;
case 'json':
$type = 'application/json';
break;
case 'jsx':
$type = 'text/jsx';
break;
case 'less':
$type = 'text/x-less';
break;
case 'md':
$type = 'text/x-gfm';
break;
case 'php':
case 'phtml':
case 'php3':
case 'php4':
case 'php5':
case 'php7':
case 'phps':
$type = 'application/x-httpd-php';
break;
case 'scss':
$type = 'text/x-scss';
break;
case 'sass':
$type = 'text/x-sass';
break;
case 'sh':
case 'bash':
$type = 'text/x-sh';
break;
case 'sql':
$type = 'text/x-sql';
break;
case 'svg':
$type = 'application/svg+xml';
break;
case 'xml':
$type = 'text/xml';
break;
case 'yml':
case 'yaml':
$type = 'text/x-yaml';
break;
case 'txt':
default:
$type = 'text/plain';
break;
}
}
}
if ( in_array( $type, array( 'text/css', 'text/x-scss', 'text/x-less', 'text/x-sass' ), true ) ) {
$settings['codemirror'] = array_merge(
$settings['codemirror'],
array(
'mode' => $type,
'lint' => false,
'autoCloseBrackets' => true,
'matchBrackets' => true,
)
);
} elseif ( 'text/x-diff' === $type ) {
$settings['codemirror'] = array_merge(
$settings['codemirror'],
array(
'mode' => 'diff',
)
);
} elseif ( 'text/html' === $type ) {
$settings['codemirror'] = array_merge(
$settings['codemirror'],
array(
'mode' => 'htmlmixed',
'lint' => true,
'autoCloseBrackets' => true,
'autoCloseTags' => true,
'matchTags' => array(
'bothTags' => true,
),
)
);
if ( ! current_user_can( 'unfiltered_html' ) ) {
$settings['htmlhint']['kses'] = wp_kses_allowed_html( 'post' );
}
} elseif ( 'text/x-gfm' === $type ) {
$settings['codemirror'] = array_merge(
$settings['codemirror'],
array(
'mode' => 'gfm',
'highlightFormatting' => true,
)
);
} elseif ( 'application/javascript' === $type || 'text/javascript' === $type ) {
$settings['codemirror'] = array_merge(
$settings['codemirror'],
array(
'mode' => 'javascript',
'lint' => true,
'autoCloseBrackets' => true,
'matchBrackets' => true,
)
);
} elseif ( false !== strpos( $type, 'json' ) ) {
$settings['codemirror'] = array_merge(
$settings['codemirror'],
array(
'mode' => array(
'name' => 'javascript',
),
'lint' => true,
'autoCloseBrackets' => true,
'matchBrackets' => true,
)
);
if ( 'application/ld+json' === $type ) {
$settings['codemirror']['mode']['jsonld'] = true;
} else {
$settings['codemirror']['mode']['json'] = true;
}
} elseif ( false !== strpos( $type, 'jsx' ) ) {
$settings['codemirror'] = array_merge(
$settings['codemirror'],
array(
'mode' => 'jsx',
'autoCloseBrackets' => true,
'matchBrackets' => true,
)
);
} elseif ( 'text/x-markdown' === $type ) {
$settings['codemirror'] = array_merge(
$settings['codemirror'],
array(
'mode' => 'markdown',
'highlightFormatting' => true,
)
);
} elseif ( 'text/nginx' === $type ) {
$settings['codemirror'] = array_merge(
$settings['codemirror'],
array(
'mode' => 'nginx',
)
);
} elseif ( 'application/x-httpd-php' === $type ) {
$settings['codemirror'] = array_merge(
$settings['codemirror'],
array(
'mode' => 'php',
'autoCloseBrackets' => true,
'autoCloseTags' => true,
'matchBrackets' => true,
'matchTags' => array(
'bothTags' => true,
),
)
);
} elseif ( 'text/x-sql' === $type || 'text/x-mysql' === $type ) {
$settings['codemirror'] = array_merge(
$settings['codemirror'],
array(
'mode' => 'sql',
'autoCloseBrackets' => true,
'matchBrackets' => true,
)
);
} elseif ( false !== strpos( $type, 'xml' ) ) {
$settings['codemirror'] = array_merge(
$settings['codemirror'],
array(
'mode' => 'xml',
'autoCloseBrackets' => true,
'autoCloseTags' => true,
'matchTags' => array(
'bothTags' => true,
),
)
);
} elseif ( 'text/x-yaml' === $type ) {
$settings['codemirror'] = array_merge(
$settings['codemirror'],
array(
'mode' => 'yaml',
)
);
} else {
$settings['codemirror']['mode'] = $type;
}
if ( ! empty( $settings['codemirror']['lint'] ) ) {
$settings['codemirror']['gutters'][] = 'CodeMirror-lint-markers';
}
// Let settings supplied via args override any defaults.
foreach ( wp_array_slice_assoc( $args, array( 'codemirror', 'csslint', 'jshint', 'htmlhint' ) ) as $key => $value ) {
$settings[ $key ] = array_merge(
$settings[ $key ],
$value
);
}
/**
* Filters settings that are passed into the code editor.
*
* Returning a falsey value will disable the syntax-highlighting code editor.
*
* @since 4.9.0
*
* @param array $settings The array of settings passed to the code editor.
* A falsey value disables the editor.
* @param array $args {
* Args passed when calling `get_code_editor_settings()`.
*
* @type string $type The MIME type of the file to be edited.
* @type string $file Filename being edited.
* @type WP_Theme $theme Theme being edited when on the theme file editor.
* @type string $plugin Plugin being edited when on the plugin file editor.
* @type array $codemirror Additional CodeMirror setting overrides.
* @type array $csslint CSSLint rule overrides.
* @type array $jshint JSHint rule overrides.
* @type array $htmlhint HTMLHint rule overrides.
* }
*/
return apply_filters( 'wp_code_editor_settings', $settings, $args );
}
```
[apply\_filters( 'wp\_code\_editor\_settings', array $settings, array $args )](../hooks/wp_code_editor_settings)
Filters settings that are passed into the code editor.
| Uses | Description |
| --- | --- |
| [wp\_array\_slice\_assoc()](wp_array_slice_assoc) wp-includes/functions.php | Extracts a slice of an array, given a list of keys. |
| [wp\_kses\_allowed\_html()](wp_kses_allowed_html) wp-includes/kses.php | Returns an array of allowed HTML tags and attributes for a given context. |
| [wp\_get\_mime\_types()](wp_get_mime_types) wp-includes/functions.php | Retrieves the list of mime types and file extensions. |
| [current\_user\_can()](current_user_can) wp-includes/capabilities.php | Returns whether the current user has the specified capability. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| Used By | Description |
| --- | --- |
| [wp\_enqueue\_code\_editor()](wp_enqueue_code_editor) wp-includes/general-template.php | Enqueues assets needed by the code editor for the given settings. |
| Version | Description |
| --- | --- |
| [5.0.0](https://developer.wordpress.org/reference/since/5.0.0/) | Introduced. |
| programming_docs |
wordpress the_post_thumbnail( string|int[] $size = 'post-thumbnail', string|array $attr = '' ) the\_post\_thumbnail( string|int[] $size = 'post-thumbnail', string|array $attr = '' )
======================================================================================
Displays the post thumbnail.
When a theme adds ‘post-thumbnail’ support, a special ‘post-thumbnail’ image size is registered, which differs from the ‘thumbnail’ image size managed via the Settings > Media screen.
When using [the\_post\_thumbnail()](the_post_thumbnail) or related functions, the ‘post-thumbnail’ image size is used by default, though a different size can be specified instead as needed.
* [get\_the\_post\_thumbnail()](get_the_post_thumbnail)
`$size` string|int[] Optional Image size. Accepts any registered image size name, or an array of width and height values in pixels (in that order). Default `'post-thumbnail'`. Default: `'post-thumbnail'`
`$attr` string|array Optional Query string or array of attributes. Default: `''`
File: `wp-includes/post-thumbnail-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/post-thumbnail-template.php/)
```
function the_post_thumbnail( $size = 'post-thumbnail', $attr = '' ) {
echo get_the_post_thumbnail( null, $size, $attr );
}
```
| Uses | Description |
| --- | --- |
| [get\_the\_post\_thumbnail()](get_the_post_thumbnail) wp-includes/post-thumbnail-template.php | Retrieves the post thumbnail. |
| Version | Description |
| --- | --- |
| [2.9.0](https://developer.wordpress.org/reference/since/2.9.0/) | Introduced. |
wordpress wp_ob_end_flush_all() wp\_ob\_end\_flush\_all()
=========================
Flushes all output buffers for PHP 5.2.
Make sure all output buffers are flushed before our singletons are destroyed.
File: `wp-includes/functions.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/functions.php/)
```
function wp_ob_end_flush_all() {
$levels = ob_get_level();
for ( $i = 0; $i < $levels; $i++ ) {
ob_end_flush();
}
}
```
| Used By | Description |
| --- | --- |
| [Bulk\_Upgrader\_Skin::flush\_output()](../classes/bulk_upgrader_skin/flush_output) wp-admin/includes/class-bulk-upgrader-skin.php | |
| [show\_message()](show_message) wp-admin/includes/misc.php | Displays the given administration message. |
| [spawn\_cron()](spawn_cron) wp-includes/cron.php | Sends a request to run cron through HTTP request that doesn’t halt page loading. |
| Version | Description |
| --- | --- |
| [2.2.0](https://developer.wordpress.org/reference/since/2.2.0/) | Introduced. |
wordpress wp_exif_frac2dec( string $str ): int|float wp\_exif\_frac2dec( string $str ): int|float
============================================
Converts a fraction string to a decimal.
`$str` string Required Fraction string. int|float Returns calculated fraction or integer 0 on invalid input.
File: `wp-admin/includes/image.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/image.php/)
```
function wp_exif_frac2dec( $str ) {
if ( ! is_scalar( $str ) || is_bool( $str ) ) {
return 0;
}
if ( ! is_string( $str ) ) {
return $str; // This can only be an integer or float, so this is fine.
}
// Fractions passed as a string must contain a single `/`.
if ( substr_count( $str, '/' ) !== 1 ) {
if ( is_numeric( $str ) ) {
return (float) $str;
}
return 0;
}
list( $numerator, $denominator ) = explode( '/', $str );
// Both the numerator and the denominator must be numbers.
if ( ! is_numeric( $numerator ) || ! is_numeric( $denominator ) ) {
return 0;
}
// The denominator must not be zero.
if ( 0 == $denominator ) { // phpcs:ignore WordPress.PHP.StrictComparisons.LooseComparison -- Deliberate loose comparison.
return 0;
}
return $numerator / $denominator;
}
```
| Used By | Description |
| --- | --- |
| [wp\_read\_image\_metadata()](wp_read_image_metadata) wp-admin/includes/image.php | Gets extended image metadata, exif or iptc as available. |
| Version | Description |
| --- | --- |
| [2.5.0](https://developer.wordpress.org/reference/since/2.5.0/) | Introduced. |
wordpress get_user_meta( int $user_id, string $key = '', bool $single = false ): mixed get\_user\_meta( int $user\_id, string $key = '', bool $single = false ): mixed
===============================================================================
Retrieves user meta field for a user.
`$user_id` int Required User ID. `$key` string Optional The meta key to retrieve. By default, returns data for all keys. Default: `''`
`$single` bool Optional Whether to return a single value.
This parameter has no effect if `$key` is not specified.
Default: `false`
mixed An array of values if `$single` is false.
The value of meta data field if `$single` is true.
False for an invalid `$user_id` (non-numeric, zero, or negative value).
An empty string if a valid but non-existing user ID is passed.
Please note that if the meta value exists but is empty, it will return an empty string (or array) as if the meta value didn’t exist. This might cause unexpected behaviors in your code when you empty the user meta, your code can try to use add\_user\_meta instead of update\_user\_meta thinking the user does not have meta created yet.
File: `wp-includes/user.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/user.php/)
```
function get_user_meta( $user_id, $key = '', $single = false ) {
return get_metadata( 'user', $user_id, $key, $single );
}
```
| Uses | Description |
| --- | --- |
| [get\_metadata()](get_metadata) wp-includes/meta.php | Retrieves the value of a metadata field for the specified object type and ID. |
| Used By | Description |
| --- | --- |
| [WP\_Application\_Passwords::get\_user\_application\_passwords()](../classes/wp_application_passwords/get_user_application_passwords) wp-includes/class-wp-application-passwords.php | Gets a user’s application passwords. |
| [wp\_initialize\_site()](wp_initialize_site) wp-includes/ms-site.php | Runs the initialization routine for a given site. |
| [wp\_default\_packages\_inline\_scripts()](wp_default_packages_inline_scripts) wp-includes/script-loader.php | Adds inline scripts required for the WordPress JavaScript packages. |
| [the\_block\_editor\_meta\_boxes()](the_block_editor_meta_boxes) wp-admin/includes/post.php | Renders the meta boxes forms. |
| [register\_and\_do\_post\_meta\_boxes()](register_and_do_post_meta_boxes) wp-admin/includes/meta-boxes.php | Registers the default post meta boxes, and runs the `do_meta_boxes` actions. |
| [wp\_user\_personal\_data\_exporter()](wp_user_personal_data_exporter) wp-includes/user.php | Finds and exports personal data associated with an email address from the user and user\_meta table. |
| [WP\_User::get\_caps\_data()](../classes/wp_user/get_caps_data) wp-includes/class-wp-user.php | Gets the available user capabilities data. |
| [WP\_Widget\_Text::render\_control\_template\_scripts()](../classes/wp_widget_text/render_control_template_scripts) wp-includes/widgets/class-wp-widget-text.php | Render form template scripts. |
| [WP\_Screen::render\_meta\_boxes\_preferences()](../classes/wp_screen/render_meta_boxes_preferences) wp-admin/includes/class-wp-screen.php | Renders the meta boxes preferences. |
| [WP\_User\_Meta\_Session\_Tokens::get\_sessions()](../classes/wp_user_meta_session_tokens/get_sessions) wp-includes/class-wp-user-meta-session-tokens.php | Retrieves all sessions of the user. |
| [choose\_primary\_blog()](choose_primary_blog) wp-admin/includes/ms.php | Handles the display of choosing a user’s primary site. |
| [new\_user\_email\_admin\_notice()](new_user_email_admin_notice) wp-includes/user.php | Adds an admin notice alerting the user to check for confirmation request email after email address change. |
| [WP\_Internal\_Pointers::enqueue\_scripts()](../classes/wp_internal_pointers/enqueue_scripts) wp-admin/includes/class-wp-internal-pointers.php | Initializes the new feature pointers. |
| [wp\_ajax\_save\_user\_color\_scheme()](wp_ajax_save_user_color_scheme) wp-admin/includes/ajax-actions.php | Ajax handler for auto-saving the selected color scheme for a user’s own profile. |
| [wp\_ajax\_dismiss\_wp\_pointer()](wp_ajax_dismiss_wp_pointer) wp-admin/includes/ajax-actions.php | Ajax handler for dismissing a WordPress pointer. |
| [WP\_User::\_\_get()](../classes/wp_user/__get) wp-includes/class-wp-user.php | Magic method for accessing custom fields. |
| [wp\_update\_user()](wp_update_user) wp-includes/user.php | Updates a user in the database. |
| [get\_blogs\_of\_user()](get_blogs_of_user) wp-includes/user.php | Gets the sites a user belongs to. |
| [is\_user\_member\_of\_blog()](is_user_member_of_blog) wp-includes/user.php | Finds out whether a user is a member of a given blog. |
| [get\_active\_blog\_for\_user()](get_active_blog_for_user) wp-includes/ms-functions.php | Gets one of a user’s active blogs. |
| [add\_user\_to\_blog()](add_user_to_blog) wp-includes/ms-functions.php | Adds a user to a blog, along with specifying the user’s role. |
| [remove\_user\_from\_blog()](remove_user_from_blog) wp-includes/ms-functions.php | Removes a user from a blog. |
| Version | Description |
| --- | --- |
| [3.0.0](https://developer.wordpress.org/reference/since/3.0.0/) | Introduced. |
wordpress wp_unschedule_event( int $timestamp, string $hook, array $args = array(), bool $wp_error = false ): bool|WP_Error wp\_unschedule\_event( int $timestamp, string $hook, array $args = array(), bool $wp\_error = false ): bool|WP\_Error
=====================================================================================================================
Unschedule a previously scheduled event.
The $timestamp and $hook parameters are required so that the event can be identified.
`$timestamp` int Required Unix timestamp (UTC) of the event. `$hook` string Required Action hook of the event. `$args` array Optional Array containing each separate argument to pass to the hook's callback function.
Although not passed to a callback, these arguments are used to uniquely identify the event, so they should be the same as those used when originally scheduling the event.
Default: `array()`
`$wp_error` bool Optional Whether to return a [WP\_Error](../classes/wp_error) on failure. Default: `false`
bool|[WP\_Error](../classes/wp_error) True if event successfully unscheduled. False or [WP\_Error](../classes/wp_error) on failure.
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 unscheduled by calling this function.
File: `wp-includes/cron.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/cron.php/)
```
function wp_unschedule_event( $timestamp, $hook, $args = array(), $wp_error = false ) {
// Make sure timestamp is a positive integer.
if ( ! is_numeric( $timestamp ) || $timestamp <= 0 ) {
if ( $wp_error ) {
return new WP_Error(
'invalid_timestamp',
__( 'Event timestamp must be a valid Unix timestamp.' )
);
}
return false;
}
/**
* Filter to preflight or hijack unscheduling of events.
*
* Returning a non-null value will short-circuit the normal unscheduling
* process, causing the function to return the filtered value instead.
*
* For plugins replacing wp-cron, return true if the event was successfully
* unscheduled, false or a WP_Error if not.
*
* @since 5.1.0
* @since 5.7.0 The `$wp_error` parameter was added, and a `WP_Error` object can now be returned.
*
* @param null|bool|WP_Error $pre Value to return instead. Default null to continue unscheduling the event.
* @param int $timestamp Timestamp for when to run the event.
* @param string $hook Action hook, the execution of which will be unscheduled.
* @param array $args Arguments to pass to the hook's callback function.
* @param bool $wp_error Whether to return a WP_Error on failure.
*/
$pre = apply_filters( 'pre_unschedule_event', null, $timestamp, $hook, $args, $wp_error );
if ( null !== $pre ) {
if ( $wp_error && false === $pre ) {
return new WP_Error(
'pre_unschedule_event_false',
__( 'A plugin prevented the event from being unscheduled.' )
);
}
if ( ! $wp_error && is_wp_error( $pre ) ) {
return false;
}
return $pre;
}
$crons = _get_cron_array();
$key = md5( serialize( $args ) );
unset( $crons[ $timestamp ][ $hook ][ $key ] );
if ( empty( $crons[ $timestamp ][ $hook ] ) ) {
unset( $crons[ $timestamp ][ $hook ] );
}
if ( empty( $crons[ $timestamp ] ) ) {
unset( $crons[ $timestamp ] );
}
return _set_cron_array( $crons, $wp_error );
}
```
[apply\_filters( 'pre\_unschedule\_event', null|bool|WP\_Error $pre, int $timestamp, string $hook, array $args, bool $wp\_error )](../hooks/pre_unschedule_event)
Filter to preflight or hijack unscheduling of events.
| Uses | Description |
| --- | --- |
| [\_get\_cron\_array()](_get_cron_array) wp-includes/cron.php | Retrieve cron info array option. |
| [\_set\_cron\_array()](_set_cron_array) wp-includes/cron.php | Updates the cron option with the new cron array. |
| [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| [is\_wp\_error()](is_wp_error) wp-includes/load.php | Checks whether the given variable is a WordPress Error. |
| [WP\_Error::\_\_construct()](../classes/wp_error/__construct) wp-includes/class-wp-error.php | Initializes the error. |
| Used By | Description |
| --- | --- |
| [wp\_clear\_scheduled\_hook()](wp_clear_scheduled_hook) wp-includes/cron.php | Unschedules all events attached to the hook with the specified arguments. |
| Version | Description |
| --- | --- |
| [5.7.0](https://developer.wordpress.org/reference/since/5.7.0/) | The `$wp_error` parameter was added. |
| [5.1.0](https://developer.wordpress.org/reference/since/5.1.0/) | Return value modified to boolean indicating success or failure, ['pre\_unschedule\_event'](../hooks/pre_unschedule_event) filter added to short-circuit the function. |
| [2.1.0](https://developer.wordpress.org/reference/since/2.1.0/) | Introduced. |
wordpress wp_handle_upload( array $file, array|false $overrides = false, string $time = null ): array wp\_handle\_upload( array $file, array|false $overrides = false, string $time = null ): array
=============================================================================================
Wrapper for [\_wp\_handle\_upload()](_wp_handle_upload) .
Passes the [‘wp\_handle\_upload’](../hooks/wp_handle_upload) action.
* [\_wp\_handle\_upload()](_wp_handle_upload)
`$file` array Required Reference to a single element of `$_FILES`.
Call the function once for each uploaded file.
See [\_wp\_handle\_upload()](_wp_handle_upload) for accepted values. More Arguments from \_wp\_handle\_upload( ... $file ) Reference to a single element from `$_FILES`. Call the function once for each uploaded file.
* `name`stringThe original name of the file on the client machine.
* `type`stringThe mime type of the file, if the browser provided this information.
* `tmp_name`stringThe temporary filename of the file in which the uploaded file was stored on the server.
* `size`intThe size, in bytes, of the uploaded file.
* `error`intThe error code associated with this file upload.
`$overrides` array|false Optional An associative array of names => values to override default variables.
See [\_wp\_handle\_upload()](_wp_handle_upload) for accepted values. More Arguments from \_wp\_handle\_upload( ... $overrides ) An array of override parameters for this file, or boolean false if none are provided.
* `upload_error_handler`callableFunction to call when there is an error during the upload process.
@see [wp\_handle\_upload\_error()](wp_handle_upload_error) .
* `unique_filename_callback`callableFunction to call when determining a unique file name for the file.
@see [wp\_unique\_filename()](wp_unique_filename) .
* `upload_error_strings`string[]The strings that describe the error indicated in `$_FILES[{form field}]['error']`.
* `test_form`boolWhether to test that the `$_POST['action']` parameter is as expected.
* `test_size`boolWhether to test that the file size is greater than zero bytes.
* `test_type`boolWhether to test that the mime type of the file is as expected.
* `mimes`string[]Array of allowed mime types keyed by their file extension regex.
Default: `false`
`$time` string Optional Time formatted in `'yyyy/mm'`. Default: `null`
array See [\_wp\_handle\_upload()](_wp_handle_upload) for return value.
File: `wp-admin/includes/file.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/file.php/)
```
function wp_handle_upload( &$file, $overrides = false, $time = null ) {
/*
* $_POST['action'] must be set and its value must equal $overrides['action']
* or this:
*/
$action = 'wp_handle_upload';
if ( isset( $overrides['action'] ) ) {
$action = $overrides['action'];
}
return _wp_handle_upload( $file, $overrides, $time, $action );
}
```
| Uses | Description |
| --- | --- |
| [\_wp\_handle\_upload()](_wp_handle_upload) wp-admin/includes/file.php | Handles PHP uploads in WordPress. |
| Used By | Description |
| --- | --- |
| [WP\_REST\_Attachments\_Controller::upload\_from\_file()](../classes/wp_rest_attachments_controller/upload_from_file) wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php | Handles an upload via multipart/form-data ($\_FILES). |
| [File\_Upload\_Upgrader::\_\_construct()](../classes/file_upload_upgrader/__construct) wp-admin/includes/class-file-upload-upgrader.php | Construct the upgrader for a form. |
| [media\_handle\_upload()](media_handle_upload) wp-admin/includes/media.php | Saves a file submitted from a POST request and create an attachment post for it. |
| [wp\_import\_handle\_upload()](wp_import_handle_upload) wp-admin/includes/import.php | Handles importer uploading and adds attachment. |
| [Custom\_Image\_Header::step\_2\_manage\_upload()](../classes/custom_image_header/step_2_manage_upload) wp-admin/includes/class-custom-image-header.php | Upload the file to be cropped in the second step. |
| [Custom\_Background::handle\_upload()](../classes/custom_background/handle_upload) wp-admin/includes/class-custom-background.php | Handles an Image upload for the background image. |
| Version | Description |
| --- | --- |
| [2.0.0](https://developer.wordpress.org/reference/since/2.0.0/) | Introduced. |
wordpress get_block_editor_server_block_settings(): array get\_block\_editor\_server\_block\_settings(): array
====================================================
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.
array An associative array of registered block data.
File: `wp-admin/includes/post.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/post.php/)
```
function get_block_editor_server_block_settings() {
$block_registry = WP_Block_Type_Registry::get_instance();
$blocks = array();
$fields_to_pick = array(
'api_version' => 'apiVersion',
'title' => 'title',
'description' => 'description',
'icon' => 'icon',
'attributes' => 'attributes',
'provides_context' => 'providesContext',
'uses_context' => 'usesContext',
'supports' => 'supports',
'category' => 'category',
'styles' => 'styles',
'textdomain' => 'textdomain',
'parent' => 'parent',
'ancestor' => 'ancestor',
'keywords' => 'keywords',
'example' => 'example',
'variations' => 'variations',
);
foreach ( $block_registry->get_all_registered() as $block_name => $block_type ) {
foreach ( $fields_to_pick as $field => $key ) {
if ( ! isset( $block_type->{ $field } ) ) {
continue;
}
if ( ! isset( $blocks[ $block_name ] ) ) {
$blocks[ $block_name ] = array();
}
$blocks[ $block_name ][ $key ] = $block_type->{ $field };
}
}
return $blocks;
}
```
| Uses | Description |
| --- | --- |
| [WP\_Block\_Type\_Registry::get\_instance()](../classes/wp_block_type_registry/get_instance) wp-includes/class-wp-block-type-registry.php | Utility method to retrieve the main instance of the class. |
| Used By | Description |
| --- | --- |
| [WP\_Customize\_Widgets::enqueue\_scripts()](../classes/wp_customize_widgets/enqueue_scripts) wp-includes/class-wp-customize-widgets.php | Enqueues scripts and styles for Customizer panel and export data to JavaScript. |
| Version | Description |
| --- | --- |
| [5.0.0](https://developer.wordpress.org/reference/since/5.0.0/) | Introduced. |
| programming_docs |
wordpress wp_replace_insecure_home_url( string $content ): string wp\_replace\_insecure\_home\_url( string $content ): string
===========================================================
Replaces insecure HTTP URLs to the site in the given content, if configured to do so.
This function replaces all occurrences of the HTTP version of the site’s URL with its HTTPS counterpart, if determined via [wp\_should\_replace\_insecure\_home\_url()](wp_should_replace_insecure_home_url) .
`$content` string Required Content to replace URLs in. string Filtered content.
File: `wp-includes/https-migration.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/https-migration.php/)
```
function wp_replace_insecure_home_url( $content ) {
if ( ! wp_should_replace_insecure_home_url() ) {
return $content;
}
$https_url = home_url( '', 'https' );
$http_url = str_replace( 'https://', 'http://', $https_url );
// Also replace potentially escaped URL.
$escaped_https_url = str_replace( '/', '\/', $https_url );
$escaped_http_url = str_replace( '/', '\/', $http_url );
return str_replace(
array(
$http_url,
$escaped_http_url,
),
array(
$https_url,
$escaped_https_url,
),
$content
);
}
```
| Uses | Description |
| --- | --- |
| [wp\_should\_replace\_insecure\_home\_url()](wp_should_replace_insecure_home_url) wp-includes/https-migration.php | Checks whether WordPress should replace old HTTP URLs to the site with their HTTPS counterpart. |
| [home\_url()](home_url) wp-includes/link-template.php | Retrieves the URL for the current site where the front end is accessible. |
| Version | Description |
| --- | --- |
| [5.7.0](https://developer.wordpress.org/reference/since/5.7.0/) | Introduced. |
wordpress wp_get_http( string $url, string|bool $file_path = false, int $red = 1 ): Requests_Utility_CaseInsensitiveDictionary|false wp\_get\_http( string $url, string|bool $file\_path = false, int $red = 1 ): Requests\_Utility\_CaseInsensitiveDictionary|false
===============================================================================================================================
This function has been deprecated. Use [WP\_Http](../classes/wp_http)() instead.
Perform a HTTP HEAD or GET request.
If $file\_path is a writable filename, this will do a GET request and write the file to that path.
* [WP\_Http](../classes/wp_http)
`$url` string Required URL to fetch. `$file_path` string|bool Optional File path to write request to. Default: `false`
`$red` int Optional The number of Redirects followed, Upon 5 being hit, returns false. Default: `1`
[Requests\_Utility\_CaseInsensitiveDictionary](../classes/requests_utility_caseinsensitivedictionary)|false Headers on success, false on failure.
File: `wp-includes/deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/deprecated.php/)
```
function wp_get_http( $url, $file_path = false, $red = 1 ) {
_deprecated_function( __FUNCTION__, '4.4.0', 'WP_Http' );
@set_time_limit( 60 );
if ( $red > 5 )
return false;
$options = array();
$options['redirection'] = 5;
if ( false == $file_path )
$options['method'] = 'HEAD';
else
$options['method'] = 'GET';
$response = wp_safe_remote_request( $url, $options );
if ( is_wp_error( $response ) )
return false;
$headers = wp_remote_retrieve_headers( $response );
$headers['response'] = wp_remote_retrieve_response_code( $response );
// WP_HTTP no longer follows redirects for HEAD requests.
if ( 'HEAD' == $options['method'] && in_array($headers['response'], array(301, 302)) && isset( $headers['location'] ) ) {
return wp_get_http( $headers['location'], $file_path, ++$red );
}
if ( false == $file_path )
return $headers;
// GET request - write it to the supplied filename.
$out_fp = fopen($file_path, 'w');
if ( !$out_fp )
return $headers;
fwrite( $out_fp, wp_remote_retrieve_body( $response ) );
fclose($out_fp);
clearstatcache();
return $headers;
}
```
| Uses | Description |
| --- | --- |
| [wp\_get\_http()](wp_get_http) wp-includes/deprecated.php | Perform a HTTP HEAD or GET request. |
| [wp\_safe\_remote\_request()](wp_safe_remote_request) wp-includes/http.php | Retrieve the raw response from a safe HTTP request. |
| [wp\_remote\_retrieve\_headers()](wp_remote_retrieve_headers) wp-includes/http.php | Retrieve only the headers from the raw response. |
| [wp\_remote\_retrieve\_response\_code()](wp_remote_retrieve_response_code) wp-includes/http.php | Retrieve only the response code from the raw response. |
| [wp\_remote\_retrieve\_body()](wp_remote_retrieve_body) wp-includes/http.php | Retrieve only the body from the raw response. |
| [\_deprecated\_function()](_deprecated_function) wp-includes/functions.php | Marks a function as deprecated and inform when it has been used. |
| [is\_wp\_error()](is_wp_error) wp-includes/load.php | Checks whether the given variable is a WordPress Error. |
| Used By | Description |
| --- | --- |
| [wp\_get\_http()](wp_get_http) wp-includes/deprecated.php | Perform a HTTP HEAD or GET request. |
| Version | Description |
| --- | --- |
| [4.4.0](https://developer.wordpress.org/reference/since/4.4.0/) | Use [WP\_Http](../classes/wp_http) |
| [2.5.0](https://developer.wordpress.org/reference/since/2.5.0/) | Introduced. |
wordpress unregister_meta_key( string $object_type, string $meta_key, string $object_subtype = '' ): bool unregister\_meta\_key( string $object\_type, string $meta\_key, string $object\_subtype = '' ): bool
====================================================================================================
Unregisters a meta key from the list of registered keys.
`$object_type` string Required Type of object metadata is for. Accepts `'post'`, `'comment'`, `'term'`, `'user'`, or any other object type with an associated meta table. `$meta_key` string Required Metadata key. `$object_subtype` string Optional The subtype of the object type. Default: `''`
bool True if successful. False if the meta key was not registered.
File: `wp-includes/meta.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/meta.php/)
```
function unregister_meta_key( $object_type, $meta_key, $object_subtype = '' ) {
global $wp_meta_keys;
if ( ! registered_meta_key_exists( $object_type, $meta_key, $object_subtype ) ) {
return false;
}
$args = $wp_meta_keys[ $object_type ][ $object_subtype ][ $meta_key ];
if ( isset( $args['sanitize_callback'] ) && is_callable( $args['sanitize_callback'] ) ) {
if ( ! empty( $object_subtype ) ) {
remove_filter( "sanitize_{$object_type}_meta_{$meta_key}_for_{$object_subtype}", $args['sanitize_callback'] );
} else {
remove_filter( "sanitize_{$object_type}_meta_{$meta_key}", $args['sanitize_callback'] );
}
}
if ( isset( $args['auth_callback'] ) && is_callable( $args['auth_callback'] ) ) {
if ( ! empty( $object_subtype ) ) {
remove_filter( "auth_{$object_type}_meta_{$meta_key}_for_{$object_subtype}", $args['auth_callback'] );
} else {
remove_filter( "auth_{$object_type}_meta_{$meta_key}", $args['auth_callback'] );
}
}
unset( $wp_meta_keys[ $object_type ][ $object_subtype ][ $meta_key ] );
// Do some clean up.
if ( empty( $wp_meta_keys[ $object_type ][ $object_subtype ] ) ) {
unset( $wp_meta_keys[ $object_type ][ $object_subtype ] );
}
if ( empty( $wp_meta_keys[ $object_type ] ) ) {
unset( $wp_meta_keys[ $object_type ] );
}
return true;
}
```
| Uses | Description |
| --- | --- |
| [registered\_meta\_key\_exists()](registered_meta_key_exists) wp-includes/meta.php | Checks if a meta key is registered. |
| [remove\_filter()](remove_filter) wp-includes/plugin.php | Removes a callback function from a filter hook. |
| Used By | Description |
| --- | --- |
| [unregister\_term\_meta()](unregister_term_meta) wp-includes/taxonomy.php | Unregisters a meta key for terms. |
| [unregister\_post\_meta()](unregister_post_meta) wp-includes/post.php | Unregisters a meta key for posts. |
| Version | Description |
| --- | --- |
| [4.9.8](https://developer.wordpress.org/reference/since/4.9.8/) | The `$object_subtype` parameter was added. |
| [4.6.0](https://developer.wordpress.org/reference/since/4.6.0/) | Introduced. |
wordpress update_post_meta( int $post_id, string $meta_key, mixed $meta_value, mixed $prev_value = '' ): int|bool update\_post\_meta( int $post\_id, string $meta\_key, mixed $meta\_value, mixed $prev\_value = '' ): int|bool
=============================================================================================================
Updates a post meta field based on the given 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 and its ID returned.
Can be used in place of [add\_post\_meta()](add_post_meta) .
`$post_id` int Required Post ID. `$meta_key` string Required Metadata key. `$meta_value` mixed Required Metadata value. Must be serializable if non-scalar. `$prev_value` mixed Optional Previous value to check before updating.
If specified, only update existing metadata entries with this value. Otherwise, update all entries. Default: `''`
int|bool Meta ID if the key didn't exist, true on successful update, false on failure or if the value passed to the function is the same as the one that is already in the database.
Post meta values are passed through the stripslashes() function upon being stored, so you will need to be careful when passing in values (such as JSON) that might include \ escaped characters.
Consider the JSON value `{"key":"value with \"escaped quotes\""}`
```
<?php
$escaped_json = '{"key":"value with \\"escaped quotes\\""}';
update_post_meta( $id, 'escaped_json', $escaped_json );
$broken = get_post_meta( $id, 'escaped_json', true );
/*
$broken, after passing through stripslashes() ends up unparsable:
{"key":"value with "escaped quotes""}
*/
?>
```
By adding one more level of \ escaping using function `wp_slash` (introduced in WP 3.6), you can compensate for the call to stripslashes()
```
<?php
$escaped_json = '{"key":"value with \\"escaped quotes\\""}';
update_post_meta( $id, 'double_escaped_json', wp_slash( $escaped_json ) );
$fixed = get_post_meta( $id, 'double_escaped_json', true );
/*
$fixed, after stripslashes(), ends up being stored as desired:
{"key":"value with \"escaped quotes\""}
*/
?>
```
File: `wp-includes/post.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/post.php/)
```
function update_post_meta( $post_id, $meta_key, $meta_value, $prev_value = '' ) {
// Make sure meta is updated for the post, not for a revision.
$the_post = wp_is_post_revision( $post_id );
if ( $the_post ) {
$post_id = $the_post;
}
return update_metadata( 'post', $post_id, $meta_key, $meta_value, $prev_value );
}
```
| Uses | Description |
| --- | --- |
| [wp\_is\_post\_revision()](wp_is_post_revision) wp-includes/revision.php | Determines if the specified post is a revision. |
| [update\_metadata()](update_metadata) wp-includes/meta.php | Updates metadata for the specified object. If no value already exists for the specified object ID and metadata key, the metadata will be added. |
| Used By | Description |
| --- | --- |
| [WP\_REST\_Attachments\_Controller::edit\_media\_item()](../classes/wp_rest_attachments_controller/edit_media_item) wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php | Applies edits to a media item and creates a new attachment record. |
| [\_wp\_privacy\_account\_request\_confirmed()](_wp_privacy_account_request_confirmed) wp-includes/user.php | Updates log when privacy request is confirmed. |
| [\_wp\_privacy\_send\_request\_confirmation\_notification()](_wp_privacy_send_request_confirmation_notification) wp-includes/user.php | Notifies the site administrator via email when a request is confirmed. |
| [\_wp\_privacy\_send\_erasure\_fulfillment\_notification()](_wp_privacy_send_erasure_fulfillment_notification) wp-includes/user.php | Notifies the user when their erasure request is fulfilled. |
| [wp\_privacy\_process\_personal\_data\_export\_page()](wp_privacy_process_personal_data_export_page) wp-admin/includes/privacy-tools.php | Intercept personal data exporter page Ajax responses in order to assemble the personal data export file. |
| [wp\_privacy\_generate\_personal\_data\_export\_file()](wp_privacy_generate_personal_data_export_file) wp-admin/includes/privacy-tools.php | Generate the personal data export file. |
| [\_wp\_privacy\_completed\_request()](_wp_privacy_completed_request) wp-admin/includes/privacy-tools.php | Marks a request as completed by the admin and logs the current timestamp. |
| [WP\_Customize\_Manager::set\_changeset\_lock()](../classes/wp_customize_manager/set_changeset_lock) wp-includes/class-wp-customize-manager.php | Marks the changeset post as being currently edited by the current user. |
| [WP\_Customize\_Manager::refresh\_changeset\_lock()](../classes/wp_customize_manager/refresh_changeset_lock) wp-includes/class-wp-customize-manager.php | Refreshes changeset lock with the current time if current user edited the changeset before. |
| [WP\_Customize\_Manager::dismiss\_user\_auto\_draft\_changesets()](../classes/wp_customize_manager/dismiss_user_auto_draft_changesets) wp-includes/class-wp-customize-manager.php | Dismisses all of the current user’s auto-drafts (other than the present one). |
| [WP\_Customize\_Manager::import\_theme\_starter\_content()](../classes/wp_customize_manager/import_theme_starter_content) wp-includes/class-wp-customize-manager.php | Imports theme starter content into the customized state. |
| [WP\_REST\_Attachments\_Controller::create\_item()](../classes/wp_rest_attachments_controller/create_item) wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php | Creates a single attachment. |
| [WP\_REST\_Attachments\_Controller::update\_item()](../classes/wp_rest_attachments_controller/update_item) wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php | Updates a single attachment. |
| [WP\_REST\_Posts\_Controller::handle\_template()](../classes/wp_rest_posts_controller/handle_template) wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php | Sets the template for a post. |
| [Custom\_Background::ajax\_background\_add()](../classes/custom_background/ajax_background_add) wp-admin/includes/class-custom-background.php | Handles Ajax request for adding custom background context to an attachment. |
| [wp\_restore\_image()](wp_restore_image) wp-admin/includes/image-edit.php | Restores the metadata for a given attachment. |
| [wp\_save\_image()](wp_save_image) wp-admin/includes/image-edit.php | Saves image to post, along with enqueued changes in `$_REQUEST['history']`. |
| [wp\_generate\_attachment\_metadata()](wp_generate_attachment_metadata) wp-admin/includes/image.php | Generates attachment meta data and create image sub-sizes for images. |
| [media\_upload\_form\_handler()](media_upload_form_handler) wp-admin/includes/media.php | Handles form submissions for the legacy media uploader. |
| [wp\_set\_post\_lock()](wp_set_post_lock) wp-admin/includes/post.php | Marks the post as currently being edited by the current user. |
| [edit\_post()](edit_post) wp-admin/includes/post.php | Updates an existing post with values provided in `$_POST`. |
| [bulk\_edit\_posts()](bulk_edit_posts) wp-admin/includes/post.php | Processes the post data for the bulk editing of posts. |
| [wp\_ajax\_upload\_attachment()](wp_ajax_upload_attachment) wp-admin/includes/ajax-actions.php | Ajax handler for uploading attachments |
| [wp\_ajax\_wp\_remove\_post\_lock()](wp_ajax_wp_remove_post_lock) wp-admin/includes/ajax-actions.php | Ajax handler for removing a post lock. |
| [wp\_ajax\_save\_attachment()](wp_ajax_save_attachment) wp-admin/includes/ajax-actions.php | Ajax handler for updating attachment attributes. |
| [Custom\_Image\_Header::ajax\_header\_add()](../classes/custom_image_header/ajax_header_add) wp-admin/includes/class-custom-image-header.php | Given an attachment ID for a header image, updates its “last used” timestamp to now. |
| [Custom\_Image\_Header::customize\_set\_last\_used()](../classes/custom_image_header/customize_set_last_used) wp-admin/includes/class-custom-image-header.php | Updates the last-used postmeta on a header image attachment after saving a new header image via the Customizer. |
| [Custom\_Image\_Header::set\_header\_image()](../classes/custom_image_header/set_header_image) wp-admin/includes/class-custom-image-header.php | Choose a header image, selected from existing uploaded and default headers, or provide an array of uploaded header data (either new, or from media library). |
| [Custom\_Background::wp\_set\_background\_image()](../classes/custom_background/wp_set_background_image) wp-admin/includes/class-custom-background.php | |
| [Custom\_Background::handle\_upload()](../classes/custom_background/handle_upload) wp-admin/includes/class-custom-background.php | Handles an Image upload for the background image. |
| [WP\_Embed::shortcode()](../classes/wp_embed/shortcode) wp-includes/class-wp-embed.php | The [do\_shortcode()](do_shortcode) callback function. |
| [set\_post\_thumbnail()](set_post_thumbnail) wp-includes/post.php | Sets the post thumbnail (featured image) for the given post. |
| [wp\_update\_attachment\_metadata()](wp_update_attachment_metadata) wp-includes/post.php | Updates metadata for an attachment. |
| [wp\_insert\_post()](wp_insert_post) wp-includes/post.php | Inserts or update a post. |
| [update\_attached\_file()](update_attached_file) wp-includes/post.php | Updates attachment file path based on attachment ID. |
| [wp\_restore\_post\_revision()](wp_restore_post_revision) wp-includes/revision.php | Restores a post to the specified revision. |
| [wp\_update\_nav\_menu\_item()](wp_update_nav_menu_item) wp-includes/nav-menu.php | Saves the properties of a menu item or create a new one. |
| Version | Description |
| --- | --- |
| [1.5.0](https://developer.wordpress.org/reference/since/1.5.0/) | Introduced. |
wordpress wp_register_development_scripts( WP_Scripts $scripts ) wp\_register\_development\_scripts( WP\_Scripts $scripts )
==========================================================
Registers development scripts that integrate with `@wordpress/scripts`.
* <https://github.com/WordPress/gutenberg/tree/trunk/packages/scripts#start>
`$scripts` [WP\_Scripts](../classes/wp_scripts) Required [WP\_Scripts](../classes/wp_scripts) object. File: `wp-includes/script-loader.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/script-loader.php/)
```
function wp_register_development_scripts( $scripts ) {
if (
! defined( 'SCRIPT_DEBUG' ) || ! SCRIPT_DEBUG
|| empty( $scripts->registered['react'] )
|| defined( 'WP_RUN_CORE_TESTS' )
) {
return;
}
$development_scripts = array(
'react-refresh-entry',
'react-refresh-runtime',
);
foreach ( $development_scripts as $script_name ) {
$assets = include ABSPATH . WPINC . '/assets/script-loader-' . $script_name . '.php';
if ( ! is_array( $assets ) ) {
return;
}
$scripts->add(
'wp-' . $script_name,
'/wp-includes/js/dist/development/' . $script_name . '.js',
$assets['dependencies'],
$assets['version']
);
}
// See https://github.com/pmmmwh/react-refresh-webpack-plugin/blob/main/docs/TROUBLESHOOTING.md#externalising-react.
$scripts->registered['react']->deps[] = 'wp-react-refresh-entry';
}
```
| Used By | Description |
| --- | --- |
| [wp\_default\_packages()](wp_default_packages) wp-includes/script-loader.php | Registers all the WordPress packages scripts. |
| Version | Description |
| --- | --- |
| [6.0.0](https://developer.wordpress.org/reference/since/6.0.0/) | Introduced. |
| programming_docs |
wordpress update_post_caches( WP_Post[] $posts, string $post_type = 'post', bool $update_term_cache = true, bool $update_meta_cache = true ) update\_post\_caches( WP\_Post[] $posts, string $post\_type = 'post', bool $update\_term\_cache = true, bool $update\_meta\_cache = true )
==========================================================================================================================================
Updates post, term, and metadata caches for a list of post objects.
`$posts` [WP\_Post](../classes/wp_post)[] Required Array of post objects (passed by reference). `$post_type` string Optional Post type. Default `'post'`. Default: `'post'`
`$update_term_cache` bool Optional Whether to update the term cache. Default: `true`
`$update_meta_cache` bool Optional Whether to update the meta cache. Default: `true`
`update_post_caches( $posts, $post_type, $update_term_cache, $update_meta_cache );`
File: `wp-includes/post.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/post.php/)
```
function update_post_caches( &$posts, $post_type = 'post', $update_term_cache = true, $update_meta_cache = true ) {
// No point in doing all this work if we didn't match any posts.
if ( ! $posts ) {
return;
}
update_post_cache( $posts );
$post_ids = array();
foreach ( $posts as $post ) {
$post_ids[] = $post->ID;
}
if ( ! $post_type ) {
$post_type = 'any';
}
if ( $update_term_cache ) {
if ( is_array( $post_type ) ) {
$ptypes = $post_type;
} elseif ( 'any' === $post_type ) {
$ptypes = array();
// Just use the post_types in the supplied posts.
foreach ( $posts as $post ) {
$ptypes[] = $post->post_type;
}
$ptypes = array_unique( $ptypes );
} else {
$ptypes = array( $post_type );
}
if ( ! empty( $ptypes ) ) {
update_object_term_cache( $post_ids, $ptypes );
}
}
if ( $update_meta_cache ) {
update_postmeta_cache( $post_ids );
}
}
```
| Uses | Description |
| --- | --- |
| [update\_object\_term\_cache()](update_object_term_cache) wp-includes/taxonomy.php | Updates the cache for the given term object ID(s). |
| [update\_postmeta\_cache()](update_postmeta_cache) wp-includes/post.php | Updates metadata cache for a list of post IDs. |
| [update\_post\_cache()](update_post_cache) wp-includes/post.php | Updates posts in cache. |
| Used By | Description |
| --- | --- |
| [\_prime\_post\_caches()](_prime_post_caches) wp-includes/post.php | Adds any posts from the given IDs to the cache that do not already exist in cache. |
| Version | Description |
| --- | --- |
| [1.5.0](https://developer.wordpress.org/reference/since/1.5.0/) | Introduced. |
wordpress load_theme_textdomain( string $domain, string|false $path = false ): bool load\_theme\_textdomain( string $domain, string|false $path = false ): bool
===========================================================================
Loads the theme’s translated strings.
If the current locale exists as a .mo file in the theme’s root directory, it will be included in the translated strings by the $domain.
The .mo files must be named based on the locale exactly.
`$domain` string Required Text domain. Unique identifier for retrieving translated strings. `$path` string|false Optional Path to the directory containing the .mo file.
Default: `false`
bool True when textdomain is successfully loaded, false otherwise.
File: `wp-includes/l10n.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/l10n.php/)
```
function load_theme_textdomain( $domain, $path = false ) {
/** @var WP_Textdomain_Registry $wp_textdomain_registry */
global $wp_textdomain_registry;
/**
* Filters a theme's locale.
*
* @since 3.0.0
*
* @param string $locale The theme's current locale.
* @param string $domain Text domain. Unique identifier for retrieving translated strings.
*/
$locale = apply_filters( 'theme_locale', determine_locale(), $domain );
$mofile = $domain . '-' . $locale . '.mo';
// Try to load from the languages directory first.
if ( load_textdomain( $domain, WP_LANG_DIR . '/themes/' . $mofile, $locale ) ) {
return true;
}
if ( ! $path ) {
$path = get_template_directory();
}
$wp_textdomain_registry->set_custom_path( $domain, $path );
return load_textdomain( $domain, $path . '/' . $locale . '.mo', $locale );
}
```
[apply\_filters( 'theme\_locale', string $locale, string $domain )](../hooks/theme_locale)
Filters a theme’s locale.
| Uses | Description |
| --- | --- |
| [WP\_Textdomain\_Registry::set\_custom\_path()](../classes/wp_textdomain_registry/set_custom_path) wp-includes/class-wp-textdomain-registry.php | Sets the custom path to the plugin’s/theme’s languages directory. |
| [determine\_locale()](determine_locale) wp-includes/l10n.php | Determines the current locale desired for the request. |
| [get\_template\_directory()](get_template_directory) wp-includes/theme.php | Retrieves template directory path for the active theme. |
| [load\_textdomain()](load_textdomain) wp-includes/l10n.php | Loads a .mo file into the text domain $domain. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| Used By | Description |
| --- | --- |
| [load\_child\_theme\_textdomain()](load_child_theme_textdomain) wp-includes/l10n.php | Loads the child themes translated strings. |
| [WP\_Theme::load\_textdomain()](../classes/wp_theme/load_textdomain) wp-includes/class-wp-theme.php | Loads the theme’s textdomain. |
| Version | Description |
| --- | --- |
| [4.6.0](https://developer.wordpress.org/reference/since/4.6.0/) | The function now tries to load the .mo file from the languages directory first. |
| [1.5.0](https://developer.wordpress.org/reference/since/1.5.0/) | Introduced. |
wordpress get_mu_plugins(): array[] get\_mu\_plugins(): array[]
===========================
Checks the mu-plugins directory and retrieve all mu-plugin files with any plugin data.
WordPress only includes mu-plugin files in the base mu-plugins directory (wp-content/mu-plugins).
array[] Array of arrays of mu-plugin data, keyed by plugin file name. See [get\_plugin\_data()](get_plugin_data) .
File: `wp-admin/includes/plugin.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/plugin.php/)
```
function get_mu_plugins() {
$wp_plugins = array();
$plugin_files = array();
if ( ! is_dir( WPMU_PLUGIN_DIR ) ) {
return $wp_plugins;
}
// Files in wp-content/mu-plugins directory.
$plugins_dir = @opendir( WPMU_PLUGIN_DIR );
if ( $plugins_dir ) {
while ( ( $file = readdir( $plugins_dir ) ) !== false ) {
if ( '.php' === substr( $file, -4 ) ) {
$plugin_files[] = $file;
}
}
} else {
return $wp_plugins;
}
closedir( $plugins_dir );
if ( empty( $plugin_files ) ) {
return $wp_plugins;
}
foreach ( $plugin_files as $plugin_file ) {
if ( ! is_readable( WPMU_PLUGIN_DIR . "/$plugin_file" ) ) {
continue;
}
// Do not apply markup/translate as it will be cached.
$plugin_data = get_plugin_data( WPMU_PLUGIN_DIR . "/$plugin_file", false, false );
if ( empty( $plugin_data['Name'] ) ) {
$plugin_data['Name'] = $plugin_file;
}
$wp_plugins[ $plugin_file ] = $plugin_data;
}
if ( isset( $wp_plugins['index.php'] ) && filesize( WPMU_PLUGIN_DIR . '/index.php' ) <= 30 ) {
// Silence is golden.
unset( $wp_plugins['index.php'] );
}
uasort( $wp_plugins, '_sort_uname_callback' );
return $wp_plugins;
}
```
| Uses | Description |
| --- | --- |
| [get\_plugin\_data()](get_plugin_data) wp-admin/includes/plugin.php | Parses the plugin contents to retrieve plugin’s metadata. |
| Used By | Description |
| --- | --- |
| [WP\_Debug\_Data::debug\_data()](../classes/wp_debug_data/debug_data) wp-admin/includes/class-wp-debug-data.php | Static function for generating site debug data when required. |
| [WP\_Plugins\_List\_Table::prepare\_items()](../classes/wp_plugins_list_table/prepare_items) wp-admin/includes/class-wp-plugins-list-table.php | |
| Version | Description |
| --- | --- |
| [3.0.0](https://developer.wordpress.org/reference/since/3.0.0/) | Introduced. |
wordpress shortcode_atts( array $pairs, array $atts, string $shortcode = '' ): array shortcode\_atts( array $pairs, array $atts, string $shortcode = '' ): array
===========================================================================
Combines user attributes with known attributes and fill in defaults when needed.
The pairs should be considered to be all of the attributes which are supported by the caller and given as a list. The returned attributes will only contain the attributes in the $pairs list.
If the $atts list has unsupported attributes, then they will be ignored and removed from the final returned list.
`$pairs` array Required Entire list of supported attributes and their defaults. `$atts` array Required User defined attributes in shortcode tag. `$shortcode` string Optional The name of the shortcode, provided for context to enable filtering Default: `''`
array Combined and filtered attribute list.
File: `wp-includes/shortcodes.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/shortcodes.php/)
```
function shortcode_atts( $pairs, $atts, $shortcode = '' ) {
$atts = (array) $atts;
$out = array();
foreach ( $pairs as $name => $default ) {
if ( array_key_exists( $name, $atts ) ) {
$out[ $name ] = $atts[ $name ];
} else {
$out[ $name ] = $default;
}
}
if ( $shortcode ) {
/**
* Filters shortcode attributes.
*
* If the third parameter of the shortcode_atts() function is present then this filter is available.
* The third parameter, $shortcode, is the name of the shortcode.
*
* @since 3.6.0
* @since 4.4.0 Added the `$shortcode` parameter.
*
* @param array $out The output array of shortcode attributes.
* @param array $pairs The supported attributes and their defaults.
* @param array $atts The user defined shortcode attributes.
* @param string $shortcode The shortcode name.
*/
$out = apply_filters( "shortcode_atts_{$shortcode}", $out, $pairs, $atts, $shortcode );
}
return $out;
}
```
[apply\_filters( "shortcode\_atts\_{$shortcode}", array $out, array $pairs, array $atts, string $shortcode )](../hooks/shortcode_atts_shortcode)
Filters shortcode attributes.
| Uses | Description |
| --- | --- |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| Used By | Description |
| --- | --- |
| [wp\_video\_shortcode()](wp_video_shortcode) wp-includes/media.php | Builds the Video shortcode output. |
| [gallery\_shortcode()](gallery_shortcode) wp-includes/media.php | Builds the Gallery shortcode output. |
| [wp\_playlist\_shortcode()](wp_playlist_shortcode) wp-includes/media.php | Builds the Playlist shortcode output. |
| [wp\_audio\_shortcode()](wp_audio_shortcode) wp-includes/media.php | Builds the Audio shortcode output. |
| [img\_caption\_shortcode()](img_caption_shortcode) wp-includes/media.php | Builds the Caption shortcode output. |
| Version | Description |
| --- | --- |
| [2.5.0](https://developer.wordpress.org/reference/since/2.5.0/) | Introduced. |
wordpress wp_get_nocache_headers(): array wp\_get\_nocache\_headers(): array
==================================
Gets the header information to prevent caching.
The several different headers cover the different ways cache prevention is handled by different browsers
array The associative array of header names and field values.
File: `wp-includes/functions.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/functions.php/)
```
function wp_get_nocache_headers() {
$headers = array(
'Expires' => 'Wed, 11 Jan 1984 05:00:00 GMT',
'Cache-Control' => 'no-cache, must-revalidate, max-age=0',
);
if ( function_exists( 'apply_filters' ) ) {
/**
* Filters the cache-controlling headers.
*
* @since 2.8.0
*
* @see wp_get_nocache_headers()
*
* @param array $headers Header names and field values.
*/
$headers = (array) apply_filters( 'nocache_headers', $headers );
}
$headers['Last-Modified'] = false;
return $headers;
}
```
[apply\_filters( 'nocache\_headers', array $headers )](../hooks/nocache_headers)
Filters the cache-controlling headers.
| Uses | Description |
| --- | --- |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| Used By | Description |
| --- | --- |
| [WP\_REST\_Server::serve\_request()](../classes/wp_rest_server/serve_request) wp-includes/rest-api/class-wp-rest-server.php | Handles serving a REST API request. |
| [WP::send\_headers()](../classes/wp/send_headers) wp-includes/class-wp.php | Sends additional HTTP headers for caching, content type, etc. |
| [nocache\_headers()](nocache_headers) wp-includes/functions.php | Sets the headers to prevent caching for the different browsers. |
| Version | Description |
| --- | --- |
| [2.8.0](https://developer.wordpress.org/reference/since/2.8.0/) | Introduced. |
wordpress get_compat_media_markup( int $attachment_id, array $args = null ): array get\_compat\_media\_markup( int $attachment\_id, array $args = null ): array
============================================================================
`$attachment_id` int Required `$args` array Optional Default: `null`
array
File: `wp-admin/includes/media.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/media.php/)
```
function get_compat_media_markup( $attachment_id, $args = null ) {
$post = get_post( $attachment_id );
$default_args = array(
'errors' => null,
'in_modal' => false,
);
$user_can_edit = current_user_can( 'edit_post', $attachment_id );
$args = wp_parse_args( $args, $default_args );
/** This filter is documented in wp-admin/includes/media.php */
$args = apply_filters( 'get_media_item_args', $args );
$form_fields = array();
if ( $args['in_modal'] ) {
foreach ( get_attachment_taxonomies( $post ) as $taxonomy ) {
$t = (array) get_taxonomy( $taxonomy );
if ( ! $t['public'] || ! $t['show_ui'] ) {
continue;
}
if ( empty( $t['label'] ) ) {
$t['label'] = $taxonomy;
}
if ( empty( $t['args'] ) ) {
$t['args'] = array();
}
$terms = get_object_term_cache( $post->ID, $taxonomy );
if ( false === $terms ) {
$terms = wp_get_object_terms( $post->ID, $taxonomy, $t['args'] );
}
$values = array();
foreach ( $terms as $term ) {
$values[] = $term->slug;
}
$t['value'] = implode( ', ', $values );
$t['taxonomy'] = true;
$form_fields[ $taxonomy ] = $t;
}
}
/*
* Merge default fields with their errors, so any key passed with the error
* (e.g. 'error', 'helps', 'value') will replace the default.
* The recursive merge is easily traversed with array casting:
* foreach ( (array) $things as $thing )
*/
$form_fields = array_merge_recursive( $form_fields, (array) $args['errors'] );
/** This filter is documented in wp-admin/includes/media.php */
$form_fields = apply_filters( 'attachment_fields_to_edit', $form_fields, $post );
unset(
$form_fields['image-size'],
$form_fields['align'],
$form_fields['image_alt'],
$form_fields['post_title'],
$form_fields['post_excerpt'],
$form_fields['post_content'],
$form_fields['url'],
$form_fields['menu_order'],
$form_fields['image_url']
);
/** This filter is documented in wp-admin/includes/media.php */
$media_meta = apply_filters( 'media_meta', '', $post );
$defaults = array(
'input' => 'text',
'required' => false,
'value' => '',
'extra_rows' => array(),
'show_in_edit' => true,
'show_in_modal' => true,
);
$hidden_fields = array();
$item = '';
foreach ( $form_fields as $id => $field ) {
if ( '_' === $id[0] ) {
continue;
}
$name = "attachments[$attachment_id][$id]";
$id_attr = "attachments-$attachment_id-$id";
if ( ! empty( $field['tr'] ) ) {
$item .= $field['tr'];
continue;
}
$field = array_merge( $defaults, $field );
if ( ( ! $field['show_in_edit'] && ! $args['in_modal'] ) || ( ! $field['show_in_modal'] && $args['in_modal'] ) ) {
continue;
}
if ( 'hidden' === $field['input'] ) {
$hidden_fields[ $name ] = $field['value'];
continue;
}
$readonly = ! $user_can_edit && ! empty( $field['taxonomy'] ) ? " readonly='readonly' " : '';
$required = $field['required'] ? ' ' . wp_required_field_indicator() : '';
$required_attr = $field['required'] ? ' required' : '';
$class = 'compat-field-' . $id;
$class .= $field['required'] ? ' form-required' : '';
$item .= "\t\t<tr class='$class'>";
$item .= "\t\t\t<th scope='row' class='label'><label for='$id_attr'><span class='alignleft'>{$field['label']}</span>$required<br class='clear' /></label>";
$item .= "</th>\n\t\t\t<td class='field'>";
if ( ! empty( $field[ $field['input'] ] ) ) {
$item .= $field[ $field['input'] ];
} elseif ( 'textarea' === $field['input'] ) {
if ( 'post_content' === $id && user_can_richedit() ) {
// sanitize_post() skips the post_content when user_can_richedit.
$field['value'] = htmlspecialchars( $field['value'], ENT_QUOTES );
}
$item .= "<textarea id='$id_attr' name='$name'{$required_attr}>" . $field['value'] . '</textarea>';
} else {
$item .= "<input type='text' class='text' id='$id_attr' name='$name' value='" . esc_attr( $field['value'] ) . "' $readonly{$required_attr} />";
}
if ( ! empty( $field['helps'] ) ) {
$item .= "<p class='help'>" . implode( "</p>\n<p class='help'>", array_unique( (array) $field['helps'] ) ) . '</p>';
}
$item .= "</td>\n\t\t</tr>\n";
$extra_rows = array();
if ( ! empty( $field['errors'] ) ) {
foreach ( array_unique( (array) $field['errors'] ) as $error ) {
$extra_rows['error'][] = $error;
}
}
if ( ! empty( $field['extra_rows'] ) ) {
foreach ( $field['extra_rows'] as $class => $rows ) {
foreach ( (array) $rows as $html ) {
$extra_rows[ $class ][] = $html;
}
}
}
foreach ( $extra_rows as $class => $rows ) {
foreach ( $rows as $html ) {
$item .= "\t\t<tr><td></td><td class='$class'>$html</td></tr>\n";
}
}
}
if ( ! empty( $form_fields['_final'] ) ) {
$item .= "\t\t<tr class='final'><td colspan='2'>{$form_fields['_final']}</td></tr>\n";
}
if ( $item ) {
$item = '<p class="media-types media-types-required-info">' .
wp_required_field_message() .
'</p>' .
'<table class="compat-attachment-fields">' . $item . '</table>';
}
foreach ( $hidden_fields as $hidden_field => $value ) {
$item .= '<input type="hidden" name="' . esc_attr( $hidden_field ) . '" value="' . esc_attr( $value ) . '" />' . "\n";
}
if ( $item ) {
$item = '<input type="hidden" name="attachments[' . $attachment_id . '][menu_order]" value="' . esc_attr( $post->menu_order ) . '" />' . $item;
}
return array(
'item' => $item,
'meta' => $media_meta,
);
}
```
[apply\_filters( 'attachment\_fields\_to\_edit', array $form\_fields, WP\_Post $post )](../hooks/attachment_fields_to_edit)
Filters the attachment fields to edit.
[apply\_filters( 'get\_media\_item\_args', array $parsed\_args )](../hooks/get_media_item_args)
Filters the arguments used to retrieve an image for the edit image form.
[apply\_filters( 'media\_meta', string $media\_dims, WP\_Post $post )](../hooks/media_meta)
Filters the media metadata.
| Uses | Description |
| --- | --- |
| [wp\_required\_field\_message()](wp_required_field_message) wp-includes/general-template.php | Creates a message to explain required form fields. |
| [wp\_required\_field\_indicator()](wp_required_field_indicator) wp-includes/general-template.php | Assigns a visual indicator for required form fields. |
| [user\_can\_richedit()](user_can_richedit) wp-includes/general-template.php | Determines whether the user can access the visual editor. |
| [get\_object\_term\_cache()](get_object_term_cache) wp-includes/taxonomy.php | Retrieves the cached term objects for the given object ID. |
| [wp\_get\_object\_terms()](wp_get_object_terms) wp-includes/taxonomy.php | Retrieves the terms associated with the given object(s), in the supplied taxonomies. |
| [get\_attachment\_taxonomies()](get_attachment_taxonomies) wp-includes/media.php | Retrieves taxonomies attached to given the attachment. |
| [current\_user\_can()](current_user_can) wp-includes/capabilities.php | Returns whether the current user has the specified capability. |
| [esc\_attr()](esc_attr) wp-includes/formatting.php | Escaping for HTML attributes. |
| [wp\_parse\_args()](wp_parse_args) wp-includes/functions.php | Merges user defined arguments into defaults array. |
| [get\_taxonomy()](get_taxonomy) wp-includes/taxonomy.php | Retrieves the taxonomy object of $taxonomy. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| [get\_post()](get_post) wp-includes/post.php | Retrieves post data given a post ID or post object. |
| Used By | Description |
| --- | --- |
| [edit\_form\_image\_editor()](edit_form_image_editor) wp-admin/includes/media.php | Displays the image and editor in the post editor |
| [wp\_prepare\_attachment\_for\_js()](wp_prepare_attachment_for_js) wp-includes/media.php | Prepares an attachment post object for JS, where it is expected to be JSON-encoded and fit into an Attachment model. |
| Version | Description |
| --- | --- |
| [3.5.0](https://developer.wordpress.org/reference/since/3.5.0/) | Introduced. |
| programming_docs |
wordpress wp_resolve_numeric_slug_conflicts( array $query_vars = array() ): array wp\_resolve\_numeric\_slug\_conflicts( array $query\_vars = array() ): array
============================================================================
Resolves numeric slugs that collide with date permalinks.
Permalinks of posts with numeric slugs can sometimes look to [WP\_Query::parse\_query()](../classes/wp_query/parse_query) like a date archive, as when your permalink structure is `/%year%/%postname%/` and a post with post\_name ’05’ has the URL `/2015/05/`.
This function detects conflicts of this type and resolves them in favor of the post permalink.
Note that, since 4.3.0, [wp\_unique\_post\_slug()](wp_unique_post_slug) prevents the creation of post slugs that would result in a date archive conflict. The resolution performed in this function is primarily for legacy content, as well as cases when the admin has changed the site’s permalink structure in a way that introduces URL conflicts.
`$query_vars` array Optional Query variables for setting up the loop, as determined in [WP::parse\_request()](../classes/wp/parse_request). Default: `array()`
array Returns the original array of query vars, with date/post conflicts resolved.
File: `wp-includes/rewrite.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/rewrite.php/)
```
function wp_resolve_numeric_slug_conflicts( $query_vars = array() ) {
if ( ! isset( $query_vars['year'] ) && ! isset( $query_vars['monthnum'] ) && ! isset( $query_vars['day'] ) ) {
return $query_vars;
}
// Identify the 'postname' position in the permastruct array.
$permastructs = array_values( array_filter( explode( '/', get_option( 'permalink_structure' ) ) ) );
$postname_index = array_search( '%postname%', $permastructs, true );
if ( false === $postname_index ) {
return $query_vars;
}
/*
* A numeric slug could be confused with a year, month, or day, depending on position. To account for
* the possibility of post pagination (eg 2015/2 for the second page of a post called '2015'), our
* `is_*` checks are generous: check for year-slug clashes when `is_year` *or* `is_month`, and check
* for month-slug clashes when `is_month` *or* `is_day`.
*/
$compare = '';
if ( 0 === $postname_index && ( isset( $query_vars['year'] ) || isset( $query_vars['monthnum'] ) ) ) {
$compare = 'year';
} elseif ( $postname_index && '%year%' === $permastructs[ $postname_index - 1 ] && ( isset( $query_vars['monthnum'] ) || isset( $query_vars['day'] ) ) ) {
$compare = 'monthnum';
} elseif ( $postname_index && '%monthnum%' === $permastructs[ $postname_index - 1 ] && isset( $query_vars['day'] ) ) {
$compare = 'day';
}
if ( ! $compare ) {
return $query_vars;
}
// This is the potentially clashing slug.
$value = '';
if ( $compare && array_key_exists( $compare, $query_vars ) ) {
$value = $query_vars[ $compare ];
}
$post = get_page_by_path( $value, OBJECT, 'post' );
if ( ! ( $post instanceof WP_Post ) ) {
return $query_vars;
}
// If the date of the post doesn't match the date specified in the URL, resolve to the date archive.
if ( preg_match( '/^([0-9]{4})\-([0-9]{2})/', $post->post_date, $matches ) && isset( $query_vars['year'] ) && ( 'monthnum' === $compare || 'day' === $compare ) ) {
// $matches[1] is the year the post was published.
if ( (int) $query_vars['year'] !== (int) $matches[1] ) {
return $query_vars;
}
// $matches[2] is the month the post was published.
if ( 'day' === $compare && isset( $query_vars['monthnum'] ) && (int) $query_vars['monthnum'] !== (int) $matches[2] ) {
return $query_vars;
}
}
/*
* If the located post contains nextpage pagination, then the URL chunk following postname may be
* intended as the page number. Verify that it's a valid page before resolving to it.
*/
$maybe_page = '';
if ( 'year' === $compare && isset( $query_vars['monthnum'] ) ) {
$maybe_page = $query_vars['monthnum'];
} elseif ( 'monthnum' === $compare && isset( $query_vars['day'] ) ) {
$maybe_page = $query_vars['day'];
}
// Bug found in #11694 - 'page' was returning '/4'.
$maybe_page = (int) trim( $maybe_page, '/' );
$post_page_count = substr_count( $post->post_content, '<!--nextpage-->' ) + 1;
// If the post doesn't have multiple pages, but a 'page' candidate is found, resolve to the date archive.
if ( 1 === $post_page_count && $maybe_page ) {
return $query_vars;
}
// If the post has multiple pages and the 'page' number isn't valid, resolve to the date archive.
if ( $post_page_count > 1 && $maybe_page > $post_page_count ) {
return $query_vars;
}
// If we've gotten to this point, we have a slug/date clash. First, adjust for nextpage.
if ( '' !== $maybe_page ) {
$query_vars['page'] = (int) $maybe_page;
}
// Next, unset autodetected date-related query vars.
unset( $query_vars['year'] );
unset( $query_vars['monthnum'] );
unset( $query_vars['day'] );
// Then, set the identified post.
$query_vars['name'] = $post->post_name;
// Finally, return the modified query vars.
return $query_vars;
}
```
| Uses | Description |
| --- | --- |
| [get\_page\_by\_path()](get_page_by_path) wp-includes/post.php | Retrieves a page given its path. |
| [get\_option()](get_option) wp-includes/option.php | Retrieves an option value based on an option name. |
| Used By | Description |
| --- | --- |
| [WP::parse\_request()](../classes/wp/parse_request) wp-includes/class-wp.php | Parses the request to find the correct WordPress query. |
| [url\_to\_postid()](url_to_postid) wp-includes/rewrite.php | Examines a URL and try to determine the post ID it represents. |
| Version | Description |
| --- | --- |
| [4.3.0](https://developer.wordpress.org/reference/since/4.3.0/) | Introduced. |
wordpress wp_script_add_data( string $handle, string $key, mixed $value ): bool wp\_script\_add\_data( string $handle, string $key, mixed $value ): bool
========================================================================
Add metadata to a script.
Works only if the script has already been registered.
Possible values for $key and $value: ‘conditional’ string Comments for IE 6, lte IE 7, etc.
* [WP\_Dependencies::add\_data()](../classes/wp_dependencies/add_data)
`$handle` string Required Name of the script. `$key` string Required Name of data point for which we're storing a value. `$value` mixed Required String containing the data to be added. bool True on success, false on failure.
File: `wp-includes/functions.wp-scripts.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/functions-wp-scripts.php/)
```
function wp_script_add_data( $handle, $key, $value ) {
return wp_scripts()->add_data( $handle, $key, $value );
}
```
| Uses | Description |
| --- | --- |
| [wp\_scripts()](wp_scripts) wp-includes/functions.wp-scripts.php | Initialize $wp\_scripts if it has not been set. |
| Version | Description |
| --- | --- |
| [4.2.0](https://developer.wordpress.org/reference/since/4.2.0/) | Introduced. |
wordpress the_author_icq() the\_author\_icq()
==================
This function has been deprecated. Use [the\_author\_meta()](the_author_meta) instead.
Display the ICQ number of the author of the current post.
* [the\_author\_meta()](the_author_meta)
File: `wp-includes/deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/deprecated.php/)
```
function the_author_icq() {
_deprecated_function( __FUNCTION__, '2.8.0', 'the_author_meta(\'icq\')' );
the_author_meta('icq');
}
```
| Uses | Description |
| --- | --- |
| [the\_author\_meta()](the_author_meta) wp-includes/author-template.php | Outputs the field from the user’s DB object. Defaults to current post’s author. |
| [\_deprecated\_function()](_deprecated_function) wp-includes/functions.php | Marks a function as deprecated and inform when it has been used. |
| Version | Description |
| --- | --- |
| [2.8.0](https://developer.wordpress.org/reference/since/2.8.0/) | Use [the\_author\_meta()](the_author_meta) |
| [0.71](https://developer.wordpress.org/reference/since/0.71/) | Introduced. |
wordpress _wp_image_meta_replace_original( array $saved_data, string $original_file, array $image_meta, int $attachment_id ): array \_wp\_image\_meta\_replace\_original( array $saved\_data, string $original\_file, array $image\_meta, int $attachment\_id ): array
==================================================================================================================================
This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.
Updates the attached file and image meta data when the original image was edited.
`$saved_data` array Required The data returned from [WP\_Image\_Editor](../classes/wp_image_editor) after successfully saving an image. `$original_file` string Required Path to the original file. `$image_meta` array Required The image meta data. `$attachment_id` int Required The attachment post ID. array The updated image meta data.
File: `wp-admin/includes/image.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/image.php/)
```
function _wp_image_meta_replace_original( $saved_data, $original_file, $image_meta, $attachment_id ) {
$new_file = $saved_data['path'];
// Update the attached file meta.
update_attached_file( $attachment_id, $new_file );
// Width and height of the new image.
$image_meta['width'] = $saved_data['width'];
$image_meta['height'] = $saved_data['height'];
// Make the file path relative to the upload dir.
$image_meta['file'] = _wp_relative_upload_path( $new_file );
// Add image file size.
$image_meta['filesize'] = wp_filesize( $new_file );
// Store the original image file name in image_meta.
$image_meta['original_image'] = wp_basename( $original_file );
return $image_meta;
}
```
| Uses | Description |
| --- | --- |
| [wp\_filesize()](wp_filesize) wp-includes/functions.php | Wrapper for PHP filesize with filters and casting the result as an integer. |
| [update\_attached\_file()](update_attached_file) wp-includes/post.php | Updates attachment file path based on attachment ID. |
| [\_wp\_relative\_upload\_path()](_wp_relative_upload_path) wp-includes/post.php | Returns relative path to an uploaded file. |
| [wp\_basename()](wp_basename) wp-includes/formatting.php | i18n-friendly version of basename(). |
| Used By | Description |
| --- | --- |
| [wp\_create\_image\_subsizes()](wp_create_image_subsizes) wp-admin/includes/image.php | Creates image sub-sizes, adds the new data to the image meta `sizes` array, and updates the image metadata. |
| Version | Description |
| --- | --- |
| [6.0.0](https://developer.wordpress.org/reference/since/6.0.0/) | The `$filesize` value was added to the returned array. |
| [5.3.0](https://developer.wordpress.org/reference/since/5.3.0/) | Introduced. |
wordpress get_rss( string $url, int $num_items = 5 ): bool get\_rss( string $url, int $num\_items = 5 ): bool
==================================================
Display RSS items in HTML list items.
You have to specify which HTML list you want, either ordered or unordered before using the function. You also have to specify how many items you wish to display. You can’t display all of them like you can with [wp\_rss()](wp_rss) function.
`$url` string Required URL of feed to display. Will not auto sense feed URL. `$num_items` int Optional Number of items to display, default is all. Default: `5`
bool False on failure.
File: `wp-includes/rss.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/rss.php/)
```
function get_rss ($url, $num_items = 5) { // Like get posts, but for RSS
$rss = fetch_rss($url);
if ( $rss ) {
$rss->items = array_slice($rss->items, 0, $num_items);
foreach ( (array) $rss->items as $item ) {
echo "<li>\n";
echo "<a href='$item[link]' title='$item[description]'>";
echo esc_html($item['title']);
echo "</a><br />\n";
echo "</li>\n";
}
} else {
return false;
}
}
```
| Uses | Description |
| --- | --- |
| [fetch\_rss()](fetch_rss) wp-includes/rss.php | Build Magpie object based on RSS from URL. |
| [esc\_html()](esc_html) wp-includes/formatting.php | Escaping for HTML blocks. |
| Version | Description |
| --- | --- |
| [1.5.0](https://developer.wordpress.org/reference/since/1.5.0/) | Introduced. |
wordpress get_file_data( string $file, array $default_headers, string $context = '' ): string[] get\_file\_data( string $file, array $default\_headers, string $context = '' ): string[]
========================================================================================
Retrieves metadata from a file.
Searches for metadata in the first 8 KB of a file, such as a plugin or theme.
Each piece of metadata must be on its own line. Fields can not span multiple lines, the value will get cut at the end of the first line.
If the file data is not within that first 8 KB, then the author should correct their plugin file and move the data headers to the top.
`$file` string Required Absolute path to the file. `$default_headers` array Required List of headers, in the format `array( 'HeaderKey' => 'Header Name' )`. `$context` string Optional If specified adds filter hook ['extra\_$context\_headers'](../hooks/extra_context_headers).
Default: `''`
string[] Array of file header values keyed by header name.
File: `wp-includes/functions.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/functions.php/)
```
function get_file_data( $file, $default_headers, $context = '' ) {
// Pull only the first 8 KB of the file in.
$file_data = file_get_contents( $file, false, null, 0, 8 * KB_IN_BYTES );
if ( false === $file_data ) {
$file_data = '';
}
// Make sure we catch CR-only line endings.
$file_data = str_replace( "\r", "\n", $file_data );
/**
* Filters extra file headers by context.
*
* The dynamic portion of the hook name, `$context`, refers to
* the context where extra headers might be loaded.
*
* @since 2.9.0
*
* @param array $extra_context_headers Empty array by default.
*/
$extra_headers = $context ? apply_filters( "extra_{$context}_headers", array() ) : array();
if ( $extra_headers ) {
$extra_headers = array_combine( $extra_headers, $extra_headers ); // Keys equal values.
$all_headers = array_merge( $extra_headers, (array) $default_headers );
} else {
$all_headers = $default_headers;
}
foreach ( $all_headers as $field => $regex ) {
if ( preg_match( '/^(?:[ \t]*<\?php)?[ \t\/*#@]*' . preg_quote( $regex, '/' ) . ':(.*)$/mi', $file_data, $match ) && $match[1] ) {
$all_headers[ $field ] = _cleanup_header_comment( $match[1] );
} else {
$all_headers[ $field ] = '';
}
}
return $all_headers;
}
```
[apply\_filters( "extra\_{$context}\_headers", array $extra\_context\_headers )](../hooks/extra_context_headers)
Filters extra file headers by context.
| Uses | Description |
| --- | --- |
| [\_cleanup\_header\_comment()](_cleanup_header_comment) wp-includes/functions.php | Strips close comment and close php tags from file headers used by WP. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| Used By | Description |
| --- | --- |
| [\_register\_theme\_block\_patterns()](_register_theme_block_patterns) wp-includes/block-patterns.php | Register any patterns that the active theme may provide under its `./patterns/` directory. Each pattern is defined as a PHP file and defines its metadata using plugin-style headers. The minimum required definition is: |
| [Theme\_Upgrader::check\_package()](../classes/theme_upgrader/check_package) wp-admin/includes/class-theme-upgrader.php | Checks that the package source contains a valid theme. |
| [get\_plugin\_data()](get_plugin_data) wp-admin/includes/plugin.php | Parses the plugin contents to retrieve plugin’s metadata. |
| [wp\_get\_pomo\_file\_data()](wp_get_pomo_file_data) wp-includes/l10n.php | Extracts headers from a PO file. |
| [WP\_Theme::\_\_construct()](../classes/wp_theme/__construct) wp-includes/class-wp-theme.php | Constructor for [WP\_Theme](../classes/wp_theme). |
| Version | Description |
| --- | --- |
| [2.9.0](https://developer.wordpress.org/reference/since/2.9.0/) | Introduced. |
wordpress wp_kses_attr_parse( string $element ): array|false wp\_kses\_attr\_parse( string $element ): array|false
=====================================================
Finds all attributes of an HTML element.
Does not modify input. May return "evil" output.
Based on `wp_kses_split2()` and `wp_kses_attr()`.
`$element` string Required HTML element. array|false List of attributes found in the element. Returns false on failure.
File: `wp-includes/kses.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/kses.php/)
```
function wp_kses_attr_parse( $element ) {
$valid = preg_match( '%^(<\s*)(/\s*)?([a-zA-Z0-9]+\s*)([^>]*)(>?)$%', $element, $matches );
if ( 1 !== $valid ) {
return false;
}
$begin = $matches[1];
$slash = $matches[2];
$elname = $matches[3];
$attr = $matches[4];
$end = $matches[5];
if ( '' !== $slash ) {
// Closing elements do not get parsed.
return false;
}
// Is there a closing XHTML slash at the end of the attributes?
if ( 1 === preg_match( '%\s*/\s*$%', $attr, $matches ) ) {
$xhtml_slash = $matches[0];
$attr = substr( $attr, 0, -strlen( $xhtml_slash ) );
} else {
$xhtml_slash = '';
}
// Split it.
$attrarr = wp_kses_hair_parse( $attr );
if ( false === $attrarr ) {
return false;
}
// Make sure all input is returned by adding front and back matter.
array_unshift( $attrarr, $begin . $slash . $elname );
array_push( $attrarr, $xhtml_slash . $end );
return $attrarr;
}
```
| Uses | Description |
| --- | --- |
| [wp\_kses\_hair\_parse()](wp_kses_hair_parse) wp-includes/kses.php | Builds an attribute list from string containing attributes. |
| Used By | Description |
| --- | --- |
| [do\_shortcodes\_in\_html\_tags()](do_shortcodes_in_html_tags) wp-includes/shortcodes.php | Searches only inside HTML elements for shortcodes and process them. |
| Version | Description |
| --- | --- |
| [4.2.3](https://developer.wordpress.org/reference/since/4.2.3/) | Introduced. |
wordpress wp_autosave( array $post_data ): mixed wp\_autosave( array $post\_data ): mixed
========================================
Saves a post submitted with XHR.
Intended for use with heartbeat and autosave.js
`$post_data` array Required Associative array of the submitted post data. mixed The value 0 or [WP\_Error](../classes/wp_error) on failure. The saved post ID on success.
The ID can be the draft post\_id or the autosave revision post\_id.
File: `wp-admin/includes/post.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/post.php/)
```
function wp_autosave( $post_data ) {
// Back-compat.
if ( ! defined( 'DOING_AUTOSAVE' ) ) {
define( 'DOING_AUTOSAVE', true );
}
$post_id = (int) $post_data['post_id'];
$post_data['ID'] = $post_id;
$post_data['post_ID'] = $post_id;
if ( false === wp_verify_nonce( $post_data['_wpnonce'], 'update-post_' . $post_id ) ) {
return new WP_Error( 'invalid_nonce', __( 'Error while saving.' ) );
}
$post = get_post( $post_id );
if ( ! current_user_can( 'edit_post', $post->ID ) ) {
return new WP_Error( 'edit_posts', __( 'Sorry, you are not allowed to edit this item.' ) );
}
if ( 'auto-draft' === $post->post_status ) {
$post_data['post_status'] = 'draft';
}
if ( 'page' !== $post_data['post_type'] && ! empty( $post_data['catslist'] ) ) {
$post_data['post_category'] = explode( ',', $post_data['catslist'] );
}
if ( ! wp_check_post_lock( $post->ID ) && get_current_user_id() == $post->post_author
&& ( 'auto-draft' === $post->post_status || 'draft' === $post->post_status )
) {
// Drafts and auto-drafts are just overwritten by autosave for the same user if the post is not locked.
return edit_post( wp_slash( $post_data ) );
} else {
// Non-drafts or other users' drafts are not overwritten.
// The autosave is stored in a special post revision for each user.
return wp_create_post_autosave( wp_slash( $post_data ) );
}
}
```
| Uses | Description |
| --- | --- |
| [wp\_check\_post\_lock()](wp_check_post_lock) wp-admin/includes/post.php | Determines whether the post is currently being edited by another user. |
| [wp\_create\_post\_autosave()](wp_create_post_autosave) wp-admin/includes/post.php | Creates autosave data for the specified post from `$_POST` data. |
| [edit\_post()](edit_post) wp-admin/includes/post.php | Updates an existing post with values provided in `$_POST`. |
| [wp\_verify\_nonce()](wp_verify_nonce) wp-includes/pluggable.php | Verifies that a correct security nonce was used with time limit. |
| [current\_user\_can()](current_user_can) wp-includes/capabilities.php | Returns whether the current user has the specified capability. |
| [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. |
| [wp\_slash()](wp_slash) wp-includes/formatting.php | Adds slashes to a string or recursively adds slashes to strings within an array. |
| [get\_current\_user\_id()](get_current_user_id) wp-includes/user.php | Gets the current user’s ID. |
| [get\_post()](get_post) wp-includes/post.php | Retrieves post data given a post ID or post object. |
| [WP\_Error::\_\_construct()](../classes/wp_error/__construct) wp-includes/class-wp-error.php | Initializes the error. |
| Used By | Description |
| --- | --- |
| [heartbeat\_autosave()](heartbeat_autosave) wp-admin/includes/misc.php | Performs autosave with heartbeat. |
| Version | Description |
| --- | --- |
| [3.9.0](https://developer.wordpress.org/reference/since/3.9.0/) | Introduced. |
| programming_docs |
wordpress get_the_modified_author(): string|void get\_the\_modified\_author(): string|void
=========================================
Retrieves the author who last edited the current post.
string|void The author's display name, empty string if unknown.
##### Usage:
```
<?php echo get_the_modified_author(); ?>
```
File: `wp-includes/author-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/author-template.php/)
```
function get_the_modified_author() {
$last_id = get_post_meta( get_post()->ID, '_edit_last', true );
if ( $last_id ) {
$last_user = get_userdata( $last_id );
/**
* Filters the display name of the author who last edited the current post.
*
* @since 2.8.0
*
* @param string $display_name The author's display name, empty string if unknown.
*/
return apply_filters( 'the_modified_author', $last_user ? $last_user->display_name : '' );
}
}
```
[apply\_filters( 'the\_modified\_author', string $display\_name )](../hooks/the_modified_author)
Filters the display name of the author who last edited the current post.
| Uses | Description |
| --- | --- |
| [get\_userdata()](get_userdata) wp-includes/pluggable.php | Retrieves user info by user ID. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| [get\_post\_meta()](get_post_meta) wp-includes/post.php | Retrieves a post meta field for the given post ID. |
| [get\_post()](get_post) wp-includes/post.php | Retrieves post data given a post ID or post object. |
| Used By | Description |
| --- | --- |
| [the\_modified\_author()](the_modified_author) wp-includes/author-template.php | Displays the name of the author who last edited the current post, if the author’s ID is available. |
| Version | Description |
| --- | --- |
| [2.8.0](https://developer.wordpress.org/reference/since/2.8.0/) | Introduced. |
wordpress wp_nav_menu_manage_columns(): string[] wp\_nav\_menu\_manage\_columns(): string[]
==========================================
Returns the columns for the nav menus page.
string[] Array of column titles keyed by their column name.
File: `wp-admin/includes/nav-menu.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/nav-menu.php/)
```
function wp_nav_menu_manage_columns() {
return array(
'_title' => __( 'Show advanced menu properties' ),
'cb' => '<input type="checkbox" />',
'link-target' => __( 'Link Target' ),
'title-attribute' => __( 'Title Attribute' ),
'css-classes' => __( 'CSS Classes' ),
'xfn' => __( 'Link Relationship (XFN)' ),
'description' => __( 'Description' ),
);
}
```
| Uses | Description |
| --- | --- |
| [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. |
| Used By | Description |
| --- | --- |
| [WP\_Customize\_Nav\_Menus\_Panel::wp\_nav\_menu\_manage\_columns()](../classes/wp_customize_nav_menus_panel/wp_nav_menu_manage_columns) wp-includes/customize/class-wp-customize-nav-menus-panel.php | Returns the advanced options for the nav menus page. |
| Version | Description |
| --- | --- |
| [3.0.0](https://developer.wordpress.org/reference/since/3.0.0/) | Introduced. |
wordpress the_author_yim() the\_author\_yim()
==================
This function has been deprecated. Use [the\_author\_meta()](the_author_meta) instead.
Display the Yahoo! IM name of the author of the current post.
* [the\_author\_meta()](the_author_meta)
File: `wp-includes/deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/deprecated.php/)
```
function the_author_yim() {
_deprecated_function( __FUNCTION__, '2.8.0', 'the_author_meta(\'yim\')' );
the_author_meta('yim');
}
```
| Uses | Description |
| --- | --- |
| [the\_author\_meta()](the_author_meta) wp-includes/author-template.php | Outputs the field from the user’s DB object. Defaults to current post’s author. |
| [\_deprecated\_function()](_deprecated_function) wp-includes/functions.php | Marks a function as deprecated and inform when it has been used. |
| Version | Description |
| --- | --- |
| [2.8.0](https://developer.wordpress.org/reference/since/2.8.0/) | Use [the\_author\_meta()](the_author_meta) |
| [0.71](https://developer.wordpress.org/reference/since/0.71/) | Introduced. |
wordpress verify_file_signature( string $filename, string|array $signatures, string|false $filename_for_errors = false ): bool|WP_Error verify\_file\_signature( string $filename, string|array $signatures, string|false $filename\_for\_errors = false ): bool|WP\_Error
==================================================================================================================================
Verifies the contents of a file against its ED25519 signature.
`$filename` string Required The file to validate. `$signatures` string|array Required A Signature provided for the file. `$filename_for_errors` string|false Optional A friendly filename for errors. Default: `false`
bool|[WP\_Error](../classes/wp_error) True on success, false if verification not attempted, or [WP\_Error](../classes/wp_error) describing an error condition.
File: `wp-admin/includes/file.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/file.php/)
```
function verify_file_signature( $filename, $signatures, $filename_for_errors = false ) {
if ( ! $filename_for_errors ) {
$filename_for_errors = wp_basename( $filename );
}
// Check we can process signatures.
if ( ! function_exists( 'sodium_crypto_sign_verify_detached' ) || ! in_array( 'sha384', array_map( 'strtolower', hash_algos() ), true ) ) {
return new WP_Error(
'signature_verification_unsupported',
sprintf(
/* translators: %s: The filename of the package. */
__( 'The authenticity of %s could not be verified as signature verification is unavailable on this system.' ),
'<span class="code">' . esc_html( $filename_for_errors ) . '</span>'
),
( ! function_exists( 'sodium_crypto_sign_verify_detached' ) ? 'sodium_crypto_sign_verify_detached' : 'sha384' )
);
}
// Check for a edge-case affecting PHP Maths abilities.
if (
! extension_loaded( 'sodium' ) &&
in_array( PHP_VERSION_ID, array( 70200, 70201, 70202 ), true ) &&
extension_loaded( 'opcache' )
) {
// Sodium_Compat isn't compatible with PHP 7.2.0~7.2.2 due to a bug in the PHP Opcache extension, bail early as it'll fail.
// https://bugs.php.net/bug.php?id=75938
return new WP_Error(
'signature_verification_unsupported',
sprintf(
/* translators: %s: The filename of the package. */
__( 'The authenticity of %s could not be verified as signature verification is unavailable on this system.' ),
'<span class="code">' . esc_html( $filename_for_errors ) . '</span>'
),
array(
'php' => PHP_VERSION,
'sodium' => defined( 'SODIUM_LIBRARY_VERSION' ) ? SODIUM_LIBRARY_VERSION : ( defined( 'ParagonIE_Sodium_Compat::VERSION_STRING' ) ? ParagonIE_Sodium_Compat::VERSION_STRING : false ),
)
);
}
// Verify runtime speed of Sodium_Compat is acceptable.
if ( ! extension_loaded( 'sodium' ) && ! ParagonIE_Sodium_Compat::polyfill_is_fast() ) {
$sodium_compat_is_fast = false;
// Allow for an old version of Sodium_Compat being loaded before the bundled WordPress one.
if ( method_exists( 'ParagonIE_Sodium_Compat', 'runtime_speed_test' ) ) {
/*
* Run `ParagonIE_Sodium_Compat::runtime_speed_test()` in optimized integer mode,
* as that's what WordPress utilizes during signing verifications.
*/
// phpcs:disable WordPress.NamingConventions.ValidVariableName
$old_fastMult = ParagonIE_Sodium_Compat::$fastMult;
ParagonIE_Sodium_Compat::$fastMult = true;
$sodium_compat_is_fast = ParagonIE_Sodium_Compat::runtime_speed_test( 100, 10 );
ParagonIE_Sodium_Compat::$fastMult = $old_fastMult;
// phpcs:enable
}
// This cannot be performed in a reasonable amount of time.
// https://github.com/paragonie/sodium_compat#help-sodium_compat-is-slow-how-can-i-make-it-fast
if ( ! $sodium_compat_is_fast ) {
return new WP_Error(
'signature_verification_unsupported',
sprintf(
/* translators: %s: The filename of the package. */
__( 'The authenticity of %s could not be verified as signature verification is unavailable on this system.' ),
'<span class="code">' . esc_html( $filename_for_errors ) . '</span>'
),
array(
'php' => PHP_VERSION,
'sodium' => defined( 'SODIUM_LIBRARY_VERSION' ) ? SODIUM_LIBRARY_VERSION : ( defined( 'ParagonIE_Sodium_Compat::VERSION_STRING' ) ? ParagonIE_Sodium_Compat::VERSION_STRING : false ),
'polyfill_is_fast' => false,
'max_execution_time' => ini_get( 'max_execution_time' ),
)
);
}
}
if ( ! $signatures ) {
return new WP_Error(
'signature_verification_no_signature',
sprintf(
/* translators: %s: The filename of the package. */
__( 'The authenticity of %s could not be verified as no signature was found.' ),
'<span class="code">' . esc_html( $filename_for_errors ) . '</span>'
),
array(
'filename' => $filename_for_errors,
)
);
}
$trusted_keys = wp_trusted_keys();
$file_hash = hash_file( 'sha384', $filename, true );
mbstring_binary_safe_encoding();
$skipped_key = 0;
$skipped_signature = 0;
foreach ( (array) $signatures as $signature ) {
$signature_raw = base64_decode( $signature );
// Ensure only valid-length signatures are considered.
if ( SODIUM_CRYPTO_SIGN_BYTES !== strlen( $signature_raw ) ) {
$skipped_signature++;
continue;
}
foreach ( (array) $trusted_keys as $key ) {
$key_raw = base64_decode( $key );
// Only pass valid public keys through.
if ( SODIUM_CRYPTO_SIGN_PUBLICKEYBYTES !== strlen( $key_raw ) ) {
$skipped_key++;
continue;
}
if ( sodium_crypto_sign_verify_detached( $signature_raw, $file_hash, $key_raw ) ) {
reset_mbstring_encoding();
return true;
}
}
}
reset_mbstring_encoding();
return new WP_Error(
'signature_verification_failed',
sprintf(
/* translators: %s: The filename of the package. */
__( 'The authenticity of %s could not be verified.' ),
'<span class="code">' . esc_html( $filename_for_errors ) . '</span>'
),
// Error data helpful for debugging:
array(
'filename' => $filename_for_errors,
'keys' => $trusted_keys,
'signatures' => $signatures,
'hash' => bin2hex( $file_hash ),
'skipped_key' => $skipped_key,
'skipped_sig' => $skipped_signature,
'php' => PHP_VERSION,
'sodium' => defined( 'SODIUM_LIBRARY_VERSION' ) ? SODIUM_LIBRARY_VERSION : ( defined( 'ParagonIE_Sodium_Compat::VERSION_STRING' ) ? ParagonIE_Sodium_Compat::VERSION_STRING : false ),
)
);
}
```
| Uses | Description |
| --- | --- |
| [wp\_trusted\_keys()](wp_trusted_keys) wp-admin/includes/file.php | Retrieves the list of signing keys trusted by WordPress. |
| [mbstring\_binary\_safe\_encoding()](mbstring_binary_safe_encoding) wp-includes/functions.php | Sets the mbstring internal encoding to a binary safe encoding when func\_overload is enabled. |
| [reset\_mbstring\_encoding()](reset_mbstring_encoding) wp-includes/functions.php | Resets the mbstring internal encoding to a users previously set encoding. |
| [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. |
| [wp\_basename()](wp_basename) wp-includes/formatting.php | i18n-friendly version of basename(). |
| [esc\_html()](esc_html) wp-includes/formatting.php | Escaping for HTML blocks. |
| [WP\_Error::\_\_construct()](../classes/wp_error/__construct) wp-includes/class-wp-error.php | Initializes the error. |
| Used By | Description |
| --- | --- |
| [download\_url()](download_url) wp-admin/includes/file.php | Downloads a URL to a local temporary file using the WordPress HTTP API. |
| Version | Description |
| --- | --- |
| [5.2.0](https://developer.wordpress.org/reference/since/5.2.0/) | Introduced. |
wordpress translate_with_context( string $text, string $domain = 'default' ): string translate\_with\_context( string $text, string $domain = 'default' ): string
============================================================================
This function has been deprecated. Use [\_x()](_x) instead.
Translates $text like [translate()](translate) , but assumes that the text contains a context after its last vertical bar.
* [\_x()](_x)
`$text` string Required Text to translate. `$domain` string Optional Domain to retrieve the translated text. Default: `'default'`
string Translated text.
File: `wp-includes/deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/deprecated.php/)
```
function translate_with_context( $text, $domain = 'default' ) {
_deprecated_function( __FUNCTION__, '2.9.0', '_x()' );
return before_last_bar( translate( $text, $domain ) );
}
```
| Uses | Description |
| --- | --- |
| [before\_last\_bar()](before_last_bar) wp-includes/l10n.php | Removes last item on a pipe-delimited string. |
| [translate()](translate) wp-includes/l10n.php | Retrieves the translation of $text. |
| [\_deprecated\_function()](_deprecated_function) wp-includes/functions.php | Marks a function as deprecated and inform when it has been used. |
| Version | Description |
| --- | --- |
| [3.0.0](https://developer.wordpress.org/reference/since/3.0.0/) | Use [\_x()](_x) |
| [2.5.0](https://developer.wordpress.org/reference/since/2.5.0/) | Introduced. |
wordpress wp_roles(): WP_Roles wp\_roles(): WP\_Roles
======================
Retrieves the global [WP\_Roles](../classes/wp_roles) instance and instantiates it if necessary.
[WP\_Roles](../classes/wp_roles) [WP\_Roles](../classes/wp_roles) global instance if not already instantiated.
File: `wp-includes/capabilities.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/capabilities.php/)
```
function wp_roles() {
global $wp_roles;
if ( ! isset( $wp_roles ) ) {
$wp_roles = new WP_Roles();
}
return $wp_roles;
}
```
| Uses | Description |
| --- | --- |
| [WP\_Roles::\_\_construct()](../classes/wp_roles/__construct) wp-includes/class-wp-roles.php | Constructor. |
| Used By | Description |
| --- | --- |
| [wp\_switch\_roles\_and\_user()](wp_switch_roles_and_user) wp-includes/ms-blogs.php | Switches the initialized roles and current user capabilities to another site. |
| [wp\_get\_users\_with\_no\_role()](wp_get_users_with_no_role) wp-includes/user.php | Gets the user IDs of all users with no role on this site. |
| [WP\_Users\_List\_Table::get\_role\_list()](../classes/wp_users_list_table/get_role_list) wp-admin/includes/class-wp-users-list-table.php | Returns an array of translated user role names for a given user object. |
| [edit\_user()](edit_user) wp-admin/includes/user.php | Edit user settings based on contents of $\_POST |
| [get\_editable\_roles()](get_editable_roles) wp-admin/includes/user.php | Fetch a filtered list of user roles that the current user is allowed to edit. |
| [WP\_Users\_List\_Table::get\_views()](../classes/wp_users_list_table/get_views) wp-admin/includes/class-wp-users-list-table.php | Return an associative array listing all the views that can be used with this table. |
| [WP\_User::get\_role\_caps()](../classes/wp_user/get_role_caps) wp-includes/class-wp-user.php | Retrieves all of the capabilities of the user’s roles, and merges them with individual user capabilities. |
| [WP\_Role::add\_cap()](../classes/wp_role/add_cap) wp-includes/class-wp-role.php | Assign role a capability. |
| [WP\_Role::remove\_cap()](../classes/wp_role/remove_cap) wp-includes/class-wp-role.php | Removes a capability from a role. |
| [get\_role()](get_role) wp-includes/capabilities.php | Retrieves role object. |
| [add\_role()](add_role) wp-includes/capabilities.php | Adds a role, if it does not exist. |
| [remove\_role()](remove_role) wp-includes/capabilities.php | Removes a role, if it exists. |
| [count\_users()](count_users) wp-includes/user.php | Counts number of users who have each of the user roles. |
| Version | Description |
| --- | --- |
| [4.3.0](https://developer.wordpress.org/reference/since/4.3.0/) | Introduced. |
wordpress _get_additional_user_keys( WP_User $user ): string[] \_get\_additional\_user\_keys( WP\_User $user ): string[]
=========================================================
This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.
Returns a list of meta keys to be (maybe) populated in [wp\_update\_user()](wp_update_user) .
The list of keys returned via this function are dependent on the presence of those keys in the user meta data to be set.
`$user` [WP\_User](../classes/wp_user) Required [WP\_User](../classes/wp_user) instance. string[] List of user keys to be populated in [wp\_update\_user()](wp_update_user) .
File: `wp-includes/user.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/user.php/)
```
function _get_additional_user_keys( $user ) {
$keys = array( 'first_name', 'last_name', 'nickname', 'description', 'rich_editing', 'syntax_highlighting', 'comment_shortcuts', 'admin_color', 'use_ssl', 'show_admin_bar_front', 'locale' );
return array_merge( $keys, array_keys( wp_get_user_contact_methods( $user ) ) );
}
```
| Uses | Description |
| --- | --- |
| [wp\_get\_user\_contact\_methods()](wp_get_user_contact_methods) wp-includes/user.php | Sets up the user contact methods. |
| Used By | Description |
| --- | --- |
| [wp\_update\_user()](wp_update_user) wp-includes/user.php | Updates a user in the database. |
| Version | Description |
| --- | --- |
| [3.3.0](https://developer.wordpress.org/reference/since/3.3.0/) | Introduced. |
wordpress get_post_class( string|string[] $class = '', int|WP_Post $post = null ): string[] get\_post\_class( string|string[] $class = '', int|WP\_Post $post = null ): string[]
====================================================================================
Retrieves an array of the class names for the post container element.
The class names are many. If the post is a sticky, then the ‘sticky’ class name. The class ‘hentry’ is always added to each post. If the post has a post thumbnail, ‘has-post-thumbnail’ is added as a class. For each taxonomy that the post belongs to, a class will be added of the format ‘{$taxonomy}-{$slug}’ – eg ‘category-foo’ or ‘my\_custom\_taxonomy-bar’.
The ‘post\_tag’ taxonomy is a special case; the class has the ‘tag-‘ prefix instead of ‘post\_tag-‘. All class names are passed through the filter, [‘post\_class’](../hooks/post_class), with the list of class names, followed by $class parameter value, with the post ID as the last parameter.
`$class` string|string[] Optional Space-separated string or array of class names to add to the class list. Default: `''`
`$post` int|[WP\_Post](../classes/wp_post) Optional Post ID or post object. Default: `null`
string[] Array of class names.
File: `wp-includes/post-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/post-template.php/)
```
function get_post_class( $class = '', $post = null ) {
$post = get_post( $post );
$classes = array();
if ( $class ) {
if ( ! is_array( $class ) ) {
$class = preg_split( '#\s+#', $class );
}
$classes = array_map( 'esc_attr', $class );
} else {
// Ensure that we always coerce class to being an array.
$class = array();
}
if ( ! $post ) {
return $classes;
}
$classes[] = 'post-' . $post->ID;
if ( ! is_admin() ) {
$classes[] = $post->post_type;
}
$classes[] = 'type-' . $post->post_type;
$classes[] = 'status-' . $post->post_status;
// Post Format.
if ( post_type_supports( $post->post_type, 'post-formats' ) ) {
$post_format = get_post_format( $post->ID );
if ( $post_format && ! is_wp_error( $post_format ) ) {
$classes[] = 'format-' . sanitize_html_class( $post_format );
} else {
$classes[] = 'format-standard';
}
}
$post_password_required = post_password_required( $post->ID );
// Post requires password.
if ( $post_password_required ) {
$classes[] = 'post-password-required';
} elseif ( ! empty( $post->post_password ) ) {
$classes[] = 'post-password-protected';
}
// Post thumbnails.
if ( current_theme_supports( 'post-thumbnails' ) && has_post_thumbnail( $post->ID ) && ! is_attachment( $post ) && ! $post_password_required ) {
$classes[] = 'has-post-thumbnail';
}
// Sticky for Sticky Posts.
if ( is_sticky( $post->ID ) ) {
if ( is_home() && ! is_paged() ) {
$classes[] = 'sticky';
} elseif ( is_admin() ) {
$classes[] = 'status-sticky';
}
}
// hentry for hAtom compliance.
$classes[] = 'hentry';
// All public taxonomies.
$taxonomies = get_taxonomies( array( 'public' => true ) );
/**
* Filters the taxonomies to generate classes for each individual term.
*
* Default is all public taxonomies registered to the post type.
*
* @since 6.1.0
*
* @param string[] $taxonomies List of all taxonomy names to generate classes for.
* @param int $post_id The post ID.
* @param string[] $classes An array of post class names.
* @param string[] $class An array of additional class names added to the post.
*/
$taxonomies = apply_filters( 'post_class_taxonomies', $taxonomies, $post->ID, $classes, $class );
foreach ( (array) $taxonomies as $taxonomy ) {
if ( is_object_in_taxonomy( $post->post_type, $taxonomy ) ) {
foreach ( (array) get_the_terms( $post->ID, $taxonomy ) as $term ) {
if ( empty( $term->slug ) ) {
continue;
}
$term_class = sanitize_html_class( $term->slug, $term->term_id );
if ( is_numeric( $term_class ) || ! trim( $term_class, '-' ) ) {
$term_class = $term->term_id;
}
// 'post_tag' uses the 'tag' prefix for backward compatibility.
if ( 'post_tag' === $taxonomy ) {
$classes[] = 'tag-' . $term_class;
} else {
$classes[] = sanitize_html_class( $taxonomy . '-' . $term_class, $taxonomy . '-' . $term->term_id );
}
}
}
}
$classes = array_map( 'esc_attr', $classes );
/**
* Filters the list of CSS class names for the current post.
*
* @since 2.7.0
*
* @param string[] $classes An array of post class names.
* @param string[] $class An array of additional class names added to the post.
* @param int $post_id The post ID.
*/
$classes = apply_filters( 'post_class', $classes, $class, $post->ID );
return array_unique( $classes );
}
```
[apply\_filters( 'post\_class', string[] $classes, string[] $class, int $post\_id )](../hooks/post_class)
Filters the list of CSS class names for the current post.
[apply\_filters( 'post\_class\_taxonomies', string[] $taxonomies, int $post\_id, string[] $classes, string[] $class )](../hooks/post_class_taxonomies)
Filters the taxonomies to generate classes for each individual term.
| Uses | Description |
| --- | --- |
| [get\_the\_terms()](get_the_terms) wp-includes/category-template.php | Retrieves the terms of the taxonomy that are attached to the post. |
| [has\_post\_thumbnail()](has_post_thumbnail) wp-includes/post-thumbnail-template.php | Determines whether a post has an image attached. |
| [get\_post\_format()](get_post_format) wp-includes/post-formats.php | Retrieve the format slug for a post |
| [post\_type\_supports()](post_type_supports) wp-includes/post.php | Checks a post type’s support for a given feature. |
| [is\_sticky()](is_sticky) wp-includes/post.php | Determines whether a post is sticky. |
| [post\_password\_required()](post_password_required) wp-includes/post-template.php | Determines whether the post requires password and whether a correct password has been provided. |
| [get\_taxonomies()](get_taxonomies) wp-includes/taxonomy.php | Retrieves a list of registered taxonomy names or objects. |
| [is\_object\_in\_taxonomy()](is_object_in_taxonomy) wp-includes/taxonomy.php | Determines if the given object type is associated with the given taxonomy. |
| [is\_home()](is_home) wp-includes/query.php | Determines whether the query is for the blog homepage. |
| [is\_paged()](is_paged) wp-includes/query.php | Determines whether the query is for a paged result and not for the first page. |
| [is\_attachment()](is_attachment) wp-includes/query.php | Determines whether the query is for an existing attachment page. |
| [sanitize\_html\_class()](sanitize_html_class) wp-includes/formatting.php | Sanitizes an HTML classname to ensure it only contains valid characters. |
| [current\_theme\_supports()](current_theme_supports) wp-includes/theme.php | Checks a theme’s support for a given feature. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| [is\_admin()](is_admin) wp-includes/load.php | Determines whether the current request is for an administrative interface page. |
| [get\_post()](get_post) wp-includes/post.php | Retrieves post data given a post ID or post object. |
| [is\_wp\_error()](is_wp_error) wp-includes/load.php | Checks whether the given variable is a WordPress Error. |
| Used By | Description |
| --- | --- |
| [WP\_Posts\_List\_Table::single\_row()](../classes/wp_posts_list_table/single_row) wp-admin/includes/class-wp-posts-list-table.php | |
| [post\_class()](post_class) wp-includes/post-template.php | Displays the classes for the post container element. |
| Version | Description |
| --- | --- |
| [4.2.0](https://developer.wordpress.org/reference/since/4.2.0/) | Custom taxonomy class names were added. |
| [2.7.0](https://developer.wordpress.org/reference/since/2.7.0/) | Introduced. |
| programming_docs |
wordpress wp_explain_nonce( string $action ): string wp\_explain\_nonce( string $action ): string
============================================
This function has been deprecated. Use [wp\_nonce\_ays()](wp_nonce_ays) instead.
Retrieve nonce action “Are you sure” message.
Deprecated in 3.4.1 and 3.5.0. Backported to 3.3.3.
* [wp\_nonce\_ays()](wp_nonce_ays)
`$action` string Required Nonce action. string Are you sure message.
File: `wp-includes/deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/deprecated.php/)
```
function wp_explain_nonce( $action ) {
_deprecated_function( __FUNCTION__, '3.4.1', 'wp_nonce_ays()' );
return __( 'Are you sure you want to do this?' );
}
```
| Uses | Description |
| --- | --- |
| [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. |
| [\_deprecated\_function()](_deprecated_function) wp-includes/functions.php | Marks a function as deprecated and inform when it has been used. |
| Version | Description |
| --- | --- |
| [2.0.4](https://developer.wordpress.org/reference/since/2.0.4/) | Introduced. |
wordpress wp_dropdown_pages( array|string $args = '' ): string wp\_dropdown\_pages( array|string $args = '' ): string
======================================================
Retrieves or displays a list of pages as a dropdown (select list).
* [get\_pages()](get_pages)
`$args` array|string Optional Array or string of arguments to generate a page dropdown. See [get\_pages()](get_pages) for additional arguments.
* `depth`intMaximum depth. Default 0.
* `child_of`intPage ID to retrieve child pages of. Default 0.
* `selected`int|stringValue of the option that should be selected. Default 0.
* `echo`bool|intWhether to echo or return the generated markup. Accepts 0, 1, or their bool equivalents. Default 1.
* `name`stringValue for the `'name'` attribute of the select element.
Default `'page_id'`.
* `id`stringValue for the `'id'` attribute of the select element.
* `class`stringValue for the `'class'` attribute of the select element. Default: none.
Defaults to the value of `$name`.
* `show_option_none`stringText to display for showing no pages. Default empty (does not display).
* `show_option_no_change`stringText to display for "no change" option. Default empty (does not display).
* `option_none_value`stringValue to use when no page is selected.
* `value_field`stringPost field used to populate the `'value'` attribute of the option elements. Accepts any valid post field. Default `'ID'`.
More Arguments from get\_pages( ... $args ) Array or string of arguments to retrieve pages.
* `child_of`intPage ID to return child and grandchild pages of. Note: The value of `$hierarchical` has no bearing on whether `$child_of` returns hierarchical results. Default 0, or no restriction.
* `sort_order`stringHow to sort retrieved pages. Accepts `'ASC'`, `'DESC'`. Default `'ASC'`.
* `sort_column`stringWhat columns to sort pages by, comma-separated. Accepts `'post_author'`, `'post_date'`, `'post_title'`, `'post_name'`, `'post_modified'`, `'menu_order'`, `'post_modified_gmt'`, `'post_parent'`, `'ID'`, `'rand'`, `'comment*count'`.
`'post*'` can be omitted for any values that start with it.
Default `'post_title'`.
* `hierarchical`boolWhether to return pages hierarchically. If false in conjunction with `$child_of` also being false, both arguments will be disregarded.
Default true.
* `exclude`int[]Array of page IDs to exclude.
* `include`int[]Array of page IDs to include. Cannot be used with `$child_of`, `$parent`, `$exclude`, `$meta_key`, `$meta_value`, or `$hierarchical`.
* `meta_key`stringOnly include pages with this meta key.
* `meta_value`stringOnly include pages with this meta value. Requires `$meta_key`.
* `authors`stringA comma-separated list of author IDs.
* `parent`intPage ID to return direct children of. Default -1, or no restriction.
* `exclude_tree`string|int[]Comma-separated string or array of page IDs to exclude.
* `number`intThe number of pages to return. Default 0, or all pages.
* `offset`intThe number of pages to skip before returning. Requires `$number`.
Default 0.
* `post_type`stringThe post type to query. Default `'page'`.
* `post_status`string|arrayA comma-separated list or array of post statuses to include.
Default `'publish'`.
Default: `''`
string HTML dropdown list of pages.
File: `wp-includes/post-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/post-template.php/)
```
function wp_dropdown_pages( $args = '' ) {
$defaults = array(
'depth' => 0,
'child_of' => 0,
'selected' => 0,
'echo' => 1,
'name' => 'page_id',
'id' => '',
'class' => '',
'show_option_none' => '',
'show_option_no_change' => '',
'option_none_value' => '',
'value_field' => 'ID',
);
$parsed_args = wp_parse_args( $args, $defaults );
$pages = get_pages( $parsed_args );
$output = '';
// Back-compat with old system where both id and name were based on $name argument.
if ( empty( $parsed_args['id'] ) ) {
$parsed_args['id'] = $parsed_args['name'];
}
if ( ! empty( $pages ) ) {
$class = '';
if ( ! empty( $parsed_args['class'] ) ) {
$class = " class='" . esc_attr( $parsed_args['class'] ) . "'";
}
$output = "<select name='" . esc_attr( $parsed_args['name'] ) . "'" . $class . " id='" . esc_attr( $parsed_args['id'] ) . "'>\n";
if ( $parsed_args['show_option_no_change'] ) {
$output .= "\t<option value=\"-1\">" . $parsed_args['show_option_no_change'] . "</option>\n";
}
if ( $parsed_args['show_option_none'] ) {
$output .= "\t<option value=\"" . esc_attr( $parsed_args['option_none_value'] ) . '">' . $parsed_args['show_option_none'] . "</option>\n";
}
$output .= walk_page_dropdown_tree( $pages, $parsed_args['depth'], $parsed_args );
$output .= "</select>\n";
}
/**
* Filters the HTML output of a list of pages as a dropdown.
*
* @since 2.1.0
* @since 4.4.0 `$parsed_args` and `$pages` added as arguments.
*
* @param string $output HTML output for dropdown list of pages.
* @param array $parsed_args The parsed arguments array. See wp_dropdown_pages()
* for information on accepted arguments.
* @param WP_Post[] $pages Array of the page objects.
*/
$html = apply_filters( 'wp_dropdown_pages', $output, $parsed_args, $pages );
if ( $parsed_args['echo'] ) {
echo $html;
}
return $html;
}
```
[apply\_filters( 'wp\_dropdown\_pages', string $output, array $parsed\_args, WP\_Post[] $pages )](../hooks/wp_dropdown_pages)
Filters the HTML output of a list of pages as a dropdown.
| Uses | Description |
| --- | --- |
| [walk\_page\_dropdown\_tree()](walk_page_dropdown_tree) wp-includes/post-template.php | Retrieves HTML dropdown (select) content for page list. |
| [get\_pages()](get_pages) wp-includes/post.php | Retrieves an array of pages (or hierarchical post type items). |
| [esc\_attr()](esc_attr) wp-includes/formatting.php | Escaping for HTML attributes. |
| [wp\_parse\_args()](wp_parse_args) wp-includes/functions.php | Merges user defined arguments into defaults array. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| Used By | Description |
| --- | --- |
| [page\_attributes\_meta\_box()](page_attributes_meta_box) wp-admin/includes/meta-boxes.php | Displays page attributes form fields. |
| [WP\_Posts\_List\_Table::inline\_edit()](../classes/wp_posts_list_table/inline_edit) wp-admin/includes/class-wp-posts-list-table.php | Outputs the hidden row displayed when inline editing |
| [WP\_Customize\_Control::render\_content()](../classes/wp_customize_control/render_content) wp-includes/class-wp-customize-control.php | Render the control’s content. |
| Version | Description |
| --- | --- |
| [4.3.0](https://developer.wordpress.org/reference/since/4.3.0/) | The `$class` argument was added. |
| [4.2.0](https://developer.wordpress.org/reference/since/4.2.0/) | The `$value_field` argument was added. |
| [2.1.0](https://developer.wordpress.org/reference/since/2.1.0/) | Introduced. |
wordpress install_network() install\_network()
==================
Install Network.
File: `wp-admin/includes/schema.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/schema.php/)
```
function install_network() {
if ( ! defined( 'WP_INSTALLING_NETWORK' ) ) {
define( 'WP_INSTALLING_NETWORK', true );
}
dbDelta( wp_get_db_schema( 'global' ) );
}
```
| Uses | Description |
| --- | --- |
| [wp\_get\_db\_schema()](wp_get_db_schema) wp-admin/includes/schema.php | Retrieve the SQL for creating database tables. |
| [dbDelta()](dbdelta) wp-admin/includes/upgrade.php | Modifies the database based on specified SQL statements. |
| Version | Description |
| --- | --- |
| [3.0.0](https://developer.wordpress.org/reference/since/3.0.0/) | Introduced. |
wordpress media_upload_header() media\_upload\_header()
=======================
Outputs the legacy media upload header.
File: `wp-admin/includes/media.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/media.php/)
```
function media_upload_header() {
$post_id = isset( $_REQUEST['post_id'] ) ? (int) $_REQUEST['post_id'] : 0;
echo '<script type="text/javascript">post_id = ' . $post_id . ';</script>';
if ( empty( $_GET['chromeless'] ) ) {
echo '<div id="media-upload-header">';
the_media_upload_tabs();
echo '</div>';
}
}
```
| Uses | Description |
| --- | --- |
| [the\_media\_upload\_tabs()](the_media_upload_tabs) wp-admin/includes/media.php | Outputs the legacy media upload tabs UI. |
| Used By | Description |
| --- | --- |
| [media\_upload\_type\_form()](media_upload_type_form) wp-admin/includes/media.php | Outputs the legacy media upload form for a given media type. |
| [media\_upload\_type\_url\_form()](media_upload_type_url_form) wp-admin/includes/media.php | Outputs the legacy media upload form for external media. |
| [media\_upload\_gallery\_form()](media_upload_gallery_form) wp-admin/includes/media.php | Adds gallery form to upload iframe. |
| [media\_upload\_library\_form()](media_upload_library_form) wp-admin/includes/media.php | Outputs the legacy media upload form for the media library. |
| Version | Description |
| --- | --- |
| [2.5.0](https://developer.wordpress.org/reference/since/2.5.0/) | Introduced. |
wordpress wp_underscore_playlist_templates() wp\_underscore\_playlist\_templates()
=====================================
Outputs the templates used by playlists.
File: `wp-includes/media.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/media.php/)
```
function wp_underscore_playlist_templates() {
?>
<script type="text/html" id="tmpl-wp-playlist-current-item">
<# if ( data.thumb && data.thumb.src ) { #>
<img src="{{ data.thumb.src }}" alt="" />
<# } #>
<div class="wp-playlist-caption">
<span class="wp-playlist-item-meta wp-playlist-item-title">
<?php
/* translators: %s: Playlist item title. */
printf( _x( '“%s”', 'playlist item title' ), '{{ data.title }}' );
?>
</span>
<# if ( data.meta.album ) { #><span class="wp-playlist-item-meta wp-playlist-item-album">{{ data.meta.album }}</span><# } #>
<# if ( data.meta.artist ) { #><span class="wp-playlist-item-meta wp-playlist-item-artist">{{ data.meta.artist }}</span><# } #>
</div>
</script>
<script type="text/html" id="tmpl-wp-playlist-item">
<div class="wp-playlist-item">
<a class="wp-playlist-caption" href="{{ data.src }}">
{{ data.index ? ( data.index + '. ' ) : '' }}
<# if ( data.caption ) { #>
{{ data.caption }}
<# } else { #>
<span class="wp-playlist-item-title">
<?php
/* translators: %s: Playlist item title. */
printf( _x( '“%s”', 'playlist item title' ), '{{{ data.title }}}' );
?>
</span>
<# if ( data.artists && data.meta.artist ) { #>
<span class="wp-playlist-item-artist"> — {{ data.meta.artist }}</span>
<# } #>
<# } #>
</a>
<# if ( data.meta.length_formatted ) { #>
<div class="wp-playlist-item-length">{{ data.meta.length_formatted }}</div>
<# } #>
</div>
</script>
<?php
}
```
| Uses | Description |
| --- | --- |
| [\_x()](_x) wp-includes/l10n.php | Retrieves translated string with gettext context. |
| Used By | Description |
| --- | --- |
| [wp\_ajax\_parse\_media\_shortcode()](wp_ajax_parse_media_shortcode) wp-admin/includes/ajax-actions.php | |
| Version | Description |
| --- | --- |
| [3.9.0](https://developer.wordpress.org/reference/since/3.9.0/) | Introduced. |
wordpress rest_validate_array_value_from_schema( mixed $value, array $args, string $param ): true|WP_Error rest\_validate\_array\_value\_from\_schema( mixed $value, array $args, string $param ): true|WP\_Error
======================================================================================================
Validates an array value based on a schema.
`$value` mixed Required The value to validate. `$args` array Required Schema array to use for validation. `$param` string Required The parameter name, used in error messages. true|[WP\_Error](../classes/wp_error)
File: `wp-includes/rest-api.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/rest-api.php/)
```
function rest_validate_array_value_from_schema( $value, $args, $param ) {
if ( ! rest_is_array( $value ) ) {
return new WP_Error(
'rest_invalid_type',
/* translators: 1: Parameter, 2: Type name. */
sprintf( __( '%1$s is not of type %2$s.' ), $param, 'array' ),
array( 'param' => $param )
);
}
$value = rest_sanitize_array( $value );
if ( isset( $args['items'] ) ) {
foreach ( $value as $index => $v ) {
$is_valid = rest_validate_value_from_schema( $v, $args['items'], $param . '[' . $index . ']' );
if ( is_wp_error( $is_valid ) ) {
return $is_valid;
}
}
}
if ( isset( $args['minItems'] ) && count( $value ) < $args['minItems'] ) {
return new WP_Error(
'rest_too_few_items',
sprintf(
/* translators: 1: Parameter, 2: Number. */
_n(
'%1$s must contain at least %2$s item.',
'%1$s must contain at least %2$s items.',
$args['minItems']
),
$param,
number_format_i18n( $args['minItems'] )
)
);
}
if ( isset( $args['maxItems'] ) && count( $value ) > $args['maxItems'] ) {
return new WP_Error(
'rest_too_many_items',
sprintf(
/* translators: 1: Parameter, 2: Number. */
_n(
'%1$s must contain at most %2$s item.',
'%1$s must contain at most %2$s items.',
$args['maxItems']
),
$param,
number_format_i18n( $args['maxItems'] )
)
);
}
if ( ! empty( $args['uniqueItems'] ) && ! rest_validate_array_contains_unique_items( $value ) ) {
/* translators: %s: Parameter. */
return new WP_Error( 'rest_duplicate_items', sprintf( __( '%s has duplicate items.' ), $param ) );
}
return true;
}
```
| Uses | Description |
| --- | --- |
| [rest\_sanitize\_array()](rest_sanitize_array) wp-includes/rest-api.php | Converts an array-like value to an array. |
| [rest\_validate\_array\_contains\_unique\_items()](rest_validate_array_contains_unique_items) wp-includes/rest-api.php | Checks if an array is made up of unique items. |
| [rest\_is\_array()](rest_is_array) wp-includes/rest-api.php | Determines if a given value is array-like. |
| [rest\_validate\_value\_from\_schema()](rest_validate_value_from_schema) wp-includes/rest-api.php | Validate a value based on a schema. |
| [\_n()](_n) wp-includes/l10n.php | Translates and retrieves the singular or plural form based on the supplied number. |
| [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. |
| [number\_format\_i18n()](number_format_i18n) wp-includes/functions.php | Converts float number to format based on the locale. |
| [is\_wp\_error()](is_wp_error) wp-includes/load.php | Checks whether the given variable is a WordPress Error. |
| [WP\_Error::\_\_construct()](../classes/wp_error/__construct) wp-includes/class-wp-error.php | Initializes the error. |
| Used By | Description |
| --- | --- |
| [rest\_validate\_value\_from\_schema()](rest_validate_value_from_schema) wp-includes/rest-api.php | Validate a value based on a schema. |
| Version | Description |
| --- | --- |
| [5.7.0](https://developer.wordpress.org/reference/since/5.7.0/) | Introduced. |
wordpress wp_ajax_delete_tag() wp\_ajax\_delete\_tag()
=======================
Ajax handler for deleting a tag.
File: `wp-admin/includes/ajax-actions.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/ajax-actions.php/)
```
function wp_ajax_delete_tag() {
$tag_id = (int) $_POST['tag_ID'];
check_ajax_referer( "delete-tag_$tag_id" );
if ( ! current_user_can( 'delete_term', $tag_id ) ) {
wp_die( -1 );
}
$taxonomy = ! empty( $_POST['taxonomy'] ) ? $_POST['taxonomy'] : 'post_tag';
$tag = get_term( $tag_id, $taxonomy );
if ( ! $tag || is_wp_error( $tag ) ) {
wp_die( 1 );
}
if ( wp_delete_term( $tag_id, $taxonomy ) ) {
wp_die( 1 );
} else {
wp_die( 0 );
}
}
```
| Uses | Description |
| --- | --- |
| [wp\_delete\_term()](wp_delete_term) wp-includes/taxonomy.php | Removes a term from the database. |
| [current\_user\_can()](current_user_can) wp-includes/capabilities.php | Returns whether the current user has the specified capability. |
| [check\_ajax\_referer()](check_ajax_referer) wp-includes/pluggable.php | Verifies the Ajax request to prevent processing requests external of the blog. |
| [wp\_die()](wp_die) wp-includes/functions.php | Kills WordPress execution and displays HTML page with an error message. |
| [get\_term()](get_term) wp-includes/taxonomy.php | Gets all term data from database by term ID. |
| [is\_wp\_error()](is_wp_error) wp-includes/load.php | Checks whether the given variable is a WordPress Error. |
| Version | Description |
| --- | --- |
| [3.1.0](https://developer.wordpress.org/reference/since/3.1.0/) | Introduced. |
wordpress add_user(): int|WP_Error add\_user(): int|WP\_Error
==========================
Creates a new user from the “Users” form using $\_POST information.
int|[WP\_Error](../classes/wp_error) [WP\_Error](../classes/wp_error) or User ID.
File: `wp-admin/includes/user.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/user.php/)
```
function add_user() {
return edit_user();
}
```
| Uses | Description |
| --- | --- |
| [edit\_user()](edit_user) wp-admin/includes/user.php | Edit user settings based on contents of $\_POST |
| Version | Description |
| --- | --- |
| [2.0.0](https://developer.wordpress.org/reference/since/2.0.0/) | Introduced. |
wordpress wp_rss( string $url, int $num_items = -1 ) wp\_rss( string $url, int $num\_items = -1 )
============================================
Display all RSS items in a HTML ordered list.
`$url` string Required URL of feed to display. Will not auto sense feed URL. `$num_items` int Optional Number of items to display, default is all. Default: `-1`
File: `wp-includes/rss.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/rss.php/)
```
function wp_rss( $url, $num_items = -1 ) {
if ( $rss = fetch_rss( $url ) ) {
echo '<ul>';
if ( $num_items !== -1 ) {
$rss->items = array_slice( $rss->items, 0, $num_items );
}
foreach ( (array) $rss->items as $item ) {
printf(
'<li><a href="%1$s" title="%2$s">%3$s</a></li>',
esc_url( $item['link'] ),
esc_attr( strip_tags( $item['description'] ) ),
esc_html( $item['title'] )
);
}
echo '</ul>';
} else {
_e( 'An error has occurred, which probably means the feed is down. Try again later.' );
}
}
```
| Uses | Description |
| --- | --- |
| [fetch\_rss()](fetch_rss) wp-includes/rss.php | Build Magpie object based on RSS from URL. |
| [\_e()](_e) wp-includes/l10n.php | Displays translated text. |
| [esc\_url()](esc_url) wp-includes/formatting.php | Checks and cleans a URL. |
| [esc\_attr()](esc_attr) wp-includes/formatting.php | Escaping for HTML attributes. |
| [esc\_html()](esc_html) wp-includes/formatting.php | Escaping for HTML blocks. |
| Version | Description |
| --- | --- |
| [1.5.0](https://developer.wordpress.org/reference/since/1.5.0/) | Introduced. |
| programming_docs |
wordpress wp_rel_ugc( string $text ): string wp\_rel\_ugc( string $text ): string
====================================
Adds `rel="nofollow ugc"` string to all HTML A elements in content.
`$text` string Required Content that may contain HTML A elements. string Converted content.
File: `wp-includes/formatting.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/formatting.php/)
```
function wp_rel_ugc( $text ) {
// This is a pre-save filter, so text is already escaped.
$text = stripslashes( $text );
$text = preg_replace_callback(
'|<a (.+?)>|i',
static function( $matches ) {
return wp_rel_callback( $matches, 'nofollow ugc' );
},
$text
);
return wp_slash( $text );
}
```
| Uses | Description |
| --- | --- |
| [wp\_rel\_callback()](wp_rel_callback) wp-includes/formatting.php | Callback to add a rel attribute to HTML A element. |
| [wp\_slash()](wp_slash) wp-includes/formatting.php | Adds slashes to a string or recursively adds slashes to strings within an array. |
| Version | Description |
| --- | --- |
| [5.3.0](https://developer.wordpress.org/reference/since/5.3.0/) | Introduced. |
wordpress get_comment_date( string $format = '', int|WP_Comment $comment_ID ): string get\_comment\_date( string $format = '', int|WP\_Comment $comment\_ID ): string
===============================================================================
Retrieves the comment date of the current comment.
`$format` string Optional PHP date format. Defaults to the `'date_format'` option. Default: `''`
`$comment_ID` int|[WP\_Comment](../classes/wp_comment) Optional [WP\_Comment](../classes/wp_comment) or ID of the comment for which to get the date.
Default current comment. string The comment's date.
The date format can be in a format specified in [Formatting Date and Time](https://wordpress.org/support/article/formatting-date-and-time/)
File: `wp-includes/comment-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/comment-template.php/)
```
function get_comment_date( $format = '', $comment_ID = 0 ) {
$comment = get_comment( $comment_ID );
$_format = ! empty( $format ) ? $format : get_option( 'date_format' );
$date = mysql2date( $_format, $comment->comment_date );
/**
* Filters the returned comment date.
*
* @since 1.5.0
*
* @param string|int $date Formatted date string or Unix timestamp.
* @param string $format PHP date format.
* @param WP_Comment $comment The comment object.
*/
return apply_filters( 'get_comment_date', $date, $format, $comment );
}
```
[apply\_filters( 'get\_comment\_date', string|int $date, string $format, WP\_Comment $comment )](../hooks/get_comment_date)
Filters the returned comment date.
| Uses | Description |
| --- | --- |
| [mysql2date()](mysql2date) wp-includes/functions.php | Converts given MySQL date string into a different format. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| [get\_option()](get_option) wp-includes/option.php | Retrieves an option value based on an option name. |
| [get\_comment()](get_comment) wp-includes/comment.php | Retrieves comment data given a comment ID or comment object. |
| Used By | Description |
| --- | --- |
| [WP\_Comments\_List\_Table::column\_date()](../classes/wp_comments_list_table/column_date) wp-admin/includes/class-wp-comments-list-table.php | |
| [Walker\_Comment::comment()](../classes/walker_comment/comment) wp-includes/class-walker-comment.php | Outputs a single comment. |
| [Walker\_Comment::html5\_comment()](../classes/walker_comment/html5_comment) wp-includes/class-walker-comment.php | Outputs a comment in the HTML5 format. |
| [comment\_date()](comment_date) wp-includes/comment-template.php | Displays the comment date of the current comment. |
| Version | Description |
| --- | --- |
| [4.4.0](https://developer.wordpress.org/reference/since/4.4.0/) | Added the ability for `$comment_ID` to also accept a [WP\_Comment](../classes/wp_comment) object. |
| [1.5.0](https://developer.wordpress.org/reference/since/1.5.0/) | Introduced. |
wordpress post_reply_link( array $args = array(), int|WP_Post $post = null ) post\_reply\_link( array $args = array(), int|WP\_Post $post = null )
=====================================================================
Displays the HTML content for reply to post link.
* [get\_post\_reply\_link()](get_post_reply_link)
`$args` array Optional Override default options. Default: `array()`
`$post` int|[WP\_Post](../classes/wp_post) Optional Post ID or [WP\_Post](../classes/wp_post) object the comment is going to be displayed on.
Default current post. Default: `null`
File: `wp-includes/comment-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/comment-template.php/)
```
function post_reply_link( $args = array(), $post = null ) {
echo get_post_reply_link( $args, $post );
}
```
| Uses | Description |
| --- | --- |
| [get\_post\_reply\_link()](get_post_reply_link) wp-includes/comment-template.php | Retrieves HTML content for reply to post link. |
| Version | Description |
| --- | --- |
| [2.7.0](https://developer.wordpress.org/reference/since/2.7.0/) | Introduced. |
wordpress get_category_to_edit( int $id ): object get\_category\_to\_edit( int $id ): object
==========================================
Gets category object for given ID and ‘edit’ filter context.
`$id` int Required object
File: `wp-admin/includes/taxonomy.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/taxonomy.php/)
```
function get_category_to_edit( $id ) {
$category = get_term( $id, 'category', OBJECT, 'edit' );
_make_cat_compat( $category );
return $category;
}
```
| Uses | Description |
| --- | --- |
| [\_make\_cat\_compat()](_make_cat_compat) wp-includes/category.php | Updates category structure to old pre-2.3 from new taxonomy structure. |
| [get\_term()](get_term) wp-includes/taxonomy.php | Gets all term data from database by term ID. |
| Version | Description |
| --- | --- |
| [2.0.0](https://developer.wordpress.org/reference/since/2.0.0/) | Introduced. |
wordpress get_category_children( int $id, string $before = '/', string $after = '', array $visited = array() ): string get\_category\_children( int $id, string $before = '/', string $after = '', array $visited = array() ): string
==============================================================================================================
This function has been deprecated. Use [get\_term\_children()](get_term_children) instead.
Retrieve category children list separated before and after the term IDs.
* [get\_term\_children()](get_term_children)
`$id` int Required Category ID to retrieve children. `$before` string Optional Prepend before category term ID. Default `'/'`. Default: `'/'`
`$after` string Optional Append after category term ID. Default: `''`
`$visited` array Optional Category Term IDs that have already been added.
Default: `array()`
string
File: `wp-includes/deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/deprecated.php/)
```
function get_category_children( $id, $before = '/', $after = '', $visited = array() ) {
_deprecated_function( __FUNCTION__, '2.8.0', 'get_term_children()' );
if ( 0 == $id )
return '';
$chain = '';
/** TODO: Consult hierarchy */
$cat_ids = get_all_category_ids();
foreach ( (array) $cat_ids as $cat_id ) {
if ( $cat_id == $id )
continue;
$category = get_category( $cat_id );
if ( is_wp_error( $category ) )
return $category;
if ( $category->parent == $id && !in_array( $category->term_id, $visited ) ) {
$visited[] = $category->term_id;
$chain .= $before.$category->term_id.$after;
$chain .= get_category_children( $category->term_id, $before, $after );
}
}
return $chain;
}
```
| Uses | Description |
| --- | --- |
| [get\_category\_children()](get_category_children) wp-includes/deprecated.php | Retrieve category children list separated before and after the term IDs. |
| [get\_all\_category\_ids()](get_all_category_ids) wp-includes/deprecated.php | Retrieves all category IDs. |
| [get\_category()](get_category) wp-includes/category.php | Retrieves category data given a category ID or category object. |
| [\_deprecated\_function()](_deprecated_function) wp-includes/functions.php | Marks a function as deprecated and inform when it has been used. |
| [is\_wp\_error()](is_wp_error) wp-includes/load.php | Checks whether the given variable is a WordPress Error. |
| Used By | Description |
| --- | --- |
| [get\_category\_children()](get_category_children) wp-includes/deprecated.php | Retrieve category children list separated before and after the term IDs. |
| Version | Description |
| --- | --- |
| [2.8.0](https://developer.wordpress.org/reference/since/2.8.0/) | Use [get\_term\_children()](get_term_children) |
| [1.2.0](https://developer.wordpress.org/reference/since/1.2.0/) | Introduced. |
wordpress get_post_status( int|WP_Post $post = null ): string|false get\_post\_status( int|WP\_Post $post = null ): string|false
============================================================
Retrieves 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.
`$post` int|[WP\_Post](../classes/wp_post) Optional Post ID or post object. Defaults to global $post. Default: `null`
string|false Post status on success, false on failure.
File: `wp-includes/post.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/post.php/)
```
function get_post_status( $post = null ) {
$post = get_post( $post );
if ( ! is_object( $post ) ) {
return false;
}
$post_status = $post->post_status;
if (
'attachment' === $post->post_type &&
'inherit' === $post_status
) {
if (
0 === $post->post_parent ||
! get_post( $post->post_parent ) ||
$post->ID === $post->post_parent
) {
// Unattached attachments with inherit status are assumed to be published.
$post_status = 'publish';
} elseif ( 'trash' === get_post_status( $post->post_parent ) ) {
// Get parent status prior to trashing.
$post_status = get_post_meta( $post->post_parent, '_wp_trash_meta_status', true );
if ( ! $post_status ) {
// Assume publish as above.
$post_status = 'publish';
}
} else {
$post_status = get_post_status( $post->post_parent );
}
} elseif (
'attachment' === $post->post_type &&
! in_array( $post_status, array( 'private', 'trash', 'auto-draft' ), true )
) {
/*
* Ensure uninherited attachments have a permitted status either 'private', 'trash', 'auto-draft'.
* This is to match the logic in wp_insert_post().
*
* Note: 'inherit' is excluded from this check as it is resolved to the parent post's
* status in the logic block above.
*/
$post_status = 'publish';
}
/**
* Filters the post status.
*
* @since 4.4.0
* @since 5.7.0 The attachment post type is now passed through this filter.
*
* @param string $post_status The post status.
* @param WP_Post $post The post object.
*/
return apply_filters( 'get_post_status', $post_status, $post );
}
```
[apply\_filters( 'get\_post\_status', string $post\_status, WP\_Post $post )](../hooks/get_post_status)
Filters the post status.
| Uses | Description |
| --- | --- |
| [get\_post\_status()](get_post_status) wp-includes/post.php | Retrieves the post status based on the post ID. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| [get\_post\_meta()](get_post_meta) wp-includes/post.php | Retrieves a post meta field for the given post ID. |
| [get\_post()](get_post) wp-includes/post.php | Retrieves post data given a post ID or post object. |
| Used By | Description |
| --- | --- |
| [wp\_force\_plain\_post\_permalink()](wp_force_plain_post_permalink) wp-includes/link-template.php | Determine whether post should always use a plain permalink structure. |
| [is\_post\_publicly\_viewable()](is_post_publicly_viewable) wp-includes/post.php | Determines whether a post is publicly viewable. |
| [the\_block\_editor\_meta\_box\_post\_form\_hidden\_fields()](the_block_editor_meta_box_post_form_hidden_fields) wp-admin/includes/post.php | Renders the hidden form required for the meta boxes form. |
| [register\_and\_do\_post\_meta\_boxes()](register_and_do_post_meta_boxes) wp-admin/includes/meta-boxes.php | Registers the default post meta boxes, and runs the `do_meta_boxes` actions. |
| [get\_privacy\_policy\_url()](get_privacy_policy_url) wp-includes/link-template.php | Retrieves the URL to the privacy policy page. |
| [WP\_Privacy\_Requests\_Table::column\_status()](../classes/wp_privacy_requests_table/column_status) wp-admin/includes/class-wp-privacy-requests-table.php | Status column. |
| [WP\_Customize\_Manager::handle\_dismiss\_autosave\_or\_lock\_request()](../classes/wp_customize_manager/handle_dismiss_autosave_or_lock_request) wp-includes/class-wp-customize-manager.php | Deletes a given auto-draft changeset or the autosave revision for a given changeset or delete changeset lock. |
| [WP\_Customize\_Manager::trash\_changeset\_post()](../classes/wp_customize_manager/trash_changeset_post) wp-includes/class-wp-customize-manager.php | Trashes or deletes a changeset post. |
| [WP\_Customize\_Manager::handle\_changeset\_trash\_request()](../classes/wp_customize_manager/handle_changeset_trash_request) wp-includes/class-wp-customize-manager.php | Handles request to trash a changeset. |
| [\_wp\_keep\_alive\_customize\_changeset\_dependent\_auto\_drafts()](_wp_keep_alive_customize_changeset_dependent_auto_drafts) wp-includes/theme.php | Makes sure that auto-draft posts get their post\_date bumped or status changed to draft to prevent premature garbage-collection. |
| [\_wp\_delete\_customize\_changeset\_dependent\_auto\_drafts()](_wp_delete_customize_changeset_dependent_auto_drafts) wp-includes/nav-menu.php | Deletes auto-draft posts associated with the supplied changeset. |
| [WP\_Customize\_Manager::save\_changeset\_post()](../classes/wp_customize_manager/save_changeset_post) wp-includes/class-wp-customize-manager.php | Saves the post for the loaded changeset. |
| [WP\_Customize\_Manager::import\_theme\_starter\_content()](../classes/wp_customize_manager/import_theme_starter_content) wp-includes/class-wp-customize-manager.php | Imports theme starter content into the customized state. |
| [WP\_Customize\_Nav\_Menus::save\_nav\_menus\_created\_posts()](../classes/wp_customize_nav_menus/save_nav_menus_created_posts) wp-includes/class-wp-customize-nav-menus.php | Publishes the auto-draft posts that were created for nav menu items. |
| [wp\_handle\_comment\_submission()](wp_handle_comment_submission) wp-includes/comment.php | Handles the submission of a comment, usually posted to wp-comments-post.php via a comment form. |
| [WP\_List\_Table::comments\_bubble()](../classes/wp_list_table/comments_bubble) wp-admin/includes/class-wp-list-table.php | Displays a comment count bubble. |
| [redirect\_post()](redirect_post) wp-admin/includes/post.php | Redirects to previous page. |
| [map\_meta\_cap()](map_meta_cap) wp-includes/capabilities.php | Maps a capability to the primitive capabilities required of the given user to satisfy the capability being checked. |
| [WP\_Query::get\_posts()](../classes/wp_query/get_posts) wp-includes/class-wp-query.php | Retrieves an array of posts based on query variables. |
| [wp\_set\_post\_categories()](wp_set_post_categories) wp-includes/post.php | Sets categories for a post. |
| [wp\_delete\_post()](wp_delete_post) wp-includes/post.php | Trashes or deletes a post or page. |
| [get\_post\_status()](get_post_status) wp-includes/post.php | Retrieves the post status based on the post ID. |
| [redirect\_canonical()](redirect_canonical) wp-includes/canonical.php | Redirects incoming links to the proper URL based on the site url. |
| [wp\_setup\_nav\_menu\_item()](wp_setup_nav_menu_item) wp-includes/nav-menu.php | Decorates a menu item object with the shared navigation menu item properties. |
| [wp\_xmlrpc\_server::wp\_newComment()](../classes/wp_xmlrpc_server/wp_newcomment) wp-includes/class-wp-xmlrpc-server.php | Create new comment. |
| Version | Description |
| --- | --- |
| [2.0.0](https://developer.wordpress.org/reference/since/2.0.0/) | Introduced. |
wordpress wp_set_comment_cookies( WP_Comment $comment, WP_User $user, bool $cookies_consent = true ) wp\_set\_comment\_cookies( WP\_Comment $comment, WP\_User $user, bool $cookies\_consent = true )
================================================================================================
Sets the cookies used to store an unauthenticated commentator’s identity. Typically used to recall previous comments by this commentator that are still held in moderation.
`$comment` [WP\_Comment](../classes/wp_comment) Required Comment object. `$user` [WP\_User](../classes/wp_user) Required Comment author's user object. The user may not exist. `$cookies_consent` bool Optional Comment author's consent to store cookies. Default: `true`
File: `wp-includes/comment.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/comment.php/)
```
function wp_set_comment_cookies( $comment, $user, $cookies_consent = true ) {
// If the user already exists, or the user opted out of cookies, don't set cookies.
if ( $user->exists() ) {
return;
}
if ( false === $cookies_consent ) {
// Remove any existing cookies.
$past = time() - YEAR_IN_SECONDS;
setcookie( 'comment_author_' . COOKIEHASH, ' ', $past, COOKIEPATH, COOKIE_DOMAIN );
setcookie( 'comment_author_email_' . COOKIEHASH, ' ', $past, COOKIEPATH, COOKIE_DOMAIN );
setcookie( 'comment_author_url_' . COOKIEHASH, ' ', $past, COOKIEPATH, COOKIE_DOMAIN );
return;
}
/**
* Filters the lifetime of the comment cookie in seconds.
*
* @since 2.8.0
*
* @param int $seconds Comment cookie lifetime. Default 30000000.
*/
$comment_cookie_lifetime = time() + apply_filters( 'comment_cookie_lifetime', 30000000 );
$secure = ( 'https' === parse_url( home_url(), PHP_URL_SCHEME ) );
setcookie( 'comment_author_' . COOKIEHASH, $comment->comment_author, $comment_cookie_lifetime, COOKIEPATH, COOKIE_DOMAIN, $secure );
setcookie( 'comment_author_email_' . COOKIEHASH, $comment->comment_author_email, $comment_cookie_lifetime, COOKIEPATH, COOKIE_DOMAIN, $secure );
setcookie( 'comment_author_url_' . COOKIEHASH, esc_url( $comment->comment_author_url ), $comment_cookie_lifetime, COOKIEPATH, COOKIE_DOMAIN, $secure );
}
```
[apply\_filters( 'comment\_cookie\_lifetime', int $seconds )](../hooks/comment_cookie_lifetime)
Filters the lifetime of the comment cookie in seconds.
| Uses | Description |
| --- | --- |
| [esc\_url()](esc_url) wp-includes/formatting.php | Checks and cleans a URL. |
| [home\_url()](home_url) wp-includes/link-template.php | Retrieves the URL for the current site where the front end is accessible. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| Version | Description |
| --- | --- |
| [4.9.6](https://developer.wordpress.org/reference/since/4.9.6/) | The `$cookies_consent` parameter was added. |
| [3.4.0](https://developer.wordpress.org/reference/since/3.4.0/) | Introduced. |
wordpress get_tags_to_edit( int $post_id, string $taxonomy = 'post_tag' ): string|false|WP_Error get\_tags\_to\_edit( int $post\_id, string $taxonomy = 'post\_tag' ): string|false|WP\_Error
============================================================================================
Gets comma-separated list of tags available to edit.
`$post_id` int Required `$taxonomy` string Optional The taxonomy for which to retrieve terms. Default `'post_tag'`. Default: `'post_tag'`
string|false|[WP\_Error](../classes/wp_error)
File: `wp-admin/includes/taxonomy.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/taxonomy.php/)
```
function get_tags_to_edit( $post_id, $taxonomy = 'post_tag' ) {
return get_terms_to_edit( $post_id, $taxonomy );
}
```
| Uses | Description |
| --- | --- |
| [get\_terms\_to\_edit()](get_terms_to_edit) wp-admin/includes/taxonomy.php | Gets comma-separated list of terms available to edit for the given post ID. |
| Version | Description |
| --- | --- |
| [2.3.0](https://developer.wordpress.org/reference/since/2.3.0/) | Introduced. |
| programming_docs |
wordpress wp_network_admin_email_change_notification( string $option_name, string $new_email, string $old_email, int $network_id ) wp\_network\_admin\_email\_change\_notification( string $option\_name, string $new\_email, string $old\_email, int $network\_id )
=================================================================================================================================
Sends an email to the old network admin email address when the network admin email address changes.
`$option_name` string Required The relevant database option name. `$new_email` string Required The new network admin email address. `$old_email` string Required The old network admin email address. `$network_id` int Required ID of the network. File: `wp-includes/ms-functions.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/ms-functions.php/)
```
function wp_network_admin_email_change_notification( $option_name, $new_email, $old_email, $network_id ) {
$send = true;
// Don't send the notification to the default 'admin_email' value.
if ( '[email protected]' === $old_email ) {
$send = false;
}
/**
* Filters whether to send the network admin email change notification email.
*
* @since 4.9.0
*
* @param bool $send Whether to send the email notification.
* @param string $old_email The old network admin email address.
* @param string $new_email The new network admin email address.
* @param int $network_id ID of the network.
*/
$send = apply_filters( 'send_network_admin_email_change_email', $send, $old_email, $new_email, $network_id );
if ( ! $send ) {
return;
}
/* translators: Do not translate OLD_EMAIL, NEW_EMAIL, SITENAME, SITEURL: those are placeholders. */
$email_change_text = __(
'Hi,
This notice confirms that the network admin email address was changed on ###SITENAME###.
The new network admin email address is ###NEW_EMAIL###.
This email has been sent to ###OLD_EMAIL###
Regards,
All at ###SITENAME###
###SITEURL###'
);
$email_change_email = array(
'to' => $old_email,
/* translators: Network admin email change notification email subject. %s: Network title. */
'subject' => __( '[%s] Network Admin Email Changed' ),
'message' => $email_change_text,
'headers' => '',
);
// Get network name.
$network_name = wp_specialchars_decode( get_site_option( 'site_name' ), ENT_QUOTES );
/**
* Filters the contents of the email notification sent when the network admin email address is changed.
*
* @since 4.9.0
*
* @param array $email_change_email {
* Used to build wp_mail().
*
* @type string $to The intended recipient.
* @type string $subject The subject of the email.
* @type string $message The content of the email.
* The following strings have a special meaning and will get replaced dynamically:
* - ###OLD_EMAIL### The old network admin email address.
* - ###NEW_EMAIL### The new network admin email address.
* - ###SITENAME### The name of the network.
* - ###SITEURL### The URL to the site.
* @type string $headers Headers.
* }
* @param string $old_email The old network admin email address.
* @param string $new_email The new network admin email address.
* @param int $network_id ID of the network.
*/
$email_change_email = apply_filters( 'network_admin_email_change_email', $email_change_email, $old_email, $new_email, $network_id );
$email_change_email['message'] = str_replace( '###OLD_EMAIL###', $old_email, $email_change_email['message'] );
$email_change_email['message'] = str_replace( '###NEW_EMAIL###', $new_email, $email_change_email['message'] );
$email_change_email['message'] = str_replace( '###SITENAME###', $network_name, $email_change_email['message'] );
$email_change_email['message'] = str_replace( '###SITEURL###', home_url(), $email_change_email['message'] );
wp_mail(
$email_change_email['to'],
sprintf(
$email_change_email['subject'],
$network_name
),
$email_change_email['message'],
$email_change_email['headers']
);
}
```
[apply\_filters( 'network\_admin\_email\_change\_email', array $email\_change\_email, string $old\_email, string $new\_email, int $network\_id )](../hooks/network_admin_email_change_email)
Filters the contents of the email notification sent when the network admin email address is changed.
[apply\_filters( 'send\_network\_admin\_email\_change\_email', bool $send, string $old\_email, string $new\_email, int $network\_id )](../hooks/send_network_admin_email_change_email)
Filters whether to send the network admin email change notification email.
| Uses | Description |
| --- | --- |
| [wp\_specialchars\_decode()](wp_specialchars_decode) wp-includes/formatting.php | Converts a number of HTML entities into their special characters. |
| [wp\_mail()](wp_mail) wp-includes/pluggable.php | Sends an email, similar to PHP’s mail function. |
| [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. |
| [home\_url()](home_url) wp-includes/link-template.php | Retrieves the URL for the current site where the front end is accessible. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| [get\_site\_option()](get_site_option) wp-includes/option.php | Retrieve an option value for the current network based on name of option. |
| Version | Description |
| --- | --- |
| [4.9.0](https://developer.wordpress.org/reference/since/4.9.0/) | Introduced. |
wordpress paginate_comments_links( string|array $args = array() ): void|string|array paginate\_comments\_links( string|array $args = array() ): void|string|array
============================================================================
Displays or retrieves pagination links for the comments on the current post.
* [paginate\_links()](paginate_links)
`$args` string|array Optional args. See [paginate\_links()](paginate_links) . More Arguments from paginate\_links( ... $args ) Array or string of arguments for generating paginated links for archives.
* `base`stringBase of the paginated url.
* `format`stringFormat for the pagination structure.
* `total`intThe total amount of pages. Default is the value [WP\_Query](../classes/wp_query)'s `max_num_pages` or 1.
* `current`intThe current page number. Default is `'paged'` query var or 1.
* `aria_current`stringThe value for the aria-current attribute. Possible values are `'page'`, `'step'`, `'location'`, `'date'`, `'time'`, `'true'`, `'false'`. Default is `'page'`.
* `show_all`boolWhether to show all pages. Default false.
* `end_size`intHow many numbers on either the start and the end list edges.
Default 1.
* `mid_size`intHow many numbers to either side of the current pages. Default 2.
* `prev_next`boolWhether to include the previous and next links in the list. Default true.
* `prev_text`stringThe previous page text. Default '« Previous'.
* `next_text`stringThe next page text. Default 'Next »'.
* `type`stringControls format of the returned value. Possible values are `'plain'`, `'array'` and `'list'`. Default is `'plain'`.
* `add_args`arrayAn array of query args to add. Default false.
* `add_fragment`stringA string to append to each link.
* `before_page_number`stringA string to appear before the page number.
* `after_page_number`stringA string to append after the page number.
Default: `array()`
void|string|array Void if `'echo'` argument is true and `'type'` is not an array, or if the query is not for an existing single post of any post type.
Otherwise, markup for comment page links or array of comment page links, depending on `'type'` argument.
**Defaults**
`$args = array(
'base' => add_query_arg( 'cpage', '%#%' ),
'format' => '',
'total' => $max_page,
'current' => $page,
'echo' => true,
'add_fragment' => '#comments'
);`
Arguments passed in are merged to the defaults, via [wp\_parse\_args()](wp_parse_args) .
These arguments are mostly to make the call of `paginate_links()` work, so be careful if you change them.
File: `wp-includes/link-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/link-template.php/)
```
function paginate_comments_links( $args = array() ) {
global $wp_rewrite;
if ( ! is_singular() ) {
return;
}
$page = get_query_var( 'cpage' );
if ( ! $page ) {
$page = 1;
}
$max_page = get_comment_pages_count();
$defaults = array(
'base' => add_query_arg( 'cpage', '%#%' ),
'format' => '',
'total' => $max_page,
'current' => $page,
'echo' => true,
'type' => 'plain',
'add_fragment' => '#comments',
);
if ( $wp_rewrite->using_permalinks() ) {
$defaults['base'] = user_trailingslashit( trailingslashit( get_permalink() ) . $wp_rewrite->comments_pagination_base . '-%#%', 'commentpaged' );
}
$args = wp_parse_args( $args, $defaults );
$page_links = paginate_links( $args );
if ( $args['echo'] && 'array' !== $args['type'] ) {
echo $page_links;
} else {
return $page_links;
}
}
```
| Uses | Description |
| --- | --- |
| [paginate\_links()](paginate_links) wp-includes/general-template.php | Retrieves paginated links for archive post pages. |
| [is\_singular()](is_singular) wp-includes/query.php | Determines whether the query is for an existing single post of any post type (post, attachment, page, custom post types). |
| [get\_query\_var()](get_query_var) wp-includes/query.php | Retrieves the value of a query variable in the [WP\_Query](../classes/wp_query) class. |
| [user\_trailingslashit()](user_trailingslashit) wp-includes/link-template.php | Retrieves a trailing-slashed string if the site is set for adding trailing slashes. |
| [WP\_Rewrite::using\_permalinks()](../classes/wp_rewrite/using_permalinks) wp-includes/class-wp-rewrite.php | Determines whether permalinks are being used. |
| [get\_comment\_pages\_count()](get_comment_pages_count) wp-includes/comment.php | Calculates the total number of comment pages. |
| [trailingslashit()](trailingslashit) wp-includes/formatting.php | Appends a trailing slash. |
| [wp\_parse\_args()](wp_parse_args) wp-includes/functions.php | Merges user defined arguments into defaults array. |
| [add\_query\_arg()](add_query_arg) wp-includes/functions.php | Retrieves a modified URL query string. |
| [get\_permalink()](get_permalink) wp-includes/link-template.php | Retrieves the full permalink for the current post or post ID. |
| Used By | Description |
| --- | --- |
| [get\_the\_comments\_pagination()](get_the_comments_pagination) wp-includes/link-template.php | Retrieves a paginated navigation to next/previous set of comments, when applicable. |
| Version | Description |
| --- | --- |
| [2.7.0](https://developer.wordpress.org/reference/since/2.7.0/) | Introduced. |
wordpress _wp_batch_split_terms() \_wp\_batch\_split\_terms()
===========================
Splits a batch of shared taxonomy terms.
File: `wp-includes/taxonomy.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/taxonomy.php/)
```
function _wp_batch_split_terms() {
global $wpdb;
$lock_name = 'term_split.lock';
// Try to lock.
$lock_result = $wpdb->query( $wpdb->prepare( "INSERT IGNORE INTO `$wpdb->options` ( `option_name`, `option_value`, `autoload` ) VALUES (%s, %s, 'no') /* LOCK */", $lock_name, time() ) );
if ( ! $lock_result ) {
$lock_result = get_option( $lock_name );
// Bail if we were unable to create a lock, or if the existing lock is still valid.
if ( ! $lock_result || ( $lock_result > ( time() - HOUR_IN_SECONDS ) ) ) {
wp_schedule_single_event( time() + ( 5 * MINUTE_IN_SECONDS ), 'wp_split_shared_term_batch' );
return;
}
}
// Update the lock, as by this point we've definitely got a lock, just need to fire the actions.
update_option( $lock_name, time() );
// Get a list of shared terms (those with more than one associated row in term_taxonomy).
$shared_terms = $wpdb->get_results(
"SELECT tt.term_id, t.*, count(*) as term_tt_count FROM {$wpdb->term_taxonomy} tt
LEFT JOIN {$wpdb->terms} t ON t.term_id = tt.term_id
GROUP BY t.term_id
HAVING term_tt_count > 1
LIMIT 10"
);
// No more terms, we're done here.
if ( ! $shared_terms ) {
update_option( 'finished_splitting_shared_terms', true );
delete_option( $lock_name );
return;
}
// Shared terms found? We'll need to run this script again.
wp_schedule_single_event( time() + ( 2 * MINUTE_IN_SECONDS ), 'wp_split_shared_term_batch' );
// Rekey shared term array for faster lookups.
$_shared_terms = array();
foreach ( $shared_terms as $shared_term ) {
$term_id = (int) $shared_term->term_id;
$_shared_terms[ $term_id ] = $shared_term;
}
$shared_terms = $_shared_terms;
// Get term taxonomy data for all shared terms.
$shared_term_ids = implode( ',', array_keys( $shared_terms ) );
$shared_tts = $wpdb->get_results( "SELECT * FROM {$wpdb->term_taxonomy} WHERE `term_id` IN ({$shared_term_ids})" );
// Split term data recording is slow, so we do it just once, outside the loop.
$split_term_data = get_option( '_split_terms', array() );
$skipped_first_term = array();
$taxonomies = array();
foreach ( $shared_tts as $shared_tt ) {
$term_id = (int) $shared_tt->term_id;
// Don't split the first tt belonging to a given term_id.
if ( ! isset( $skipped_first_term[ $term_id ] ) ) {
$skipped_first_term[ $term_id ] = 1;
continue;
}
if ( ! isset( $split_term_data[ $term_id ] ) ) {
$split_term_data[ $term_id ] = array();
}
// Keep track of taxonomies whose hierarchies need flushing.
if ( ! isset( $taxonomies[ $shared_tt->taxonomy ] ) ) {
$taxonomies[ $shared_tt->taxonomy ] = 1;
}
// Split the term.
$split_term_data[ $term_id ][ $shared_tt->taxonomy ] = _split_shared_term( $shared_terms[ $term_id ], $shared_tt, false );
}
// Rebuild the cached hierarchy for each affected taxonomy.
foreach ( array_keys( $taxonomies ) as $tax ) {
delete_option( "{$tax}_children" );
_get_term_hierarchy( $tax );
}
update_option( '_split_terms', $split_term_data );
delete_option( $lock_name );
}
```
| Uses | Description |
| --- | --- |
| [wp\_schedule\_single\_event()](wp_schedule_single_event) wp-includes/cron.php | Schedules an event to run only once. |
| [\_get\_term\_hierarchy()](_get_term_hierarchy) wp-includes/taxonomy.php | Retrieves children of taxonomy as term IDs. |
| [delete\_option()](delete_option) wp-includes/option.php | Removes option by name. Prevents removal of protected WordPress options. |
| [wpdb::query()](../classes/wpdb/query) wp-includes/class-wpdb.php | Performs a database query, using current database connection. |
| [update\_option()](update_option) wp-includes/option.php | Updates the value of an option that was already added. |
| [get\_option()](get_option) wp-includes/option.php | Retrieves an option value based on an option name. |
| [wpdb::get\_results()](../classes/wpdb/get_results) wp-includes/class-wpdb.php | Retrieves an entire SQL result set from the database (i.e., many rows). |
| [wpdb::prepare()](../classes/wpdb/prepare) wp-includes/class-wpdb.php | Prepares a SQL query for safe execution. |
| Version | Description |
| --- | --- |
| [4.3.0](https://developer.wordpress.org/reference/since/4.3.0/) | Introduced. |
wordpress wp_specialchars_decode( string $string, string|int $quote_style = ENT_NOQUOTES ): string wp\_specialchars\_decode( string $string, string|int $quote\_style = ENT\_NOQUOTES ): string
============================================================================================
Converts a number of HTML entities into their special characters.
Specifically deals with: `&`, `<`, `>`, `"`, and `'`.
`$quote_style` can be set to ENT\_COMPAT to decode `"` entities, or ENT\_QUOTES to do both `"` and `'`. Default is ENT\_NOQUOTES where no quotes are decoded.
`$string` string Required The text which is to be decoded. `$quote_style` string|int Optional Converts double quotes if set to ENT\_COMPAT, both single and double if set to ENT\_QUOTES or none if set to ENT\_NOQUOTES.
Also compatible with old [\_wp\_specialchars()](_wp_specialchars) values; converting single quotes if set to `'single'`, double if set to `'double'` or both if otherwise set.
Default is ENT\_NOQUOTES. More Arguments from \_wp\_specialchars( ... $quote\_style ) Converts double quotes if set to ENT\_COMPAT, both single and double if set to ENT\_QUOTES or none if set to ENT\_NOQUOTES.
Converts single and double quotes, as well as converting HTML named entities (that are not also XML named entities) to their code points if set to ENT\_XML1. Also compatible with old values; converting single quotes if set to `'single'`, double if set to `'double'` or both if otherwise set.
Default is ENT\_NOQUOTES. Default: `ENT_NOQUOTES`
string The decoded text without HTML entities.
File: `wp-includes/formatting.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/formatting.php/)
```
function wp_specialchars_decode( $string, $quote_style = ENT_NOQUOTES ) {
$string = (string) $string;
if ( 0 === strlen( $string ) ) {
return '';
}
// Don't bother if there are no entities - saves a lot of processing.
if ( strpos( $string, '&' ) === false ) {
return $string;
}
// Match the previous behaviour of _wp_specialchars() when the $quote_style is not an accepted value.
if ( empty( $quote_style ) ) {
$quote_style = ENT_NOQUOTES;
} elseif ( ! in_array( $quote_style, array( 0, 2, 3, 'single', 'double' ), true ) ) {
$quote_style = ENT_QUOTES;
}
// More complete than get_html_translation_table( HTML_SPECIALCHARS ).
$single = array(
''' => '\'',
''' => '\'',
);
$single_preg = array(
'/�*39;/' => ''',
'/�*27;/i' => ''',
);
$double = array(
'"' => '"',
'"' => '"',
'"' => '"',
);
$double_preg = array(
'/�*34;/' => '"',
'/�*22;/i' => '"',
);
$others = array(
'<' => '<',
'<' => '<',
'>' => '>',
'>' => '>',
'&' => '&',
'&' => '&',
'&' => '&',
);
$others_preg = array(
'/�*60;/' => '<',
'/�*62;/' => '>',
'/�*38;/' => '&',
'/�*26;/i' => '&',
);
if ( ENT_QUOTES === $quote_style ) {
$translation = array_merge( $single, $double, $others );
$translation_preg = array_merge( $single_preg, $double_preg, $others_preg );
} elseif ( ENT_COMPAT === $quote_style || 'double' === $quote_style ) {
$translation = array_merge( $double, $others );
$translation_preg = array_merge( $double_preg, $others_preg );
} elseif ( 'single' === $quote_style ) {
$translation = array_merge( $single, $others );
$translation_preg = array_merge( $single_preg, $others_preg );
} elseif ( ENT_NOQUOTES === $quote_style ) {
$translation = $others;
$translation_preg = $others_preg;
}
// Remove zero padding on numeric entities.
$string = preg_replace( array_keys( $translation_preg ), array_values( $translation_preg ), $string );
// Replace characters according to translation table.
return strtr( $string, $translation );
}
```
| Used By | Description |
| --- | --- |
| [wpmu\_new\_site\_admin\_notification()](wpmu_new_site_admin_notification) wp-includes/ms-functions.php | Notifies the Multisite network administrator that a new site was created. |
| [WP\_Automatic\_Updater::send\_plugin\_theme\_email()](../classes/wp_automatic_updater/send_plugin_theme_email) wp-admin/includes/class-wp-automatic-updater.php | Sends an email upon the completion or failure of a plugin or theme background update. |
| [WP\_Recovery\_Mode\_Email\_Service::send\_recovery\_mode\_email()](../classes/wp_recovery_mode_email_service/send_recovery_mode_email) wp-includes/class-wp-recovery-mode-email-service.php | Sends the Recovery Mode email to the site admin email address. |
| [\_wp\_privacy\_send\_request\_confirmation\_notification()](_wp_privacy_send_request_confirmation_notification) wp-includes/user.php | Notifies the site administrator via email when a request is confirmed. |
| [\_wp\_privacy\_send\_erasure\_fulfillment\_notification()](_wp_privacy_send_erasure_fulfillment_notification) wp-includes/user.php | Notifies the user when their erasure request is fulfilled. |
| [wp\_send\_user\_request()](wp_send_user_request) wp-includes/user.php | Send a confirmation request email to confirm an action. |
| [wp\_privacy\_send\_personal\_data\_export\_email()](wp_privacy_send_personal_data_export_email) wp-admin/includes/privacy-tools.php | Send an email to the user with a link to the personal data export file |
| [wp\_site\_admin\_email\_change\_notification()](wp_site_admin_email_change_notification) wp-includes/functions.php | Sends an email to the old site admin email address when the site admin email address changes. |
| [update\_network\_option\_new\_admin\_email()](update_network_option_new_admin_email) wp-includes/ms-functions.php | Sends a confirmation request email when a change of network admin email address is attempted. |
| [wp\_network\_admin\_email\_change\_notification()](wp_network_admin_email_change_notification) wp-includes/ms-functions.php | Sends an email to the old network admin email address when the network admin email address changes. |
| [retrieve\_password()](retrieve_password) wp-includes/user.php | Handles sending a password retrieval email to a user. |
| [WP\_Automatic\_Updater::send\_email()](../classes/wp_automatic_updater/send_email) wp-admin/includes/class-wp-automatic-updater.php | Sends an email upon the completion or failure of a background core update. |
| [WP\_Automatic\_Updater::send\_debug\_email()](../classes/wp_automatic_updater/send_debug_email) wp-admin/includes/class-wp-automatic-updater.php | Prepares and sends an email of a full log of background update results, useful for debugging and geekery. |
| [update\_option\_new\_admin\_email()](update_option_new_admin_email) wp-admin/includes/misc.php | Sends a confirmation request email when a change of site admin email address is attempted. |
| [send\_confirmation\_on\_profile\_email()](send_confirmation_on_profile_email) wp-includes/user.php | Sends a confirmation request email when a change of user email address is attempted. |
| [admin\_created\_user\_email()](admin_created_user_email) wp-admin/includes/user.php | |
| [wp\_password\_change\_notification()](wp_password_change_notification) wp-includes/pluggable.php | Notifies the blog admin of a user changing password, normally via email. |
| [wp\_new\_user\_notification()](wp_new_user_notification) wp-includes/pluggable.php | Emails login credentials to a newly-registered user. |
| [wp\_notify\_postauthor()](wp_notify_postauthor) wp-includes/pluggable.php | Notifies an author (and/or others) of a comment/trackback/pingback on a post. |
| [wp\_notify\_moderator()](wp_notify_moderator) wp-includes/pluggable.php | Notifies the moderator of the site about a new comment that is awaiting approval. |
| [wp\_update\_user()](wp_update_user) wp-includes/user.php | Updates a user in the database. |
| [wpmu\_welcome\_user\_notification()](wpmu_welcome_user_notification) wp-includes/ms-functions.php | Notifies a user that their account activation has been successful. |
| [wpmu\_welcome\_notification()](wpmu_welcome_notification) wp-includes/ms-functions.php | Notifies the site administrator that their site activation was successful. |
| [wpmu\_signup\_blog\_notification()](wpmu_signup_blog_notification) wp-includes/ms-functions.php | Sends a confirmation request email to a user when they sign up for a new site. The new site will not become active until the confirmation link is clicked. |
| [wpmu\_signup\_user\_notification()](wpmu_signup_user_notification) wp-includes/ms-functions.php | Sends a confirmation request email to a user when they sign up for a new user account (without signing up for a site at the same time). The user account will not become active until the confirmation link is clicked. |
| [wp\_update\_nav\_menu\_item()](wp_update_nav_menu_item) wp-includes/nav-menu.php | Saves the properties of a menu item or create a new one. |
| Version | Description |
| --- | --- |
| [2.8.0](https://developer.wordpress.org/reference/since/2.8.0/) | Introduced. |
| programming_docs |
wordpress links_popup_script( string $text = 'Links', int $width = 400, int $height = 400, string $file = 'links.all.php', bool $count = true ) links\_popup\_script( string $text = 'Links', int $width = 400, int $height = 400, string $file = 'links.all.php', bool $count = true )
=======================================================================================================================================
This function has been deprecated.
Show the link to the links popup and the number of links.
`$text` string Optional the text of the link Default: `'Links'`
`$width` int Optional the width of the popup window Default: `400`
`$height` int Optional the height of the popup window Default: `400`
`$file` string Optional the page to open in the popup window Default: `'links.all.php'`
`$count` bool Optional the number of links in the db Default: `true`
File: `wp-includes/deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/deprecated.php/)
```
function links_popup_script($text = 'Links', $width=400, $height=400, $file='links.all.php', $count = true) {
_deprecated_function( __FUNCTION__, '2.1.0' );
}
```
| Uses | Description |
| --- | --- |
| [\_deprecated\_function()](_deprecated_function) wp-includes/functions.php | Marks a function as deprecated and inform when it has been used. |
| Version | Description |
| --- | --- |
| [2.1.0](https://developer.wordpress.org/reference/since/2.1.0/) | This function has been deprecated. |
| [0.71](https://developer.wordpress.org/reference/since/0.71/) | Introduced. |
wordpress wp_ajax_add_link_category( string $action ) wp\_ajax\_add\_link\_category( string $action )
===============================================
Ajax handler for adding a link category.
`$action` string Required Action to perform. File: `wp-admin/includes/ajax-actions.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/ajax-actions.php/)
```
function wp_ajax_add_link_category( $action ) {
if ( empty( $action ) ) {
$action = 'add-link-category';
}
check_ajax_referer( $action );
$taxonomy_object = get_taxonomy( 'link_category' );
if ( ! current_user_can( $taxonomy_object->cap->manage_terms ) ) {
wp_die( -1 );
}
$names = explode( ',', wp_unslash( $_POST['newcat'] ) );
$x = new WP_Ajax_Response();
foreach ( $names as $cat_name ) {
$cat_name = trim( $cat_name );
$slug = sanitize_title( $cat_name );
if ( '' === $slug ) {
continue;
}
$cat_id = wp_insert_term( $cat_name, 'link_category' );
if ( ! $cat_id || is_wp_error( $cat_id ) ) {
continue;
} else {
$cat_id = $cat_id['term_id'];
}
$cat_name = esc_html( $cat_name );
$x->add(
array(
'what' => 'link-category',
'id' => $cat_id,
'data' => "<li id='link-category-$cat_id'><label for='in-link-category-$cat_id' class='selectit'><input value='" . esc_attr( $cat_id ) . "' type='checkbox' checked='checked' name='link_category[]' id='in-link-category-$cat_id'/> $cat_name</label></li>",
'position' => -1,
)
);
}
$x->send();
}
```
| Uses | Description |
| --- | --- |
| [sanitize\_title()](sanitize_title) wp-includes/formatting.php | Sanitizes a string into a slug, which can be used in URLs or HTML attributes. |
| [wp\_insert\_term()](wp_insert_term) wp-includes/taxonomy.php | Adds a new term to the database. |
| [WP\_Ajax\_Response::\_\_construct()](../classes/wp_ajax_response/__construct) wp-includes/class-wp-ajax-response.php | Constructor – Passes args to [WP\_Ajax\_Response::add()](../classes/wp_ajax_response/add). |
| [current\_user\_can()](current_user_can) wp-includes/capabilities.php | Returns whether the current user has the specified capability. |
| [wp\_unslash()](wp_unslash) wp-includes/formatting.php | Removes slashes from a string or recursively removes slashes from strings within an array. |
| [esc\_html()](esc_html) wp-includes/formatting.php | Escaping for HTML blocks. |
| [esc\_attr()](esc_attr) wp-includes/formatting.php | Escaping for HTML attributes. |
| [check\_ajax\_referer()](check_ajax_referer) wp-includes/pluggable.php | Verifies the Ajax request to prevent processing requests external of the blog. |
| [wp\_die()](wp_die) wp-includes/functions.php | Kills WordPress execution and displays HTML page with an error message. |
| [get\_taxonomy()](get_taxonomy) wp-includes/taxonomy.php | Retrieves the taxonomy object of $taxonomy. |
| [is\_wp\_error()](is_wp_error) wp-includes/load.php | Checks whether the given variable is a WordPress Error. |
| Version | Description |
| --- | --- |
| [3.1.0](https://developer.wordpress.org/reference/since/3.1.0/) | Introduced. |
wordpress wp_style_loader_src( string $src, string $handle ): string|false wp\_style\_loader\_src( string $src, string $handle ): string|false
===================================================================
Administration Screen CSS for changing the styles.
If installing the ‘wp-admin/’ directory will be replaced with ‘./’.
The $\_wp\_admin\_css\_colors global manages the Administration Screens CSS stylesheet that is loaded. The option that is set is ‘admin\_color’ and is the color and key for the array. The value for the color key is an object with a ‘url’ parameter that has the URL path to the CSS file.
The query from $src parameter will be appended to the URL that is given from the $\_wp\_admin\_css\_colors array value URL.
`$src` string Required Source URL. `$handle` string Required Either `'colors'` or `'colors-rtl'`. string|false URL path to CSS stylesheet for Administration Screens.
File: `wp-includes/script-loader.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/script-loader.php/)
```
function wp_style_loader_src( $src, $handle ) {
global $_wp_admin_css_colors;
if ( wp_installing() ) {
return preg_replace( '#^wp-admin/#', './', $src );
}
if ( 'colors' === $handle ) {
$color = get_user_option( 'admin_color' );
if ( empty( $color ) || ! isset( $_wp_admin_css_colors[ $color ] ) ) {
$color = 'fresh';
}
$color = $_wp_admin_css_colors[ $color ];
$url = $color->url;
if ( ! $url ) {
return false;
}
$parsed = parse_url( $src );
if ( isset( $parsed['query'] ) && $parsed['query'] ) {
wp_parse_str( $parsed['query'], $qv );
$url = add_query_arg( $qv, $url );
}
return $url;
}
return $src;
}
```
| Uses | Description |
| --- | --- |
| [wp\_installing()](wp_installing) wp-includes/load.php | Check or set whether WordPress is in “installation” mode. |
| [wp\_parse\_str()](wp_parse_str) wp-includes/formatting.php | Parses a string into variables to be stored in an array. |
| [get\_user\_option()](get_user_option) wp-includes/user.php | Retrieves user option that can be either per Site or per Network. |
| [add\_query\_arg()](add_query_arg) wp-includes/functions.php | Retrieves a modified URL query string. |
| Version | Description |
| --- | --- |
| [2.6.0](https://developer.wordpress.org/reference/since/2.6.0/) | Introduced. |
wordpress _wp_get_allowed_postdata( array|WP_Error|null $post_data = null ): array|WP_Error \_wp\_get\_allowed\_postdata( array|WP\_Error|null $post\_data = null ): array|WP\_Error
========================================================================================
Returns only allowed post data fields.
`$post_data` array|[WP\_Error](../classes/wp_error)|null Optional The array of post data to process, or an error object.
Defaults to the `$_POST` superglobal. Default: `null`
array|[WP\_Error](../classes/wp_error) Array of post data on success, [WP\_Error](../classes/wp_error) on failure.
File: `wp-admin/includes/post.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/post.php/)
```
function _wp_get_allowed_postdata( $post_data = null ) {
if ( empty( $post_data ) ) {
$post_data = $_POST;
}
// Pass through errors.
if ( is_wp_error( $post_data ) ) {
return $post_data;
}
return array_diff_key( $post_data, array_flip( array( 'meta_input', 'file', 'guid' ) ) );
}
```
| Uses | Description |
| --- | --- |
| [is\_wp\_error()](is_wp_error) wp-includes/load.php | Checks whether the given variable is a WordPress Error. |
| Used By | Description |
| --- | --- |
| [wp\_create\_post\_autosave()](wp_create_post_autosave) wp-admin/includes/post.php | Creates autosave data for the specified post from `$_POST` data. |
| [wp\_write\_post()](wp_write_post) wp-admin/includes/post.php | Creates a new post from the “Write Post” form using `$_POST` information. |
| [edit\_post()](edit_post) wp-admin/includes/post.php | Updates an existing post with values provided in `$_POST`. |
| [bulk\_edit\_posts()](bulk_edit_posts) wp-admin/includes/post.php | Processes the post data for the bulk editing of posts. |
| [wp\_ajax\_upload\_attachment()](wp_ajax_upload_attachment) wp-admin/includes/ajax-actions.php | Ajax handler for uploading attachments |
| Version | Description |
| --- | --- |
| [5.0.1](https://developer.wordpress.org/reference/since/5.0.1/) | Introduced. |
wordpress rel_canonical() rel\_canonical()
================
Outputs rel=canonical for singular queries.
File: `wp-includes/link-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/link-template.php/)
```
function rel_canonical() {
if ( ! is_singular() ) {
return;
}
$id = get_queried_object_id();
if ( 0 === $id ) {
return;
}
$url = wp_get_canonical_url( $id );
if ( ! empty( $url ) ) {
echo '<link rel="canonical" href="' . esc_url( $url ) . '" />' . "\n";
}
}
```
| Uses | Description |
| --- | --- |
| [wp\_get\_canonical\_url()](wp_get_canonical_url) wp-includes/link-template.php | Returns the canonical URL for a post. |
| [is\_singular()](is_singular) wp-includes/query.php | Determines whether the query is for an existing single post of any post type (post, attachment, page, custom post types). |
| [get\_queried\_object\_id()](get_queried_object_id) wp-includes/query.php | Retrieves the ID of the currently queried object. |
| [esc\_url()](esc_url) wp-includes/formatting.php | Checks and cleans a URL. |
| Version | Description |
| --- | --- |
| [4.6.0](https://developer.wordpress.org/reference/since/4.6.0/) | Adjusted to use `wp_get_canonical_url()`. |
| [2.9.0](https://developer.wordpress.org/reference/since/2.9.0/) | Introduced. |
wordpress urldecode_deep( mixed $value ): mixed urldecode\_deep( mixed $value ): mixed
======================================
Navigates through an array, object, or scalar, and decodes URL-encoded values
`$value` mixed Required The array or string to be decoded. mixed The decoded value.
File: `wp-includes/formatting.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/formatting.php/)
```
function urldecode_deep( $value ) {
return map_deep( $value, 'urldecode' );
}
```
| Uses | Description |
| --- | --- |
| [map\_deep()](map_deep) wp-includes/formatting.php | Maps a function to all non-iterable elements of an array or an object. |
| Version | Description |
| --- | --- |
| [4.4.0](https://developer.wordpress.org/reference/since/4.4.0/) | Introduced. |
wordpress make_url_footnote( string $content ): string make\_url\_footnote( string $content ): string
==============================================
This function has been deprecated.
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.
`$content` string Required Content to get links. string HTML stripped out of content with links at the bottom.
File: `wp-includes/deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/deprecated.php/)
```
function make_url_footnote( $content ) {
_deprecated_function( __FUNCTION__, '2.9.0', '' );
preg_match_all( '/<a(.+?)href=\"(.+?)\"(.*?)>(.+?)<\/a>/', $content, $matches );
$links_summary = "\n";
for ( $i = 0, $c = count( $matches[0] ); $i < $c; $i++ ) {
$link_match = $matches[0][$i];
$link_number = '['.($i+1).']';
$link_url = $matches[2][$i];
$link_text = $matches[4][$i];
$content = str_replace( $link_match, $link_text . ' ' . $link_number, $content );
$link_url = ( ( strtolower( substr( $link_url, 0, 7 ) ) != 'http://' ) && ( strtolower( substr( $link_url, 0, 8 ) ) != 'https://' ) ) ? get_option( 'home' ) . $link_url : $link_url;
$links_summary .= "\n" . $link_number . ' ' . $link_url;
}
$content = strip_tags( $content );
$content .= $links_summary;
return $content;
}
```
| Uses | Description |
| --- | --- |
| [\_deprecated\_function()](_deprecated_function) wp-includes/functions.php | Marks a function as deprecated and inform when it has been used. |
| [get\_option()](get_option) wp-includes/option.php | Retrieves an option value based on an option name. |
| Used By | Description |
| --- | --- |
| [the\_content\_rss()](the_content_rss) wp-includes/deprecated.php | Display the post content for the feed. |
| Version | Description |
| --- | --- |
| [2.9.0](https://developer.wordpress.org/reference/since/2.9.0/) | This function has been deprecated. |
| [0.71](https://developer.wordpress.org/reference/since/0.71/) | Introduced. |
wordpress get_user_by( string $field, int|string $value ): WP_User|false get\_user\_by( string $field, int|string $value ): WP\_User|false
=================================================================
Retrieves user info by a given field.
`$field` string Required The field to retrieve the user with. id | ID | slug | email | login. `$value` int|string Required A value for $field. A user ID, slug, email address, or login name. [WP\_User](../classes/wp_user)|false [WP\_User](../classes/wp_user) object on success, false on failure.
File: `wp-includes/pluggable.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/pluggable.php/)
```
function get_user_by( $field, $value ) {
$userdata = WP_User::get_data_by( $field, $value );
if ( ! $userdata ) {
return false;
}
$user = new WP_User;
$user->init( $userdata );
return $user;
}
```
| Uses | Description |
| --- | --- |
| [WP\_User::get\_data\_by()](../classes/wp_user/get_data_by) wp-includes/class-wp-user.php | Returns only the main user fields. |
| [WP\_User::\_\_construct()](../classes/wp_user/__construct) wp-includes/class-wp-user.php | Constructor. |
| Used By | Description |
| --- | --- |
| [wpmu\_new\_site\_admin\_notification()](wpmu_new_site_admin_notification) wp-includes/ms-functions.php | Notifies the Multisite network administrator that a new site was created. |
| [wp\_authenticate\_application\_password()](wp_authenticate_application_password) wp-includes/user.php | Authenticates the user using an application password. |
| [populate\_network\_meta()](populate_network_meta) wp-admin/includes/schema.php | Creates WordPress network meta and sets the default values. |
| [get\_object\_subtype()](get_object_subtype) wp-includes/meta.php | Returns the object subtype for a given object ID of a specific type. |
| [wp\_create\_user\_request()](wp_create_user_request) wp-includes/user.php | Creates and logs a user request to perform a specific action. |
| [wp\_user\_personal\_data\_exporter()](wp_user_personal_data_exporter) wp-includes/user.php | Finds and exports personal data associated with an email address from the user and user\_meta table. |
| [wp\_media\_personal\_data\_exporter()](wp_media_personal_data_exporter) wp-includes/media.php | Finds and exports attachments associated with an email address. |
| [\_wp\_personal\_data\_handle\_actions()](_wp_personal_data_handle_actions) wp-admin/includes/privacy-tools.php | Handle list table actions. |
| [get\_user\_locale()](get_user_locale) wp-includes/l10n.php | Retrieves the locale of a user. |
| [WP\_REST\_Users\_Controller::create\_item()](../classes/wp_rest_users_controller/create_item) wp-includes/rest-api/endpoints/class-wp-rest-users-controller.php | Creates a single user. |
| [WP\_REST\_Users\_Controller::update\_item()](../classes/wp_rest_users_controller/update_item) wp-includes/rest-api/endpoints/class-wp-rest-users-controller.php | Updates a single user. |
| [wp\_authenticate\_email\_password()](wp_authenticate_email_password) wp-includes/user.php | Authenticates a user using the email and password. |
| [get\_avatar\_data()](get_avatar_data) wp-includes/link-template.php | Retrieves default data about the avatar. |
| [retrieve\_password()](retrieve_password) wp-includes/user.php | Handles sending a password retrieval email to a user. |
| [wp\_validate\_auth\_cookie()](wp_validate_auth_cookie) wp-includes/pluggable.php | Validates authentication cookie. |
| [get\_userdata()](get_userdata) wp-includes/pluggable.php | Retrieves user info by user ID. |
| [get\_profile()](get_profile) wp-includes/deprecated.php | Retrieve user data based on field. |
| [WP\_Query::get\_queried\_object()](../classes/wp_query/get_queried_object) wp-includes/class-wp-query.php | Retrieves the currently queried object. |
| [WP\_Query::get\_posts()](../classes/wp_query/get_posts) wp-includes/class-wp-query.php | Retrieves an array of posts based on query variables. |
| [check\_password\_reset\_key()](check_password_reset_key) wp-includes/user.php | Retrieves a user row based on password reset key and login. |
| [username\_exists()](username_exists) wp-includes/user.php | Determines whether the given username exists. |
| [email\_exists()](email_exists) wp-includes/user.php | Determines whether the given email exists. |
| [wp\_authenticate\_username\_password()](wp_authenticate_username_password) wp-includes/user.php | Authenticates a user, confirming the username and password are valid. |
| [get\_userdatabylogin()](get_userdatabylogin) wp-includes/pluggable-deprecated.php | Retrieve user info by login name. |
| [get\_user\_by\_email()](get_user_by_email) wp-includes/pluggable-deprecated.php | Retrieve user info by email. |
| [wp\_setcookie()](wp_setcookie) wp-includes/pluggable-deprecated.php | Sets a cookie for a user who just logged in. This function is deprecated. |
| [get\_pages()](get_pages) wp-includes/post.php | Retrieves an array of pages (or hierarchical post type items). |
| [is\_user\_spammy()](is_user_spammy) wp-includes/ms-functions.php | Determines whether a user is marked as a spammer, based on user login. |
| [wpmu\_signup\_blog\_notification()](wpmu_signup_blog_notification) wp-includes/ms-functions.php | Sends a confirmation request email to a user when they sign up for a new site. The new site will not become active until the confirmation link is clicked. |
| [wpmu\_signup\_user\_notification()](wpmu_signup_user_notification) wp-includes/ms-functions.php | Sends a confirmation request email to a user when they sign up for a new user account (without signing up for a site at the same time). The user account will not become active until the confirmation link is clicked. |
| [is\_site\_admin()](is_site_admin) wp-includes/ms-deprecated.php | Determine if user is a site admin. |
| [get\_user\_details()](get_user_details) wp-includes/ms-deprecated.php | Deprecated functionality to retrieve user information. |
| [get\_user\_id\_from\_string()](get_user_id_from_string) wp-includes/ms-deprecated.php | Get a numeric user ID from either an email address or a login. |
| [check\_comment()](check_comment) wp-includes/comment.php | Checks whether a comment passes internal checks to be allowed to add. |
| Version | Description |
| --- | --- |
| [4.4.0](https://developer.wordpress.org/reference/since/4.4.0/) | Added `'ID'` as an alias of `'id'` for the `$field` parameter. |
| [2.8.0](https://developer.wordpress.org/reference/since/2.8.0/) | Introduced. |
| programming_docs |
wordpress _wp_check_alternate_file_names( string[] $filenames, string $dir, array $files ): bool \_wp\_check\_alternate\_file\_names( string[] $filenames, string $dir, array $files ): bool
===========================================================================================
This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.
Helper function to test if each of an array of file names could conflict with existing files.
`$filenames` string[] Required Array of file names to check. `$dir` string Required The directory containing the files. `$files` array Required An array of existing files in the directory. May be empty. bool True if the tested file name could match an existing file, false otherwise.
File: `wp-includes/functions.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/functions.php/)
```
function _wp_check_alternate_file_names( $filenames, $dir, $files ) {
foreach ( $filenames as $filename ) {
if ( file_exists( $dir . $filename ) ) {
return true;
}
if ( ! empty( $files ) && _wp_check_existing_file_names( $filename, $files ) ) {
return true;
}
}
return false;
}
```
| Uses | Description |
| --- | --- |
| [\_wp\_check\_existing\_file\_names()](_wp_check_existing_file_names) wp-includes/functions.php | Helper function to check if a file name could match an existing image sub-size file name. |
| Used By | Description |
| --- | --- |
| [wp\_unique\_filename()](wp_unique_filename) wp-includes/functions.php | Gets a filename that is sanitized and unique for the given directory. |
| Version | Description |
| --- | --- |
| [5.8.1](https://developer.wordpress.org/reference/since/5.8.1/) | Introduced. |
wordpress get_site_transient( string $transient ): mixed get\_site\_transient( string $transient ): mixed
================================================
Retrieves the value of a site transient.
If the transient does not exist, does not have a value, or has expired, then the return value will be false.
* [get\_transient()](get_transient)
`$transient` string Required Transient name. Expected to not be SQL-escaped. mixed Value of transient.
File: `wp-includes/option.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/option.php/)
```
function get_site_transient( $transient ) {
/**
* Filters the value of an existing site transient before it is retrieved.
*
* The dynamic portion of the hook name, `$transient`, refers to the transient name.
*
* Returning a value other than boolean false will short-circuit retrieval and
* return that value instead.
*
* @since 2.9.0
* @since 4.4.0 The `$transient` parameter was added.
*
* @param mixed $pre_site_transient The default value to return if the site transient does not exist.
* Any value other than false will short-circuit the retrieval
* of the transient, and return that value.
* @param string $transient Transient name.
*/
$pre = apply_filters( "pre_site_transient_{$transient}", false, $transient );
if ( false !== $pre ) {
return $pre;
}
if ( wp_using_ext_object_cache() || wp_installing() ) {
$value = wp_cache_get( $transient, 'site-transient' );
} else {
// Core transients that do not have a timeout. Listed here so querying timeouts can be avoided.
$no_timeout = array( 'update_core', 'update_plugins', 'update_themes' );
$transient_option = '_site_transient_' . $transient;
if ( ! in_array( $transient, $no_timeout, true ) ) {
$transient_timeout = '_site_transient_timeout_' . $transient;
$timeout = get_site_option( $transient_timeout );
if ( false !== $timeout && $timeout < time() ) {
delete_site_option( $transient_option );
delete_site_option( $transient_timeout );
$value = false;
}
}
if ( ! isset( $value ) ) {
$value = get_site_option( $transient_option );
}
}
/**
* Filters the value of an existing site transient.
*
* The dynamic portion of the hook name, `$transient`, refers to the transient name.
*
* @since 2.9.0
* @since 4.4.0 The `$transient` parameter was added.
*
* @param mixed $value Value of site transient.
* @param string $transient Transient name.
*/
return apply_filters( "site_transient_{$transient}", $value, $transient );
}
```
[apply\_filters( "pre\_site\_transient\_{$transient}", mixed $pre\_site\_transient, string $transient )](../hooks/pre_site_transient_transient)
Filters the value of an existing site transient before it is retrieved.
[apply\_filters( "site\_transient\_{$transient}", mixed $value, string $transient )](../hooks/site_transient_transient)
Filters the value of an existing site transient.
| Uses | Description |
| --- | --- |
| [wp\_installing()](wp_installing) wp-includes/load.php | Check or set whether WordPress is in “installation” mode. |
| [wp\_using\_ext\_object\_cache()](wp_using_ext_object_cache) wp-includes/load.php | Toggle `$_wp_using_ext_object_cache` on and off without directly touching global. |
| [delete\_site\_option()](delete_site_option) wp-includes/option.php | Removes a option by name for the current network. |
| [wp\_cache\_get()](wp_cache_get) wp-includes/cache.php | Retrieves the cache contents from the cache by key and group. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| [get\_site\_option()](get_site_option) wp-includes/option.php | Retrieve an option value for the current network based on name of option. |
| Used By | Description |
| --- | --- |
| [WP\_REST\_URL\_Details\_Controller::get\_cache()](../classes/wp_rest_url_details_controller/get_cache) wp-includes/rest-api/endpoints/class-wp-rest-url-details-controller.php | Utility function to retrieve a value from the cache at a given key. |
| [WP\_REST\_Pattern\_Directory\_Controller::get\_items()](../classes/wp_rest_pattern_directory_controller/get_items) wp-includes/rest-api/endpoints/class-wp-rest-pattern-directory-controller.php | Search and retrieve block patterns metadata |
| [WP\_MS\_Themes\_List\_Table::column\_autoupdates()](../classes/wp_ms_themes_list_table/column_autoupdates) wp-admin/includes/class-wp-ms-themes-list-table.php | Handles the auto-updates column output. |
| [WP\_Debug\_Data::debug\_data()](../classes/wp_debug_data/debug_data) wp-admin/includes/class-wp-debug-data.php | Static function for generating site debug data when required. |
| [wp\_check\_php\_version()](wp_check_php_version) wp-admin/includes/misc.php | Checks if the user needs to update PHP. |
| [WP\_Plugin\_Install\_List\_Table::get\_installed\_plugins()](../classes/wp_plugin_install_list_table/get_installed_plugins) wp-admin/includes/class-wp-plugin-install-list-table.php | Return the list of known plugins. |
| [WP\_Community\_Events::get\_cached\_events()](../classes/wp_community_events/get_cached_events) wp-admin/includes/class-wp-community-events.php | Gets cached events. |
| [wp\_ajax\_update\_theme()](wp_ajax_update_theme) wp-admin/includes/ajax-actions.php | Ajax handler for updating a theme. |
| [wp\_get\_available\_translations()](wp_get_available_translations) wp-admin/includes/translation-install.php | Get available translations from the WordPress.org API. |
| [WP\_Automatic\_Updater::run()](../classes/wp_automatic_updater/run) wp-admin/includes/class-wp-automatic-updater.php | Kicks off the background update process, looping through all pending updates. |
| [Plugin\_Upgrader::bulk\_upgrade()](../classes/plugin_upgrader/bulk_upgrade) wp-admin/includes/class-plugin-upgrader.php | Bulk upgrade several plugins at once. |
| [Theme\_Upgrader::upgrade()](../classes/theme_upgrader/upgrade) wp-admin/includes/class-theme-upgrader.php | Upgrade a theme. |
| [Theme\_Upgrader::bulk\_upgrade()](../classes/theme_upgrader/bulk_upgrade) wp-admin/includes/class-theme-upgrader.php | Upgrade several themes at once. |
| [Plugin\_Upgrader::upgrade()](../classes/plugin_upgrader/upgrade) wp-admin/includes/class-plugin-upgrader.php | Upgrade a plugin. |
| [wp\_prepare\_themes\_for\_js()](wp_prepare_themes_for_js) wp-admin/includes/theme.php | Prepares themes for JavaScript. |
| [get\_theme\_update\_available()](get_theme_update_available) wp-admin/includes/theme.php | Retrieves the update link if there is a theme update available. |
| [get\_theme\_feature\_list()](get_theme_feature_list) wp-admin/includes/theme.php | Retrieves list of WordPress theme features (aka theme tags). |
| [WP\_Plugins\_List\_Table::single\_row()](../classes/wp_plugins_list_table/single_row) wp-admin/includes/class-wp-plugins-list-table.php | |
| [WP\_Plugins\_List\_Table::prepare\_items()](../classes/wp_plugins_list_table/prepare_items) wp-admin/includes/class-wp-plugins-list-table.php | |
| [WP\_MS\_Themes\_List\_Table::prepare\_items()](../classes/wp_ms_themes_list_table/prepare_items) wp-admin/includes/class-wp-ms-themes-list-table.php | |
| [get\_core\_updates()](get_core_updates) wp-admin/includes/update.php | Gets available core updates. |
| [find\_core\_auto\_update()](find_core_auto_update) wp-admin/includes/update.php | Gets the best available (and enabled) Auto-Update for WordPress core. |
| [find\_core\_update()](find_core_update) wp-admin/includes/update.php | Finds the available update for WordPress core. |
| [get\_plugin\_updates()](get_plugin_updates) wp-admin/includes/update.php | Retrieves plugins with updates available. |
| [wp\_plugin\_update\_rows()](wp_plugin_update_rows) wp-admin/includes/update.php | Adds a callback to display update information for plugins with updates available. |
| [wp\_plugin\_update\_row()](wp_plugin_update_row) wp-admin/includes/update.php | Displays update information for a plugin. |
| [get\_theme\_updates()](get_theme_updates) wp-admin/includes/update.php | Retrieves themes with updates available. |
| [wp\_theme\_update\_rows()](wp_theme_update_rows) wp-admin/includes/update.php | Adds a callback to display update information for themes with updates available. |
| [wp\_theme\_update\_row()](wp_theme_update_row) wp-admin/includes/update.php | Displays update information for a theme. |
| [wp\_check\_browser\_version()](wp_check_browser_version) wp-admin/includes/dashboard.php | Checks if the user needs a browser update. |
| [install\_popular\_tags()](install_popular_tags) wp-admin/includes/plugin-install.php | Retrieves popular WordPress plugin tags. |
| [install\_plugin\_install\_status()](install_plugin_install_status) wp-admin/includes/plugin-install.php | Determines the status we can perform on a plugin. |
| [delete\_plugins()](delete_plugins) wp-admin/includes/plugin.php | Removes directory and files of a plugin for a list of plugins. |
| [wp\_get\_popular\_importers()](wp_get_popular_importers) wp-admin/includes/import.php | Returns a list from WordPress.org of popular importer plugins. |
| [wp\_credits()](wp_credits) wp-admin/includes/credits.php | Retrieve the contributor credits. |
| [get\_theme\_roots()](get_theme_roots) wp-includes/theme.php | Retrieves theme roots. |
| [search\_theme\_directories()](search_theme_directories) wp-includes/theme.php | Searches all registered theme directories for complete and valid themes. |
| [\_maybe\_update\_plugins()](_maybe_update_plugins) wp-includes/update.php | Checks the last time plugins were run before checking plugin versions. |
| [\_maybe\_update\_themes()](_maybe_update_themes) wp-includes/update.php | Checks themes versions only after a duration of time. |
| [wp\_version\_check()](wp_version_check) wp-includes/update.php | Checks WordPress version against the newest version. |
| [wp\_update\_plugins()](wp_update_plugins) wp-includes/update.php | Checks for available updates to plugins based on the latest versions hosted on WordPress.org. |
| [wp\_update\_themes()](wp_update_themes) wp-includes/update.php | Checks for available updates to themes based on the latest versions hosted on WordPress.org. |
| [wp\_get\_translation\_updates()](wp_get_translation_updates) wp-includes/update.php | Retrieves a list of all language updates available. |
| [wp\_get\_update\_data()](wp_get_update_data) wp-includes/update.php | Collects counts and UI strings for available updates. |
| [\_maybe\_update\_core()](_maybe_update_core) wp-includes/update.php | Determines whether core should be updated. |
| Version | Description |
| --- | --- |
| [2.9.0](https://developer.wordpress.org/reference/since/2.9.0/) | Introduced. |
wordpress domain_exists( string $domain, string $path, int $network_id = 1 ): int|null domain\_exists( string $domain, string $path, int $network\_id = 1 ): int|null
==============================================================================
Checks whether a site name is already taken.
The name is the site’s subdomain or the site’s subdirectory path depending on the network settings.
Used during the new site registration process to ensure that each site name is unique.
`$domain` string Required The domain to be checked. `$path` string Required The path to be checked. `$network_id` int Optional Network ID. Relevant only on multi-network installations. Default: `1`
int|null The site ID if the site name exists, null otherwise.
File: `wp-includes/ms-functions.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/ms-functions.php/)
```
function domain_exists( $domain, $path, $network_id = 1 ) {
$path = trailingslashit( $path );
$args = array(
'network_id' => $network_id,
'domain' => $domain,
'path' => $path,
'fields' => 'ids',
'number' => 1,
'update_site_meta_cache' => false,
);
$result = get_sites( $args );
$result = array_shift( $result );
/**
* Filters whether a site name is taken.
*
* The name is the site's subdomain or the site's subdirectory
* path depending on the network settings.
*
* @since 3.5.0
*
* @param int|null $result The site ID if the site name exists, null otherwise.
* @param string $domain Domain to be checked.
* @param string $path Path to be checked.
* @param int $network_id Network ID. Relevant only on multi-network installations.
*/
return apply_filters( 'domain_exists', $result, $domain, $path, $network_id );
}
```
[apply\_filters( 'domain\_exists', int|null $result, string $domain, string $path, int $network\_id )](../hooks/domain_exists)
Filters whether a site name is taken.
| Uses | Description |
| --- | --- |
| [get\_sites()](get_sites) wp-includes/ms-site.php | Retrieves a list of sites matching requested arguments. |
| [trailingslashit()](trailingslashit) wp-includes/formatting.php | Appends a trailing slash. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| Used By | Description |
| --- | --- |
| [wp\_validate\_site\_data()](wp_validate_site_data) wp-includes/ms-site.php | Validates data for a site prior to inserting or updating in the database. |
| [wpmu\_create\_blog()](wpmu_create_blog) wp-includes/ms-functions.php | Creates a site. |
| [wpmu\_validate\_blog\_signup()](wpmu_validate_blog_signup) wp-includes/ms-functions.php | Processes new site registrations. |
| [create\_empty\_blog()](create_empty_blog) wp-includes/ms-deprecated.php | Create an empty blog. |
| Version | Description |
| --- | --- |
| [MU (3.0.0)](https://developer.wordpress.org/reference/since/mu.3.0.0/) | Introduced. |
wordpress wp_get_db_schema( string $scope = 'all', int $blog_id = null ): string wp\_get\_db\_schema( string $scope = 'all', int $blog\_id = null ): string
==========================================================================
Retrieve the SQL for creating database tables.
`$scope` string Optional The tables for which to retrieve SQL. Can be all, global, ms\_global, or blog tables. Defaults to all. Default: `'all'`
`$blog_id` int Optional The site ID for which to retrieve SQL. Default is the current site ID. Default: `null`
string The SQL needed to create the requested tables.
File: `wp-admin/includes/schema.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/schema.php/)
```
function wp_get_db_schema( $scope = 'all', $blog_id = null ) {
global $wpdb;
$charset_collate = $wpdb->get_charset_collate();
if ( $blog_id && $blog_id != $wpdb->blogid ) {
$old_blog_id = $wpdb->set_blog_id( $blog_id );
}
// Engage multisite if in the middle of turning it on from network.php.
$is_multisite = is_multisite() || ( defined( 'WP_INSTALLING_NETWORK' ) && WP_INSTALLING_NETWORK );
/*
* Indexes have a maximum size of 767 bytes. Historically, we haven't need to be concerned about that.
* As of 4.2, however, we moved to utf8mb4, which uses 4 bytes per character. This means that an index which
* used to have room for floor(767/3) = 255 characters, now only has room for floor(767/4) = 191 characters.
*/
$max_index_length = 191;
// Blog-specific tables.
$blog_tables = "CREATE TABLE $wpdb->termmeta (
meta_id bigint(20) unsigned NOT NULL auto_increment,
term_id bigint(20) unsigned NOT NULL default '0',
meta_key varchar(255) default NULL,
meta_value longtext,
PRIMARY KEY (meta_id),
KEY term_id (term_id),
KEY meta_key (meta_key($max_index_length))
) $charset_collate;
CREATE TABLE $wpdb->terms (
term_id bigint(20) unsigned NOT NULL auto_increment,
name varchar(200) NOT NULL default '',
slug varchar(200) NOT NULL default '',
term_group bigint(10) NOT NULL default 0,
PRIMARY KEY (term_id),
KEY slug (slug($max_index_length)),
KEY name (name($max_index_length))
) $charset_collate;
CREATE TABLE $wpdb->term_taxonomy (
term_taxonomy_id bigint(20) unsigned NOT NULL auto_increment,
term_id bigint(20) unsigned NOT NULL default 0,
taxonomy varchar(32) NOT NULL default '',
description longtext NOT NULL,
parent bigint(20) unsigned NOT NULL default 0,
count bigint(20) NOT NULL default 0,
PRIMARY KEY (term_taxonomy_id),
UNIQUE KEY term_id_taxonomy (term_id,taxonomy),
KEY taxonomy (taxonomy)
) $charset_collate;
CREATE TABLE $wpdb->term_relationships (
object_id bigint(20) unsigned NOT NULL default 0,
term_taxonomy_id bigint(20) unsigned NOT NULL default 0,
term_order int(11) NOT NULL default 0,
PRIMARY KEY (object_id,term_taxonomy_id),
KEY term_taxonomy_id (term_taxonomy_id)
) $charset_collate;
CREATE TABLE $wpdb->commentmeta (
meta_id bigint(20) unsigned NOT NULL auto_increment,
comment_id bigint(20) unsigned NOT NULL default '0',
meta_key varchar(255) default NULL,
meta_value longtext,
PRIMARY KEY (meta_id),
KEY comment_id (comment_id),
KEY meta_key (meta_key($max_index_length))
) $charset_collate;
CREATE TABLE $wpdb->comments (
comment_ID bigint(20) unsigned NOT NULL auto_increment,
comment_post_ID bigint(20) unsigned NOT NULL default '0',
comment_author tinytext NOT NULL,
comment_author_email varchar(100) NOT NULL default '',
comment_author_url varchar(200) NOT NULL default '',
comment_author_IP varchar(100) NOT NULL default '',
comment_date datetime NOT NULL default '0000-00-00 00:00:00',
comment_date_gmt datetime NOT NULL default '0000-00-00 00:00:00',
comment_content text NOT NULL,
comment_karma int(11) NOT NULL default '0',
comment_approved varchar(20) NOT NULL default '1',
comment_agent varchar(255) NOT NULL default '',
comment_type varchar(20) NOT NULL default 'comment',
comment_parent bigint(20) unsigned NOT NULL default '0',
user_id bigint(20) unsigned NOT NULL default '0',
PRIMARY KEY (comment_ID),
KEY comment_post_ID (comment_post_ID),
KEY comment_approved_date_gmt (comment_approved,comment_date_gmt),
KEY comment_date_gmt (comment_date_gmt),
KEY comment_parent (comment_parent),
KEY comment_author_email (comment_author_email(10))
) $charset_collate;
CREATE TABLE $wpdb->links (
link_id bigint(20) unsigned NOT NULL auto_increment,
link_url varchar(255) NOT NULL default '',
link_name varchar(255) NOT NULL default '',
link_image varchar(255) NOT NULL default '',
link_target varchar(25) NOT NULL default '',
link_description varchar(255) NOT NULL default '',
link_visible varchar(20) NOT NULL default 'Y',
link_owner bigint(20) unsigned NOT NULL default '1',
link_rating int(11) NOT NULL default '0',
link_updated datetime NOT NULL default '0000-00-00 00:00:00',
link_rel varchar(255) NOT NULL default '',
link_notes mediumtext NOT NULL,
link_rss varchar(255) NOT NULL default '',
PRIMARY KEY (link_id),
KEY link_visible (link_visible)
) $charset_collate;
CREATE TABLE $wpdb->options (
option_id bigint(20) unsigned NOT NULL auto_increment,
option_name varchar(191) NOT NULL default '',
option_value longtext NOT NULL,
autoload varchar(20) NOT NULL default 'yes',
PRIMARY KEY (option_id),
UNIQUE KEY option_name (option_name),
KEY autoload (autoload)
) $charset_collate;
CREATE TABLE $wpdb->postmeta (
meta_id bigint(20) unsigned NOT NULL auto_increment,
post_id bigint(20) unsigned NOT NULL default '0',
meta_key varchar(255) default NULL,
meta_value longtext,
PRIMARY KEY (meta_id),
KEY post_id (post_id),
KEY meta_key (meta_key($max_index_length))
) $charset_collate;
CREATE TABLE $wpdb->posts (
ID bigint(20) unsigned NOT NULL auto_increment,
post_author bigint(20) unsigned NOT NULL default '0',
post_date datetime NOT NULL default '0000-00-00 00:00:00',
post_date_gmt datetime NOT NULL default '0000-00-00 00:00:00',
post_content longtext NOT NULL,
post_title text NOT NULL,
post_excerpt text NOT NULL,
post_status varchar(20) NOT NULL default 'publish',
comment_status varchar(20) NOT NULL default 'open',
ping_status varchar(20) NOT NULL default 'open',
post_password varchar(255) NOT NULL default '',
post_name varchar(200) NOT NULL default '',
to_ping text NOT NULL,
pinged text NOT NULL,
post_modified datetime NOT NULL default '0000-00-00 00:00:00',
post_modified_gmt datetime NOT NULL default '0000-00-00 00:00:00',
post_content_filtered longtext NOT NULL,
post_parent bigint(20) unsigned NOT NULL default '0',
guid varchar(255) NOT NULL default '',
menu_order int(11) NOT NULL default '0',
post_type varchar(20) NOT NULL default 'post',
post_mime_type varchar(100) NOT NULL default '',
comment_count bigint(20) NOT NULL default '0',
PRIMARY KEY (ID),
KEY post_name (post_name($max_index_length)),
KEY type_status_date (post_type,post_status,post_date,ID),
KEY post_parent (post_parent),
KEY post_author (post_author)
) $charset_collate;\n";
// Single site users table. The multisite flavor of the users table is handled below.
$users_single_table = "CREATE TABLE $wpdb->users (
ID bigint(20) unsigned NOT NULL auto_increment,
user_login varchar(60) NOT NULL default '',
user_pass varchar(255) NOT NULL default '',
user_nicename varchar(50) NOT NULL default '',
user_email varchar(100) NOT NULL default '',
user_url varchar(100) NOT NULL default '',
user_registered datetime NOT NULL default '0000-00-00 00:00:00',
user_activation_key varchar(255) NOT NULL default '',
user_status int(11) NOT NULL default '0',
display_name varchar(250) NOT NULL default '',
PRIMARY KEY (ID),
KEY user_login_key (user_login),
KEY user_nicename (user_nicename),
KEY user_email (user_email)
) $charset_collate;\n";
// Multisite users table.
$users_multi_table = "CREATE TABLE $wpdb->users (
ID bigint(20) unsigned NOT NULL auto_increment,
user_login varchar(60) NOT NULL default '',
user_pass varchar(255) NOT NULL default '',
user_nicename varchar(50) NOT NULL default '',
user_email varchar(100) NOT NULL default '',
user_url varchar(100) NOT NULL default '',
user_registered datetime NOT NULL default '0000-00-00 00:00:00',
user_activation_key varchar(255) NOT NULL default '',
user_status int(11) NOT NULL default '0',
display_name varchar(250) NOT NULL default '',
spam tinyint(2) NOT NULL default '0',
deleted tinyint(2) NOT NULL default '0',
PRIMARY KEY (ID),
KEY user_login_key (user_login),
KEY user_nicename (user_nicename),
KEY user_email (user_email)
) $charset_collate;\n";
// Usermeta.
$usermeta_table = "CREATE TABLE $wpdb->usermeta (
umeta_id bigint(20) unsigned NOT NULL auto_increment,
user_id bigint(20) unsigned NOT NULL default '0',
meta_key varchar(255) default NULL,
meta_value longtext,
PRIMARY KEY (umeta_id),
KEY user_id (user_id),
KEY meta_key (meta_key($max_index_length))
) $charset_collate;\n";
// Global tables.
if ( $is_multisite ) {
$global_tables = $users_multi_table . $usermeta_table;
} else {
$global_tables = $users_single_table . $usermeta_table;
}
// Multisite global tables.
$ms_global_tables = "CREATE TABLE $wpdb->blogs (
blog_id bigint(20) NOT NULL auto_increment,
site_id bigint(20) NOT NULL default '0',
domain varchar(200) NOT NULL default '',
path varchar(100) NOT NULL default '',
registered datetime NOT NULL default '0000-00-00 00:00:00',
last_updated datetime NOT NULL default '0000-00-00 00:00:00',
public tinyint(2) NOT NULL default '1',
archived tinyint(2) NOT NULL default '0',
mature tinyint(2) NOT NULL default '0',
spam tinyint(2) NOT NULL default '0',
deleted tinyint(2) NOT NULL default '0',
lang_id int(11) NOT NULL default '0',
PRIMARY KEY (blog_id),
KEY domain (domain(50),path(5)),
KEY lang_id (lang_id)
) $charset_collate;
CREATE TABLE $wpdb->blogmeta (
meta_id bigint(20) unsigned NOT NULL auto_increment,
blog_id bigint(20) NOT NULL default '0',
meta_key varchar(255) default NULL,
meta_value longtext,
PRIMARY KEY (meta_id),
KEY meta_key (meta_key($max_index_length)),
KEY blog_id (blog_id)
) $charset_collate;
CREATE TABLE $wpdb->registration_log (
ID bigint(20) NOT NULL auto_increment,
email varchar(255) NOT NULL default '',
IP varchar(30) NOT NULL default '',
blog_id bigint(20) NOT NULL default '0',
date_registered datetime NOT NULL default '0000-00-00 00:00:00',
PRIMARY KEY (ID),
KEY IP (IP)
) $charset_collate;
CREATE TABLE $wpdb->site (
id bigint(20) NOT NULL auto_increment,
domain varchar(200) NOT NULL default '',
path varchar(100) NOT NULL default '',
PRIMARY KEY (id),
KEY domain (domain(140),path(51))
) $charset_collate;
CREATE TABLE $wpdb->sitemeta (
meta_id bigint(20) NOT NULL auto_increment,
site_id bigint(20) NOT NULL default '0',
meta_key varchar(255) default NULL,
meta_value longtext,
PRIMARY KEY (meta_id),
KEY meta_key (meta_key($max_index_length)),
KEY site_id (site_id)
) $charset_collate;
CREATE TABLE $wpdb->signups (
signup_id bigint(20) NOT NULL auto_increment,
domain varchar(200) NOT NULL default '',
path varchar(100) NOT NULL default '',
title longtext NOT NULL,
user_login varchar(60) NOT NULL default '',
user_email varchar(100) NOT NULL default '',
registered datetime NOT NULL default '0000-00-00 00:00:00',
activated datetime NOT NULL default '0000-00-00 00:00:00',
active tinyint(1) NOT NULL default '0',
activation_key varchar(50) NOT NULL default '',
meta longtext,
PRIMARY KEY (signup_id),
KEY activation_key (activation_key),
KEY user_email (user_email),
KEY user_login_email (user_login,user_email),
KEY domain_path (domain(140),path(51))
) $charset_collate;";
switch ( $scope ) {
case 'blog':
$queries = $blog_tables;
break;
case 'global':
$queries = $global_tables;
if ( $is_multisite ) {
$queries .= $ms_global_tables;
}
break;
case 'ms_global':
$queries = $ms_global_tables;
break;
case 'all':
default:
$queries = $global_tables . $blog_tables;
if ( $is_multisite ) {
$queries .= $ms_global_tables;
}
break;
}
if ( isset( $old_blog_id ) ) {
$wpdb->set_blog_id( $old_blog_id );
}
return $queries;
}
```
| Uses | Description |
| --- | --- |
| [wpdb::set\_blog\_id()](../classes/wpdb/set_blog_id) wp-includes/class-wpdb.php | Sets blog ID. |
| [wpdb::get\_charset\_collate()](../classes/wpdb/get_charset_collate) wp-includes/class-wpdb.php | Retrieves the database character collate. |
| [is\_multisite()](is_multisite) wp-includes/load.php | If Multisite is enabled. |
| Used By | Description |
| --- | --- |
| [install\_network()](install_network) wp-admin/includes/schema.php | Install Network. |
| [dbDelta()](dbdelta) wp-admin/includes/upgrade.php | Modifies the database based on specified SQL statements. |
| Version | Description |
| --- | --- |
| [3.3.0](https://developer.wordpress.org/reference/since/3.3.0/) | Introduced. |
| programming_docs |
wordpress wp_cache_set( int|string $key, mixed $data, string $group = '', int $expire ): bool wp\_cache\_set( int|string $key, mixed $data, string $group = '', int $expire ): bool
=====================================================================================
Saves the data to the cache.
Differs from [wp\_cache\_add()](wp_cache_add) and [wp\_cache\_replace()](wp_cache_replace) in that it will always write data.
* [WP\_Object\_Cache::set()](../classes/wp_object_cache/set)
`$key` int|string Required The cache key to use for retrieval later. `$data` mixed Required The contents to store in the cache. `$group` string Optional Where to group the cache contents. Enables the same key to be used across groups. Default: `''`
`$expire` int Optional When to expire the cache contents, in seconds.
Default 0 (no expiration). bool True on success, false on failure.
File: `wp-includes/cache.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/cache.php/)
```
function wp_cache_set( $key, $data, $group = '', $expire = 0 ) {
global $wp_object_cache;
return $wp_object_cache->set( $key, $data, $group, (int) $expire );
}
```
| Uses | Description |
| --- | --- |
| [WP\_Object\_Cache::set()](../classes/wp_object_cache/set) wp-includes/class-wp-object-cache.php | Sets the data contents into the cache. |
| Used By | Description |
| --- | --- |
| [wp\_cache\_set\_sites\_last\_changed()](wp_cache_set_sites_last_changed) wp-includes/ms-site.php | Sets the last changed time for the ‘sites’ cache group. |
| [wp\_cache\_set\_terms\_last\_changed()](wp_cache_set_terms_last_changed) wp-includes/taxonomy.php | Sets the last changed time for the ‘terms’ cache group. |
| [wp\_cache\_set\_comments\_last\_changed()](wp_cache_set_comments_last_changed) wp-includes/comment.php | Sets the last changed time for the ‘comment’ cache group. |
| [wp\_cache\_set\_posts\_last\_changed()](wp_cache_set_posts_last_changed) wp-includes/post.php | Sets the last changed time for the ‘posts’ cache group. |
| [\_find\_post\_by\_old\_slug()](_find_post_by_old_slug) wp-includes/query.php | Find the post ID for redirecting an old slug. |
| [\_find\_post\_by\_old\_date()](_find_post_by_old_date) wp-includes/query.php | Find the post ID for redirecting an old date. |
| [WP\_Privacy\_Requests\_Table::get\_request\_counts()](../classes/wp_privacy_requests_table/get_request_counts) wp-admin/includes/class-wp-privacy-requests-table.php | Count number of requests for each status. |
| [WP\_Embed::find\_oembed\_post\_id()](../classes/wp_embed/find_oembed_post_id) wp-includes/class-wp-embed.php | Finds the oEmbed cache post ID for a given cache key. |
| [WP\_Customize\_Manager::find\_changeset\_post\_id()](../classes/wp_customize_manager/find_changeset_post_id) wp-includes/class-wp-customize-manager.php | Finds the changeset post ID for a given changeset UUID. |
| [wp\_cache\_get\_last\_changed()](wp_cache_get_last_changed) wp-includes/functions.php | Gets last changed date for the specified cache group. |
| [WP\_Term\_Query::get\_terms()](../classes/wp_term_query/get_terms) wp-includes/class-wp-term-query.php | Retrieves the query results. |
| [clean\_network\_cache()](clean_network_cache) wp-includes/ms-network.php | Removes a network from the object cache. |
| [WP\_Site::get\_details()](../classes/wp_site/get_details) wp-includes/class-wp-site.php | Retrieves the details for this site. |
| [update\_network\_option()](update_network_option) wp-includes/option.php | Updates the value of a network option that was already added. |
| [add\_network\_option()](add_network_option) wp-includes/option.php | Adds a new network option. |
| [get\_network\_option()](get_network_option) wp-includes/option.php | Retrieves a network’s option value based on the option name. |
| [WP\_MS\_Sites\_List\_Table::column\_users()](../classes/wp_ms_sites_list_table/column_users) wp-admin/includes/class-wp-ms-sites-list-table.php | Handles the users column output. |
| [get\_plugins()](get_plugins) wp-admin/includes/plugin.php | Checks the plugins directory and retrieve all plugin files with plugin data. |
| [wp\_get\_archives()](wp_get_archives) wp-includes/general-template.php | Displays archive links based on type and format. |
| [get\_calendar()](get_calendar) wp-includes/general-template.php | Displays calendar with days that have posts as links. |
| [WP\_Query::get\_posts()](../classes/wp_query/get_posts) wp-includes/class-wp-query.php | Retrieves an array of posts based on query variables. |
| [is\_blog\_installed()](is_blog_installed) wp-includes/functions.php | Determines whether WordPress is already installed. |
| [is\_object\_in\_term()](is_object_in_term) wp-includes/taxonomy.php | Determines if the given object is associated with any of the given terms. |
| [clean\_term\_cache()](clean_term_cache) wp-includes/taxonomy.php | Removes all of the term IDs from the cache. |
| [get\_objects\_in\_term()](get_objects_in_term) wp-includes/taxonomy.php | Retrieves object IDs of valid taxonomy and term. |
| [get\_adjacent\_post()](get_adjacent_post) wp-includes/link-template.php | Retrieves the adjacent post. |
| [set\_site\_transient()](set_site_transient) wp-includes/option.php | Sets/updates the value of a site transient. |
| [set\_transient()](set_transient) wp-includes/option.php | Sets/updates the value of a transient. |
| [update\_option()](update_option) wp-includes/option.php | Updates the value of an option that was already added. |
| [add\_option()](add_option) wp-includes/option.php | Adds a new option. |
| [delete\_option()](delete_option) wp-includes/option.php | Removes option by name. Prevents removal of protected WordPress options. |
| [get\_option()](get_option) wp-includes/option.php | Retrieves an option value based on an option name. |
| [clean\_post\_cache()](clean_post_cache) wp-includes/post.php | Will clean the post in the cache. |
| [\_get\_last\_post\_time()](_get_last_post_time) wp-includes/post.php | Gets the timestamp of the last time any post was modified or published. |
| [get\_page\_by\_path()](get_page_by_path) wp-includes/post.php | Retrieves a page given its path. |
| [get\_pages()](get_pages) wp-includes/post.php | Retrieves an array of pages (or hierarchical post type items). |
| [wp\_count\_posts()](wp_count_posts) wp-includes/post.php | Counts number of posts of a post type and if user has permissions to view. |
| [wp\_count\_attachments()](wp_count_attachments) wp-includes/post.php | Counts number of attachments for the mime type(s). |
| [wpmu\_create\_blog()](wpmu_create_blog) wp-includes/ms-functions.php | Creates a site. |
| [get\_blog\_id\_from\_url()](get_blog_id_from_url) wp-includes/ms-functions.php | Gets a blog’s numeric ID from its URL. |
| [get\_bookmarks()](get_bookmarks) wp-includes/bookmark.php | Retrieves the list of bookmarks. |
| [clean\_blog\_cache()](clean_blog_cache) wp-includes/ms-site.php | Clean the blog cache |
| [get\_blog\_details()](get_blog_details) wp-includes/ms-blogs.php | Retrieve the details for a blog from the blogs table and blog options. |
| [clean\_comment\_cache()](clean_comment_cache) wp-includes/comment.php | Removes a comment from the object cache. |
| [wp\_count\_comments()](wp_count_comments) wp-includes/comment.php | Retrieves the total comment counts for the whole site or a single post. |
| [get\_lastcommentmodified()](get_lastcommentmodified) wp-includes/comment.php | Retrieves the date the last comment was modified. |
| Version | Description |
| --- | --- |
| [2.0.0](https://developer.wordpress.org/reference/since/2.0.0/) | Introduced. |
wordpress is_year(): bool is\_year(): bool
================
Determines whether the query is for an existing year archive.
For more information on this and similar theme functions, check out the [Conditional Tags](https://developer.wordpress.org/themes/basics/conditional-tags/) article in the Theme Developer Handbook.
bool Whether the query is for an existing year archive.
File: `wp-includes/query.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/query.php/)
```
function is_year() {
global $wp_query;
if ( ! isset( $wp_query ) ) {
_doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the query is run. Before then, they always return false.' ), '3.1.0' );
return false;
}
return $wp_query->is_year();
}
```
| Uses | Description |
| --- | --- |
| [WP\_Query::is\_year()](../classes/wp_query/is_year) wp-includes/class-wp-query.php | Is the query for an existing year archive? |
| [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. |
| [\_doing\_it\_wrong()](_doing_it_wrong) wp-includes/functions.php | Marks something as being incorrectly called. |
| Used By | Description |
| --- | --- |
| [wp\_get\_document\_title()](wp_get_document_title) wp-includes/general-template.php | Returns document title for the current page. |
| [get\_the\_archive\_title()](get_the_archive_title) wp-includes/general-template.php | Retrieves the archive title based on the queried object. |
| [redirect\_canonical()](redirect_canonical) wp-includes/canonical.php | Redirects incoming links to the proper URL based on the site url. |
| Version | Description |
| --- | --- |
| [1.5.0](https://developer.wordpress.org/reference/since/1.5.0/) | Introduced. |
wordpress wp_fuzzy_number_match( int|float $expected, int|float $actual, int|float $precision = 1 ): bool wp\_fuzzy\_number\_match( int|float $expected, int|float $actual, int|float $precision = 1 ): bool
==================================================================================================
Checks if two numbers are nearly the same.
This is similar to using `round()` but the precision is more fine-grained.
`$expected` int|float Required The expected value. `$actual` int|float Required The actual number. `$precision` int|float Optional The allowed variation. Default: `1`
bool Whether the numbers match within the specified precision.
File: `wp-includes/functions.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/functions.php/)
```
function wp_fuzzy_number_match( $expected, $actual, $precision = 1 ) {
return abs( (float) $expected - (float) $actual ) <= $precision;
}
```
| Used By | Description |
| --- | --- |
| [wp\_image\_matches\_ratio()](wp_image_matches_ratio) wp-includes/media.php | Helper function to test if aspect ratios for two images match. |
| [image\_resize\_dimensions()](image_resize_dimensions) wp-includes/media.php | Retrieves calculated resize dimensions for use in [WP\_Image\_Editor](../classes/wp_image_editor). |
| Version | Description |
| --- | --- |
| [5.3.0](https://developer.wordpress.org/reference/since/5.3.0/) | Introduced. |
wordpress create_user( string $username, string $password, string $email ): int create\_user( string $username, string $password, string $email ): int
======================================================================
This function has been deprecated. Use [wp\_create\_user()](wp_create_user) instead.
An alias of [wp\_create\_user()](wp_create_user) .
* [wp\_create\_user()](wp_create_user)
`$username` string Required The user's username. `$password` string Required The user's password. `$email` string Required The user's email. int The new user's ID.
File: `wp-includes/deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/deprecated.php/)
```
function create_user($username, $password, $email) {
_deprecated_function( __FUNCTION__, '2.0.0', 'wp_create_user()' );
return wp_create_user($username, $password, $email);
}
```
| Uses | Description |
| --- | --- |
| [wp\_create\_user()](wp_create_user) wp-includes/user.php | Provides a simpler way of inserting a user into the database. |
| [\_deprecated\_function()](_deprecated_function) wp-includes/functions.php | Marks a function as deprecated and inform when it has been used. |
| Version | Description |
| --- | --- |
| [2.0.0](https://developer.wordpress.org/reference/since/2.0.0/) | Introduced. |
wordpress wp_ajax_edit_theme_plugin_file() wp\_ajax\_edit\_theme\_plugin\_file()
=====================================
Ajax handler for editing a theme or plugin file.
* [wp\_edit\_theme\_plugin\_file()](wp_edit_theme_plugin_file)
File: `wp-admin/includes/ajax-actions.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/ajax-actions.php/)
```
function wp_ajax_edit_theme_plugin_file() {
$r = wp_edit_theme_plugin_file( wp_unslash( $_POST ) ); // Validation of args is done in wp_edit_theme_plugin_file().
if ( is_wp_error( $r ) ) {
wp_send_json_error(
array_merge(
array(
'code' => $r->get_error_code(),
'message' => $r->get_error_message(),
),
(array) $r->get_error_data()
)
);
} else {
wp_send_json_success(
array(
'message' => __( 'File edited successfully.' ),
)
);
}
}
```
| Uses | Description |
| --- | --- |
| [wp\_edit\_theme\_plugin\_file()](wp_edit_theme_plugin_file) wp-admin/includes/file.php | Attempts to edit a file for a theme or plugin. |
| [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. |
| [wp\_unslash()](wp_unslash) wp-includes/formatting.php | Removes slashes from a string or recursively removes slashes from strings within an array. |
| [wp\_send\_json\_error()](wp_send_json_error) wp-includes/functions.php | Sends a JSON response back to an Ajax request, indicating failure. |
| [wp\_send\_json\_success()](wp_send_json_success) wp-includes/functions.php | Sends a JSON response back to an Ajax request, indicating success. |
| [is\_wp\_error()](is_wp_error) wp-includes/load.php | Checks whether the given variable is a WordPress Error. |
| Version | Description |
| --- | --- |
| [4.9.0](https://developer.wordpress.org/reference/since/4.9.0/) | Introduced. |
wordpress _load_textdomain_just_in_time( string $domain ): bool \_load\_textdomain\_just\_in\_time( string $domain ): bool
==========================================================
This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.
Loads plugin and theme text domains just-in-time.
When a textdomain is encountered for the first time, we try to load the translation file from `wp-content/languages`, removing the need to call [load\_plugin\_textdomain()](load_plugin_textdomain) or [load\_theme\_textdomain()](load_theme_textdomain) .
`$domain` string Required Text domain. Unique identifier for retrieving translated strings. bool True when the textdomain is successfully loaded, false otherwise.
File: `wp-includes/l10n.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/l10n.php/)
```
function _load_textdomain_just_in_time( $domain ) {
/** @var WP_Textdomain_Registry $wp_textdomain_registry */
global $l10n_unloaded, $wp_textdomain_registry;
$l10n_unloaded = (array) $l10n_unloaded;
// Short-circuit if domain is 'default' which is reserved for core.
if ( 'default' === $domain || isset( $l10n_unloaded[ $domain ] ) ) {
return false;
}
if ( ! $wp_textdomain_registry->has( $domain ) ) {
return false;
}
$locale = determine_locale();
$path = $wp_textdomain_registry->get( $domain, $locale );
if ( ! $path ) {
return false;
}
// Themes with their language directory outside of WP_LANG_DIR have a different file name.
$template_directory = trailingslashit( get_template_directory() );
$stylesheet_directory = trailingslashit( get_stylesheet_directory() );
if ( str_starts_with( $path, $template_directory ) || str_starts_with( $path, $stylesheet_directory ) ) {
$mofile = "{$path}{$locale}.mo";
} else {
$mofile = "{$path}{$domain}-{$locale}.mo";
}
return load_textdomain( $domain, $mofile, $locale );
}
```
| Uses | Description |
| --- | --- |
| [WP\_Textdomain\_Registry::has()](../classes/wp_textdomain_registry/has) wp-includes/class-wp-textdomain-registry.php | Determines whether any MO file paths are available for the domain. |
| [WP\_Textdomain\_Registry::get()](../classes/wp_textdomain_registry/get) wp-includes/class-wp-textdomain-registry.php | Returns the languages directory path for a specific domain and locale. |
| [determine\_locale()](determine_locale) wp-includes/l10n.php | Determines the current locale desired for the request. |
| [get\_template\_directory()](get_template_directory) wp-includes/theme.php | Retrieves template directory path for the active theme. |
| [get\_stylesheet\_directory()](get_stylesheet_directory) wp-includes/theme.php | Retrieves stylesheet directory path for the active theme. |
| [load\_textdomain()](load_textdomain) wp-includes/l10n.php | Loads a .mo file into the text domain $domain. |
| [trailingslashit()](trailingslashit) wp-includes/formatting.php | Appends a trailing slash. |
| Used By | Description |
| --- | --- |
| [get\_translations\_for\_domain()](get_translations_for_domain) wp-includes/l10n.php | Returns the Translations instance for a text domain. |
| Version | Description |
| --- | --- |
| [4.6.0](https://developer.wordpress.org/reference/since/4.6.0/) | Introduced. |
wordpress insert_with_markers( string $filename, string $marker, array|string $insertion ): bool insert\_with\_markers( string $filename, string $marker, array|string $insertion ): bool
========================================================================================
Inserts an array of strings into a file (.htaccess), placing it between BEGIN and END markers.
Replaces existing marked info. Retains surrounding data. Creates file if none exists.
`$filename` string Required Filename to alter. `$marker` string Required The marker to alter. `$insertion` array|string Required The new content to insert. bool True on write success, false on failure.
File: `wp-admin/includes/misc.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/misc.php/)
```
function insert_with_markers( $filename, $marker, $insertion ) {
if ( ! file_exists( $filename ) ) {
if ( ! is_writable( dirname( $filename ) ) ) {
return false;
}
if ( ! touch( $filename ) ) {
return false;
}
// Make sure the file is created with a minimum set of permissions.
$perms = fileperms( $filename );
if ( $perms ) {
chmod( $filename, $perms | 0644 );
}
} elseif ( ! is_writable( $filename ) ) {
return false;
}
if ( ! is_array( $insertion ) ) {
$insertion = explode( "\n", $insertion );
}
$switched_locale = switch_to_locale( get_locale() );
$instructions = sprintf(
/* translators: 1: Marker. */
__(
'The directives (lines) between "BEGIN %1$s" and "END %1$s" are
dynamically generated, and should only be modified via WordPress filters.
Any changes to the directives between these markers will be overwritten.'
),
$marker
);
$instructions = explode( "\n", $instructions );
foreach ( $instructions as $line => $text ) {
$instructions[ $line ] = '# ' . $text;
}
/**
* Filters the inline instructions inserted before the dynamically generated content.
*
* @since 5.3.0
*
* @param string[] $instructions Array of lines with inline instructions.
* @param string $marker The marker being inserted.
*/
$instructions = apply_filters( 'insert_with_markers_inline_instructions', $instructions, $marker );
if ( $switched_locale ) {
restore_previous_locale();
}
$insertion = array_merge( $instructions, $insertion );
$start_marker = "# BEGIN {$marker}";
$end_marker = "# END {$marker}";
$fp = fopen( $filename, 'r+' );
if ( ! $fp ) {
return false;
}
// Attempt to get a lock. If the filesystem supports locking, this will block until the lock is acquired.
flock( $fp, LOCK_EX );
$lines = array();
while ( ! feof( $fp ) ) {
$lines[] = rtrim( fgets( $fp ), "\r\n" );
}
// Split out the existing file into the preceding lines, and those that appear after the marker.
$pre_lines = array();
$post_lines = array();
$existing_lines = array();
$found_marker = false;
$found_end_marker = false;
foreach ( $lines as $line ) {
if ( ! $found_marker && false !== strpos( $line, $start_marker ) ) {
$found_marker = true;
continue;
} elseif ( ! $found_end_marker && false !== strpos( $line, $end_marker ) ) {
$found_end_marker = true;
continue;
}
if ( ! $found_marker ) {
$pre_lines[] = $line;
} elseif ( $found_marker && $found_end_marker ) {
$post_lines[] = $line;
} else {
$existing_lines[] = $line;
}
}
// Check to see if there was a change.
if ( $existing_lines === $insertion ) {
flock( $fp, LOCK_UN );
fclose( $fp );
return true;
}
// Generate the new file data.
$new_file_data = implode(
"\n",
array_merge(
$pre_lines,
array( $start_marker ),
$insertion,
array( $end_marker ),
$post_lines
)
);
// Write to the start of the file, and truncate it to that length.
fseek( $fp, 0 );
$bytes = fwrite( $fp, $new_file_data );
if ( $bytes ) {
ftruncate( $fp, ftell( $fp ) );
}
fflush( $fp );
flock( $fp, LOCK_UN );
fclose( $fp );
return (bool) $bytes;
}
```
[apply\_filters( 'insert\_with\_markers\_inline\_instructions', string[] $instructions, string $marker )](../hooks/insert_with_markers_inline_instructions)
Filters the inline instructions inserted before the dynamically generated content.
| Uses | Description |
| --- | --- |
| [restore\_previous\_locale()](restore_previous_locale) wp-includes/l10n.php | Restores the translations according to the previous locale. |
| [switch\_to\_locale()](switch_to_locale) wp-includes/l10n.php | Switches the translations according to the given locale. |
| [get\_locale()](get_locale) wp-includes/l10n.php | Retrieves the current locale. |
| [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| Used By | Description |
| --- | --- |
| [save\_mod\_rewrite\_rules()](save_mod_rewrite_rules) wp-admin/includes/misc.php | Updates the htaccess file with the current rules if it is writable. |
| Version | Description |
| --- | --- |
| [1.5.0](https://developer.wordpress.org/reference/since/1.5.0/) | Introduced. |
| programming_docs |
wordpress wp_comment_trashnotice() wp\_comment\_trashnotice()
==========================
Outputs ‘undo move to Trash’ text for comments.
File: `wp-admin/includes/template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/template.php/)
```
function wp_comment_trashnotice() {
?>
<div class="hidden" id="trash-undo-holder">
<div class="trash-undo-inside">
<?php
/* translators: %s: Comment author, filled by Ajax. */
printf( __( 'Comment by %s moved to the Trash.' ), '<strong></strong>' );
?>
<span class="undo untrash"><a href="#"><?php _e( 'Undo' ); ?></a></span>
</div>
</div>
<div class="hidden" id="spam-undo-holder">
<div class="spam-undo-inside">
<?php
/* translators: %s: Comment author, filled by Ajax. */
printf( __( 'Comment by %s marked as spam.' ), '<strong></strong>' );
?>
<span class="undo unspam"><a href="#"><?php _e( 'Undo' ); ?></a></span>
</div>
</div>
<?php
}
```
| Uses | Description |
| --- | --- |
| [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. |
| [\_e()](_e) wp-includes/l10n.php | Displays translated text. |
| Used By | Description |
| --- | --- |
| [wp\_dashboard\_recent\_comments()](wp_dashboard_recent_comments) wp-admin/includes/dashboard.php | Show Comments section. |
| [post\_comment\_meta\_box()](post_comment_meta_box) wp-admin/includes/meta-boxes.php | Displays comments for post. |
| Version | Description |
| --- | --- |
| [2.9.0](https://developer.wordpress.org/reference/since/2.9.0/) | Introduced. |
wordpress esc_html( string $text ): string esc\_html( string $text ): string
=================================
Escaping for HTML blocks.
`$text` string Required string
File: `wp-includes/formatting.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/formatting.php/)
```
function esc_html( $text ) {
$safe_text = wp_check_invalid_utf8( $text );
$safe_text = _wp_specialchars( $safe_text, ENT_QUOTES );
/**
* Filters a string cleaned and escaped for output in HTML.
*
* Text passed to esc_html() is stripped of invalid or special characters
* before output.
*
* @since 2.8.0
*
* @param string $safe_text The text after it has been escaped.
* @param string $text The text prior to being escaped.
*/
return apply_filters( 'esc_html', $safe_text, $text );
}
```
[apply\_filters( 'esc\_html', string $safe\_text, string $text )](../hooks/esc_html)
Filters a string cleaned and escaped for output in HTML.
| Uses | Description |
| --- | --- |
| [wp\_check\_invalid\_utf8()](wp_check_invalid_utf8) wp-includes/formatting.php | Checks for invalid UTF8 in a string. |
| [\_wp\_specialchars()](_wp_specialchars) wp-includes/formatting.php | Converts a number of special characters into their HTML entities. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| Used By | Description |
| --- | --- |
| [wp\_required\_field\_indicator()](wp_required_field_indicator) wp-includes/general-template.php | Assigns a visual indicator for required form fields. |
| [WP\_List\_Table::get\_views\_links()](../classes/wp_list_table/get_views_links) wp-admin/includes/class-wp-list-table.php | Generates views links. |
| [WP\_Theme\_JSON::remove\_insecure\_settings()](../classes/wp_theme_json/remove_insecure_settings) wp-includes/class-wp-theme-json.php | Processes a setting node and returns the same node without the insecure settings. |
| [WP\_Theme\_JSON::is\_safe\_css\_declaration()](../classes/wp_theme_json/is_safe_css_declaration) wp-includes/class-wp-theme-json.php | Checks that a declaration provided by the user is safe. |
| [WP\_Image\_Editor\_Imagick::write\_image()](../classes/wp_image_editor_imagick/write_image) wp-includes/class-wp-image-editor-imagick.php | Writes an image to a file or stream. |
| [WP\_Application\_Passwords\_List\_Table::column\_name()](../classes/wp_application_passwords_list_table/column_name) wp-admin/includes/class-wp-application-passwords-list-table.php | Handles the name column output. |
| [WP\_Comments\_List\_Table::comment\_type\_dropdown()](../classes/wp_comments_list_table/comment_type_dropdown) wp-admin/includes/class-wp-comments-list-table.php | Displays a comment type drop-down for filtering on the Comments list table. |
| [Plugin\_Installer\_Skin::do\_overwrite()](../classes/plugin_installer_skin/do_overwrite) wp-admin/includes/class-plugin-installer-skin.php | Check if the plugin can be overwritten and output the HTML for overwriting a plugin on upload. |
| [Theme\_Installer\_Skin::do\_overwrite()](../classes/theme_installer_skin/do_overwrite) wp-admin/includes/class-theme-installer-skin.php | Check if the theme can be overwritten and output the HTML for overwriting a theme on upload. |
| [wp\_credits\_section\_title()](wp_credits_section_title) wp-admin/includes/credits.php | Displays the title for a given group of contributors. |
| [wp\_credits\_section\_list()](wp_credits_section_list) wp-admin/includes/credits.php | Displays a list of contributors for a given group. |
| [verify\_file\_signature()](verify_file_signature) wp-admin/includes/file.php | Verifies the contents of a file against its ED25519 signature. |
| [WP\_Posts\_List\_Table::formats\_dropdown()](../classes/wp_posts_list_table/formats_dropdown) wp-admin/includes/class-wp-posts-list-table.php | Displays a formats drop-down for filtering items. |
| [WP\_Site\_Health\_Auto\_Updates::test\_constants()](../classes/wp_site_health_auto_updates/test_constants) wp-admin/includes/class-wp-site-health-auto-updates.php | Tests if auto-updates related constants are set correctly. |
| [register\_and\_do\_post\_meta\_boxes()](register_and_do_post_meta_boxes) wp-admin/includes/meta-boxes.php | Registers the default post meta boxes, and runs the `do_meta_boxes` actions. |
| [wp\_comments\_personal\_data\_exporter()](wp_comments_personal_data_exporter) wp-includes/comment.php | Finds and exports personal data associated with an email address from the comments table. |
| [wp\_comments\_personal\_data\_eraser()](wp_comments_personal_data_eraser) wp-includes/comment.php | Erases personal data associated with an email address from the comments table. |
| [get\_the\_privacy\_policy\_link()](get_the_privacy_policy_link) wp-includes/link-template.php | Returns the privacy policy link with formatting, when applicable. |
| [WP\_Privacy\_Policy\_Content::privacy\_policy\_guide()](../classes/wp_privacy_policy_content/privacy_policy_guide) wp-admin/includes/class-wp-privacy-policy-content.php | Output the privacy policy guide together with content from the theme and plugins. |
| [wp\_privacy\_generate\_personal\_data\_export\_group\_html()](wp_privacy_generate_personal_data_export_group_html) wp-admin/includes/privacy-tools.php | Generate a single group for the personal data export report. |
| [wp\_privacy\_generate\_personal\_data\_export\_file()](wp_privacy_generate_personal_data_export_file) wp-admin/includes/privacy-tools.php | Generate the personal data export file. |
| [WP\_Privacy\_Requests\_Table::column\_status()](../classes/wp_privacy_requests_table/column_status) wp-admin/includes/class-wp-privacy-requests-table.php | Status column. |
| [wp\_ajax\_wp\_privacy\_export\_personal\_data()](wp_ajax_wp_privacy_export_personal_data) wp-admin/includes/ajax-actions.php | Ajax handler for exporting a user’s personal data. |
| [wp\_ajax\_wp\_privacy\_erase\_personal\_data()](wp_ajax_wp_privacy_erase_personal_data) wp-admin/includes/ajax-actions.php | Ajax handler for erasing personal data. |
| [WP\_Widget\_Media\_Gallery::render\_control\_template\_scripts()](../classes/wp_widget_media_gallery/render_control_template_scripts) wp-includes/widgets/class-wp-widget-media-gallery.php | Render form template scripts. |
| [WP\_Customize\_Themes\_Section::filter\_drawer\_content\_template()](../classes/wp_customize_themes_section/filter_drawer_content_template) wp-includes/customize/class-wp-customize-themes-section.php | Render the filter drawer portion of a themes section as a JS template. |
| [wp\_print\_plugin\_file\_tree()](wp_print_plugin_file_tree) wp-admin/includes/misc.php | Outputs the formatted file list for the plugin file editor. |
| [wp\_print\_theme\_file\_tree()](wp_print_theme_file_tree) wp-admin/includes/misc.php | Outputs the formatted file list for the theme file editor. |
| [WP\_Widget\_Media::render\_control\_template\_scripts()](../classes/wp_widget_media/render_control_template_scripts) wp-includes/widgets/class-wp-widget-media.php | Render form template scripts. |
| [WP\_Customize\_Nav\_Menus::print\_post\_type\_container()](../classes/wp_customize_nav_menus/print_post_type_container) wp-includes/class-wp-customize-nav-menus.php | Prints the markup for new menu items. |
| [WP\_Ajax\_Upgrader\_Skin::get\_error\_messages()](../classes/wp_ajax_upgrader_skin/get_error_messages) wp-admin/includes/class-wp-ajax-upgrader-skin.php | Retrieves a string for error messages. |
| [network\_edit\_site\_nav()](network_edit_site_nav) wp-admin/includes/ms.php | Outputs the HTML for a network’s “Edit Site” tabular interface. |
| [wp\_ajax\_delete\_plugin()](wp_ajax_delete_plugin) wp-admin/includes/ajax-actions.php | Ajax handler for deleting a plugin. |
| [wp\_ajax\_install\_theme()](wp_ajax_install_theme) wp-admin/includes/ajax-actions.php | Ajax handler for installing a theme. |
| [wp\_ajax\_update\_theme()](wp_ajax_update_theme) wp-admin/includes/ajax-actions.php | Ajax handler for updating a theme. |
| [wp\_ajax\_delete\_theme()](wp_ajax_delete_theme) wp-admin/includes/ajax-actions.php | Ajax handler for deleting a theme. |
| [wp\_ajax\_install\_plugin()](wp_ajax_install_plugin) wp-admin/includes/ajax-actions.php | Ajax handler for installing a plugin. |
| [the\_embed\_site\_title()](the_embed_site_title) wp-includes/embed.php | Prints the necessary markup for the site title in an embed template. |
| [WP\_Customize\_Widgets::start\_dynamic\_sidebar()](../classes/wp_customize_widgets/start_dynamic_sidebar) wp-includes/class-wp-customize-widgets.php | Begins keeping track of the current sidebar being rendered. |
| [WP\_Customize\_Widgets::end\_dynamic\_sidebar()](../classes/wp_customize_widgets/end_dynamic_sidebar) wp-includes/class-wp-customize-widgets.php | Finishes keeping track of the current sidebar being rendered. |
| [\_oembed\_create\_xml()](_oembed_create_xml) wp-includes/embed.php | Creates an XML string from a given array. |
| [WP\_Customize\_Nav\_Menu\_Location\_Control::render\_content()](../classes/wp_customize_nav_menu_location_control/render_content) wp-includes/customize/class-wp-customize-nav-menu-location-control.php | Render content just like a normal select control. |
| [WP\_Customize\_Nav\_Menu\_Setting::sanitize()](../classes/wp_customize_nav_menu_setting/sanitize) wp-includes/customize/class-wp-customize-nav-menu-setting.php | Sanitize an input. |
| [WP\_Customize\_Nav\_Menus::available\_items\_template()](../classes/wp_customize_nav_menus/available_items_template) wp-includes/class-wp-customize-nav-menus.php | Prints the HTML template used to render the add-menu-item frame. |
| [WP\_Customize\_Nav\_Menus::enqueue\_scripts()](../classes/wp_customize_nav_menus/enqueue_scripts) wp-includes/class-wp-customize-nav-menus.php | Enqueues scripts and styles for Customizer pane. |
| [WP\_Customize\_New\_Menu\_Section::render()](../classes/wp_customize_new_menu_section/render) wp-includes/customize/class-wp-customize-new-menu-section.php | Render the section, and the controls that have been added to it. |
| [WP\_Posts\_List\_Table::column\_title()](../classes/wp_posts_list_table/column_title) wp-admin/includes/class-wp-posts-list-table.php | Handles the title column output. |
| [WP\_Posts\_List\_Table::column\_default()](../classes/wp_posts_list_table/column_default) wp-admin/includes/class-wp-posts-list-table.php | Handles the default column output. |
| [WP\_Comments\_List\_Table::handle\_row\_actions()](../classes/wp_comments_list_table/handle_row_actions) wp-admin/includes/class-wp-comments-list-table.php | Generates and displays row actions links. |
| [WP\_Media\_List\_Table::column\_default()](../classes/wp_media_list_table/column_default) wp-admin/includes/class-wp-media-list-table.php | Handles output for the default column. |
| [WP\_Media\_List\_Table::column\_title()](../classes/wp_media_list_table/column_title) wp-admin/includes/class-wp-media-list-table.php | Handles the title column output. |
| [the\_meta()](the_meta) wp-includes/post-template.php | Displays a list of post custom fields. |
| [wp\_ajax\_update\_plugin()](wp_ajax_update_plugin) wp-admin/includes/ajax-actions.php | Ajax handler for updating a plugin. |
| [WP\_Customize\_Manager::render\_control\_templates()](../classes/wp_customize_manager/render_control_templates) wp-includes/class-wp-customize-manager.php | Renders JS templates for all registered control types. |
| [\_navigation\_markup()](_navigation_markup) wp-includes/link-template.php | Wraps passed links in navigational markup. |
| [WP\_Date\_Query::validate\_date\_values()](../classes/wp_date_query/validate_date_values) wp-includes/class-wp-date-query.php | Validates the given date\_query values and triggers errors if something is not valid. |
| [WP\_Customize\_Section::json()](../classes/wp_customize_section/json) wp-includes/class-wp-customize-section.php | Gather the parameters passed to client JavaScript via JSON. |
| [wp\_dropdown\_languages()](wp_dropdown_languages) wp-includes/l10n.php | Displays or returns a Language selector. |
| [wp\_ajax\_parse\_embed()](wp_ajax_parse_embed) wp-admin/includes/ajax-actions.php | Apply [embed] Ajax handlers to a string. |
| [wp\_install\_language\_form()](wp_install_language_form) wp-admin/includes/translation-install.php | Output the select form for the language selection on the installation screen. |
| [signup\_user()](signup_user) wp-signup.php | Shows a form for a visitor to sign up for a new user account. |
| [show\_blog\_form()](show_blog_form) wp-signup.php | Generates and displays the Sign-up and Create Site forms. |
| [WP\_Upgrader::fs\_connect()](../classes/wp_upgrader/fs_connect) wp-admin/includes/class-wp-upgrader.php | Connect to the filesystem. |
| [WP\_Screen::render\_screen\_meta()](../classes/wp_screen/render_screen_meta) wp-admin/includes/class-wp-screen.php | Renders the screen’s help section. |
| [WP\_Plugins\_List\_Table::no\_items()](../classes/wp_plugins_list_table/no_items) wp-admin/includes/class-wp-plugins-list-table.php | |
| [wp\_dropdown\_cats()](wp_dropdown_cats) wp-admin/includes/deprecated.php | Legacy function used for generating a categories drop-down control. |
| [install\_themes\_dashboard()](install_themes_dashboard) wp-admin/includes/theme-install.php | Displays tags filter for themes. |
| [Bulk\_Upgrader\_Skin::error()](../classes/bulk_upgrader_skin/error) wp-admin/includes/class-bulk-upgrader-skin.php | |
| [WP\_Upgrader\_Skin::error()](../classes/wp_upgrader_skin/error) wp-admin/includes/class-wp-upgrader-skin.php | |
| [mu\_dropdown\_languages()](mu_dropdown_languages) wp-admin/includes/ms.php | Generates and displays a drop-down of available languages. |
| [new\_user\_email\_admin\_notice()](new_user_email_admin_notice) wp-includes/user.php | Adds an admin notice alerting the user to check for confirmation request email after email address change. |
| [wp\_image\_editor()](wp_image_editor) wp-admin/includes/image-edit.php | Loads the WP image-editing interface. |
| [admin\_color\_scheme\_picker()](admin_color_scheme_picker) wp-admin/includes/misc.php | Displays the default admin color scheme picker (Used in user-edit.php). |
| [install\_plugin\_information()](install_plugin_information) wp-admin/includes/plugin-install.php | Displays plugin information in dialog box form. |
| [wp\_dashboard\_browser\_nag()](wp_dashboard_browser_nag) wp-admin/includes/dashboard.php | Displays the browser update nag. |
| [wp\_dashboard\_plugins\_output()](wp_dashboard_plugins_output) wp-admin/includes/deprecated.php | Display plugins text for the WordPress news widget. |
| [wp\_dashboard\_recent\_drafts()](wp_dashboard_recent_drafts) wp-admin/includes/dashboard.php | Show recent drafts of the user on the dashboard. |
| [\_wp\_dashboard\_recent\_comments\_row()](_wp_dashboard_recent_comments_row) wp-admin/includes/dashboard.php | Outputs a row for the Recent Comments widget. |
| [WP\_Plugin\_Install\_List\_Table::display\_rows()](../classes/wp_plugin_install_list_table/display_rows) wp-admin/includes/class-wp-plugin-install-list-table.php | |
| [Walker\_Category\_Checklist::start\_el()](../classes/walker_category_checklist/start_el) wp-admin/includes/class-walker-category-checklist.php | Start the element output. |
| [\_draft\_or\_post\_title()](_draft_or_post_title) wp-admin/includes/template.php | Gets the post title. |
| [get\_inline\_data()](get_inline_data) wp-admin/includes/template.php | Adds hidden fields with the data for use in the inline editor for posts and pages. |
| [meta\_form()](meta_form) wp-admin/includes/template.php | Prints the form in the Custom Fields meta box. |
| [page\_template\_dropdown()](page_template_dropdown) wp-admin/includes/template.php | Prints out option HTML elements for the page templates drop-down. |
| [parent\_dropdown()](parent_dropdown) wp-admin/includes/template.php | Prints out option HTML elements for the page parents drop-down. |
| [do\_accordion\_sections()](do_accordion_sections) wp-admin/includes/template.php | Meta Box Accordion Template Function. |
| [wp\_popular\_terms\_checklist()](wp_popular_terms_checklist) wp-admin/includes/template.php | Retrieves a list of the most popular terms from the specified taxonomy. |
| [wp\_link\_category\_checklist()](wp_link_category_checklist) wp-admin/includes/template.php | Outputs a link category checklist element. |
| [WP\_Users\_List\_Table::single\_row()](../classes/wp_users_list_table/single_row) wp-admin/includes/class-wp-users-list-table.php | Generate HTML for a single row on the users.php admin panel. |
| [media\_upload\_type\_form()](media_upload_type_form) wp-admin/includes/media.php | Outputs the legacy media upload form for a given media type. |
| [media\_upload\_library\_form()](media_upload_library_form) wp-admin/includes/media.php | Outputs the legacy media upload form for the media library. |
| [attachment\_submitbox\_metadata()](attachment_submitbox_metadata) wp-admin/includes/media.php | Displays non-editable attachment metadata in the publish meta box. |
| [get\_media\_item()](get_media_item) wp-admin/includes/media.php | Retrieves HTML form for modifying the image attachment. |
| [media\_upload\_form()](media_upload_form) wp-admin/includes/media.php | Outputs the legacy media upload form. |
| [wp\_media\_upload\_handler()](wp_media_upload_handler) wp-admin/includes/media.php | Handles the process of uploading media. |
| [get\_sample\_permalink\_html()](get_sample_permalink_html) wp-admin/includes/post.php | Returns the HTML of the sample permalink slug editor. |
| [\_wp\_post\_thumbnail\_html()](_wp_post_thumbnail_html) wp-admin/includes/post.php | Returns HTML for the post thumbnail meta box. |
| [\_admin\_notice\_post\_locked()](_admin_notice_post_locked) wp-admin/includes/post.php | Outputs the HTML for the notice to say that someone else is editing or has taken over editing of this post. |
| [get\_default\_post\_to\_edit()](get_default_post_to_edit) wp-admin/includes/post.php | Returns default post information to use when populating the “Write Post” form. |
| [wp\_ajax\_upload\_attachment()](wp_ajax_upload_attachment) wp-admin/includes/ajax-actions.php | Ajax handler for uploading attachments |
| [wp\_ajax\_wp\_fullscreen\_save\_post()](wp_ajax_wp_fullscreen_save_post) wp-admin/includes/ajax-actions.php | Ajax handler for saving posts from the fullscreen editor. |
| [wp\_ajax\_inline\_save()](wp_ajax_inline_save) wp-admin/includes/ajax-actions.php | Ajax handler for Quick Edit saving a post from a list table. |
| [wp\_ajax\_find\_posts()](wp_ajax_find_posts) wp-admin/includes/ajax-actions.php | Ajax handler for querying posts for the Find Posts modal. |
| [wp\_ajax\_add\_link\_category()](wp_ajax_add_link_category) wp-admin/includes/ajax-actions.php | Ajax handler for adding a link category. |
| [wp\_get\_revision\_ui\_diff()](wp_get_revision_ui_diff) wp-admin/includes/revision.php | Get the revision UI diff. |
| [post\_trackback\_meta\_box()](post_trackback_meta_box) wp-admin/includes/meta-boxes.php | Displays trackback links form fields. |
| [page\_attributes\_meta\_box()](page_attributes_meta_box) wp-admin/includes/meta-boxes.php | Displays page attributes form fields. |
| [post\_submit\_meta\_box()](post_submit_meta_box) wp-admin/includes/meta-boxes.php | Displays post submit form fields. |
| [post\_format\_meta\_box()](post_format_meta_box) wp-admin/includes/meta-boxes.php | Displays post format form elements. |
| [post\_categories\_meta\_box()](post_categories_meta_box) wp-admin/includes/meta-boxes.php | Displays post categories form fields. |
| [edit\_link()](edit_link) wp-admin/includes/bookmark.php | Updates or inserts a link using values provided in $\_POST. |
| [WP\_Comments\_List\_Table::column\_author()](../classes/wp_comments_list_table/column_author) wp-admin/includes/class-wp-comments-list-table.php | |
| [WP\_Comments\_List\_Table::column\_response()](../classes/wp_comments_list_table/column_response) wp-admin/includes/class-wp-comments-list-table.php | |
| [WP\_Comments\_List\_Table::column\_comment()](../classes/wp_comments_list_table/column_comment) wp-admin/includes/class-wp-comments-list-table.php | |
| [Walker\_Nav\_Menu\_Edit::start\_el()](../classes/walker_nav_menu_edit/start_el) wp-admin/includes/class-walker-nav-menu-edit.php | Start the element output. |
| [Walker\_Nav\_Menu\_Checklist::start\_el()](../classes/walker_nav_menu_checklist/start_el) wp-admin/includes/class-walker-nav-menu-checklist.php | Start the element output. |
| [wp\_nav\_menu\_item\_taxonomy\_meta\_box()](wp_nav_menu_item_taxonomy_meta_box) wp-admin/includes/nav-menu.php | Displays a meta box for a taxonomy menu item. |
| [request\_filesystem\_credentials()](request_filesystem_credentials) wp-admin/includes/file.php | Displays a form to the user to request for their FTP/SSH details in order to connect to the filesystem. |
| [WP\_Posts\_List\_Table::inline\_edit()](../classes/wp_posts_list_table/inline_edit) wp-admin/includes/class-wp-posts-list-table.php | Outputs the hidden row displayed when inline editing |
| [wp\_list\_widget\_controls()](wp_list_widget_controls) wp-admin/includes/widgets.php | Show the widgets and their settings for a sidebar. |
| [wp\_widget\_control()](wp_widget_control) wp-admin/includes/widgets.php | Meta widget used to display the control form for a widget. |
| [\_wp\_credits\_add\_profile\_link()](_wp_credits_add_profile_link) wp-admin/includes/credits.php | Retrieve the link to a contributor’s WordPress.org profile page. |
| [\_wp\_credits\_build\_object\_link()](_wp_credits_build_object_link) wp-admin/includes/credits.php | Retrieve the link to an external library used in WordPress. |
| [Custom\_Image\_Header::step\_1()](../classes/custom_image_header/step_1) wp-admin/includes/class-custom-image-header.php | Display first step of custom header image page. |
| [WP\_Object\_Cache::stats()](../classes/wp_object_cache/stats) wp-includes/class-wp-object-cache.php | Echoes the stats of the caching. |
| [wp\_generate\_tag\_cloud()](wp_generate_tag_cloud) wp-includes/category-template.php | Generates a tag cloud (heatmap) from provided data. |
| [esc\_html\_\_()](esc_html__) wp-includes/l10n.php | Retrieves the translation of $text and escapes it for safe use in HTML output. |
| [esc\_html\_e()](esc_html_e) wp-includes/l10n.php | Displays translated text that has been escaped for safe use in HTML output. |
| [esc\_html\_x()](esc_html_x) wp-includes/l10n.php | Translates string with gettext context, and escapes it for safe use in HTML output. |
| [sanitize\_option()](sanitize_option) wp-includes/formatting.php | Sanitizes various option values based on the nature of the option. |
| [wp\_pre\_kses\_less\_than\_callback()](wp_pre_kses_less_than_callback) wp-includes/formatting.php | Callback function used by preg\_replace. |
| [wp\_login\_form()](wp_login_form) wp-includes/general-template.php | Provides a simple login form for use anywhere within WordPress. |
| [wp\_specialchars()](wp_specialchars) wp-includes/deprecated.php | Legacy escaping for HTML blocks. |
| [the\_content\_rss()](the_content_rss) wp-includes/deprecated.php | Display the post content for the feed. |
| [WP\_Theme::markup\_header()](../classes/wp_theme/markup_header) wp-includes/class-wp-theme.php | Marks up a theme header. |
| [WP\_Theme::\_\_construct()](../classes/wp_theme/__construct) wp-includes/class-wp-theme.php | Constructor for [WP\_Theme](../classes/wp_theme). |
| [wp\_timezone\_choice()](wp_timezone_choice) wp-includes/functions.php | Gives a nicely-formatted list of timezone strings. |
| [wp\_nonce\_url()](wp_nonce_url) wp-includes/functions.php | Retrieves URL with nonce added to URL query. |
| [wp\_upload\_dir()](wp_upload_dir) wp-includes/functions.php | Returns an array containing the current upload directory’s path and URL. |
| [WP\_Nav\_Menu\_Widget::form()](../classes/wp_nav_menu_widget/form) wp-includes/widgets/class-wp-nav-menu-widget.php | Outputs the settings form for the Navigation Menu widget. |
| [WP\_Widget\_Tag\_Cloud::form()](../classes/wp_widget_tag_cloud/form) wp-includes/widgets/class-wp-widget-tag-cloud.php | Outputs the Tag Cloud widget settings form. |
| [WP\_Widget\_RSS::widget()](../classes/wp_widget_rss/widget) wp-includes/widgets/class-wp-widget-rss.php | Outputs the content for the current RSS widget instance. |
| [WP\_Widget\_Archives::widget()](../classes/wp_widget_archives/widget) wp-includes/widgets/class-wp-widget-archives.php | Outputs the content for the current Archives widget instance. |
| [WP\_Widget\_Links::form()](../classes/wp_widget_links/form) wp-includes/widgets/class-wp-widget-links.php | Outputs the settings form for the Links widget. |
| [wp\_widget\_rss\_output()](wp_widget_rss_output) wp-includes/widgets.php | Display the RSS entries in a list. |
| [wp\_widget\_rss\_form()](wp_widget_rss_form) wp-includes/widgets.php | Display RSS widget options form. |
| [WP\_Embed::maybe\_make\_link()](../classes/wp_embed/maybe_make_link) wp-includes/class-wp-embed.php | Conditionally makes a hyperlink based on an internal class variable. |
| [sanitize\_term\_field()](sanitize_term_field) wp-includes/taxonomy.php | Sanitizes the field value in the term based on the context. |
| [wp\_version\_check()](wp_version_check) wp-includes/update.php | Checks WordPress version against the newest version. |
| [WP\_oEmbed::data2html()](../classes/wp_oembed/data2html) wp-includes/class-wp-oembed.php | Converts a data object from [WP\_oEmbed::fetch()](../classes/wp_oembed/fetch) and returns the HTML. |
| [wp\_admin\_bar\_site\_menu()](wp_admin_bar_site_menu) wp-includes/admin-bar.php | Adds the “Site Name” menu. |
| [wp\_protect\_special\_option()](wp_protect_special_option) wp-includes/option.php | Protects WordPress special option from being modified. |
| [wp\_dropdown\_users()](wp_dropdown_users) wp-includes/user.php | Creates dropdown HTML content of users. |
| [sanitize\_user\_field()](sanitize_user_field) wp-includes/user.php | Sanitizes user field based on context. |
| [Walker\_PageDropdown::start\_el()](../classes/walker_pagedropdown/start_el) wp-includes/class-walker-page-dropdown.php | Starts the element output. |
| [wp\_get\_attachment\_link()](wp_get_attachment_link) wp-includes/post-template.php | Retrieves an attachment page link using an image or icon, if possible. |
| [wp\_video\_shortcode()](wp_video_shortcode) wp-includes/media.php | Builds the Video shortcode output. |
| [wp\_audio\_shortcode()](wp_audio_shortcode) wp-includes/media.php | Builds the Audio shortcode output. |
| [wpmu\_welcome\_user\_notification()](wpmu_welcome_user_notification) wp-includes/ms-functions.php | Notifies a user that their account activation has been successful. |
| [wpmu\_welcome\_notification()](wpmu_welcome_notification) wp-includes/ms-functions.php | Notifies the site administrator that their site activation was successful. |
| [wpmu\_signup\_blog\_notification()](wpmu_signup_blog_notification) wp-includes/ms-functions.php | Sends a confirmation request email to a user when they sign up for a new site. The new site will not become active until the confirmation link is clicked. |
| [wpmu\_signup\_user\_notification()](wpmu_signup_user_notification) wp-includes/ms-functions.php | Sends a confirmation request email to a user when they sign up for a new user account (without signing up for a site at the same time). The user account will not become active until the confirmation link is clicked. |
| [sanitize\_bookmark\_field()](sanitize_bookmark_field) wp-includes/bookmark.php | Sanitizes a bookmark field. |
| [wpmu\_admin\_do\_redirect()](wpmu_admin_do_redirect) wp-includes/ms-deprecated.php | Redirect a user based on $\_GET or $\_POST arguments. |
| [wp\_update\_nav\_menu\_object()](wp_update_nav_menu_object) wp-includes/nav-menu.php | Saves the properties of a menu or create a new menu with those properties. |
| [wp\_rss()](wp_rss) wp-includes/rss.php | Display all RSS items in a HTML ordered list. |
| [get\_rss()](get_rss) wp-includes/rss.php | Display RSS items in HTML list items. |
| [wp\_xmlrpc\_server::pingback\_ping()](../classes/wp_xmlrpc_server/pingback_ping) wp-includes/class-wp-xmlrpc-server.php | Retrieves a pingback and registers it. |
| [wp\_xmlrpc\_server::mw\_getCategories()](../classes/wp_xmlrpc_server/mw_getcategories) wp-includes/class-wp-xmlrpc-server.php | Retrieve the list of categories on a given blog. |
| [wp\_xmlrpc\_server::wp\_getTags()](../classes/wp_xmlrpc_server/wp_gettags) wp-includes/class-wp-xmlrpc-server.php | Get list of all tags |
| [WP\_Customize\_Control::render\_content()](../classes/wp_customize_control/render_content) wp-includes/class-wp-customize-control.php | Render the control’s content. |
| [wp\_widget\_description()](wp_widget_description) wp-includes/widgets.php | Retrieve description for widget. |
| [get\_cancel\_comment\_reply\_link()](get_cancel_comment_reply_link) wp-includes/comment-template.php | Retrieves HTML content for cancel comment reply link. |
| [get\_comment\_author\_email\_link()](get_comment_author_email_link) wp-includes/comment-template.php | Returns the HTML email link to the author of the current comment. |
| [comment\_author\_IP()](comment_author_ip) wp-includes/comment-template.php | Displays the IP address of the author of the current comment. |
| [WP\_Customize\_Widgets::output\_widget\_control\_templates()](../classes/wp_customize_widgets/output_widget_control_templates) wp-includes/class-wp-customize-widgets.php | Renders the widget form control templates into the DOM. |
| [\_WP\_Editors::wp\_link\_query()](../classes/_wp_editors/wp_link_query) wp-includes/class-wp-editor.php | Performs post queries for internal linking. |
| [wp\_print\_media\_templates()](wp_print_media_templates) wp-includes/media-template.php | Prints the templates used in the media manager. |
| Version | Description |
| --- | --- |
| [2.8.0](https://developer.wordpress.org/reference/since/2.8.0/) | Introduced. |
| programming_docs |
wordpress network_domain_check(): string|false network\_domain\_check(): string|false
======================================
Check for an existing network.
string|false Base domain if network exists, otherwise false.
File: `wp-admin/includes/network.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/network.php/)
```
function network_domain_check() {
global $wpdb;
$sql = $wpdb->prepare( 'SHOW TABLES LIKE %s', $wpdb->esc_like( $wpdb->site ) );
if ( $wpdb->get_var( $sql ) ) {
return $wpdb->get_var( "SELECT domain FROM $wpdb->site ORDER BY id ASC LIMIT 1" );
}
return false;
}
```
| Uses | Description |
| --- | --- |
| [wpdb::esc\_like()](../classes/wpdb/esc_like) wp-includes/class-wpdb.php | First half of escaping for `LIKE` special characters `%` and `_` before preparing for SQL. |
| [wpdb::get\_var()](../classes/wpdb/get_var) wp-includes/class-wpdb.php | Retrieves one variable from the database. |
| [wpdb::prepare()](../classes/wpdb/prepare) wp-includes/class-wpdb.php | Prepares a SQL query for safe execution. |
| Used By | Description |
| --- | --- |
| [get\_clean\_basedomain()](get_clean_basedomain) wp-admin/includes/network.php | Get base domain of network. |
| Version | Description |
| --- | --- |
| [3.0.0](https://developer.wordpress.org/reference/since/3.0.0/) | Introduced. |
wordpress wp_is_site_protected_by_basic_auth( string $context = '' ): bool wp\_is\_site\_protected\_by\_basic\_auth( string $context = '' ): bool
======================================================================
Checks if this site is protected by HTTP Basic Auth.
At the moment, this merely checks for the present of Basic Auth credentials. Therefore, calling this function with a context different from the current context may give inaccurate results.
In a future release, this evaluation may be made more robust.
Currently, this is only used by Application Passwords to prevent a conflict since it also utilizes Basic Auth.
`$context` string Optional The context to check for protection. Accepts `'login'`, `'admin'`, and `'front'`.
Defaults to the current context. Default: `''`
bool Whether the site is protected by Basic Auth.
File: `wp-includes/load.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/load.php/)
```
function wp_is_site_protected_by_basic_auth( $context = '' ) {
global $pagenow;
if ( ! $context ) {
if ( 'wp-login.php' === $pagenow ) {
$context = 'login';
} elseif ( is_admin() ) {
$context = 'admin';
} else {
$context = 'front';
}
}
$is_protected = ! empty( $_SERVER['PHP_AUTH_USER'] ) || ! empty( $_SERVER['PHP_AUTH_PW'] );
/**
* Filters whether a site is protected by HTTP Basic Auth.
*
* @since 5.6.1
*
* @param bool $is_protected Whether the site is protected by Basic Auth.
* @param string $context The context to check for protection. One of 'login', 'admin', or 'front'.
*/
return apply_filters( 'wp_is_site_protected_by_basic_auth', $is_protected, $context );
}
```
[apply\_filters( 'wp\_is\_site\_protected\_by\_basic\_auth', bool $is\_protected, string $context )](../hooks/wp_is_site_protected_by_basic_auth)
Filters whether a site is protected by HTTP Basic Auth.
| Uses | Description |
| --- | --- |
| [is\_admin()](is_admin) wp-includes/load.php | Determines whether the current request is for an administrative interface page. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| Used By | Description |
| --- | --- |
| [WP\_Site\_Health::get\_tests()](../classes/wp_site_health/get_tests) wp-admin/includes/class-wp-site-health.php | Returns a set of tests that belong to the site status page. |
| Version | Description |
| --- | --- |
| [5.6.1](https://developer.wordpress.org/reference/since/5.6.1/) | Introduced. |
wordpress media_handle_upload( string $file_id, int $post_id, array $post_data = array(), array $overrides = array('test_form' => false) ): int|WP_Error media\_handle\_upload( string $file\_id, int $post\_id, array $post\_data = array(), array $overrides = array('test\_form' => false) ): int|WP\_Error
=====================================================================================================================================================
Saves a file submitted from a POST request and create an attachment post for it.
`$file_id` string Required Index of the `$_FILES` array that the file was sent. `$post_id` int Required The post ID of a post to attach the media item to. Required, but can be set to 0, creating a media item that has no relationship to a post. `$post_data` array Optional Overwrite some of the attachment. Default: `array()`
`$overrides` array Optional Override the [wp\_handle\_upload()](wp_handle_upload) behavior. More Arguments from wp\_handle\_upload( ... $overrides ) An array of override parameters for this file, or boolean false if none are provided.
* `upload_error_handler`callableFunction to call when there is an error during the upload process.
@see [wp\_handle\_upload\_error()](wp_handle_upload_error) .
* `unique_filename_callback`callableFunction to call when determining a unique file name for the file.
@see [wp\_unique\_filename()](wp_unique_filename) .
* `upload_error_strings`string[]The strings that describe the error indicated in `$_FILES[{form field}]['error']`.
* `test_form`boolWhether to test that the `$_POST['action']` parameter is as expected.
* `test_size`boolWhether to test that the file size is greater than zero bytes.
* `test_type`boolWhether to test that the mime type of the file is as expected.
* `mimes`string[]Array of allowed mime types keyed by their file extension regex.
Default: `array('test_form' => false)`
int|[WP\_Error](../classes/wp_error) ID of the attachment or a [WP\_Error](../classes/wp_error) object on failure.
File: `wp-admin/includes/media.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/media.php/)
```
function media_handle_upload( $file_id, $post_id, $post_data = array(), $overrides = array( 'test_form' => false ) ) {
$time = current_time( 'mysql' );
$post = get_post( $post_id );
if ( $post ) {
// The post date doesn't usually matter for pages, so don't backdate this upload.
if ( 'page' !== $post->post_type && substr( $post->post_date, 0, 4 ) > 0 ) {
$time = $post->post_date;
}
}
$file = wp_handle_upload( $_FILES[ $file_id ], $overrides, $time );
if ( isset( $file['error'] ) ) {
return new WP_Error( 'upload_error', $file['error'] );
}
$name = $_FILES[ $file_id ]['name'];
$ext = pathinfo( $name, PATHINFO_EXTENSION );
$name = wp_basename( $name, ".$ext" );
$url = $file['url'];
$type = $file['type'];
$file = $file['file'];
$title = sanitize_text_field( $name );
$content = '';
$excerpt = '';
if ( preg_match( '#^audio#', $type ) ) {
$meta = wp_read_audio_metadata( $file );
if ( ! empty( $meta['title'] ) ) {
$title = $meta['title'];
}
if ( ! empty( $title ) ) {
if ( ! empty( $meta['album'] ) && ! empty( $meta['artist'] ) ) {
/* translators: 1: Audio track title, 2: Album title, 3: Artist name. */
$content .= sprintf( __( '"%1$s" from %2$s by %3$s.' ), $title, $meta['album'], $meta['artist'] );
} elseif ( ! empty( $meta['album'] ) ) {
/* translators: 1: Audio track title, 2: Album title. */
$content .= sprintf( __( '"%1$s" from %2$s.' ), $title, $meta['album'] );
} elseif ( ! empty( $meta['artist'] ) ) {
/* translators: 1: Audio track title, 2: Artist name. */
$content .= sprintf( __( '"%1$s" by %2$s.' ), $title, $meta['artist'] );
} else {
/* translators: %s: Audio track title. */
$content .= sprintf( __( '"%s".' ), $title );
}
} elseif ( ! empty( $meta['album'] ) ) {
if ( ! empty( $meta['artist'] ) ) {
/* translators: 1: Audio album title, 2: Artist name. */
$content .= sprintf( __( '%1$s by %2$s.' ), $meta['album'], $meta['artist'] );
} else {
$content .= $meta['album'] . '.';
}
} elseif ( ! empty( $meta['artist'] ) ) {
$content .= $meta['artist'] . '.';
}
if ( ! empty( $meta['year'] ) ) {
/* translators: Audio file track information. %d: Year of audio track release. */
$content .= ' ' . sprintf( __( 'Released: %d.' ), $meta['year'] );
}
if ( ! empty( $meta['track_number'] ) ) {
$track_number = explode( '/', $meta['track_number'] );
if ( is_numeric( $track_number[0] ) ) {
if ( isset( $track_number[1] ) && is_numeric( $track_number[1] ) ) {
$content .= ' ' . sprintf(
/* translators: Audio file track information. 1: Audio track number, 2: Total audio tracks. */
__( 'Track %1$s of %2$s.' ),
number_format_i18n( $track_number[0] ),
number_format_i18n( $track_number[1] )
);
} else {
$content .= ' ' . sprintf(
/* translators: Audio file track information. %s: Audio track number. */
__( 'Track %s.' ),
number_format_i18n( $track_number[0] )
);
}
}
}
if ( ! empty( $meta['genre'] ) ) {
/* translators: Audio file genre information. %s: Audio genre name. */
$content .= ' ' . sprintf( __( 'Genre: %s.' ), $meta['genre'] );
}
// Use image exif/iptc data for title and caption defaults if possible.
} elseif ( 0 === strpos( $type, 'image/' ) ) {
$image_meta = wp_read_image_metadata( $file );
if ( $image_meta ) {
if ( trim( $image_meta['title'] ) && ! is_numeric( sanitize_title( $image_meta['title'] ) ) ) {
$title = $image_meta['title'];
}
if ( trim( $image_meta['caption'] ) ) {
$excerpt = $image_meta['caption'];
}
}
}
// Construct the attachment array.
$attachment = array_merge(
array(
'post_mime_type' => $type,
'guid' => $url,
'post_parent' => $post_id,
'post_title' => $title,
'post_content' => $content,
'post_excerpt' => $excerpt,
),
$post_data
);
// This should never be set as it would then overwrite an existing attachment.
unset( $attachment['ID'] );
// Save the data.
$attachment_id = wp_insert_attachment( $attachment, $file, $post_id, true );
if ( ! is_wp_error( $attachment_id ) ) {
// Set a custom header with the attachment_id.
// Used by the browser/client to resume creating image sub-sizes after a PHP fatal error.
if ( ! headers_sent() ) {
header( 'X-WP-Upload-Attachment-ID: ' . $attachment_id );
}
// The image sub-sizes are created during wp_generate_attachment_metadata().
// This is generally slow and may cause timeouts or out of memory errors.
wp_update_attachment_metadata( $attachment_id, wp_generate_attachment_metadata( $attachment_id, $file ) );
}
return $attachment_id;
}
```
| Uses | Description |
| --- | --- |
| [wp\_read\_image\_metadata()](wp_read_image_metadata) wp-admin/includes/image.php | Gets extended image metadata, exif or iptc as available. |
| [wp\_generate\_attachment\_metadata()](wp_generate_attachment_metadata) wp-admin/includes/image.php | Generates attachment meta data and create image sub-sizes for images. |
| [wp\_read\_audio\_metadata()](wp_read_audio_metadata) wp-admin/includes/media.php | Retrieves metadata from an audio file’s ID3 tags. |
| [wp\_handle\_upload()](wp_handle_upload) wp-admin/includes/file.php | Wrapper for [\_wp\_handle\_upload()](_wp_handle_upload) . |
| [sanitize\_text\_field()](sanitize_text_field) wp-includes/formatting.php | Sanitizes a string from user input or from the database. |
| [sanitize\_title()](sanitize_title) wp-includes/formatting.php | Sanitizes a string into a slug, which can be used in URLs or HTML attributes. |
| [current\_time()](current_time) wp-includes/functions.php | Retrieves the current time based on specified type. |
| [wp\_insert\_attachment()](wp_insert_attachment) wp-includes/post.php | Inserts an attachment. |
| [wp\_update\_attachment\_metadata()](wp_update_attachment_metadata) wp-includes/post.php | Updates metadata for an attachment. |
| [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. |
| [wp\_basename()](wp_basename) wp-includes/formatting.php | i18n-friendly version of basename(). |
| [number\_format\_i18n()](number_format_i18n) wp-includes/functions.php | Converts float number to format based on the locale. |
| [get\_post()](get_post) wp-includes/post.php | Retrieves post data given a post ID or post object. |
| [is\_wp\_error()](is_wp_error) wp-includes/load.php | Checks whether the given variable is a WordPress Error. |
| [WP\_Error::\_\_construct()](../classes/wp_error/__construct) wp-includes/class-wp-error.php | Initializes the error. |
| Used By | Description |
| --- | --- |
| [wp\_media\_upload\_handler()](wp_media_upload_handler) wp-admin/includes/media.php | Handles the process of uploading media. |
| [wp\_ajax\_upload\_attachment()](wp_ajax_upload_attachment) wp-admin/includes/ajax-actions.php | Ajax handler for uploading attachments |
| Version | Description |
| --- | --- |
| [2.5.0](https://developer.wordpress.org/reference/since/2.5.0/) | Introduced. |
wordpress wp_assign_widget_to_sidebar( string $widget_id, string $sidebar_id ) wp\_assign\_widget\_to\_sidebar( string $widget\_id, string $sidebar\_id )
==========================================================================
Assigns a widget to the given sidebar.
`$widget_id` string Required The widget ID to assign. `$sidebar_id` string Required The sidebar ID to assign to. If empty, the widget won't be added to any sidebar. File: `wp-includes/widgets.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/widgets.php/)
```
function wp_assign_widget_to_sidebar( $widget_id, $sidebar_id ) {
$sidebars = wp_get_sidebars_widgets();
foreach ( $sidebars as $maybe_sidebar_id => $widgets ) {
foreach ( $widgets as $i => $maybe_widget_id ) {
if ( $widget_id === $maybe_widget_id && $sidebar_id !== $maybe_sidebar_id ) {
unset( $sidebars[ $maybe_sidebar_id ][ $i ] );
// We could technically break 2 here, but continue looping in case the ID is duplicated.
continue 2;
}
}
}
if ( $sidebar_id ) {
$sidebars[ $sidebar_id ][] = $widget_id;
}
wp_set_sidebars_widgets( $sidebars );
}
```
| Uses | Description |
| --- | --- |
| [wp\_get\_sidebars\_widgets()](wp_get_sidebars_widgets) wp-includes/widgets.php | Retrieve full list of sidebars and their widget instance IDs. |
| [wp\_set\_sidebars\_widgets()](wp_set_sidebars_widgets) wp-includes/widgets.php | Set the sidebar widget option to update sidebars. |
| Used By | Description |
| --- | --- |
| [WP\_REST\_Widgets\_Controller::create\_item()](../classes/wp_rest_widgets_controller/create_item) wp-includes/rest-api/endpoints/class-wp-rest-widgets-controller.php | Creates a widget. |
| [WP\_REST\_Widgets\_Controller::update\_item()](../classes/wp_rest_widgets_controller/update_item) wp-includes/rest-api/endpoints/class-wp-rest-widgets-controller.php | Updates an existing widget. |
| [WP\_REST\_Widgets\_Controller::delete\_item()](../classes/wp_rest_widgets_controller/delete_item) wp-includes/rest-api/endpoints/class-wp-rest-widgets-controller.php | Deletes a widget. |
| Version | Description |
| --- | --- |
| [5.8.0](https://developer.wordpress.org/reference/since/5.8.0/) | Introduced. |
wordpress _doing_it_wrong( string $function, string $message, string $version ) \_doing\_it\_wrong( string $function, string $message, string $version )
========================================================================
Marks something as being incorrectly called.
There is a hook [‘doing\_it\_wrong\_run’](../hooks/doing_it_wrong_run) that will be called that can be used to get the backtrace up to what file and function called the deprecated function.
The current behavior is to trigger a user error if `WP_DEBUG` is true.
`$function` string Required The function that was called. `$message` string Required A message explaining what has been done incorrectly. `$version` string Required The version of WordPress where the message was added. File: `wp-includes/functions.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/functions.php/)
```
function _doing_it_wrong( $function, $message, $version ) {
/**
* Fires when the given function is being used incorrectly.
*
* @since 3.1.0
*
* @param string $function The function that was called.
* @param string $message A message explaining what has been done incorrectly.
* @param string $version The version of WordPress where the message was added.
*/
do_action( 'doing_it_wrong_run', $function, $message, $version );
/**
* Filters whether to trigger an error for _doing_it_wrong() calls.
*
* @since 3.1.0
* @since 5.1.0 Added the $function, $message and $version parameters.
*
* @param bool $trigger Whether to trigger the error for _doing_it_wrong() calls. Default true.
* @param string $function The function that was called.
* @param string $message A message explaining what has been done incorrectly.
* @param string $version The version of WordPress where the message was added.
*/
if ( WP_DEBUG && apply_filters( 'doing_it_wrong_trigger_error', true, $function, $message, $version ) ) {
if ( function_exists( '__' ) ) {
if ( $version ) {
/* translators: %s: Version number. */
$version = sprintf( __( '(This message was added in version %s.)' ), $version );
}
$message .= ' ' . sprintf(
/* translators: %s: Documentation URL. */
__( 'Please see <a href="%s">Debugging in WordPress</a> for more information.' ),
__( 'https://wordpress.org/support/article/debugging-in-wordpress/' )
);
trigger_error(
sprintf(
/* translators: Developer debugging message. 1: PHP function name, 2: Explanatory message, 3: WordPress version number. */
__( 'Function %1$s was called <strong>incorrectly</strong>. %2$s %3$s' ),
$function,
$message,
$version
),
E_USER_NOTICE
);
} else {
if ( $version ) {
$version = sprintf( '(This message was added in version %s.)', $version );
}
$message .= sprintf(
' Please see <a href="%s">Debugging in WordPress</a> for more information.',
'https://wordpress.org/support/article/debugging-in-wordpress/'
);
trigger_error(
sprintf(
'Function %1$s was called <strong>incorrectly</strong>. %2$s %3$s',
$function,
$message,
$version
),
E_USER_NOTICE
);
}
}
}
```
[do\_action( 'doing\_it\_wrong\_run', string $function, string $message, string $version )](../hooks/doing_it_wrong_run)
Fires when the given function is being used incorrectly.
[apply\_filters( 'doing\_it\_wrong\_trigger\_error', bool $trigger, string $function, string $message, string $version )](../hooks/doing_it_wrong_trigger_error)
Filters whether to trigger an error for [\_doing\_it\_wrong()](_doing_it_wrong) calls.
| Uses | Description |
| --- | --- |
| [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. |
| [do\_action()](do_action) wp-includes/plugin.php | Calls the callback functions that have been added to an action hook. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| Used By | Description |
| --- | --- |
| [WP\_Block\_Type::\_\_set()](../classes/wp_block_type/__set) wp-includes/class-wp-block-type.php | Proxies setting values for deprecated properties for script and style handles for backward compatibility. |
| [wp\_cache\_flush\_group()](wp_cache_flush_group) wp-includes/cache-compat.php | Removes all cache items in a group, if the object cache implementation supports it. |
| [WP\_Style\_Engine\_Processor::add\_store()](../classes/wp_style_engine_processor/add_store) wp-includes/style-engine/class-wp-style-engine-processor.php | Adds a store to the processor. |
| [WP\_Object\_Cache::is\_valid\_key()](../classes/wp_object_cache/is_valid_key) wp-includes/class-wp-object-cache.php | Serves as a utility function to determine whether a key is valid. |
| [WP\_List\_Table::get\_views\_links()](../classes/wp_list_table/get_views_links) wp-admin/includes/class-wp-list-table.php | Generates views links. |
| [\_register\_theme\_block\_patterns()](_register_theme_block_patterns) wp-includes/block-patterns.php | Register any patterns that the active theme may provide under its `./patterns/` directory. Each pattern is defined as a PHP file and defines its metadata using plugin-style headers. The minimum required definition is: |
| [wp\_maybe\_update\_user\_counts()](wp_maybe_update_user_counts) wp-includes/user.php | Updates the total count of users on the site if live user counting is enabled. |
| [wp\_update\_user\_counts()](wp_update_user_counts) wp-includes/user.php | Updates the total count of users on the site. |
| [wp\_is\_large\_user\_count()](wp_is_large_user_count) wp-includes/user.php | Determines whether the site has a large number of users. |
| [wp\_check\_widget\_editor\_deps()](wp_check_widget_editor_deps) wp-includes/widgets.php | Displays a [\_doing\_it\_wrong()](_doing_it_wrong) message for conflicting widget editor scripts. |
| [WP\_Theme\_JSON::get\_property\_value()](../classes/wp_theme_json/get_property_value) wp-includes/class-wp-theme-json.php | Returns the style property for the given path. |
| [wp\_migrate\_old\_typography\_shape()](wp_migrate_old_typography_shape) wp-includes/blocks.php | Converts typography keys declared under `supports.*` to `supports.typography.*`. |
| [WP\_Block\_Patterns\_Registry::unregister()](../classes/wp_block_patterns_registry/unregister) wp-includes/class-wp-block-patterns-registry.php | Unregisters a block pattern. |
| [WP\_Block\_Patterns\_Registry::register()](../classes/wp_block_patterns_registry/register) wp-includes/class-wp-block-patterns-registry.php | Registers a block pattern. |
| [WP\_Block\_Pattern\_Categories\_Registry::register()](../classes/wp_block_pattern_categories_registry/register) wp-includes/class-wp-block-pattern-categories-registry.php | Registers a pattern category. |
| [WP\_Block\_Pattern\_Categories\_Registry::unregister()](../classes/wp_block_pattern_categories_registry/unregister) wp-includes/class-wp-block-pattern-categories-registry.php | Unregisters a pattern category. |
| [rest\_handle\_multi\_type\_schema()](rest_handle_multi_type_schema) wp-includes/rest-api.php | Handles getting the best type for a multi-type schema. |
| [rest\_stabilize\_value()](rest_stabilize_value) wp-includes/rest-api.php | Stabilizes a value following JSON Schema semantics. |
| [register\_block\_script\_handle()](register_block_script_handle) wp-includes/blocks.php | Finds a script handle for the selected block metadata field. It detects when a path to file was provided and finds a corresponding asset file with details necessary to register the script under automatically generated handle name. It returns unprocessed script handle otherwise. |
| [WP\_Sitemaps\_Renderer::get\_sitemap\_index\_xml()](../classes/wp_sitemaps_renderer/get_sitemap_index_xml) wp-includes/sitemaps/class-wp-sitemaps-renderer.php | Gets XML for a sitemap index. |
| [WP\_Sitemaps\_Renderer::get\_sitemap\_xml()](../classes/wp_sitemaps_renderer/get_sitemap_xml) wp-includes/sitemaps/class-wp-sitemaps-renderer.php | Gets XML for a sitemap. |
| [is\_favicon()](is_favicon) wp-includes/query.php | Is the query for the favicon.ico file? |
| [WP\_Block\_Styles\_Registry::register()](../classes/wp_block_styles_registry/register) wp-includes/class-wp-block-styles-registry.php | Registers a block style for the given block type. |
| [WP\_Block\_Styles\_Registry::unregister()](../classes/wp_block_styles_registry/unregister) wp-includes/class-wp-block-styles-registry.php | Unregisters a block style of the given block type. |
| [is\_privacy\_policy()](is_privacy_policy) wp-includes/query.php | Determines whether the query is for the Privacy Policy page. |
| [wp\_ajax\_health\_check\_get\_sizes()](wp_ajax_health_check_get_sizes) wp-admin/includes/ajax-actions.php | Ajax handler for site health check to get directories and database sizes. |
| [wp\_ajax\_health\_check\_dotorg\_communication()](wp_ajax_health_check_dotorg_communication) wp-admin/includes/ajax-actions.php | Ajax handler for site health checks on server communication. |
| [wp\_ajax\_health\_check\_background\_updates()](wp_ajax_health_check_background_updates) wp-admin/includes/ajax-actions.php | Ajax handler for site health checks on background updates. |
| [wp\_ajax\_health\_check\_loopback\_requests()](wp_ajax_health_check_loopback_requests) wp-admin/includes/ajax-actions.php | Ajax handler for site health checks on loopback requests. |
| [wp\_check\_site\_meta\_support\_prefilter()](wp_check_site_meta_support_prefilter) wp-includes/ms-site.php | Aborts calls to site meta if it is not supported. |
| [WP\_REST\_Search\_Controller::\_\_construct()](../classes/wp_rest_search_controller/__construct) wp-includes/rest-api/endpoints/class-wp-rest-search-controller.php | Constructor. |
| [WP\_Block\_Type\_Registry::register()](../classes/wp_block_type_registry/register) wp-includes/class-wp-block-type-registry.php | Registers a block type. |
| [WP\_Block\_Type\_Registry::unregister()](../classes/wp_block_type_registry/unregister) wp-includes/class-wp-block-type-registry.php | Unregisters a block type. |
| [wp\_user\_personal\_data\_exporter()](wp_user_personal_data_exporter) wp-includes/user.php | Finds and exports personal data associated with an email address from the user and user\_meta table. |
| [wp\_privacy\_generate\_personal\_data\_export\_file()](wp_privacy_generate_personal_data_export_file) wp-admin/includes/privacy-tools.php | Generate the personal data export file. |
| [wp\_add\_privacy\_policy\_content()](wp_add_privacy_policy_content) wp-admin/includes/plugin.php | Declares a helper function for adding content to the Privacy Policy Guide. |
| [wp\_is\_uuid()](wp_is_uuid) wp-includes/functions.php | Validates that a UUID is valid. |
| [rest\_sanitize\_value\_from\_schema()](rest_sanitize_value_from_schema) wp-includes/rest-api.php | Sanitize a value based on a schema. |
| [rest\_validate\_value\_from\_schema()](rest_validate_value_from_schema) wp-includes/rest-api.php | Validate a value based on a schema. |
| [WP\_REST\_Posts\_Controller::get\_item\_schema()](../classes/wp_rest_posts_controller/get_item_schema) wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php | Retrieves the post’s schema, conforming to JSON Schema. |
| [WP\_REST\_Controller::register\_routes()](../classes/wp_rest_controller/register_routes) wp-includes/rest-api/endpoints/class-wp-rest-controller.php | Registers the routes for the objects of the controller. |
| [wp\_add\_inline\_script()](wp_add_inline_script) wp-includes/functions.wp-scripts.php | Adds extra code to a registered script. |
| [WP\_Customize\_Partial::render()](../classes/wp_customize_partial/render) wp-includes/customize/class-wp-customize-partial.php | Renders the template partial involving the associated settings. |
| [register\_rest\_route()](register_rest_route) wp-includes/rest-api.php | Registers a REST API route. |
| [is\_embed()](is_embed) wp-includes/query.php | Is the query for an embedded post? |
| [WP\_Date\_Query::validate\_date\_values()](../classes/wp_date_query/validate_date_values) wp-includes/class-wp-date-query.php | Validates the given date\_query values and triggers errors if something is not valid. |
| [WP\_Customize\_Manager::remove\_panel()](../classes/wp_customize_manager/remove_panel) wp-includes/class-wp-customize-manager.php | Removes a customize panel. |
| [register\_setting()](register_setting) wp-includes/option.php | Registers a setting and its data. |
| [add\_menu\_page()](add_menu_page) wp-admin/includes/plugin.php | Adds a top-level menu page. |
| [add\_submenu\_page()](add_submenu_page) wp-admin/includes/plugin.php | Adds a submenu page. |
| [convert\_to\_screen()](convert_to_screen) wp-admin/includes/template.php | Converts a screen string to a screen object. |
| [map\_meta\_cap()](map_meta_cap) wp-includes/capabilities.php | Maps a capability to the primitive capabilities required of the given user to satisfy the capability being checked. |
| [add\_theme\_support()](add_theme_support) wp-includes/theme.php | Registers theme support for a given feature. |
| [check\_admin\_referer()](check_admin_referer) wp-includes/pluggable.php | Ensures intent by verifying that a user was referred from another admin page with the correct security nonce. |
| [check\_ajax\_referer()](check_ajax_referer) wp-includes/pluggable.php | Verifies the Ajax request to prevent processing requests external of the blog. |
| [is\_preview()](is_preview) wp-includes/query.php | Determines whether the query is for a post or page preview. |
| [is\_robots()](is_robots) wp-includes/query.php | Is the query for the robots.txt file? |
| [is\_search()](is_search) wp-includes/query.php | Determines whether the query is for a search. |
| [is\_single()](is_single) wp-includes/query.php | Determines whether the query is for an existing single post. |
| [is\_singular()](is_singular) wp-includes/query.php | Determines whether the query is for an existing single post of any post type (post, attachment, page, custom post types). |
| [is\_time()](is_time) wp-includes/query.php | Determines whether the query is for a specific time. |
| [is\_trackback()](is_trackback) wp-includes/query.php | Determines whether the query is for a trackback endpoint call. |
| [is\_year()](is_year) wp-includes/query.php | Determines whether the query is for an existing year archive. |
| [is\_404()](is_404) wp-includes/query.php | Determines whether the query has resulted in a 404 (returns no results). |
| [is\_main\_query()](is_main_query) wp-includes/query.php | Determines whether the query is the main query. |
| [is\_attachment()](is_attachment) wp-includes/query.php | Determines whether the query is for an existing attachment page. |
| [is\_author()](is_author) wp-includes/query.php | Determines whether the query is for an existing author archive page. |
| [is\_category()](is_category) wp-includes/query.php | Determines whether the query is for an existing category archive page. |
| [is\_tag()](is_tag) wp-includes/query.php | Determines whether the query is for an existing tag archive page. |
| [is\_date()](is_date) wp-includes/query.php | Determines whether the query is for an existing date archive. |
| [is\_day()](is_day) wp-includes/query.php | Determines whether the query is for an existing day archive. |
| [is\_feed()](is_feed) wp-includes/query.php | Determines whether the query is for a feed. |
| [is\_comment\_feed()](is_comment_feed) wp-includes/query.php | Is the query for a comments feed? |
| [is\_month()](is_month) wp-includes/query.php | Determines whether the query is for an existing month archive. |
| [is\_tax()](is_tax) wp-includes/query.php | Determines whether the query is for an existing custom taxonomy archive page. |
| [is\_front\_page()](is_front_page) wp-includes/query.php | Determines whether the query is for the front page of the site. |
| [is\_home()](is_home) wp-includes/query.php | Determines whether the query is for the blog homepage. |
| [is\_page()](is_page) wp-includes/query.php | Determines whether the query is for an existing single page. |
| [is\_paged()](is_paged) wp-includes/query.php | Determines whether the query is for a paged result and not for the first page. |
| [is\_archive()](is_archive) wp-includes/query.php | Determines whether the query is for an existing archive page. |
| [is\_post\_type\_archive()](is_post_type_archive) wp-includes/query.php | Determines whether the query is for an existing post type archive page. |
| [wp\_deregister\_script()](wp_deregister_script) wp-includes/functions.wp-scripts.php | Remove a registered script. |
| [wp\_send\_json()](wp_send_json) wp-includes/functions.php | Sends a JSON response back to an Ajax request. |
| [register\_taxonomy()](register_taxonomy) wp-includes/taxonomy.php | Creates or modifies a taxonomy object. |
| [WP\_Admin\_Bar::add\_node()](../classes/wp_admin_bar/add_node) wp-includes/class-wp-admin-bar.php | Adds a node to the menu. |
| [wp\_add\_inline\_style()](wp_add_inline_style) wp-includes/functions.wp-styles.php | Add extra CSS styles to a registered stylesheet. |
| [do\_shortcode\_tag()](do_shortcode_tag) wp-includes/shortcodes.php | Regular Expression callable for [do\_shortcode()](do_shortcode) for calling shortcode hook. |
| [add\_shortcode()](add_shortcode) wp-includes/shortcodes.php | Adds a new shortcode. |
| [register\_uninstall\_hook()](register_uninstall_hook) wp-includes/plugin.php | Sets the uninstallation hook for a plugin. |
| [wp\_insert\_post()](wp_insert_post) wp-includes/post.php | Inserts or update a post. |
| [register\_post\_type()](register_post_type) wp-includes/post.php | Registers a post type. |
| [get\_user\_count()](get_user_count) wp-includes/user.php | Returns the number of active users in your installation. |
| [WP\_Scripts::localize()](../classes/wp_scripts/localize) wp-includes/class-wp-scripts.php | Localizes a script, only if the script has already been added. |
| [register\_nav\_menus()](register_nav_menus) wp-includes/nav-menu.php | Registers navigation menu locations for a theme. |
| [wpdb::\_real\_escape()](../classes/wpdb/_real_escape) wp-includes/class-wpdb.php | Real escape, using mysqli\_real\_escape\_string() or mysql\_real\_escape\_string(). |
| [wpdb::prepare()](../classes/wpdb/prepare) wp-includes/class-wpdb.php | Prepares a SQL query for safe execution. |
| [the\_widget()](the_widget) wp-includes/widgets.php | Output an arbitrary widget as a template tag. |
| [register\_sidebar()](register_sidebar) wp-includes/widgets.php | Builds the definition for a single sidebar and returns the ID. |
| [register\_meta()](register_meta) wp-includes/meta.php | Registers a meta key. |
| Version | Description |
| --- | --- |
| [5.4.0](https://developer.wordpress.org/reference/since/5.4.0/) | This function is no longer marked as "private". |
| [3.1.0](https://developer.wordpress.org/reference/since/3.1.0/) | Introduced. |
| programming_docs |
wordpress get_previous_post_link( string $format = '« %link', string $link = '%title', bool $in_same_term = false, int[]|string $excluded_terms = '', string $taxonomy = 'category' ): string get\_previous\_post\_link( string $format = '« %link', string $link = '%title', bool $in\_same\_term = false, int[]|string $excluded\_terms = '', string $taxonomy = 'category' ): string
===============================================================================================================================================================================================
Retrieves the previous post link that is adjacent to the current post.
`$format` string Optional Link anchor format. Default '« %link'. Default: `'« %link'`
`$link` string Optional Link permalink format. Default `'%title'`. Default: `'%title'`
`$in_same_term` bool Optional Whether link should be in a same taxonomy term. Default: `false`
`$excluded_terms` int[]|string Optional Array or comma-separated list of excluded term IDs. Default: `''`
`$taxonomy` string Optional Taxonomy, if $in\_same\_term is true. Default `'category'`. Default: `'category'`
string The link URL of the previous post in relation to the current post.
File: `wp-includes/link-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/link-template.php/)
```
function get_previous_post_link( $format = '« %link', $link = '%title', $in_same_term = false, $excluded_terms = '', $taxonomy = 'category' ) {
return get_adjacent_post_link( $format, $link, $in_same_term, $excluded_terms, true, $taxonomy );
}
```
| Uses | Description |
| --- | --- |
| [get\_adjacent\_post\_link()](get_adjacent_post_link) wp-includes/link-template.php | Retrieves the adjacent post link. |
| Used By | Description |
| --- | --- |
| [get\_the\_post\_navigation()](get_the_post_navigation) wp-includes/link-template.php | Retrieves the navigation to next/previous post, when applicable. |
| [previous\_post\_link()](previous_post_link) wp-includes/link-template.php | Displays the previous post link that is adjacent to the current post. |
| Version | Description |
| --- | --- |
| [3.7.0](https://developer.wordpress.org/reference/since/3.7.0/) | Introduced. |
wordpress wp_prepare_site_data( array $data, array $defaults, WP_Site|null $old_site = null ): array|WP_Error wp\_prepare\_site\_data( array $data, array $defaults, WP\_Site|null $old\_site = null ): array|WP\_Error
=========================================================================================================
Prepares site data for insertion or update in the database.
`$data` array Required Associative array of site data passed to the respective function.
See [wp\_insert\_site()](wp_insert_site) for the possibly included data. More Arguments from wp\_insert\_site( ... $data ) Data for the new site that should be inserted.
* `domain`stringSite domain. Default empty string.
* `path`stringSite path. Default `'/'`.
* `network_id`intThe site's network ID. Default is the current network ID.
* `registered`stringWhen the site was registered, in SQL datetime format. Default is the current time.
* `last_updated`stringWhen the site was last updated, in SQL datetime format. Default is the value of $registered.
* `public`intWhether the site is public. Default 1.
* `archived`intWhether the site is archived. Default 0.
* `mature`intWhether the site is mature. Default 0.
* `spam`intWhether the site is spam. Default 0.
* `deleted`intWhether the site is deleted. Default 0.
* `lang_id`intThe site's language ID. Currently unused. Default 0.
* `user_id`intUser ID for the site administrator. Passed to the `wp_initialize_site` hook.
* `title`stringSite title. Default is 'Site %d' where %d is the site ID. Passed to the `wp_initialize_site` hook.
* `options`arrayCustom option $key => $value pairs to use. Default empty array. Passed to the `wp_initialize_site` hook.
* `meta`arrayCustom site metadata $key => $value pairs to use. Default empty array.
Passed to the `wp_initialize_site` hook.
`$defaults` array Required Site data defaults to parse $data against. `$old_site` [WP\_Site](../classes/wp_site)|null Optional Old site object if an update, or null if an insertion.
Default: `null`
array|[WP\_Error](../classes/wp_error) Site data ready for a database transaction, or [WP\_Error](../classes/wp_error) in case a validation error occurred.
File: `wp-includes/ms-site.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/ms-site.php/)
```
function wp_prepare_site_data( $data, $defaults, $old_site = null ) {
// Maintain backward-compatibility with `$site_id` as network ID.
if ( isset( $data['site_id'] ) ) {
if ( ! empty( $data['site_id'] ) && empty( $data['network_id'] ) ) {
$data['network_id'] = $data['site_id'];
}
unset( $data['site_id'] );
}
/**
* Filters passed site data in order to normalize it.
*
* @since 5.1.0
*
* @param array $data Associative array of site data passed to the respective function.
* See {@see wp_insert_site()} for the possibly included data.
*/
$data = apply_filters( 'wp_normalize_site_data', $data );
$allowed_data_fields = array( 'domain', 'path', 'network_id', 'registered', 'last_updated', 'public', 'archived', 'mature', 'spam', 'deleted', 'lang_id' );
$data = array_intersect_key( wp_parse_args( $data, $defaults ), array_flip( $allowed_data_fields ) );
$errors = new WP_Error();
/**
* Fires when data should be validated for a site prior to inserting or updating in the database.
*
* Plugins should amend the `$errors` object via its `WP_Error::add()` method.
*
* @since 5.1.0
*
* @param WP_Error $errors Error object to add validation errors to.
* @param array $data Associative array of complete site data. See {@see wp_insert_site()}
* for the included data.
* @param WP_Site|null $old_site The old site object if the data belongs to a site being updated,
* or null if it is a new site being inserted.
*/
do_action( 'wp_validate_site_data', $errors, $data, $old_site );
if ( ! empty( $errors->errors ) ) {
return $errors;
}
// Prepare for database.
$data['site_id'] = $data['network_id'];
unset( $data['network_id'] );
return $data;
}
```
[apply\_filters( 'wp\_normalize\_site\_data', array $data )](../hooks/wp_normalize_site_data)
Filters passed site data in order to normalize it.
[do\_action( 'wp\_validate\_site\_data', WP\_Error $errors, array $data, WP\_Site|null $old\_site )](../hooks/wp_validate_site_data)
Fires when data should be validated for a site prior to inserting or updating in the database.
| Uses | Description |
| --- | --- |
| [wp\_parse\_args()](wp_parse_args) wp-includes/functions.php | Merges user defined arguments into defaults array. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| [do\_action()](do_action) wp-includes/plugin.php | Calls the callback functions that have been added to an action hook. |
| [WP\_Error::\_\_construct()](../classes/wp_error/__construct) wp-includes/class-wp-error.php | Initializes the error. |
| Used By | Description |
| --- | --- |
| [wp\_insert\_site()](wp_insert_site) wp-includes/ms-site.php | Inserts a new site into the database. |
| [wp\_update\_site()](wp_update_site) wp-includes/ms-site.php | Updates a site in the database. |
| Version | Description |
| --- | --- |
| [5.1.0](https://developer.wordpress.org/reference/since/5.1.0/) | Introduced. |
wordpress get_the_ID(): int|false get\_the\_ID(): int|false
=========================
Retrieves the ID of the current item in the WordPress Loop.
int|false The ID of the current item in the WordPress Loop. False if $post is not set.
File: `wp-includes/post-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/post-template.php/)
```
function get_the_ID() { // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.FunctionNameInvalid
$post = get_post();
return ! empty( $post ) ? $post->ID : false;
}
```
| Uses | Description |
| --- | --- |
| [get\_post()](get_post) wp-includes/post.php | Retrieves post data given a post ID or post object. |
| Used By | Description |
| --- | --- |
| [print\_embed\_sharing\_dialog()](print_embed_sharing_dialog) wp-includes/embed.php | Prints the necessary markup for the embed sharing dialog. |
| [wp\_dashboard\_recent\_posts()](wp_dashboard_recent_posts) wp-admin/includes/dashboard.php | Generates Publishing Soon and Recently Published sections. |
| [wp\_get\_archives()](wp_get_archives) wp-includes/general-template.php | Displays archive links based on type and format. |
| [get\_post\_comments\_feed\_link()](get_post_comments_feed_link) wp-includes/link-template.php | Retrieves the permalink for the post comments feed. |
| [prepend\_attachment()](prepend_attachment) wp-includes/post-template.php | Wraps attachment in paragraph tag before content. |
| [the\_ID()](the_id) wp-includes/post-template.php | Displays the ID of the current item in the WordPress Loop. |
| [wp\_video\_shortcode()](wp_video_shortcode) wp-includes/media.php | Builds the Video shortcode output. |
| [wp\_audio\_shortcode()](wp_audio_shortcode) wp-includes/media.php | Builds the Audio shortcode output. |
| [is\_sticky()](is_sticky) wp-includes/post.php | Determines whether a post is sticky. |
| [get\_post\_custom()](get_post_custom) wp-includes/post.php | Retrieves post meta fields, based on post ID. |
| [get\_comment\_id\_fields()](get_comment_id_fields) wp-includes/comment-template.php | Retrieves hidden input HTML for replying to comments. |
| [wp\_list\_comments()](wp_list_comments) wp-includes/comment-template.php | Displays a list of comments. |
| [get\_trackback\_url()](get_trackback_url) wp-includes/comment-template.php | Retrieves the current post’s trackback URL. |
| [comments\_popup\_link()](comments_popup_link) wp-includes/comment-template.php | Displays the link to the comments for the current post ID. |
| Version | Description |
| --- | --- |
| [2.1.0](https://developer.wordpress.org/reference/since/2.1.0/) | Introduced. |
wordpress wp_embed_handler_audio( array $matches, array $attr, string $url, array $rawattr ): string wp\_embed\_handler\_audio( array $matches, array $attr, string $url, array $rawattr ): string
=============================================================================================
Audio embed handler callback.
`$matches` array Required The RegEx matches from the provided regex when calling [wp\_embed\_register\_handler()](wp_embed_register_handler) . `$attr` array Required Embed attributes. `$url` string Required The original URL that was matched by the regex. `$rawattr` array Required The original unmodified attributes. string The embed HTML.
File: `wp-includes/embed.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/embed.php/)
```
function wp_embed_handler_audio( $matches, $attr, $url, $rawattr ) {
$audio = sprintf( '[audio src="%s" /]', esc_url( $url ) );
/**
* Filters the audio embed output.
*
* @since 3.6.0
*
* @param string $audio Audio embed output.
* @param array $attr An array of embed attributes.
* @param string $url The original URL that was matched by the regex.
* @param array $rawattr The original unmodified attributes.
*/
return apply_filters( 'wp_embed_handler_audio', $audio, $attr, $url, $rawattr );
}
```
[apply\_filters( 'wp\_embed\_handler\_audio', string $audio, array $attr, string $url, array $rawattr )](../hooks/wp_embed_handler_audio)
Filters the audio embed output.
| Uses | Description |
| --- | --- |
| [esc\_url()](esc_url) wp-includes/formatting.php | Checks and cleans a URL. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| Version | Description |
| --- | --- |
| [3.6.0](https://developer.wordpress.org/reference/since/3.6.0/) | Introduced. |
wordpress sanitize_title( string $title, string $fallback_title = '', string $context = 'save' ): string sanitize\_title( string $title, string $fallback\_title = '', string $context = 'save' ): string
================================================================================================
Sanitizes a string into a slug, which can be used in URLs or HTML attributes.
By default, converts accent characters to ASCII characters and further limits the output to alphanumeric characters, underscore (\_) and dash (-) through the [‘sanitize\_title’](../hooks/sanitize_title) filter.
If `$title` is empty and `$fallback_title` is set, the latter will be used.
`$title` string Required The string to be sanitized. `$fallback_title` string Optional A title to use if $title is empty. Default: `''`
`$context` string Optional The operation for which the string is sanitized.
When set to `'save'`, the string runs through [remove\_accents()](remove_accents) .
Default `'save'`. Default: `'save'`
string The sanitized string.
The ‘save’ context is used most often when saving a value in the database, but is used for other purposes as well. The ‘query’ context is used by [sanitize\_title\_for\_query()](sanitize_title_for_query) when the value is going to be used in the `WHERE` clause of a query.
File: `wp-includes/formatting.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/formatting.php/)
```
function sanitize_title( $title, $fallback_title = '', $context = 'save' ) {
$raw_title = $title;
if ( 'save' === $context ) {
$title = remove_accents( $title );
}
/**
* Filters a sanitized title string.
*
* @since 1.2.0
*
* @param string $title Sanitized title.
* @param string $raw_title The title prior to sanitization.
* @param string $context The context for which the title is being sanitized.
*/
$title = apply_filters( 'sanitize_title', $title, $raw_title, $context );
if ( '' === $title || false === $title ) {
$title = $fallback_title;
}
return $title;
}
```
[apply\_filters( 'sanitize\_title', string $title, string $raw\_title, string $context )](../hooks/sanitize_title)
Filters a sanitized title string.
| Uses | Description |
| --- | --- |
| [remove\_accents()](remove_accents) wp-includes/formatting.php | Converts all accent characters to ASCII characters. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| Used By | Description |
| --- | --- |
| [WP\_Theme\_JSON::set\_spacing\_sizes()](../classes/wp_theme_json/set_spacing_sizes) wp-includes/class-wp-theme-json.php | Sets the spacingSizes array based on the spacingScale values from theme.json. |
| [WP\_Theme\_JSON::get\_layout\_styles()](../classes/wp_theme_json/get_layout_styles) wp-includes/class-wp-theme-json.php | Gets the CSS layout rules for a particular block from theme.json layout definitions. |
| [\_register\_remote\_theme\_patterns()](_register_remote_theme_patterns) wp-includes/block-patterns.php | Registers patterns from Pattern Directory provided by a theme’s `theme.json` file. |
| [\_load\_remote\_featured\_patterns()](_load_remote_featured_patterns) wp-includes/block-patterns.php | Register `Featured` (category) patterns from wordpress.org/patterns. |
| [\_load\_remote\_block\_patterns()](_load_remote_block_patterns) wp-includes/block-patterns.php | Register Core’s official patterns from wordpress.org/patterns. |
| [WP\_REST\_Attachments\_Controller::insert\_attachment()](../classes/wp_rest_attachments_controller/insert_attachment) wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php | Inserts the attachment post in the database. Does not update the attachment meta. |
| [WP\_Customize\_Manager::import\_theme\_starter\_content()](../classes/wp_customize_manager/import_theme_starter_content) wp-includes/class-wp-customize-manager.php | Imports theme starter content into the customized state. |
| [WP\_Customize\_Manager::prepare\_starter\_content\_attachments()](../classes/wp_customize_manager/prepare_starter_content_attachments) wp-includes/class-wp-customize-manager.php | Prepares starter content attachments. |
| [wp\_update\_custom\_css\_post()](wp_update_custom_css_post) wp-includes/theme.php | Updates the `custom_css` post for a given theme. |
| [wp\_get\_custom\_css\_post()](wp_get_custom_css_post) wp-includes/theme.php | Fetches the `custom_css` post for a given theme. |
| [WP\_REST\_Controller::sanitize\_slug()](../classes/wp_rest_controller/sanitize_slug) wp-includes/rest-api/endpoints/class-wp-rest-controller.php | Sanitizes the slug value. |
| [WP\_Customize\_Nav\_Menus::insert\_auto\_draft\_post()](../classes/wp_customize_nav_menus/insert_auto_draft_post) wp-includes/class-wp-customize-nav-menus.php | Adds a new `auto-draft` post. |
| [WP\_Customize\_Nav\_Menu\_Setting::filter\_wp\_get\_nav\_menus()](../classes/wp_customize_nav_menu_setting/filter_wp_get_nav_menus) wp-includes/customize/class-wp-customize-nav-menu-setting.php | Filters the [wp\_get\_nav\_menus()](wp_get_nav_menus) result to ensure the inserted menu object is included, and the deleted one is removed. |
| [WP\_Customize\_Nav\_Menu\_Setting::filter\_wp\_get\_nav\_menu\_object()](../classes/wp_customize_nav_menu_setting/filter_wp_get_nav_menu_object) wp-includes/customize/class-wp-customize-nav-menu-setting.php | Filters the [wp\_get\_nav\_menu\_object()](wp_get_nav_menu_object) result to supply the previewed menu object. |
| [wp\_install\_maybe\_enable\_pretty\_permalinks()](wp_install_maybe_enable_pretty_permalinks) wp-admin/includes/upgrade.php | Maybe enable pretty permalinks on installation. |
| [WP\_Plugins\_List\_Table::single\_row()](../classes/wp_plugins_list_table/single_row) wp-admin/includes/class-wp-plugins-list-table.php | |
| [update\_nag()](update_nag) wp-admin/includes/update.php | Returns core update notification message. |
| [make\_site\_theme()](make_site_theme) wp-admin/includes/upgrade.php | Creates a site theme. |
| [wp\_install\_defaults()](wp_install_defaults) wp-admin/includes/upgrade.php | Creates the initial content for a newly-installed site. |
| [add\_menu\_page()](add_menu_page) wp-admin/includes/plugin.php | Adds a top-level menu page. |
| [media\_handle\_upload()](media_handle_upload) wp-admin/includes/media.php | Saves a file submitted from a POST request and create an attachment post for it. |
| [media\_handle\_sideload()](media_handle_sideload) wp-admin/includes/media.php | Handles a side-loaded file in the same way as an uploaded file is handled by [media\_handle\_upload()](media_handle_upload) . |
| [get\_sample\_permalink()](get_sample_permalink) wp-admin/includes/post.php | Returns a sample permalink based on the post name. |
| [\_wp\_ajax\_add\_hierarchical\_term()](_wp_ajax_add_hierarchical_term) wp-admin/includes/ajax-actions.php | Ajax handler for adding a hierarchical term. |
| [wp\_ajax\_add\_link\_category()](wp_ajax_add_link_category) wp-admin/includes/ajax-actions.php | Ajax handler for adding a link category. |
| [list\_core\_update()](list_core_update) wp-admin/update-core.php | Lists available core updates. |
| [sanitize\_title\_for\_query()](sanitize_title_for_query) wp-includes/formatting.php | Sanitizes a title with the ‘query’ context. |
| [register\_widget\_control()](register_widget_control) wp-includes/deprecated.php | Registers widget control callback for customizing options. |
| [register\_sidebar\_widget()](register_sidebar_widget) wp-includes/deprecated.php | Register widget for sidebar with backward compatibility. |
| [get\_category\_by\_path()](get_category_by_path) wp-includes/category.php | Retrieves a category based on URL containing the category slug. |
| [wp\_update\_term()](wp_update_term) wp-includes/taxonomy.php | Updates term based on arguments provided. |
| [wp\_insert\_term()](wp_insert_term) wp-includes/taxonomy.php | Adds a new term to the database. |
| [term\_exists()](term_exists) wp-includes/taxonomy.php | Determines whether a taxonomy term exists. |
| [register\_taxonomy()](register_taxonomy) wp-includes/taxonomy.php | Creates or modifies a taxonomy object. |
| [permalink\_anchor()](permalink_anchor) wp-includes/link-template.php | Displays the permalink anchor for the current post. |
| [WP\_Admin\_Bar::add\_node()](../classes/wp_admin_bar/add_node) wp-includes/class-wp-admin-bar.php | Adds a node to the menu. |
| [wp\_insert\_user()](wp_insert_user) wp-includes/user.php | Inserts a user into the database. |
| [wp\_insert\_post()](wp_insert_post) wp-includes/post.php | Inserts or update a post. |
| [dynamic\_sidebar()](dynamic_sidebar) wp-includes/widgets.php | Display dynamic sidebar. |
| [is\_active\_sidebar()](is_active_sidebar) wp-includes/widgets.php | Determines whether a sidebar contains widgets. |
| Version | Description |
| --- | --- |
| [1.0.0](https://developer.wordpress.org/reference/since/1.0.0/) | Introduced. |
| programming_docs |
wordpress wp_editor( string $content, string $editor_id, array $settings = array() ) wp\_editor( string $content, string $editor\_id, array $settings = array() )
============================================================================
Renders an editor.
Using this function is the proper way to output all needed components for both TinyMCE and Quicktags.
[\_WP\_Editors](../classes/_wp_editors) should not be used directly. See <https://core.trac.wordpress.org/ticket/17144>.
NOTE: Once initialized the TinyMCE editor cannot be safely moved in the DOM. For that reason running [wp\_editor()](wp_editor) inside of a meta box is not a good idea unless only Quicktags is used.
On the post edit screen several actions can be used to include additional editors containing TinyMCE: ‘edit\_page\_form’, ‘edit\_form\_advanced’ and ‘dbx\_post\_sidebar’.
See <https://core.trac.wordpress.org/ticket/19173> for more information.
* [\_WP\_Editors::editor()](../classes/_wp_editors/editor)
* [\_WP\_Editors::parse\_settings()](../classes/_wp_editors/parse_settings)
`$content` string Required Initial content for the editor. `$editor_id` string Required HTML ID attribute value for the textarea and TinyMCE.
Should not contain square brackets. `$settings` array Optional See [\_WP\_Editors::parse\_settings()](../classes/_wp_editors/parse_settings) for description. More Arguments from \_WP\_Editors::parse\_settings( ... $settings ) Array of editor arguments.
* `wpautop`boolWhether to use [wpautop()](wpautop) . Default true.
* `media_buttons`boolWhether to show the Add Media/other media buttons.
* `default_editor`stringWhen both TinyMCE and Quicktags are used, set which editor is shown on page load. Default empty.
* `drag_drop_upload`boolWhether to enable drag & drop on the editor uploading. Default false.
Requires the media modal.
* `textarea_name`stringGive the textarea a unique name here. Square brackets can be used here. Default $editor\_id.
* `textarea_rows`intNumber rows in the editor textarea. Default 20.
* `tabindex`string|intTabindex value to use. Default empty.
* `tabfocus_elements`stringThe previous and next element ID to move the focus to when pressing the Tab key in TinyMCE. Default `':prev,:next'`.
* `editor_css`stringIntended for extra styles for both Visual and Text editors.
Should include `<style>` tags, and can use "scoped". Default empty.
* `editor_class`stringExtra classes to add to the editor textarea element. Default empty.
* `teeny`boolWhether to output the minimal editor config. Examples include Press This and the Comment editor. Default false.
* `dfw`boolDeprecated in 4.1. Unused.
* `tinymce`bool|arrayWhether to load TinyMCE. Can be used to pass settings directly to TinyMCE using an array. Default true.
* `quicktags`bool|arrayWhether to load Quicktags. Can be used to pass settings directly to Quicktags using an array. Default true.
Default: `array()`
File: `wp-includes/general-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/general-template.php/)
```
function wp_editor( $content, $editor_id, $settings = array() ) {
if ( ! class_exists( '_WP_Editors', false ) ) {
require ABSPATH . WPINC . '/class-wp-editor.php';
}
_WP_Editors::editor( $content, $editor_id, $settings );
}
```
| Uses | Description |
| --- | --- |
| [\_WP\_Editors::editor()](../classes/_wp_editors/editor) wp-includes/class-wp-editor.php | Outputs the HTML for a single instance of the editor. |
| Used By | Description |
| --- | --- |
| [wp\_comment\_reply()](wp_comment_reply) wp-admin/includes/template.php | Outputs the in-line comment reply-to form in the Comments list table. |
| [edit\_form\_image\_editor()](edit_form_image_editor) wp-admin/includes/media.php | Displays the image and editor in the post editor |
| [the\_editor()](the_editor) wp-includes/deprecated.php | Displays an editor: TinyMCE, HTML, or both. |
| Version | Description |
| --- | --- |
| [3.3.0](https://developer.wordpress.org/reference/since/3.3.0/) | Introduced. |
wordpress wp_install_maybe_enable_pretty_permalinks(): bool wp\_install\_maybe\_enable\_pretty\_permalinks(): bool
======================================================
Maybe enable pretty permalinks on installation.
If after enabling pretty permalinks don’t work, fallback to query-string permalinks.
bool Whether pretty permalinks are enabled. False otherwise.
File: `wp-admin/includes/upgrade.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/upgrade.php/)
```
function wp_install_maybe_enable_pretty_permalinks() {
global $wp_rewrite;
// Bail if a permalink structure is already enabled.
if ( get_option( 'permalink_structure' ) ) {
return true;
}
/*
* The Permalink structures to attempt.
*
* The first is designed for mod_rewrite or nginx rewriting.
*
* The second is PATHINFO-based permalinks for web server configurations
* without a true rewrite module enabled.
*/
$permalink_structures = array(
'/%year%/%monthnum%/%day%/%postname%/',
'/index.php/%year%/%monthnum%/%day%/%postname%/',
);
foreach ( (array) $permalink_structures as $permalink_structure ) {
$wp_rewrite->set_permalink_structure( $permalink_structure );
/*
* Flush rules with the hard option to force refresh of the web-server's
* rewrite config file (e.g. .htaccess or web.config).
*/
$wp_rewrite->flush_rules( true );
$test_url = '';
// Test against a real WordPress post.
$first_post = get_page_by_path( sanitize_title( _x( 'hello-world', 'Default post slug' ) ), OBJECT, 'post' );
if ( $first_post ) {
$test_url = get_permalink( $first_post->ID );
}
/*
* Send a request to the site, and check whether
* the 'x-pingback' header is returned as expected.
*
* Uses wp_remote_get() instead of wp_remote_head() because web servers
* can block head requests.
*/
$response = wp_remote_get( $test_url, array( 'timeout' => 5 ) );
$x_pingback_header = wp_remote_retrieve_header( $response, 'x-pingback' );
$pretty_permalinks = $x_pingback_header && get_bloginfo( 'pingback_url' ) === $x_pingback_header;
if ( $pretty_permalinks ) {
return true;
}
}
/*
* If it makes it this far, pretty permalinks failed.
* Fallback to query-string permalinks.
*/
$wp_rewrite->set_permalink_structure( '' );
$wp_rewrite->flush_rules( true );
return false;
}
```
| Uses | Description |
| --- | --- |
| [sanitize\_title()](sanitize_title) wp-includes/formatting.php | Sanitizes a string into a slug, which can be used in URLs or HTML attributes. |
| [wp\_remote\_get()](wp_remote_get) wp-includes/http.php | Performs an HTTP request using the GET method and returns its response. |
| [wp\_remote\_retrieve\_header()](wp_remote_retrieve_header) wp-includes/http.php | Retrieve a single header by name from the raw response. |
| [get\_page\_by\_path()](get_page_by_path) wp-includes/post.php | Retrieves a page given its path. |
| [WP\_Rewrite::set\_permalink\_structure()](../classes/wp_rewrite/set_permalink_structure) wp-includes/class-wp-rewrite.php | Sets the main permalink structure for the site. |
| [WP\_Rewrite::flush\_rules()](../classes/wp_rewrite/flush_rules) wp-includes/class-wp-rewrite.php | Removes rewrite rules and then recreate rewrite rules. |
| [\_x()](_x) wp-includes/l10n.php | Retrieves translated string with gettext context. |
| [get\_bloginfo()](get_bloginfo) wp-includes/general-template.php | Retrieves information about the current site. |
| [get\_permalink()](get_permalink) wp-includes/link-template.php | Retrieves the full permalink for the current post or post ID. |
| [get\_option()](get_option) wp-includes/option.php | Retrieves an option value based on an option name. |
| Used By | Description |
| --- | --- |
| [wp\_install()](wp_install) wp-admin/includes/upgrade.php | Installs the site. |
| Version | Description |
| --- | --- |
| [4.2.0](https://developer.wordpress.org/reference/since/4.2.0/) | Introduced. |
wordpress __( string $text, string $domain = 'default' ): string \_\_( string $text, string $domain = 'default' ): string
========================================================
Retrieves the translation of $text.
If there is no translation, or the text domain isn’t loaded, the original text is returned.
`$text` string Required Text to translate. `$domain` string Optional Text domain. Unique identifier for retrieving translated strings.
Default `'default'`. Default: `'default'`
string Translated text.
File: `wp-includes/l10n.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/l10n.php/)
```
function __( $text, $domain = 'default' ) {
return translate( $text, $domain );
}
```
| Uses | Description |
| --- | --- |
| [translate()](translate) wp-includes/l10n.php | Retrieves the translation of $text. |
| Used By | Description |
| --- | --- |
| [wp\_register\_persisted\_preferences\_meta()](wp_register_persisted_preferences_meta) wp-includes/user.php | Registers the user meta property for persisted preferences. |
| [WP\_Block\_Type::\_\_set()](../classes/wp_block_type/__set) wp-includes/class-wp-block-type.php | Proxies setting values for deprecated properties for script and style handles for backward compatibility. |
| [wp\_cache\_flush\_group()](wp_cache_flush_group) wp-includes/cache-compat.php | Removes all cache items in a group, if the object cache implementation supports it. |
| [WP\_Theme\_JSON::set\_spacing\_sizes()](../classes/wp_theme_json/set_spacing_sizes) wp-includes/class-wp-theme-json.php | Sets the spacingSizes array based on the spacingScale values from theme.json. |
| [\_wp\_build\_title\_and\_description\_for\_single\_post\_type\_block\_template()](_wp_build_title_and_description_for_single_post_type_block_template) wp-includes/block-template-utils.php | Builds the title and description of a post-specific template based on the underlying referenced post. |
| [\_wp\_build\_title\_and\_description\_for\_taxonomy\_block\_template()](_wp_build_title_and_description_for_taxonomy_block_template) wp-includes/block-template-utils.php | Builds the title and description of a taxonomy-specific template based on the underlying entity referenced. |
| [WP\_Style\_Engine\_Processor::add\_store()](../classes/wp_style_engine_processor/add_store) wp-includes/style-engine/class-wp-style-engine-processor.php | Adds a store to the processor. |
| [wp\_required\_field\_message()](wp_required_field_message) wp-includes/general-template.php | Creates a message to explain required form fields. |
| [wp\_required\_field\_indicator()](wp_required_field_indicator) wp-includes/general-template.php | Assigns a visual indicator for required form fields. |
| [WP\_Object\_Cache::is\_valid\_key()](../classes/wp_object_cache/is_valid_key) wp-includes/class-wp-object-cache.php | Serves as a utility function to determine whether a key is valid. |
| [wp\_get\_latest\_revision\_id\_and\_total\_count()](wp_get_latest_revision_id_and_total_count) wp-includes/revision.php | Returns the latest revision ID and count of revisions for a post. |
| [WP\_Site\_Health::get\_test\_page\_cache()](../classes/wp_site_health/get_test_page_cache) wp-admin/includes/class-wp-site-health.php | Tests if a full page cache is available. |
| [WP\_Site\_Health::get\_test\_persistent\_object\_cache()](../classes/wp_site_health/get_test_persistent_object_cache) wp-admin/includes/class-wp-site-health.php | Tests if the site uses persistent object cache and recommends to use it if not. |
| [WP\_List\_Table::get\_views\_links()](../classes/wp_list_table/get_views_links) wp-admin/includes/class-wp-list-table.php | Generates views links. |
| [IXR\_Message::parse()](../classes/ixr_message/parse) wp-includes/IXR/class-IXR-message.php | |
| [WP\_Widget\_Media::get\_default\_description()](../classes/wp_widget_media/get_default_description) wp-includes/widgets/class-wp-widget-media.php | Returns the default description of the widget. |
| [WP\_Widget\_Media::get\_l10n\_defaults()](../classes/wp_widget_media/get_l10n_defaults) wp-includes/widgets/class-wp-widget-media.php | Returns the default localized strings used by the widget. |
| [WP\_Taxonomy::get\_default\_labels()](../classes/wp_taxonomy/get_default_labels) wp-includes/class-wp-taxonomy.php | Returns the default labels for taxonomies. |
| [WP\_Post\_Type::get\_default\_labels()](../classes/wp_post_type/get_default_labels) wp-includes/class-wp-post-type.php | Returns the default labels for post types. |
| [\_register\_theme\_block\_patterns()](_register_theme_block_patterns) wp-includes/block-patterns.php | Register any patterns that the active theme may provide under its `./patterns/` directory. Each pattern is defined as a PHP file and defines its metadata using plugin-style headers. The minimum required definition is: |
| [WP\_REST\_Block\_Patterns\_Controller::get\_item\_schema()](../classes/wp_rest_block_patterns_controller/get_item_schema) wp-includes/rest-api/endpoints/class-wp-rest-block-patterns-controller.php | Retrieves the block pattern schema, conforming to JSON Schema. |
| [WP\_REST\_Block\_Patterns\_Controller::get\_items\_permissions\_check()](../classes/wp_rest_block_patterns_controller/get_items_permissions_check) wp-includes/rest-api/endpoints/class-wp-rest-block-patterns-controller.php | Checks whether a given request has permission to read block patterns. |
| [WP\_REST\_Global\_Styles\_Controller::get\_theme\_items\_permissions\_check()](../classes/wp_rest_global_styles_controller/get_theme_items_permissions_check) wp-includes/rest-api/endpoints/class-wp-rest-global-styles-controller.php | Checks if a given request has access to read a single theme global styles config. |
| [WP\_REST\_Global\_Styles\_Controller::get\_theme\_items()](../classes/wp_rest_global_styles_controller/get_theme_items) wp-includes/rest-api/endpoints/class-wp-rest-global-styles-controller.php | Returns the given theme global styles variations. |
| [WP\_REST\_Block\_Pattern\_Categories\_Controller::get\_items\_permissions\_check()](../classes/wp_rest_block_pattern_categories_controller/get_items_permissions_check) wp-includes/rest-api/endpoints/class-wp-rest-block-pattern-categories-controller.php | Checks whether a given request has permission to read block patterns. |
| [WP\_REST\_Block\_Pattern\_Categories\_Controller::get\_item\_schema()](../classes/wp_rest_block_pattern_categories_controller/get_item_schema) wp-includes/rest-api/endpoints/class-wp-rest-block-pattern-categories-controller.php | Retrieves the block pattern category schema, conforming to JSON Schema. |
| [\_wp\_theme\_json\_webfonts\_handler()](_wp_theme_json_webfonts_handler) wp-includes/script-loader.php | Runs the theme.json webfonts handler. |
| [wp\_maybe\_update\_user\_counts()](wp_maybe_update_user_counts) wp-includes/user.php | Updates the total count of users on the site if live user counting is enabled. |
| [wp\_update\_user\_counts()](wp_update_user_counts) wp-includes/user.php | Updates the total count of users on the site. |
| [wp\_is\_large\_user\_count()](wp_is_large_user_count) wp-includes/user.php | Determines whether the site has a large number of users. |
| [WP\_REST\_Menu\_Items\_Controller::get\_schema\_links()](../classes/wp_rest_menu_items_controller/get_schema_links) wp-includes/rest-api/endpoints/class-wp-rest-menu-items-controller.php | Retrieves Link Description Objects that should be added to the Schema for the posts collection. |
| [WP\_REST\_Menu\_Items\_Controller::get\_item\_schema()](../classes/wp_rest_menu_items_controller/get_item_schema) wp-includes/rest-api/endpoints/class-wp-rest-menu-items-controller.php | Retrieves the term’s schema, conforming to JSON Schema. |
| [WP\_REST\_Menu\_Items\_Controller::get\_collection\_params()](../classes/wp_rest_menu_items_controller/get_collection_params) wp-includes/rest-api/endpoints/class-wp-rest-menu-items-controller.php | Retrieves the query params for the posts collection. |
| [WP\_REST\_Menu\_Items\_Controller::check\_has\_read\_only\_access()](../classes/wp_rest_menu_items_controller/check_has_read_only_access) wp-includes/rest-api/endpoints/class-wp-rest-menu-items-controller.php | Checks whether the current user has read permission for the endpoint. |
| [WP\_REST\_Menu\_Items\_Controller::create\_item()](../classes/wp_rest_menu_items_controller/create_item) wp-includes/rest-api/endpoints/class-wp-rest-menu-items-controller.php | Creates a single post. |
| [WP\_REST\_Menu\_Items\_Controller::delete\_item()](../classes/wp_rest_menu_items_controller/delete_item) wp-includes/rest-api/endpoints/class-wp-rest-menu-items-controller.php | Deletes a single menu item. |
| [WP\_REST\_Menu\_Items\_Controller::prepare\_item\_for\_database()](../classes/wp_rest_menu_items_controller/prepare_item_for_database) wp-includes/rest-api/endpoints/class-wp-rest-menu-items-controller.php | Prepares a single post for create or update. |
| [WP\_REST\_Global\_Styles\_Controller::get\_theme\_item\_permissions\_check()](../classes/wp_rest_global_styles_controller/get_theme_item_permissions_check) wp-includes/rest-api/endpoints/class-wp-rest-global-styles-controller.php | Checks if a given request has access to read a single theme global styles config. |
| [WP\_REST\_Global\_Styles\_Controller::get\_theme\_item()](../classes/wp_rest_global_styles_controller/get_theme_item) wp-includes/rest-api/endpoints/class-wp-rest-global-styles-controller.php | Returns the given theme global styles config. |
| [WP\_REST\_Global\_Styles\_Controller::register\_routes()](../classes/wp_rest_global_styles_controller/register_routes) wp-includes/rest-api/endpoints/class-wp-rest-global-styles-controller.php | Registers the controllers routes. |
| [WP\_REST\_Global\_Styles\_Controller::get\_post()](../classes/wp_rest_global_styles_controller/get_post) wp-includes/rest-api/endpoints/class-wp-rest-global-styles-controller.php | Get the post, if the ID is valid. |
| [WP\_REST\_Global\_Styles\_Controller::get\_item\_permissions\_check()](../classes/wp_rest_global_styles_controller/get_item_permissions_check) wp-includes/rest-api/endpoints/class-wp-rest-global-styles-controller.php | Checks if a given request has access to read a single global style. |
| [WP\_REST\_Global\_Styles\_Controller::update\_item\_permissions\_check()](../classes/wp_rest_global_styles_controller/update_item_permissions_check) wp-includes/rest-api/endpoints/class-wp-rest-global-styles-controller.php | Checks if a given request has access to write a single global styles config. |
| [WP\_REST\_Global\_Styles\_Controller::get\_item\_schema()](../classes/wp_rest_global_styles_controller/get_item_schema) wp-includes/rest-api/endpoints/class-wp-rest-global-styles-controller.php | Retrieves the global styles type’ schema, conforming to JSON Schema. |
| [WP\_REST\_URL\_Details\_Controller::register\_routes()](../classes/wp_rest_url_details_controller/register_routes) wp-includes/rest-api/endpoints/class-wp-rest-url-details-controller.php | Registers the necessary REST API routes. |
| [WP\_REST\_URL\_Details\_Controller::get\_item\_schema()](../classes/wp_rest_url_details_controller/get_item_schema) wp-includes/rest-api/endpoints/class-wp-rest-url-details-controller.php | Retrieves the item’s schema, conforming to JSON Schema. |
| [WP\_REST\_URL\_Details\_Controller::parse\_url\_details()](../classes/wp_rest_url_details_controller/parse_url_details) wp-includes/rest-api/endpoints/class-wp-rest-url-details-controller.php | Retrieves the contents of the title tag from the HTML response. |
| [WP\_REST\_URL\_Details\_Controller::permissions\_check()](../classes/wp_rest_url_details_controller/permissions_check) wp-includes/rest-api/endpoints/class-wp-rest-url-details-controller.php | Checks whether a given request has permission to read remote URLs. |
| [WP\_REST\_URL\_Details\_Controller::get\_remote\_url()](../classes/wp_rest_url_details_controller/get_remote_url) wp-includes/rest-api/endpoints/class-wp-rest-url-details-controller.php | Retrieves the document title from a remote URL. |
| [WP\_REST\_Menus\_Controller::check\_has\_read\_only\_access()](../classes/wp_rest_menus_controller/check_has_read_only_access) wp-includes/rest-api/endpoints/class-wp-rest-menus-controller.php | Checks whether the current user has read permission for the endpoint. |
| [WP\_REST\_Menus\_Controller::create\_item()](../classes/wp_rest_menus_controller/create_item) wp-includes/rest-api/endpoints/class-wp-rest-menus-controller.php | Creates a single term in a taxonomy. |
| [WP\_REST\_Menus\_Controller::update\_item()](../classes/wp_rest_menus_controller/update_item) wp-includes/rest-api/endpoints/class-wp-rest-menus-controller.php | Updates a single term from a taxonomy. |
| [WP\_REST\_Menus\_Controller::delete\_item()](../classes/wp_rest_menus_controller/delete_item) wp-includes/rest-api/endpoints/class-wp-rest-menus-controller.php | Deletes a single term from a taxonomy. |
| [WP\_REST\_Menus\_Controller::handle\_locations()](../classes/wp_rest_menus_controller/handle_locations) wp-includes/rest-api/endpoints/class-wp-rest-menus-controller.php | Updates the menu’s locations from a REST request. |
| [WP\_REST\_Menus\_Controller::get\_item\_schema()](../classes/wp_rest_menus_controller/get_item_schema) wp-includes/rest-api/endpoints/class-wp-rest-menus-controller.php | Retrieves the term’s schema, conforming to JSON Schema. |
| [WP\_REST\_Menu\_Locations\_Controller::register\_routes()](../classes/wp_rest_menu_locations_controller/register_routes) wp-includes/rest-api/endpoints/class-wp-rest-menu-locations-controller.php | Registers the routes for the objects of the controller. |
| [WP\_REST\_Menu\_Locations\_Controller::get\_items\_permissions\_check()](../classes/wp_rest_menu_locations_controller/get_items_permissions_check) wp-includes/rest-api/endpoints/class-wp-rest-menu-locations-controller.php | Checks whether a given request has permission to read menu locations. |
| [WP\_REST\_Menu\_Locations\_Controller::get\_item\_permissions\_check()](../classes/wp_rest_menu_locations_controller/get_item_permissions_check) wp-includes/rest-api/endpoints/class-wp-rest-menu-locations-controller.php | Checks if a given request has access to read a menu location. |
| [WP\_REST\_Menu\_Locations\_Controller::get\_item()](../classes/wp_rest_menu_locations_controller/get_item) wp-includes/rest-api/endpoints/class-wp-rest-menu-locations-controller.php | Retrieves a specific menu location. |
| [WP\_REST\_Menu\_Locations\_Controller::get\_item\_schema()](../classes/wp_rest_menu_locations_controller/get_item_schema) wp-includes/rest-api/endpoints/class-wp-rest-menu-locations-controller.php | Retrieves the menu location’s schema, conforming to JSON Schema. |
| [WP\_REST\_Edit\_Site\_Export\_Controller::permissions\_check()](../classes/wp_rest_edit_site_export_controller/permissions_check) wp-includes/rest-api/endpoints/class-wp-rest-edit-site-export-controller.php | Checks whether a given request has permission to export. |
| [wp\_get\_sidebar()](wp_get_sidebar) wp-includes/widgets.php | Retrieves the registered sidebar with the given ID. |
| [wp\_json\_file\_decode()](wp_json_file_decode) wp-includes/functions.php | Reads and decodes a JSON file. |
| [wp\_generate\_block\_templates\_export\_file()](wp_generate_block_templates_export_file) wp-includes/block-template-utils.php | Creates an export of the current templates and template parts from the site editor at the specified path in a ZIP file. |
| [\_build\_block\_template\_result\_from\_post()](_build_block_template_result_from_post) wp-includes/block-template-utils.php | Builds a unified template object based a post Object. |
| [get\_allowed\_block\_template\_part\_areas()](get_allowed_block_template_part_areas) wp-includes/block-template-utils.php | Returns a filtered list of allowed area values for template parts. |
| [get\_default\_block\_template\_types()](get_default_block_template_types) wp-includes/block-template-utils.php | Returns a filtered list of default template types, containing their localized titles and descriptions. |
| [\_filter\_block\_template\_part\_area()](_filter_block_template_part_area) wp-includes/block-template-utils.php | Checks whether the input ‘area’ is a supported value. |
| [wp\_admin\_bar\_edit\_site\_menu()](wp_admin_bar_edit_site_menu) wp-includes/admin-bar.php | Adds the “Edit site” link to the Toolbar. |
| [\_add\_plugin\_file\_editor\_to\_tools()](_add_plugin_file_editor_to_tools) wp-admin/menu.php | Adds the ‘Plugin File Editor’ menu item after the ‘Themes File Editor’ in Tools for block themes. |
| [WP\_Widget\_Block::\_\_construct()](../classes/wp_widget_block/__construct) wp-includes/widgets/class-wp-widget-block.php | Sets up a new Block widget instance. |
| [WP\_REST\_Widgets\_Controller::prepare\_item\_for\_response()](../classes/wp_rest_widgets_controller/prepare_item_for_response) wp-includes/rest-api/endpoints/class-wp-rest-widgets-controller.php | Prepares the widget for the REST response. |
| [WP\_REST\_Widgets\_Controller::get\_collection\_params()](../classes/wp_rest_widgets_controller/get_collection_params) wp-includes/rest-api/endpoints/class-wp-rest-widgets-controller.php | Gets the list of collection params. |
| [WP\_REST\_Widgets\_Controller::get\_item\_schema()](../classes/wp_rest_widgets_controller/get_item_schema) wp-includes/rest-api/endpoints/class-wp-rest-widgets-controller.php | Retrieves the widget’s schema, conforming to JSON Schema. |
| [WP\_REST\_Widgets\_Controller::register\_routes()](../classes/wp_rest_widgets_controller/register_routes) wp-includes/rest-api/endpoints/class-wp-rest-widgets-controller.php | Registers the widget routes for the controller. |
| [WP\_REST\_Widgets\_Controller::get\_item()](../classes/wp_rest_widgets_controller/get_item) wp-includes/rest-api/endpoints/class-wp-rest-widgets-controller.php | Gets an individual widget. |
| [WP\_REST\_Widgets\_Controller::update\_item()](../classes/wp_rest_widgets_controller/update_item) wp-includes/rest-api/endpoints/class-wp-rest-widgets-controller.php | Updates an existing widget. |
| [WP\_REST\_Widgets\_Controller::delete\_item()](../classes/wp_rest_widgets_controller/delete_item) wp-includes/rest-api/endpoints/class-wp-rest-widgets-controller.php | Deletes a widget. |
| [WP\_REST\_Widgets\_Controller::permissions\_check()](../classes/wp_rest_widgets_controller/permissions_check) wp-includes/rest-api/endpoints/class-wp-rest-widgets-controller.php | Performs a permissions check for managing widgets. |
| [WP\_REST\_Widgets\_Controller::save\_widget()](../classes/wp_rest_widgets_controller/save_widget) wp-includes/rest-api/endpoints/class-wp-rest-widgets-controller.php | Saves the widget in the request object. |
| [WP\_REST\_Sidebars\_Controller::register\_routes()](../classes/wp_rest_sidebars_controller/register_routes) wp-includes/rest-api/endpoints/class-wp-rest-sidebars-controller.php | Registers the controllers routes. |
| [WP\_REST\_Sidebars\_Controller::get\_item()](../classes/wp_rest_sidebars_controller/get_item) wp-includes/rest-api/endpoints/class-wp-rest-sidebars-controller.php | Retrieves one sidebar from the collection. |
| [WP\_REST\_Sidebars\_Controller::do\_permissions\_check()](../classes/wp_rest_sidebars_controller/do_permissions_check) wp-includes/rest-api/endpoints/class-wp-rest-sidebars-controller.php | Checks if the user has permissions to make the request. |
| [WP\_REST\_Sidebars\_Controller::get\_item\_schema()](../classes/wp_rest_sidebars_controller/get_item_schema) wp-includes/rest-api/endpoints/class-wp-rest-sidebars-controller.php | Retrieves the block type’ schema, conforming to JSON Schema. |
| [WP\_REST\_Templates\_Controller::get\_collection\_params()](../classes/wp_rest_templates_controller/get_collection_params) wp-includes/rest-api/endpoints/class-wp-rest-templates-controller.php | Retrieves the query params for the posts collection. |
| [WP\_REST\_Templates\_Controller::get\_item\_schema()](../classes/wp_rest_templates_controller/get_item_schema) wp-includes/rest-api/endpoints/class-wp-rest-templates-controller.php | Retrieves the block type’ schema, conforming to JSON Schema. |
| [WP\_REST\_Templates\_Controller::register\_routes()](../classes/wp_rest_templates_controller/register_routes) wp-includes/rest-api/endpoints/class-wp-rest-templates-controller.php | Registers the controllers routes. |
| [WP\_REST\_Templates\_Controller::permissions\_check()](../classes/wp_rest_templates_controller/permissions_check) wp-includes/rest-api/endpoints/class-wp-rest-templates-controller.php | Checks if the user has permissions to make the request. |
| [WP\_REST\_Templates\_Controller::get\_item()](../classes/wp_rest_templates_controller/get_item) wp-includes/rest-api/endpoints/class-wp-rest-templates-controller.php | Returns the given template |
| [WP\_REST\_Templates\_Controller::update\_item()](../classes/wp_rest_templates_controller/update_item) wp-includes/rest-api/endpoints/class-wp-rest-templates-controller.php | Updates a single template. |
| [WP\_REST\_Templates\_Controller::create\_item()](../classes/wp_rest_templates_controller/create_item) wp-includes/rest-api/endpoints/class-wp-rest-templates-controller.php | Creates a single template. |
| [WP\_REST\_Templates\_Controller::delete\_item()](../classes/wp_rest_templates_controller/delete_item) wp-includes/rest-api/endpoints/class-wp-rest-templates-controller.php | Deletes a single template. |
| [WP\_REST\_Templates\_Controller::prepare\_item\_for\_database()](../classes/wp_rest_templates_controller/prepare_item_for_database) wp-includes/rest-api/endpoints/class-wp-rest-templates-controller.php | Prepares a single template for create or update. |
| [WP\_REST\_Pattern\_Directory\_Controller::get\_items\_permissions\_check()](../classes/wp_rest_pattern_directory_controller/get_items_permissions_check) wp-includes/rest-api/endpoints/class-wp-rest-pattern-directory-controller.php | Checks whether a given request has permission to view the local block pattern directory. |
| [WP\_REST\_Pattern\_Directory\_Controller::get\_items()](../classes/wp_rest_pattern_directory_controller/get_items) wp-includes/rest-api/endpoints/class-wp-rest-pattern-directory-controller.php | Search and retrieve block patterns metadata |
| [WP\_REST\_Pattern\_Directory\_Controller::get\_item\_schema()](../classes/wp_rest_pattern_directory_controller/get_item_schema) wp-includes/rest-api/endpoints/class-wp-rest-pattern-directory-controller.php | Retrieves the block pattern’s schema, conforming to JSON Schema. |
| [WP\_REST\_Pattern\_Directory\_Controller::get\_collection\_params()](../classes/wp_rest_pattern_directory_controller/get_collection_params) wp-includes/rest-api/endpoints/class-wp-rest-pattern-directory-controller.php | Retrieves the search parameters for the block pattern’s collection. |
| [WP\_REST\_Widget\_Types\_Controller::get\_item\_schema()](../classes/wp_rest_widget_types_controller/get_item_schema) wp-includes/rest-api/endpoints/class-wp-rest-widget-types-controller.php | Retrieves the widget type’s schema, conforming to JSON Schema. |
| [WP\_REST\_Widget\_Types\_Controller::encode\_form\_data()](../classes/wp_rest_widget_types_controller/encode_form_data) wp-includes/rest-api/endpoints/class-wp-rest-widget-types-controller.php | An RPC-style endpoint which can be used by clients to turn user input in a widget admin form into an encoded instance object. |
| [WP\_REST\_Widget\_Types\_Controller::register\_routes()](../classes/wp_rest_widget_types_controller/register_routes) wp-includes/rest-api/endpoints/class-wp-rest-widget-types-controller.php | Registers the widget type routes. |
| [WP\_REST\_Widget\_Types\_Controller::check\_read\_permission()](../classes/wp_rest_widget_types_controller/check_read_permission) wp-includes/rest-api/endpoints/class-wp-rest-widget-types-controller.php | Checks whether the user can read widget types. |
| [WP\_REST\_Widget\_Types\_Controller::get\_widget()](../classes/wp_rest_widget_types_controller/get_widget) wp-includes/rest-api/endpoints/class-wp-rest-widget-types-controller.php | Gets the details about the requested widget. |
| [get\_default\_block\_editor\_settings()](get_default_block_editor_settings) wp-includes/block-editor.php | Returns the default block editor settings. |
| [wp\_check\_widget\_editor\_deps()](wp_check_widget_editor_deps) wp-includes/widgets.php | Displays a [\_doing\_it\_wrong()](_doing_it_wrong) message for conflicting widget editor scripts. |
| [locate\_block\_template()](locate_block_template) wp-includes/block-template.php | Finds a block template with equal or higher specificity than a given PHP template file. |
| [WP\_Theme\_JSON::get\_property\_value()](../classes/wp_theme_json/get_property_value) wp-includes/class-wp-theme-json.php | Returns the style property for the given path. |
| [wp\_migrate\_old\_typography\_shape()](wp_migrate_old_typography_shape) wp-includes/blocks.php | Converts typography keys declared under `supports.*` to `supports.typography.*`. |
| [deactivated\_plugins\_notice()](deactivated_plugins_notice) wp-admin/includes/plugin.php | Renders an admin notice when a plugin was deactivated during an update. |
| [WP\_REST\_Application\_Passwords\_Controller::get\_current\_item\_permissions\_check()](../classes/wp_rest_application_passwords_controller/get_current_item_permissions_check) wp-includes/rest-api/endpoints/class-wp-rest-application-passwords-controller.php | Checks if a given request has access to get the currently used application password for a user. |
| [WP\_REST\_Application\_Passwords\_Controller::get\_current\_item()](../classes/wp_rest_application_passwords_controller/get_current_item) wp-includes/rest-api/endpoints/class-wp-rest-application-passwords-controller.php | Retrieves the application password being currently used for authentication of a user. |
| [WP\_REST\_Themes\_Controller::get\_item\_permissions\_check()](../classes/wp_rest_themes_controller/get_item_permissions_check) wp-includes/rest-api/endpoints/class-wp-rest-themes-controller.php | Checks if a given request has access to read the theme. |
| [WP\_REST\_Themes\_Controller::check\_read\_active\_theme\_permission()](../classes/wp_rest_themes_controller/check_read_active_theme_permission) wp-includes/rest-api/endpoints/class-wp-rest-themes-controller.php | Checks if a theme can be read. |
| [WP\_REST\_Themes\_Controller::get\_item()](../classes/wp_rest_themes_controller/get_item) wp-includes/rest-api/endpoints/class-wp-rest-themes-controller.php | Retrieves a single theme. |
| [WP\_REST\_Posts\_Controller::prepare\_taxonomy\_limit\_schema()](../classes/wp_rest_posts_controller/prepare_taxonomy_limit_schema) wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php | Prepares the collection schema for including and excluding items by terms. |
| [wp\_get\_default\_update\_https\_url()](wp_get_default_update_https_url) wp-includes/functions.php | Gets the default URL to learn more about updating the site to use HTTPS. |
| [wp\_update\_https\_detection\_errors()](wp_update_https_detection_errors) wp-includes/https-detection.php | Runs a remote HTTPS request to detect whether HTTPS supported, and stores potential errors. |
| [rest\_validate\_integer\_value\_from\_schema()](rest_validate_integer_value_from_schema) wp-includes/rest-api.php | Validates an integer value based on a schema. |
| [rest\_validate\_enum()](rest_validate_enum) wp-includes/rest-api.php | Validates that the given value is a member of the JSON Schema “enum”. |
| [rest\_validate\_null\_value\_from\_schema()](rest_validate_null_value_from_schema) wp-includes/rest-api.php | Validates a null value based on a schema. |
| [rest\_validate\_boolean\_value\_from\_schema()](rest_validate_boolean_value_from_schema) wp-includes/rest-api.php | Validates a boolean value based on a schema. |
| [rest\_validate\_object\_value\_from\_schema()](rest_validate_object_value_from_schema) wp-includes/rest-api.php | Validates an object value based on a schema. |
| [rest\_validate\_array\_value\_from\_schema()](rest_validate_array_value_from_schema) wp-includes/rest-api.php | Validates an array value based on a schema. |
| [rest\_validate\_number\_value\_from\_schema()](rest_validate_number_value_from_schema) wp-includes/rest-api.php | Validates a number value based on a schema. |
| [rest\_validate\_string\_value\_from\_schema()](rest_validate_string_value_from_schema) wp-includes/rest-api.php | Validates a string value based on a schema. |
| [wp\_ajax\_send\_password\_reset()](wp_ajax_send_password_reset) wp-admin/includes/ajax-actions.php | Ajax handler sends a password reset link. |
| [wpmu\_new\_site\_admin\_notification()](wpmu_new_site_admin_notification) wp-includes/ms-functions.php | Notifies the Multisite network administrator that a new site was created. |
| [WP\_REST\_Server::serve\_batch\_request\_v1()](../classes/wp_rest_server/serve_batch_request_v1) wp-includes/rest-api/class-wp-rest-server.php | Serves the batch/v1 request. |
| [WP\_REST\_Server::match\_request\_to\_handler()](../classes/wp_rest_server/match_request_to_handler) wp-includes/rest-api/class-wp-rest-server.php | Matches a request object to its handler. |
| [WP\_REST\_Server::respond\_to\_request()](../classes/wp_rest_server/respond_to_request) wp-includes/rest-api/class-wp-rest-server.php | Dispatches the request to the callback handler. |
| [WP\_REST\_Site\_Health\_Controller::get\_item\_schema()](../classes/wp_rest_site_health_controller/get_item_schema) wp-includes/rest-api/endpoints/class-wp-rest-site-health-controller.php | Gets the schema for each site health test. |
| [WP\_REST\_Site\_Health\_Controller::get\_directory\_sizes()](../classes/wp_rest_site_health_controller/get_directory_sizes) wp-includes/rest-api/endpoints/class-wp-rest-site-health-controller.php | Gets the current directory sizes for this install. |
| [WP\_REST\_Application\_Passwords\_Controller::do\_permissions\_check()](../classes/wp_rest_application_passwords_controller/do_permissions_check) wp-includes/rest-api/endpoints/class-wp-rest-application-passwords-controller.php | Performs a permissions check for the request. |
| [WP\_REST\_Application\_Passwords\_Controller::get\_user()](../classes/wp_rest_application_passwords_controller/get_user) wp-includes/rest-api/endpoints/class-wp-rest-application-passwords-controller.php | Gets the requested user. |
| [WP\_REST\_Application\_Passwords\_Controller::get\_application\_password()](../classes/wp_rest_application_passwords_controller/get_application_password) wp-includes/rest-api/endpoints/class-wp-rest-application-passwords-controller.php | Gets the requested application password for a user. |
| [WP\_REST\_Application\_Passwords\_Controller::get\_item\_schema()](../classes/wp_rest_application_passwords_controller/get_item_schema) wp-includes/rest-api/endpoints/class-wp-rest-application-passwords-controller.php | Retrieves the application password’s schema, conforming to JSON Schema. |
| [WP\_REST\_Application\_Passwords\_Controller::get\_items\_permissions\_check()](../classes/wp_rest_application_passwords_controller/get_items_permissions_check) wp-includes/rest-api/endpoints/class-wp-rest-application-passwords-controller.php | Checks if a given request has access to get application passwords. |
| [WP\_REST\_Application\_Passwords\_Controller::get\_item\_permissions\_check()](../classes/wp_rest_application_passwords_controller/get_item_permissions_check) wp-includes/rest-api/endpoints/class-wp-rest-application-passwords-controller.php | Checks if a given request has access to get a specific application password. |
| [WP\_REST\_Application\_Passwords\_Controller::create\_item\_permissions\_check()](../classes/wp_rest_application_passwords_controller/create_item_permissions_check) wp-includes/rest-api/endpoints/class-wp-rest-application-passwords-controller.php | Checks if a given request has access to create application passwords. |
| [WP\_REST\_Application\_Passwords\_Controller::update\_item\_permissions\_check()](../classes/wp_rest_application_passwords_controller/update_item_permissions_check) wp-includes/rest-api/endpoints/class-wp-rest-application-passwords-controller.php | Checks if a given request has access to update application passwords. |
| [WP\_REST\_Application\_Passwords\_Controller::delete\_items\_permissions\_check()](../classes/wp_rest_application_passwords_controller/delete_items_permissions_check) wp-includes/rest-api/endpoints/class-wp-rest-application-passwords-controller.php | Checks if a given request has access to delete all application passwords for a user. |
| [WP\_REST\_Application\_Passwords\_Controller::delete\_item\_permissions\_check()](../classes/wp_rest_application_passwords_controller/delete_item_permissions_check) wp-includes/rest-api/endpoints/class-wp-rest-application-passwords-controller.php | Checks if a given request has access to delete a specific application password for a user. |
| [WP\_Image\_Editor\_Imagick::write\_image()](../classes/wp_image_editor_imagick/write_image) wp-includes/class-wp-image-editor-imagick.php | Writes an image to a file or stream. |
| [WP\_Application\_Passwords::delete\_application\_password()](../classes/wp_application_passwords/delete_application_password) wp-includes/class-wp-application-passwords.php | Deletes an application password. |
| [WP\_Application\_Passwords::delete\_all\_application\_passwords()](../classes/wp_application_passwords/delete_all_application_passwords) wp-includes/class-wp-application-passwords.php | Deletes all application passwords for the given user. |
| [WP\_Application\_Passwords::create\_new\_application\_password()](../classes/wp_application_passwords/create_new_application_password) wp-includes/class-wp-application-passwords.php | Creates a new application password. |
| [WP\_Application\_Passwords::update\_application\_password()](../classes/wp_application_passwords/update_application_password) wp-includes/class-wp-application-passwords.php | Updates an application password. |
| [WP\_Application\_Passwords::record\_application\_password\_usage()](../classes/wp_application_passwords/record_application_password_usage) wp-includes/class-wp-application-passwords.php | Records that an application password has been used. |
| [clean\_dirsize\_cache()](clean_dirsize_cache) wp-includes/functions.php | Cleans directory size cache used by [recurse\_dirsize()](recurse_dirsize) . |
| [wp\_authenticate\_application\_password()](wp_authenticate_application_password) wp-includes/user.php | Authenticates the user using an application password. |
| [rest\_format\_combining\_operation\_error()](rest_format_combining_operation_error) wp-includes/rest-api.php | Formats a combining operation error into a [WP\_Error](../classes/wp_error) object. |
| [rest\_get\_combining\_operation\_error()](rest_get_combining_operation_error) wp-includes/rest-api.php | Gets the error of combining operation. |
| [rest\_find\_one\_matching\_schema()](rest_find_one_matching_schema) wp-includes/rest-api.php | Finds the matching schema among the “oneOf” schemas. |
| [WP\_Application\_Passwords\_List\_Table::column\_created()](../classes/wp_application_passwords_list_table/column_created) wp-admin/includes/class-wp-application-passwords-list-table.php | Handles the created column output. |
| [WP\_Application\_Passwords\_List\_Table::column\_last\_used()](../classes/wp_application_passwords_list_table/column_last_used) wp-admin/includes/class-wp-application-passwords-list-table.php | Handles the last used column output. |
| [WP\_Application\_Passwords\_List\_Table::column\_revoke()](../classes/wp_application_passwords_list_table/column_revoke) wp-admin/includes/class-wp-application-passwords-list-table.php | Handles the revoke column output. |
| [WP\_Application\_Passwords\_List\_Table::print\_js\_template\_row()](../classes/wp_application_passwords_list_table/print_js_template_row) wp-admin/includes/class-wp-application-passwords-list-table.php | Prints the JavaScript template for the new row item. |
| [WP\_Application\_Passwords\_List\_Table::get\_columns()](../classes/wp_application_passwords_list_table/get_columns) wp-admin/includes/class-wp-application-passwords-list-table.php | Gets the list of columns. |
| [get\_media\_states()](get_media_states) wp-admin/includes/template.php | Retrieves an array of media states from an attachment. |
| [WP\_Site\_Health::get\_test\_authorization\_header()](../classes/wp_site_health/get_test_authorization_header) wp-admin/includes/class-wp-site-health.php | Tests if the Authorization header has the expected values. |
| [wp\_is\_authorize\_application\_password\_request\_valid()](wp_is_authorize_application_password_request_valid) wp-admin/includes/user.php | Checks if the Authorize Application Password request is valid. |
| [WP\_Comments\_List\_Table::comment\_type\_dropdown()](../classes/wp_comments_list_table/comment_type_dropdown) wp-admin/includes/class-wp-comments-list-table.php | Displays a comment type drop-down for filtering on the Comments list table. |
| [core\_auto\_updates\_settings()](core_auto_updates_settings) wp-admin/update-core.php | Display WordPress auto-updates settings. |
| [WP\_Block\_Patterns\_Registry::unregister()](../classes/wp_block_patterns_registry/unregister) wp-includes/class-wp-block-patterns-registry.php | Unregisters a block pattern. |
| [WP\_Block\_Patterns\_Registry::register()](../classes/wp_block_patterns_registry/register) wp-includes/class-wp-block-patterns-registry.php | Registers a block pattern. |
| [WP\_Block\_Pattern\_Categories\_Registry::register()](../classes/wp_block_pattern_categories_registry/register) wp-includes/class-wp-block-pattern-categories-registry.php | Registers a pattern category. |
| [WP\_Block\_Pattern\_Categories\_Registry::unregister()](../classes/wp_block_pattern_categories_registry/unregister) wp-includes/class-wp-block-pattern-categories-registry.php | Unregisters a pattern category. |
| [wp\_get\_environment\_type()](wp_get_environment_type) wp-includes/load.php | Retrieves the current environment type. |
| [WP\_REST\_Block\_Directory\_Controller::get\_items\_permissions\_check()](../classes/wp_rest_block_directory_controller/get_items_permissions_check) wp-includes/rest-api/endpoints/class-wp-rest-block-directory-controller.php | Checks whether a given request has permission to install and activate plugins. |
| [WP\_REST\_Block\_Directory\_Controller::prepare\_item\_for\_response()](../classes/wp_rest_block_directory_controller/prepare_item_for_response) wp-includes/rest-api/endpoints/class-wp-rest-block-directory-controller.php | Parse block metadata for a block, and prepare it for an API response. |
| [WP\_REST\_Block\_Directory\_Controller::get\_item\_schema()](../classes/wp_rest_block_directory_controller/get_item_schema) wp-includes/rest-api/endpoints/class-wp-rest-block-directory-controller.php | Retrieves the theme’s schema, conforming to JSON Schema. |
| [WP\_REST\_Block\_Directory\_Controller::get\_collection\_params()](../classes/wp_rest_block_directory_controller/get_collection_params) wp-includes/rest-api/endpoints/class-wp-rest-block-directory-controller.php | Retrieves the search params for the blocks collection. |
| [WP\_REST\_Plugins\_Controller::get\_plugin\_data()](../classes/wp_rest_plugins_controller/get_plugin_data) wp-includes/rest-api/endpoints/class-wp-rest-plugins-controller.php | Gets the plugin header data for a plugin. |
| [WP\_REST\_Plugins\_Controller::plugin\_status\_permission\_check()](../classes/wp_rest_plugins_controller/plugin_status_permission_check) wp-includes/rest-api/endpoints/class-wp-rest-plugins-controller.php | Handle updating a plugin’s status. |
| [WP\_REST\_Plugins\_Controller::handle\_plugin\_status()](../classes/wp_rest_plugins_controller/handle_plugin_status) wp-includes/rest-api/endpoints/class-wp-rest-plugins-controller.php | Handle updating a plugin’s status. |
| [WP\_REST\_Plugins\_Controller::is\_filesystem\_available()](../classes/wp_rest_plugins_controller/is_filesystem_available) wp-includes/rest-api/endpoints/class-wp-rest-plugins-controller.php | Determine if the endpoints are available. |
| [WP\_REST\_Plugins\_Controller::get\_item\_schema()](../classes/wp_rest_plugins_controller/get_item_schema) wp-includes/rest-api/endpoints/class-wp-rest-plugins-controller.php | Retrieves the plugin’s schema, conforming to JSON Schema. |
| [WP\_REST\_Plugins\_Controller::get\_collection\_params()](../classes/wp_rest_plugins_controller/get_collection_params) wp-includes/rest-api/endpoints/class-wp-rest-plugins-controller.php | Retrieves the query params for the collections. |
| [WP\_REST\_Plugins\_Controller::get\_item\_permissions\_check()](../classes/wp_rest_plugins_controller/get_item_permissions_check) wp-includes/rest-api/endpoints/class-wp-rest-plugins-controller.php | Checks if a given request has access to get a specific plugin. |
| [WP\_REST\_Plugins\_Controller::check\_read\_permission()](../classes/wp_rest_plugins_controller/check_read_permission) wp-includes/rest-api/endpoints/class-wp-rest-plugins-controller.php | Checks if the given plugin can be viewed by the current user. |
| [WP\_REST\_Plugins\_Controller::create\_item\_permissions\_check()](../classes/wp_rest_plugins_controller/create_item_permissions_check) wp-includes/rest-api/endpoints/class-wp-rest-plugins-controller.php | Checks if a given request has access to upload plugins. |
| [WP\_REST\_Plugins\_Controller::create\_item()](../classes/wp_rest_plugins_controller/create_item) wp-includes/rest-api/endpoints/class-wp-rest-plugins-controller.php | Uploads a plugin and optionally activates it. |
| [WP\_REST\_Plugins\_Controller::update\_item\_permissions\_check()](../classes/wp_rest_plugins_controller/update_item_permissions_check) wp-includes/rest-api/endpoints/class-wp-rest-plugins-controller.php | Checks if a given request has access to update a specific plugin. |
| [WP\_REST\_Plugins\_Controller::delete\_item\_permissions\_check()](../classes/wp_rest_plugins_controller/delete_item_permissions_check) wp-includes/rest-api/endpoints/class-wp-rest-plugins-controller.php | Checks if a given request has access to delete a specific plugin. |
| [WP\_REST\_Plugins\_Controller::delete\_item()](../classes/wp_rest_plugins_controller/delete_item) wp-includes/rest-api/endpoints/class-wp-rest-plugins-controller.php | Deletes one plugin from the site. |
| [WP\_REST\_Plugins\_Controller::register\_routes()](../classes/wp_rest_plugins_controller/register_routes) wp-includes/rest-api/endpoints/class-wp-rest-plugins-controller.php | Registers the routes for the plugins controller. |
| [WP\_REST\_Plugins\_Controller::get\_items\_permissions\_check()](../classes/wp_rest_plugins_controller/get_items_permissions_check) wp-includes/rest-api/endpoints/class-wp-rest-plugins-controller.php | Checks if a given request has access to get plugins. |
| [WP\_REST\_Block\_Types\_Controller::get\_block()](../classes/wp_rest_block_types_controller/get_block) wp-includes/rest-api/endpoints/class-wp-rest-block-types-controller.php | Get the block, if the name is valid. |
| [WP\_REST\_Block\_Types\_Controller::get\_item\_schema()](../classes/wp_rest_block_types_controller/get_item_schema) wp-includes/rest-api/endpoints/class-wp-rest-block-types-controller.php | Retrieves the block type’ schema, conforming to JSON Schema. |
| [WP\_REST\_Block\_Types\_Controller::get\_collection\_params()](../classes/wp_rest_block_types_controller/get_collection_params) wp-includes/rest-api/endpoints/class-wp-rest-block-types-controller.php | Retrieves the query params for collections. |
| [WP\_REST\_Block\_Types\_Controller::register\_routes()](../classes/wp_rest_block_types_controller/register_routes) wp-includes/rest-api/endpoints/class-wp-rest-block-types-controller.php | Registers the routes for block types. |
| [WP\_REST\_Block\_Types\_Controller::check\_read\_permission()](../classes/wp_rest_block_types_controller/check_read_permission) wp-includes/rest-api/endpoints/class-wp-rest-block-types-controller.php | Checks whether a given block type should be visible. |
| [WP\_REST\_Attachments\_Controller::get\_edit\_media\_item\_args()](../classes/wp_rest_attachments_controller/get_edit_media_item_args) wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php | Gets the request args for the edit item route. |
| [WP\_REST\_Attachments\_Controller::edit\_media\_item\_permissions\_check()](../classes/wp_rest_attachments_controller/edit_media_item_permissions_check) wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php | Checks if a given request has access to editing media. |
| [WP\_REST\_Attachments\_Controller::edit\_media\_item()](../classes/wp_rest_attachments_controller/edit_media_item) wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php | Applies edits to a media item and creates a new attachment record. |
| [create\_initial\_theme\_features()](create_initial_theme_features) wp-includes/theme.php | Creates the initial theme features when the ‘setup\_theme’ action is fired. |
| [register\_theme\_feature()](register_theme_feature) wp-includes/theme.php | Registers a theme feature for use in [add\_theme\_support()](add_theme_support) . |
| [wp\_check\_comment\_disallowed\_list()](wp_check_comment_disallowed_list) wp-includes/comment.php | Checks if a comment contains disallowed characters or words. |
| [rest\_handle\_multi\_type\_schema()](rest_handle_multi_type_schema) wp-includes/rest-api.php | Handles getting the best type for a multi-type schema. |
| [rest\_stabilize\_value()](rest_stabilize_value) wp-includes/rest-api.php | Stabilizes a value following JSON Schema semantics. |
| [rest\_handle\_doing\_it\_wrong()](rest_handle_doing_it_wrong) wp-includes/rest-api.php | Handles \_doing\_it\_wrong errors. |
| [register\_block\_script\_handle()](register_block_script_handle) wp-includes/blocks.php | Finds a script handle for the selected block metadata field. It detects when a path to file was provided and finds a corresponding asset file with details necessary to register the script under automatically generated handle name. It returns unprocessed script handle otherwise. |
| [WP\_Sitemaps\_Renderer::get\_sitemap\_index\_xml()](../classes/wp_sitemaps_renderer/get_sitemap_index_xml) wp-includes/sitemaps/class-wp-sitemaps-renderer.php | Gets XML for a sitemap index. |
| [WP\_Sitemaps\_Renderer::get\_sitemap\_xml()](../classes/wp_sitemaps_renderer/get_sitemap_xml) wp-includes/sitemaps/class-wp-sitemaps-renderer.php | Gets XML for a sitemap. |
| [WP\_Sitemaps\_Renderer::check\_for\_simple\_xml\_availability()](../classes/wp_sitemaps_renderer/check_for_simple_xml_availability) wp-includes/sitemaps/class-wp-sitemaps-renderer.php | Checks for the availability of the SimpleXML extension and errors if missing. |
| [WP\_Sitemaps\_Stylesheet::get\_sitemap\_stylesheet()](../classes/wp_sitemaps_stylesheet/get_sitemap_stylesheet) wp-includes/sitemaps/class-wp-sitemaps-stylesheet.php | Returns the escaped XSL for all sitemaps, except index. |
| [WP\_Sitemaps\_Stylesheet::get\_sitemap\_index\_stylesheet()](../classes/wp_sitemaps_stylesheet/get_sitemap_index_stylesheet) wp-includes/sitemaps/class-wp-sitemaps-stylesheet.php | Returns the escaped XSL for the index sitemaps. |
| [WP\_Automatic\_Updater::send\_plugin\_theme\_email()](../classes/wp_automatic_updater/send_plugin_theme_email) wp-admin/includes/class-wp-automatic-updater.php | Sends an email upon the completion or failure of a plugin or theme background update. |
| [wp\_get\_auto\_update\_message()](wp_get_auto_update_message) wp-admin/includes/update.php | Determines the appropriate auto-update message to be displayed. |
| [WP\_Site\_Health::get\_test\_plugin\_theme\_auto\_updates()](../classes/wp_site_health/get_test_plugin_theme_auto_updates) wp-admin/includes/class-wp-site-health.php | Tests if plugin and theme auto-updates appear to be configured correctly. |
| [WP\_Site\_Health::get\_test\_file\_uploads()](../classes/wp_site_health/get_test_file_uploads) wp-admin/includes/class-wp-site-health.php | Tests if ‘file\_uploads’ directive in PHP.ini is turned off. |
| [WP\_Site\_Health::detect\_plugin\_theme\_auto\_update\_issues()](../classes/wp_site_health/detect_plugin_theme_auto_update_issues) wp-admin/includes/class-wp-site-health.php | Checks for potential issues with plugin and theme auto-updates. |
| [WP\_Site\_Health::get\_test\_php\_sessions()](../classes/wp_site_health/get_test_php_sessions) wp-admin/includes/class-wp-site-health.php | Tests if there’s an active PHP session that can affect loopback requests. |
| [Plugin\_Installer\_Skin::do\_overwrite()](../classes/plugin_installer_skin/do_overwrite) wp-admin/includes/class-plugin-installer-skin.php | Check if the plugin can be overwritten and output the HTML for overwriting a plugin on upload. |
| [Theme\_Installer\_Skin::do\_overwrite()](../classes/theme_installer_skin/do_overwrite) wp-admin/includes/class-theme-installer-skin.php | Check if the theme can be overwritten and output the HTML for overwriting a theme on upload. |
| [WP\_MS\_Themes\_List\_Table::column\_autoupdates()](../classes/wp_ms_themes_list_table/column_autoupdates) wp-admin/includes/class-wp-ms-themes-list-table.php | Handles the auto-updates column output. |
| [wp\_ajax\_toggle\_auto\_updates()](wp_ajax_toggle_auto_updates) wp-admin/includes/ajax-actions.php | Ajax handler to enable or disable plugin and theme auto-updates. |
| [wp\_theme\_auto\_update\_setting\_template()](wp_theme_auto_update_setting_template) wp-admin/themes.php | Returns the JavaScript template used to display the auto-update setting for a theme. |
| [is\_favicon()](is_favicon) wp-includes/query.php | Is the query for the favicon.ico file? |
| [wp\_dashboard\_site\_health()](wp_dashboard_site_health) wp-admin/includes/dashboard.php | Displays the Site Health Status widget. |
| [WP\_Site\_Health::wp\_cron\_scheduled\_check()](../classes/wp_site_health/wp_cron_scheduled_check) wp-admin/includes/class-wp-site-health.php | Runs the scheduled event to check and update the latest site health status for the website. |
| [WP\_Site\_Health::get\_test\_php\_default\_timezone()](../classes/wp_site_health/get_test_php_default_timezone) wp-admin/includes/class-wp-site-health.php | Tests if the PHP default timezone is set to UTC. |
| [WP\_REST\_Attachments\_Controller::register\_routes()](../classes/wp_rest_attachments_controller/register_routes) wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php | Registers the routes for attachments. |
| [WP\_Block\_Styles\_Registry::register()](../classes/wp_block_styles_registry/register) wp-includes/class-wp-block-styles-registry.php | Registers a block style for the given block type. |
| [WP\_Block\_Styles\_Registry::unregister()](../classes/wp_block_styles_registry/unregister) wp-includes/class-wp-block-styles-registry.php | Unregisters a block style of the given block type. |
| [WP\_Image\_Editor\_Imagick::make\_subsize()](../classes/wp_image_editor_imagick/make_subsize) wp-includes/class-wp-image-editor-imagick.php | Create an image sub-size and return the image meta data value for it. |
| [WP\_Image\_Editor\_Imagick::maybe\_exif\_rotate()](../classes/wp_image_editor_imagick/maybe_exif_rotate) wp-includes/class-wp-image-editor-imagick.php | Check if a JPEG image has EXIF Orientation tag and rotate it if needed. |
| [WP\_Recovery\_Mode\_Email\_Service::get\_debug()](../classes/wp_recovery_mode_email_service/get_debug) wp-includes/class-wp-recovery-mode-email-service.php | Return debug information in an easy to manipulate format. |
| [WP\_Image\_Editor\_GD::make\_subsize()](../classes/wp_image_editor_gd/make_subsize) wp-includes/class-wp-image-editor-gd.php | Create an image sub-size and return the image meta data value for it. |
| [get\_post\_states()](get_post_states) wp-admin/includes/template.php | Retrieves an array of post states from a post. |
| [wp\_update\_image\_subsizes()](wp_update_image_subsizes) wp-admin/includes/image.php | If any of the currently registered image sub-sizes are missing, create them and update the image meta data. |
| [WP\_Site\_Health\_Auto\_Updates::test\_wp\_automatic\_updates\_disabled()](../classes/wp_site_health_auto_updates/test_wp_automatic_updates_disabled) wp-admin/includes/class-wp-site-health-auto-updates.php | Checks if automatic updates are disabled. |
| [WP\_Privacy\_Data\_Removal\_Requests\_List\_Table::column\_email()](../classes/wp_privacy_data_removal_requests_list_table/column_email) wp-admin/includes/class-wp-privacy-data-removal-requests-list-table.php | Actions column. |
| [WP\_Privacy\_Data\_Removal\_Requests\_List\_Table::column\_next\_steps()](../classes/wp_privacy_data_removal_requests_list_table/column_next_steps) wp-admin/includes/class-wp-privacy-data-removal-requests-list-table.php | Next steps column. |
| [wp\_ajax\_media\_create\_image\_subsizes()](wp_ajax_media_create_image_subsizes) wp-admin/includes/ajax-actions.php | Ajax handler for creating missing image sub-sizes for just uploaded images. |
| [WP\_MS\_Sites\_List\_Table::site\_states()](../classes/wp_ms_sites_list_table/site_states) wp-admin/includes/class-wp-ms-sites-list-table.php | Maybe output comma-separated site states. |
| [WP\_MS\_Sites\_List\_Table::extra\_tablenav()](../classes/wp_ms_sites_list_table/extra_tablenav) wp-admin/includes/class-wp-ms-sites-list-table.php | Extra controls to be displayed between bulk actions and pagination. |
| [WP\_Privacy\_Data\_Export\_Requests\_List\_Table::column\_email()](../classes/wp_privacy_data_export_requests_list_table/column_email) wp-admin/includes/class-wp-privacy-data-export-requests-list-table.php | Actions column. |
| [WP\_Privacy\_Data\_Export\_Requests\_List\_Table::column\_next\_steps()](../classes/wp_privacy_data_export_requests_list_table/column_next_steps) wp-admin/includes/class-wp-privacy-data-export-requests-list-table.php | Displays the next steps column. |
| [WP\_Recovery\_Mode::handle\_error()](../classes/wp_recovery_mode/handle_error) wp-includes/class-wp-recovery-mode.php | Handles a fatal error occurring. |
| [WP\_Recovery\_Mode::handle\_exit\_recovery\_mode()](../classes/wp_recovery_mode/handle_exit_recovery_mode) wp-includes/class-wp-recovery-mode.php | Handles a request to exit Recovery Mode. |
| [is\_privacy\_policy()](is_privacy_policy) wp-includes/query.php | Determines whether the query is for the Privacy Policy page. |
| [WP\_Recovery\_Mode\_Key\_Service::validate\_recovery\_mode\_key()](../classes/wp_recovery_mode_key_service/validate_recovery_mode_key) wp-includes/class-wp-recovery-mode-key-service.php | Verifies if the recovery mode key is correct. |
| [WP\_Recovery\_Mode\_Email\_Service::maybe\_send\_recovery\_mode\_email()](../classes/wp_recovery_mode_email_service/maybe_send_recovery_mode_email) wp-includes/class-wp-recovery-mode-email-service.php | Sends the recovery mode email if the rate limit has not been sent. |
| [WP\_Recovery\_Mode\_Email\_Service::send\_recovery\_mode\_email()](../classes/wp_recovery_mode_email_service/send_recovery_mode_email) wp-includes/class-wp-recovery-mode-email-service.php | Sends the Recovery Mode email to the site admin email address. |
| [WP\_Recovery\_Mode\_Email\_Service::get\_cause()](../classes/wp_recovery_mode_email_service/get_cause) wp-includes/class-wp-recovery-mode-email-service.php | Gets the description indicating the possible cause for the error. |
| [WP\_Recovery\_Mode\_Cookie\_Service::validate\_cookie()](../classes/wp_recovery_mode_cookie_service/validate_cookie) wp-includes/class-wp-recovery-mode-cookie-service.php | Validates the recovery mode cookie. |
| [WP\_Recovery\_Mode\_Cookie\_Service::get\_session\_id\_from\_cookie()](../classes/wp_recovery_mode_cookie_service/get_session_id_from_cookie) wp-includes/class-wp-recovery-mode-cookie-service.php | Gets the session identifier from the cookie. |
| [WP\_Recovery\_Mode\_Cookie\_Service::parse\_cookie()](../classes/wp_recovery_mode_cookie_service/parse_cookie) wp-includes/class-wp-recovery-mode-cookie-service.php | Parses the cookie into its four parts. |
| [WP\_Recovery\_Mode\_Cookie\_Service::recovery\_mode\_hash()](../classes/wp_recovery_mode_cookie_service/recovery_mode_hash) wp-includes/class-wp-recovery-mode-cookie-service.php | Gets a form of `wp_hash()` specific to Recovery Mode. |
| [wp\_get\_extension\_error\_description()](wp_get_extension_error_description) wp-includes/error-protection.php | Get a human readable description of an extension’s error. |
| [WP\_Fatal\_Error\_Handler::display\_default\_error\_template()](../classes/wp_fatal_error_handler/display_default_error_template) wp-includes/class-wp-fatal-error-handler.php | Displays the default PHP error template. |
| [wp\_get\_update\_php\_annotation()](wp_get_update_php_annotation) wp-includes/functions.php | Returns the default annotation for the web hosting altering the “Update PHP” page URL. |
| [wp\_admin\_bar\_recovery\_mode\_menu()](wp_admin_bar_recovery_mode_menu) wp-includes/admin-bar.php | Adds a link to exit recovery mode when Recovery Mode is active. |
| [WP\_Debug\_Data::get\_sizes()](../classes/wp_debug_data/get_sizes) wp-admin/includes/class-wp-debug-data.php | Fetches the sizes of the WordPress directories: `wordpress` (ABSPATH), `plugins`, `themes`, and `uploads`. |
| [WP\_Debug\_Data::debug\_data()](../classes/wp_debug_data/debug_data) wp-admin/includes/class-wp-debug-data.php | Static function for generating site debug data when required. |
| [verify\_file\_signature()](verify_file_signature) wp-admin/includes/file.php | Verifies the contents of a file against its ED25519 signature. |
| [resume\_theme()](resume_theme) wp-admin/includes/theme.php | Tries to resume a single theme. |
| [paused\_themes\_notice()](paused_themes_notice) wp-admin/includes/theme.php | Renders an admin notice in case some themes have been paused due to errors. |
| [wp\_recovery\_mode\_nag()](wp_recovery_mode_nag) wp-admin/includes/update.php | Displays a notice when the user is in recovery mode. |
| [WP\_Site\_Health::get\_test\_ssl\_support()](../classes/wp_site_health/get_test_ssl_support) wp-admin/includes/class-wp-site-health.php | Checks if the HTTP API can handle SSL/TLS requests. |
| [WP\_Site\_Health::get\_test\_scheduled\_events()](../classes/wp_site_health/get_test_scheduled_events) wp-admin/includes/class-wp-site-health.php | Tests if scheduled events run as intended. |
| [WP\_Site\_Health::get\_test\_background\_updates()](../classes/wp_site_health/get_test_background_updates) wp-admin/includes/class-wp-site-health.php | Tests if WordPress can run automated background updates. |
| [WP\_Site\_Health::get\_test\_loopback\_requests()](../classes/wp_site_health/get_test_loopback_requests) wp-admin/includes/class-wp-site-health.php | Tests if loopbacks work as expected. |
| [WP\_Site\_Health::get\_test\_http\_requests()](../classes/wp_site_health/get_test_http_requests) wp-admin/includes/class-wp-site-health.php | Tests if HTTP requests are blocked. |
| [WP\_Site\_Health::get\_test\_rest\_availability()](../classes/wp_site_health/get_test_rest_availability) wp-admin/includes/class-wp-site-health.php | Tests if the REST API is accessible. |
| [WP\_Site\_Health::get\_tests()](../classes/wp_site_health/get_tests) wp-admin/includes/class-wp-site-health.php | Returns a set of tests that belong to the site status page. |
| [WP\_Site\_Health::get\_cron\_tasks()](../classes/wp_site_health/get_cron_tasks) wp-admin/includes/class-wp-site-health.php | Populates the list of cron events and store them to a class-wide variable. |
| [WP\_Site\_Health::can\_perform\_loopback()](../classes/wp_site_health/can_perform_loopback) wp-admin/includes/class-wp-site-health.php | Runs a loopback test on the site. |
| [WP\_Site\_Health::get\_test\_wordpress\_version()](../classes/wp_site_health/get_test_wordpress_version) wp-admin/includes/class-wp-site-health.php | Tests for WordPress version and outputs it. |
| [WP\_Site\_Health::get\_test\_plugin\_version()](../classes/wp_site_health/get_test_plugin_version) wp-admin/includes/class-wp-site-health.php | Tests if plugins are outdated, or unnecessary. |
| [WP\_Site\_Health::get\_test\_theme\_version()](../classes/wp_site_health/get_test_theme_version) wp-admin/includes/class-wp-site-health.php | Tests if themes are outdated, or unnecessary. |
| [WP\_Site\_Health::get\_test\_php\_version()](../classes/wp_site_health/get_test_php_version) wp-admin/includes/class-wp-site-health.php | Tests if the supplied PHP version is supported. |
| [WP\_Site\_Health::get\_test\_php\_extensions()](../classes/wp_site_health/get_test_php_extensions) wp-admin/includes/class-wp-site-health.php | Tests if required PHP modules are installed on the host. |
| [WP\_Site\_Health::get\_test\_sql\_server()](../classes/wp_site_health/get_test_sql_server) wp-admin/includes/class-wp-site-health.php | Tests if the SQL server is up to date. |
| [WP\_Site\_Health::get\_test\_utf8mb4\_support()](../classes/wp_site_health/get_test_utf8mb4_support) wp-admin/includes/class-wp-site-health.php | Tests if the database server is capable of using utf8mb4. |
| [WP\_Site\_Health::get\_test\_dotorg\_communication()](../classes/wp_site_health/get_test_dotorg_communication) wp-admin/includes/class-wp-site-health.php | Tests if the site can communicate with WordPress.org. |
| [WP\_Site\_Health::get\_test\_is\_in\_debug\_mode()](../classes/wp_site_health/get_test_is_in_debug_mode) wp-admin/includes/class-wp-site-health.php | Tests if debug information is enabled. |
| [WP\_Site\_Health::get\_test\_https\_status()](../classes/wp_site_health/get_test_https_status) wp-admin/includes/class-wp-site-health.php | Tests if the site is serving content over HTTPS. |
| [resume\_plugin()](resume_plugin) wp-admin/includes/plugin.php | Tries to resume a single plugin. |
| [paused\_plugins\_notice()](paused_plugins_notice) wp-admin/includes/plugin.php | Renders an admin notice in case some plugins have been paused due to errors. |
| [validate\_plugin\_requirements()](validate_plugin_requirements) wp-admin/includes/plugin.php | Validates the plugin requirements for WordPress version and PHP version. |
| [WP\_Site\_Health\_Auto\_Updates::test\_check\_wp\_filesystem\_method()](../classes/wp_site_health_auto_updates/test_check_wp_filesystem_method) wp-admin/includes/class-wp-site-health-auto-updates.php | Checks if we can access files without providing credentials. |
| [WP\_Site\_Health\_Auto\_Updates::test\_all\_files\_writable()](../classes/wp_site_health_auto_updates/test_all_files_writable) wp-admin/includes/class-wp-site-health-auto-updates.php | Checks if core files are writable by the web user/group. |
| [WP\_Site\_Health\_Auto\_Updates::test\_accepts\_dev\_updates()](../classes/wp_site_health_auto_updates/test_accepts_dev_updates) wp-admin/includes/class-wp-site-health-auto-updates.php | Checks if the install is using a development branch and can use nightly packages. |
| [WP\_Site\_Health\_Auto\_Updates::test\_accepts\_minor\_updates()](../classes/wp_site_health_auto_updates/test_accepts_minor_updates) wp-admin/includes/class-wp-site-health-auto-updates.php | Checks if the site supports automatic minor updates. |
| [WP\_Site\_Health\_Auto\_Updates::test\_constants()](../classes/wp_site_health_auto_updates/test_constants) wp-admin/includes/class-wp-site-health-auto-updates.php | Tests if auto-updates related constants are set correctly. |
| [WP\_Site\_Health\_Auto\_Updates::test\_wp\_version\_check\_attached()](../classes/wp_site_health_auto_updates/test_wp_version_check_attached) wp-admin/includes/class-wp-site-health-auto-updates.php | Checks if updates are intercepted by a filter. |
| [WP\_Site\_Health\_Auto\_Updates::test\_filters\_automatic\_updater\_disabled()](../classes/wp_site_health_auto_updates/test_filters_automatic_updater_disabled) wp-admin/includes/class-wp-site-health-auto-updates.php | Checks if automatic updates are disabled by a filter. |
| [WP\_Site\_Health\_Auto\_Updates::test\_if\_failed\_update()](../classes/wp_site_health_auto_updates/test_if_failed_update) wp-admin/includes/class-wp-site-health-auto-updates.php | Checks if automatic updates have tried to run, but failed, previously. |
| [WP\_Site\_Health\_Auto\_Updates::test\_vcs\_abspath()](../classes/wp_site_health_auto_updates/test_vcs_abspath) wp-admin/includes/class-wp-site-health-auto-updates.php | Checks if WordPress is controlled by a VCS (Git, Subversion etc). |
| [wp\_ajax\_health\_check\_get\_sizes()](wp_ajax_health_check_get_sizes) wp-admin/includes/ajax-actions.php | Ajax handler for site health check to get directories and database sizes. |
| [wp\_ajax\_health\_check\_dotorg\_communication()](wp_ajax_health_check_dotorg_communication) wp-admin/includes/ajax-actions.php | Ajax handler for site health checks on server communication. |
| [wp\_ajax\_health\_check\_background\_updates()](wp_ajax_health_check_background_updates) wp-admin/includes/ajax-actions.php | Ajax handler for site health checks on background updates. |
| [wp\_ajax\_health\_check\_loopback\_requests()](wp_ajax_health_check_loopback_requests) wp-admin/includes/ajax-actions.php | Ajax handler for site health checks on loopback requests. |
| [wp\_direct\_php\_update\_button()](wp_direct_php_update_button) wp-includes/functions.php | Displays a button directly linking to a PHP update process. |
| [wp\_check\_site\_meta\_support\_prefilter()](wp_check_site_meta_support_prefilter) wp-includes/ms-site.php | Aborts calls to site meta if it is not supported. |
| [wp\_validate\_site\_data()](wp_validate_site_data) wp-includes/ms-site.php | Validates data for a site prior to inserting or updating in the database. |
| [wp\_initialize\_site()](wp_initialize_site) wp-includes/ms-site.php | Runs the initialization routine for a given site. |
| [wp\_uninitialize\_site()](wp_uninitialize_site) wp-includes/ms-site.php | Runs the uninitialization routine for a given site. |
| [wp\_insert\_site()](wp_insert_site) wp-includes/ms-site.php | Inserts a new site into the database. |
| [wp\_update\_site()](wp_update_site) wp-includes/ms-site.php | Updates a site in the database. |
| [wp\_delete\_site()](wp_delete_site) wp-includes/ms-site.php | Deletes a site from the database. |
| [\_wp\_die\_process\_input()](_wp_die_process_input) wp-includes/functions.php | Processes arguments passed to [wp\_die()](wp_die) consistently for its handlers. |
| [wp\_dashboard\_php\_nag()](wp_dashboard_php_nag) wp-admin/includes/dashboard.php | Displays the PHP update nag. |
| [populate\_network\_meta()](populate_network_meta) wp-admin/includes/schema.php | Creates WordPress network meta and sets the default values. |
| [WP\_REST\_Search\_Controller::\_\_construct()](../classes/wp_rest_search_controller/__construct) wp-includes/rest-api/endpoints/class-wp-rest-search-controller.php | Constructor. |
| [WP\_REST\_Search\_Controller::get\_items()](../classes/wp_rest_search_controller/get_items) wp-includes/rest-api/endpoints/class-wp-rest-search-controller.php | Retrieves a collection of search results. |
| [WP\_REST\_Search\_Controller::get\_item\_schema()](../classes/wp_rest_search_controller/get_item_schema) wp-includes/rest-api/endpoints/class-wp-rest-search-controller.php | Retrieves the item schema, conforming to JSON Schema. |
| [WP\_REST\_Search\_Controller::get\_collection\_params()](../classes/wp_rest_search_controller/get_collection_params) wp-includes/rest-api/endpoints/class-wp-rest-search-controller.php | Retrieves the query params for the search results collection. |
| [WP\_REST\_Search\_Controller::get\_search\_handler()](../classes/wp_rest_search_controller/get_search_handler) wp-includes/rest-api/endpoints/class-wp-rest-search-controller.php | Gets the search handler to handle the current request. |
| [WP\_REST\_Themes\_Controller::register\_routes()](../classes/wp_rest_themes_controller/register_routes) wp-includes/rest-api/endpoints/class-wp-rest-themes-controller.php | Registers the routes for themes. |
| [WP\_REST\_Themes\_Controller::get\_items\_permissions\_check()](../classes/wp_rest_themes_controller/get_items_permissions_check) wp-includes/rest-api/endpoints/class-wp-rest-themes-controller.php | Checks if a given request has access to read the theme. |
| [WP\_REST\_Themes\_Controller::get\_item\_schema()](../classes/wp_rest_themes_controller/get_item_schema) wp-includes/rest-api/endpoints/class-wp-rest-themes-controller.php | Retrieves the theme’s schema, conforming to JSON Schema. |
| [WP\_REST\_Themes\_Controller::get\_collection\_params()](../classes/wp_rest_themes_controller/get_collection_params) wp-includes/rest-api/endpoints/class-wp-rest-themes-controller.php | Retrieves the search params for the themes collection. |
| [WP\_REST\_Autosaves\_Controller::register\_routes()](../classes/wp_rest_autosaves_controller/register_routes) wp-includes/rest-api/endpoints/class-wp-rest-autosaves-controller.php | Registers the routes for autosaves. |
| [WP\_REST\_Autosaves\_Controller::get\_items\_permissions\_check()](../classes/wp_rest_autosaves_controller/get_items_permissions_check) wp-includes/rest-api/endpoints/class-wp-rest-autosaves-controller.php | Checks if a given request has access to get autosaves. |
| [WP\_REST\_Autosaves\_Controller::create\_item\_permissions\_check()](../classes/wp_rest_autosaves_controller/create_item_permissions_check) wp-includes/rest-api/endpoints/class-wp-rest-autosaves-controller.php | Checks if a given request has access to create an autosave revision. |
| [WP\_REST\_Autosaves\_Controller::get\_item()](../classes/wp_rest_autosaves_controller/get_item) wp-includes/rest-api/endpoints/class-wp-rest-autosaves-controller.php | Get the autosave, if the ID is valid. |
| [WP\_REST\_Autosaves\_Controller::get\_item\_schema()](../classes/wp_rest_autosaves_controller/get_item_schema) wp-includes/rest-api/endpoints/class-wp-rest-autosaves-controller.php | Retrieves the autosave’s schema, conforming to JSON Schema. |
| [WP\_REST\_Autosaves\_Controller::create\_post\_autosave()](../classes/wp_rest_autosaves_controller/create_post_autosave) wp-includes/rest-api/endpoints/class-wp-rest-autosaves-controller.php | Creates autosave for the specified post. |
| [WP\_REST\_Block\_Renderer\_Controller::register\_routes()](../classes/wp_rest_block_renderer_controller/register_routes) wp-includes/rest-api/endpoints/class-wp-rest-block-renderer-controller.php | Registers the necessary REST API routes, one for each dynamic block. |
| [WP\_REST\_Block\_Renderer\_Controller::get\_item\_permissions\_check()](../classes/wp_rest_block_renderer_controller/get_item_permissions_check) wp-includes/rest-api/endpoints/class-wp-rest-block-renderer-controller.php | Checks if a given request has access to read blocks. |
| [WP\_REST\_Block\_Renderer\_Controller::get\_item()](../classes/wp_rest_block_renderer_controller/get_item) wp-includes/rest-api/endpoints/class-wp-rest-block-renderer-controller.php | Returns block output from block’s registered render\_callback. |
| [WP\_REST\_Block\_Renderer\_Controller::get\_item\_schema()](../classes/wp_rest_block_renderer_controller/get_item_schema) wp-includes/rest-api/endpoints/class-wp-rest-block-renderer-controller.php | Retrieves block’s output schema, conforming to JSON Schema. |
| [wp\_default\_packages\_vendor()](wp_default_packages_vendor) wp-includes/script-loader.php | Registers all the WordPress vendor scripts that are in the standardized `js/dist/vendor/` location. |
| [wp\_default\_packages\_inline\_scripts()](wp_default_packages_inline_scripts) wp-includes/script-loader.php | Adds inline scripts required for the WordPress JavaScript packages. |
| [WP\_Block\_Type\_Registry::register()](../classes/wp_block_type_registry/register) wp-includes/class-wp-block-type-registry.php | Registers a block type. |
| [WP\_Block\_Type\_Registry::unregister()](../classes/wp_block_type_registry/unregister) wp-includes/class-wp-block-type-registry.php | Unregisters a block type. |
| [do\_block\_editor\_incompatible\_meta\_box()](do_block_editor_incompatible_meta_box) wp-admin/includes/template.php | Renders a “fake” meta box with an information message, shown on the block editor, when an incompatible meta box is found. |
| [register\_and\_do\_post\_meta\_boxes()](register_and_do_post_meta_boxes) wp-admin/includes/meta-boxes.php | Registers the default post meta boxes, and runs the `do_meta_boxes` actions. |
| [WP\_REST\_Posts\_Controller::get\_schema\_links()](../classes/wp_rest_posts_controller/get_schema_links) wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php | Retrieves Link Description Objects that should be added to the Schema for the posts collection. |
| [WP\_REST\_Attachments\_Controller::check\_upload\_size()](../classes/wp_rest_attachments_controller/check_upload_size) wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php | Determine if uploaded file exceeds space quota on multisite. |
| [wp\_register\_comment\_personal\_data\_exporter()](wp_register_comment_personal_data_exporter) wp-includes/comment.php | Registers the personal data exporter for comments. |
| [wp\_comments\_personal\_data\_exporter()](wp_comments_personal_data_exporter) wp-includes/comment.php | Finds and exports personal data associated with an email address from the comments table. |
| [wp\_register\_comment\_personal\_data\_eraser()](wp_register_comment_personal_data_eraser) wp-includes/comment.php | Registers the personal data eraser for comments. |
| [wp\_comments\_personal\_data\_eraser()](wp_comments_personal_data_eraser) wp-includes/comment.php | Erases personal data associated with an email address from the comments table. |
| [wp\_privacy\_anonymize\_data()](wp_privacy_anonymize_data) wp-includes/functions.php | Returns uniform “anonymous” data by type. |
| [wp\_validate\_user\_request\_key()](wp_validate_user_request_key) wp-includes/user.php | Validates a user request by comparing the key with the request’s key. |
| [\_wp\_privacy\_send\_request\_confirmation\_notification()](_wp_privacy_send_request_confirmation_notification) wp-includes/user.php | Notifies the site administrator via email when a request is confirmed. |
| [\_wp\_privacy\_send\_erasure\_fulfillment\_notification()](_wp_privacy_send_erasure_fulfillment_notification) wp-includes/user.php | Notifies the user when their erasure request is fulfilled. |
| [\_wp\_privacy\_account\_request\_confirmed\_message()](_wp_privacy_account_request_confirmed_message) wp-includes/user.php | Returns request confirmation message HTML. |
| [wp\_create\_user\_request()](wp_create_user_request) wp-includes/user.php | Creates and logs a user request to perform a specific action. |
| [wp\_user\_request\_action\_description()](wp_user_request_action_description) wp-includes/user.php | Gets action description from the name and return a string. |
| [wp\_send\_user\_request()](wp_send_user_request) wp-includes/user.php | Send a confirmation request email to confirm an action. |
| [wp\_register\_user\_personal\_data\_exporter()](wp_register_user_personal_data_exporter) wp-includes/user.php | Registers the personal data exporter for users. |
| [wp\_user\_personal\_data\_exporter()](wp_user_personal_data_exporter) wp-includes/user.php | Finds and exports personal data associated with an email address from the user and user\_meta table. |
| [wp\_register\_media\_personal\_data\_exporter()](wp_register_media_personal_data_exporter) wp-includes/media.php | Registers the personal data exporter for media. |
| [wp\_media\_personal\_data\_exporter()](wp_media_personal_data_exporter) wp-includes/media.php | Finds and exports attachments associated with an email address. |
| [WP\_Privacy\_Policy\_Content::notice()](../classes/wp_privacy_policy_content/notice) wp-admin/includes/class-wp-privacy-policy-content.php | Add a notice with a link to the guide when editing the privacy policy page. |
| [WP\_Privacy\_Policy\_Content::privacy\_policy\_guide()](../classes/wp_privacy_policy_content/privacy_policy_guide) wp-admin/includes/class-wp-privacy-policy-content.php | Output the privacy policy guide together with content from the theme and plugins. |
| [WP\_Privacy\_Policy\_Content::get\_default\_content()](../classes/wp_privacy_policy_content/get_default_content) wp-admin/includes/class-wp-privacy-policy-content.php | Return the default suggested privacy policy content. |
| [WP\_Privacy\_Policy\_Content::add\_suggested\_content()](../classes/wp_privacy_policy_content/add_suggested_content) wp-admin/includes/class-wp-privacy-policy-content.php | Add the suggested privacy policy text to the policy postbox. |
| [WP\_Privacy\_Policy\_Content::policy\_text\_changed\_notice()](../classes/wp_privacy_policy_content/policy_text_changed_notice) wp-admin/includes/class-wp-privacy-policy-content.php | Output a warning when some privacy info has changed. |
| [\_wp\_privacy\_settings\_filter\_draft\_page\_titles()](_wp_privacy_settings_filter_draft_page_titles) wp-admin/includes/misc.php | Appends ‘(Draft)’ to draft page titles in the privacy page dropdown so that unpublished content is obvious. |
| [wp\_privacy\_process\_personal\_data\_export\_page()](wp_privacy_process_personal_data_export_page) wp-admin/includes/privacy-tools.php | Intercept personal data exporter page Ajax responses in order to assemble the personal data export file. |
| [wp\_privacy\_generate\_personal\_data\_export\_file()](wp_privacy_generate_personal_data_export_file) wp-admin/includes/privacy-tools.php | Generate the personal data export file. |
| [wp\_privacy\_send\_personal\_data\_export\_email()](wp_privacy_send_personal_data_export_email) wp-admin/includes/privacy-tools.php | Send an email to the user with a link to the personal data export file |
| [WP\_Privacy\_Requests\_Table::get\_timestamp\_as\_date()](../classes/wp_privacy_requests_table/get_timestamp_as_date) wp-admin/includes/class-wp-privacy-requests-table.php | Convert timestamp for display. |
| [WP\_Privacy\_Requests\_Table::get\_columns()](../classes/wp_privacy_requests_table/get_columns) wp-admin/includes/class-wp-privacy-requests-table.php | Get columns to show in the list table. |
| [WP\_Privacy\_Requests\_Table::get\_bulk\_actions()](../classes/wp_privacy_requests_table/get_bulk_actions) wp-admin/includes/class-wp-privacy-requests-table.php | Get bulk actions. |
| [wp\_privacy\_process\_personal\_data\_erasure\_page()](wp_privacy_process_personal_data_erasure_page) wp-admin/includes/privacy-tools.php | Mark erasure requests as completed after processing is finished. |
| [\_wp\_privacy\_resend\_request()](_wp_privacy_resend_request) wp-admin/includes/privacy-tools.php | Resend an existing request and return the result. |
| [\_wp\_privacy\_completed\_request()](_wp_privacy_completed_request) wp-admin/includes/privacy-tools.php | Marks a request as completed by the admin and logs the current timestamp. |
| [\_wp\_personal\_data\_handle\_actions()](_wp_personal_data_handle_actions) wp-admin/includes/privacy-tools.php | Handle list table actions. |
| [wp\_add\_privacy\_policy\_content()](wp_add_privacy_policy_content) wp-admin/includes/plugin.php | Declares a helper function for adding content to the Privacy Policy Guide. |
| [wp\_ajax\_wp\_privacy\_export\_personal\_data()](wp_ajax_wp_privacy_export_personal_data) wp-admin/includes/ajax-actions.php | Ajax handler for exporting a user’s personal data. |
| [wp\_ajax\_wp\_privacy\_erase\_personal\_data()](wp_ajax_wp_privacy_erase_personal_data) wp-admin/includes/ajax-actions.php | Ajax handler for erasing personal data. |
| [wp\_start\_scraping\_edited\_file\_errors()](wp_start_scraping_edited_file_errors) wp-includes/load.php | Start scraping edited file errors. |
| [wp\_unschedule\_hook()](wp_unschedule_hook) wp-includes/cron.php | Unschedules all events attached to the hook. |
| [WP\_Customize\_Manager::handle\_override\_changeset\_lock\_request()](../classes/wp_customize_manager/handle_override_changeset_lock_request) wp-includes/class-wp-customize-manager.php | Removes changeset lock when take over request is sent via Ajax. |
| [WP\_Customize\_Manager::handle\_changeset\_trash\_request()](../classes/wp_customize_manager/handle_changeset_trash_request) wp-includes/class-wp-customize-manager.php | Handles request to trash a changeset. |
| [WP\_REST\_Posts\_Controller::check\_template()](../classes/wp_rest_posts_controller/check_template) wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php | Checks whether the template is valid for the given post. |
| [wp\_is\_uuid()](wp_is_uuid) wp-includes/functions.php | Validates that a UUID is valid. |
| [wp\_site\_admin\_email\_change\_notification()](wp_site_admin_email_change_notification) wp-includes/functions.php | Sends an email to the old site admin email address when the site admin email address changes. |
| [WP\_Widget\_Media\_Gallery::render\_control\_template\_scripts()](../classes/wp_widget_media_gallery/render_control_template_scripts) wp-includes/widgets/class-wp-widget-media-gallery.php | Render form template scripts. |
| [WP\_Widget\_Media\_Gallery::\_\_construct()](../classes/wp_widget_media_gallery/__construct) wp-includes/widgets/class-wp-widget-media-gallery.php | Constructor. |
| [WP\_Widget\_Media\_Gallery::get\_instance\_schema()](../classes/wp_widget_media_gallery/get_instance_schema) wp-includes/widgets/class-wp-widget-media-gallery.php | Get schema for properties of a widget instance (item). |
| [WP\_Widget\_Custom\_HTML::add\_help\_text()](../classes/wp_widget_custom_html/add_help_text) wp-includes/widgets/class-wp-widget-custom-html.php | Add help text to widgets admin screen. |
| [WP\_Widget\_Custom\_HTML::\_\_construct()](../classes/wp_widget_custom_html/__construct) wp-includes/widgets/class-wp-widget-custom-html.php | Sets up a new Custom HTML widget instance. |
| [WP\_Customize\_Nav\_Menu\_Locations\_Control::content\_template()](../classes/wp_customize_nav_menu_locations_control/content_template) wp-includes/customize/class-wp-customize-nav-menu-locations-control.php | JS/Underscore template for the control UI. |
| [WP\_Customize\_Themes\_Panel::content\_template()](../classes/wp_customize_themes_panel/content_template) wp-includes/customize/class-wp-customize-themes-panel.php | An Underscore (JS) template for this panel’s content (but not its container). |
| [WP\_Customize\_Themes\_Panel::render\_template()](../classes/wp_customize_themes_panel/render_template) wp-includes/customize/class-wp-customize-themes-panel.php | An Underscore (JS) template for rendering this panel’s container. |
| [WP\_Customize\_Themes\_Section::render\_template()](../classes/wp_customize_themes_section/render_template) wp-includes/customize/class-wp-customize-themes-section.php | Render a themes section as a JS template. |
| [WP\_Customize\_Themes\_Section::filter\_bar\_content\_template()](../classes/wp_customize_themes_section/filter_bar_content_template) wp-includes/customize/class-wp-customize-themes-section.php | Render the filter bar portion of a themes section as a JS template. |
| [WP\_Customize\_Date\_Time\_Control::get\_month\_choices()](../classes/wp_customize_date_time_control/get_month_choices) wp-includes/customize/class-wp-customize-date-time-control.php | Generate options for the month Select. |
| [WP\_Customize\_Date\_Time\_Control::get\_timezone\_info()](../classes/wp_customize_date_time_control/get_timezone_info) wp-includes/customize/class-wp-customize-date-time-control.php | Get timezone info. |
| [WP\_Customize\_Media\_Control::get\_default\_button\_labels()](../classes/wp_customize_media_control/get_default_button_labels) wp-includes/customize/class-wp-customize-media-control.php | Get default button labels. |
| [update\_network\_option\_new\_admin\_email()](update_network_option_new_admin_email) wp-includes/ms-functions.php | Sends a confirmation request email when a change of network admin email address is attempted. |
| [wp\_network\_admin\_email\_change\_notification()](wp_network_admin_email_change_notification) wp-includes/ms-functions.php | Sends an email to the old network admin email address when the network admin email address changes. |
| [wp\_load\_press\_this()](wp_load_press_this) wp-admin/press-this.php | |
| [get\_site\_screen\_help\_tab\_args()](get_site_screen_help_tab_args) wp-admin/includes/ms.php | Returns the arguments for the help tab on the Edit Site screens. |
| [get\_site\_screen\_help\_sidebar\_content()](get_site_screen_help_sidebar_content) wp-admin/includes/ms.php | Returns the content for the help sidebar on the Edit Site screens. |
| [wp\_ajax\_edit\_theme\_plugin\_file()](wp_ajax_edit_theme_plugin_file) wp-admin/includes/ajax-actions.php | Ajax handler for editing a theme or plugin file. |
| [wp\_print\_file\_editor\_templates()](wp_print_file_editor_templates) wp-admin/includes/file.php | Prints file editor templates (for plugins and themes). |
| [wp\_edit\_theme\_plugin\_file()](wp_edit_theme_plugin_file) wp-admin/includes/file.php | Attempts to edit a file for a theme or plugin. |
| [WP\_REST\_Users\_Controller::get\_user()](../classes/wp_rest_users_controller/get_user) wp-includes/rest-api/endpoints/class-wp-rest-users-controller.php | Get the user, if the ID is valid. |
| [WP\_REST\_Revisions\_Controller::get\_revision()](../classes/wp_rest_revisions_controller/get_revision) wp-includes/rest-api/endpoints/class-wp-rest-revisions-controller.php | Get the revision, if the ID is valid. |
| [WP\_REST\_Revisions\_Controller::get\_parent()](../classes/wp_rest_revisions_controller/get_parent) wp-includes/rest-api/endpoints/class-wp-rest-revisions-controller.php | Get the parent post, if the ID is valid. |
| [WP\_REST\_Terms\_Controller::get\_term()](../classes/wp_rest_terms_controller/get_term) wp-includes/rest-api/endpoints/class-wp-rest-terms-controller.php | Get the term, if the ID is valid. |
| [WP\_REST\_Posts\_Controller::get\_post()](../classes/wp_rest_posts_controller/get_post) wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php | Gets the post, if the ID is valid. |
| [WP\_REST\_Comments\_Controller::get\_comment()](../classes/wp_rest_comments_controller/get_comment) wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php | Get the comment, if the ID is valid. |
| [WP\_oEmbed\_Controller::get\_proxy\_item\_permissions\_check()](../classes/wp_oembed_controller/get_proxy_item_permissions_check) wp-includes/class-wp-oembed-controller.php | Checks if current user can make a proxy oEmbed request. |
| [WP\_oEmbed\_Controller::get\_proxy\_item()](../classes/wp_oembed_controller/get_proxy_item) wp-includes/class-wp-oembed-controller.php | Callback for the proxy API endpoint. |
| [WP\_Http::validate\_redirects()](../classes/wp_http/validate_redirects) wp-includes/class-wp-http.php | Validate redirected URLs. |
| [WP\_Widget\_Media\_Audio::\_\_construct()](../classes/wp_widget_media_audio/__construct) wp-includes/widgets/class-wp-widget-media-audio.php | Constructor. |
| [WP\_Widget\_Media\_Audio::get\_instance\_schema()](../classes/wp_widget_media_audio/get_instance_schema) wp-includes/widgets/class-wp-widget-media-audio.php | Get schema for properties of a widget instance (item). |
| [WP\_Widget\_Media\_Video::\_\_construct()](../classes/wp_widget_media_video/__construct) wp-includes/widgets/class-wp-widget-media-video.php | Constructor. |
| [WP\_Widget\_Media\_Video::get\_instance\_schema()](../classes/wp_widget_media_video/get_instance_schema) wp-includes/widgets/class-wp-widget-media-video.php | Get schema for properties of a widget instance (item). |
| [WP\_Widget\_Media::get\_instance\_schema()](../classes/wp_widget_media/get_instance_schema) wp-includes/widgets/class-wp-widget-media.php | Get schema for properties of a widget instance (item). |
| [WP\_Widget\_Media\_Image::get\_instance\_schema()](../classes/wp_widget_media_image/get_instance_schema) wp-includes/widgets/class-wp-widget-media-image.php | Get schema for properties of a widget instance (item). |
| [WP\_Widget\_Media\_Image::render\_control\_template\_scripts()](../classes/wp_widget_media_image/render_control_template_scripts) wp-includes/widgets/class-wp-widget-media-image.php | Render form template scripts. |
| [WP\_Widget\_Media\_Image::\_\_construct()](../classes/wp_widget_media_image/__construct) wp-includes/widgets/class-wp-widget-media-image.php | Constructor. |
| [wp\_print\_community\_events\_markup()](wp_print_community_events_markup) wp-admin/includes/dashboard.php | Prints the markup for the Community Events section of the Events and News Dashboard widget. |
| [wp\_print\_community\_events\_templates()](wp_print_community_events_templates) wp-admin/includes/dashboard.php | Renders the events templates for the Event and News widget. |
| [wp\_dashboard\_events\_news()](wp_dashboard_events_news) wp-admin/includes/dashboard.php | Renders the Events and News dashboard widget. |
| [WP\_Community\_Events::format\_event\_data\_time()](../classes/wp_community_events/format_event_data_time) wp-admin/includes/class-wp-community-events.php | Adds formatted date and time items for each event in an API response. |
| [WP\_Community\_Events::get\_events()](../classes/wp_community_events/get_events) wp-admin/includes/class-wp-community-events.php | Gets data about events near a particular location. |
| [rest\_sanitize\_value\_from\_schema()](rest_sanitize_value_from_schema) wp-includes/rest-api.php | Sanitize a value based on a schema. |
| [rest\_validate\_value\_from\_schema()](rest_validate_value_from_schema) wp-includes/rest-api.php | Validate a value based on a schema. |
| [WP\_Customize\_Manager::\_sanitize\_background\_setting()](../classes/wp_customize_manager/_sanitize_background_setting) wp-includes/class-wp-customize-manager.php | Callback for validating a background setting value. |
| [WP\_Customize\_Manager::\_validate\_header\_video()](../classes/wp_customize_manager/_validate_header_video) wp-includes/class-wp-customize-manager.php | Callback for validating the header\_video value. |
| [WP\_Customize\_Manager::\_validate\_external\_header\_video()](../classes/wp_customize_manager/_validate_external_header_video) wp-includes/class-wp-customize-manager.php | Callback for validating the external\_header\_video value. |
| [WP\_Customize\_Manager::save\_changeset\_post()](../classes/wp_customize_manager/save_changeset_post) wp-includes/class-wp-customize-manager.php | Saves the post for the loaded changeset. |
| [get\_header\_video\_settings()](get_header_video_settings) wp-includes/theme.php | Retrieves header video settings. |
| [\_WP\_Editors::get\_translation()](../classes/_wp_editors/get_translation) wp-includes/class-wp-editor.php | |
| [WP\_REST\_Meta\_Fields::delete\_meta\_value()](../classes/wp_rest_meta_fields/delete_meta_value) wp-includes/rest-api/fields/class-wp-rest-meta-fields.php | Deletes a meta value for an object. |
| [WP\_REST\_Meta\_Fields::update\_multi\_meta\_value()](../classes/wp_rest_meta_fields/update_multi_meta_value) wp-includes/rest-api/fields/class-wp-rest-meta-fields.php | Updates multiple meta values for an object. |
| [WP\_REST\_Meta\_Fields::update\_meta\_value()](../classes/wp_rest_meta_fields/update_meta_value) wp-includes/rest-api/fields/class-wp-rest-meta-fields.php | Updates a meta value for an object. |
| [WP\_REST\_Meta\_Fields::get\_field\_schema()](../classes/wp_rest_meta_fields/get_field_schema) wp-includes/rest-api/fields/class-wp-rest-meta-fields.php | Retrieves the object’s meta schema, conforming to JSON Schema. |
| [WP\_REST\_Meta\_Fields::update\_value()](../classes/wp_rest_meta_fields/update_value) wp-includes/rest-api/fields/class-wp-rest-meta-fields.php | Updates meta values. |
| [WP\_REST\_Users\_Controller::check\_username()](../classes/wp_rest_users_controller/check_username) wp-includes/rest-api/endpoints/class-wp-rest-users-controller.php | Check a username for the REST API. |
| [WP\_REST\_Users\_Controller::check\_user\_password()](../classes/wp_rest_users_controller/check_user_password) wp-includes/rest-api/endpoints/class-wp-rest-users-controller.php | Check a user password for the REST API. |
| [WP\_REST\_Users\_Controller::get\_item\_schema()](../classes/wp_rest_users_controller/get_item_schema) wp-includes/rest-api/endpoints/class-wp-rest-users-controller.php | Retrieves the user’s schema, conforming to JSON Schema. |
| [WP\_REST\_Users\_Controller::get\_collection\_params()](../classes/wp_rest_users_controller/get_collection_params) wp-includes/rest-api/endpoints/class-wp-rest-users-controller.php | Retrieves the query params for collections. |
| [WP\_REST\_Users\_Controller::check\_role\_update()](../classes/wp_rest_users_controller/check_role_update) wp-includes/rest-api/endpoints/class-wp-rest-users-controller.php | Determines if the current user is allowed to make the desired roles change. |
| [WP\_REST\_Users\_Controller::delete\_item\_permissions\_check()](../classes/wp_rest_users_controller/delete_item_permissions_check) wp-includes/rest-api/endpoints/class-wp-rest-users-controller.php | Checks if a given request has access delete a user. |
| [WP\_REST\_Users\_Controller::delete\_item()](../classes/wp_rest_users_controller/delete_item) wp-includes/rest-api/endpoints/class-wp-rest-users-controller.php | Deletes a single user. |
| [WP\_REST\_Users\_Controller::get\_current\_item()](../classes/wp_rest_users_controller/get_current_item) wp-includes/rest-api/endpoints/class-wp-rest-users-controller.php | Retrieves the current user. |
| [WP\_REST\_Users\_Controller::create\_item\_permissions\_check()](../classes/wp_rest_users_controller/create_item_permissions_check) wp-includes/rest-api/endpoints/class-wp-rest-users-controller.php | Checks if a given request has access create users. |
| [WP\_REST\_Users\_Controller::create\_item()](../classes/wp_rest_users_controller/create_item) wp-includes/rest-api/endpoints/class-wp-rest-users-controller.php | Creates a single user. |
| [WP\_REST\_Users\_Controller::update\_item\_permissions\_check()](../classes/wp_rest_users_controller/update_item_permissions_check) wp-includes/rest-api/endpoints/class-wp-rest-users-controller.php | Checks if a given request has access to update a user. |
| [WP\_REST\_Users\_Controller::update\_item()](../classes/wp_rest_users_controller/update_item) wp-includes/rest-api/endpoints/class-wp-rest-users-controller.php | Updates a single user. |
| [WP\_REST\_Users\_Controller::register\_routes()](../classes/wp_rest_users_controller/register_routes) wp-includes/rest-api/endpoints/class-wp-rest-users-controller.php | Registers the routes for users. |
| [WP\_REST\_Users\_Controller::check\_reassign()](../classes/wp_rest_users_controller/check_reassign) wp-includes/rest-api/endpoints/class-wp-rest-users-controller.php | Checks for a valid value for the reassign parameter when deleting users. |
| [WP\_REST\_Users\_Controller::get\_items\_permissions\_check()](../classes/wp_rest_users_controller/get_items_permissions_check) wp-includes/rest-api/endpoints/class-wp-rest-users-controller.php | Permissions check for getting all users. |
| [WP\_REST\_Users\_Controller::get\_item\_permissions\_check()](../classes/wp_rest_users_controller/get_item_permissions_check) wp-includes/rest-api/endpoints/class-wp-rest-users-controller.php | Checks if a given request has access to read a user. |
| [WP\_REST\_Revisions\_Controller::get\_item\_schema()](../classes/wp_rest_revisions_controller/get_item_schema) wp-includes/rest-api/endpoints/class-wp-rest-revisions-controller.php | Retrieves the revision’s schema, conforming to JSON Schema. |
| [WP\_REST\_Revisions\_Controller::get\_collection\_params()](../classes/wp_rest_revisions_controller/get_collection_params) wp-includes/rest-api/endpoints/class-wp-rest-revisions-controller.php | Retrieves the query params for collections. |
| [WP\_REST\_Revisions\_Controller::delete\_item\_permissions\_check()](../classes/wp_rest_revisions_controller/delete_item_permissions_check) wp-includes/rest-api/endpoints/class-wp-rest-revisions-controller.php | Checks if a given request has access to delete a revision. |
| [WP\_REST\_Revisions\_Controller::delete\_item()](../classes/wp_rest_revisions_controller/delete_item) wp-includes/rest-api/endpoints/class-wp-rest-revisions-controller.php | Deletes a single revision. |
| [WP\_REST\_Attachments\_Controller::upload\_from\_file()](../classes/wp_rest_attachments_controller/upload_from_file) wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php | Handles an upload via multipart/form-data ($\_FILES). |
| [WP\_REST\_Revisions\_Controller::register\_routes()](../classes/wp_rest_revisions_controller/register_routes) wp-includes/rest-api/endpoints/class-wp-rest-revisions-controller.php | Registers the routes for revisions based on post types supporting revisions. |
| [WP\_REST\_Revisions\_Controller::get\_items\_permissions\_check()](../classes/wp_rest_revisions_controller/get_items_permissions_check) wp-includes/rest-api/endpoints/class-wp-rest-revisions-controller.php | Checks if a given request has access to get revisions. |
| [WP\_REST\_Revisions\_Controller::get\_items()](../classes/wp_rest_revisions_controller/get_items) wp-includes/rest-api/endpoints/class-wp-rest-revisions-controller.php | Gets a collection of revisions. |
| [WP\_REST\_Attachments\_Controller::get\_item\_schema()](../classes/wp_rest_attachments_controller/get_item_schema) wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php | Retrieves the attachment’s schema, conforming to JSON Schema. |
| [WP\_REST\_Attachments\_Controller::upload\_from\_data()](../classes/wp_rest_attachments_controller/upload_from_data) wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php | Handles an upload via raw POST data. |
| [WP\_REST\_Attachments\_Controller::get\_collection\_params()](../classes/wp_rest_attachments_controller/get_collection_params) wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php | Retrieves the query params for collections of attachments. |
| [WP\_REST\_Attachments\_Controller::create\_item()](../classes/wp_rest_attachments_controller/create_item) wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php | Creates a single attachment. |
| [WP\_REST\_Attachments\_Controller::update\_item()](../classes/wp_rest_attachments_controller/update_item) wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php | Updates a single attachment. |
| [WP\_REST\_Attachments\_Controller::create\_item\_permissions\_check()](../classes/wp_rest_attachments_controller/create_item_permissions_check) wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php | Checks if a given request has access to create an attachment. |
| [WP\_REST\_Post\_Statuses\_Controller::get\_item\_permissions\_check()](../classes/wp_rest_post_statuses_controller/get_item_permissions_check) wp-includes/rest-api/endpoints/class-wp-rest-post-statuses-controller.php | Checks if a given request has access to read a post status. |
| [WP\_REST\_Post\_Statuses\_Controller::get\_item()](../classes/wp_rest_post_statuses_controller/get_item) wp-includes/rest-api/endpoints/class-wp-rest-post-statuses-controller.php | Retrieves a specific post status. |
| [WP\_REST\_Post\_Statuses\_Controller::get\_item\_schema()](../classes/wp_rest_post_statuses_controller/get_item_schema) wp-includes/rest-api/endpoints/class-wp-rest-post-statuses-controller.php | Retrieves the post status’ schema, conforming to JSON Schema. |
| [WP\_REST\_Post\_Statuses\_Controller::register\_routes()](../classes/wp_rest_post_statuses_controller/register_routes) wp-includes/rest-api/endpoints/class-wp-rest-post-statuses-controller.php | Registers the routes for post statuses. |
| [WP\_REST\_Post\_Statuses\_Controller::get\_items\_permissions\_check()](../classes/wp_rest_post_statuses_controller/get_items_permissions_check) wp-includes/rest-api/endpoints/class-wp-rest-post-statuses-controller.php | Checks whether a given request has permission to read post statuses. |
| [WP\_REST\_Settings\_Controller::update\_item()](../classes/wp_rest_settings_controller/update_item) wp-includes/rest-api/endpoints/class-wp-rest-settings-controller.php | Updates settings for the settings object. |
| [WP\_REST\_Terms\_Controller::get\_item\_schema()](../classes/wp_rest_terms_controller/get_item_schema) wp-includes/rest-api/endpoints/class-wp-rest-terms-controller.php | Retrieves the term’s schema, conforming to JSON Schema. |
| [WP\_REST\_Terms\_Controller::get\_collection\_params()](../classes/wp_rest_terms_controller/get_collection_params) wp-includes/rest-api/endpoints/class-wp-rest-terms-controller.php | Retrieves the query params for collections. |
| [WP\_REST\_Terms\_Controller::delete\_item()](../classes/wp_rest_terms_controller/delete_item) wp-includes/rest-api/endpoints/class-wp-rest-terms-controller.php | Deletes a single term from a taxonomy. |
| [WP\_REST\_Terms\_Controller::create\_item\_permissions\_check()](../classes/wp_rest_terms_controller/create_item_permissions_check) wp-includes/rest-api/endpoints/class-wp-rest-terms-controller.php | Checks if a request has access to create a term. |
| [WP\_REST\_Terms\_Controller::create\_item()](../classes/wp_rest_terms_controller/create_item) wp-includes/rest-api/endpoints/class-wp-rest-terms-controller.php | Creates a single term in a taxonomy. |
| [WP\_REST\_Terms\_Controller::update\_item\_permissions\_check()](../classes/wp_rest_terms_controller/update_item_permissions_check) wp-includes/rest-api/endpoints/class-wp-rest-terms-controller.php | Checks if a request has access to update the specified term. |
| [WP\_REST\_Terms\_Controller::update\_item()](../classes/wp_rest_terms_controller/update_item) wp-includes/rest-api/endpoints/class-wp-rest-terms-controller.php | Updates a single term from a taxonomy. |
| [WP\_REST\_Terms\_Controller::delete\_item\_permissions\_check()](../classes/wp_rest_terms_controller/delete_item_permissions_check) wp-includes/rest-api/endpoints/class-wp-rest-terms-controller.php | Checks if a request has access to delete the specified term. |
| [WP\_REST\_Terms\_Controller::register\_routes()](../classes/wp_rest_terms_controller/register_routes) wp-includes/rest-api/endpoints/class-wp-rest-terms-controller.php | Registers the routes for terms. |
| [WP\_REST\_Terms\_Controller::get\_items\_permissions\_check()](../classes/wp_rest_terms_controller/get_items_permissions_check) wp-includes/rest-api/endpoints/class-wp-rest-terms-controller.php | Checks if a request has access to read terms in the specified taxonomy. |
| [WP\_REST\_Terms\_Controller::get\_item\_permissions\_check()](../classes/wp_rest_terms_controller/get_item_permissions_check) wp-includes/rest-api/endpoints/class-wp-rest-terms-controller.php | Checks if a request has access to read or edit the specified term. |
| [WP\_REST\_Posts\_Controller::get\_item\_schema()](../classes/wp_rest_posts_controller/get_item_schema) wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php | Retrieves the post’s schema, conforming to JSON Schema. |
| [WP\_REST\_Posts\_Controller::get\_collection\_params()](../classes/wp_rest_posts_controller/get_collection_params) wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php | Retrieves the query params for the posts collection. |
| [WP\_REST\_Posts\_Controller::sanitize\_post\_statuses()](../classes/wp_rest_posts_controller/sanitize_post_statuses) wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php | Sanitizes and validates the list of post statuses, including whether the user can query private statuses. |
| [WP\_REST\_Posts\_Controller::handle\_status\_param()](../classes/wp_rest_posts_controller/handle_status_param) wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php | Determines validity and normalizes the given status parameter. |
| [WP\_REST\_Posts\_Controller::handle\_featured\_media()](../classes/wp_rest_posts_controller/handle_featured_media) wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php | Determines the featured media based on a request param. |
| [WP\_REST\_Posts\_Controller::prepare\_item\_for\_database()](../classes/wp_rest_posts_controller/prepare_item_for_database) wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php | Prepares a single post for create or update. |
| [WP\_REST\_Posts\_Controller::create\_item()](../classes/wp_rest_posts_controller/create_item) wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php | Creates a single post. |
| [WP\_REST\_Posts\_Controller::update\_item\_permissions\_check()](../classes/wp_rest_posts_controller/update_item_permissions_check) wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php | Checks if a given request has access to update a post. |
| [WP\_REST\_Posts\_Controller::delete\_item\_permissions\_check()](../classes/wp_rest_posts_controller/delete_item_permissions_check) wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php | Checks if a given request has access to delete a post. |
| [WP\_REST\_Posts\_Controller::delete\_item()](../classes/wp_rest_posts_controller/delete_item) wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php | Deletes a single post. |
| [WP\_REST\_Posts\_Controller::get\_item\_permissions\_check()](../classes/wp_rest_posts_controller/get_item_permissions_check) wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php | Checks if a given request has access to read a post. |
| [WP\_REST\_Posts\_Controller::create\_item\_permissions\_check()](../classes/wp_rest_posts_controller/create_item_permissions_check) wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php | Checks if a given request has access to create a post. |
| [WP\_REST\_Posts\_Controller::register\_routes()](../classes/wp_rest_posts_controller/register_routes) wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php | Registers the routes for posts. |
| [WP\_REST\_Posts\_Controller::get\_items\_permissions\_check()](../classes/wp_rest_posts_controller/get_items_permissions_check) wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php | Checks if a given request has access to read posts. |
| [WP\_REST\_Posts\_Controller::get\_items()](../classes/wp_rest_posts_controller/get_items) wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php | Retrieves a collection of posts. |
| [WP\_REST\_Taxonomies\_Controller::get\_item\_permissions\_check()](../classes/wp_rest_taxonomies_controller/get_item_permissions_check) wp-includes/rest-api/endpoints/class-wp-rest-taxonomies-controller.php | Checks if a given request has access to a taxonomy. |
| [WP\_REST\_Taxonomies\_Controller::get\_item()](../classes/wp_rest_taxonomies_controller/get_item) wp-includes/rest-api/endpoints/class-wp-rest-taxonomies-controller.php | Retrieves a specific taxonomy. |
| [WP\_REST\_Taxonomies\_Controller::get\_item\_schema()](../classes/wp_rest_taxonomies_controller/get_item_schema) wp-includes/rest-api/endpoints/class-wp-rest-taxonomies-controller.php | Retrieves the taxonomy’s schema, conforming to JSON Schema. |
| [WP\_REST\_Taxonomies\_Controller::get\_collection\_params()](../classes/wp_rest_taxonomies_controller/get_collection_params) wp-includes/rest-api/endpoints/class-wp-rest-taxonomies-controller.php | Retrieves the query params for collections. |
| [WP\_REST\_Taxonomies\_Controller::register\_routes()](../classes/wp_rest_taxonomies_controller/register_routes) wp-includes/rest-api/endpoints/class-wp-rest-taxonomies-controller.php | Registers the routes for taxonomies. |
| [WP\_REST\_Taxonomies\_Controller::get\_items\_permissions\_check()](../classes/wp_rest_taxonomies_controller/get_items_permissions_check) wp-includes/rest-api/endpoints/class-wp-rest-taxonomies-controller.php | Checks whether a given request has permission to read taxonomies. |
| [WP\_REST\_Post\_Types\_Controller::register\_routes()](../classes/wp_rest_post_types_controller/register_routes) wp-includes/rest-api/endpoints/class-wp-rest-post-types-controller.php | Registers the routes for post types. |
| [WP\_REST\_Post\_Types\_Controller::get\_items\_permissions\_check()](../classes/wp_rest_post_types_controller/get_items_permissions_check) wp-includes/rest-api/endpoints/class-wp-rest-post-types-controller.php | Checks whether a given request has permission to read types. |
| [WP\_REST\_Post\_Types\_Controller::get\_item()](../classes/wp_rest_post_types_controller/get_item) wp-includes/rest-api/endpoints/class-wp-rest-post-types-controller.php | Retrieves a specific post type. |
| [WP\_REST\_Post\_Types\_Controller::get\_item\_schema()](../classes/wp_rest_post_types_controller/get_item_schema) wp-includes/rest-api/endpoints/class-wp-rest-post-types-controller.php | Retrieves the post type’s schema, conforming to JSON Schema. |
| [WP\_REST\_Controller::get\_collection\_params()](../classes/wp_rest_controller/get_collection_params) wp-includes/rest-api/endpoints/class-wp-rest-controller.php | Retrieves the query params for the collections. |
| [WP\_REST\_Controller::get\_context\_param()](../classes/wp_rest_controller/get_context_param) wp-includes/rest-api/endpoints/class-wp-rest-controller.php | Retrieves the magical context param. |
| [WP\_REST\_Controller::delete\_item()](../classes/wp_rest_controller/delete_item) wp-includes/rest-api/endpoints/class-wp-rest-controller.php | Deletes one item from the collection. |
| [WP\_REST\_Controller::prepare\_item\_for\_database()](../classes/wp_rest_controller/prepare_item_for_database) wp-includes/rest-api/endpoints/class-wp-rest-controller.php | Prepares one item for create or update operation. |
| [WP\_REST\_Controller::prepare\_item\_for\_response()](../classes/wp_rest_controller/prepare_item_for_response) wp-includes/rest-api/endpoints/class-wp-rest-controller.php | Prepares the item for the REST response. |
| [WP\_REST\_Controller::delete\_item\_permissions\_check()](../classes/wp_rest_controller/delete_item_permissions_check) wp-includes/rest-api/endpoints/class-wp-rest-controller.php | Checks if a given request has access to delete a specific item. |
| [WP\_REST\_Controller::get\_item()](../classes/wp_rest_controller/get_item) wp-includes/rest-api/endpoints/class-wp-rest-controller.php | Retrieves one item from the collection. |
| [WP\_REST\_Controller::create\_item\_permissions\_check()](../classes/wp_rest_controller/create_item_permissions_check) wp-includes/rest-api/endpoints/class-wp-rest-controller.php | Checks if a given request has access to create items. |
| [WP\_REST\_Controller::create\_item()](../classes/wp_rest_controller/create_item) wp-includes/rest-api/endpoints/class-wp-rest-controller.php | Creates one item from the collection. |
| [WP\_REST\_Controller::update\_item\_permissions\_check()](../classes/wp_rest_controller/update_item_permissions_check) wp-includes/rest-api/endpoints/class-wp-rest-controller.php | Checks if a given request has access to update a specific item. |
| [WP\_REST\_Controller::update\_item()](../classes/wp_rest_controller/update_item) wp-includes/rest-api/endpoints/class-wp-rest-controller.php | Updates one item from the collection. |
| [WP\_REST\_Controller::register\_routes()](../classes/wp_rest_controller/register_routes) wp-includes/rest-api/endpoints/class-wp-rest-controller.php | Registers the routes for the objects of the controller. |
| [WP\_REST\_Controller::get\_items\_permissions\_check()](../classes/wp_rest_controller/get_items_permissions_check) wp-includes/rest-api/endpoints/class-wp-rest-controller.php | Checks if a given request has access to get items. |
| [WP\_REST\_Controller::get\_items()](../classes/wp_rest_controller/get_items) wp-includes/rest-api/endpoints/class-wp-rest-controller.php | Retrieves a collection of items. |
| [WP\_REST\_Controller::get\_item\_permissions\_check()](../classes/wp_rest_controller/get_item_permissions_check) wp-includes/rest-api/endpoints/class-wp-rest-controller.php | Checks if a given request has access to get a specific item. |
| [WP\_REST\_Comments\_Controller::get\_item\_schema()](../classes/wp_rest_comments_controller/get_item_schema) wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php | Retrieves the comment’s schema, conforming to JSON Schema. |
| [WP\_REST\_Comments\_Controller::get\_collection\_params()](../classes/wp_rest_comments_controller/get_collection_params) wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php | Retrieves the query params for collections. |
| [WP\_REST\_Comments\_Controller::prepare\_item\_for\_database()](../classes/wp_rest_comments_controller/prepare_item_for_database) wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php | Prepares a single comment to be inserted into the database. |
| [WP\_REST\_Comments\_Controller::update\_item\_permissions\_check()](../classes/wp_rest_comments_controller/update_item_permissions_check) wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php | Checks if a given REST request has access to update a comment. |
| [WP\_REST\_Comments\_Controller::update\_item()](../classes/wp_rest_comments_controller/update_item) wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php | Updates a comment. |
| [WP\_REST\_Comments\_Controller::delete\_item\_permissions\_check()](../classes/wp_rest_comments_controller/delete_item_permissions_check) wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php | Checks if a given request has access to delete a comment. |
| [WP\_REST\_Comments\_Controller::delete\_item()](../classes/wp_rest_comments_controller/delete_item) wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php | Deletes a comment. |
| [WP\_REST\_Comments\_Controller::get\_item\_permissions\_check()](../classes/wp_rest_comments_controller/get_item_permissions_check) wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php | Checks if a given request has access to read the comment. |
| [WP\_REST\_Comments\_Controller::create\_item\_permissions\_check()](../classes/wp_rest_comments_controller/create_item_permissions_check) wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php | Checks if a given request has access to create a comment. |
| [WP\_REST\_Comments\_Controller::create\_item()](../classes/wp_rest_comments_controller/create_item) wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php | Creates a comment. |
| [WP\_REST\_Comments\_Controller::register\_routes()](../classes/wp_rest_comments_controller/register_routes) wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php | Registers the routes for comments. |
| [WP\_REST\_Comments\_Controller::get\_items\_permissions\_check()](../classes/wp_rest_comments_controller/get_items_permissions_check) wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php | Checks if a given request has access to read comments. |
| [wp\_check\_comment\_data\_max\_lengths()](wp_check_comment_data_max_lengths) wp-includes/comment.php | Compares the lengths of comment data against the maximum character limits. |
| [wp\_check\_comment\_flood()](wp_check_comment_flood) wp-includes/comment.php | Checks whether comment flooding is occurring. |
| [WP\_Customize\_Nav\_Menus::print\_post\_type\_container()](../classes/wp_customize_nav_menus/print_post_type_container) wp-includes/class-wp-customize-nav-menus.php | Prints the markup for new menu items. |
| [WP\_Customize\_Nav\_Menus::insert\_auto\_draft\_post()](../classes/wp_customize_nav_menus/insert_auto_draft_post) wp-includes/class-wp-customize-nav-menus.php | Adds a new `auto-draft` post. |
| [WP\_Customize\_Nav\_Menus::ajax\_insert\_auto\_draft\_post()](../classes/wp_customize_nav_menus/ajax_insert_auto_draft_post) wp-includes/class-wp-customize-nav-menus.php | Ajax handler for adding a new auto-draft post. |
| [WP\_Customize\_Background\_Position\_Control::content\_template()](../classes/wp_customize_background_position_control/content_template) wp-includes/customize/class-wp-customize-background-position-control.php | Render a JS template for the content of the position control. |
| [WP\_Customize\_Custom\_CSS\_Setting::validate()](../classes/wp_customize_custom_css_setting/validate) wp-includes/customize/class-wp-customize-custom-css-setting.php | Validate a received value for being valid CSS. |
| [WP\_Customize\_Nav\_Menu\_Item\_Setting::get\_original\_title()](../classes/wp_customize_nav_menu_item_setting/get_original_title) wp-includes/customize/class-wp-customize-nav-menu-item-setting.php | Get original title. |
| [WP\_Customize\_Nav\_Menu\_Item\_Setting::get\_type\_label()](../classes/wp_customize_nav_menu_item_setting/get_type_label) wp-includes/customize/class-wp-customize-nav-menu-item-setting.php | Get type label. |
| [register\_initial\_settings()](register_initial_settings) wp-includes/option.php | Registers default settings available in WordPress. |
| [WP\_Customize\_Manager::validate\_setting\_values()](../classes/wp_customize_manager/validate_setting_values) wp-includes/class-wp-customize-manager.php | Validates setting values. |
| [WP\_Customize\_Setting::validate()](../classes/wp_customize_setting/validate) wp-includes/class-wp-customize-setting.php | Validates an input. |
| [wp\_localize\_jquery\_ui\_datepicker()](wp_localize_jquery_ui_datepicker) wp-includes/script-loader.php | Localizes the jQuery UI datepicker. |
| [\_deprecated\_hook()](_deprecated_hook) wp-includes/functions.php | Marks a deprecated action or filter hook as deprecated and throws a notice. |
| [wp\_print\_admin\_notice\_templates()](wp_print_admin_notice_templates) wp-admin/includes/update.php | Prints the JavaScript templates for update admin notices. |
| [network\_edit\_site\_nav()](network_edit_site_nav) wp-admin/includes/ms.php | Outputs the HTML for a network’s “Edit Site” tabular interface. |
| [wp\_ajax\_search\_install\_plugins()](wp_ajax_search_install_plugins) wp-admin/includes/ajax-actions.php | Ajax handler for searching plugins to install. |
| [wp\_ajax\_delete\_plugin()](wp_ajax_delete_plugin) wp-admin/includes/ajax-actions.php | Ajax handler for deleting a plugin. |
| [wp\_ajax\_search\_plugins()](wp_ajax_search_plugins) wp-admin/includes/ajax-actions.php | Ajax handler for searching plugins. |
| [wp\_ajax\_install\_theme()](wp_ajax_install_theme) wp-admin/includes/ajax-actions.php | Ajax handler for installing a theme. |
| [wp\_ajax\_update\_theme()](wp_ajax_update_theme) wp-admin/includes/ajax-actions.php | Ajax handler for updating a theme. |
| [wp\_ajax\_delete\_theme()](wp_ajax_delete_theme) wp-admin/includes/ajax-actions.php | Ajax handler for deleting a theme. |
| [wp\_ajax\_install\_plugin()](wp_ajax_install_plugin) wp-admin/includes/ajax-actions.php | Ajax handler for installing a plugin. |
| [WP\_Metadata\_Lazyloader::reset\_queue()](../classes/wp_metadata_lazyloader/reset_queue) wp-includes/class-wp-metadata-lazyloader.php | Resets lazy-load queue for a given object type. |
| [WP\_Metadata\_Lazyloader::queue\_objects()](../classes/wp_metadata_lazyloader/queue_objects) wp-includes/class-wp-metadata-lazyloader.php | Adds objects to the metadata lazy-load queue. |
| [WP\_Customize\_Manager::get\_previewable\_devices()](../classes/wp_customize_manager/get_previewable_devices) wp-includes/class-wp-customize-manager.php | Returns a list of devices to allow previewing. |
| [WP\_Image\_Editor\_Imagick::strip\_meta()](../classes/wp_image_editor_imagick/strip_meta) wp-includes/class-wp-image-editor-imagick.php | Strips all image meta except color profiles from an image. |
| [unregister\_taxonomy()](unregister_taxonomy) wp-includes/taxonomy.php | Unregisters a taxonomy. |
| [wp\_authenticate\_email\_password()](wp_authenticate_email_password) wp-includes/user.php | Authenticates a user using the email and password. |
| [wp\_add\_inline\_script()](wp_add_inline_script) wp-includes/functions.wp-scripts.php | Adds extra code to a registered script. |
| [unregister\_post\_type()](unregister_post_type) wp-includes/post.php | Unregisters a post type. |
| [WP\_Customize\_Partial::render()](../classes/wp_customize_partial/render) wp-includes/customize/class-wp-customize-partial.php | Renders the template partial involving the associated settings. |
| [WP\_Customize\_Selective\_Refresh::export\_preview\_data()](../classes/wp_customize_selective_refresh/export_preview_data) wp-includes/customize/class-wp-customize-selective-refresh.php | Exports data in preview after it has finished rendering so that partials can be added at runtime. |
| [WP\_User::\_\_unset()](../classes/wp_user/__unset) wp-includes/class-wp-user.php | Magic method for unsetting a certain custom field. |
| [rest\_cookie\_check\_errors()](rest_cookie_check_errors) wp-includes/rest-api.php | Checks for errors when using cookie-based authentication. |
| [rest\_handle\_deprecated\_function()](rest_handle_deprecated_function) wp-includes/rest-api.php | Handles [\_deprecated\_function()](_deprecated_function) errors. |
| [rest\_handle\_deprecated\_argument()](rest_handle_deprecated_argument) wp-includes/rest-api.php | Handles [\_deprecated\_argument()](_deprecated_argument) errors. |
| [register\_rest\_route()](register_rest_route) wp-includes/rest-api.php | Registers a REST API route. |
| [is\_embed()](is_embed) wp-includes/query.php | Is the query for an embedded post? |
| [wp\_embed\_excerpt\_more()](wp_embed_excerpt_more) wp-includes/embed.php | Filters the string in the ‘more’ link displayed after a trimmed excerpt. |
| [get\_post\_embed\_html()](get_post_embed_html) wp-includes/embed.php | Retrieves the embed code for a specific post. |
| [WP\_Customize\_Manager::customize\_pane\_settings()](../classes/wp_customize_manager/customize_pane_settings) wp-includes/class-wp-customize-manager.php | Prints JavaScript settings for parent window. |
| [WP\_Customize\_Manager::get\_document\_title\_template()](../classes/wp_customize_manager/get_document_title_template) wp-includes/class-wp-customize-manager.php | Gets the template string for the Customizer pane document title. |
| [get\_the\_author\_posts\_link()](get_the_author_posts_link) wp-includes/author-template.php | Retrieves an HTML link to the author page of the current post’s author. |
| [add\_term\_meta()](add_term_meta) wp-includes/taxonomy.php | Adds metadata to a term. |
| [update\_term\_meta()](update_term_meta) wp-includes/taxonomy.php | Updates term metadata. |
| [wp\_get\_document\_title()](wp_get_document_title) wp-includes/general-template.php | Returns document title for the current page. |
| [WP\_REST\_Request::sanitize\_params()](../classes/wp_rest_request/sanitize_params) wp-includes/rest-api/class-wp-rest-request.php | Sanitizes (where possible) the params on the request. |
| [WP\_REST\_Request::has\_valid\_params()](../classes/wp_rest_request/has_valid_params) wp-includes/rest-api/class-wp-rest-request.php | Checks whether this request is valid according to its attributes. |
| [WP\_REST\_Request::parse\_json\_params()](../classes/wp_rest_request/parse_json_params) wp-includes/rest-api/class-wp-rest-request.php | Parses the JSON parameters. |
| [WP\_REST\_Server::dispatch()](../classes/wp_rest_server/dispatch) wp-includes/rest-api/class-wp-rest-server.php | Matches the request to a callback and call it. |
| [WP\_REST\_Server::get\_namespace\_index()](../classes/wp_rest_server/get_namespace_index) wp-includes/rest-api/class-wp-rest-server.php | Retrieves the index for a namespace. |
| [WP\_REST\_Server::serve\_request()](../classes/wp_rest_server/serve_request) wp-includes/rest-api/class-wp-rest-server.php | Handles serving a REST API request. |
| [WP\_oEmbed\_Controller::register\_routes()](../classes/wp_oembed_controller/register_routes) wp-includes/class-wp-oembed-controller.php | Register the oEmbed REST API route. |
| [get\_password\_reset\_key()](get_password_reset_key) wp-includes/user.php | Creates, stores, then returns a password reset key for user. |
| [WP\_Term::get\_instance()](../classes/wp_term/get_instance) wp-includes/class-wp-term.php | Retrieve [WP\_Term](../classes/wp_term) instance. |
| [wp\_handle\_comment\_submission()](wp_handle_comment_submission) wp-includes/comment.php | Handles the submission of a comment, usually posted to wp-comments-post.php via a comment form. |
| [get\_the\_comments\_navigation()](get_the_comments_navigation) wp-includes/link-template.php | Retrieves navigation to next/previous set of comments, when applicable. |
| [get\_the\_comments\_pagination()](get_the_comments_pagination) wp-includes/link-template.php | Retrieves a paginated navigation to next/previous set of comments, when applicable. |
| [WP\_Screen::render\_list\_table\_columns\_preferences()](../classes/wp_screen/render_list_table_columns_preferences) wp-admin/includes/class-wp-screen.php | Renders the list table columns preferences. |
| [WP\_Screen::set\_screen\_reader\_content()](../classes/wp_screen/set_screen_reader_content) wp-admin/includes/class-wp-screen.php | Adds accessible hidden headings and text for the screen. |
| [wp\_admin\_bar\_customize\_menu()](wp_admin_bar_customize_menu) wp-includes/admin-bar.php | Adds the “Customize” link to the Toolbar. |
| [wp\_xmlrpc\_server::\_toggle\_sticky()](../classes/wp_xmlrpc_server/_toggle_sticky) wp-includes/class-wp-xmlrpc-server.php | Encapsulate the logic for sticking a post and determining if the user has permission to do so |
| [WP\_Customize\_Nav\_Menu\_Item\_Control::content\_template()](../classes/wp_customize_nav_menu_item_control/content_template) wp-includes/customize/class-wp-customize-nav-menu-item-control.php | JS/Underscore template for the control UI. |
| [WP\_Customize\_Nav\_Menu\_Control::content\_template()](../classes/wp_customize_nav_menu_control/content_template) wp-includes/customize/class-wp-customize-nav-menu-control.php | JS/Underscore template for the control UI. |
| [WP\_Customize\_Nav\_Menu\_Setting::update()](../classes/wp_customize_nav_menu_setting/update) wp-includes/customize/class-wp-customize-nav-menu-setting.php | Create/update the nav\_menu term for this setting. |
| [WP\_Customize\_Nav\_Menu\_Item\_Setting::sanitize()](../classes/wp_customize_nav_menu_item_setting/sanitize) wp-includes/customize/class-wp-customize-nav-menu-item-setting.php | Sanitize an input. |
| [WP\_Customize\_Nav\_Menus\_Panel::content\_template()](../classes/wp_customize_nav_menus_panel/content_template) wp-includes/customize/class-wp-customize-nav-menus-panel.php | An Underscore (JS) template for this panel’s content (but not its container). |
| [WP\_Customize\_Panel::content\_template()](../classes/wp_customize_panel/content_template) wp-includes/class-wp-customize-panel.php | An Underscore (JS) template for this panel’s content (but not its container). |
| [\_deprecated\_constructor()](_deprecated_constructor) wp-includes/functions.php | Marks a constructor as deprecated and informs when it has been used. |
| [WP\_Customize\_Nav\_Menus::print\_templates()](../classes/wp_customize_nav_menus/print_templates) wp-includes/class-wp-customize-nav-menus.php | Prints the JavaScript templates used to render Menu Customizer components. |
| [WP\_Customize\_Nav\_Menus::available\_items\_template()](../classes/wp_customize_nav_menus/available_items_template) wp-includes/class-wp-customize-nav-menus.php | Prints the HTML template used to render the add-menu-item frame. |
| [WP\_Customize\_Nav\_Menus::search\_available\_items\_query()](../classes/wp_customize_nav_menus/search_available_items_query) wp-includes/class-wp-customize-nav-menus.php | Performs post queries for available-item searching. |
| [WP\_Customize\_Nav\_Menus::enqueue\_scripts()](../classes/wp_customize_nav_menus/enqueue_scripts) wp-includes/class-wp-customize-nav-menus.php | Enqueues scripts and styles for Customizer pane. |
| [WP\_Customize\_Nav\_Menus::customize\_register()](../classes/wp_customize_nav_menus/customize_register) wp-includes/class-wp-customize-nav-menus.php | Adds the customizer settings and controls. |
| [WP\_Customize\_Nav\_Menus::load\_available\_items\_query()](../classes/wp_customize_nav_menus/load_available_items_query) wp-includes/class-wp-customize-nav-menus.php | Performs the post\_type and taxonomy queries for loading available menu items. |
| [WP\_Customize\_Nav\_Menus::ajax\_search\_available\_items()](../classes/wp_customize_nav_menus/ajax_search_available_items) wp-includes/class-wp-customize-nav-menus.php | Ajax handler for searching available menu items. |
| [WP\_Posts\_List\_Table::handle\_row\_actions()](../classes/wp_posts_list_table/handle_row_actions) wp-admin/includes/class-wp-posts-list-table.php | Generates and displays row action links. |
| [WP\_Posts\_List\_Table::column\_cb()](../classes/wp_posts_list_table/column_cb) wp-admin/includes/class-wp-posts-list-table.php | Handles the checkbox column output. |
| [WP\_Posts\_List\_Table::column\_title()](../classes/wp_posts_list_table/column_title) wp-admin/includes/class-wp-posts-list-table.php | Handles the title column output. |
| [WP\_Posts\_List\_Table::column\_date()](../classes/wp_posts_list_table/column_date) wp-admin/includes/class-wp-posts-list-table.php | Handles the post date column output. |
| [WP\_Links\_List\_Table::handle\_row\_actions()](../classes/wp_links_list_table/handle_row_actions) wp-admin/includes/class-wp-links-list-table.php | Generates and displays row action links. |
| [WP\_Links\_List\_Table::column\_cb()](../classes/wp_links_list_table/column_cb) wp-admin/includes/class-wp-links-list-table.php | Handles the checkbox column output. |
| [WP\_Links\_List\_Table::column\_name()](../classes/wp_links_list_table/column_name) wp-admin/includes/class-wp-links-list-table.php | Handles the link name column output. |
| [WP\_MS\_Themes\_List\_Table::column\_name()](../classes/wp_ms_themes_list_table/column_name) wp-admin/includes/class-wp-ms-themes-list-table.php | Handles the name column output. |
| [WP\_MS\_Themes\_List\_Table::column\_description()](../classes/wp_ms_themes_list_table/column_description) wp-admin/includes/class-wp-ms-themes-list-table.php | Handles the description column output. |
| [WP\_MS\_Themes\_List\_Table::single\_row\_columns()](../classes/wp_ms_themes_list_table/single_row_columns) wp-admin/includes/class-wp-ms-themes-list-table.php | Handles the output for a single table row. |
| [WP\_Comments\_List\_Table::handle\_row\_actions()](../classes/wp_comments_list_table/handle_row_actions) wp-admin/includes/class-wp-comments-list-table.php | Generates and displays row actions links. |
| [wp\_ajax\_crop\_image()](wp_ajax_crop_image) wp-admin/includes/ajax-actions.php | Ajax handler for cropping an image. |
| [WP\_List\_Table::handle\_row\_actions()](../classes/wp_list_table/handle_row_actions) wp-admin/includes/class-wp-list-table.php | Generates and display row actions links for the list table. |
| [WP\_MS\_Sites\_List\_Table::handle\_row\_actions()](../classes/wp_ms_sites_list_table/handle_row_actions) wp-admin/includes/class-wp-ms-sites-list-table.php | Generates and displays row action links. |
| [WP\_MS\_Sites\_List\_Table::column\_cb()](../classes/wp_ms_sites_list_table/column_cb) wp-admin/includes/class-wp-ms-sites-list-table.php | Handles the checkbox column output. |
| [WP\_MS\_Sites\_List\_Table::column\_blogname()](../classes/wp_ms_sites_list_table/column_blogname) wp-admin/includes/class-wp-ms-sites-list-table.php | Handles the site name column output. |
| [WP\_MS\_Sites\_List\_Table::column\_lastupdated()](../classes/wp_ms_sites_list_table/column_lastupdated) wp-admin/includes/class-wp-ms-sites-list-table.php | Handles the lastupdated column output. |
| [WP\_MS\_Sites\_List\_Table::column\_registered()](../classes/wp_ms_sites_list_table/column_registered) wp-admin/includes/class-wp-ms-sites-list-table.php | Handles the registered column output. |
| [WP\_Terms\_List\_Table::handle\_row\_actions()](../classes/wp_terms_list_table/handle_row_actions) wp-admin/includes/class-wp-terms-list-table.php | Generates and displays row action links. |
| [WP\_MS\_Users\_List\_Table::handle\_row\_actions()](../classes/wp_ms_users_list_table/handle_row_actions) wp-admin/includes/class-wp-ms-users-list-table.php | Generates and displays row action links. |
| [WP\_MS\_Users\_List\_Table::column\_username()](../classes/wp_ms_users_list_table/column_username) wp-admin/includes/class-wp-ms-users-list-table.php | Handles the username column output. |
| [WP\_MS\_Users\_List\_Table::column\_registered()](../classes/wp_ms_users_list_table/column_registered) wp-admin/includes/class-wp-ms-users-list-table.php | Handles the registered date column output. |
| [WP\_MS\_Users\_List\_Table::column\_blogs()](../classes/wp_ms_users_list_table/column_blogs) wp-admin/includes/class-wp-ms-users-list-table.php | Handles the sites column output. |
| [WP\_MS\_Users\_List\_Table::column\_cb()](../classes/wp_ms_users_list_table/column_cb) wp-admin/includes/class-wp-ms-users-list-table.php | Handles the checkbox column output. |
| [WP\_Media\_List\_Table::column\_date()](../classes/wp_media_list_table/column_date) wp-admin/includes/class-wp-media-list-table.php | Handles the date column output. |
| [WP\_Media\_List\_Table::column\_parent()](../classes/wp_media_list_table/column_parent) wp-admin/includes/class-wp-media-list-table.php | Handles the parent column output. |
| [WP\_Media\_List\_Table::column\_cb()](../classes/wp_media_list_table/column_cb) wp-admin/includes/class-wp-media-list-table.php | Handles the checkbox column output. |
| [WP\_Media\_List\_Table::column\_title()](../classes/wp_media_list_table/column_title) wp-admin/includes/class-wp-media-list-table.php | Handles the title column output. |
| [WP\_Customize\_Theme\_Control::content\_template()](../classes/wp_customize_theme_control/content_template) wp-includes/customize/class-wp-customize-theme-control.php | Render a JS template for theme display. |
| [wpdb::get\_table\_charset()](../classes/wpdb/get_table_charset) wp-includes/class-wpdb.php | Retrieves the character set for the given table. |
| [wpdb::strip\_invalid\_text()](../classes/wpdb/strip_invalid_text) wp-includes/class-wpdb.php | Strips any invalid characters based on value/charset pairs. |
| [wpdb::process\_fields()](../classes/wpdb/process_fields) wp-includes/class-wpdb.php | Processes arrays of field/value pairs and field formats. |
| [customize\_themes\_print\_templates()](customize_themes_print_templates) wp-admin/includes/theme.php | Prints JS templates for the theme-browsing UI in the Customizer. |
| [wp\_ajax\_press\_this\_add\_category()](wp_ajax_press_this_add_category) wp-includes/deprecated.php | Ajax handler for creating new category from Press This. |
| [wp\_ajax\_update\_plugin()](wp_ajax_update_plugin) wp-admin/includes/ajax-actions.php | Ajax handler for updating a plugin. |
| [wp\_ajax\_press\_this\_save\_post()](wp_ajax_press_this_save_post) wp-includes/deprecated.php | Ajax handler for saving a post from Press This. |
| [wp\_media\_attach\_action()](wp_media_attach_action) wp-admin/includes/media.php | Encapsulates the logic for Attach/Detach actions. |
| [WP\_Customize\_Manager::render\_control\_templates()](../classes/wp_customize_manager/render_control_templates) wp-includes/class-wp-customize-manager.php | Renders JS templates for all registered control types. |
| [get\_the\_archive\_title()](get_the_archive_title) wp-includes/general-template.php | Retrieves the archive title based on the queried object. |
| [wp\_get\_password\_hint()](wp_get_password_hint) wp-includes/user.php | Gets the text suggesting how to create strong passwords. |
| [\_navigation\_markup()](_navigation_markup) wp-includes/link-template.php | Wraps passed links in navigational markup. |
| [get\_the\_post\_navigation()](get_the_post_navigation) wp-includes/link-template.php | Retrieves the navigation to next/previous post, when applicable. |
| [get\_the\_posts\_navigation()](get_the_posts_navigation) wp-includes/link-template.php | Returns the navigation to next/previous set of posts, when applicable. |
| [get\_the\_posts\_pagination()](get_the_posts_pagination) wp-includes/link-template.php | Retrieves a paginated navigation to next/previous set of posts, when applicable. |
| [WP\_Date\_Query::validate\_date\_values()](../classes/wp_date_query/validate_date_values) wp-includes/class-wp-date-query.php | Validates the given date\_query values and triggers errors if something is not valid. |
| [WP\_Customize\_Section::json()](../classes/wp_customize_section/json) wp-includes/class-wp-customize-section.php | Gather the parameters passed to client JavaScript via JSON. |
| [wp\_ajax\_destroy\_sessions()](wp_ajax_destroy_sessions) wp-admin/includes/ajax-actions.php | Ajax handler for destroying multiple open sessions for a user. |
| [wp\_print\_revision\_templates()](wp_print_revision_templates) wp-admin/includes/revision.php | Print JavaScript templates required for the revisions experience. |
| [WP\_Customize\_Manager::remove\_panel()](../classes/wp_customize_manager/remove_panel) wp-includes/class-wp-customize-manager.php | Removes a customize panel. |
| [get\_comments\_number\_text()](get_comments_number_text) wp-includes/comment-template.php | Displays the language string for the number of comments the current post has. |
| [wp\_ajax\_parse\_embed()](wp_ajax_parse_embed) wp-admin/includes/ajax-actions.php | Apply [embed] Ajax handlers to a string. |
| [wp\_ajax\_parse\_media\_shortcode()](wp_ajax_parse_media_shortcode) wp-admin/includes/ajax-actions.php | |
| [\_wp\_handle\_upload()](_wp_handle_upload) wp-admin/includes/file.php | Handles PHP uploads in WordPress. |
| [translations\_api()](translations_api) wp-admin/includes/translation-install.php | Retrieve translations from WordPress Translation API. |
| [retrieve\_password()](retrieve_password) wp-includes/user.php | Handles sending a password retrieval email to a user. |
| [login\_header()](login_header) wp-login.php | Output the login page header. |
| [show\_user\_form()](show_user_form) wp-signup.php | Displays the fields for the new user account registration form. |
| [signup\_another\_blog()](signup_another_blog) wp-signup.php | Shows a form for returning users to sign up for another site. |
| [confirm\_another\_blog\_signup()](confirm_another_blog_signup) wp-signup.php | Shows a message confirming that the new site has been created. |
| [signup\_user()](signup_user) wp-signup.php | Shows a form for a visitor to sign up for a new user account. |
| [confirm\_user\_signup()](confirm_user_signup) wp-signup.php | Shows a message confirming that the new user has been registered and is awaiting activation. |
| [confirm\_blog\_signup()](confirm_blog_signup) wp-signup.php | Shows a message confirming that the new site has been registered and is awaiting activation. |
| [show\_blog\_form()](show_blog_form) wp-signup.php | Generates and displays the Sign-up and Create Site forms. |
| [network\_step1()](network_step1) wp-admin/includes/network.php | Prints step 1 for Network installation process. |
| [network\_step2()](network_step2) wp-admin/includes/network.php | Prints step 2 for Network installation process. |
| [display\_setup\_form()](display_setup_form) wp-admin/install.php | Displays installer setup form. |
| [WP\_Automatic\_Updater::update()](../classes/wp_automatic_updater/update) wp-admin/includes/class-wp-automatic-updater.php | Updates an item, if appropriate. |
| [WP\_Automatic\_Updater::send\_email()](../classes/wp_automatic_updater/send_email) wp-admin/includes/class-wp-automatic-updater.php | Sends an email upon the completion or failure of a background core update. |
| [WP\_Automatic\_Updater::send\_debug\_email()](../classes/wp_automatic_updater/send_debug_email) wp-admin/includes/class-wp-automatic-updater.php | Prepares and sends an email of a full log of background update results, useful for debugging and geekery. |
| [File\_Upload\_Upgrader::\_\_construct()](../classes/file_upload_upgrader/__construct) wp-admin/includes/class-file-upload-upgrader.php | Construct the upgrader for a form. |
| [Core\_Upgrader::upgrade\_strings()](../classes/core_upgrader/upgrade_strings) wp-admin/includes/class-core-upgrader.php | Initialize the upgrade strings. |
| [Core\_Upgrader::upgrade()](../classes/core_upgrader/upgrade) wp-admin/includes/class-core-upgrader.php | Upgrade WordPress core. |
| [Language\_Pack\_Upgrader::upgrade\_strings()](../classes/language_pack_upgrader/upgrade_strings) wp-admin/includes/class-language-pack-upgrader.php | Initialize the upgrade strings. |
| [Language\_Pack\_Upgrader::check\_package()](../classes/language_pack_upgrader/check_package) wp-admin/includes/class-language-pack-upgrader.php | Checks that the package source contains .mo and .po files. |
| [Plugin\_Upgrader::check\_package()](../classes/plugin_upgrader/check_package) wp-admin/includes/class-plugin-upgrader.php | Checks that the source package contains a valid plugin. |
| [Theme\_Upgrader::upgrade\_strings()](../classes/theme_upgrader/upgrade_strings) wp-admin/includes/class-theme-upgrader.php | Initialize the upgrade strings. |
| [Theme\_Upgrader::install\_strings()](../classes/theme_upgrader/install_strings) wp-admin/includes/class-theme-upgrader.php | Initialize the installation strings. |
| [Theme\_Upgrader::check\_package()](../classes/theme_upgrader/check_package) wp-admin/includes/class-theme-upgrader.php | Checks that the package source contains a valid theme. |
| [Plugin\_Upgrader::upgrade\_strings()](../classes/plugin_upgrader/upgrade_strings) wp-admin/includes/class-plugin-upgrader.php | Initialize the upgrade strings. |
| [Plugin\_Upgrader::install\_strings()](../classes/plugin_upgrader/install_strings) wp-admin/includes/class-plugin-upgrader.php | Initialize the installation strings. |
| [WP\_Upgrader::generic\_strings()](../classes/wp_upgrader/generic_strings) wp-admin/includes/class-wp-upgrader.php | Add the generic strings to WP\_Upgrader::$strings. |
| [WP\_Filesystem\_SSH2::\_\_construct()](../classes/wp_filesystem_ssh2/__construct) wp-admin/includes/class-wp-filesystem-ssh2.php | Constructor. |
| [WP\_Filesystem\_SSH2::connect()](../classes/wp_filesystem_ssh2/connect) wp-admin/includes/class-wp-filesystem-ssh2.php | Connects filesystem. |
| [WP\_Filesystem\_SSH2::run\_command()](../classes/wp_filesystem_ssh2/run_command) wp-admin/includes/class-wp-filesystem-ssh2.php | |
| [WP\_MS\_Users\_List\_Table::get\_bulk\_actions()](../classes/wp_ms_users_list_table/get_bulk_actions) wp-admin/includes/class-wp-ms-users-list-table.php | |
| [WP\_MS\_Users\_List\_Table::get\_columns()](../classes/wp_ms_users_list_table/get_columns) wp-admin/includes/class-wp-ms-users-list-table.php | |
| [WP\_Screen::show\_screen\_options()](../classes/wp_screen/show_screen_options) wp-admin/includes/class-wp-screen.php | |
| [WP\_Screen::render\_screen\_options()](../classes/wp_screen/render_screen_options) wp-admin/includes/class-wp-screen.php | Renders the screen options tab. |
| [WP\_Screen::render\_per\_page\_options()](../classes/wp_screen/render_per_page_options) wp-admin/includes/class-wp-screen.php | Renders the items per page option. |
| [delete\_theme()](delete_theme) wp-admin/includes/theme.php | Removes a theme. |
| [get\_theme\_update\_available()](get_theme_update_available) wp-admin/includes/theme.php | Retrieves the update link if there is a theme update available. |
| [get\_theme\_feature\_list()](get_theme_feature_list) wp-admin/includes/theme.php | Retrieves list of WordPress theme features (aka theme tags). |
| [themes\_api()](themes_api) wp-admin/includes/theme.php | Retrieves theme installer pages from the WordPress.org Themes API. |
| [WP\_Screen::render\_screen\_meta()](../classes/wp_screen/render_screen_meta) wp-admin/includes/class-wp-screen.php | Renders the screen’s help section. |
| [WP\_Screen::get()](../classes/wp_screen/get) wp-admin/includes/class-wp-screen.php | Fetches a screen object. |
| [WP\_Plugins\_List\_Table::get\_bulk\_actions()](../classes/wp_plugins_list_table/get_bulk_actions) wp-admin/includes/class-wp-plugins-list-table.php | |
| [WP\_Plugins\_List\_Table::extra\_tablenav()](../classes/wp_plugins_list_table/extra_tablenav) wp-admin/includes/class-wp-plugins-list-table.php | |
| [WP\_Plugins\_List\_Table::single\_row()](../classes/wp_plugins_list_table/single_row) wp-admin/includes/class-wp-plugins-list-table.php | |
| [WP\_Plugins\_List\_Table::no\_items()](../classes/wp_plugins_list_table/no_items) wp-admin/includes/class-wp-plugins-list-table.php | |
| [WP\_Plugins\_List\_Table::get\_columns()](../classes/wp_plugins_list_table/get_columns) wp-admin/includes/class-wp-plugins-list-table.php | |
| [WP\_Links\_List\_Table::get\_bulk\_actions()](../classes/wp_links_list_table/get_bulk_actions) wp-admin/includes/class-wp-links-list-table.php | |
| [WP\_Links\_List\_Table::extra\_tablenav()](../classes/wp_links_list_table/extra_tablenav) wp-admin/includes/class-wp-links-list-table.php | |
| [WP\_Links\_List\_Table::get\_columns()](../classes/wp_links_list_table/get_columns) wp-admin/includes/class-wp-links-list-table.php | |
| [WP\_User\_Search::query()](../classes/wp_user_search/query) wp-admin/includes/deprecated.php | Executes the user search query. |
| [WP\_User\_Search::do\_paging()](../classes/wp_user_search/do_paging) wp-admin/includes/deprecated.php | Handles paging for the user search query. |
| [install\_theme\_search\_form()](install_theme_search_form) wp-admin/includes/theme-install.php | Displays search form for searching themes. |
| [install\_themes\_dashboard()](install_themes_dashboard) wp-admin/includes/theme-install.php | Displays tags filter for themes. |
| [install\_themes\_upload()](install_themes_upload) wp-admin/includes/theme-install.php | Displays a form to upload themes from zip files. |
| [install\_theme\_information()](install_theme_information) wp-admin/includes/theme-install.php | Displays theme information in dialog box form. |
| [Language\_Pack\_Upgrader\_Skin::\_\_construct()](../classes/language_pack_upgrader_skin/__construct) wp-admin/includes/class-language-pack-upgrader-skin.php | |
| [Language\_Pack\_Upgrader\_Skin::before()](../classes/language_pack_upgrader_skin/before) wp-admin/includes/class-language-pack-upgrader-skin.php | |
| [Language\_Pack\_Upgrader\_Skin::bulk\_footer()](../classes/language_pack_upgrader_skin/bulk_footer) wp-admin/includes/class-language-pack-upgrader-skin.php | |
| [Theme\_Upgrader\_Skin::\_\_construct()](../classes/theme_upgrader_skin/__construct) wp-admin/includes/class-theme-upgrader-skin.php | Constructor. |
| [Theme\_Upgrader\_Skin::after()](../classes/theme_upgrader_skin/after) wp-admin/includes/class-theme-upgrader-skin.php | Action to perform following a single theme update. |
| [Plugin\_Installer\_Skin::after()](../classes/plugin_installer_skin/after) wp-admin/includes/class-plugin-installer-skin.php | Action to perform following a plugin install. |
| [Theme\_Installer\_Skin::after()](../classes/theme_installer_skin/after) wp-admin/includes/class-theme-installer-skin.php | Action to perform following a single theme install. |
| [Bulk\_Theme\_Upgrader\_Skin::add\_strings()](../classes/bulk_theme_upgrader_skin/add_strings) wp-admin/includes/class-bulk-theme-upgrader-skin.php | |
| [Bulk\_Theme\_Upgrader\_Skin::bulk\_footer()](../classes/bulk_theme_upgrader_skin/bulk_footer) wp-admin/includes/class-bulk-theme-upgrader-skin.php | |
| [Bulk\_Upgrader\_Skin::after()](../classes/bulk_upgrader_skin/after) wp-admin/includes/class-bulk-upgrader-skin.php | |
| [Bulk\_Plugin\_Upgrader\_Skin::add\_strings()](../classes/bulk_plugin_upgrader_skin/add_strings) wp-admin/includes/class-bulk-plugin-upgrader-skin.php | |
| [Bulk\_Plugin\_Upgrader\_Skin::bulk\_footer()](../classes/bulk_plugin_upgrader_skin/bulk_footer) wp-admin/includes/class-bulk-plugin-upgrader-skin.php | |
| [Plugin\_Upgrader\_Skin::\_\_construct()](../classes/plugin_upgrader_skin/__construct) wp-admin/includes/class-plugin-upgrader-skin.php | Constructor. |
| [Plugin\_Upgrader\_Skin::after()](../classes/plugin_upgrader_skin/after) wp-admin/includes/class-plugin-upgrader-skin.php | Action to perform following a single plugin update. |
| [Bulk\_Upgrader\_Skin::add\_strings()](../classes/bulk_upgrader_skin/add_strings) wp-admin/includes/class-bulk-upgrader-skin.php | |
| [WP\_List\_Table::comments\_bubble()](../classes/wp_list_table/comments_bubble) wp-admin/includes/class-wp-list-table.php | Displays a comment count bubble. |
| [WP\_List\_Table::pagination()](../classes/wp_list_table/pagination) wp-admin/includes/class-wp-list-table.php | Displays the pagination. |
| [WP\_List\_Table::print\_column\_headers()](../classes/wp_list_table/print_column_headers) wp-admin/includes/class-wp-list-table.php | Prints column headers, accounting for hidden and sortable columns. |
| [WP\_List\_Table::\_\_construct()](../classes/wp_list_table/__construct) wp-admin/includes/class-wp-list-table.php | Constructor. |
| [WP\_List\_Table::bulk\_actions()](../classes/wp_list_table/bulk_actions) wp-admin/includes/class-wp-list-table.php | Displays the bulk actions dropdown. |
| [WP\_List\_Table::row\_actions()](../classes/wp_list_table/row_actions) wp-admin/includes/class-wp-list-table.php | Generates the required HTML for a list of row action links. |
| [WP\_List\_Table::months\_dropdown()](../classes/wp_list_table/months_dropdown) wp-admin/includes/class-wp-list-table.php | Displays a dropdown for filtering items in the list table by month. |
| [\_access\_denied\_splash()](_access_denied_splash) wp-admin/includes/ms.php | Displays an access denied message when a user tries to view a site’s dashboard they do not have access to. |
| [mu\_dropdown\_languages()](mu_dropdown_languages) wp-admin/includes/ms.php | Generates and displays a drop-down of available languages. |
| [site\_admin\_notice()](site_admin_notice) wp-admin/includes/ms.php | Displays an admin notice to upgrade all sites after a core upgrade. |
| [upload\_is\_user\_over\_quota()](upload_is_user_over_quota) wp-admin/includes/ms.php | Check whether a site has used its allotted upload space. |
| [display\_space\_usage()](display_space_usage) wp-admin/includes/ms.php | Displays the amount of disk space used by the current site. Not used in core. |
| [update\_option\_new\_admin\_email()](update_option_new_admin_email) wp-admin/includes/misc.php | Sends a confirmation request email when a change of site admin email address is attempted. |
| [send\_confirmation\_on\_profile\_email()](send_confirmation_on_profile_email) wp-includes/user.php | Sends a confirmation request email when a change of user email address is attempted. |
| [new\_user\_email\_admin\_notice()](new_user_email_admin_notice) wp-includes/user.php | Adds an admin notice alerting the user to check for confirmation request email after email address change. |
| [wp\_save\_image\_file()](wp_save_image_file) wp-admin/includes/image-edit.php | Saves image to file. |
| [image\_edit\_apply\_changes()](image_edit_apply_changes) wp-admin/includes/image-edit.php | Performs group of changes on Editor specified. |
| [wp\_restore\_image()](wp_restore_image) wp-admin/includes/image-edit.php | Restores the metadata for a given attachment. |
| [wp\_save\_image()](wp_save_image) wp-admin/includes/image-edit.php | Saves image to post, along with enqueued changes in `$_REQUEST['history']`. |
| [check\_upload\_size()](check_upload_size) wp-admin/includes/ms.php | Determine if uploaded file exceeds space quota. |
| [wp\_image\_editor()](wp_image_editor) wp-admin/includes/image-edit.php | Loads the WP image-editing interface. |
| [wp\_stream\_image()](wp_stream_image) wp-admin/includes/image-edit.php | Streams image in [WP\_Image\_Editor](../classes/wp_image_editor) to browser. |
| [WP\_Filesystem\_FTPext::connect()](../classes/wp_filesystem_ftpext/connect) wp-admin/includes/class-wp-filesystem-ftpext.php | Connects filesystem. |
| [WP\_Filesystem\_FTPext::\_\_construct()](../classes/wp_filesystem_ftpext/__construct) wp-admin/includes/class-wp-filesystem-ftpext.php | Constructor. |
| [WP\_MS\_Themes\_List\_Table::get\_columns()](../classes/wp_ms_themes_list_table/get_columns) wp-admin/includes/class-wp-ms-themes-list-table.php | |
| [WP\_MS\_Themes\_List\_Table::get\_bulk\_actions()](../classes/wp_ms_themes_list_table/get_bulk_actions) wp-admin/includes/class-wp-ms-themes-list-table.php | |
| [WP\_Filesystem\_Base::search\_for\_folder()](../classes/wp_filesystem_base/search_for_folder) wp-admin/includes/class-wp-filesystem-base.php | Locates a folder on the remote filesystem. |
| [wp\_check\_locked\_posts()](wp_check_locked_posts) wp-admin/includes/misc.php | Checks lock status for posts displayed on the Posts screen. |
| [wp\_refresh\_post\_lock()](wp_refresh_post_lock) wp-admin/includes/misc.php | Checks lock status on the New/Edit Post screen and refresh the lock. |
| [heartbeat\_autosave()](heartbeat_autosave) wp-admin/includes/misc.php | Performs autosave with heartbeat. |
| [insert\_with\_markers()](insert_with_markers) wp-admin/includes/misc.php | Inserts an array of strings into a file (.htaccess), placing it between BEGIN and END markers. |
| [populate\_network()](populate_network) wp-admin/includes/schema.php | Populate network settings. |
| [WP\_Theme\_Install\_List\_Table::install\_theme\_info()](../classes/wp_theme_install_list_table/install_theme_info) wp-admin/includes/class-wp-theme-install-list-table.php | Prints the info for a theme (to be used in the theme installer modal). |
| [populate\_options()](populate_options) wp-admin/includes/schema.php | Create WordPress options and set the default values. |
| [wp\_insert\_category()](wp_insert_category) wp-admin/includes/taxonomy.php | Updates an existing Category or creates a new Category. |
| [WP\_Theme\_Install\_List\_Table::prepare\_items()](../classes/wp_theme_install_list_table/prepare_items) wp-admin/includes/class-wp-theme-install-list-table.php | |
| [WP\_Theme\_Install\_List\_Table::single\_row()](../classes/wp_theme_install_list_table/single_row) wp-admin/includes/class-wp-theme-install-list-table.php | Prints a theme from the WordPress.org API. |
| [maintenance\_nag()](maintenance_nag) wp-admin/includes/update.php | Displays maintenance nag HTML message. |
| [get\_core\_checksums()](get_core_checksums) wp-admin/includes/update.php | Gets and caches the checksums for the given version of WordPress. |
| [core\_update\_footer()](core_update_footer) wp-admin/includes/update.php | Returns core update footer message. |
| [update\_nag()](update_nag) wp-admin/includes/update.php | Returns core update notification message. |
| [update\_right\_now\_message()](update_right_now_message) wp-admin/includes/update.php | Displays WordPress version and active theme in the ‘At a Glance’ dashboard widget. |
| [wp\_plugin\_update\_row()](wp_plugin_update_row) wp-admin/includes/update.php | Displays update information for a plugin. |
| [wp\_theme\_update\_row()](wp_theme_update_row) wp-admin/includes/update.php | Displays update information for a theme. |
| [wp\_welcome\_panel()](wp_welcome_panel) wp-admin/includes/dashboard.php | Displays a welcome panel to introduce users to WordPress. |
| [install\_dashboard()](install_dashboard) wp-admin/includes/plugin-install.php | Displays the Featured tab of Add Plugins screen. |
| [install\_search\_form()](install_search_form) wp-admin/includes/plugin-install.php | Displays a search form for searching plugins. |
| [install\_plugins\_upload()](install_plugins_upload) wp-admin/includes/plugin-install.php | Displays a form to upload plugins from zip files. |
| [display\_plugins\_table()](display_plugins_table) wp-admin/includes/plugin-install.php | Displays plugin content based on plugin list. |
| [install\_plugin\_information()](install_plugin_information) wp-admin/includes/plugin-install.php | Displays plugin information in dialog box form. |
| [plugins\_api()](plugins_api) wp-admin/includes/plugin-install.php | Retrieves plugin installer pages from the WordPress.org Plugins API. |
| [wp\_dashboard\_site\_activity()](wp_dashboard_site_activity) wp-admin/includes/dashboard.php | Callback function for Activity widget. |
| [wp\_dashboard\_recent\_posts()](wp_dashboard_recent_posts) wp-admin/includes/dashboard.php | Generates Publishing Soon and Recently Published sections. |
| [wp\_dashboard\_recent\_comments()](wp_dashboard_recent_comments) wp-admin/includes/dashboard.php | Show Comments section. |
| [wp\_dashboard\_cached\_rss\_widget()](wp_dashboard_cached_rss_widget) wp-admin/includes/dashboard.php | Checks to see if all of the feed url in $check\_urls are cached. |
| [wp\_dashboard\_rss\_control()](wp_dashboard_rss_control) wp-admin/includes/dashboard.php | The RSS dashboard widget control. |
| [wp\_dashboard\_primary()](wp_dashboard_primary) wp-admin/includes/dashboard.php | ‘WordPress Events and News’ dashboard widget. |
| [wp\_dashboard\_quota()](wp_dashboard_quota) wp-admin/includes/dashboard.php | Displays file upload quota on dashboard. |
| [wp\_dashboard\_browser\_nag()](wp_dashboard_browser_nag) wp-admin/includes/dashboard.php | Displays the browser update nag. |
| [wp\_dashboard\_plugins\_output()](wp_dashboard_plugins_output) wp-admin/includes/deprecated.php | Display plugins text for the WordPress news widget. |
| [wp\_add\_dashboard\_widget()](wp_add_dashboard_widget) wp-admin/includes/dashboard.php | Adds a new dashboard widget. |
| [\_wp\_dashboard\_control\_callback()](_wp_dashboard_control_callback) wp-admin/includes/dashboard.php | Outputs controls for the current dashboard widget. |
| [wp\_dashboard\_right\_now()](wp_dashboard_right_now) wp-admin/includes/dashboard.php | Dashboard widget that displays some basic stats about the site. |
| [wp\_network\_dashboard\_right\_now()](wp_network_dashboard_right_now) wp-admin/includes/dashboard.php | |
| [wp\_dashboard\_quick\_press()](wp_dashboard_quick_press) wp-admin/includes/dashboard.php | The Quick Draft widget display and creation of drafts. |
| [wp\_dashboard\_recent\_drafts()](wp_dashboard_recent_drafts) wp-admin/includes/dashboard.php | Show recent drafts of the user on the dashboard. |
| [\_wp\_dashboard\_recent\_comments\_row()](_wp_dashboard_recent_comments_row) wp-admin/includes/dashboard.php | Outputs a row for the Recent Comments widget. |
| [wp\_dashboard\_setup()](wp_dashboard_setup) wp-admin/includes/dashboard.php | Registers dashboard widgets. |
| [wp\_install()](wp_install) wp-admin/includes/upgrade.php | Installs the site. |
| [wp\_install\_defaults()](wp_install_defaults) wp-admin/includes/upgrade.php | Creates the initial content for a newly-installed site. |
| [wp\_new\_blog\_notification()](wp_new_blog_notification) wp-admin/includes/upgrade.php | Notifies the site admin that the installation of WordPress is complete. |
| [register\_setting()](register_setting) wp-includes/option.php | Registers a setting and its data. |
| [unregister\_setting()](unregister_setting) wp-includes/option.php | Unregisters a setting. |
| [validate\_plugin()](validate_plugin) wp-admin/includes/plugin.php | Validates the plugin path. |
| [add\_menu\_page()](add_menu_page) wp-admin/includes/plugin.php | Adds a top-level menu page. |
| [add\_submenu\_page()](add_submenu_page) wp-admin/includes/plugin.php | Adds a submenu page. |
| [\_get\_dropins()](_get_dropins) wp-admin/includes/plugin.php | Returns drop-ins that WordPress uses. |
| [activate\_plugin()](activate_plugin) wp-admin/includes/plugin.php | Attempts activation of plugin in a “sandbox” and redirects on success. |
| [activate\_plugins()](activate_plugins) wp-admin/includes/plugin.php | Activates multiple plugins. |
| [delete\_plugins()](delete_plugins) wp-admin/includes/plugin.php | Removes directory and files of a plugin for a list of plugins. |
| [get\_plugin\_data()](get_plugin_data) wp-admin/includes/plugin.php | Parses the plugin contents to retrieve plugin’s metadata. |
| [\_get\_plugin\_data\_markup\_translate()](_get_plugin_data_markup_translate) wp-admin/includes/plugin.php | Sanitizes plugin data, optionally adds markup, optionally translates. |
| [default\_password\_nag()](default_password_nag) wp-admin/includes/user.php | |
| [WP\_Plugin\_Install\_List\_Table::display\_rows()](../classes/wp_plugin_install_list_table/display_rows) wp-admin/includes/class-wp-plugin-install-list-table.php | |
| [edit\_user()](edit_user) wp-admin/includes/user.php | Edit user settings based on contents of $\_POST |
| [WP\_Plugin\_Install\_List\_Table::prepare\_items()](../classes/wp_plugin_install_list_table/prepare_items) wp-admin/includes/class-wp-plugin-install-list-table.php | |
| [get\_submit\_button()](get_submit_button) wp-admin/includes/template.php | Returns a submit button, with provided text and appropriate class. |
| [convert\_to\_screen()](convert_to_screen) wp-admin/includes/template.php | Converts a screen string to a screen object. |
| [wp\_star\_rating()](wp_star_rating) wp-admin/includes/template.php | Outputs a HTML element with a star rating for a given rating. |
| [add\_settings\_field()](add_settings_field) wp-admin/includes/template.php | Adds a new field to a section of a settings page. |
| [find\_posts\_div()](find_posts_div) wp-admin/includes/template.php | Outputs the modal window used for attaching media to posts or pages in the media-listing screen. |
| [\_draft\_or\_post\_title()](_draft_or_post_title) wp-admin/includes/template.php | Gets the post title. |
| [wp\_comment\_trashnotice()](wp_comment_trashnotice) wp-admin/includes/template.php | Outputs ‘undo move to Trash’ text for comments. |
| [list\_meta()](list_meta) wp-admin/includes/template.php | Outputs a post’s public meta data in the Custom Fields meta box. |
| [\_list\_meta\_row()](_list_meta_row) wp-admin/includes/template.php | Outputs a single row of public meta data in the Custom Fields meta box. |
| [meta\_form()](meta_form) wp-admin/includes/template.php | Prints the form in the Custom Fields meta box. |
| [touch\_time()](touch_time) wp-admin/includes/template.php | Prints out HTML form date elements for editing post or comment publish date. |
| [wp\_import\_upload\_form()](wp_import_upload_form) wp-admin/includes/template.php | Outputs the form used by the importers to accept the data to be imported. |
| [do\_meta\_boxes()](do_meta_boxes) wp-admin/includes/template.php | Meta-Box template function. |
| [add\_settings\_section()](add_settings_section) wp-admin/includes/template.php | Adds a new section to a settings page. |
| [WP\_Themes\_List\_Table::no\_items()](../classes/wp_themes_list_table/no_items) wp-admin/includes/class-wp-themes-list-table.php | |
| [WP\_Themes\_List\_Table::display\_rows()](../classes/wp_themes_list_table/display_rows) wp-admin/includes/class-wp-themes-list-table.php | |
| [WP\_MS\_Sites\_List\_Table::\_\_construct()](../classes/wp_ms_sites_list_table/__construct) wp-admin/includes/class-wp-ms-sites-list-table.php | Constructor. |
| [WP\_MS\_Sites\_List\_Table::get\_bulk\_actions()](../classes/wp_ms_sites_list_table/get_bulk_actions) wp-admin/includes/class-wp-ms-sites-list-table.php | |
| [WP\_MS\_Sites\_List\_Table::get\_columns()](../classes/wp_ms_sites_list_table/get_columns) wp-admin/includes/class-wp-ms-sites-list-table.php | |
| [WP\_Users\_List\_Table::single\_row()](../classes/wp_users_list_table/single_row) wp-admin/includes/class-wp-users-list-table.php | Generate HTML for a single row on the users.php admin panel. |
| [WP\_Users\_List\_Table::get\_views()](../classes/wp_users_list_table/get_views) wp-admin/includes/class-wp-users-list-table.php | Return an associative array listing all the views that can be used with this table. |
| [WP\_Users\_List\_Table::get\_bulk\_actions()](../classes/wp_users_list_table/get_bulk_actions) wp-admin/includes/class-wp-users-list-table.php | Retrieve an associative array of bulk actions available on this table. |
| [WP\_Users\_List\_Table::extra\_tablenav()](../classes/wp_users_list_table/extra_tablenav) wp-admin/includes/class-wp-users-list-table.php | Output the controls to allow user roles to be changed in bulk. |
| [WP\_Users\_List\_Table::get\_columns()](../classes/wp_users_list_table/get_columns) wp-admin/includes/class-wp-users-list-table.php | Get a list of columns for the list table. |
| [media\_upload\_type\_form()](media_upload_type_form) wp-admin/includes/media.php | Outputs the legacy media upload form for a given media type. |
| [media\_upload\_gallery\_form()](media_upload_gallery_form) wp-admin/includes/media.php | Adds gallery form to upload iframe. |
| [media\_upload\_library\_form()](media_upload_library_form) wp-admin/includes/media.php | Outputs the legacy media upload form for the media library. |
| [wp\_media\_insert\_url\_form()](wp_media_insert_url_form) wp-admin/includes/media.php | Creates the form for external url. |
| [media\_upload\_flash\_bypass()](media_upload_flash_bypass) wp-admin/includes/media.php | Displays the multi-file uploader message. |
| [media\_upload\_max\_image\_resize()](media_upload_max_image_resize) wp-admin/includes/media.php | Displays the checkbox to scale images. |
| [multisite\_over\_quota\_message()](multisite_over_quota_message) wp-admin/includes/media.php | Displays the out of storage quota message in Multisite. |
| [edit\_form\_image\_editor()](edit_form_image_editor) wp-admin/includes/media.php | Displays the image and editor in the post editor |
| [attachment\_submitbox\_metadata()](attachment_submitbox_metadata) wp-admin/includes/media.php | Displays non-editable attachment metadata in the publish meta box. |
| [get\_attachment\_fields\_to\_edit()](get_attachment_fields_to_edit) wp-admin/includes/media.php | Retrieves the attachment fields to edit form fields. |
| [get\_media\_item()](get_media_item) wp-admin/includes/media.php | Retrieves HTML form for modifying the image attachment. |
| [media\_upload\_form()](media_upload_form) wp-admin/includes/media.php | Outputs the legacy media upload form. |
| [wp\_media\_upload\_handler()](wp_media_upload_handler) wp-admin/includes/media.php | Handles the process of uploading media. |
| [media\_sideload\_image()](media_sideload_image) wp-admin/includes/media.php | Downloads an image from the specified URL, saves it as an attachment, and optionally attaches it to a post. |
| [image\_align\_input\_fields()](image_align_input_fields) wp-admin/includes/media.php | Retrieves HTML for the image alignment radio buttons with the specified one checked. |
| [image\_size\_input\_fields()](image_size_input_fields) wp-admin/includes/media.php | Retrieves HTML for the size radio buttons with the specified one checked. |
| [image\_link\_input\_fields()](image_link_input_fields) wp-admin/includes/media.php | Retrieves HTML for the Link URL buttons with the default link type as specified. |
| [media\_handle\_upload()](media_handle_upload) wp-admin/includes/media.php | Saves a file submitted from a POST request and create an attachment post for it. |
| [media\_buttons()](media_buttons) wp-admin/includes/media.php | Adds the media button to the editor. |
| [get\_sample\_permalink\_html()](get_sample_permalink_html) wp-admin/includes/post.php | Returns the HTML of the sample permalink slug editor. |
| [\_wp\_post\_thumbnail\_html()](_wp_post_thumbnail_html) wp-admin/includes/post.php | Returns HTML for the post thumbnail meta box. |
| [\_admin\_notice\_post\_locked()](_admin_notice_post_locked) wp-admin/includes/post.php | Outputs the HTML for the notice to say that someone else is editing or has taken over editing of this post. |
| [post\_preview()](post_preview) wp-admin/includes/post.php | Saves a draft or manually autosaves for the purpose of showing a post preview. |
| [wp\_autosave()](wp_autosave) wp-admin/includes/post.php | Saves a post submitted with XHR. |
| [media\_upload\_tabs()](media_upload_tabs) wp-admin/includes/media.php | Defines the default media upload tabs. |
| [update\_gallery\_tab()](update_gallery_tab) wp-admin/includes/media.php | Adds the gallery tab back to the tabs array if post has image attachments. |
| [wp\_write\_post()](wp_write_post) wp-admin/includes/post.php | Creates a new post from the “Write Post” form using `$_POST` information. |
| [\_wp\_translate\_postdata()](_wp_translate_postdata) wp-admin/includes/post.php | Renames `$_POST` data from form names to DB post columns. |
| [edit\_post()](edit_post) wp-admin/includes/post.php | Updates an existing post with values provided in `$_POST`. |
| [bulk\_edit\_posts()](bulk_edit_posts) wp-admin/includes/post.php | Processes the post data for the bulk editing of posts. |
| [get\_default\_post\_to\_edit()](get_default_post_to_edit) wp-admin/includes/post.php | Returns default post information to use when populating the “Write Post” form. |
| [wp\_ajax\_save\_widget()](wp_ajax_save_widget) wp-admin/includes/ajax-actions.php | Ajax handler for saving a widget. |
| [wp\_ajax\_upload\_attachment()](wp_ajax_upload_attachment) wp-admin/includes/ajax-actions.php | Ajax handler for uploading attachments |
| [wp\_ajax\_wp\_fullscreen\_save\_post()](wp_ajax_wp_fullscreen_save_post) wp-admin/includes/ajax-actions.php | Ajax handler for saving posts from the fullscreen editor. |
| [wp\_ajax\_add\_menu\_item()](wp_ajax_add_menu_item) wp-admin/includes/ajax-actions.php | Ajax handler for adding a menu item. |
| [wp\_ajax\_add\_meta()](wp_ajax_add_meta) wp-admin/includes/ajax-actions.php | Ajax handler for adding meta. |
| [wp\_ajax\_add\_user()](wp_ajax_add_user) wp-admin/includes/ajax-actions.php | Ajax handler for adding a user. |
| [wp\_ajax\_inline\_save()](wp_ajax_inline_save) wp-admin/includes/ajax-actions.php | Ajax handler for Quick Edit saving a post from a list table. |
| [wp\_ajax\_inline\_save\_tax()](wp_ajax_inline_save_tax) wp-admin/includes/ajax-actions.php | Ajax handler for quick edit saving for a term. |
| [wp\_ajax\_find\_posts()](wp_ajax_find_posts) wp-admin/includes/ajax-actions.php | Ajax handler for querying posts for the Find Posts modal. |
| [wp\_ajax\_dim\_comment()](wp_ajax_dim_comment) wp-admin/includes/ajax-actions.php | Ajax handler to dim a comment. |
| [wp\_ajax\_add\_tag()](wp_ajax_add_tag) wp-admin/includes/ajax-actions.php | Ajax handler to add a tag. |
| [wp\_ajax\_replyto\_comment()](wp_ajax_replyto_comment) wp-admin/includes/ajax-actions.php | Ajax handler for replying to a comment. |
| [wp\_ajax\_edit\_comment()](wp_ajax_edit_comment) wp-admin/includes/ajax-actions.php | Ajax handler for editing a comment. |
| [wp\_get\_revision\_ui\_diff()](wp_get_revision_ui_diff) wp-admin/includes/revision.php | Get the revision UI diff. |
| [wp\_prepare\_revisions\_for\_js()](wp_prepare_revisions_for_js) wp-admin/includes/revision.php | Prepare revisions for JavaScript. |
| [update\_core()](update_core) wp-admin/includes/update-core.php | Upgrades the core of WordPress. |
| [\_redirect\_to\_about\_wordpress()](_redirect_to_about_wordpress) wp-admin/includes/update-core.php | Redirect to the About WordPress page after a successful upgrade. |
| [post\_trackback\_meta\_box()](post_trackback_meta_box) wp-admin/includes/meta-boxes.php | Displays trackback links form fields. |
| [post\_custom\_meta\_box()](post_custom_meta_box) wp-admin/includes/meta-boxes.php | Displays custom fields form fields. |
| [post\_comment\_status\_meta\_box()](post_comment_status_meta_box) wp-admin/includes/meta-boxes.php | Displays comments status form fields. |
| [post\_comment\_meta\_box()](post_comment_meta_box) wp-admin/includes/meta-boxes.php | Displays comments for post. |
| [page\_attributes\_meta\_box()](page_attributes_meta_box) wp-admin/includes/meta-boxes.php | Displays page attributes form fields. |
| [link\_submit\_meta\_box()](link_submit_meta_box) wp-admin/includes/meta-boxes.php | Displays link create form fields. |
| [wp\_insert\_link()](wp_insert_link) wp-admin/includes/bookmark.php | Inserts a link into the database, or updates an existing link. |
| [wp\_link\_manager\_disabled\_message()](wp_link_manager_disabled_message) wp-admin/includes/bookmark.php | Outputs the ‘disabled’ message for the WordPress Link Manager. |
| [post\_submit\_meta\_box()](post_submit_meta_box) wp-admin/includes/meta-boxes.php | Displays post submit form fields. |
| [attachment\_submit\_meta\_box()](attachment_submit_meta_box) wp-admin/includes/meta-boxes.php | Displays attachment submit form fields. |
| [post\_categories\_meta\_box()](post_categories_meta_box) wp-admin/includes/meta-boxes.php | Displays post categories form fields. |
| [post\_excerpt\_meta\_box()](post_excerpt_meta_box) wp-admin/includes/meta-boxes.php | Displays post excerpt form fields. |
| [edit\_link()](edit_link) wp-admin/includes/bookmark.php | Updates or inserts a link using values provided in $\_POST. |
| [WP\_Media\_List\_Table::\_\_construct()](../classes/wp_media_list_table/__construct) wp-admin/includes/class-wp-media-list-table.php | Constructor. |
| [WP\_Media\_List\_Table::get\_views()](../classes/wp_media_list_table/get_views) wp-admin/includes/class-wp-media-list-table.php | |
| [WP\_Media\_List\_Table::get\_bulk\_actions()](../classes/wp_media_list_table/get_bulk_actions) wp-admin/includes/class-wp-media-list-table.php | |
| [WP\_Media\_List\_Table::extra\_tablenav()](../classes/wp_media_list_table/extra_tablenav) wp-admin/includes/class-wp-media-list-table.php | |
| [WP\_Media\_List\_Table::get\_columns()](../classes/wp_media_list_table/get_columns) wp-admin/includes/class-wp-media-list-table.php | |
| [WP\_Media\_List\_Table::\_get\_row\_actions()](../classes/wp_media_list_table/_get_row_actions) wp-admin/includes/class-wp-media-list-table.php | |
| [wpmu\_checkAvailableSpace()](wpmu_checkavailablespace) wp-admin/includes/ms-deprecated.php | Determines if the available space defined by the admin has been exceeded by the user. |
| [WP\_Post\_Comments\_List\_Table::get\_column\_info()](../classes/wp_post_comments_list_table/get_column_info) wp-admin/includes/class-wp-post-comments-list-table.php | |
| [WP\_Comments\_List\_Table::column\_date()](../classes/wp_comments_list_table/column_date) wp-admin/includes/class-wp-comments-list-table.php | |
| [WP\_Comments\_List\_Table::get\_bulk\_actions()](../classes/wp_comments_list_table/get_bulk_actions) wp-admin/includes/class-wp-comments-list-table.php | |
| [WP\_Comments\_List\_Table::extra\_tablenav()](../classes/wp_comments_list_table/extra_tablenav) wp-admin/includes/class-wp-comments-list-table.php | |
| [WP\_Comments\_List\_Table::get\_columns()](../classes/wp_comments_list_table/get_columns) wp-admin/includes/class-wp-comments-list-table.php | |
| [WP\_Comments\_List\_Table::column\_comment()](../classes/wp_comments_list_table/column_comment) wp-admin/includes/class-wp-comments-list-table.php | |
| [WP\_Terms\_List\_Table::column\_name()](../classes/wp_terms_list_table/column_name) wp-admin/includes/class-wp-terms-list-table.php | |
| [WP\_Terms\_List\_Table::column\_description()](../classes/wp_terms_list_table/column_description) wp-admin/includes/class-wp-terms-list-table.php | |
| [WP\_Terms\_List\_Table::\_\_construct()](../classes/wp_terms_list_table/__construct) wp-admin/includes/class-wp-terms-list-table.php | Constructor. |
| [WP\_Terms\_List\_Table::get\_bulk\_actions()](../classes/wp_terms_list_table/get_bulk_actions) wp-admin/includes/class-wp-terms-list-table.php | |
| [WP\_Terms\_List\_Table::get\_columns()](../classes/wp_terms_list_table/get_columns) wp-admin/includes/class-wp-terms-list-table.php | |
| [WP\_Terms\_List\_Table::column\_cb()](../classes/wp_terms_list_table/column_cb) wp-admin/includes/class-wp-terms-list-table.php | |
| [Walker\_Nav\_Menu\_Edit::start\_el()](../classes/walker_nav_menu_edit/start_el) wp-admin/includes/class-walker-nav-menu-edit.php | Start the element output. |
| [wp\_nav\_menu\_manage\_columns()](wp_nav_menu_manage_columns) wp-admin/includes/nav-menu.php | Returns the columns for the nav menus page. |
| [wp\_nav\_menu\_update\_menu\_items()](wp_nav_menu_update_menu_items) wp-admin/includes/nav-menu.php | Saves nav menu items |
| [wp\_nav\_menu\_setup()](wp_nav_menu_setup) wp-admin/includes/nav-menu.php | Register nav menu meta boxes and advanced menu items. |
| [wp\_nav\_menu\_item\_post\_type\_meta\_box()](wp_nav_menu_item_post_type_meta_box) wp-admin/includes/nav-menu.php | Displays a meta box for a post type menu item. |
| [wp\_nav\_menu\_item\_taxonomy\_meta\_box()](wp_nav_menu_item_taxonomy_meta_box) wp-admin/includes/nav-menu.php | Displays a meta box for a taxonomy menu item. |
| [wp\_get\_nav\_menu\_to\_edit()](wp_get_nav_menu_to_edit) wp-admin/includes/nav-menu.php | Returns the menu formatted to edit. |
| [WP\_Filesystem\_ftpsockets::\_\_construct()](../classes/wp_filesystem_ftpsockets/__construct) wp-admin/includes/class-wp-filesystem-ftpsockets.php | Constructor. |
| [WP\_Filesystem\_ftpsockets::connect()](../classes/wp_filesystem_ftpsockets/connect) wp-admin/includes/class-wp-filesystem-ftpsockets.php | Connects filesystem. |
| [request\_filesystem\_credentials()](request_filesystem_credentials) wp-admin/includes/file.php | Displays a form to the user to request for their FTP/SSH details in order to connect to the filesystem. |
| [validate\_file\_to\_edit()](validate_file_to_edit) wp-admin/includes/file.php | Makes sure that the file that was requested to be edited is allowed to be edited. |
| [download\_url()](download_url) wp-admin/includes/file.php | Downloads a URL to a local temporary file using the WordPress HTTP API. |
| [verify\_file\_md5()](verify_file_md5) wp-admin/includes/file.php | Calculates and compares the MD5 of a file to its expected value. |
| [unzip\_file()](unzip_file) wp-admin/includes/file.php | Unzips a specified ZIP file to a location on the filesystem via the WordPress Filesystem Abstraction. |
| [\_unzip\_file\_ziparchive()](_unzip_file_ziparchive) wp-admin/includes/file.php | Attempts to unzip an archive using the ZipArchive class. |
| [\_unzip\_file\_pclzip()](_unzip_file_pclzip) wp-admin/includes/file.php | Attempts to unzip an archive using the PclZip library. |
| [copy\_dir()](copy_dir) wp-admin/includes/file.php | Copies a directory from one location to another via the WordPress Filesystem Abstraction. |
| [WP\_Posts\_List\_Table::inline\_edit()](../classes/wp_posts_list_table/inline_edit) wp-admin/includes/class-wp-posts-list-table.php | Outputs the hidden row displayed when inline editing |
| [get\_file\_description()](get_file_description) wp-admin/includes/file.php | Gets the description for standard WordPress theme files. |
| [wp\_list\_widget\_controls()](wp_list_widget_controls) wp-admin/includes/widgets.php | Show the widgets and their settings for a sidebar. |
| [wp\_widget\_control()](wp_widget_control) wp-admin/includes/widgets.php | Meta widget used to display the control form for a widget. |
| [WP\_Posts\_List\_Table::get\_bulk\_actions()](../classes/wp_posts_list_table/get_bulk_actions) wp-admin/includes/class-wp-posts-list-table.php | |
| [WP\_Posts\_List\_Table::extra\_tablenav()](../classes/wp_posts_list_table/extra_tablenav) wp-admin/includes/class-wp-posts-list-table.php | |
| [WP\_Posts\_List\_Table::get\_columns()](../classes/wp_posts_list_table/get_columns) wp-admin/includes/class-wp-posts-list-table.php | |
| [wp\_import\_handle\_upload()](wp_import_handle_upload) wp-admin/includes/import.php | Handles importer uploading and adds attachment. |
| [wp\_get\_popular\_importers()](wp_get_popular_importers) wp-admin/includes/import.php | Returns a list from WordPress.org of popular importer plugins. |
| [edit\_comment()](edit_comment) wp-admin/includes/comment.php | Updates a comment with values provided in $\_POST. |
| [options\_reading\_blog\_charset()](options_reading_blog_charset) wp-admin/includes/options.php | Render the site charset setting. |
| [admin\_created\_user\_email()](admin_created_user_email) wp-admin/includes/user.php | |
| [Custom\_Image\_Header::ajax\_header\_crop()](../classes/custom_image_header/ajax_header_crop) wp-admin/includes/class-custom-image-header.php | Gets attachment uploaded by Media Manager, crops it, then saves it as a new object. Returns JSON-encoded object details. |
| [Custom\_Image\_Header::step\_1()](../classes/custom_image_header/step_1) wp-admin/includes/class-custom-image-header.php | Display first step of custom header image page. |
| [Custom\_Image\_Header::step\_2()](../classes/custom_image_header/step_2) wp-admin/includes/class-custom-image-header.php | Display second step of custom header image page. |
| [Custom\_Image\_Header::step\_2\_manage\_upload()](../classes/custom_image_header/step_2_manage_upload) wp-admin/includes/class-custom-image-header.php | Upload the file to be cropped in the second step. |
| [Custom\_Image\_Header::step\_3()](../classes/custom_image_header/step_3) wp-admin/includes/class-custom-image-header.php | Display third step of custom header image page. |
| [Custom\_Image\_Header::admin\_page()](../classes/custom_image_header/admin_page) wp-admin/includes/class-custom-image-header.php | Display the page based on the current step. |
| [Custom\_Image\_Header::init()](../classes/custom_image_header/init) wp-admin/includes/class-custom-image-header.php | Set up the hooks for the Custom Header admin page. |
| [Custom\_Image\_Header::help()](../classes/custom_image_header/help) wp-admin/includes/class-custom-image-header.php | Adds contextual help. |
| [confirm\_delete\_users()](confirm_delete_users) wp-admin/includes/ms.php | |
| [list\_core\_update()](list_core_update) wp-admin/update-core.php | Lists available core updates. |
| [dismissed\_updates()](dismissed_updates) wp-admin/update-core.php | Display dismissed updates. |
| [core\_upgrade\_preamble()](core_upgrade_preamble) wp-admin/update-core.php | Display upgrade WordPress for downloading latest or upgrading automatically form. |
| [list\_plugin\_updates()](list_plugin_updates) wp-admin/update-core.php | Display the upgrade plugins form. |
| [list\_theme\_updates()](list_theme_updates) wp-admin/update-core.php | Display the upgrade themes form. |
| [list\_translation\_updates()](list_translation_updates) wp-admin/update-core.php | Display the update translations form. |
| [do\_core\_upgrade()](do_core_upgrade) wp-admin/update-core.php | Upgrade WordPress core display. |
| [Custom\_Background::wp\_set\_background\_image()](../classes/custom_background/wp_set_background_image) wp-admin/includes/class-custom-background.php | |
| [\_add\_themes\_utility\_last()](_add_themes_utility_last) wp-admin/menu.php | Adds the ‘Theme File Editor’ menu item to the bottom of the Appearance (non-block themes) or Tools (block themes) menu. |
| [Custom\_Background::init()](../classes/custom_background/init) wp-admin/includes/class-custom-background.php | Sets up the hooks for the Custom Background admin page. |
| [Custom\_Background::admin\_load()](../classes/custom_background/admin_load) wp-admin/includes/class-custom-background.php | Sets up the enqueue for the CSS & JavaScript files. |
| [Custom\_Background::admin\_page()](../classes/custom_background/admin_page) wp-admin/includes/class-custom-background.php | Displays the custom background page. |
| [Custom\_Background::handle\_upload()](../classes/custom_background/handle_upload) wp-admin/includes/class-custom-background.php | Handles an Image upload for the background image. |
| [\_wp\_menu\_output()](_wp_menu_output) wp-admin/menu-header.php | Display menu. |
| [WP\_User::has\_cap()](../classes/wp_user/has_cap) wp-includes/class-wp-user.php | Returns whether the user has the specified capability. |
| [WP\_User::\_\_isset()](../classes/wp_user/__isset) wp-includes/class-wp-user.php | Magic method for checking the existence of a certain custom field. |
| [WP\_User::\_\_get()](../classes/wp_user/__get) wp-includes/class-wp-user.php | Magic method for accessing custom fields. |
| [WP\_User::\_\_set()](../classes/wp_user/__set) wp-includes/class-wp-user.php | Magic method for setting custom user fields. |
| [WP\_Customize\_Manager::register\_controls()](../classes/wp_customize_manager/register_controls) wp-includes/class-wp-customize-manager.php | Registers some default controls. |
| [map\_meta\_cap()](map_meta_cap) wp-includes/capabilities.php | Maps a capability to the primitive capabilities required of the given user to satisfy the capability being checked. |
| [WP\_Customize\_Manager::customize\_preview\_init()](../classes/wp_customize_manager/customize_preview_init) wp-includes/class-wp-customize-manager.php | Prints JavaScript settings. |
| [WP\_Customize\_Manager::customize\_preview\_settings()](../classes/wp_customize_manager/customize_preview_settings) wp-includes/class-wp-customize-manager.php | Prints JavaScript settings for preview frame. |
| [WP\_Customize\_Manager::save()](../classes/wp_customize_manager/save) wp-includes/class-wp-customize-manager.php | Handles customize\_save WP Ajax request to save/update a changeset. |
| [WP\_Customize\_Manager::wp\_die()](../classes/wp_customize_manager/wp_die) wp-includes/class-wp-customize-manager.php | Custom wp\_die wrapper. Returns either the standard message for UI or the Ajax message. |
| [WP\_Customize\_Manager::setup\_theme()](../classes/wp_customize_manager/setup_theme) wp-includes/class-wp-customize-manager.php | Starts preview and customize theme. |
| [wp\_schedule\_event()](wp_schedule_event) wp-includes/cron.php | Schedules a recurring event. |
| [wp\_reschedule\_event()](wp_reschedule_event) wp-includes/cron.php | Reschedules a recurring event. |
| [wp\_unschedule\_event()](wp_unschedule_event) wp-includes/cron.php | Unschedule a previously scheduled event. |
| [wp\_clear\_scheduled\_hook()](wp_clear_scheduled_hook) wp-includes/cron.php | Unschedules all events attached to the hook with the specified arguments. |
| [\_set\_cron\_array()](_set_cron_array) wp-includes/cron.php | Updates the cron option with the new cron array. |
| [wp\_get\_schedules()](wp_get_schedules) wp-includes/cron.php | Retrieve supported event recurrence schedules. |
| [wp\_schedule\_single\_event()](wp_schedule_single_event) wp-includes/cron.php | Schedules an event to run only once. |
| [Walker\_Category::start\_el()](../classes/walker_category/start_el) wp-includes/class-walker-category.php | Starts the element output. |
| [the\_tags()](the_tags) wp-includes/category-template.php | Displays the tags for a post. |
| [get\_the\_category\_list()](get_the_category_list) wp-includes/category-template.php | Retrieves category list for a post in either HTML list or custom format. |
| [wp\_dropdown\_categories()](wp_dropdown_categories) wp-includes/category-template.php | Displays or retrieves the HTML dropdown list of categories. |
| [wp\_list\_categories()](wp_list_categories) wp-includes/category-template.php | Displays or retrieves the HTML list of categories. |
| [add\_theme\_support()](add_theme_support) wp-includes/theme.php | Registers theme support for a given feature. |
| [\_wp\_customize\_loader\_settings()](_wp_customize_loader_settings) wp-includes/theme.php | Adds settings for the customize-loader script. |
| [sanitize\_option()](sanitize_option) wp-includes/formatting.php | Sanitizes various option values based on the nature of the option. |
| [wp\_sprintf\_l()](wp_sprintf_l) wp-includes/formatting.php | Localizes list items before the rest of the content. |
| [wp\_trim\_words()](wp_trim_words) wp-includes/formatting.php | Trims text to a certain number of words. |
| [wp\_password\_change\_notification()](wp_password_change_notification) wp-includes/pluggable.php | Notifies the blog admin of a user changing password, normally via email. |
| [wp\_new\_user\_notification()](wp_new_user_notification) wp-includes/pluggable.php | Emails login credentials to a newly-registered user. |
| [wp\_salt()](wp_salt) wp-includes/pluggable.php | Returns a salt to add to hashes. |
| [wp\_redirect()](wp_redirect) wp-includes/pluggable.php | Redirects to another page. |
| [wp\_notify\_postauthor()](wp_notify_postauthor) wp-includes/pluggable.php | Notifies an author (and/or others) of a comment/trackback/pingback on a post. |
| [wp\_notify\_moderator()](wp_notify_moderator) wp-includes/pluggable.php | Notifies the moderator of the site about a new comment that is awaiting approval. |
| [check\_admin\_referer()](check_admin_referer) wp-includes/pluggable.php | Ensures intent by verifying that a user was referred from another admin page with the correct security nonce. |
| [check\_ajax\_referer()](check_ajax_referer) wp-includes/pluggable.php | Verifies the Ajax request to prevent processing requests external of the blog. |
| [wp\_authenticate()](wp_authenticate) wp-includes/pluggable.php | Authenticates a user, confirming the login credentials are valid. |
| [paginate\_links()](paginate_links) wp-includes/general-template.php | Retrieves paginated links for archive post pages. |
| [feed\_links()](feed_links) wp-includes/general-template.php | Displays the links to the general feeds. |
| [feed\_links\_extra()](feed_links_extra) wp-includes/general-template.php | Displays the links to the extra feeds such as category feeds. |
| [wp\_get\_archives()](wp_get_archives) wp-includes/general-template.php | Displays archive links based on type and format. |
| [get\_calendar()](get_calendar) wp-includes/general-template.php | Displays calendar with days that have posts as links. |
| [get\_bloginfo()](get_bloginfo) wp-includes/general-template.php | Retrieves information about the current site. |
| [wp\_title()](wp_title) wp-includes/general-template.php | Displays or retrieves page title for all areas of blog. |
| [wp\_loginout()](wp_loginout) wp-includes/general-template.php | Displays the Log In/Out link. |
| [wp\_login\_form()](wp_login_form) wp-includes/general-template.php | Provides a simple login form for use anywhere within WordPress. |
| [wp\_register()](wp_register) wp-includes/general-template.php | Displays the Registration or Admin link. |
| [wp\_explain\_nonce()](wp_explain_nonce) wp-includes/deprecated.php | Retrieve nonce action “Are you sure” message. |
| [wp\_load\_image()](wp_load_image) wp-includes/deprecated.php | Load an image from a string, if PHP supports it. |
| [get\_boundary\_post\_rel\_link()](get_boundary_post_rel_link) wp-includes/deprecated.php | Get boundary post relational link. |
| [wp\_admin\_bar\_dashboard\_view\_site\_menu()](wp_admin_bar_dashboard_view_site_menu) wp-includes/deprecated.php | Add the “Dashboard”/”Visit Site” menu. |
| [get\_the\_attachment\_link()](get_the_attachment_link) wp-includes/deprecated.php | Retrieve HTML content of attachment image with link. |
| [dropdown\_cats()](dropdown_cats) wp-includes/deprecated.php | Deprecated method for generating a drop-down of categories. |
| [get\_links()](get_links) wp-includes/deprecated.php | Gets the links associated with category by ID. |
| [start\_wp()](start_wp) wp-includes/deprecated.php | Sets up the WordPress Loop. |
| [WP\_Theme::markup\_header()](../classes/wp_theme/markup_header) wp-includes/class-wp-theme.php | Marks up a theme header. |
| [WP\_Theme::translate\_header()](../classes/wp_theme/translate_header) wp-includes/class-wp-theme.php | Translates a theme header. |
| [WP\_Theme::\_\_construct()](../classes/wp_theme/__construct) wp-includes/class-wp-theme.php | Constructor for [WP\_Theme](../classes/wp_theme). |
| [WP::parse\_request()](../classes/wp/parse_request) wp-includes/class-wp.php | Parses the request to find the correct WordPress query. |
| [WP\_Query::get\_posts()](../classes/wp_query/get_posts) wp-includes/class-wp-query.php | Retrieves an array of posts based on query variables. |
| [is\_preview()](is_preview) wp-includes/query.php | Determines whether the query is for a post or page preview. |
| [is\_robots()](is_robots) wp-includes/query.php | Is the query for the robots.txt file? |
| [is\_search()](is_search) wp-includes/query.php | Determines whether the query is for a search. |
| [is\_single()](is_single) wp-includes/query.php | Determines whether the query is for an existing single post. |
| [is\_singular()](is_singular) wp-includes/query.php | Determines whether the query is for an existing single post of any post type (post, attachment, page, custom post types). |
| [is\_time()](is_time) wp-includes/query.php | Determines whether the query is for a specific time. |
| [is\_trackback()](is_trackback) wp-includes/query.php | Determines whether the query is for a trackback endpoint call. |
| [is\_year()](is_year) wp-includes/query.php | Determines whether the query is for an existing year archive. |
| [is\_404()](is_404) wp-includes/query.php | Determines whether the query has resulted in a 404 (returns no results). |
| [is\_main\_query()](is_main_query) wp-includes/query.php | Determines whether the query is the main query. |
| [is\_attachment()](is_attachment) wp-includes/query.php | Determines whether the query is for an existing attachment page. |
| [is\_author()](is_author) wp-includes/query.php | Determines whether the query is for an existing author archive page. |
| [is\_category()](is_category) wp-includes/query.php | Determines whether the query is for an existing category archive page. |
| [is\_tag()](is_tag) wp-includes/query.php | Determines whether the query is for an existing tag archive page. |
| [is\_tax()](is_tax) wp-includes/query.php | Determines whether the query is for an existing custom taxonomy archive page. |
| [is\_date()](is_date) wp-includes/query.php | Determines whether the query is for an existing date archive. |
| [is\_day()](is_day) wp-includes/query.php | Determines whether the query is for an existing day archive. |
| [is\_feed()](is_feed) wp-includes/query.php | Determines whether the query is for a feed. |
| [is\_comment\_feed()](is_comment_feed) wp-includes/query.php | Is the query for a comments feed? |
| [is\_month()](is_month) wp-includes/query.php | Determines whether the query is for an existing month archive. |
| [is\_page()](is_page) wp-includes/query.php | Determines whether the query is for an existing single page. |
| [is\_paged()](is_paged) wp-includes/query.php | Determines whether the query is for a paged result and not for the first page. |
| [is\_front\_page()](is_front_page) wp-includes/query.php | Determines whether the query is for the front page of the site. |
| [is\_home()](is_home) wp-includes/query.php | Determines whether the query is for the blog homepage. |
| [is\_archive()](is_archive) wp-includes/query.php | Determines whether the query is for an existing archive page. |
| [is\_post\_type\_archive()](is_post_type_archive) wp-includes/query.php | Determines whether the query is for an existing post type archive page. |
| [WP\_Image\_Editor\_Imagick::update\_size()](../classes/wp_image_editor_imagick/update_size) wp-includes/class-wp-image-editor-imagick.php | Sets or updates current image size. |
| [WP\_Image\_Editor\_Imagick::resize()](../classes/wp_image_editor_imagick/resize) wp-includes/class-wp-image-editor-imagick.php | Resizes current image. |
| [get\_categories()](get_categories) wp-includes/category.php | Retrieves a list of category objects. |
| [WP\_Image\_Editor\_Imagick::load()](../classes/wp_image_editor_imagick/load) wp-includes/class-wp-image-editor-imagick.php | Loads image from $this->file into new Imagick Object. |
| [wp\_check\_php\_mysql\_versions()](wp_check_php_mysql_versions) wp-includes/load.php | Check for the required PHP version, and the MySQL extension or a database drop-in. |
| [wp\_maintenance()](wp_maintenance) wp-includes/load.php | Die with a maintenance message when conditions are met. |
| [wp\_set\_wpdb\_vars()](wp_set_wpdb_vars) wp-includes/load.php | Set the database table prefix and the format specifiers for database table columns. |
| [wp\_not\_installed()](wp_not_installed) wp-includes/load.php | Redirect to the installer if WordPress is not installed. |
| [WP\_Http::handle\_redirects()](../classes/wp_http/handle_redirects) wp-includes/class-wp-http.php | Handles an HTTP redirect and follows it if appropriate. |
| [WP\_Http\_Streams::request()](../classes/wp_http_streams/request) wp-includes/class-wp-http-streams.php | Send a HTTP request to a URI using PHP Streams. |
| [WP\_Http\_Curl::request()](../classes/wp_http_curl/request) wp-includes/class-wp-http-curl.php | Send a HTTP request to a URI using cURL extension. |
| [WP\_Http::\_dispatch\_request()](../classes/wp_http/_dispatch_request) wp-includes/class-wp-http.php | Dispatches a HTTP request to a supporting transport. |
| [WP\_Http::request()](../classes/wp_http/request) wp-includes/class-wp-http.php | Send an HTTP request to a URI. |
| [wp\_deregister\_script()](wp_deregister_script) wp-includes/functions.wp-scripts.php | Remove a registered script. |
| [wp\_timezone\_choice()](wp_timezone_choice) wp-includes/functions.php | Gives a nicely-formatted list of timezone strings. |
| [\_deprecated\_function()](_deprecated_function) wp-includes/functions.php | Marks a function as deprecated and inform when it has been used. |
| [\_deprecated\_file()](_deprecated_file) wp-includes/functions.php | Marks a file as deprecated and inform when it has been used. |
| [\_deprecated\_argument()](_deprecated_argument) wp-includes/functions.php | Marks a function argument as deprecated and inform when it has been used. |
| [\_doing\_it\_wrong()](_doing_it_wrong) wp-includes/functions.php | Marks something as being incorrectly called. |
| [wp\_send\_json()](wp_send_json) wp-includes/functions.php | Sends a JSON response back to an Ajax request. |
| [wp\_widgets\_add\_menu()](wp_widgets_add_menu) wp-includes/functions.php | Appends the Widgets menu to the themes main menu. |
| [dead\_db()](dead_db) wp-includes/functions.php | Loads custom DB error or display WordPress DB error. |
| [wp\_nonce\_ays()](wp_nonce_ays) wp-includes/functions.php | Displays “Are You Sure” message to confirm the action being taken. |
| [\_default\_wp\_die\_handler()](_default_wp_die_handler) wp-includes/functions.php | Kills WordPress execution and displays HTML page with an error message. |
| [wp\_upload\_bits()](wp_upload_bits) wp-includes/functions.php | Creates a file in the upload folder with given content. |
| [is\_blog\_installed()](is_blog_installed) wp-includes/functions.php | Determines whether WordPress is already installed. |
| [wp\_upload\_dir()](wp_upload_dir) wp-includes/functions.php | Returns an array containing the current upload directory’s path and URL. |
| [do\_feed()](do_feed) wp-includes/functions.php | Loads the feed template from the use of an action hook. |
| [WP\_Nav\_Menu\_Widget::\_\_construct()](../classes/wp_nav_menu_widget/__construct) wp-includes/widgets/class-wp-nav-menu-widget.php | Sets up a new Navigation Menu widget instance. |
| [WP\_Nav\_Menu\_Widget::widget()](../classes/wp_nav_menu_widget/widget) wp-includes/widgets/class-wp-nav-menu-widget.php | Outputs the content for the current Navigation Menu widget instance. |
| [WP\_Nav\_Menu\_Widget::form()](../classes/wp_nav_menu_widget/form) wp-includes/widgets/class-wp-nav-menu-widget.php | Outputs the settings form for the Navigation Menu widget. |
| [WP\_Widget\_Tag\_Cloud::\_\_construct()](../classes/wp_widget_tag_cloud/__construct) wp-includes/widgets/class-wp-widget-tag-cloud.php | Sets up a new Tag Cloud widget instance. |
| [WP\_Widget\_Tag\_Cloud::widget()](../classes/wp_widget_tag_cloud/widget) wp-includes/widgets/class-wp-widget-tag-cloud.php | Outputs the content for the current Tag Cloud widget instance. |
| [WP\_Widget\_RSS::\_\_construct()](../classes/wp_widget_rss/__construct) wp-includes/widgets/class-wp-widget-rss.php | Sets up a new RSS widget instance. |
| [WP\_Widget\_RSS::widget()](../classes/wp_widget_rss/widget) wp-includes/widgets/class-wp-widget-rss.php | Outputs the content for the current RSS widget instance. |
| [WP\_Widget\_Recent\_Comments::\_\_construct()](../classes/wp_widget_recent_comments/__construct) wp-includes/widgets/class-wp-widget-recent-comments.php | Sets up a new Recent Comments widget instance. |
| [WP\_Widget\_Recent\_Comments::widget()](../classes/wp_widget_recent_comments/widget) wp-includes/widgets/class-wp-widget-recent-comments.php | Outputs the content for the current Recent Comments widget instance. |
| [WP\_Widget\_Recent\_Posts::\_\_construct()](../classes/wp_widget_recent_posts/__construct) wp-includes/widgets/class-wp-widget-recent-posts.php | Sets up a new Recent Posts widget instance. |
| [WP\_Widget\_Recent\_Posts::widget()](../classes/wp_widget_recent_posts/widget) wp-includes/widgets/class-wp-widget-recent-posts.php | Outputs the content for the current Recent Posts widget instance. |
| [WP\_Widget\_Categories::\_\_construct()](../classes/wp_widget_categories/__construct) wp-includes/widgets/class-wp-widget-categories.php | Sets up a new Categories widget instance. |
| [WP\_Widget\_Categories::widget()](../classes/wp_widget_categories/widget) wp-includes/widgets/class-wp-widget-categories.php | Outputs the content for the current Categories widget instance. |
| [WP\_Widget\_Text::\_\_construct()](../classes/wp_widget_text/__construct) wp-includes/widgets/class-wp-widget-text.php | Sets up a new Text widget instance. |
| [WP\_Widget\_Calendar::\_\_construct()](../classes/wp_widget_calendar/__construct) wp-includes/widgets/class-wp-widget-calendar.php | Sets up a new Calendar widget instance. |
| [WP\_Widget\_Meta::\_\_construct()](../classes/wp_widget_meta/__construct) wp-includes/widgets/class-wp-widget-meta.php | Sets up a new Meta widget instance. |
| [WP\_Widget\_Meta::widget()](../classes/wp_widget_meta/widget) wp-includes/widgets/class-wp-widget-meta.php | Outputs the content for the current Meta widget instance. |
| [WP\_Widget\_Archives::\_\_construct()](../classes/wp_widget_archives/__construct) wp-includes/widgets/class-wp-widget-archives.php | Sets up a new Archives widget instance. |
| [WP\_Widget\_Archives::widget()](../classes/wp_widget_archives/widget) wp-includes/widgets/class-wp-widget-archives.php | Outputs the content for the current Archives widget instance. |
| [WP\_Widget\_Links::\_\_construct()](../classes/wp_widget_links/__construct) wp-includes/widgets/class-wp-widget-links.php | Sets up a new Links widget instance. |
| [WP\_Widget\_Search::\_\_construct()](../classes/wp_widget_search/__construct) wp-includes/widgets/class-wp-widget-search.php | Sets up a new Search widget instance. |
| [WP\_Widget\_Pages::\_\_construct()](../classes/wp_widget_pages/__construct) wp-includes/widgets/class-wp-widget-pages.php | Sets up a new Pages widget instance. |
| [WP\_Widget\_Pages::widget()](../classes/wp_widget_pages/widget) wp-includes/widgets/class-wp-widget-pages.php | Outputs the content for the current Pages widget instance. |
| [WP\_Locale::\_strings\_for\_pot()](../classes/wp_locale/_strings_for_pot) wp-includes/class-wp-locale.php | Registers date/time format strings for general POT. |
| [wp\_widget\_rss\_output()](wp_widget_rss_output) wp-includes/widgets.php | Display the RSS entries in a list. |
| [wp\_widget\_rss\_form()](wp_widget_rss_form) wp-includes/widgets.php | Display RSS widget options form. |
| [WP\_Locale::init()](../classes/wp_locale/init) wp-includes/class-wp-locale.php | Sets up the translated strings and object properties. |
| [WP\_Tax\_Query::clean\_query()](../classes/wp_tax_query/clean_query) wp-includes/class-wp-tax-query.php | Validates a single query. |
| [WP\_Tax\_Query::transform\_query()](../classes/wp_tax_query/transform_query) wp-includes/class-wp-tax-query.php | Transforms a single query, from one field to another. |
| [get\_term\_link()](get_term_link) wp-includes/taxonomy.php | Generates a permalink for a taxonomy term archive. |
| [get\_the\_taxonomies()](get_the_taxonomies) wp-includes/taxonomy.php | Retrieves all taxonomies associated with a post. |
| [is\_object\_in\_term()](is_object_in_term) wp-includes/taxonomy.php | Determines if the given object is associated with any of the given terms. |
| [wp\_update\_term()](wp_update_term) wp-includes/taxonomy.php | Updates term based on arguments provided. |
| [wp\_get\_object\_terms()](wp_get_object_terms) wp-includes/taxonomy.php | Retrieves the terms associated with the given object(s), in the supplied taxonomies. |
| [wp\_insert\_term()](wp_insert_term) wp-includes/taxonomy.php | Adds a new term to the database. |
| [wp\_set\_object\_terms()](wp_set_object_terms) wp-includes/taxonomy.php | Creates term and taxonomy relationships. |
| [wp\_remove\_object\_terms()](wp_remove_object_terms) wp-includes/taxonomy.php | Removes term(s) associated with a given object. |
| [get\_term\_children()](get_term_children) wp-includes/taxonomy.php | Merges all term children into a single array of their IDs. |
| [get\_terms()](get_terms) wp-includes/taxonomy.php | Retrieves the terms in a given taxonomy or list of taxonomies. |
| [create\_initial\_taxonomies()](create_initial_taxonomies) wp-includes/taxonomy.php | Creates the initial taxonomies. |
| [register\_taxonomy()](register_taxonomy) wp-includes/taxonomy.php | Creates or modifies a taxonomy object. |
| [get\_objects\_in\_term()](get_objects_in_term) wp-includes/taxonomy.php | Retrieves object IDs of valid taxonomy and term. |
| [get\_term()](get_term) wp-includes/taxonomy.php | Gets all term data from database by term ID. |
| [the\_shortlink()](the_shortlink) wp-includes/link-template.php | Displays the shortlink for a post. |
| [get\_next\_comments\_link()](get_next_comments_link) wp-includes/link-template.php | Retrieves the link to the next comments page. |
| [get\_previous\_comments\_link()](get_previous_comments_link) wp-includes/link-template.php | Retrieves the link to the previous comments page. |
| [get\_adjacent\_post\_link()](get_adjacent_post_link) wp-includes/link-template.php | Retrieves the adjacent post link. |
| [get\_next\_posts\_link()](get_next_posts_link) wp-includes/link-template.php | Retrieves the next posts page link. |
| [get\_previous\_posts\_link()](get_previous_posts_link) wp-includes/link-template.php | Retrieves the previous posts page link. |
| [get\_posts\_nav\_link()](get_posts_nav_link) wp-includes/link-template.php | Retrieves the post pages link navigation for previous and next pages. |
| [get\_adjacent\_post()](get_adjacent_post) wp-includes/link-template.php | Retrieves the adjacent post. |
| [get\_adjacent\_post\_rel\_link()](get_adjacent_post_rel_link) wp-includes/link-template.php | Retrieves the adjacent post relational link. |
| [edit\_post\_link()](edit_post_link) wp-includes/link-template.php | Displays the edit post link for post. |
| [edit\_comment\_link()](edit_comment_link) wp-includes/link-template.php | Displays the edit comment link with formatting. |
| [edit\_bookmark\_link()](edit_bookmark_link) wp-includes/link-template.php | Displays the edit bookmark link anchor content. |
| [edit\_term\_link()](edit_term_link) wp-includes/link-template.php | Displays or retrieves the edit term link with formatting. |
| [post\_comments\_feed\_link()](post_comments_feed_link) wp-includes/link-template.php | Displays the comment feed link for a post. |
| [WP\_Admin\_Bar::add\_node()](../classes/wp_admin_bar/add_node) wp-includes/class-wp-admin-bar.php | Adds a node to the menu. |
| [wp\_version\_check()](wp_version_check) wp-includes/update.php | Checks WordPress version against the newest version. |
| [wp\_update\_plugins()](wp_update_plugins) wp-includes/update.php | Checks for available updates to plugins based on the latest versions hosted on WordPress.org. |
| [wp\_update\_themes()](wp_update_themes) wp-includes/update.php | Checks for available updates to themes based on the latest versions hosted on WordPress.org. |
| [wp\_get\_update\_data()](wp_get_update_data) wp-includes/update.php | Collects counts and UI strings for available updates. |
| [wp\_add\_inline\_style()](wp_add_inline_style) wp-includes/functions.wp-styles.php | Add extra CSS styles to a registered stylesheet. |
| [do\_shortcode\_tag()](do_shortcode_tag) wp-includes/shortcodes.php | Regular Expression callable for [do\_shortcode()](do_shortcode) for calling shortcode hook. |
| [WP\_Image\_Editor::set\_quality()](../classes/wp_image_editor/set_quality) wp-includes/class-wp-image-editor.php | Sets Image Compression quality on a 1-100% scale. |
| [add\_shortcode()](add_shortcode) wp-includes/shortcodes.php | Adds a new shortcode. |
| [wp\_admin\_bar\_wp\_menu()](wp_admin_bar_wp_menu) wp-includes/admin-bar.php | Adds the WordPress logo menu. |
| [wp\_admin\_bar\_sidebar\_toggle()](wp_admin_bar_sidebar_toggle) wp-includes/admin-bar.php | Adds the sidebar toggle button. |
| [wp\_admin\_bar\_my\_account\_item()](wp_admin_bar_my_account_item) wp-includes/admin-bar.php | Adds the “My Account” item. |
| [wp\_admin\_bar\_my\_account\_menu()](wp_admin_bar_my_account_menu) wp-includes/admin-bar.php | Adds the “My Account” submenu items. |
| [wp\_admin\_bar\_site\_menu()](wp_admin_bar_site_menu) wp-includes/admin-bar.php | Adds the “Site Name” menu. |
| [wp\_admin\_bar\_my\_sites\_menu()](wp_admin_bar_my_sites_menu) wp-includes/admin-bar.php | Adds the “My Sites/[Site Name]” menu and all submenus. |
| [wp\_admin\_bar\_shortlink\_menu()](wp_admin_bar_shortlink_menu) wp-includes/admin-bar.php | Provides a shortlink. |
| [wp\_admin\_bar\_edit\_menu()](wp_admin_bar_edit_menu) wp-includes/admin-bar.php | Provides an edit link for posts and terms. |
| [wp\_admin\_bar\_appearance\_menu()](wp_admin_bar_appearance_menu) wp-includes/admin-bar.php | Adds appearance submenu items to the “Site Name” menu. |
| [wp\_admin\_bar\_search\_menu()](wp_admin_bar_search_menu) wp-includes/admin-bar.php | Adds search form. |
| [register\_uninstall\_hook()](register_uninstall_hook) wp-includes/plugin.php | Sets the uninstallation hook for a plugin. |
| [prep\_atom\_text\_construct()](prep_atom_text_construct) wp-includes/feed.php | Determines the type of a string of data with the data formatted. |
| [get\_wp\_title\_rss()](get_wp_title_rss) wp-includes/feed.php | Retrieves the blog title for the feed title. |
| [wp\_title\_rss()](wp_title_rss) wp-includes/feed.php | Displays the blog title for display of the feed title. |
| [update\_option()](update_option) wp-includes/option.php | Updates the value of an option that was already added. |
| [add\_option()](add_option) wp-includes/option.php | Adds a new option. |
| [get\_option()](get_option) wp-includes/option.php | Retrieves an option value based on an option name. |
| [wp\_protect\_special\_option()](wp_protect_special_option) wp-includes/option.php | Protects WordPress special option from being modified. |
| [WP\_User\_Query::prepare\_query()](../classes/wp_user_query/prepare_query) wp-includes/class-wp-user-query.php | Prepares the query variables. |
| [wp\_update\_user()](wp_update_user) wp-includes/user.php | Updates a user in the database. |
| [wp\_get\_user\_contact\_methods()](wp_get_user_contact_methods) wp-includes/user.php | Sets up the user contact methods. |
| [check\_password\_reset\_key()](check_password_reset_key) wp-includes/user.php | Retrieves a user row based on password reset key and login. |
| [register\_new\_user()](register_new_user) wp-includes/user.php | Handles registering a new user. |
| [wp\_insert\_user()](wp_insert_user) wp-includes/user.php | Inserts a user into the database. |
| [wp\_authenticate\_username\_password()](wp_authenticate_username_password) wp-includes/user.php | Authenticates a user, confirming the username and password are valid. |
| [wp\_authenticate\_cookie()](wp_authenticate_cookie) wp-includes/user.php | Authenticates the user using the WordPress auth cookie. |
| [wp\_authenticate\_spam\_check()](wp_authenticate_spam_check) wp-includes/user.php | For Multisite blogs, checks if the authenticated user has been marked as a spammer, or if the user’s primary blog has been marked as spam. |
| [\_walk\_bookmarks()](_walk_bookmarks) wp-includes/bookmark-template.php | The formatted output of a list of bookmarks. |
| [wp\_list\_bookmarks()](wp_list_bookmarks) wp-includes/bookmark-template.php | Retrieves or echoes all of the bookmarks. |
| [WP\_Image\_Editor\_GD::load()](../classes/wp_image_editor_gd/load) wp-includes/class-wp-image-editor-gd.php | Loads image from $this->file into new GD Resource. |
| [WP\_Image\_Editor\_GD::resize()](../classes/wp_image_editor_gd/resize) wp-includes/class-wp-image-editor-gd.php | Resizes current image. |
| [WP\_Image\_Editor\_GD::\_resize()](../classes/wp_image_editor_gd/_resize) wp-includes/class-wp-image-editor-gd.php | |
| [WP\_Image\_Editor\_GD::crop()](../classes/wp_image_editor_gd/crop) wp-includes/class-wp-image-editor-gd.php | Crops Image. |
| [WP\_Image\_Editor\_GD::rotate()](../classes/wp_image_editor_gd/rotate) wp-includes/class-wp-image-editor-gd.php | Rotates current image counter-clockwise by $angle. |
| [WP\_Image\_Editor\_GD::flip()](../classes/wp_image_editor_gd/flip) wp-includes/class-wp-image-editor-gd.php | Flips current image. |
| [WP\_Image\_Editor\_GD::\_save()](../classes/wp_image_editor_gd/_save) wp-includes/class-wp-image-editor-gd.php | |
| [Walker\_PageDropdown::start\_el()](../classes/walker_pagedropdown/start_el) wp-includes/class-walker-page-dropdown.php | Starts the element output. |
| [Walker\_Page::start\_el()](../classes/walker_page/start_el) wp-includes/class-walker-page.php | Outputs the beginning of the current element in the tree. |
| [wp\_get\_attachment\_link()](wp_get_attachment_link) wp-includes/post-template.php | Retrieves an attachment page link using an image or icon, if possible. |
| [get\_the\_password\_form()](get_the_password_form) wp-includes/post-template.php | Retrieves protected post password form content. |
| [wp\_post\_revision\_title()](wp_post_revision_title) wp-includes/post-template.php | Retrieves formatted date timestamp of a revision (linked to that revisions’s page). |
| [wp\_post\_revision\_title\_expanded()](wp_post_revision_title_expanded) wp-includes/post-template.php | Retrieves formatted date timestamp of a revision (linked to that revisions’s page). |
| [wp\_list\_post\_revisions()](wp_list_post_revisions) wp-includes/post-template.php | Displays a list of a post’s revisions. |
| [wp\_link\_pages()](wp_link_pages) wp-includes/post-template.php | The formatted output of a list of pages. |
| [wp\_list\_pages()](wp_list_pages) wp-includes/post-template.php | Retrieves or displays a list of pages (or hierarchical post type items) in list (li) format. |
| [wp\_page\_menu()](wp_page_menu) wp-includes/post-template.php | Displays or retrieves a list of pages with an optional home link. |
| [get\_the\_content()](get_the_content) wp-includes/post-template.php | Retrieves the post content. |
| [get\_the\_excerpt()](get_the_excerpt) wp-includes/post-template.php | Retrieves the post excerpt. |
| [get\_the\_title()](get_the_title) wp-includes/post-template.php | Retrieves the post title. |
| [wp\_get\_image\_editor()](wp_get_image_editor) wp-includes/media.php | Returns a [WP\_Image\_Editor](../classes/wp_image_editor) instance and loads file into it. |
| [wp\_prepare\_attachment\_for\_js()](wp_prepare_attachment_for_js) wp-includes/media.php | Prepares an attachment post object for JS, where it is expected to be JSON-encoded and fit into an Attachment model. |
| [wp\_enqueue\_media()](wp_enqueue_media) wp-includes/media.php | Enqueues all scripts, styles, settings, and templates necessary to use all media JS APIs. |
| [wp\_get\_attachment\_id3\_keys()](wp_get_attachment_id3_keys) wp-includes/media.php | Returns useful keys to use to lookup data from an attachment’s stored metadata. |
| [wp\_get\_recent\_posts()](wp_get_recent_posts) wp-includes/post.php | Retrieves a number of recent posts. |
| [wp\_insert\_post()](wp_insert_post) wp-includes/post.php | Inserts or update a post. |
| [wp\_update\_post()](wp_update_post) wp-includes/post.php | Updates a post with new post data. |
| [get\_post\_mime\_types()](get_post_mime_types) wp-includes/post.php | Gets default post mime types. |
| [get\_post\_statuses()](get_post_statuses) wp-includes/post.php | Retrieves all of the WordPress supported post statuses. |
| [get\_page\_statuses()](get_page_statuses) wp-includes/post.php | Retrieves all of the WordPress support page statuses. |
| [register\_post\_type()](register_post_type) wp-includes/post.php | Registers a post type. |
| [create\_initial\_post\_types()](create_initial_post_types) wp-includes/post.php | Creates the initial post types when ‘init’ action is fired. |
| [\_wp\_put\_post\_revision()](_wp_put_post_revision) wp-includes/revision.php | Inserts post data into the posts table as a post revision. |
| [\_show\_post\_preview()](_show_post_preview) wp-includes/revision.php | Filters the latest content for preview from the post autosave. |
| [\_wp\_post\_revision\_fields()](_wp_post_revision_fields) wp-includes/revision.php | Determines which fields of posts are to be saved in revisions. |
| [maybe\_add\_existing\_user\_to\_blog()](maybe_add_existing_user_to_blog) wp-includes/ms-functions.php | Adds a new user to a blog by visiting /newbloguser/{key}/. |
| [welcome\_user\_msg\_filter()](welcome_user_msg_filter) wp-includes/ms-functions.php | Ensures that the welcome message is not empty. Currently unused. |
| [wpmu\_welcome\_user\_notification()](wpmu_welcome_user_notification) wp-includes/ms-functions.php | Notifies a user that their account activation has been successful. |
| [upload\_is\_file\_too\_big()](upload_is_file_too_big) wp-includes/ms-functions.php | Checks whether an upload is too big. |
| [signup\_nonce\_check()](signup_nonce_check) wp-includes/ms-functions.php | Processes the signup nonce created in [signup\_nonce\_fields()](signup_nonce_fields) . |
| [install\_blog()](install_blog) wp-includes/ms-deprecated.php | Install an empty blog. |
| [wpmu\_activate\_signup()](wpmu_activate_signup) wp-includes/ms-functions.php | Activates a signup. |
| [wpmu\_create\_blog()](wpmu_create_blog) wp-includes/ms-functions.php | Creates a site. |
| [newblog\_notify\_siteadmin()](newblog_notify_siteadmin) wp-includes/ms-functions.php | Notifies the network admin that a new site has been activated. |
| [newuser\_notify\_siteadmin()](newuser_notify_siteadmin) wp-includes/ms-functions.php | Notifies the network admin that a new user has been activated. |
| [wpmu\_welcome\_notification()](wpmu_welcome_notification) wp-includes/ms-functions.php | Notifies the site administrator that their site activation was successful. |
| [wpmu\_validate\_user\_signup()](wpmu_validate_user_signup) wp-includes/ms-functions.php | Sanitizes and validates data required for a user sign-up. |
| [wpmu\_validate\_blog\_signup()](wpmu_validate_blog_signup) wp-includes/ms-functions.php | Processes new site registrations. |
| [wpmu\_signup\_blog\_notification()](wpmu_signup_blog_notification) wp-includes/ms-functions.php | Sends a confirmation request email to a user when they sign up for a new site. The new site will not become active until the confirmation link is clicked. |
| [wpmu\_signup\_user\_notification()](wpmu_signup_user_notification) wp-includes/ms-functions.php | Sends a confirmation request email to a user when they sign up for a new user account (without signing up for a site at the same time). The user account will not become active until the confirmation link is clicked. |
| [create\_empty\_blog()](create_empty_blog) wp-includes/ms-deprecated.php | Create an empty blog. |
| [add\_user\_to\_blog()](add_user_to_blog) wp-includes/ms-functions.php | Adds a user to a blog, along with specifying the user’s role. |
| [remove\_user\_from\_blog()](remove_user_from_blog) wp-includes/ms-functions.php | Removes a user from a blog. |
| [get\_user\_count()](get_user_count) wp-includes/user.php | Returns the number of active users in your installation. |
| [ms\_not\_installed()](ms_not_installed) wp-includes/ms-load.php | Displays a failure message. |
| [wpmu\_admin\_do\_redirect()](wpmu_admin_do_redirect) wp-includes/ms-deprecated.php | Redirect a user based on $\_GET or $\_POST arguments. |
| [ms\_site\_check()](ms_site_check) wp-includes/ms-load.php | Checks status of current blog. |
| [set\_post\_format()](set_post_format) wp-includes/post-formats.php | Assign a format to a post |
| [WP\_Scripts::localize()](../classes/wp_scripts/localize) wp-includes/class-wp-scripts.php | Localizes a script, only if the script has already been added. |
| [get\_the\_author\_link()](get_the_author_link) wp-includes/author-template.php | Retrieves either author’s link or author’s name. |
| [wp\_list\_authors()](wp_list_authors) wp-includes/author-template.php | Lists all the authors of the site, with several options available. |
| [the\_author()](the_author) wp-includes/author-template.php | Displays the name of the author of the current post. |
| [wp\_setup\_nav\_menu\_item()](wp_setup_nav_menu_item) wp-includes/nav-menu.php | Decorates a menu item object with the shared navigation menu item properties. |
| [wp\_update\_nav\_menu\_object()](wp_update_nav_menu_object) wp-includes/nav-menu.php | Saves the properties of a menu or create a new menu with those properties. |
| [wp\_update\_nav\_menu\_item()](wp_update_nav_menu_item) wp-includes/nav-menu.php | Saves the properties of a menu item or create a new one. |
| [register\_nav\_menus()](register_nav_menus) wp-includes/nav-menu.php | Registers navigation menu locations for a theme. |
| [AtomParser::parse()](../classes/atomparser/parse) wp-includes/atomlib.php | |
| [wp\_xmlrpc\_server::mt\_getPostCategories()](../classes/wp_xmlrpc_server/mt_getpostcategories) wp-includes/class-wp-xmlrpc-server.php | Retrieve post categories. |
| [wp\_xmlrpc\_server::mt\_setPostCategories()](../classes/wp_xmlrpc_server/mt_setpostcategories) wp-includes/class-wp-xmlrpc-server.php | Sets categories for a post. |
| [wp\_xmlrpc\_server::mt\_getTrackbackPings()](../classes/wp_xmlrpc_server/mt_gettrackbackpings) wp-includes/class-wp-xmlrpc-server.php | Retrieve trackbacks sent to a given post. |
| [wp\_xmlrpc\_server::mt\_publishPost()](../classes/wp_xmlrpc_server/mt_publishpost) wp-includes/class-wp-xmlrpc-server.php | Sets a post’s publish status to ‘publish’. |
| [wp\_xmlrpc\_server::pingback\_ping()](../classes/wp_xmlrpc_server/pingback_ping) wp-includes/class-wp-xmlrpc-server.php | Retrieves a pingback and registers it. |
| [wp\_xmlrpc\_server::pingback\_extensions\_getPingbacks()](../classes/wp_xmlrpc_server/pingback_extensions_getpingbacks) wp-includes/class-wp-xmlrpc-server.php | Retrieve array of URLs that pingbacked the given URL. |
| [wp\_xmlrpc\_server::mw\_editPost()](../classes/wp_xmlrpc_server/mw_editpost) wp-includes/class-wp-xmlrpc-server.php | Edit a post. |
| [wp\_xmlrpc\_server::mw\_getPost()](../classes/wp_xmlrpc_server/mw_getpost) wp-includes/class-wp-xmlrpc-server.php | Retrieve post. |
| [wp\_xmlrpc\_server::mw\_getRecentPosts()](../classes/wp_xmlrpc_server/mw_getrecentposts) wp-includes/class-wp-xmlrpc-server.php | Retrieve list of recent posts. |
| [wp\_xmlrpc\_server::mw\_getCategories()](../classes/wp_xmlrpc_server/mw_getcategories) wp-includes/class-wp-xmlrpc-server.php | Retrieve the list of categories on a given blog. |
| [wp\_xmlrpc\_server::mw\_newMediaObject()](../classes/wp_xmlrpc_server/mw_newmediaobject) wp-includes/class-wp-xmlrpc-server.php | Uploads a file, following your settings. |
| [wp\_xmlrpc\_server::mt\_getRecentPostTitles()](../classes/wp_xmlrpc_server/mt_getrecentposttitles) wp-includes/class-wp-xmlrpc-server.php | Retrieve the post titles of recent posts. |
| [wp\_xmlrpc\_server::mt\_getCategoryList()](../classes/wp_xmlrpc_server/mt_getcategorylist) wp-includes/class-wp-xmlrpc-server.php | Retrieve list of all categories on blog. |
| [wp\_xmlrpc\_server::blogger\_getUserInfo()](../classes/wp_xmlrpc_server/blogger_getuserinfo) wp-includes/class-wp-xmlrpc-server.php | Retrieve user’s data. |
| [wp\_xmlrpc\_server::blogger\_getPost()](../classes/wp_xmlrpc_server/blogger_getpost) wp-includes/class-wp-xmlrpc-server.php | Retrieve post. |
| [wp\_xmlrpc\_server::blogger\_getRecentPosts()](../classes/wp_xmlrpc_server/blogger_getrecentposts) wp-includes/class-wp-xmlrpc-server.php | Retrieve list of recent posts. |
| [wp\_xmlrpc\_server::blogger\_getTemplate()](../classes/wp_xmlrpc_server/blogger_gettemplate) wp-includes/class-wp-xmlrpc-server.php | Deprecated. |
| [wp\_xmlrpc\_server::blogger\_setTemplate()](../classes/wp_xmlrpc_server/blogger_settemplate) wp-includes/class-wp-xmlrpc-server.php | Deprecated. |
| [wp\_xmlrpc\_server::blogger\_newPost()](../classes/wp_xmlrpc_server/blogger_newpost) wp-includes/class-wp-xmlrpc-server.php | Creates new post. |
| [wp\_xmlrpc\_server::blogger\_editPost()](../classes/wp_xmlrpc_server/blogger_editpost) wp-includes/class-wp-xmlrpc-server.php | Edit a post. |
| [wp\_xmlrpc\_server::blogger\_deletePost()](../classes/wp_xmlrpc_server/blogger_deletepost) wp-includes/class-wp-xmlrpc-server.php | Remove a post. |
| [wp\_xmlrpc\_server::mw\_newPost()](../classes/wp_xmlrpc_server/mw_newpost) wp-includes/class-wp-xmlrpc-server.php | Create a new post. |
| [wp\_xmlrpc\_server::wp\_setOptions()](../classes/wp_xmlrpc_server/wp_setoptions) wp-includes/class-wp-xmlrpc-server.php | Update blog options. |
| [wp\_xmlrpc\_server::wp\_getMediaItem()](../classes/wp_xmlrpc_server/wp_getmediaitem) wp-includes/class-wp-xmlrpc-server.php | Retrieve a media item by ID |
| [wp\_xmlrpc\_server::wp\_getPostFormats()](../classes/wp_xmlrpc_server/wp_getpostformats) wp-includes/class-wp-xmlrpc-server.php | Retrieves a list of post formats used by the site. |
| [wp\_xmlrpc\_server::wp\_getPostType()](../classes/wp_xmlrpc_server/wp_getposttype) wp-includes/class-wp-xmlrpc-server.php | Retrieves a post type |
| [wp\_xmlrpc\_server::wp\_getRevisions()](../classes/wp_xmlrpc_server/wp_getrevisions) wp-includes/class-wp-xmlrpc-server.php | Retrieve revisions for a specific post. |
| [wp\_xmlrpc\_server::wp\_restoreRevision()](../classes/wp_xmlrpc_server/wp_restorerevision) wp-includes/class-wp-xmlrpc-server.php | Restore a post revision |
| [wp\_xmlrpc\_server::wp\_getMediaLibrary()](../classes/wp_xmlrpc_server/wp_getmedialibrary) wp-includes/class-wp-xmlrpc-server.php | Retrieves a collection of media library items (or attachments) |
| [wp\_xmlrpc\_server::wp\_getComments()](../classes/wp_xmlrpc_server/wp_getcomments) wp-includes/class-wp-xmlrpc-server.php | Retrieve comments. |
| [wp\_xmlrpc\_server::wp\_deleteComment()](../classes/wp_xmlrpc_server/wp_deletecomment) wp-includes/class-wp-xmlrpc-server.php | Delete a comment. |
| [wp\_xmlrpc\_server::wp\_editComment()](../classes/wp_xmlrpc_server/wp_editcomment) wp-includes/class-wp-xmlrpc-server.php | Edit comment. |
| [wp\_xmlrpc\_server::wp\_newComment()](../classes/wp_xmlrpc_server/wp_newcomment) wp-includes/class-wp-xmlrpc-server.php | Create new comment. |
| [wp\_xmlrpc\_server::wp\_getCommentStatusList()](../classes/wp_xmlrpc_server/wp_getcommentstatuslist) wp-includes/class-wp-xmlrpc-server.php | Retrieve all of the comment status. |
| [wp\_xmlrpc\_server::wp\_getCommentCount()](../classes/wp_xmlrpc_server/wp_getcommentcount) wp-includes/class-wp-xmlrpc-server.php | Retrieve comment count. |
| [wp\_xmlrpc\_server::wp\_getPostStatusList()](../classes/wp_xmlrpc_server/wp_getpoststatuslist) wp-includes/class-wp-xmlrpc-server.php | Retrieve post statuses. |
| [wp\_xmlrpc\_server::wp\_getPageStatusList()](../classes/wp_xmlrpc_server/wp_getpagestatuslist) wp-includes/class-wp-xmlrpc-server.php | Retrieve page statuses. |
| [wp\_xmlrpc\_server::wp\_getPageTemplates()](../classes/wp_xmlrpc_server/wp_getpagetemplates) wp-includes/class-wp-xmlrpc-server.php | Retrieve page templates. |
| [wp\_xmlrpc\_server::wp\_getPages()](../classes/wp_xmlrpc_server/wp_getpages) wp-includes/class-wp-xmlrpc-server.php | Retrieve Pages. |
| [wp\_xmlrpc\_server::wp\_deletePage()](../classes/wp_xmlrpc_server/wp_deletepage) wp-includes/class-wp-xmlrpc-server.php | Delete page. |
| [wp\_xmlrpc\_server::wp\_editPage()](../classes/wp_xmlrpc_server/wp_editpage) wp-includes/class-wp-xmlrpc-server.php | Edit page. |
| [wp\_xmlrpc\_server::wp\_getPageList()](../classes/wp_xmlrpc_server/wp_getpagelist) wp-includes/class-wp-xmlrpc-server.php | Retrieve page list. |
| [wp\_xmlrpc\_server::wp\_getAuthors()](../classes/wp_xmlrpc_server/wp_getauthors) wp-includes/class-wp-xmlrpc-server.php | Retrieve authors list. |
| [wp\_xmlrpc\_server::wp\_getTags()](../classes/wp_xmlrpc_server/wp_gettags) wp-includes/class-wp-xmlrpc-server.php | Get list of all tags |
| [wp\_xmlrpc\_server::wp\_newCategory()](../classes/wp_xmlrpc_server/wp_newcategory) wp-includes/class-wp-xmlrpc-server.php | Create new category. |
| [wp\_xmlrpc\_server::wp\_deleteCategory()](../classes/wp_xmlrpc_server/wp_deletecategory) wp-includes/class-wp-xmlrpc-server.php | Remove category. |
| [wp\_xmlrpc\_server::wp\_suggestCategories()](../classes/wp_xmlrpc_server/wp_suggestcategories) wp-includes/class-wp-xmlrpc-server.php | Retrieve category list. |
| [wp\_xmlrpc\_server::wp\_getComment()](../classes/wp_xmlrpc_server/wp_getcomment) wp-includes/class-wp-xmlrpc-server.php | Retrieve comment. |
| [wp\_xmlrpc\_server::wp\_getPosts()](../classes/wp_xmlrpc_server/wp_getposts) wp-includes/class-wp-xmlrpc-server.php | Retrieve posts. |
| [wp\_xmlrpc\_server::wp\_newTerm()](../classes/wp_xmlrpc_server/wp_newterm) wp-includes/class-wp-xmlrpc-server.php | Create a new term. |
| [wp\_xmlrpc\_server::wp\_editTerm()](../classes/wp_xmlrpc_server/wp_editterm) wp-includes/class-wp-xmlrpc-server.php | Edit a term. |
| [wp\_xmlrpc\_server::wp\_deleteTerm()](../classes/wp_xmlrpc_server/wp_deleteterm) wp-includes/class-wp-xmlrpc-server.php | Delete a term. |
| [wp\_xmlrpc\_server::wp\_getTerm()](../classes/wp_xmlrpc_server/wp_getterm) wp-includes/class-wp-xmlrpc-server.php | Retrieve a term. |
| [wp\_xmlrpc\_server::wp\_getTerms()](../classes/wp_xmlrpc_server/wp_getterms) wp-includes/class-wp-xmlrpc-server.php | Retrieve all terms for a taxonomy. |
| [wp\_xmlrpc\_server::wp\_getTaxonomy()](../classes/wp_xmlrpc_server/wp_gettaxonomy) wp-includes/class-wp-xmlrpc-server.php | Retrieve a taxonomy. |
| [wp\_xmlrpc\_server::wp\_getUser()](../classes/wp_xmlrpc_server/wp_getuser) wp-includes/class-wp-xmlrpc-server.php | Retrieve a user. |
| [wp\_xmlrpc\_server::wp\_getUsers()](../classes/wp_xmlrpc_server/wp_getusers) wp-includes/class-wp-xmlrpc-server.php | Retrieve users. |
| [wp\_xmlrpc\_server::wp\_getProfile()](../classes/wp_xmlrpc_server/wp_getprofile) wp-includes/class-wp-xmlrpc-server.php | Retrieve information about the requesting user. |
| [wp\_xmlrpc\_server::wp\_editProfile()](../classes/wp_xmlrpc_server/wp_editprofile) wp-includes/class-wp-xmlrpc-server.php | Edit user’s profile. |
| [wp\_xmlrpc\_server::wp\_getPage()](../classes/wp_xmlrpc_server/wp_getpage) wp-includes/class-wp-xmlrpc-server.php | Retrieve page. |
| [wp\_xmlrpc\_server::\_insert\_post()](../classes/wp_xmlrpc_server/_insert_post) wp-includes/class-wp-xmlrpc-server.php | Helper method for wp\_newPost() and wp\_editPost(), containing shared logic. |
| [wp\_xmlrpc\_server::wp\_editPost()](../classes/wp_xmlrpc_server/wp_editpost) wp-includes/class-wp-xmlrpc-server.php | Edit a post for any registered post type. |
| [wp\_xmlrpc\_server::wp\_deletePost()](../classes/wp_xmlrpc_server/wp_deletepost) wp-includes/class-wp-xmlrpc-server.php | Delete a post for any registered post type. |
| [wp\_xmlrpc\_server::wp\_getPost()](../classes/wp_xmlrpc_server/wp_getpost) wp-includes/class-wp-xmlrpc-server.php | Retrieve a post. |
| [wp\_xmlrpc\_server::minimum\_args()](../classes/wp_xmlrpc_server/minimum_args) wp-includes/class-wp-xmlrpc-server.php | Checks if the method received at least the minimum number of arguments. |
| [wp\_xmlrpc\_server::login()](../classes/wp_xmlrpc_server/login) wp-includes/class-wp-xmlrpc-server.php | Log user in. |
| [wp\_xmlrpc\_server::initialise\_blog\_option\_info()](../classes/wp_xmlrpc_server/initialise_blog_option_info) wp-includes/class-wp-xmlrpc-server.php | Set up blog options property. |
| [WP\_Customize\_Header\_Image\_Control::\_\_construct()](../classes/wp_customize_header_image_control/__construct) wp-includes/customize/class-wp-customize-header-image-control.php | Constructor. |
| [WP\_Customize\_Header\_Image\_Control::render\_content()](../classes/wp_customize_header_image_control/render_content) wp-includes/customize/class-wp-customize-header-image-control.php | |
| [ms\_subdomain\_constants()](ms_subdomain_constants) wp-includes/ms-default-constants.php | Defines Multisite subdomain constants and handles warnings and notices. |
| [WP\_Customize\_Background\_Image\_Control::\_\_construct()](../classes/wp_customize_background_image_control/__construct) wp-includes/customize/class-wp-customize-background-image-control.php | Constructor. |
| [WP\_Customize\_Color\_Control::\_\_construct()](../classes/wp_customize_color_control/__construct) wp-includes/customize/class-wp-customize-color-control.php | Constructor. |
| [WP\_Customize\_Control::render\_content()](../classes/wp_customize_control/render_content) wp-includes/class-wp-customize-control.php | Render the control’s content. |
| [wpdb::check\_database\_version()](../classes/wpdb/check_database_version) wp-includes/class-wpdb.php | Determines whether MySQL database is at least the required minimum version. |
| [wpdb::check\_connection()](../classes/wpdb/check_connection) wp-includes/class-wpdb.php | Checks that the connection to the database is still up. If not, try to reconnect. |
| [wpdb::query()](../classes/wpdb/query) wp-includes/class-wpdb.php | Performs a database query, using current database connection. |
| [wpdb::select()](../classes/wpdb/select) wp-includes/class-wpdb.php | Selects a database using the current or provided database connection. |
| [wpdb::\_real\_escape()](../classes/wpdb/_real_escape) wp-includes/class-wpdb.php | Real escape, using mysqli\_real\_escape\_string() or mysql\_real\_escape\_string(). |
| [wpdb::prepare()](../classes/wpdb/prepare) wp-includes/class-wpdb.php | Prepares a SQL query for safe execution. |
| [wpdb::print\_error()](../classes/wpdb/print_error) wp-includes/class-wpdb.php | Prints SQL/DB error. |
| [wpdb::db\_connect()](../classes/wpdb/db_connect) wp-includes/class-wpdb.php | Connects to and selects database. |
| [WP\_Widget::form()](../classes/wp_widget/form) wp-includes/class-wp-widget.php | Outputs the settings update form. |
| [the\_widget()](the_widget) wp-includes/widgets.php | Output an arbitrary widget as a template tag. |
| [Walker\_Comment::comment()](../classes/walker_comment/comment) wp-includes/class-walker-comment.php | Outputs a single comment. |
| [Walker\_Comment::html5\_comment()](../classes/walker_comment/html5_comment) wp-includes/class-walker-comment.php | Outputs a comment in the HTML5 format. |
| [register\_sidebars()](register_sidebars) wp-includes/widgets.php | Creates multiple sidebars. |
| [register\_sidebar()](register_sidebar) wp-includes/widgets.php | Builds the definition for a single sidebar and returns the ID. |
| [Walker\_Comment::ping()](../classes/walker_comment/ping) wp-includes/class-walker-comment.php | Outputs a pingback comment. |
| [get\_post\_reply\_link()](get_post_reply_link) wp-includes/comment-template.php | Retrieves HTML content for reply to post link. |
| [get\_cancel\_comment\_reply\_link()](get_cancel_comment_reply_link) wp-includes/comment-template.php | Retrieves HTML content for cancel comment reply link. |
| [comment\_form\_title()](comment_form_title) wp-includes/comment-template.php | Displays text based on comment reply status. |
| [comment\_form()](comment_form) wp-includes/comment-template.php | Outputs a complete commenting form for use within a template. |
| [comment\_type()](comment_type) wp-includes/comment-template.php | Displays the comment type of the current comment. |
| [trackback\_url()](trackback_url) wp-includes/comment-template.php | Displays the current post’s trackback URL. |
| [comments\_popup\_link()](comments_popup_link) wp-includes/comment-template.php | Displays the link to the comments for the current post ID. |
| [get\_comment\_reply\_link()](get_comment_reply_link) wp-includes/comment-template.php | Retrieves HTML content for reply to comment link. |
| [get\_comment\_text()](get_comment_text) wp-includes/comment-template.php | Retrieves the text of the current comment. |
| [get\_comment\_excerpt()](get_comment_excerpt) wp-includes/comment-template.php | Retrieves the excerpt of the given comment. |
| [get\_comment\_author()](get_comment_author) wp-includes/comment-template.php | Retrieves the author of the current comment. |
| [WP\_Customize\_Widgets::export\_preview\_data()](../classes/wp_customize_widgets/export_preview_data) wp-includes/class-wp-customize-widgets.php | Communicates the sidebars that appeared on the page at the very end of the page, and at the very end of the wp\_footer, |
| [WP\_Customize\_Widgets::enqueue\_scripts()](../classes/wp_customize_widgets/enqueue_scripts) wp-includes/class-wp-customize-widgets.php | Enqueues scripts and styles for Customizer panel and export data to JavaScript. |
| [WP\_Customize\_Widgets::output\_widget\_control\_templates()](../classes/wp_customize_widgets/output_widget_control_templates) wp-includes/class-wp-customize-widgets.php | Renders the widget form control templates into the DOM. |
| [WP\_Customize\_Widgets::customize\_register()](../classes/wp_customize_widgets/customize_register) wp-includes/class-wp-customize-widgets.php | Registers Customizer settings and controls for all sidebars and widgets. |
| [wp\_default\_scripts()](wp_default_scripts) wp-includes/script-loader.php | Registers all WordPress scripts. |
| [wp\_set\_comment\_status()](wp_set_comment_status) wp-includes/comment.php | Sets the status of a comment. |
| [wp\_update\_comment()](wp_update_comment) wp-includes/comment.php | Updates an existing comment in the database. |
| [get\_comment\_statuses()](get_comment_statuses) wp-includes/comment.php | Retrieves all of the WordPress supported comment statuses. |
| [wp\_allow\_comment()](wp_allow_comment) wp-includes/comment.php | Validates whether this comment is allowed to be made. |
| [register\_meta()](register_meta) wp-includes/meta.php | Registers a meta key. |
| [\_WP\_Editors::wp\_link\_query()](../classes/_wp_editors/wp_link_query) wp-includes/class-wp-editor.php | Performs post queries for internal linking. |
| [wp\_print\_media\_templates()](wp_print_media_templates) wp-includes/media-template.php | Prints the templates used in the media manager. |
| Version | Description |
| --- | --- |
| [2.1.0](https://developer.wordpress.org/reference/since/2.1.0/) | Introduced. |
| programming_docs |
wordpress wp_ajax_menu_quick_search() wp\_ajax\_menu\_quick\_search()
===============================
Ajax handler for menu quick searching.
File: `wp-admin/includes/ajax-actions.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/ajax-actions.php/)
```
function wp_ajax_menu_quick_search() {
if ( ! current_user_can( 'edit_theme_options' ) ) {
wp_die( -1 );
}
require_once ABSPATH . 'wp-admin/includes/nav-menu.php';
_wp_ajax_menu_quick_search( $_POST );
wp_die();
}
```
| Uses | Description |
| --- | --- |
| [\_wp\_ajax\_menu\_quick\_search()](_wp_ajax_menu_quick_search) wp-admin/includes/nav-menu.php | Prints the appropriate response to a menu quick search. |
| [current\_user\_can()](current_user_can) wp-includes/capabilities.php | Returns whether the current user has the specified capability. |
| [wp\_die()](wp_die) wp-includes/functions.php | Kills WordPress execution and displays HTML page with an error message. |
| Version | Description |
| --- | --- |
| [3.1.0](https://developer.wordpress.org/reference/since/3.1.0/) | Introduced. |
wordpress wp_ajax_get_permalink() wp\_ajax\_get\_permalink()
==========================
Ajax handler to retrieve a permalink.
File: `wp-admin/includes/ajax-actions.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/ajax-actions.php/)
```
function wp_ajax_get_permalink() {
check_ajax_referer( 'getpermalink', 'getpermalinknonce' );
$post_id = isset( $_POST['post_id'] ) ? (int) $_POST['post_id'] : 0;
wp_die( get_preview_post_link( $post_id ) );
}
```
| Uses | Description |
| --- | --- |
| [get\_preview\_post\_link()](get_preview_post_link) wp-includes/link-template.php | Retrieves the URL used for the post preview. |
| [check\_ajax\_referer()](check_ajax_referer) wp-includes/pluggable.php | Verifies the Ajax request to prevent processing requests external of the blog. |
| [wp\_die()](wp_die) wp-includes/functions.php | Kills WordPress execution and displays HTML page with an error message. |
| Version | Description |
| --- | --- |
| [3.1.0](https://developer.wordpress.org/reference/since/3.1.0/) | Introduced. |
wordpress iis7_add_rewrite_rule( string $filename, string $rewrite_rule ): bool iis7\_add\_rewrite\_rule( string $filename, string $rewrite\_rule ): bool
=========================================================================
Adds WordPress rewrite rule to the IIS 7+ configuration file.
`$filename` string Required The file path to the configuration file. `$rewrite_rule` string Required The XML fragment with URL Rewrite rule. bool
File: `wp-admin/includes/misc.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/misc.php/)
```
function iis7_add_rewrite_rule( $filename, $rewrite_rule ) {
if ( ! class_exists( 'DOMDocument', false ) ) {
return false;
}
// If configuration file does not exist then we create one.
if ( ! file_exists( $filename ) ) {
$fp = fopen( $filename, 'w' );
fwrite( $fp, '<configuration/>' );
fclose( $fp );
}
$doc = new DOMDocument();
$doc->preserveWhiteSpace = false;
if ( $doc->load( $filename ) === false ) {
return false;
}
$xpath = new DOMXPath( $doc );
// First check if the rule already exists as in that case there is no need to re-add it.
$wordpress_rules = $xpath->query( '/configuration/system.webServer/rewrite/rules/rule[starts-with(@name,\'wordpress\')] | /configuration/system.webServer/rewrite/rules/rule[starts-with(@name,\'WordPress\')]' );
if ( $wordpress_rules->length > 0 ) {
return true;
}
// Check the XPath to the rewrite rule and create XML nodes if they do not exist.
$xml_nodes = $xpath->query( '/configuration/system.webServer/rewrite/rules' );
if ( $xml_nodes->length > 0 ) {
$rules_node = $xml_nodes->item( 0 );
} else {
$rules_node = $doc->createElement( 'rules' );
$xml_nodes = $xpath->query( '/configuration/system.webServer/rewrite' );
if ( $xml_nodes->length > 0 ) {
$rewrite_node = $xml_nodes->item( 0 );
$rewrite_node->appendChild( $rules_node );
} else {
$rewrite_node = $doc->createElement( 'rewrite' );
$rewrite_node->appendChild( $rules_node );
$xml_nodes = $xpath->query( '/configuration/system.webServer' );
if ( $xml_nodes->length > 0 ) {
$system_web_server_node = $xml_nodes->item( 0 );
$system_web_server_node->appendChild( $rewrite_node );
} else {
$system_web_server_node = $doc->createElement( 'system.webServer' );
$system_web_server_node->appendChild( $rewrite_node );
$xml_nodes = $xpath->query( '/configuration' );
if ( $xml_nodes->length > 0 ) {
$config_node = $xml_nodes->item( 0 );
$config_node->appendChild( $system_web_server_node );
} else {
$config_node = $doc->createElement( 'configuration' );
$doc->appendChild( $config_node );
$config_node->appendChild( $system_web_server_node );
}
}
}
}
$rule_fragment = $doc->createDocumentFragment();
$rule_fragment->appendXML( $rewrite_rule );
$rules_node->appendChild( $rule_fragment );
$doc->encoding = 'UTF-8';
$doc->formatOutput = true;
saveDomDocument( $doc, $filename );
return true;
}
```
| Uses | Description |
| --- | --- |
| [saveDomDocument()](savedomdocument) wp-admin/includes/misc.php | Saves the XML document into a file. |
| Used By | Description |
| --- | --- |
| [iis7\_save\_url\_rewrite\_rules()](iis7_save_url_rewrite_rules) wp-admin/includes/misc.php | Updates the IIS web.config file with the current rules if it is writable. |
| Version | Description |
| --- | --- |
| [2.8.0](https://developer.wordpress.org/reference/since/2.8.0/) | Introduced. |
wordpress switch_to_locale( string $locale ): bool switch\_to\_locale( string $locale ): bool
==========================================
Switches the translations according to the given locale.
`$locale` string Required The locale. bool True on success, false on failure.
File: `wp-includes/l10n.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/l10n.php/)
```
function switch_to_locale( $locale ) {
/* @var WP_Locale_Switcher $wp_locale_switcher */
global $wp_locale_switcher;
return $wp_locale_switcher->switch_to_locale( $locale );
}
```
| Uses | Description |
| --- | --- |
| [WP\_Locale\_Switcher::switch\_to\_locale()](../classes/wp_locale_switcher/switch_to_locale) wp-includes/class-wp-locale-switcher.php | Switches the translations according to the given locale. |
| Used By | Description |
| --- | --- |
| [wpmu\_new\_site\_admin\_notification()](wpmu_new_site_admin_notification) wp-includes/ms-functions.php | Notifies the Multisite network administrator that a new site was created. |
| [WP\_Recovery\_Mode\_Email\_Service::send\_recovery\_mode\_email()](../classes/wp_recovery_mode_email_service/send_recovery_mode_email) wp-includes/class-wp-recovery-mode-email-service.php | Sends the Recovery Mode email to the site admin email address. |
| [\_wp\_privacy\_send\_erasure\_fulfillment\_notification()](_wp_privacy_send_erasure_fulfillment_notification) wp-includes/user.php | Notifies the user when their erasure request is fulfilled. |
| [wp\_send\_user\_request()](wp_send_user_request) wp-includes/user.php | Send a confirmation request email to confirm an action. |
| [wp\_privacy\_send\_personal\_data\_export\_email()](wp_privacy_send_personal_data_export_email) wp-admin/includes/privacy-tools.php | Send an email to the user with a link to the personal data export file |
| [update\_network\_option\_new\_admin\_email()](update_network_option_new_admin_email) wp-includes/ms-functions.php | Sends a confirmation request email when a change of network admin email address is attempted. |
| [WP\_Customize\_Selective\_Refresh::export\_preview\_data()](../classes/wp_customize_selective_refresh/export_preview_data) wp-includes/customize/class-wp-customize-selective-refresh.php | Exports data in preview after it has finished rendering so that partials can be added at runtime. |
| [retrieve\_password()](retrieve_password) wp-includes/user.php | Handles sending a password retrieval email to a user. |
| [update\_option\_new\_admin\_email()](update_option_new_admin_email) wp-admin/includes/misc.php | Sends a confirmation request email when a change of site admin email address is attempted. |
| [insert\_with\_markers()](insert_with_markers) wp-admin/includes/misc.php | Inserts an array of strings into a file (.htaccess), placing it between BEGIN and END markers. |
| [WP\_Customize\_Manager::customize\_preview\_settings()](../classes/wp_customize_manager/customize_preview_settings) wp-includes/class-wp-customize-manager.php | Prints JavaScript settings for preview frame. |
| [wp\_new\_user\_notification()](wp_new_user_notification) wp-includes/pluggable.php | Emails login credentials to a newly-registered user. |
| [wp\_notify\_postauthor()](wp_notify_postauthor) wp-includes/pluggable.php | Notifies an author (and/or others) of a comment/trackback/pingback on a post. |
| [wp\_notify\_moderator()](wp_notify_moderator) wp-includes/pluggable.php | Notifies the moderator of the site about a new comment that is awaiting approval. |
| [wp\_update\_user()](wp_update_user) wp-includes/user.php | Updates a user in the database. |
| [wpmu\_welcome\_user\_notification()](wpmu_welcome_user_notification) wp-includes/ms-functions.php | Notifies a user that their account activation has been successful. |
| [wpmu\_welcome\_notification()](wpmu_welcome_notification) wp-includes/ms-functions.php | Notifies the site administrator that their site activation was successful. |
| [wpmu\_signup\_blog\_notification()](wpmu_signup_blog_notification) wp-includes/ms-functions.php | Sends a confirmation request email to a user when they sign up for a new site. The new site will not become active until the confirmation link is clicked. |
| [wpmu\_signup\_user\_notification()](wpmu_signup_user_notification) wp-includes/ms-functions.php | Sends a confirmation request email to a user when they sign up for a new user account (without signing up for a site at the same time). The user account will not become active until the confirmation link is clicked. |
| [WP\_Customize\_Widgets::export\_preview\_data()](../classes/wp_customize_widgets/export_preview_data) wp-includes/class-wp-customize-widgets.php | Communicates the sidebars that appeared on the page at the very end of the page, and at the very end of the wp\_footer, |
| Version | Description |
| --- | --- |
| [4.7.0](https://developer.wordpress.org/reference/since/4.7.0/) | Introduced. |
wordpress install_plugins_favorites_form() install\_plugins\_favorites\_form()
===================================
Shows a username form for the favorites page.
File: `wp-admin/includes/plugin-install.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/plugin-install.php/)
```
function install_plugins_favorites_form() {
$user = get_user_option( 'wporg_favorites' );
$action = 'save_wporg_username_' . get_current_user_id();
?>
<p><?php _e( 'If you have marked plugins as favorites on WordPress.org, you can browse them here.' ); ?></p>
<form method="get">
<input type="hidden" name="tab" value="favorites" />
<p>
<label for="user"><?php _e( 'Your WordPress.org username:' ); ?></label>
<input type="search" id="user" name="user" value="<?php echo esc_attr( $user ); ?>" />
<input type="submit" class="button" value="<?php esc_attr_e( 'Get Favorites' ); ?>" />
<input type="hidden" id="wporg-username-nonce" name="_wpnonce" value="<?php echo esc_attr( wp_create_nonce( $action ) ); ?>" />
</p>
</form>
<?php
}
```
| Uses | Description |
| --- | --- |
| [esc\_attr\_e()](esc_attr_e) wp-includes/l10n.php | Displays translated text that has been escaped for safe use in an attribute. |
| [wp\_create\_nonce()](wp_create_nonce) wp-includes/pluggable.php | Creates a cryptographic token tied to a specific action, user, user session, and window of time. |
| [get\_user\_option()](get_user_option) wp-includes/user.php | Retrieves user option that can be either per Site or per Network. |
| [\_e()](_e) wp-includes/l10n.php | Displays translated text. |
| [esc\_attr()](esc_attr) wp-includes/formatting.php | Escaping for HTML attributes. |
| [get\_current\_user\_id()](get_current_user_id) wp-includes/user.php | Gets the current user’s ID. |
| Version | Description |
| --- | --- |
| [3.5.0](https://developer.wordpress.org/reference/since/3.5.0/) | Introduced. |
wordpress set_post_format( int|object $post, string $format ): array|WP_Error|false set\_post\_format( int|object $post, string $format ): array|WP\_Error|false
============================================================================
Assign a format to a post
`$post` int|object Required The post for which to assign a format. `$format` string Required A format to assign. Use an empty string or array to remove all formats from the post. array|[WP\_Error](../classes/wp_error)|false Array of affected term IDs on success. [WP\_Error](../classes/wp_error) on error.
See [Post Formats](https://wordpress.org/support/article/post-formats/#supported-formats) page for supported formats.
File: `wp-includes/post-formats.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/post-formats.php/)
```
function set_post_format( $post, $format ) {
$post = get_post( $post );
if ( ! $post ) {
return new WP_Error( 'invalid_post', __( 'Invalid post.' ) );
}
if ( ! empty( $format ) ) {
$format = sanitize_key( $format );
if ( 'standard' === $format || ! in_array( $format, get_post_format_slugs(), true ) ) {
$format = '';
} else {
$format = 'post-format-' . $format;
}
}
return wp_set_post_terms( $post->ID, $format, 'post_format' );
}
```
| Uses | Description |
| --- | --- |
| [wp\_set\_post\_terms()](wp_set_post_terms) wp-includes/post.php | Sets the terms for a post. |
| [get\_post\_format\_slugs()](get_post_format_slugs) wp-includes/post-formats.php | Retrieves the array of post format slugs. |
| [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. |
| [sanitize\_key()](sanitize_key) wp-includes/formatting.php | Sanitizes a string key. |
| [get\_post()](get_post) wp-includes/post.php | Retrieves post data given a post ID or post object. |
| [WP\_Error::\_\_construct()](../classes/wp_error/__construct) wp-includes/class-wp-error.php | Initializes the error. |
| Used By | Description |
| --- | --- |
| [WP\_REST\_Posts\_Controller::create\_item()](../classes/wp_rest_posts_controller/create_item) wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php | Creates a single post. |
| [WP\_REST\_Posts\_Controller::update\_item()](../classes/wp_rest_posts_controller/update_item) wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php | Updates a single post. |
| [edit\_post()](edit_post) wp-admin/includes/post.php | Updates an existing post with values provided in `$_POST`. |
| [bulk\_edit\_posts()](bulk_edit_posts) wp-admin/includes/post.php | Processes the post data for the bulk editing of posts. |
| [get\_default\_post\_to\_edit()](get_default_post_to_edit) wp-admin/includes/post.php | Returns default post information to use when populating the “Write Post” form. |
| [wp\_xmlrpc\_server::mw\_editPost()](../classes/wp_xmlrpc_server/mw_editpost) wp-includes/class-wp-xmlrpc-server.php | Edit a post. |
| [wp\_xmlrpc\_server::mw\_newPost()](../classes/wp_xmlrpc_server/mw_newpost) wp-includes/class-wp-xmlrpc-server.php | Create a new post. |
| [wp\_xmlrpc\_server::\_insert\_post()](../classes/wp_xmlrpc_server/_insert_post) wp-includes/class-wp-xmlrpc-server.php | Helper method for wp\_newPost() and wp\_editPost(), containing shared logic. |
| Version | Description |
| --- | --- |
| [3.1.0](https://developer.wordpress.org/reference/since/3.1.0/) | Introduced. |
wordpress rest_url( string $path = '', string $scheme = 'rest' ): string rest\_url( string $path = '', string $scheme = 'rest' ): string
===============================================================
Retrieves the URL to a REST endpoint.
Note: The returned URL is NOT escaped.
`$path` string Optional REST route. Default: `''`
`$scheme` string Optional Sanitization scheme. Default `'rest'`. Default: `'rest'`
string Full URL to the endpoint.
File: `wp-includes/rest-api.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/rest-api.php/)
```
function rest_url( $path = '', $scheme = 'rest' ) {
return get_rest_url( null, $path, $scheme );
}
```
| Uses | Description |
| --- | --- |
| [get\_rest\_url()](get_rest_url) wp-includes/rest-api.php | Retrieves the URL to a REST endpoint on a site. |
| Used By | Description |
| --- | --- |
| [WP\_REST\_Post\_Types\_Controller::prepare\_links()](../classes/wp_rest_post_types_controller/prepare_links) wp-includes/rest-api/endpoints/class-wp-rest-post-types-controller.php | Prepares links for the request. |
| [WP\_REST\_Taxonomies\_Controller::prepare\_links()](../classes/wp_rest_taxonomies_controller/prepare_links) wp-includes/rest-api/endpoints/class-wp-rest-taxonomies-controller.php | Prepares links for the request. |
| [WP\_REST\_Server::add\_image\_to\_index()](../classes/wp_rest_server/add_image_to_index) wp-includes/rest-api/class-wp-rest-server.php | Exposes an image through the WordPress REST API. |
| [WP\_REST\_Menu\_Items\_Controller::prepare\_links()](../classes/wp_rest_menu_items_controller/prepare_links) wp-includes/rest-api/endpoints/class-wp-rest-menu-items-controller.php | Prepares links for the request. |
| [WP\_REST\_Menu\_Items\_Controller::get\_schema\_links()](../classes/wp_rest_menu_items_controller/get_schema_links) wp-includes/rest-api/endpoints/class-wp-rest-menu-items-controller.php | Retrieves Link Description Objects that should be added to the Schema for the posts collection. |
| [WP\_REST\_Menu\_Items\_Controller::create\_item()](../classes/wp_rest_menu_items_controller/create_item) wp-includes/rest-api/endpoints/class-wp-rest-menu-items-controller.php | Creates a single post. |
| [WP\_REST\_Global\_Styles\_Controller::get\_theme\_item()](../classes/wp_rest_global_styles_controller/get_theme_item) wp-includes/rest-api/endpoints/class-wp-rest-global-styles-controller.php | Returns the given theme global styles config. |
| [WP\_REST\_Global\_Styles\_Controller::prepare\_links()](../classes/wp_rest_global_styles_controller/prepare_links) wp-includes/rest-api/endpoints/class-wp-rest-global-styles-controller.php | Prepares links for the request. |
| [WP\_REST\_Menus\_Controller::prepare\_links()](../classes/wp_rest_menus_controller/prepare_links) wp-includes/rest-api/endpoints/class-wp-rest-menus-controller.php | Prepares links for the request. |
| [WP\_REST\_Menus\_Controller::create\_item()](../classes/wp_rest_menus_controller/create_item) wp-includes/rest-api/endpoints/class-wp-rest-menus-controller.php | Creates a single term in a taxonomy. |
| [WP\_REST\_Menu\_Locations\_Controller::prepare\_links()](../classes/wp_rest_menu_locations_controller/prepare_links) wp-includes/rest-api/endpoints/class-wp-rest-menu-locations-controller.php | Prepares links for the request. |
| [WP\_REST\_Widgets\_Controller::prepare\_links()](../classes/wp_rest_widgets_controller/prepare_links) wp-includes/rest-api/endpoints/class-wp-rest-widgets-controller.php | Prepares links for the widget. |
| [WP\_REST\_Sidebars\_Controller::prepare\_links()](../classes/wp_rest_sidebars_controller/prepare_links) wp-includes/rest-api/endpoints/class-wp-rest-sidebars-controller.php | Prepares links for the sidebar. |
| [WP\_REST\_Templates\_Controller::prepare\_links()](../classes/wp_rest_templates_controller/prepare_links) wp-includes/rest-api/endpoints/class-wp-rest-templates-controller.php | Prepares links for the request. |
| [WP\_REST\_Templates\_Controller::create\_item()](../classes/wp_rest_templates_controller/create_item) wp-includes/rest-api/endpoints/class-wp-rest-templates-controller.php | Creates a single template. |
| [WP\_REST\_Widget\_Types\_Controller::prepare\_links()](../classes/wp_rest_widget_types_controller/prepare_links) wp-includes/rest-api/endpoints/class-wp-rest-widget-types-controller.php | Prepares links for the widget type. |
| [WP\_REST\_Server::add\_active\_theme\_link\_to\_index()](../classes/wp_rest_server/add_active_theme_link_to_index) wp-includes/rest-api/class-wp-rest-server.php | Adds a link to the active theme for users who have proper permissions. |
| [WP\_REST\_Themes\_Controller::prepare\_links()](../classes/wp_rest_themes_controller/prepare_links) wp-includes/rest-api/endpoints/class-wp-rest-themes-controller.php | Prepares links for the request. |
| [WP\_REST\_Application\_Passwords\_Controller::prepare\_links()](../classes/wp_rest_application_passwords_controller/prepare_links) wp-includes/rest-api/endpoints/class-wp-rest-application-passwords-controller.php | Prepares links for the request. |
| [WP\_REST\_Term\_Search\_Handler::prepare\_item\_links()](../classes/wp_rest_term_search_handler/prepare_item_links) wp-includes/rest-api/search/class-wp-rest-term-search-handler.php | Prepares links for the search result of a given ID. |
| [WP\_REST\_Block\_Directory\_Controller::prepare\_links()](../classes/wp_rest_block_directory_controller/prepare_links) wp-includes/rest-api/endpoints/class-wp-rest-block-directory-controller.php | Generates a list of links to include in the response for the plugin. |
| [WP\_REST\_Plugins\_Controller::prepare\_links()](../classes/wp_rest_plugins_controller/prepare_links) wp-includes/rest-api/endpoints/class-wp-rest-plugins-controller.php | Prepares links for the request. |
| [WP\_REST\_Plugins\_Controller::create\_item()](../classes/wp_rest_plugins_controller/create_item) wp-includes/rest-api/endpoints/class-wp-rest-plugins-controller.php | Uploads a plugin and optionally activates it. |
| [WP\_REST\_Block\_Types\_Controller::prepare\_links()](../classes/wp_rest_block_types_controller/prepare_links) wp-includes/rest-api/endpoints/class-wp-rest-block-types-controller.php | Prepares links for the request. |
| [WP\_REST\_Attachments\_Controller::edit\_media\_item()](../classes/wp_rest_attachments_controller/edit_media_item) wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php | Applies edits to a media item and creates a new attachment record. |
| [WP\_Site\_Health::get\_test\_rest\_availability()](../classes/wp_site_health/get_test_rest_availability) wp-admin/includes/class-wp-site-health.php | Tests if the REST API is accessible. |
| [WP\_Site\_Health::get\_tests()](../classes/wp_site_health/get_tests) wp-admin/includes/class-wp-site-health.php | Returns a set of tests that belong to the site status page. |
| [WP\_REST\_Search\_Controller::get\_items()](../classes/wp_rest_search_controller/get_items) wp-includes/rest-api/endpoints/class-wp-rest-search-controller.php | Retrieves a collection of search results. |
| [WP\_REST\_Search\_Controller::prepare\_item\_for\_response()](../classes/wp_rest_search_controller/prepare_item_for_response) wp-includes/rest-api/endpoints/class-wp-rest-search-controller.php | Prepares a single search result for response. |
| [WP\_REST\_Post\_Search\_Handler::prepare\_item\_links()](../classes/wp_rest_post_search_handler/prepare_item_links) wp-includes/rest-api/search/class-wp-rest-post-search-handler.php | Prepares links for the search result of a given ID. |
| [WP\_REST\_Posts\_Controller::get\_schema\_links()](../classes/wp_rest_posts_controller/get_schema_links) wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php | Retrieves Link Description Objects that should be added to the Schema for the posts collection. |
| [WP\_REST\_Users\_Controller::prepare\_links()](../classes/wp_rest_users_controller/prepare_links) wp-includes/rest-api/endpoints/class-wp-rest-users-controller.php | Prepares links for the user request. |
| [WP\_REST\_Users\_Controller::create\_item()](../classes/wp_rest_users_controller/create_item) wp-includes/rest-api/endpoints/class-wp-rest-users-controller.php | Creates a single user. |
| [WP\_REST\_Users\_Controller::get\_items()](../classes/wp_rest_users_controller/get_items) wp-includes/rest-api/endpoints/class-wp-rest-users-controller.php | Retrieves all users. |
| [WP\_REST\_Revisions\_Controller::prepare\_item\_for\_response()](../classes/wp_rest_revisions_controller/prepare_item_for_response) wp-includes/rest-api/endpoints/class-wp-rest-revisions-controller.php | Prepares the revision for the REST response. |
| [WP\_REST\_Revisions\_Controller::get\_items()](../classes/wp_rest_revisions_controller/get_items) wp-includes/rest-api/endpoints/class-wp-rest-revisions-controller.php | Gets a collection of revisions. |
| [WP\_REST\_Attachments\_Controller::create\_item()](../classes/wp_rest_attachments_controller/create_item) wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php | Creates a single attachment. |
| [WP\_REST\_Post\_Statuses\_Controller::prepare\_item\_for\_response()](../classes/wp_rest_post_statuses_controller/prepare_item_for_response) wp-includes/rest-api/endpoints/class-wp-rest-post-statuses-controller.php | Prepares a post status object for serialization. |
| [WP\_REST\_Terms\_Controller::prepare\_links()](../classes/wp_rest_terms_controller/prepare_links) wp-includes/rest-api/endpoints/class-wp-rest-terms-controller.php | Prepares links for the request. |
| [WP\_REST\_Terms\_Controller::create\_item()](../classes/wp_rest_terms_controller/create_item) wp-includes/rest-api/endpoints/class-wp-rest-terms-controller.php | Creates a single term in a taxonomy. |
| [WP\_REST\_Terms\_Controller::get\_items()](../classes/wp_rest_terms_controller/get_items) wp-includes/rest-api/endpoints/class-wp-rest-terms-controller.php | Retrieves terms associated with a taxonomy. |
| [WP\_REST\_Posts\_Controller::prepare\_links()](../classes/wp_rest_posts_controller/prepare_links) wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php | Prepares links for the request. |
| [WP\_REST\_Posts\_Controller::create\_item()](../classes/wp_rest_posts_controller/create_item) wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php | Creates a single post. |
| [WP\_REST\_Posts\_Controller::get\_items()](../classes/wp_rest_posts_controller/get_items) wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php | Retrieves a collection of posts. |
| [WP\_REST\_Comments\_Controller::prepare\_links()](../classes/wp_rest_comments_controller/prepare_links) wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php | Prepares links for the request. |
| [WP\_REST\_Comments\_Controller::create\_item()](../classes/wp_rest_comments_controller/create_item) wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php | Creates a comment. |
| [WP\_REST\_Comments\_Controller::get\_items()](../classes/wp_rest_comments_controller/get_items) wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php | Retrieves a list of comment items. |
| [WP\_REST\_Request::from\_url()](../classes/wp_rest_request/from_url) wp-includes/rest-api/class-wp-rest-request.php | Retrieves a [WP\_REST\_Request](../classes/wp_rest_request) object from a full URL. |
| [rest\_output\_link\_wp\_head()](rest_output_link_wp_head) wp-includes/rest-api.php | Outputs the REST API link tag into page header. |
| [rest\_output\_link\_header()](rest_output_link_header) wp-includes/rest-api.php | Sends a Link header for the REST API. |
| [get\_oembed\_endpoint\_url()](get_oembed_endpoint_url) wp-includes/embed.php | Retrieves the oEmbed endpoint URL for a given permalink. |
| [WP\_REST\_Server::get\_data\_for\_route()](../classes/wp_rest_server/get_data_for_route) wp-includes/rest-api/class-wp-rest-server.php | Retrieves publicly-visible data for the route. |
| [WP\_REST\_Server::get\_namespace\_index()](../classes/wp_rest_server/get_namespace_index) wp-includes/rest-api/class-wp-rest-server.php | Retrieves the index for a namespace. |
| [wp\_enqueue\_media()](wp_enqueue_media) wp-includes/media.php | Enqueues all scripts, styles, settings, and templates necessary to use all media JS APIs. |
| Version | Description |
| --- | --- |
| [4.4.0](https://developer.wordpress.org/reference/since/4.4.0/) | Introduced. |
| programming_docs |
wordpress get_the_post_thumbnail_url( int|WP_Post $post = null, string|int[] $size = 'post-thumbnail' ): string|false get\_the\_post\_thumbnail\_url( int|WP\_Post $post = null, string|int[] $size = 'post-thumbnail' ): string|false
================================================================================================================
Returns the post thumbnail URL.
`$post` int|[WP\_Post](../classes/wp_post) Optional Post ID or [WP\_Post](../classes/wp_post) object. Default is global `$post`. Default: `null`
`$size` string|int[] Optional Registered image size to retrieve the source for or a flat array of height and width dimensions. Default `'post-thumbnail'`. Default: `'post-thumbnail'`
string|false Post thumbnail URL or false if no image is available. If `$size` does not match any registered image size, the original image URL will be returned.
File: `wp-includes/post-thumbnail-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/post-thumbnail-template.php/)
```
function get_the_post_thumbnail_url( $post = null, $size = 'post-thumbnail' ) {
$post_thumbnail_id = get_post_thumbnail_id( $post );
if ( ! $post_thumbnail_id ) {
return false;
}
$thumbnail_url = wp_get_attachment_image_url( $post_thumbnail_id, $size );
/**
* Filters the post thumbnail URL.
*
* @since 5.9.0
*
* @param string|false $thumbnail_url Post thumbnail URL or false if the post does not exist.
* @param int|WP_Post|null $post Post ID or WP_Post object. Default is global `$post`.
* @param string|int[] $size Registered image size to retrieve the source for or a flat array
* of height and width dimensions. Default 'post-thumbnail'.
*/
return apply_filters( 'post_thumbnail_url', $thumbnail_url, $post, $size );
}
```
[apply\_filters( 'post\_thumbnail\_url', string|false $thumbnail\_url, int|WP\_Post|null $post, string|int[] $size )](../hooks/post_thumbnail_url)
Filters the post thumbnail URL.
| Uses | Description |
| --- | --- |
| [wp\_get\_attachment\_image\_url()](wp_get_attachment_image_url) wp-includes/media.php | Gets the URL of an image attachment. |
| [get\_post\_thumbnail\_id()](get_post_thumbnail_id) wp-includes/post-thumbnail-template.php | Retrieves the post thumbnail ID. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| Used By | Description |
| --- | --- |
| [the\_post\_thumbnail\_url()](the_post_thumbnail_url) wp-includes/post-thumbnail-template.php | Displays the post thumbnail URL. |
| Version | Description |
| --- | --- |
| [4.4.0](https://developer.wordpress.org/reference/since/4.4.0/) | Introduced. |
wordpress status_header( int $code, string $description = '' ) status\_header( int $code, string $description = '' )
=====================================================
Sets HTTP status header.
* [get\_status\_header\_desc()](get_status_header_desc)
`$code` int Required HTTP status code. `$description` string Optional A custom description for the HTTP status. Default: `''`
##### Usage:
```
status_header( $header );
```
##### Notes:
Uses: [`apply_filters()`](https://codex.wordpress.org/Function_Reference/apply_filters "Function Reference/apply filters") Calls ‘`status_header`‘ on status header string, HTTP code, HTTP code description, and protocol string as separate parameters.
File: `wp-includes/functions.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/functions.php/)
```
function status_header( $code, $description = '' ) {
if ( ! $description ) {
$description = get_status_header_desc( $code );
}
if ( empty( $description ) ) {
return;
}
$protocol = wp_get_server_protocol();
$status_header = "$protocol $code $description";
if ( function_exists( 'apply_filters' ) ) {
/**
* Filters an HTTP status header.
*
* @since 2.2.0
*
* @param string $status_header HTTP status header.
* @param int $code HTTP status code.
* @param string $description Description for the status code.
* @param string $protocol Server protocol.
*/
$status_header = apply_filters( 'status_header', $status_header, $code, $description, $protocol );
}
if ( ! headers_sent() ) {
header( $status_header, true, $code );
}
}
```
[apply\_filters( 'status\_header', string $status\_header, int $code, string $description, string $protocol )](../hooks/status_header)
Filters an HTTP status header.
| Uses | Description |
| --- | --- |
| [wp\_get\_server\_protocol()](wp_get_server_protocol) wp-includes/load.php | Return the HTTP protocol sent by the server. |
| [get\_status\_header\_desc()](get_status_header_desc) wp-includes/functions.php | Retrieves the description for the HTTP status. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| Used By | Description |
| --- | --- |
| [IXR\_Server::serve()](../classes/ixr_server/serve) wp-includes/IXR/class-IXR-server.php | |
| [wp\_xmlrpc\_server::error()](../classes/wp_xmlrpc_server/error) wp-includes/class-wp-xmlrpc-server.php | Send error response to client. |
| [WP\_Sitemaps::render\_sitemaps()](../classes/wp_sitemaps/render_sitemaps) wp-includes/sitemaps/class-wp-sitemaps.php | Renders sitemap templates based on rewrite rules. |
| [\_jsonp\_wp\_die\_handler()](_jsonp_wp_die_handler) wp-includes/functions.php | Kills WordPress execution and displays JSONP response with an error message. |
| [\_xml\_wp\_die\_handler()](_xml_wp_die_handler) wp-includes/functions.php | Kills WordPress execution and displays XML response with an error message. |
| [\_json\_wp\_die\_handler()](_json_wp_die_handler) wp-includes/functions.php | Kills WordPress execution and displays JSON response with an error message. |
| [WP\_Customize\_Nav\_Menus::ajax\_insert\_auto\_draft\_post()](../classes/wp_customize_nav_menus/ajax_insert_auto_draft_post) wp-includes/class-wp-customize-nav-menus.php | Ajax handler for adding a new auto-draft post. |
| [WP\_Customize\_Selective\_Refresh::handle\_render\_partials\_request()](../classes/wp_customize_selective_refresh/handle_render_partials_request) wp-includes/customize/class-wp-customize-selective-refresh.php | Handles the Ajax request to return the rendered partials for the requested placements. |
| [\_oembed\_rest\_pre\_serve\_request()](_oembed_rest_pre_serve_request) wp-includes/embed.php | Hooks into the REST API output to print XML instead of JSON. |
| [WP\_REST\_Server::set\_status()](../classes/wp_rest_server/set_status) wp-includes/rest-api/class-wp-rest-server.php | Sends an HTTP status code. |
| [wp\_redirect()](wp_redirect) wp-includes/pluggable.php | Redirects to another page. |
| [WP::handle\_404()](../classes/wp/handle_404) wp-includes/class-wp.php | Set the Headers for 404, if nothing is found for requested URL. |
| [WP::send\_headers()](../classes/wp/send_headers) wp-includes/class-wp.php | Sends additional HTTP headers for caching, content type, etc. |
| [wp\_send\_json()](wp_send_json) wp-includes/functions.php | Sends a JSON response back to an Ajax request. |
| [\_default\_wp\_die\_handler()](_default_wp_die_handler) wp-includes/functions.php | Kills WordPress execution and displays HTML page with an error message. |
| [\_ajax\_wp\_die\_handler()](_ajax_wp_die_handler) wp-includes/functions.php | Kills WordPress execution and displays Ajax response with an error message. |
| [send\_origin\_headers()](send_origin_headers) wp-includes/http.php | Send Access-Control-Allow-Origin and related headers if the current request is from an allowed origin. |
| Version | Description |
| --- | --- |
| [4.4.0](https://developer.wordpress.org/reference/since/4.4.0/) | Added the `$description` parameter. |
| [2.0.0](https://developer.wordpress.org/reference/since/2.0.0/) | Introduced. |
wordpress wp_print_inline_script_tag( string $javascript, array $attributes = array() ) wp\_print\_inline\_script\_tag( string $javascript, array $attributes = array() )
=================================================================================
Prints inline JavaScript wrapped in tag.
It is possible to inject attributes in the `<script>` tag via the [‘wp\_script\_attributes’](../hooks/wp_script_attributes) filter.
Automatically injects type attribute if needed.
`$javascript` string Required Inline JavaScript code. `$attributes` array Optional Key-value pairs representing `<script>` tag attributes. Default: `array()`
File: `wp-includes/script-loader.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/script-loader.php/)
```
function wp_print_inline_script_tag( $javascript, $attributes = array() ) {
echo wp_get_inline_script_tag( $javascript, $attributes );
}
```
| Uses | Description |
| --- | --- |
| [wp\_get\_inline\_script\_tag()](wp_get_inline_script_tag) wp-includes/script-loader.php | Wraps inline JavaScript in tag. |
| Used By | Description |
| --- | --- |
| [print\_embed\_scripts()](print_embed_scripts) wp-includes/embed.php | Prints the JavaScript in the embed iframe header. |
| Version | Description |
| --- | --- |
| [5.7.0](https://developer.wordpress.org/reference/since/5.7.0/) | Introduced. |
wordpress get_blog_id_from_url( string $domain, string $path = '/' ): int get\_blog\_id\_from\_url( string $domain, string $path = '/' ): int
===================================================================
Gets a blog’s numeric ID from its URL.
On a subdirectory installation like example.com/blog1/, $domain will be the root ‘example.com’ and $path the subdirectory ‘/blog1/’. With subdomains like blog1.example.com, $domain is ‘blog1.example.com’ and $path is ‘/’.
`$domain` string Required `$path` string Optional Not required for subdomain installations. Default: `'/'`
int 0 if no blog found, otherwise the ID of the matching blog
File: `wp-includes/ms-functions.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/ms-functions.php/)
```
function get_blog_id_from_url( $domain, $path = '/' ) {
$domain = strtolower( $domain );
$path = strtolower( $path );
$id = wp_cache_get( md5( $domain . $path ), 'blog-id-cache' );
if ( -1 == $id ) { // Blog does not exist.
return 0;
} elseif ( $id ) {
return (int) $id;
}
$args = array(
'domain' => $domain,
'path' => $path,
'fields' => 'ids',
'number' => 1,
'update_site_meta_cache' => false,
);
$result = get_sites( $args );
$id = array_shift( $result );
if ( ! $id ) {
wp_cache_set( md5( $domain . $path ), -1, 'blog-id-cache' );
return 0;
}
wp_cache_set( md5( $domain . $path ), $id, 'blog-id-cache' );
return $id;
}
```
| Uses | Description |
| --- | --- |
| [get\_sites()](get_sites) wp-includes/ms-site.php | Retrieves a list of sites matching requested arguments. |
| [wp\_cache\_set()](wp_cache_set) wp-includes/cache.php | Saves the data to the cache. |
| [wp\_cache\_get()](wp_cache_get) wp-includes/cache.php | Retrieves the cache contents from the cache by key and group. |
| Version | Description |
| --- | --- |
| [MU (3.0.0)](https://developer.wordpress.org/reference/since/mu.3.0.0/) | Introduced. |
wordpress wp_guess_url(): string wp\_guess\_url(): string
========================
Guesses the URL for the site.
Will remove wp-admin links to retrieve only return URLs not in the wp-admin directory.
string The guessed URL.
File: `wp-includes/functions.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/functions.php/)
```
function wp_guess_url() {
if ( defined( 'WP_SITEURL' ) && '' !== WP_SITEURL ) {
$url = WP_SITEURL;
} else {
$abspath_fix = str_replace( '\\', '/', ABSPATH );
$script_filename_dir = dirname( $_SERVER['SCRIPT_FILENAME'] );
// The request is for the admin.
if ( strpos( $_SERVER['REQUEST_URI'], 'wp-admin' ) !== false || strpos( $_SERVER['REQUEST_URI'], 'wp-login.php' ) !== false ) {
$path = preg_replace( '#/(wp-admin/?.*|wp-login\.php.*)#i', '', $_SERVER['REQUEST_URI'] );
// The request is for a file in ABSPATH.
} elseif ( $script_filename_dir . '/' === $abspath_fix ) {
// Strip off any file/query params in the path.
$path = preg_replace( '#/[^/]*$#i', '', $_SERVER['PHP_SELF'] );
} else {
if ( false !== strpos( $_SERVER['SCRIPT_FILENAME'], $abspath_fix ) ) {
// Request is hitting a file inside ABSPATH.
$directory = str_replace( ABSPATH, '', $script_filename_dir );
// Strip off the subdirectory, and any file/query params.
$path = preg_replace( '#/' . preg_quote( $directory, '#' ) . '/[^/]*$#i', '', $_SERVER['REQUEST_URI'] );
} elseif ( false !== strpos( $abspath_fix, $script_filename_dir ) ) {
// Request is hitting a file above ABSPATH.
$subdirectory = substr( $abspath_fix, strpos( $abspath_fix, $script_filename_dir ) + strlen( $script_filename_dir ) );
// Strip off any file/query params from the path, appending the subdirectory to the installation.
$path = preg_replace( '#/[^/]*$#i', '', $_SERVER['REQUEST_URI'] ) . $subdirectory;
} else {
$path = $_SERVER['REQUEST_URI'];
}
}
$schema = is_ssl() ? 'https://' : 'http://'; // set_url_scheme() is not defined yet.
$url = $schema . $_SERVER['HTTP_HOST'] . $path;
}
return rtrim( $url, '/' );
}
```
| Uses | Description |
| --- | --- |
| [is\_ssl()](is_ssl) wp-includes/load.php | Determines if SSL is used. |
| Used By | Description |
| --- | --- |
| [populate\_options()](populate_options) wp-admin/includes/schema.php | Create WordPress options and set the default values. |
| [wp\_install()](wp_install) wp-admin/includes/upgrade.php | Installs the site. |
| [wp\_not\_installed()](wp_not_installed) wp-includes/load.php | Redirect to the installer if WordPress is not installed. |
| [wp\_default\_styles()](wp_default_styles) wp-includes/script-loader.php | Assigns default styles to $styles object. |
| [wp\_default\_scripts()](wp_default_scripts) wp-includes/script-loader.php | Registers all WordPress scripts. |
| Version | Description |
| --- | --- |
| [2.6.0](https://developer.wordpress.org/reference/since/2.6.0/) | Introduced. |
wordpress _rest_array_intersect_key_recursive( array $array1, array $array2 ): array \_rest\_array\_intersect\_key\_recursive( array $array1, array $array2 ): array
===============================================================================
Recursively computes the intersection of arrays using keys for comparison.
`$array1` array Required The array with master keys to check. `$array2` array Required An array to compare keys against. array An associative array containing all the entries of array1 which have keys that are present in all arguments.
File: `wp-includes/rest-api.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/rest-api.php/)
```
function _rest_array_intersect_key_recursive( $array1, $array2 ) {
$array1 = array_intersect_key( $array1, $array2 );
foreach ( $array1 as $key => $value ) {
if ( is_array( $value ) && is_array( $array2[ $key ] ) ) {
$array1[ $key ] = _rest_array_intersect_key_recursive( $value, $array2[ $key ] );
}
}
return $array1;
}
```
| Uses | Description |
| --- | --- |
| [\_rest\_array\_intersect\_key\_recursive()](_rest_array_intersect_key_recursive) wp-includes/rest-api.php | Recursively computes the intersection of arrays using keys for comparison. |
| Used By | Description |
| --- | --- |
| [\_rest\_array\_intersect\_key\_recursive()](_rest_array_intersect_key_recursive) wp-includes/rest-api.php | Recursively computes the intersection of arrays using keys for comparison. |
| [rest\_filter\_response\_fields()](rest_filter_response_fields) wp-includes/rest-api.php | Filters the REST API response to include only a white-listed set of response object fields. |
| Version | Description |
| --- | --- |
| [5.3.0](https://developer.wordpress.org/reference/since/5.3.0/) | Introduced. |
wordpress attachment_submitbox_metadata() attachment\_submitbox\_metadata()
=================================
Displays non-editable attachment metadata in the publish meta box.
File: `wp-admin/includes/media.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/media.php/)
```
function attachment_submitbox_metadata() {
$post = get_post();
$attachment_id = $post->ID;
$file = get_attached_file( $attachment_id );
$filename = esc_html( wp_basename( $file ) );
$media_dims = '';
$meta = wp_get_attachment_metadata( $attachment_id );
if ( isset( $meta['width'], $meta['height'] ) ) {
$media_dims .= "<span id='media-dims-$attachment_id'>{$meta['width']} × {$meta['height']}</span> ";
}
/** This filter is documented in wp-admin/includes/media.php */
$media_dims = apply_filters( 'media_meta', $media_dims, $post );
$att_url = wp_get_attachment_url( $attachment_id );
$author = new WP_User( $post->post_author );
$uploaded_by_name = __( '(no author)' );
$uploaded_by_link = '';
if ( $author->exists() ) {
$uploaded_by_name = $author->display_name ? $author->display_name : $author->nickname;
$uploaded_by_link = get_edit_user_link( $author->ID );
}
?>
<div class="misc-pub-section misc-pub-uploadedby">
<?php if ( $uploaded_by_link ) { ?>
<?php _e( 'Uploaded by:' ); ?> <a href="<?php echo $uploaded_by_link; ?>"><strong><?php echo $uploaded_by_name; ?></strong></a>
<?php } else { ?>
<?php _e( 'Uploaded by:' ); ?> <strong><?php echo $uploaded_by_name; ?></strong>
<?php } ?>
</div>
<?php
if ( $post->post_parent ) {
$post_parent = get_post( $post->post_parent );
if ( $post_parent ) {
$uploaded_to_title = $post_parent->post_title ? $post_parent->post_title : __( '(no title)' );
$uploaded_to_link = get_edit_post_link( $post->post_parent, 'raw' );
?>
<div class="misc-pub-section misc-pub-uploadedto">
<?php if ( $uploaded_to_link ) { ?>
<?php _e( 'Uploaded to:' ); ?> <a href="<?php echo $uploaded_to_link; ?>"><strong><?php echo $uploaded_to_title; ?></strong></a>
<?php } else { ?>
<?php _e( 'Uploaded to:' ); ?> <strong><?php echo $uploaded_to_title; ?></strong>
<?php } ?>
</div>
<?php
}
}
?>
<div class="misc-pub-section misc-pub-attachment">
<label for="attachment_url"><?php _e( 'File URL:' ); ?></label>
<input type="text" class="widefat urlfield" readonly="readonly" name="attachment_url" id="attachment_url" value="<?php echo esc_attr( $att_url ); ?>" />
<span class="copy-to-clipboard-container">
<button type="button" class="button copy-attachment-url edit-media" data-clipboard-target="#attachment_url"><?php _e( 'Copy URL to clipboard' ); ?></button>
<span class="success hidden" aria-hidden="true"><?php _e( 'Copied!' ); ?></span>
</span>
</div>
<div class="misc-pub-section misc-pub-filename">
<?php _e( 'File name:' ); ?> <strong><?php echo $filename; ?></strong>
</div>
<div class="misc-pub-section misc-pub-filetype">
<?php _e( 'File type:' ); ?>
<strong>
<?php
if ( preg_match( '/^.*?\.(\w+)$/', get_attached_file( $post->ID ), $matches ) ) {
echo esc_html( strtoupper( $matches[1] ) );
list( $mime_type ) = explode( '/', $post->post_mime_type );
if ( 'image' !== $mime_type && ! empty( $meta['mime_type'] ) ) {
if ( "$mime_type/" . strtolower( $matches[1] ) !== $meta['mime_type'] ) {
echo ' (' . $meta['mime_type'] . ')';
}
}
} else {
echo strtoupper( str_replace( 'image/', '', $post->post_mime_type ) );
}
?>
</strong>
</div>
<?php
$file_size = false;
if ( isset( $meta['filesize'] ) ) {
$file_size = $meta['filesize'];
} elseif ( file_exists( $file ) ) {
$file_size = wp_filesize( $file );
}
if ( ! empty( $file_size ) ) {
?>
<div class="misc-pub-section misc-pub-filesize">
<?php _e( 'File size:' ); ?> <strong><?php echo size_format( $file_size ); ?></strong>
</div>
<?php
}
if ( preg_match( '#^(audio|video)/#', $post->post_mime_type ) ) {
$fields = array(
'length_formatted' => __( 'Length:' ),
'bitrate' => __( 'Bitrate:' ),
);
/**
* Filters the audio and video metadata fields to be shown in the publish meta box.
*
* The key for each item in the array should correspond to an attachment
* metadata key, and the value should be the desired label.
*
* @since 3.7.0
* @since 4.9.0 Added the `$post` parameter.
*
* @param array $fields An array of the attachment metadata keys and labels.
* @param WP_Post $post WP_Post object for the current attachment.
*/
$fields = apply_filters( 'media_submitbox_misc_sections', $fields, $post );
foreach ( $fields as $key => $label ) {
if ( empty( $meta[ $key ] ) ) {
continue;
}
?>
<div class="misc-pub-section misc-pub-mime-meta misc-pub-<?php echo sanitize_html_class( $key ); ?>">
<?php echo $label; ?>
<strong>
<?php
switch ( $key ) {
case 'bitrate':
echo round( $meta['bitrate'] / 1000 ) . 'kb/s';
if ( ! empty( $meta['bitrate_mode'] ) ) {
echo ' ' . strtoupper( esc_html( $meta['bitrate_mode'] ) );
}
break;
default:
echo esc_html( $meta[ $key ] );
break;
}
?>
</strong>
</div>
<?php
}
$fields = array(
'dataformat' => __( 'Audio Format:' ),
'codec' => __( 'Audio Codec:' ),
);
/**
* Filters the audio attachment metadata fields to be shown in the publish meta box.
*
* The key for each item in the array should correspond to an attachment
* metadata key, and the value should be the desired label.
*
* @since 3.7.0
* @since 4.9.0 Added the `$post` parameter.
*
* @param array $fields An array of the attachment metadata keys and labels.
* @param WP_Post $post WP_Post object for the current attachment.
*/
$audio_fields = apply_filters( 'audio_submitbox_misc_sections', $fields, $post );
foreach ( $audio_fields as $key => $label ) {
if ( empty( $meta['audio'][ $key ] ) ) {
continue;
}
?>
<div class="misc-pub-section misc-pub-audio misc-pub-<?php echo sanitize_html_class( $key ); ?>">
<?php echo $label; ?> <strong><?php echo esc_html( $meta['audio'][ $key ] ); ?></strong>
</div>
<?php
}
}
if ( $media_dims ) {
?>
<div class="misc-pub-section misc-pub-dimensions">
<?php _e( 'Dimensions:' ); ?> <strong><?php echo $media_dims; ?></strong>
</div>
<?php
}
if ( ! empty( $meta['original_image'] ) ) {
?>
<div class="misc-pub-section misc-pub-original-image word-wrap-break-word">
<?php _e( 'Original image:' ); ?>
<a href="<?php echo esc_url( wp_get_original_image_url( $attachment_id ) ); ?>">
<?php echo esc_html( wp_basename( wp_get_original_image_path( $attachment_id ) ) ); ?>
</a>
</div>
<?php
}
}
```
[apply\_filters( 'audio\_submitbox\_misc\_sections', array $fields, WP\_Post $post )](../hooks/audio_submitbox_misc_sections)
Filters the audio attachment metadata fields to be shown in the publish meta box.
[apply\_filters( 'media\_meta', string $media\_dims, WP\_Post $post )](../hooks/media_meta)
Filters the media metadata.
[apply\_filters( 'media\_submitbox\_misc\_sections', array $fields, WP\_Post $post )](../hooks/media_submitbox_misc_sections)
Filters the audio and video metadata fields to be shown in the publish meta box.
| Uses | Description |
| --- | --- |
| [wp\_filesize()](wp_filesize) wp-includes/functions.php | Wrapper for PHP filesize with filters and casting the result as an integer. |
| [wp\_get\_original\_image\_url()](wp_get_original_image_url) wp-includes/post.php | Retrieves the URL to an original attachment image. |
| [wp\_get\_attachment\_url()](wp_get_attachment_url) wp-includes/post.php | Retrieves the URL for an attachment. |
| [wp\_get\_attachment\_metadata()](wp_get_attachment_metadata) wp-includes/post.php | Retrieves attachment metadata for attachment ID. |
| [get\_edit\_post\_link()](get_edit_post_link) wp-includes/link-template.php | Retrieves the edit post link for post. |
| [get\_edit\_user\_link()](get_edit_user_link) wp-includes/link-template.php | Retrieves the edit user link. |
| [size\_format()](size_format) wp-includes/functions.php | Converts a number of bytes to the largest unit the bytes will fit into. |
| [sanitize\_html\_class()](sanitize_html_class) wp-includes/formatting.php | Sanitizes an HTML classname to ensure it only contains valid characters. |
| [get\_attached\_file()](get_attached_file) wp-includes/post.php | Retrieves attached file path based on attachment ID. |
| [WP\_User::\_\_construct()](../classes/wp_user/__construct) wp-includes/class-wp-user.php | Constructor. |
| [wp\_get\_original\_image\_path()](wp_get_original_image_path) wp-includes/post.php | Retrieves the path to an uploaded image file. |
| [esc\_attr()](esc_attr) wp-includes/formatting.php | Escaping for HTML attributes. |
| [esc\_html()](esc_html) wp-includes/formatting.php | Escaping for HTML blocks. |
| [wp\_basename()](wp_basename) wp-includes/formatting.php | i18n-friendly version of basename(). |
| [\_e()](_e) wp-includes/l10n.php | Displays translated text. |
| [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| [get\_post()](get_post) wp-includes/post.php | Retrieves post data given a post ID or post object. |
| [esc\_url()](esc_url) wp-includes/formatting.php | Checks and cleans a URL. |
| Version | Description |
| --- | --- |
| [3.5.0](https://developer.wordpress.org/reference/since/3.5.0/) | Introduced. |
| programming_docs |
wordpress post_type_exists( string $post_type ): bool post\_type\_exists( string $post\_type ): bool
==============================================
Determines whether a post type is registered.
For more information on this and similar theme functions, check out the [Conditional Tags](https://developer.wordpress.org/themes/basics/conditional-tags/) article in the Theme Developer Handbook.
* [get\_post\_type\_object()](get_post_type_object)
`$post_type` string Required Post type name. bool Whether post type is registered.
File: `wp-includes/post.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/post.php/)
```
function post_type_exists( $post_type ) {
return (bool) get_post_type_object( $post_type );
}
```
| Uses | Description |
| --- | --- |
| [get\_post\_type\_object()](get_post_type_object) wp-includes/post.php | Retrieves a post type object by name. |
| Used By | Description |
| --- | --- |
| [use\_block\_editor\_for\_post\_type()](use_block_editor_for_post_type) wp-includes/post.php | Returns whether a post type is compatible with the block editor. |
| [WP\_Customize\_Nav\_Menus::ajax\_insert\_auto\_draft\_post()](../classes/wp_customize_nav_menus/ajax_insert_auto_draft_post) wp-includes/class-wp-customize-nav-menus.php | Ajax handler for adding a new auto-draft post. |
| [unregister\_post\_type()](unregister_post_type) wp-includes/post.php | Unregisters a post type. |
| [WP\_Customize\_Nav\_Menu\_Item\_Setting::populate\_value()](../classes/wp_customize_nav_menu_item_setting/populate_value) wp-includes/customize/class-wp-customize-nav-menu-item-setting.php | Ensure that the value is fully populated with the necessary properties. |
| [WP\_Screen::get()](../classes/wp_screen/get) wp-admin/includes/class-wp-screen.php | Fetches a screen object. |
| [export\_wp()](export_wp) wp-admin/includes/export.php | Generates the WXR export file for download. |
| [\_wp\_ajax\_menu\_quick\_search()](_wp_ajax_menu_quick_search) wp-admin/includes/nav-menu.php | Prints the appropriate response to a menu quick search. |
| [get\_ancestors()](get_ancestors) wp-includes/taxonomy.php | Gets an array of ancestor IDs for a given object. |
| [wp\_count\_posts()](wp_count_posts) wp-includes/post.php | Counts number of posts of a post type and if user has permissions to view. |
| [is\_post\_type\_hierarchical()](is_post_type_hierarchical) wp-includes/post.php | Determines whether the post type is hierarchical. |
| [wp\_xmlrpc\_server::wp\_getPostType()](../classes/wp_xmlrpc_server/wp_getposttype) wp-includes/class-wp-xmlrpc-server.php | Retrieves a post type |
| Version | Description |
| --- | --- |
| [3.0.0](https://developer.wordpress.org/reference/since/3.0.0/) | Introduced. |
wordpress welcome_user_msg_filter( string $text ): string welcome\_user\_msg\_filter( string $text ): string
==================================================
Ensures that the welcome message is not empty. Currently unused.
`$text` string Required string
File: `wp-includes/ms-functions.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/ms-functions.php/)
```
function welcome_user_msg_filter( $text ) {
if ( ! $text ) {
remove_filter( 'site_option_welcome_user_email', 'welcome_user_msg_filter' );
/* translators: Do not translate USERNAME, PASSWORD, LOGINLINK, SITE_NAME: those are placeholders. */
$text = __(
'Howdy USERNAME,
Your new account is set up.
You can log in with the following information:
Username: USERNAME
Password: PASSWORD
LOGINLINK
Thanks!
--The Team @ SITE_NAME'
);
update_site_option( 'welcome_user_email', $text );
}
return $text;
}
```
| Uses | Description |
| --- | --- |
| [update\_site\_option()](update_site_option) wp-includes/option.php | Updates the value of an option that was already added for the current network. |
| [remove\_filter()](remove_filter) wp-includes/plugin.php | Removes a callback function from a filter hook. |
| [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. |
| Version | Description |
| --- | --- |
| [MU (3.0.0)](https://developer.wordpress.org/reference/since/mu.3.0.0/) | Introduced. |
wordpress get_subdirectory_reserved_names(): string[] get\_subdirectory\_reserved\_names(): string[]
==============================================
Retrieves a list of reserved site on a sub-directory Multisite installation.
string[] Array of reserved names.
File: `wp-includes/ms-functions.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/ms-functions.php/)
```
function get_subdirectory_reserved_names() {
$names = array(
'page',
'comments',
'blog',
'files',
'feed',
'wp-admin',
'wp-content',
'wp-includes',
'wp-json',
'embed',
);
/**
* Filters reserved site names on a sub-directory Multisite installation.
*
* @since 3.0.0
* @since 4.4.0 'wp-admin', 'wp-content', 'wp-includes', 'wp-json', and 'embed' were added
* to the reserved names list.
*
* @param string[] $subdirectory_reserved_names Array of reserved names.
*/
return apply_filters( 'subdirectory_reserved_names', $names );
}
```
[apply\_filters( 'subdirectory\_reserved\_names', string[] $subdirectory\_reserved\_names )](../hooks/subdirectory_reserved_names)
Filters reserved site names on a sub-directory Multisite installation.
| Uses | Description |
| --- | --- |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| Used By | Description |
| --- | --- |
| [wpmu\_validate\_blog\_signup()](wpmu_validate_blog_signup) wp-includes/ms-functions.php | Processes new site registrations. |
| Version | Description |
| --- | --- |
| [4.4.0](https://developer.wordpress.org/reference/since/4.4.0/) | Introduced. |
wordpress wp_print_script_tag( array $attributes ) wp\_print\_script\_tag( array $attributes )
===========================================
Prints formatted loader tag.
It is possible to inject attributes in the `<script>` tag via the [‘wp\_script\_attributes’](../hooks/wp_script_attributes) filter.
Automatically injects type attribute if needed.
`$attributes` array Required Key-value pairs representing `<script>` tag attributes. File: `wp-includes/script-loader.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/script-loader.php/)
```
function wp_print_script_tag( $attributes ) {
echo wp_get_script_tag( $attributes );
}
```
| Uses | Description |
| --- | --- |
| [wp\_get\_script\_tag()](wp_get_script_tag) wp-includes/script-loader.php | Formats loader tags. |
| Version | Description |
| --- | --- |
| [5.7.0](https://developer.wordpress.org/reference/since/5.7.0/) | Introduced. |
wordpress wp_list_pluck( array $list, int|string $field, int|string $index_key = null ): array wp\_list\_pluck( array $list, int|string $field, int|string $index\_key = null ): array
=======================================================================================
Plucks a certain field out of each object or array in an array.
This has the same functionality and prototype of array\_column() (PHP 5.5) but also supports objects.
`$list` array Required List of objects or arrays. `$field` int|string Required Field from the object to place instead of the entire object. `$index_key` int|string Optional Field from the object to use as keys for the new array.
Default: `null`
array Array of found values. If `$index_key` is set, an array of found values with keys corresponding to `$index_key`. If `$index_key` is null, array keys from the original `$list` will be preserved in the results.
File: `wp-includes/functions.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/functions.php/)
```
function wp_list_pluck( $list, $field, $index_key = null ) {
if ( ! is_array( $list ) ) {
return array();
}
$util = new WP_List_Util( $list );
return $util->pluck( $field, $index_key );
}
```
| Uses | Description |
| --- | --- |
| [WP\_List\_Util::\_\_construct()](../classes/wp_list_util/__construct) wp-includes/class-wp-list-util.php | Constructor. |
| Used By | Description |
| --- | --- |
| [update\_post\_parent\_caches()](update_post_parent_caches) wp-includes/post.php | Updates parent post caches for a list of post objects. |
| [update\_post\_author\_caches()](update_post_author_caches) wp-includes/post.php | Updates post author user caches for a list of post objects. |
| [WP\_REST\_Menu\_Items\_Controller::prepare\_item\_for\_response()](../classes/wp_rest_menu_items_controller/prepare_item_for_response) wp-includes/rest-api/endpoints/class-wp-rest-menu-items-controller.php | Prepares a single post output for response. |
| [get\_block\_templates()](get_block_templates) wp-includes/block-template-utils.php | Retrieves a list of unified template objects based on a query. |
| [WP\_REST\_Term\_Search\_Handler::search\_items()](../classes/wp_rest_term_search_handler/search_items) wp-includes/rest-api/search/class-wp-rest-term-search-handler.php | Searches the object type content for a given search request. |
| [get\_media\_states()](get_media_states) wp-admin/includes/template.php | Retrieves an array of media states from an attachment. |
| [get\_feed\_build\_date()](get_feed_build_date) wp-includes/feed.php | Gets the UTC time of the most recently modified post from [WP\_Query](../classes/wp_query). |
| [wp\_filter\_oembed\_iframe\_title\_attribute()](wp_filter_oembed_iframe_title_attribute) wp-includes/embed.php | Filters the given oEmbed HTML to make sure iframes have a title attribute. |
| [WP\_REST\_Post\_Search\_Handler::search\_items()](../classes/wp_rest_post_search_handler/search_items) wp-includes/rest-api/search/class-wp-rest-post-search-handler.php | Searches the object type content for a given search request. |
| [WP\_Widget\_Media\_Gallery::render\_media()](../classes/wp_widget_media_gallery/render_media) wp-includes/widgets/class-wp-widget-media-gallery.php | Render the media on the frontend. |
| [WP\_Widget\_Media\_Audio::render\_media()](../classes/wp_widget_media_audio/render_media) wp-includes/widgets/class-wp-widget-media-audio.php | Render the media on the frontend. |
| [WP\_Widget\_Media\_Video::render\_media()](../classes/wp_widget_media_video/render_media) wp-includes/widgets/class-wp-widget-media-video.php | Render the media on the frontend. |
| [WP\_Widget\_Media::form()](../classes/wp_widget_media/form) wp-includes/widgets/class-wp-widget-media.php | Outputs the settings update form. |
| [WP\_Widget\_Media::widget()](../classes/wp_widget_media/widget) wp-includes/widgets/class-wp-widget-media.php | Displays the widget on the front-end. |
| [WP\_Widget\_Media\_Image::render\_media()](../classes/wp_widget_media_image/render_media) wp-includes/widgets/class-wp-widget-media-image.php | Render the media on the frontend. |
| [WP\_Community\_Events::trim\_events()](../classes/wp_community_events/trim_events) wp-admin/includes/class-wp-community-events.php | Prepares the event list for presentation. |
| [WP\_Customize\_Manager::import\_theme\_starter\_content()](../classes/wp_customize_manager/import_theme_starter_content) wp-includes/class-wp-customize-manager.php | Imports theme starter content into the customized state. |
| [WP\_REST\_Posts\_Controller::prepare\_item\_for\_response()](../classes/wp_rest_posts_controller/prepare_item_for_response) wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php | Prepares a single post output for response. |
| [WP\_REST\_Post\_Types\_Controller::prepare\_item\_for\_response()](../classes/wp_rest_post_types_controller/prepare_item_for_response) wp-includes/rest-api/endpoints/class-wp-rest-post-types-controller.php | Prepares a post type object for serialization. |
| [WP\_Term\_Query::get\_terms()](../classes/wp_term_query/get_terms) wp-includes/class-wp-term-query.php | Retrieves the query results. |
| [WP\_Comment\_Query::fill\_descendants()](../classes/wp_comment_query/fill_descendants) wp-includes/class-wp-comment-query.php | Fetch descendants for located comments. |
| [WP\_Customize\_Manager::unsanitized\_post\_values()](../classes/wp_customize_manager/unsanitized_post_values) wp-includes/class-wp-customize-manager.php | Gets dirty pre-sanitized setting values in the current customized state. |
| [WP\_Automatic\_Updater::send\_debug\_email()](../classes/wp_automatic_updater/send_debug_email) wp-admin/includes/class-wp-automatic-updater.php | Prepares and sends an email of a full log of background update results, useful for debugging and geekery. |
| [get\_terms\_to\_edit()](get_terms_to_edit) wp-admin/includes/taxonomy.php | Gets comma-separated list of terms available to edit for the given post ID. |
| [WP\_Plugin\_Install\_List\_Table::prepare\_items()](../classes/wp_plugin_install_list_table/prepare_items) wp-admin/includes/class-wp-plugin-install-list-table.php | |
| [get\_inline\_data()](get_inline_data) wp-admin/includes/template.php | Adds hidden fields with the data for use in the inline editor for posts and pages. |
| [wp\_prepare\_revisions\_for\_js()](wp_prepare_revisions_for_js) wp-admin/includes/revision.php | Prepare revisions for JavaScript. |
| [WP\_Media\_List\_Table::display\_rows()](../classes/wp_media_list_table/display_rows) wp-admin/includes/class-wp-media-list-table.php | |
| [WP\_Comments\_List\_Table::prepare\_items()](../classes/wp_comments_list_table/prepare_items) wp-admin/includes/class-wp-comments-list-table.php | |
| [get\_the\_terms()](get_the_terms) wp-includes/category-template.php | Retrieves the terms of the taxonomy that are attached to the post. |
| [WP\_Query::get\_posts()](../classes/wp_query/get_posts) wp-includes/class-wp-query.php | Retrieves an array of posts based on query variables. |
| [\_default\_wp\_die\_handler()](_default_wp_die_handler) wp-includes/functions.php | Kills WordPress execution and displays HTML page with an error message. |
| [WP\_Widget\_Recent\_Comments::widget()](../classes/wp_widget_recent_comments/widget) wp-includes/widgets/class-wp-widget-recent-comments.php | Outputs the content for the current Recent Comments widget instance. |
| [WP\_Tax\_Query::transform\_query()](../classes/wp_tax_query/transform_query) wp-includes/class-wp-tax-query.php | Transforms a single query, from one field to another. |
| [is\_object\_in\_term()](is_object_in_term) wp-includes/taxonomy.php | Determines if the given object is associated with any of the given terms. |
| [wp\_insert\_term()](wp_insert_term) wp-includes/taxonomy.php | Adds a new term to the database. |
| [wp\_delete\_term()](wp_delete_term) wp-includes/taxonomy.php | Removes a term from the database. |
| [get\_post\_galleries()](get_post_galleries) wp-includes/media.php | Retrieves galleries from the passed post’s content. |
| [get\_post\_galleries\_images()](get_post_galleries_images) wp-includes/media.php | Retrieves the image srcs from galleries from a post’s content, if present. |
| [wp\_enqueue\_media()](wp_enqueue_media) wp-includes/media.php | Enqueues all scripts, styles, settings, and templates necessary to use all media JS APIs. |
| [WP\_Post::\_\_get()](../classes/wp_post/__get) wp-includes/class-wp-post.php | Getter. |
| [wp\_update\_post()](wp_update_post) wp-includes/post.php | Updates a post with new post data. |
| Version | Description |
| --- | --- |
| [4.7.0](https://developer.wordpress.org/reference/since/4.7.0/) | Uses `WP_List_Util` class. |
| [4.0.0](https://developer.wordpress.org/reference/since/4.0.0/) | $index\_key parameter added. |
| [3.1.0](https://developer.wordpress.org/reference/since/3.1.0/) | Introduced. |
wordpress _get_block_template_file( string $template_type, string $slug ): array|null \_get\_block\_template\_file( string $template\_type, string $slug ): array|null
================================================================================
This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.
Retrieves the template file from the theme for a given slug.
`$template_type` string Required `'wp_template'` or `'wp_template_part'`. `$slug` string Required Template slug. array|null Template.
File: `wp-includes/block-template-utils.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/block-template-utils.php/)
```
function _get_block_template_file( $template_type, $slug ) {
if ( 'wp_template' !== $template_type && 'wp_template_part' !== $template_type ) {
return null;
}
$themes = array(
get_stylesheet() => get_stylesheet_directory(),
get_template() => get_template_directory(),
);
foreach ( $themes as $theme_slug => $theme_dir ) {
$template_base_paths = get_block_theme_folders( $theme_slug );
$file_path = $theme_dir . '/' . $template_base_paths[ $template_type ] . '/' . $slug . '.html';
if ( file_exists( $file_path ) ) {
$new_template_item = array(
'slug' => $slug,
'path' => $file_path,
'theme' => $theme_slug,
'type' => $template_type,
);
if ( 'wp_template_part' === $template_type ) {
return _add_block_template_part_area_info( $new_template_item );
}
if ( 'wp_template' === $template_type ) {
return _add_block_template_info( $new_template_item );
}
return $new_template_item;
}
}
return null;
}
```
| Uses | Description |
| --- | --- |
| [\_add\_block\_template\_part\_area\_info()](_add_block_template_part_area_info) wp-includes/block-template-utils.php | Attempts to add the template part’s area information to the input template. |
| [\_add\_block\_template\_info()](_add_block_template_info) wp-includes/block-template-utils.php | Attempts to add custom template information to the template item. |
| [get\_block\_theme\_folders()](get_block_theme_folders) wp-includes/block-template-utils.php | For backward compatibility reasons, block themes might be using block-templates or block-template-parts, this function ensures we fallback to these folders properly. |
| [get\_stylesheet\_directory()](get_stylesheet_directory) wp-includes/theme.php | Retrieves stylesheet directory path for the active theme. |
| [get\_template()](get_template) wp-includes/theme.php | Retrieves name of the active theme. |
| [get\_template\_directory()](get_template_directory) wp-includes/theme.php | Retrieves template directory path for the active theme. |
| [get\_stylesheet()](get_stylesheet) wp-includes/theme.php | Retrieves name of the current stylesheet. |
| Used By | Description |
| --- | --- |
| [get\_block\_file\_template()](get_block_file_template) wp-includes/block-template-utils.php | Retrieves a unified template object based on a theme file. |
| [\_build\_block\_template\_result\_from\_post()](_build_block_template_result_from_post) wp-includes/block-template-utils.php | Builds a unified template object based a post Object. |
| [resolve\_block\_template()](resolve_block_template) wp-includes/block-template.php | Returns the correct ‘wp\_template’ to render for the request template type. |
| Version | Description |
| --- | --- |
| [5.9.0](https://developer.wordpress.org/reference/since/5.9.0/) | Introduced. |
wordpress get_legacy_widget_block_editor_settings(): array get\_legacy\_widget\_block\_editor\_settings(): array
=====================================================
Returns the block editor settings needed to use the Legacy Widget block which is not registered by default.
array Settings to be used with [get\_block\_editor\_settings()](get_block_editor_settings) .
File: `wp-includes/block-editor.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/block-editor.php/)
```
function get_legacy_widget_block_editor_settings() {
$editor_settings = array();
/**
* Filters the list of widget-type IDs that should **not** be offered by the
* Legacy Widget block.
*
* Returning an empty array will make all widgets available.
*
* @since 5.8.0
*
* @param string[] $widgets An array of excluded widget-type IDs.
*/
$editor_settings['widgetTypesToHideFromLegacyWidgetBlock'] = apply_filters(
'widget_types_to_hide_from_legacy_widget_block',
array(
'pages',
'calendar',
'archives',
'media_audio',
'media_image',
'media_gallery',
'media_video',
'search',
'text',
'categories',
'recent-posts',
'recent-comments',
'rss',
'tag_cloud',
'custom_html',
'block',
)
);
return $editor_settings;
}
```
[apply\_filters( 'widget\_types\_to\_hide\_from\_legacy\_widget\_block', string[] $widgets )](../hooks/widget_types_to_hide_from_legacy_widget_block)
Filters the list of widget-type IDs that should \*\*not\*\* be offered by the Legacy Widget block.
| Uses | Description |
| --- | --- |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| Used By | Description |
| --- | --- |
| [WP\_Customize\_Widgets::enqueue\_scripts()](../classes/wp_customize_widgets/enqueue_scripts) wp-includes/class-wp-customize-widgets.php | Enqueues scripts and styles for Customizer panel and export data to JavaScript. |
| Version | Description |
| --- | --- |
| [5.8.0](https://developer.wordpress.org/reference/since/5.8.0/) | Introduced. |
| programming_docs |
wordpress wp_get_global_stylesheet( array $types = array() ): string wp\_get\_global\_stylesheet( array $types = array() ): string
=============================================================
Returns the stylesheet resulting of merging core, theme, and user data.
`$types` array Optional Types of styles to load. Optional.
It accepts `'variables'`, `'styles'`, `'presets'` as values.
If empty, it'll load all for themes with theme.json support and only [ `'variables'`, `'presets'` ] for themes without theme.json support. Default: `array()`
string Stylesheet.
File: `wp-includes/global-styles-and-settings.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/global-styles-and-settings.php/)
```
function wp_get_global_stylesheet( $types = array() ) {
// Return cached value if it can be used and exists.
// It's cached by theme to make sure that theme switching clears the cache.
$can_use_cached = (
( empty( $types ) ) &&
( ! defined( 'WP_DEBUG' ) || ! WP_DEBUG ) &&
( ! defined( 'SCRIPT_DEBUG' ) || ! SCRIPT_DEBUG ) &&
( ! defined( 'REST_REQUEST' ) || ! REST_REQUEST ) &&
! is_admin()
);
$transient_name = 'global_styles_' . get_stylesheet();
if ( $can_use_cached ) {
$cached = get_transient( $transient_name );
if ( $cached ) {
return $cached;
}
}
$tree = WP_Theme_JSON_Resolver::get_merged_data();
$supports_theme_json = WP_Theme_JSON_Resolver::theme_has_support();
if ( empty( $types ) && ! $supports_theme_json ) {
$types = array( 'variables', 'presets', 'base-layout-styles' );
} elseif ( empty( $types ) ) {
$types = array( 'variables', 'styles', 'presets' );
}
/*
* If variables are part of the stylesheet, then add them.
* This is so themes without a theme.json still work as before 5.9:
* they can override the default presets.
* See https://core.trac.wordpress.org/ticket/54782
*/
$styles_variables = '';
if ( in_array( 'variables', $types, true ) ) {
/*
* Only use the default, theme, and custom origins. Why?
* Because styles for `blocks` origin are added at a later phase
* (i.e. in the render cycle). Here, only the ones in use are rendered.
* @see wp_add_global_styles_for_blocks
*/
$origins = array( 'default', 'theme', 'custom' );
$styles_variables = $tree->get_stylesheet( array( 'variables' ), $origins );
$types = array_diff( $types, array( 'variables' ) );
}
/*
* For the remaining types (presets, styles), we do consider origins:
*
* - themes without theme.json: only the classes for the presets defined by core
* - themes with theme.json: the presets and styles classes, both from core and the theme
*/
$styles_rest = '';
if ( ! empty( $types ) ) {
/*
* Only use the default, theme, and custom origins. Why?
* Because styles for `blocks` origin are added at a later phase
* (i.e. in the render cycle). Here, only the ones in use are rendered.
* @see wp_add_global_styles_for_blocks
*/
$origins = array( 'default', 'theme', 'custom' );
if ( ! $supports_theme_json ) {
$origins = array( 'default' );
}
$styles_rest = $tree->get_stylesheet( $types, $origins );
}
$stylesheet = $styles_variables . $styles_rest;
if ( $can_use_cached ) {
// Cache for a minute.
// This cache doesn't need to be any longer, we only want to avoid spikes on high-traffic sites.
set_transient( $transient_name, $stylesheet, MINUTE_IN_SECONDS );
}
return $stylesheet;
}
```
| Uses | Description |
| --- | --- |
| [WP\_Theme\_JSON\_Resolver::get\_merged\_data()](../classes/wp_theme_json_resolver/get_merged_data) wp-includes/class-wp-theme-json-resolver.php | Returns the data merged from multiple origins. |
| [WP\_Theme\_JSON\_Resolver::theme\_has\_support()](../classes/wp_theme_json_resolver/theme_has_support) wp-includes/class-wp-theme-json-resolver.php | Determines whether the active theme has a theme.json file. |
| [get\_stylesheet()](get_stylesheet) wp-includes/theme.php | Retrieves name of the current stylesheet. |
| [get\_transient()](get_transient) wp-includes/option.php | Retrieves the value of a transient. |
| [set\_transient()](set_transient) wp-includes/option.php | Sets/updates the value of a transient. |
| [is\_admin()](is_admin) wp-includes/load.php | Determines whether the current request is for an administrative interface page. |
| Used By | Description |
| --- | --- |
| [wp\_enqueue\_global\_styles\_css\_custom\_properties()](wp_enqueue_global_styles_css_custom_properties) wp-includes/script-loader.php | Function that enqueues the CSS Custom Properties coming from theme.json. |
| [get\_block\_editor\_settings()](get_block_editor_settings) wp-includes/block-editor.php | Returns the contextualized block editor settings for a selected editor context. |
| [wp\_enqueue\_global\_styles()](wp_enqueue_global_styles) wp-includes/script-loader.php | Enqueues the global styles defined via theme.json. |
| Version | Description |
| --- | --- |
| [5.9.0](https://developer.wordpress.org/reference/since/5.9.0/) | Introduced. |
wordpress wp_dashboard_setup() wp\_dashboard\_setup()
======================
Registers dashboard widgets.
Handles POST data, sets up filters.
File: `wp-admin/includes/dashboard.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/dashboard.php/)
```
function wp_dashboard_setup() {
global $wp_registered_widgets, $wp_registered_widget_controls, $wp_dashboard_control_callbacks;
$screen = get_current_screen();
/* Register Widgets and Controls */
$wp_dashboard_control_callbacks = array();
// Browser version
$check_browser = wp_check_browser_version();
if ( $check_browser && $check_browser['upgrade'] ) {
add_filter( 'postbox_classes_dashboard_dashboard_browser_nag', 'dashboard_browser_nag_class' );
if ( $check_browser['insecure'] ) {
wp_add_dashboard_widget( 'dashboard_browser_nag', __( 'You are using an insecure browser!' ), 'wp_dashboard_browser_nag' );
} else {
wp_add_dashboard_widget( 'dashboard_browser_nag', __( 'Your browser is out of date!' ), 'wp_dashboard_browser_nag' );
}
}
// PHP Version.
$check_php = wp_check_php_version();
if ( $check_php && current_user_can( 'update_php' ) ) {
// If "not acceptable" the widget will be shown.
if ( isset( $check_php['is_acceptable'] ) && ! $check_php['is_acceptable'] ) {
add_filter( 'postbox_classes_dashboard_dashboard_php_nag', 'dashboard_php_nag_class' );
if ( $check_php['is_lower_than_future_minimum'] ) {
wp_add_dashboard_widget( 'dashboard_php_nag', __( 'PHP Update Required' ), 'wp_dashboard_php_nag' );
} else {
wp_add_dashboard_widget( 'dashboard_php_nag', __( 'PHP Update Recommended' ), 'wp_dashboard_php_nag' );
}
}
}
// Site Health.
if ( current_user_can( 'view_site_health_checks' ) && ! is_network_admin() ) {
if ( ! class_exists( 'WP_Site_Health' ) ) {
require_once ABSPATH . 'wp-admin/includes/class-wp-site-health.php';
}
WP_Site_Health::get_instance();
wp_enqueue_style( 'site-health' );
wp_enqueue_script( 'site-health' );
wp_add_dashboard_widget( 'dashboard_site_health', __( 'Site Health Status' ), 'wp_dashboard_site_health' );
}
// Right Now.
if ( is_blog_admin() && current_user_can( 'edit_posts' ) ) {
wp_add_dashboard_widget( 'dashboard_right_now', __( 'At a Glance' ), 'wp_dashboard_right_now' );
}
if ( is_network_admin() ) {
wp_add_dashboard_widget( 'network_dashboard_right_now', __( 'Right Now' ), 'wp_network_dashboard_right_now' );
}
// Activity Widget.
if ( is_blog_admin() ) {
wp_add_dashboard_widget( 'dashboard_activity', __( 'Activity' ), 'wp_dashboard_site_activity' );
}
// QuickPress Widget.
if ( is_blog_admin() && current_user_can( get_post_type_object( 'post' )->cap->create_posts ) ) {
$quick_draft_title = sprintf( '<span class="hide-if-no-js">%1$s</span> <span class="hide-if-js">%2$s</span>', __( 'Quick Draft' ), __( 'Your Recent Drafts' ) );
wp_add_dashboard_widget( 'dashboard_quick_press', $quick_draft_title, 'wp_dashboard_quick_press' );
}
// WordPress Events and News.
wp_add_dashboard_widget( 'dashboard_primary', __( 'WordPress Events and News' ), 'wp_dashboard_events_news' );
if ( is_network_admin() ) {
/**
* Fires after core widgets for the Network Admin dashboard have been registered.
*
* @since 3.1.0
*/
do_action( 'wp_network_dashboard_setup' );
/**
* Filters the list of widgets to load for the Network Admin dashboard.
*
* @since 3.1.0
*
* @param string[] $dashboard_widgets An array of dashboard widget IDs.
*/
$dashboard_widgets = apply_filters( 'wp_network_dashboard_widgets', array() );
} elseif ( is_user_admin() ) {
/**
* Fires after core widgets for the User Admin dashboard have been registered.
*
* @since 3.1.0
*/
do_action( 'wp_user_dashboard_setup' );
/**
* Filters the list of widgets to load for the User Admin dashboard.
*
* @since 3.1.0
*
* @param string[] $dashboard_widgets An array of dashboard widget IDs.
*/
$dashboard_widgets = apply_filters( 'wp_user_dashboard_widgets', array() );
} else {
/**
* Fires after core widgets for the admin dashboard have been registered.
*
* @since 2.5.0
*/
do_action( 'wp_dashboard_setup' );
/**
* Filters the list of widgets to load for the admin dashboard.
*
* @since 2.5.0
*
* @param string[] $dashboard_widgets An array of dashboard widget IDs.
*/
$dashboard_widgets = apply_filters( 'wp_dashboard_widgets', array() );
}
foreach ( $dashboard_widgets as $widget_id ) {
$name = empty( $wp_registered_widgets[ $widget_id ]['all_link'] ) ? $wp_registered_widgets[ $widget_id ]['name'] : $wp_registered_widgets[ $widget_id ]['name'] . " <a href='{$wp_registered_widgets[$widget_id]['all_link']}' class='edit-box open-box'>" . __( 'View all' ) . '</a>';
wp_add_dashboard_widget( $widget_id, $name, $wp_registered_widgets[ $widget_id ]['callback'], $wp_registered_widget_controls[ $widget_id ]['callback'] );
}
if ( 'POST' === $_SERVER['REQUEST_METHOD'] && isset( $_POST['widget_id'] ) ) {
check_admin_referer( 'edit-dashboard-widget_' . $_POST['widget_id'], 'dashboard-widget-nonce' );
ob_start(); // Hack - but the same hack wp-admin/widgets.php uses.
wp_dashboard_trigger_widget_control( $_POST['widget_id'] );
ob_end_clean();
wp_redirect( remove_query_arg( 'edit' ) );
exit;
}
/** This action is documented in wp-admin/includes/meta-boxes.php */
do_action( 'do_meta_boxes', $screen->id, 'normal', '' );
/** This action is documented in wp-admin/includes/meta-boxes.php */
do_action( 'do_meta_boxes', $screen->id, 'side', '' );
}
```
[do\_action( 'do\_meta\_boxes', string $post\_type, string $context, WP\_Post|object|string $post )](../hooks/do_meta_boxes)
Fires after meta boxes have been added.
[do\_action( 'wp\_dashboard\_setup' )](../hooks/wp_dashboard_setup)
Fires after core widgets for the admin dashboard have been registered.
[apply\_filters( 'wp\_dashboard\_widgets', string[] $dashboard\_widgets )](../hooks/wp_dashboard_widgets)
Filters the list of widgets to load for the admin dashboard.
[do\_action( 'wp\_network\_dashboard\_setup' )](../hooks/wp_network_dashboard_setup)
Fires after core widgets for the Network Admin dashboard have been registered.
[apply\_filters( 'wp\_network\_dashboard\_widgets', string[] $dashboard\_widgets )](../hooks/wp_network_dashboard_widgets)
Filters the list of widgets to load for the Network Admin dashboard.
[do\_action( 'wp\_user\_dashboard\_setup' )](../hooks/wp_user_dashboard_setup)
Fires after core widgets for the User Admin dashboard have been registered.
[apply\_filters( 'wp\_user\_dashboard\_widgets', string[] $dashboard\_widgets )](../hooks/wp_user_dashboard_widgets)
Filters the list of widgets to load for the User Admin dashboard.
| Uses | Description |
| --- | --- |
| [WP\_Site\_Health::get\_instance()](../classes/wp_site_health/get_instance) wp-admin/includes/class-wp-site-health.php | Returns an instance of the [WP\_Site\_Health](../classes/wp_site_health) class, or create one if none exist yet. |
| [check\_admin\_referer()](check_admin_referer) wp-includes/pluggable.php | Ensures intent by verifying that a user was referred from another admin page with the correct security nonce. |
| [wp\_enqueue\_style()](wp_enqueue_style) wp-includes/functions.wp-styles.php | Enqueue a CSS stylesheet. |
| [remove\_query\_arg()](remove_query_arg) wp-includes/functions.php | Removes an item or items from a query string. |
| [wp\_enqueue\_script()](wp_enqueue_script) wp-includes/functions.wp-scripts.php | Enqueue a script. |
| [is\_user\_admin()](is_user_admin) wp-includes/load.php | Determines whether the current request is for a user admin screen. |
| [is\_blog\_admin()](is_blog_admin) wp-includes/load.php | Determines whether the current request is for a site’s administrative interface. |
| [wp\_check\_php\_version()](wp_check_php_version) wp-admin/includes/misc.php | Checks if the user needs to update PHP. |
| [is\_network\_admin()](is_network_admin) wp-includes/load.php | Determines whether the current request is for the network administrative interface. |
| [wp\_redirect()](wp_redirect) wp-includes/pluggable.php | Redirects to another page. |
| [wp\_add\_dashboard\_widget()](wp_add_dashboard_widget) wp-admin/includes/dashboard.php | Adds a new dashboard widget. |
| [wp\_dashboard\_trigger\_widget\_control()](wp_dashboard_trigger_widget_control) wp-admin/includes/dashboard.php | Calls widget control callback. |
| [wp\_check\_browser\_version()](wp_check_browser_version) wp-admin/includes/dashboard.php | Checks if the user needs a browser update. |
| [get\_current\_screen()](get_current_screen) wp-admin/includes/screen.php | Get the current screen object |
| [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. |
| [current\_user\_can()](current_user_can) wp-includes/capabilities.php | Returns whether the current user has the specified capability. |
| [add\_filter()](add_filter) wp-includes/plugin.php | Adds a callback function to a filter hook. |
| [do\_action()](do_action) wp-includes/plugin.php | Calls the callback functions that have been added to an action hook. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| [get\_post\_type\_object()](get_post_type_object) wp-includes/post.php | Retrieves a post type object by name. |
| Version | Description |
| --- | --- |
| [2.5.0](https://developer.wordpress.org/reference/since/2.5.0/) | Introduced. |
wordpress wp_count_comments( int $post_id ): stdClass wp\_count\_comments( int $post\_id ): stdClass
==============================================
Retrieves the total comment counts for the whole site or a single post.
The comment stats are cached and then retrieved, if they already exist in the cache.
* [get\_comment\_count()](get_comment_count) : Which handles fetching the live comment counts.
`$post_id` int Optional Restrict the comment counts to the given post. Default 0, which indicates that comment counts for the whole site will be retrieved. stdClass The number of comments keyed by their status.
* `approved`intThe number of approved comments.
* `moderated`intThe number of comments awaiting moderation (a.k.a. pending).
* `spam`intThe number of spam comments.
* `trash`intThe number of trashed comments.
* `post-trashed`intThe number of comments for posts that are in the trash.
* `total_comments`intThe total number of non-trashed comments, including spam.
* `all`intThe total number of pending or approved comments.
File: `wp-includes/comment.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/comment.php/)
```
function wp_count_comments( $post_id = 0 ) {
$post_id = (int) $post_id;
/**
* Filters the comments count for a given post or the whole site.
*
* @since 2.7.0
*
* @param array|stdClass $count An empty array or an object containing comment counts.
* @param int $post_id The post ID. Can be 0 to represent the whole site.
*/
$filtered = apply_filters( 'wp_count_comments', array(), $post_id );
if ( ! empty( $filtered ) ) {
return $filtered;
}
$count = wp_cache_get( "comments-{$post_id}", 'counts' );
if ( false !== $count ) {
return $count;
}
$stats = get_comment_count( $post_id );
$stats['moderated'] = $stats['awaiting_moderation'];
unset( $stats['awaiting_moderation'] );
$stats_object = (object) $stats;
wp_cache_set( "comments-{$post_id}", $stats_object, 'counts' );
return $stats_object;
}
```
[apply\_filters( 'wp\_count\_comments', array|stdClass $count, int $post\_id )](../hooks/wp_count_comments)
Filters the comments count for a given post or the whole site.
| Uses | Description |
| --- | --- |
| [wp\_cache\_set()](wp_cache_set) wp-includes/cache.php | Saves the data to the cache. |
| [get\_comment\_count()](get_comment_count) wp-includes/comment.php | Retrieves the total comment counts for the whole site or a single post. |
| [wp\_cache\_get()](wp_cache_get) wp-includes/cache.php | Retrieves the cache contents from the cache by key and group. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| Used By | Description |
| --- | --- |
| [wp\_dashboard\_right\_now()](wp_dashboard_right_now) wp-admin/includes/dashboard.php | Dashboard widget that displays some basic stats about the site. |
| [\_wp\_ajax\_delete\_comment\_response()](_wp_ajax_delete_comment_response) wp-admin/includes/ajax-actions.php | Sends back current comment total and new page links if they need to be updated. |
| [wp\_ajax\_replyto\_comment()](wp_ajax_replyto_comment) wp-admin/includes/ajax-actions.php | Ajax handler for replying to a comment. |
| [WP\_Comments\_List\_Table::get\_views()](../classes/wp_comments_list_table/get_views) wp-admin/includes/class-wp-comments-list-table.php | |
| [wp\_admin\_bar\_comments\_menu()](wp_admin_bar_comments_menu) wp-includes/admin-bar.php | Adds edit comments link with awaiting moderation count bubble. |
| [wp\_xmlrpc\_server::wp\_getCommentCount()](../classes/wp_xmlrpc_server/wp_getcommentcount) wp-includes/class-wp-xmlrpc-server.php | Retrieve comment count. |
| Version | Description |
| --- | --- |
| [2.5.0](https://developer.wordpress.org/reference/since/2.5.0/) | Introduced. |
wordpress sanitize_title_for_query( string $title ): string sanitize\_title\_for\_query( string $title ): string
====================================================
Sanitizes a title with the ‘query’ context.
Used for querying the database for a value from URL.
`$title` string Required The string to be sanitized. string The sanitized string.
##### Usage:
```
sanitize_title_for_query( $title );
```
##### Notes:
Since `sanitize_title_for_query()` calls [sanitize\_title()](sanitize_title) , the [sanitize\_title](https://codex.wordpress.org/Plugin_API/Filter_Reference/sanitize_title "Plugin API/Filter Reference/sanitize title") filter is applied with a context of ‘query’.
File: `wp-includes/formatting.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/formatting.php/)
```
function sanitize_title_for_query( $title ) {
return sanitize_title( $title, '', 'query' );
}
```
| Uses | Description |
| --- | --- |
| [sanitize\_title()](sanitize_title) wp-includes/formatting.php | Sanitizes a string into a slug, which can be used in URLs or HTML attributes. |
| Used By | Description |
| --- | --- |
| [WP\_Query::get\_posts()](../classes/wp_query/get_posts) wp-includes/class-wp-query.php | Retrieves an array of posts based on query variables. |
| Version | Description |
| --- | --- |
| [3.1.0](https://developer.wordpress.org/reference/since/3.1.0/) | Introduced. |
| programming_docs |
wordpress compression_test() compression\_test()
===================
Tests support for compressing JavaScript from PHP.
Outputs JavaScript that tests if compression from PHP works as expected and sets an option with the result. Has no effect when the current user is not an administrator. To run the test again the option ‘can\_compress\_scripts’ has to be deleted.
File: `wp-admin/includes/template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/template.php/)
```
function compression_test() {
?>
<script type="text/javascript">
var compressionNonce = <?php echo wp_json_encode( wp_create_nonce( 'update_can_compress_scripts' ) ); ?>;
var testCompression = {
get : function(test) {
var x;
if ( window.XMLHttpRequest ) {
x = new XMLHttpRequest();
} else {
try{x=new ActiveXObject('Msxml2.XMLHTTP');}catch(e){try{x=new ActiveXObject('Microsoft.XMLHTTP');}catch(e){};}
}
if (x) {
x.onreadystatechange = function() {
var r, h;
if ( x.readyState == 4 ) {
r = x.responseText.substr(0, 18);
h = x.getResponseHeader('Content-Encoding');
testCompression.check(r, h, test);
}
};
x.open('GET', ajaxurl + '?action=wp-compression-test&test='+test+'&_ajax_nonce='+compressionNonce+'&'+(new Date()).getTime(), true);
x.send('');
}
},
check : function(r, h, test) {
if ( ! r && ! test )
this.get(1);
if ( 1 == test ) {
if ( h && ( h.match(/deflate/i) || h.match(/gzip/i) ) )
this.get('no');
else
this.get(2);
return;
}
if ( 2 == test ) {
if ( '"wpCompressionTest' === r )
this.get('yes');
else
this.get('no');
}
}
};
testCompression.check();
</script>
<?php
}
```
| Uses | Description |
| --- | --- |
| [wp\_create\_nonce()](wp_create_nonce) wp-includes/pluggable.php | Creates a cryptographic token tied to a specific action, user, user session, and window of time. |
| [wp\_json\_encode()](wp_json_encode) wp-includes/functions.php | Encodes a variable into JSON, with some sanity checks. |
| Version | Description |
| --- | --- |
| [2.8.0](https://developer.wordpress.org/reference/since/2.8.0/) | Introduced. |
wordpress login_footer( string $input_id = '' ) login\_footer( string $input\_id = '' )
=======================================
Outputs the footer for the login page.
`$input_id` string Optional Which input to auto-focus. Default: `''`
File: `wp-login.php`. [View all references](https://developer.wordpress.org/reference/files/wp-login.php/)
```
function login_footer( $input_id = '' ) {
global $interim_login;
// Don't allow interim logins to navigate away from the page.
if ( ! $interim_login ) {
?>
<p id="backtoblog">
<?php
$html_link = sprintf(
'<a href="%s">%s</a>',
esc_url( home_url( '/' ) ),
sprintf(
/* translators: %s: Site title. */
_x( '← Go to %s', 'site' ),
get_bloginfo( 'title', 'display' )
)
);
/**
* Filter the "Go to site" link displayed in the login page footer.
*
* @since 5.7.0
*
* @param string $link HTML link to the home URL of the current site.
*/
echo apply_filters( 'login_site_html_link', $html_link );
?>
</p>
<?php
the_privacy_policy_link( '<div class="privacy-policy-page-link">', '</div>' );
}
?>
</div><?php // End of <div id="login">. ?>
<?php
if (
! $interim_login &&
/**
* Filters the Languages select input activation on the login screen.
*
* @since 5.9.0
*
* @param bool Whether to display the Languages select input on the login screen.
*/
apply_filters( 'login_display_language_dropdown', true )
) {
$languages = get_available_languages();
if ( ! empty( $languages ) ) {
?>
<div class="language-switcher">
<form id="language-switcher" action="" method="get">
<label for="language-switcher-locales">
<span class="dashicons dashicons-translation" aria-hidden="true"></span>
<span class="screen-reader-text"><?php _e( 'Language' ); ?></span>
</label>
<?php
$args = array(
'id' => 'language-switcher-locales',
'name' => 'wp_lang',
'selected' => determine_locale(),
'show_available_translations' => false,
'explicit_option_en_us' => true,
'languages' => $languages,
);
/**
* Filters default arguments for the Languages select input on the login screen.
*
* The arguments get passed to the wp_dropdown_languages() function.
*
* @since 5.9.0
*
* @param array $args Arguments for the Languages select input on the login screen.
*/
wp_dropdown_languages( apply_filters( 'login_language_dropdown_args', $args ) );
?>
<?php if ( $interim_login ) { ?>
<input type="hidden" name="interim-login" value="1" />
<?php } ?>
<?php if ( isset( $_GET['redirect_to'] ) && '' !== $_GET['redirect_to'] ) { ?>
<input type="hidden" name="redirect_to" value="<?php echo sanitize_url( $_GET['redirect_to'] ); ?>" />
<?php } ?>
<?php if ( isset( $_GET['action'] ) && '' !== $_GET['action'] ) { ?>
<input type="hidden" name="action" value="<?php echo esc_attr( $_GET['action'] ); ?>" />
<?php } ?>
<input type="submit" class="button" value="<?php esc_attr_e( 'Change' ); ?>">
</form>
</div>
<?php } ?>
<?php } ?>
<?php
if ( ! empty( $input_id ) ) {
?>
<script type="text/javascript">
try{document.getElementById('<?php echo $input_id; ?>').focus();}catch(e){}
if(typeof wpOnload==='function')wpOnload();
</script>
<?php
}
/**
* Fires in the login page footer.
*
* @since 3.1.0
*/
do_action( 'login_footer' );
?>
<div class="clear"></div>
</body>
</html>
<?php
}
```
[apply\_filters( 'login\_display\_language\_dropdown', bool )](../hooks/login_display_language_dropdown)
Filters the Languages select input activation on the login screen.
[do\_action( 'login\_footer' )](../hooks/login_footer)
Fires in the login page footer.
[apply\_filters( 'login\_language\_dropdown\_args', array $args )](../hooks/login_language_dropdown_args)
Filters default arguments for the Languages select input on the login screen.
[apply\_filters( 'login\_site\_html\_link', string $link )](../hooks/login_site_html_link)
Filter the “Go to site” link displayed in the login page footer.
| Uses | Description |
| --- | --- |
| [determine\_locale()](determine_locale) wp-includes/l10n.php | Determines the current locale desired for the request. |
| [the\_privacy\_policy\_link()](the_privacy_policy_link) wp-includes/link-template.php | Displays the privacy policy link with formatting, when applicable. |
| [wp\_dropdown\_languages()](wp_dropdown_languages) wp-includes/l10n.php | Displays or returns a Language selector. |
| [get\_available\_languages()](get_available_languages) wp-includes/l10n.php | Gets all available languages based on the presence of \*.mo files in a given directory. |
| [esc\_attr\_e()](esc_attr_e) wp-includes/l10n.php | Displays translated text that has been escaped for safe use in an attribute. |
| [sanitize\_url()](sanitize_url) wp-includes/formatting.php | Sanitizes a URL for database or redirect usage. |
| [\_x()](_x) wp-includes/l10n.php | Retrieves translated string with gettext context. |
| [\_e()](_e) wp-includes/l10n.php | Displays translated text. |
| [esc\_url()](esc_url) wp-includes/formatting.php | Checks and cleans a URL. |
| [esc\_attr()](esc_attr) wp-includes/formatting.php | Escaping for HTML attributes. |
| [get\_bloginfo()](get_bloginfo) wp-includes/general-template.php | Retrieves information about the current site. |
| [home\_url()](home_url) wp-includes/link-template.php | Retrieves the URL for the current site where the front end is accessible. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| [do\_action()](do_action) wp-includes/plugin.php | Calls the callback functions that have been added to an action hook. |
| Version | Description |
| --- | --- |
| [3.1.0](https://developer.wordpress.org/reference/since/3.1.0/) | Introduced. |
wordpress the_modified_time( string $format = '' ) the\_modified\_time( string $format = '' )
==========================================
Displays the time at which the post was last modified.
`$format` string Optional Format to use for retrieving the time the post was modified. Accepts `'G'`, `'U'`, or PHP date format.
Defaults to the `'time_format'` option. Default: `''`
If you want to display both the modified time and the creation time, you may want to use an if statement to avoid showing the same time/date twice.
For example:
```
if ( get_the_modified_time() != get_the_time()) )
```
File: `wp-includes/general-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/general-template.php/)
```
function the_modified_time( $format = '' ) {
/**
* Filters the localized time a post was last modified, for display.
*
* @since 2.0.0
*
* @param string|false $get_the_modified_time The formatted time or false if no post is found.
* @param string $format Format to use for retrieving the time the post
* was modified. Accepts 'G', 'U', or PHP date format.
*/
echo apply_filters( 'the_modified_time', get_the_modified_time( $format ), $format );
}
```
[apply\_filters( 'the\_modified\_time', string|false $get\_the\_modified\_time, string $format )](../hooks/the_modified_time)
Filters the localized time a post was last modified, for display.
| Uses | Description |
| --- | --- |
| [get\_the\_modified\_time()](get_the_modified_time) wp-includes/general-template.php | Retrieves the time at which the post was last modified. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| Version | Description |
| --- | --- |
| [2.0.0](https://developer.wordpress.org/reference/since/2.0.0/) | Introduced. |
wordpress wp_sanitize_script_attributes( array $attributes ): string wp\_sanitize\_script\_attributes( array $attributes ): string
=============================================================
Sanitizes an attributes array into an attributes string to be placed inside a tag.
Automatically injects type attribute if needed.
Used by [wp\_get\_script\_tag()](wp_get_script_tag) and [wp\_get\_inline\_script\_tag()](wp_get_inline_script_tag) .
`$attributes` array Required Key-value pairs representing `<script>` tag attributes. string String made of sanitized `<script>` tag attributes.
File: `wp-includes/script-loader.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/script-loader.php/)
```
function wp_sanitize_script_attributes( $attributes ) {
$html5_script_support = ! is_admin() && ! current_theme_supports( 'html5', 'script' );
$attributes_string = '';
// If HTML5 script tag is supported, only the attribute name is added
// to $attributes_string for entries with a boolean value, and that are true.
foreach ( $attributes as $attribute_name => $attribute_value ) {
if ( is_bool( $attribute_value ) ) {
if ( $attribute_value ) {
$attributes_string .= $html5_script_support ? sprintf( ' %1$s="%2$s"', esc_attr( $attribute_name ), esc_attr( $attribute_name ) ) : ' ' . esc_attr( $attribute_name );
}
} else {
$attributes_string .= sprintf( ' %1$s="%2$s"', esc_attr( $attribute_name ), esc_attr( $attribute_value ) );
}
}
return $attributes_string;
}
```
| Uses | Description |
| --- | --- |
| [current\_theme\_supports()](current_theme_supports) wp-includes/theme.php | Checks a theme’s support for a given feature. |
| [esc\_attr()](esc_attr) wp-includes/formatting.php | Escaping for HTML attributes. |
| [is\_admin()](is_admin) wp-includes/load.php | Determines whether the current request is for an administrative interface page. |
| Used By | Description |
| --- | --- |
| [wp\_get\_inline\_script\_tag()](wp_get_inline_script_tag) wp-includes/script-loader.php | Wraps inline JavaScript in tag. |
| [wp\_get\_script\_tag()](wp_get_script_tag) wp-includes/script-loader.php | Formats loader tags. |
| Version | Description |
| --- | --- |
| [5.7.0](https://developer.wordpress.org/reference/since/5.7.0/) | Introduced. |
wordpress register_post_meta( string $post_type, string $meta_key, array $args ): bool register\_post\_meta( string $post\_type, string $meta\_key, array $args ): bool
================================================================================
Registers a meta key for posts.
`$post_type` string Required Post type to register a meta key for. Pass an empty string to register the meta key across all existing post types. `$meta_key` string Required The meta key to register. `$args` array Required Data used to describe the meta key when registered. See [register\_meta()](register_meta) for a list of supported arguments. More Arguments from register\_meta( ... $args ) Data used to describe the meta key when registered.
* `object_subtype`stringA subtype; e.g. if the object type is "post", the post type. If left empty, the meta key will be registered on the entire object type. Default empty.
* `type`stringThe type of data associated with this meta key.
Valid values are `'string'`, `'boolean'`, `'integer'`, `'number'`, `'array'`, and `'object'`.
* `description`stringA description of the data attached to this meta key.
* `single`boolWhether the meta key has one value per object, or an array of values per object.
* `default`mixedThe default value returned from [get\_metadata()](get_metadata) if no value has been set yet.
When using a non-single meta key, the default value is for the first entry.
In other words, when calling [get\_metadata()](get_metadata) with `$single` set to `false`, the default value given here will be wrapped in an array.
* `sanitize_callback`callableA function or method to call when sanitizing `$meta_key` data.
* `auth_callback`callableOptional. A function or method to call when performing edit\_post\_meta, add\_post\_meta, and delete\_post\_meta capability checks.
* `show_in_rest`bool|arrayWhether data associated with this meta key can be considered public and should be accessible via the REST API. A custom post type must also declare support for custom fields for registered meta to be accessible via REST.
When registering complex meta values this argument may optionally be an array with `'schema'` or `'prepare_callback'` keys instead of a boolean.
bool True if the meta key was successfully registered, false if not.
File: `wp-includes/post.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/post.php/)
```
function register_post_meta( $post_type, $meta_key, array $args ) {
$args['object_subtype'] = $post_type;
return register_meta( 'post', $meta_key, $args );
}
```
| Uses | Description |
| --- | --- |
| [register\_meta()](register_meta) wp-includes/meta.php | Registers a meta key. |
| Version | Description |
| --- | --- |
| [4.9.8](https://developer.wordpress.org/reference/since/4.9.8/) | Introduced. |
wordpress network_step1( false|WP_Error $errors = false ) network\_step1( false|WP\_Error $errors = false )
=================================================
Prints step 1 for Network installation process.
`$errors` false|[WP\_Error](../classes/wp_error) Optional Error object. Default: `false`
File: `wp-admin/includes/network.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/network.php/)
```
function network_step1( $errors = false ) {
global $is_apache;
if ( defined( 'DO_NOT_UPGRADE_GLOBAL_TABLES' ) ) {
echo '<div class="error"><p><strong>' . __( 'Error:' ) . '</strong> ' . sprintf(
/* translators: %s: DO_NOT_UPGRADE_GLOBAL_TABLES */
__( 'The constant %s cannot be defined when creating a network.' ),
'<code>DO_NOT_UPGRADE_GLOBAL_TABLES</code>'
) . '</p></div>';
echo '</div>';
require_once ABSPATH . 'wp-admin/admin-footer.php';
die();
}
$active_plugins = get_option( 'active_plugins' );
if ( ! empty( $active_plugins ) ) {
echo '<div class="notice notice-warning"><p><strong>' . __( 'Warning:' ) . '</strong> ' . sprintf(
/* translators: %s: URL to Plugins screen. */
__( 'Please <a href="%s">deactivate your plugins</a> before enabling the Network feature.' ),
admin_url( 'plugins.php?plugin_status=active' )
) . '</p></div>';
echo '<p>' . __( 'Once the network is created, you may reactivate your plugins.' ) . '</p>';
echo '</div>';
require_once ABSPATH . 'wp-admin/admin-footer.php';
die();
}
$hostname = get_clean_basedomain();
$has_ports = strstr( $hostname, ':' );
if ( ( false !== $has_ports && ! in_array( $has_ports, array( ':80', ':443' ), true ) ) ) {
echo '<div class="error"><p><strong>' . __( 'Error:' ) . '</strong> ' . __( 'You cannot install a network of sites with your server address.' ) . '</p></div>';
echo '<p>' . sprintf(
/* translators: %s: Port number. */
__( 'You cannot use port numbers such as %s.' ),
'<code>' . $has_ports . '</code>'
) . '</p>';
echo '<a href="' . esc_url( admin_url() ) . '">' . __( 'Go to Dashboard' ) . '</a>';
echo '</div>';
require_once ABSPATH . 'wp-admin/admin-footer.php';
die();
}
echo '<form method="post">';
wp_nonce_field( 'install-network-1' );
$error_codes = array();
if ( is_wp_error( $errors ) ) {
echo '<div class="error"><p><strong>' . __( 'Error: The network could not be created.' ) . '</strong></p>';
foreach ( $errors->get_error_messages() as $error ) {
echo "<p>$error</p>";
}
echo '</div>';
$error_codes = $errors->get_error_codes();
}
if ( ! empty( $_POST['sitename'] ) && ! in_array( 'empty_sitename', $error_codes, true ) ) {
$site_name = $_POST['sitename'];
} else {
/* translators: %s: Default network title. */
$site_name = sprintf( __( '%s Sites' ), get_option( 'blogname' ) );
}
if ( ! empty( $_POST['email'] ) && ! in_array( 'invalid_email', $error_codes, true ) ) {
$admin_email = $_POST['email'];
} else {
$admin_email = get_option( 'admin_email' );
}
?>
<p><?php _e( 'Welcome to the Network installation process!' ); ?></p>
<p><?php _e( 'Fill in the information below and you’ll be on your way to creating a network of WordPress sites. Configuration files will be created in the next step.' ); ?></p>
<?php
if ( isset( $_POST['subdomain_install'] ) ) {
$subdomain_install = (bool) $_POST['subdomain_install'];
} elseif ( apache_mod_loaded( 'mod_rewrite' ) ) { // Assume nothing.
$subdomain_install = true;
} elseif ( ! allow_subdirectory_install() ) {
$subdomain_install = true;
} else {
$subdomain_install = false;
$got_mod_rewrite = got_mod_rewrite();
if ( $got_mod_rewrite ) { // Dangerous assumptions.
echo '<div class="updated inline"><p><strong>' . __( 'Note:' ) . '</strong> ';
printf(
/* translators: %s: mod_rewrite */
__( 'Please make sure the Apache %s module is installed as it will be used at the end of this installation.' ),
'<code>mod_rewrite</code>'
);
echo '</p>';
} elseif ( $is_apache ) {
echo '<div class="error inline"><p><strong>' . __( 'Warning:' ) . '</strong> ';
printf(
/* translators: %s: mod_rewrite */
__( 'It looks like the Apache %s module is not installed.' ),
'<code>mod_rewrite</code>'
);
echo '</p>';
}
if ( $got_mod_rewrite || $is_apache ) { // Protect against mod_rewrite mimicry (but ! Apache).
echo '<p>';
printf(
/* translators: 1: mod_rewrite, 2: mod_rewrite documentation URL, 3: Google search for mod_rewrite. */
__( 'If %1$s is disabled, ask your administrator to enable that module, or look at the <a href="%2$s">Apache documentation</a> or <a href="%3$s">elsewhere</a> for help setting it up.' ),
'<code>mod_rewrite</code>',
'https://httpd.apache.org/docs/mod/mod_rewrite.html',
'https://www.google.com/search?q=apache+mod_rewrite'
);
echo '</p></div>';
}
}
if ( allow_subdomain_install() && allow_subdirectory_install() ) :
?>
<h3><?php esc_html_e( 'Addresses of Sites in your Network' ); ?></h3>
<p><?php _e( 'Please choose whether you would like sites in your WordPress network to use sub-domains or sub-directories.' ); ?>
<strong><?php _e( 'You cannot change this later.' ); ?></strong></p>
<p><?php _e( 'You will need a wildcard DNS record if you are going to use the virtual host (sub-domain) functionality.' ); ?></p>
<?php // @todo Link to an MS readme? ?>
<table class="form-table" role="presentation">
<tr>
<th><label><input type="radio" name="subdomain_install" value="1"<?php checked( $subdomain_install ); ?> /> <?php _e( 'Sub-domains' ); ?></label></th>
<td>
<?php
printf(
/* translators: 1: Host name. */
_x( 'like <code>site1.%1$s</code> and <code>site2.%1$s</code>', 'subdomain examples' ),
$hostname
);
?>
</td>
</tr>
<tr>
<th><label><input type="radio" name="subdomain_install" value="0"<?php checked( ! $subdomain_install ); ?> /> <?php _e( 'Sub-directories' ); ?></label></th>
<td>
<?php
printf(
/* translators: 1: Host name. */
_x( 'like <code>%1$s/site1</code> and <code>%1$s/site2</code>', 'subdirectory examples' ),
$hostname
);
?>
</td>
</tr>
</table>
<?php
endif;
if ( WP_CONTENT_DIR !== ABSPATH . 'wp-content' && ( allow_subdirectory_install() || ! allow_subdomain_install() ) ) {
echo '<div class="error inline"><p><strong>' . __( 'Warning:' ) . '</strong> ' . __( 'Subdirectory networks may not be fully compatible with custom wp-content directories.' ) . '</p></div>';
}
$is_www = ( 0 === strpos( $hostname, 'www.' ) );
if ( $is_www ) :
?>
<h3><?php esc_html_e( 'Server Address' ); ?></h3>
<p>
<?php
printf(
/* translators: 1: Site URL, 2: Host name, 3: www. */
__( 'You should consider changing your site domain to %1$s before enabling the network feature. It will still be possible to visit your site using the %3$s prefix with an address like %2$s but any links will not have the %3$s prefix.' ),
'<code>' . substr( $hostname, 4 ) . '</code>',
'<code>' . $hostname . '</code>',
'<code>www</code>'
);
?>
</p>
<table class="form-table" role="presentation">
<tr>
<th scope='row'><?php esc_html_e( 'Server Address' ); ?></th>
<td>
<?php
printf(
/* translators: %s: Host name. */
__( 'The internet address of your network will be %s.' ),
'<code>' . $hostname . '</code>'
);
?>
</td>
</tr>
</table>
<?php endif; ?>
<h3><?php esc_html_e( 'Network Details' ); ?></h3>
<table class="form-table" role="presentation">
<?php if ( 'localhost' === $hostname ) : ?>
<tr>
<th scope="row"><?php esc_html_e( 'Sub-directory Installation' ); ?></th>
<td>
<?php
printf(
/* translators: 1: localhost, 2: localhost.localdomain */
__( 'Because you are using %1$s, the sites in your WordPress network must use sub-directories. Consider using %2$s if you wish to use sub-domains.' ),
'<code>localhost</code>',
'<code>localhost.localdomain</code>'
);
// Uh oh:
if ( ! allow_subdirectory_install() ) {
echo ' <strong>' . __( 'Warning:' ) . ' ' . __( 'The main site in a sub-directory installation will need to use a modified permalink structure, potentially breaking existing links.' ) . '</strong>';
}
?>
</td>
</tr>
<?php elseif ( ! allow_subdomain_install() ) : ?>
<tr>
<th scope="row"><?php esc_html_e( 'Sub-directory Installation' ); ?></th>
<td>
<?php
_e( 'Because your installation is in a directory, the sites in your WordPress network must use sub-directories.' );
// Uh oh:
if ( ! allow_subdirectory_install() ) {
echo ' <strong>' . __( 'Warning:' ) . ' ' . __( 'The main site in a sub-directory installation will need to use a modified permalink structure, potentially breaking existing links.' ) . '</strong>';
}
?>
</td>
</tr>
<?php elseif ( ! allow_subdirectory_install() ) : ?>
<tr>
<th scope="row"><?php esc_html_e( 'Sub-domain Installation' ); ?></th>
<td>
<?php
_e( 'Because your installation is not new, the sites in your WordPress network must use sub-domains.' );
echo ' <strong>' . __( 'The main site in a sub-directory installation will need to use a modified permalink structure, potentially breaking existing links.' ) . '</strong>';
?>
</td>
</tr>
<?php endif; ?>
<?php if ( ! $is_www ) : ?>
<tr>
<th scope='row'><?php esc_html_e( 'Server Address' ); ?></th>
<td>
<?php
printf(
/* translators: %s: Host name. */
__( 'The internet address of your network will be %s.' ),
'<code>' . $hostname . '</code>'
);
?>
</td>
</tr>
<?php endif; ?>
<tr>
<th scope='row'><label for="sitename"><?php esc_html_e( 'Network Title' ); ?></label></th>
<td>
<input name='sitename' id='sitename' type='text' size='45' value='<?php echo esc_attr( $site_name ); ?>' />
<p class="description">
<?php _e( 'What would you like to call your network?' ); ?>
</p>
</td>
</tr>
<tr>
<th scope='row'><label for="email"><?php esc_html_e( 'Network Admin Email' ); ?></label></th>
<td>
<input name='email' id='email' type='text' size='45' value='<?php echo esc_attr( $admin_email ); ?>' />
<p class="description">
<?php _e( 'Your email address.' ); ?>
</p>
</td>
</tr>
</table>
<?php submit_button( __( 'Install' ), 'primary', 'submit' ); ?>
</form>
<?php
}
```
| Uses | Description |
| --- | --- |
| [get\_clean\_basedomain()](get_clean_basedomain) wp-admin/includes/network.php | Get base domain of network. |
| [checked()](checked) wp-includes/general-template.php | Outputs the HTML checked attribute. |
| [allow\_subdomain\_install()](allow_subdomain_install) wp-admin/includes/network.php | Allow subdomain installation |
| [got\_mod\_rewrite()](got_mod_rewrite) wp-admin/includes/misc.php | Returns whether the server is running Apache with the mod\_rewrite module loaded. |
| [submit\_button()](submit_button) wp-admin/includes/template.php | Echoes a submit button, with provided text and appropriate class(es). |
| [esc\_html\_e()](esc_html_e) wp-includes/l10n.php | Displays translated text that has been escaped for safe use in HTML output. |
| [allow\_subdirectory\_install()](allow_subdirectory_install) wp-admin/includes/network.php | Allow subdirectory installation. |
| [wp\_nonce\_field()](wp_nonce_field) wp-includes/functions.php | Retrieves or display nonce hidden field for forms. |
| [apache\_mod\_loaded()](apache_mod_loaded) wp-includes/functions.php | Determines whether the specified module exist in the Apache config. |
| [get\_option()](get_option) wp-includes/option.php | Retrieves an option value based on an option name. |
| [admin\_url()](admin_url) wp-includes/link-template.php | Retrieves the URL to the admin area for the current site. |
| [\_x()](_x) wp-includes/l10n.php | Retrieves translated string with gettext context. |
| [esc\_attr()](esc_attr) wp-includes/formatting.php | Escaping for HTML attributes. |
| [esc\_url()](esc_url) wp-includes/formatting.php | Checks and cleans a URL. |
| [\_e()](_e) wp-includes/l10n.php | Displays translated text. |
| [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. |
| [is\_wp\_error()](is_wp_error) wp-includes/load.php | Checks whether the given variable is a WordPress Error. |
| Version | Description |
| --- | --- |
| [3.0.0](https://developer.wordpress.org/reference/since/3.0.0/) | Introduced. |
| programming_docs |
wordpress wp_get_themes( array $args = array() ): WP_Theme[] wp\_get\_themes( array $args = array() ): WP\_Theme[]
=====================================================
Returns an array of [WP\_Theme](../classes/wp_theme) objects based on the arguments.
Despite advances over [get\_themes()](get_themes) , this function is quite expensive, and grows linearly with additional themes. Stick to [wp\_get\_theme()](wp_get_theme) if possible.
`$args` array Optional The search arguments.
* `errors`mixedTrue to return themes with errors, false to return themes without errors, null to return all themes.
Default false.
* `allowed`mixed(Multisite) True to return only allowed themes for a site.
False to return only disallowed themes for a site.
`'site'` to return only site-allowed themes.
`'network'` to return only network-allowed themes.
Null to return all themes. Default null.
* `blog_id`int(Multisite) The blog ID used to calculate which themes are allowed. Default 0, synonymous for the current blog.
Default: `array()`
[WP\_Theme](../classes/wp_theme)[] Array of [WP\_Theme](../classes/wp_theme) objects.
File: `wp-includes/theme.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/theme.php/)
```
function wp_get_themes( $args = array() ) {
global $wp_theme_directories;
$defaults = array(
'errors' => false,
'allowed' => null,
'blog_id' => 0,
);
$args = wp_parse_args( $args, $defaults );
$theme_directories = search_theme_directories();
if ( is_array( $wp_theme_directories ) && count( $wp_theme_directories ) > 1 ) {
// Make sure the active theme wins out, in case search_theme_directories() picks the wrong
// one in the case of a conflict. (Normally, last registered theme root wins.)
$current_theme = get_stylesheet();
if ( isset( $theme_directories[ $current_theme ] ) ) {
$root_of_current_theme = get_raw_theme_root( $current_theme );
if ( ! in_array( $root_of_current_theme, $wp_theme_directories, true ) ) {
$root_of_current_theme = WP_CONTENT_DIR . $root_of_current_theme;
}
$theme_directories[ $current_theme ]['theme_root'] = $root_of_current_theme;
}
}
if ( empty( $theme_directories ) ) {
return array();
}
if ( is_multisite() && null !== $args['allowed'] ) {
$allowed = $args['allowed'];
if ( 'network' === $allowed ) {
$theme_directories = array_intersect_key( $theme_directories, WP_Theme::get_allowed_on_network() );
} elseif ( 'site' === $allowed ) {
$theme_directories = array_intersect_key( $theme_directories, WP_Theme::get_allowed_on_site( $args['blog_id'] ) );
} elseif ( $allowed ) {
$theme_directories = array_intersect_key( $theme_directories, WP_Theme::get_allowed( $args['blog_id'] ) );
} else {
$theme_directories = array_diff_key( $theme_directories, WP_Theme::get_allowed( $args['blog_id'] ) );
}
}
$themes = array();
static $_themes = array();
foreach ( $theme_directories as $theme => $theme_root ) {
if ( isset( $_themes[ $theme_root['theme_root'] . '/' . $theme ] ) ) {
$themes[ $theme ] = $_themes[ $theme_root['theme_root'] . '/' . $theme ];
} else {
$themes[ $theme ] = new WP_Theme( $theme, $theme_root['theme_root'] );
$_themes[ $theme_root['theme_root'] . '/' . $theme ] = $themes[ $theme ];
}
}
if ( null !== $args['errors'] ) {
foreach ( $themes as $theme => $wp_theme ) {
if ( $wp_theme->errors() != $args['errors'] ) {
unset( $themes[ $theme ] );
}
}
}
return $themes;
}
```
| Uses | Description |
| --- | --- |
| [get\_raw\_theme\_root()](get_raw_theme_root) wp-includes/theme.php | Gets the raw theme root relative to the content directory with no filters applied. |
| [search\_theme\_directories()](search_theme_directories) wp-includes/theme.php | Searches all registered theme directories for complete and valid themes. |
| [get\_stylesheet()](get_stylesheet) wp-includes/theme.php | Retrieves name of the current stylesheet. |
| [WP\_Theme::get\_allowed\_on\_network()](../classes/wp_theme/get_allowed_on_network) wp-includes/class-wp-theme.php | Returns array of stylesheet names of themes allowed on the network. |
| [WP\_Theme::get\_allowed\_on\_site()](../classes/wp_theme/get_allowed_on_site) wp-includes/class-wp-theme.php | Returns array of stylesheet names of themes allowed on the site. |
| [WP\_Theme::get\_allowed()](../classes/wp_theme/get_allowed) wp-includes/class-wp-theme.php | Returns array of stylesheet names of themes allowed on the site or network. |
| [WP\_Theme::errors()](../classes/wp_theme/errors) wp-includes/class-wp-theme.php | Returns errors property. |
| [WP\_Theme::\_\_construct()](../classes/wp_theme/__construct) wp-includes/class-wp-theme.php | Constructor for [WP\_Theme](../classes/wp_theme). |
| [is\_multisite()](is_multisite) wp-includes/load.php | If Multisite is enabled. |
| [wp\_parse\_args()](wp_parse_args) wp-includes/functions.php | Merges user defined arguments into defaults array. |
| Used By | Description |
| --- | --- |
| [Theme\_Installer\_Skin::do\_overwrite()](../classes/theme_installer_skin/do_overwrite) wp-admin/includes/class-theme-installer-skin.php | Check if the theme can be overwritten and output the HTML for overwriting a theme on upload. |
| [wp\_ajax\_toggle\_auto\_updates()](wp_ajax_toggle_auto_updates) wp-admin/includes/ajax-actions.php | Ajax handler to enable or disable plugin and theme auto-updates. |
| [WP\_Debug\_Data::debug\_data()](../classes/wp_debug_data/debug_data) wp-admin/includes/class-wp-debug-data.php | Static function for generating site debug data when required. |
| [WP\_Site\_Health::get\_test\_theme\_version()](../classes/wp_site_health/get_test_theme_version) wp-admin/includes/class-wp-site-health.php | Tests if themes are outdated, or unnecessary. |
| [WP\_REST\_Themes\_Controller::get\_items()](../classes/wp_rest_themes_controller/get_items) wp-includes/rest-api/endpoints/class-wp-rest-themes-controller.php | Retrieves a collection of themes. |
| [WP\_Customize\_Manager::handle\_load\_themes\_request()](../classes/wp_customize_manager/handle_load_themes_request) wp-includes/class-wp-customize-manager.php | Loads themes into the theme browsing/installation UI. |
| [wp\_prepare\_themes\_for\_js()](wp_prepare_themes_for_js) wp-admin/includes/theme.php | Prepares themes for JavaScript. |
| [get\_allowed\_themes()](get_allowed_themes) wp-admin/includes/deprecated.php | Get the allowed themes for the current site. |
| [get\_broken\_themes()](get_broken_themes) wp-admin/includes/deprecated.php | Retrieves a list of broken themes. |
| [WP\_MS\_Themes\_List\_Table::prepare\_items()](../classes/wp_ms_themes_list_table/prepare_items) wp-admin/includes/class-wp-ms-themes-list-table.php | |
| [upgrade\_network()](upgrade_network) wp-admin/includes/upgrade.php | Executes network-level upgrade routines. |
| [WP\_Themes\_List\_Table::prepare\_items()](../classes/wp_themes_list_table/prepare_items) wp-admin/includes/class-wp-themes-list-table.php | |
| [wp\_clean\_themes\_cache()](wp_clean_themes_cache) wp-includes/theme.php | Clears the cache held by [get\_theme\_roots()](get_theme_roots) and [WP\_Theme](../classes/wp_theme). |
| [get\_themes()](get_themes) wp-includes/deprecated.php | Retrieve list of themes with theme data in theme directory. |
| [WP\_Theme::get\_allowed\_on\_site()](../classes/wp_theme/get_allowed_on_site) wp-includes/class-wp-theme.php | Returns array of stylesheet names of themes allowed on the site. |
| [wp\_update\_themes()](wp_update_themes) wp-includes/update.php | Checks for available updates to themes based on the latest versions hosted on WordPress.org. |
| Version | Description |
| --- | --- |
| [3.4.0](https://developer.wordpress.org/reference/since/3.4.0/) | Introduced. |
wordpress apply_shortcodes( string $content, bool $ignore_html = false ): string apply\_shortcodes( string $content, bool $ignore\_html = false ): string
========================================================================
Searches content for shortcodes and filter shortcodes through their hooks.
This function is an alias for [do\_shortcode()](do_shortcode) .
* [do\_shortcode()](do_shortcode)
`$content` string Required Content to search for shortcodes. `$ignore_html` bool Optional When true, shortcodes inside HTML elements will be skipped.
Default: `false`
string Content with shortcodes filtered out.
File: `wp-includes/shortcodes.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/shortcodes.php/)
```
function apply_shortcodes( $content, $ignore_html = false ) {
return do_shortcode( $content, $ignore_html );
}
```
| Uses | Description |
| --- | --- |
| [do\_shortcode()](do_shortcode) wp-includes/shortcodes.php | Searches content for shortcodes and filter shortcodes through their hooks. |
| Version | Description |
| --- | --- |
| [5.4.0](https://developer.wordpress.org/reference/since/5.4.0/) | Introduced. |
wordpress wp_get_plugin_error( string $plugin ): array|false wp\_get\_plugin\_error( string $plugin ): array|false
=====================================================
Gets the error that was recorded for a paused plugin.
`$plugin` string Required Path to the plugin file relative to the plugins directory. array|false Array of error information as returned by `error_get_last()`, or false if none was recorded.
File: `wp-admin/includes/plugin.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/plugin.php/)
```
function wp_get_plugin_error( $plugin ) {
if ( ! isset( $GLOBALS['_paused_plugins'] ) ) {
return false;
}
list( $plugin ) = explode( '/', $plugin );
if ( ! array_key_exists( $plugin, $GLOBALS['_paused_plugins'] ) ) {
return false;
}
return $GLOBALS['_paused_plugins'][ $plugin ];
}
```
| Used By | Description |
| --- | --- |
| [WP\_Plugins\_List\_Table::single\_row()](../classes/wp_plugins_list_table/single_row) wp-admin/includes/class-wp-plugins-list-table.php | |
| Version | Description |
| --- | --- |
| [5.2.0](https://developer.wordpress.org/reference/since/5.2.0/) | Introduced. |
wordpress list_authors( bool $optioncount = false, bool $exclude_admin = true, bool $show_fullname = false, bool $hide_empty = true, string $feed = '', string $feed_image = '' ): null|string list\_authors( bool $optioncount = false, bool $exclude\_admin = true, bool $show\_fullname = false, bool $hide\_empty = true, string $feed = '', string $feed\_image = '' ): null|string
=========================================================================================================================================================================================
This function has been deprecated. Use [wp\_list\_authors()](wp_list_authors) instead.
Lists authors.
* [wp\_list\_authors()](wp_list_authors)
`$optioncount` bool Optional Default: `false`
`$exclude_admin` bool Optional Default: `true`
`$show_fullname` bool Optional Default: `false`
`$hide_empty` bool Optional Default: `true`
`$feed` string Optional Default: `''`
`$feed_image` string Optional Default: `''`
null|string
File: `wp-includes/deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/deprecated.php/)
```
function list_authors($optioncount = false, $exclude_admin = true, $show_fullname = false, $hide_empty = true, $feed = '', $feed_image = '') {
_deprecated_function( __FUNCTION__, '2.1.0', 'wp_list_authors()' );
$args = compact('optioncount', 'exclude_admin', 'show_fullname', 'hide_empty', 'feed', 'feed_image');
return wp_list_authors($args);
}
```
| Uses | Description |
| --- | --- |
| [wp\_list\_authors()](wp_list_authors) wp-includes/author-template.php | Lists all the authors of the site, with several options available. |
| [\_deprecated\_function()](_deprecated_function) wp-includes/functions.php | Marks a function as deprecated and inform when it has been used. |
| Version | Description |
| --- | --- |
| [2.1.0](https://developer.wordpress.org/reference/since/2.1.0/) | Use [wp\_list\_authors()](wp_list_authors) |
| [1.2.0](https://developer.wordpress.org/reference/since/1.2.0/) | Introduced. |
wordpress dead_db() dead\_db()
==========
Loads custom DB error or display WordPress DB error.
If a file exists in the wp-content directory named db-error.php, then it will be loaded instead of displaying the WordPress DB error. If it is not found, then the WordPress DB error will be displayed instead.
The WordPress DB error sets the HTTP status header to 500 to try to prevent search engines from caching the message. Custom DB messages should do the same.
This function was backported to WordPress 2.3.2, but originally was added in WordPress 2.5.0.
File: `wp-includes/functions.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/functions.php/)
```
function dead_db() {
global $wpdb;
wp_load_translations_early();
// Load custom DB error template, if present.
if ( file_exists( WP_CONTENT_DIR . '/db-error.php' ) ) {
require_once WP_CONTENT_DIR . '/db-error.php';
die();
}
// If installing or in the admin, provide the verbose message.
if ( wp_installing() || defined( 'WP_ADMIN' ) ) {
wp_die( $wpdb->error );
}
// Otherwise, be terse.
wp_die( '<h1>' . __( 'Error establishing a database connection' ) . '</h1>', __( 'Database Error' ) );
}
```
| Uses | Description |
| --- | --- |
| [wp\_installing()](wp_installing) wp-includes/load.php | Check or set whether WordPress is in “installation” mode. |
| [wp\_load\_translations\_early()](wp_load_translations_early) wp-includes/load.php | Attempt an early load of translations. |
| [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. |
| [wp\_die()](wp_die) wp-includes/functions.php | Kills WordPress execution and displays HTML page with an error message. |
| Used By | Description |
| --- | --- |
| [wp\_set\_wpdb\_vars()](wp_set_wpdb_vars) wp-includes/load.php | Set the database table prefix and the format specifiers for database table columns. |
| [is\_blog\_installed()](is_blog_installed) wp-includes/functions.php | Determines whether WordPress is already installed. |
| [ms\_not\_installed()](ms_not_installed) wp-includes/ms-load.php | Displays a failure message. |
| [wpdb::check\_connection()](../classes/wpdb/check_connection) wp-includes/class-wpdb.php | Checks that the connection to the database is still up. If not, try to reconnect. |
| Version | Description |
| --- | --- |
| [2.3.2](https://developer.wordpress.org/reference/since/2.3.2/) | Introduced. |
wordpress block_editor_rest_api_preload( string[] $preload_paths, WP_Block_Editor_Context $block_editor_context ) block\_editor\_rest\_api\_preload( string[] $preload\_paths, WP\_Block\_Editor\_Context $block\_editor\_context )
=================================================================================================================
Preloads common data used with the block editor by specifying an array of REST API paths that will be preloaded for a given block editor context.
`$preload_paths` string[] Required List of paths to preload. `$block_editor_context` [WP\_Block\_Editor\_Context](../classes/wp_block_editor_context) Required The current block editor context. File: `wp-includes/block-editor.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/block-editor.php/)
```
function block_editor_rest_api_preload( array $preload_paths, $block_editor_context ) {
global $post, $wp_scripts, $wp_styles;
/**
* Filters the array of REST API paths that will be used to preloaded common data for the block editor.
*
* @since 5.8.0
*
* @param string[] $preload_paths Array of paths to preload.
* @param WP_Block_Editor_Context $block_editor_context The current block editor context.
*/
$preload_paths = apply_filters( 'block_editor_rest_api_preload_paths', $preload_paths, $block_editor_context );
if ( ! empty( $block_editor_context->post ) ) {
$selected_post = $block_editor_context->post;
/**
* Filters the array of paths that will be preloaded.
*
* Preload common data by specifying an array of REST API paths that will be preloaded.
*
* @since 5.0.0
* @deprecated 5.8.0 Use the {@see 'block_editor_rest_api_preload_paths'} filter instead.
*
* @param string[] $preload_paths Array of paths to preload.
* @param WP_Post $selected_post Post being edited.
*/
$preload_paths = apply_filters_deprecated( 'block_editor_preload_paths', array( $preload_paths, $selected_post ), '5.8.0', 'block_editor_rest_api_preload_paths' );
}
if ( empty( $preload_paths ) ) {
return;
}
/*
* Ensure the global $post, $wp_scripts, and $wp_styles remain the same after
* API data is preloaded.
* Because API preloading can call the_content and other filters, plugins
* can unexpectedly modify the global $post or enqueue assets which are not
* intended for the block editor.
*/
$backup_global_post = ! empty( $post ) ? clone $post : $post;
$backup_wp_scripts = ! empty( $wp_scripts ) ? clone $wp_scripts : $wp_scripts;
$backup_wp_styles = ! empty( $wp_styles ) ? clone $wp_styles : $wp_styles;
foreach ( $preload_paths as &$path ) {
if ( is_string( $path ) && ! str_starts_with( $path, '/' ) ) {
$path = '/' . $path;
continue;
}
if ( is_array( $path ) && is_string( $path[0] ) && ! str_starts_with( $path[0], '/' ) ) {
$path[0] = '/' . $path[0];
}
}
unset( $path );
$preload_data = array_reduce(
$preload_paths,
'rest_preload_api_request',
array()
);
// Restore the global $post, $wp_scripts, and $wp_styles as they were before API preloading.
$post = $backup_global_post;
$wp_scripts = $backup_wp_scripts;
$wp_styles = $backup_wp_styles;
wp_add_inline_script(
'wp-api-fetch',
sprintf(
'wp.apiFetch.use( wp.apiFetch.createPreloadingMiddleware( %s ) );',
wp_json_encode( $preload_data )
),
'after'
);
}
```
[apply\_filters\_deprecated( 'block\_editor\_preload\_paths', string[] $preload\_paths, WP\_Post $selected\_post )](../hooks/block_editor_preload_paths)
Filters the array of paths that will be preloaded.
[apply\_filters( 'block\_editor\_rest\_api\_preload\_paths', string[] $preload\_paths, WP\_Block\_Editor\_Context $block\_editor\_context )](../hooks/block_editor_rest_api_preload_paths)
Filters the array of REST API paths that will be used to preloaded common data for the block editor.
| Uses | Description |
| --- | --- |
| [apply\_filters\_deprecated()](apply_filters_deprecated) wp-includes/plugin.php | Fires functions attached to a deprecated filter hook. |
| [wp\_add\_inline\_script()](wp_add_inline_script) wp-includes/functions.wp-scripts.php | Adds extra code to a registered script. |
| [wp\_json\_encode()](wp_json_encode) wp-includes/functions.php | Encodes a variable into JSON, with some sanity checks. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| Version | Description |
| --- | --- |
| [5.8.0](https://developer.wordpress.org/reference/since/5.8.0/) | Introduced. |
wordpress deactivate_plugins( string|string[] $plugins, bool $silent = false, bool|null $network_wide = null ) deactivate\_plugins( string|string[] $plugins, bool $silent = false, bool|null $network\_wide = null )
======================================================================================================
Deactivates a single plugin or multiple plugins.
The deactivation hook is disabled by the plugin upgrader by using the $silent parameter.
`$plugins` string|string[] Required Single plugin or list of plugins to deactivate. `$silent` bool Optional Prevent calling deactivation hooks. Default: `false`
`$network_wide` bool|null Optional Whether to deactivate the plugin for all sites in the network.
A value of null will deactivate plugins for both the network and the current site. Multisite only. Default: `null`
This function is often used by a plugin to deactivate itself if the plugin requires the presence of certain features that are missing in environment after an administrator has activated it. This is usually the last step in a dependency-checking function.
File: `wp-admin/includes/plugin.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/plugin.php/)
```
function deactivate_plugins( $plugins, $silent = false, $network_wide = null ) {
if ( is_multisite() ) {
$network_current = get_site_option( 'active_sitewide_plugins', array() );
}
$current = get_option( 'active_plugins', array() );
$do_blog = false;
$do_network = false;
foreach ( (array) $plugins as $plugin ) {
$plugin = plugin_basename( trim( $plugin ) );
if ( ! is_plugin_active( $plugin ) ) {
continue;
}
$network_deactivating = ( false !== $network_wide ) && is_plugin_active_for_network( $plugin );
if ( ! $silent ) {
/**
* Fires before a plugin is deactivated.
*
* If a plugin is silently deactivated (such as during an update),
* this hook does not fire.
*
* @since 2.9.0
*
* @param string $plugin Path to the plugin file relative to the plugins directory.
* @param bool $network_deactivating Whether the plugin is deactivated for all sites in the network
* or just the current site. Multisite only. Default false.
*/
do_action( 'deactivate_plugin', $plugin, $network_deactivating );
}
if ( false !== $network_wide ) {
if ( is_plugin_active_for_network( $plugin ) ) {
$do_network = true;
unset( $network_current[ $plugin ] );
} elseif ( $network_wide ) {
continue;
}
}
if ( true !== $network_wide ) {
$key = array_search( $plugin, $current, true );
if ( false !== $key ) {
$do_blog = true;
unset( $current[ $key ] );
}
}
if ( $do_blog && wp_is_recovery_mode() ) {
list( $extension ) = explode( '/', $plugin );
wp_paused_plugins()->delete( $extension );
}
if ( ! $silent ) {
/**
* Fires as a specific plugin is being deactivated.
*
* This hook is the "deactivation" hook used internally by register_deactivation_hook().
* The dynamic portion of the hook name, `$plugin`, refers to the plugin basename.
*
* If a plugin is silently deactivated (such as during an update), this hook does not fire.
*
* @since 2.0.0
*
* @param bool $network_deactivating Whether the plugin is deactivated for all sites in the network
* or just the current site. Multisite only. Default false.
*/
do_action( "deactivate_{$plugin}", $network_deactivating );
/**
* Fires after a plugin is deactivated.
*
* If a plugin is silently deactivated (such as during an update),
* this hook does not fire.
*
* @since 2.9.0
*
* @param string $plugin Path to the plugin file relative to the plugins directory.
* @param bool $network_deactivating Whether the plugin is deactivated for all sites in the network
* or just the current site. Multisite only. Default false.
*/
do_action( 'deactivated_plugin', $plugin, $network_deactivating );
}
}
if ( $do_blog ) {
update_option( 'active_plugins', $current );
}
if ( $do_network ) {
update_site_option( 'active_sitewide_plugins', $network_current );
}
}
```
[do\_action( 'deactivated\_plugin', string $plugin, bool $network\_deactivating )](../hooks/deactivated_plugin)
Fires after a plugin is deactivated.
[do\_action( "deactivate\_{$plugin}", bool $network\_deactivating )](../hooks/deactivate_plugin)
Fires as a specific plugin is being deactivated.
| Uses | Description |
| --- | --- |
| [wp\_is\_recovery\_mode()](wp_is_recovery_mode) wp-includes/load.php | Is WordPress in Recovery Mode. |
| [wp\_paused\_plugins()](wp_paused_plugins) wp-includes/error-protection.php | Get the instance for storing paused plugins. |
| [is\_plugin\_active()](is_plugin_active) wp-admin/includes/plugin.php | Determines whether a plugin is active. |
| [is\_plugin\_active\_for\_network()](is_plugin_active_for_network) wp-admin/includes/plugin.php | Determines whether the plugin is active for the entire network. |
| [plugin\_basename()](plugin_basename) wp-includes/plugin.php | Gets the basename of a plugin. |
| [update\_site\_option()](update_site_option) wp-includes/option.php | Updates the value of an option that was already added for the current network. |
| [is\_multisite()](is_multisite) wp-includes/load.php | If Multisite is enabled. |
| [do\_action()](do_action) wp-includes/plugin.php | Calls the callback functions that have been added to an action hook. |
| [get\_site\_option()](get_site_option) wp-includes/option.php | Retrieve an option value for the current network based on name of option. |
| [update\_option()](update_option) wp-includes/option.php | Updates the value of an option that was already added. |
| [get\_option()](get_option) wp-includes/option.php | Retrieves an option value based on an option name. |
| Used By | Description |
| --- | --- |
| [WP\_REST\_Plugins\_Controller::handle\_plugin\_status()](../classes/wp_rest_plugins_controller/handle_plugin_status) wp-includes/rest-api/endpoints/class-wp-rest-plugins-controller.php | Handle updating a plugin’s status. |
| [Plugin\_Upgrader::deactivate\_plugin\_before\_upgrade()](../classes/plugin_upgrader/deactivate_plugin_before_upgrade) wp-admin/includes/class-plugin-upgrader.php | Deactivates a plugin before it is upgraded. |
| [validate\_active\_plugins()](validate_active_plugins) wp-admin/includes/plugin.php | Validates active plugins. |
| Version | Description |
| --- | --- |
| [2.5.0](https://developer.wordpress.org/reference/since/2.5.0/) | Introduced. |
| programming_docs |
wordpress get_next_image_link( string|int[] $size = 'thumbnail', string|false $text = false ): string get\_next\_image\_link( string|int[] $size = 'thumbnail', string|false $text = false ): string
==============================================================================================
Gets the next image link that has the same post parent.
* [get\_adjacent\_image\_link()](get_adjacent_image_link)
`$size` string|int[] Optional Image size. Accepts any registered image size name, or an array of width and height values in pixels (in that order). Default `'thumbnail'`. Default: `'thumbnail'`
`$text` string|false Optional Link text. Default: `false`
string Markup for next image link.
File: `wp-includes/media.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/media.php/)
```
function get_next_image_link( $size = 'thumbnail', $text = false ) {
return get_adjacent_image_link( false, $size, $text );
}
```
| Uses | Description |
| --- | --- |
| [get\_adjacent\_image\_link()](get_adjacent_image_link) wp-includes/media.php | Gets the next or previous image link that has the same post parent. |
| Used By | Description |
| --- | --- |
| [next\_image\_link()](next_image_link) wp-includes/media.php | Displays next image link that has the same post parent. |
| Version | Description |
| --- | --- |
| [5.8.0](https://developer.wordpress.org/reference/since/5.8.0/) | Introduced. |
wordpress before_last_bar( string $string ): string before\_last\_bar( string $string ): string
===========================================
Removes last item on a pipe-delimited string.
Meant for removing the last item in a string, such as ‘Role name|User role’. The original string will be returned if no pipe ‘|’ characters are found in the string.
`$string` string Required A pipe-delimited string. string Either $string or everything before the last pipe.
File: `wp-includes/l10n.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/l10n.php/)
```
function before_last_bar( $string ) {
$last_bar = strrpos( $string, '|' );
if ( false === $last_bar ) {
return $string;
} else {
return substr( $string, 0, $last_bar );
}
}
```
| Used By | Description |
| --- | --- |
| [translate\_user\_role()](translate_user_role) wp-includes/l10n.php | Translates role name. |
| [\_c()](_c) wp-includes/deprecated.php | Retrieve translated string with vertical bar context |
| [translate\_with\_context()](translate_with_context) wp-includes/deprecated.php | Translates $text like [translate()](translate) , but assumes that the text contains a context after its last vertical bar. |
| [\_nc()](_nc) wp-includes/deprecated.php | Legacy version of [\_n()](_n) , which supports contexts. |
| Version | Description |
| --- | --- |
| [2.8.0](https://developer.wordpress.org/reference/since/2.8.0/) | Introduced. |
wordpress img_caption_shortcode( array $attr, string $content = '' ): string img\_caption\_shortcode( array $attr, string $content = '' ): string
====================================================================
Builds the Caption shortcode output.
Allows a plugin to replace the content that would otherwise be returned. The filter is [‘img\_caption\_shortcode’](../hooks/img_caption_shortcode) and passes an empty string, the attr parameter and the content parameter values.
The supported attributes for the shortcode are ‘id’, ‘caption\_id’, ‘align’, ‘width’, ‘caption’, and ‘class’.
`$attr` array Required Attributes of the caption shortcode.
* `id`stringID of the image and caption container element, i.e. `<figure>` or `<div>`.
* `caption_id`stringID of the caption element, i.e. `<figcaption>` or `<p>`.
* `align`stringClass name that aligns the caption. Default `'alignnone'`. Accepts `'alignleft'`, `'aligncenter'`, alignright', `'alignnone'`.
* `width`intThe width of the caption, in pixels.
* `caption`stringThe caption text.
* `class`stringAdditional class name(s) added to the caption container.
`$content` string Optional Shortcode content. Default: `''`
string HTML content to display the caption.
File: `wp-includes/media.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/media.php/)
```
function img_caption_shortcode( $attr, $content = '' ) {
// New-style shortcode with the caption inside the shortcode with the link and image tags.
if ( ! isset( $attr['caption'] ) ) {
if ( preg_match( '#((?:<a [^>]+>\s*)?<img [^>]+>(?:\s*</a>)?)(.*)#is', $content, $matches ) ) {
$content = $matches[1];
$attr['caption'] = trim( $matches[2] );
}
} elseif ( strpos( $attr['caption'], '<' ) !== false ) {
$attr['caption'] = wp_kses( $attr['caption'], 'post' );
}
/**
* Filters the default caption shortcode output.
*
* If the filtered output isn't empty, it will be used instead of generating
* the default caption template.
*
* @since 2.6.0
*
* @see img_caption_shortcode()
*
* @param string $output The caption output. Default empty.
* @param array $attr Attributes of the caption shortcode.
* @param string $content The image element, possibly wrapped in a hyperlink.
*/
$output = apply_filters( 'img_caption_shortcode', '', $attr, $content );
if ( ! empty( $output ) ) {
return $output;
}
$atts = shortcode_atts(
array(
'id' => '',
'caption_id' => '',
'align' => 'alignnone',
'width' => '',
'caption' => '',
'class' => '',
),
$attr,
'caption'
);
$atts['width'] = (int) $atts['width'];
if ( $atts['width'] < 1 || empty( $atts['caption'] ) ) {
return $content;
}
$id = '';
$caption_id = '';
$describedby = '';
if ( $atts['id'] ) {
$atts['id'] = sanitize_html_class( $atts['id'] );
$id = 'id="' . esc_attr( $atts['id'] ) . '" ';
}
if ( $atts['caption_id'] ) {
$atts['caption_id'] = sanitize_html_class( $atts['caption_id'] );
} elseif ( $atts['id'] ) {
$atts['caption_id'] = 'caption-' . str_replace( '_', '-', $atts['id'] );
}
if ( $atts['caption_id'] ) {
$caption_id = 'id="' . esc_attr( $atts['caption_id'] ) . '" ';
$describedby = 'aria-describedby="' . esc_attr( $atts['caption_id'] ) . '" ';
}
$class = trim( 'wp-caption ' . $atts['align'] . ' ' . $atts['class'] );
$html5 = current_theme_supports( 'html5', 'caption' );
// HTML5 captions never added the extra 10px to the image width.
$width = $html5 ? $atts['width'] : ( 10 + $atts['width'] );
/**
* Filters the width of an image's caption.
*
* By default, the caption is 10 pixels greater than the width of the image,
* to prevent post content from running up against a floated image.
*
* @since 3.7.0
*
* @see img_caption_shortcode()
*
* @param int $width Width of the caption in pixels. To remove this inline style,
* return zero.
* @param array $atts Attributes of the caption shortcode.
* @param string $content The image element, possibly wrapped in a hyperlink.
*/
$caption_width = apply_filters( 'img_caption_shortcode_width', $width, $atts, $content );
$style = '';
if ( $caption_width ) {
$style = 'style="width: ' . (int) $caption_width . 'px" ';
}
if ( $html5 ) {
$html = sprintf(
'<figure %s%s%sclass="%s">%s%s</figure>',
$id,
$describedby,
$style,
esc_attr( $class ),
do_shortcode( $content ),
sprintf(
'<figcaption %sclass="wp-caption-text">%s</figcaption>',
$caption_id,
$atts['caption']
)
);
} else {
$html = sprintf(
'<div %s%sclass="%s">%s%s</div>',
$id,
$style,
esc_attr( $class ),
str_replace( '<img ', '<img ' . $describedby, do_shortcode( $content ) ),
sprintf(
'<p %sclass="wp-caption-text">%s</p>',
$caption_id,
$atts['caption']
)
);
}
return $html;
}
```
[apply\_filters( 'img\_caption\_shortcode', string $output, array $attr, string $content )](../hooks/img_caption_shortcode)
Filters the default caption shortcode output.
[apply\_filters( 'img\_caption\_shortcode\_width', int $width, array $atts, string $content )](../hooks/img_caption_shortcode_width)
Filters the width of an image’s caption.
| Uses | Description |
| --- | --- |
| [sanitize\_html\_class()](sanitize_html_class) wp-includes/formatting.php | Sanitizes an HTML classname to ensure it only contains valid characters. |
| [wp\_kses()](wp_kses) wp-includes/kses.php | Filters text content and strips out disallowed HTML. |
| [shortcode\_atts()](shortcode_atts) wp-includes/shortcodes.php | Combines user attributes with known attributes and fill in defaults when needed. |
| [do\_shortcode()](do_shortcode) wp-includes/shortcodes.php | Searches content for shortcodes and filter shortcodes through their hooks. |
| [current\_theme\_supports()](current_theme_supports) wp-includes/theme.php | Checks a theme’s support for a given feature. |
| [esc\_attr()](esc_attr) wp-includes/formatting.php | Escaping for HTML attributes. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| Used By | Description |
| --- | --- |
| [WP\_Widget\_Media\_Image::render\_media()](../classes/wp_widget_media_image/render_media) wp-includes/widgets/class-wp-widget-media-image.php | Render the media on the frontend. |
| Version | Description |
| --- | --- |
| [5.9.0](https://developer.wordpress.org/reference/since/5.9.0/) | The `$content` parameter default value changed from `null` to `''`. |
| [5.1.0](https://developer.wordpress.org/reference/since/5.1.0/) | The `caption_id` attribute was added. |
| [3.9.0](https://developer.wordpress.org/reference/since/3.9.0/) | The `class` attribute was added. |
| [2.6.0](https://developer.wordpress.org/reference/since/2.6.0/) | Introduced. |
wordpress _register_remote_theme_patterns() \_register\_remote\_theme\_patterns()
=====================================
This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.
Registers patterns from Pattern Directory provided by a theme’s `theme.json` file.
File: `wp-includes/block-patterns.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/block-patterns.php/)
```
function _register_remote_theme_patterns() {
/** This filter is documented in wp-includes/block-patterns.php */
if ( ! apply_filters( 'should_load_remote_block_patterns', true ) ) {
return;
}
if ( ! WP_Theme_JSON_Resolver::theme_has_support() ) {
return;
}
$pattern_settings = WP_Theme_JSON_Resolver::get_theme_data()->get_patterns();
if ( empty( $pattern_settings ) ) {
return;
}
$request = new WP_REST_Request( 'GET', '/wp/v2/pattern-directory/patterns' );
$request['slug'] = $pattern_settings;
$response = rest_do_request( $request );
if ( $response->is_error() ) {
return;
}
$patterns = $response->get_data();
$patterns_registry = WP_Block_Patterns_Registry::get_instance();
foreach ( $patterns as $pattern ) {
$pattern_name = sanitize_title( $pattern['title'] );
// Some patterns might be already registered as core patterns with the `core` prefix.
$is_registered = $patterns_registry->is_registered( $pattern_name ) || $patterns_registry->is_registered( "core/$pattern_name" );
if ( ! $is_registered ) {
register_block_pattern( $pattern_name, (array) $pattern );
}
}
}
```
[apply\_filters( 'should\_load\_remote\_block\_patterns', bool $should\_load\_remote )](../hooks/should_load_remote_block_patterns)
Filter to disable remote block patterns.
| Uses | Description |
| --- | --- |
| [WP\_Theme\_JSON\_Resolver::theme\_has\_support()](../classes/wp_theme_json_resolver/theme_has_support) wp-includes/class-wp-theme-json-resolver.php | Determines whether the active theme has a theme.json file. |
| [WP\_Theme\_JSON\_Resolver::get\_theme\_data()](../classes/wp_theme_json_resolver/get_theme_data) wp-includes/class-wp-theme-json-resolver.php | Returns the theme’s data. |
| [WP\_Block\_Patterns\_Registry::get\_instance()](../classes/wp_block_patterns_registry/get_instance) wp-includes/class-wp-block-patterns-registry.php | Utility method to retrieve the main instance of the class. |
| [register\_block\_pattern()](register_block_pattern) wp-includes/class-wp-block-patterns-registry.php | Registers a new block pattern. |
| [rest\_do\_request()](rest_do_request) wp-includes/rest-api.php | Do a REST request. |
| [WP\_REST\_Request::\_\_construct()](../classes/wp_rest_request/__construct) wp-includes/rest-api/class-wp-rest-request.php | Constructor. |
| [sanitize\_title()](sanitize_title) wp-includes/formatting.php | Sanitizes a string into a slug, which can be used in URLs or HTML attributes. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| Used By | Description |
| --- | --- |
| [WP\_REST\_Block\_Patterns\_Controller::get\_items()](../classes/wp_rest_block_patterns_controller/get_items) wp-includes/rest-api/endpoints/class-wp-rest-block-patterns-controller.php | Retrieves all block patterns. |
| Version | Description |
| --- | --- |
| [6.0.0](https://developer.wordpress.org/reference/since/6.0.0/) | Introduced. |
wordpress wp_welcome_panel() wp\_welcome\_panel()
====================
Displays a welcome panel to introduce users to WordPress.
File: `wp-admin/includes/dashboard.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/dashboard.php/)
```
function wp_welcome_panel() {
list( $display_version ) = explode( '-', get_bloginfo( 'version' ) );
$can_customize = current_user_can( 'customize' );
$is_block_theme = wp_is_block_theme();
?>
<div class="welcome-panel-content">
<div class="welcome-panel-header">
<div class="welcome-panel-header-image">
<?php echo file_get_contents( dirname( __DIR__ ) . '/images/about-header-about.svg' ); ?>
</div>
<h2><?php _e( 'Welcome to WordPress!' ); ?></h2>
<p>
<a href="<?php echo esc_url( admin_url( 'about.php' ) ); ?>">
<?php
/* translators: %s: Current WordPress version. */
printf( __( 'Learn more about the %s version.' ), $display_version );
?>
</a>
</p>
</div>
<div class="welcome-panel-column-container">
<div class="welcome-panel-column">
<svg width="48" height="48" viewBox="0 0 48 48" fill="none" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false">
<rect width="48" height="48" rx="4" fill="#1E1E1E"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M32.0668 17.0854L28.8221 13.9454L18.2008 24.671L16.8983 29.0827L21.4257 27.8309L32.0668 17.0854ZM16 32.75H24V31.25H16V32.75Z" fill="white"/>
</svg>
<div class="welcome-panel-column-content">
<h3><?php _e( 'Author rich content with blocks and patterns' ); ?></h3>
<p><?php _e( 'Block patterns are pre-configured block layouts. Use them to get inspired or create new pages in a flash.' ); ?></p>
<a href="<?php echo esc_url( admin_url( 'post-new.php?post_type=page' ) ); ?>"><?php _e( 'Add a new page' ); ?></a>
</div>
</div>
<div class="welcome-panel-column">
<svg width="48" height="48" viewBox="0 0 48 48" fill="none" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false">
<rect width="48" height="48" rx="4" fill="#1E1E1E"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M18 16h12a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H18a2 2 0 0 1-2-2V18a2 2 0 0 1 2-2zm12 1.5H18a.5.5 0 0 0-.5.5v3h13v-3a.5.5 0 0 0-.5-.5zm.5 5H22v8h8a.5.5 0 0 0 .5-.5v-7.5zm-10 0h-3V30a.5.5 0 0 0 .5.5h2.5v-8z" fill="#fff"/>
</svg>
<div class="welcome-panel-column-content">
<?php if ( $is_block_theme ) : ?>
<h3><?php _e( 'Customize your entire site with block themes' ); ?></h3>
<p><?php _e( 'Design everything on your site — from the header down to the footer, all using blocks and patterns.' ); ?></p>
<a href="<?php echo esc_url( admin_url( 'site-editor.php' ) ); ?>"><?php _e( 'Open site editor' ); ?></a>
<?php else : ?>
<h3><?php _e( 'Start Customizing' ); ?></h3>
<p><?php _e( 'Configure your site’s logo, header, menus, and more in the Customizer.' ); ?></p>
<?php if ( $can_customize ) : ?>
<a class="load-customize hide-if-no-customize" href="<?php echo wp_customize_url(); ?>"><?php _e( 'Open the Customizer' ); ?></a>
<?php endif; ?>
<?php endif; ?>
</div>
</div>
<div class="welcome-panel-column">
<svg width="48" height="48" viewBox="0 0 48 48" fill="none" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false">
<rect width="48" height="48" rx="4" fill="#1E1E1E"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M31 24a7 7 0 0 1-7 7V17a7 7 0 0 1 7 7zm-7-8a8 8 0 1 1 0 16 8 8 0 0 1 0-16z" fill="#fff"/>
</svg>
<div class="welcome-panel-column-content">
<?php if ( $is_block_theme ) : ?>
<h3><?php _e( 'Switch up your site’s look & feel with Styles' ); ?></h3>
<p><?php _e( 'Tweak your site, or give it a whole new look! Get creative — how about a new color palette or font?' ); ?></p>
<a href="<?php echo esc_url( admin_url( 'site-editor.php?styles=open' ) ); ?>"><?php _e( 'Edit styles' ); ?></a>
<?php else : ?>
<h3><?php _e( 'Discover a new way to build your site.' ); ?></h3>
<p><?php _e( 'There is a new kind of WordPress theme, called a block theme, that lets you build the site you’ve always wanted — with blocks and styles.' ); ?></p>
<a href="<?php echo esc_url( __( 'https://wordpress.org/support/article/block-themes/' ) ); ?>"><?php _e( 'Learn about block themes' ); ?></a>
<?php endif; ?>
</div>
</div>
</div>
</div>
<?php
}
```
| Uses | Description |
| --- | --- |
| [wp\_is\_block\_theme()](wp_is_block_theme) wp-includes/theme.php | Returns whether the active theme is a block-based theme or not. |
| [wp\_customize\_url()](wp_customize_url) wp-includes/theme.php | Returns a URL to load the Customizer. |
| [current\_user\_can()](current_user_can) wp-includes/capabilities.php | Returns whether the current user has the specified capability. |
| [\_e()](_e) wp-includes/l10n.php | Displays translated text. |
| [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. |
| [esc\_url()](esc_url) wp-includes/formatting.php | Checks and cleans a URL. |
| [get\_bloginfo()](get_bloginfo) wp-includes/general-template.php | Retrieves information about the current site. |
| [admin\_url()](admin_url) wp-includes/link-template.php | Retrieves the URL to the admin area for the current site. |
| Version | Description |
| --- | --- |
| [5.9.0](https://developer.wordpress.org/reference/since/5.9.0/) | Send users to the Site Editor if the active theme is block-based. |
| [3.3.0](https://developer.wordpress.org/reference/since/3.3.0/) | Introduced. |
wordpress the_archive_description( string $before = '', string $after = '' ) the\_archive\_description( string $before = '', string $after = '' )
====================================================================
Displays category, tag, term, or author description.
* [get\_the\_archive\_description()](get_the_archive_description)
`$before` string Optional Content to prepend to the description. Default: `''`
`$after` string Optional Content to append to the description. Default: `''`
File: `wp-includes/general-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/general-template.php/)
```
function the_archive_description( $before = '', $after = '' ) {
$description = get_the_archive_description();
if ( $description ) {
echo $before . $description . $after;
}
}
```
| Uses | Description |
| --- | --- |
| [get\_the\_archive\_description()](get_the_archive_description) wp-includes/general-template.php | Retrieves the description for an author, post type, or term archive. |
| Version | Description |
| --- | --- |
| [4.1.0](https://developer.wordpress.org/reference/since/4.1.0/) | Introduced. |
| programming_docs |
wordpress _wp_to_kebab_case( string $string ): string \_wp\_to\_kebab\_case( string $string ): string
===============================================
This function is trying to replicate what lodash’s kebabCase (JS library) does in the client.
The reason we need this function is that we do some processing in both the client and the server (e.g.: we generate preset classes from preset slugs) that needs to create the same output.
We can’t remove or update the client’s library due to backward compatibility (some of the output of lodash’s kebabCase is saved in the post content).
We have to make the server behave like the client.
Changes to this function should follow updates in the client with the same logic.
`$string` string Required The string to kebab-case. string kebab-cased-string.
File: `wp-includes/functions.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/functions.php/)
```
function _wp_to_kebab_case( $string ) {
//phpcs:disable WordPress.NamingConventions.ValidVariableName.VariableNotSnakeCase
// ignore the camelCase names for variables so the names are the same as lodash
// so comparing and porting new changes is easier.
/*
* Some notable things we've removed compared to the lodash version are:
*
* - non-alphanumeric characters: rsAstralRange, rsEmoji, etc
* - the groups that processed the apostrophe, as it's removed before passing the string to preg_match: rsApos, rsOptContrLower, and rsOptContrUpper
*
*/
/** Used to compose unicode character classes. */
$rsLowerRange = 'a-z\\xdf-\\xf6\\xf8-\\xff';
$rsNonCharRange = '\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf';
$rsPunctuationRange = '\\x{2000}-\\x{206f}';
$rsSpaceRange = ' \\t\\x0b\\f\\xa0\\x{feff}\\n\\r\\x{2028}\\x{2029}\\x{1680}\\x{180e}\\x{2000}\\x{2001}\\x{2002}\\x{2003}\\x{2004}\\x{2005}\\x{2006}\\x{2007}\\x{2008}\\x{2009}\\x{200a}\\x{202f}\\x{205f}\\x{3000}';
$rsUpperRange = 'A-Z\\xc0-\\xd6\\xd8-\\xde';
$rsBreakRange = $rsNonCharRange . $rsPunctuationRange . $rsSpaceRange;
/** Used to compose unicode capture groups. */
$rsBreak = '[' . $rsBreakRange . ']';
$rsDigits = '\\d+'; // The last lodash version in GitHub uses a single digit here and expands it when in use.
$rsLower = '[' . $rsLowerRange . ']';
$rsMisc = '[^' . $rsBreakRange . $rsDigits . $rsLowerRange . $rsUpperRange . ']';
$rsUpper = '[' . $rsUpperRange . ']';
/** Used to compose unicode regexes. */
$rsMiscLower = '(?:' . $rsLower . '|' . $rsMisc . ')';
$rsMiscUpper = '(?:' . $rsUpper . '|' . $rsMisc . ')';
$rsOrdLower = '\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])';
$rsOrdUpper = '\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])';
$regexp = '/' . implode(
'|',
array(
$rsUpper . '?' . $rsLower . '+' . '(?=' . implode( '|', array( $rsBreak, $rsUpper, '$' ) ) . ')',
$rsMiscUpper . '+' . '(?=' . implode( '|', array( $rsBreak, $rsUpper . $rsMiscLower, '$' ) ) . ')',
$rsUpper . '?' . $rsMiscLower . '+',
$rsUpper . '+',
$rsOrdUpper,
$rsOrdLower,
$rsDigits,
)
) . '/u';
preg_match_all( $regexp, str_replace( "'", '', $string ), $matches );
return strtolower( implode( '-', $matches[0] ) );
//phpcs:enable WordPress.NamingConventions.ValidVariableName.VariableNotSnakeCase
}
```
| Used By | Description |
| --- | --- |
| [WP\_Style\_Engine::get\_css\_declarations()](../classes/wp_style_engine/get_css_declarations) wp-includes/style-engine/class-wp-style-engine.php | Returns an array of CSS declarations based on valid block style values. |
| [WP\_Style\_Engine::get\_slug\_from\_preset\_value()](../classes/wp_style_engine/get_slug_from_preset_value) wp-includes/style-engine/class-wp-style-engine.php | Util: Extracts the slug in kebab case from a preset string, e.g., “heavenly-blue” from ‘var:preset|color|heavenlyBlue’. |
| [\_wp\_theme\_json\_webfonts\_handler()](_wp_theme_json_webfonts_handler) wp-includes/script-loader.php | Runs the theme.json webfonts handler. |
| [WP\_Theme\_JSON::get\_settings\_values\_by\_slug()](../classes/wp_theme_json/get_settings_values_by_slug) wp-includes/class-wp-theme-json.php | Gets preset values keyed by slugs based on settings and metadata. |
| [WP\_Theme\_JSON::get\_settings\_slugs()](../classes/wp_theme_json/get_settings_slugs) wp-includes/class-wp-theme-json.php | Similar to get\_settings\_values\_by\_slug, but doesn’t compute the value. |
| [WP\_Theme\_JSON::flatten\_tree()](../classes/wp_theme_json/flatten_tree) wp-includes/class-wp-theme-json.php | Given a tree, it creates a flattened one by merging the keys and binding the leaf values to the new keys. |
wordpress the_author_url() the\_author\_url()
==================
This function has been deprecated. Use [the\_author\_meta()](the_author_meta) instead.
Display the URL to the home page of the author of the current post.
* [the\_author\_meta()](the_author_meta)
File: `wp-includes/deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/deprecated.php/)
```
function the_author_url() {
_deprecated_function( __FUNCTION__, '2.8.0', 'the_author_meta(\'url\')' );
the_author_meta('url');
}
```
| Uses | Description |
| --- | --- |
| [the\_author\_meta()](the_author_meta) wp-includes/author-template.php | Outputs the field from the user’s DB object. Defaults to current post’s author. |
| [\_deprecated\_function()](_deprecated_function) wp-includes/functions.php | Marks a function as deprecated and inform when it has been used. |
| Version | Description |
| --- | --- |
| [2.8.0](https://developer.wordpress.org/reference/since/2.8.0/) | Use [the\_author\_meta()](the_author_meta) |
| [0.71](https://developer.wordpress.org/reference/since/0.71/) | Introduced. |
wordpress do_meta_boxes( string|WP_Screen $screen, string $context, mixed $data_object ): int do\_meta\_boxes( string|WP\_Screen $screen, string $context, mixed $data\_object ): int
=======================================================================================
Meta-Box template function.
`$screen` string|[WP\_Screen](../classes/wp_screen) Required The screen identifier. If you have used [add\_menu\_page()](add_menu_page) or [add\_submenu\_page()](add_submenu_page) to create a new screen (and hence screen\_id) make sure your menu slug conforms to the limits of [sanitize\_key()](sanitize_key) otherwise the `'screen'` menu may not correctly render on your page. `$context` string Required The screen context for which to display meta boxes. `$data_object` mixed Required Gets passed to the meta box callback function as the first parameter.
Often this is the object that's the focus of the current screen, for example a `WP_Post` or `WP_Comment` object. int Number of meta\_boxes.
This function outputs all metaboxes registered to a specific page and context. Meta boxes should be registered using the [add\_meta\_box()](add_meta_box) function.
File: `wp-admin/includes/template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/template.php/)
```
function do_meta_boxes( $screen, $context, $data_object ) {
global $wp_meta_boxes;
static $already_sorted = false;
if ( empty( $screen ) ) {
$screen = get_current_screen();
} elseif ( is_string( $screen ) ) {
$screen = convert_to_screen( $screen );
}
$page = $screen->id;
$hidden = get_hidden_meta_boxes( $screen );
printf( '<div id="%s-sortables" class="meta-box-sortables">', esc_attr( $context ) );
// Grab the ones the user has manually sorted.
// Pull them out of their previous context/priority and into the one the user chose.
$sorted = get_user_option( "meta-box-order_$page" );
if ( ! $already_sorted && $sorted ) {
foreach ( $sorted as $box_context => $ids ) {
foreach ( explode( ',', $ids ) as $id ) {
if ( $id && 'dashboard_browser_nag' !== $id ) {
add_meta_box( $id, null, null, $screen, $box_context, 'sorted' );
}
}
}
}
$already_sorted = true;
$i = 0;
if ( isset( $wp_meta_boxes[ $page ][ $context ] ) ) {
foreach ( array( 'high', 'sorted', 'core', 'default', 'low' ) as $priority ) {
if ( isset( $wp_meta_boxes[ $page ][ $context ][ $priority ] ) ) {
foreach ( (array) $wp_meta_boxes[ $page ][ $context ][ $priority ] as $box ) {
if ( false === $box || ! $box['title'] ) {
continue;
}
$block_compatible = true;
if ( is_array( $box['args'] ) ) {
// If a meta box is just here for back compat, don't show it in the block editor.
if ( $screen->is_block_editor() && isset( $box['args']['__back_compat_meta_box'] ) && $box['args']['__back_compat_meta_box'] ) {
continue;
}
if ( isset( $box['args']['__block_editor_compatible_meta_box'] ) ) {
$block_compatible = (bool) $box['args']['__block_editor_compatible_meta_box'];
unset( $box['args']['__block_editor_compatible_meta_box'] );
}
// If the meta box is declared as incompatible with the block editor, override the callback function.
if ( ! $block_compatible && $screen->is_block_editor() ) {
$box['old_callback'] = $box['callback'];
$box['callback'] = 'do_block_editor_incompatible_meta_box';
}
if ( isset( $box['args']['__back_compat_meta_box'] ) ) {
$block_compatible = $block_compatible || (bool) $box['args']['__back_compat_meta_box'];
unset( $box['args']['__back_compat_meta_box'] );
}
}
$i++;
// get_hidden_meta_boxes() doesn't apply in the block editor.
$hidden_class = ( ! $screen->is_block_editor() && in_array( $box['id'], $hidden, true ) ) ? ' hide-if-js' : '';
echo '<div id="' . $box['id'] . '" class="postbox ' . postbox_classes( $box['id'], $page ) . $hidden_class . '" ' . '>' . "\n";
echo '<div class="postbox-header">';
echo '<h2 class="hndle">';
if ( 'dashboard_php_nag' === $box['id'] ) {
echo '<span aria-hidden="true" class="dashicons dashicons-warning"></span>';
echo '<span class="screen-reader-text">' . __( 'Warning:' ) . ' </span>';
}
echo $box['title'];
echo "</h2>\n";
if ( 'dashboard_browser_nag' !== $box['id'] ) {
$widget_title = $box['title'];
if ( is_array( $box['args'] ) && isset( $box['args']['__widget_basename'] ) ) {
$widget_title = $box['args']['__widget_basename'];
// Do not pass this parameter to the user callback function.
unset( $box['args']['__widget_basename'] );
}
echo '<div class="handle-actions hide-if-no-js">';
echo '<button type="button" class="handle-order-higher" aria-disabled="false" aria-describedby="' . $box['id'] . '-handle-order-higher-description">';
echo '<span class="screen-reader-text">' . __( 'Move up' ) . '</span>';
echo '<span class="order-higher-indicator" aria-hidden="true"></span>';
echo '</button>';
echo '<span class="hidden" id="' . $box['id'] . '-handle-order-higher-description">' . sprintf(
/* translators: %s: Meta box title. */
__( 'Move %s box up' ),
$widget_title
) . '</span>';
echo '<button type="button" class="handle-order-lower" aria-disabled="false" aria-describedby="' . $box['id'] . '-handle-order-lower-description">';
echo '<span class="screen-reader-text">' . __( 'Move down' ) . '</span>';
echo '<span class="order-lower-indicator" aria-hidden="true"></span>';
echo '</button>';
echo '<span class="hidden" id="' . $box['id'] . '-handle-order-lower-description">' . sprintf(
/* translators: %s: Meta box title. */
__( 'Move %s box down' ),
$widget_title
) . '</span>';
echo '<button type="button" class="handlediv" aria-expanded="true">';
echo '<span class="screen-reader-text">' . sprintf(
/* translators: %s: Meta box title. */
__( 'Toggle panel: %s' ),
$widget_title
) . '</span>';
echo '<span class="toggle-indicator" aria-hidden="true"></span>';
echo '</button>';
echo '</div>';
}
echo '</div>';
echo '<div class="inside">' . "\n";
if ( WP_DEBUG && ! $block_compatible && 'edit' === $screen->parent_base && ! $screen->is_block_editor() && ! isset( $_GET['meta-box-loader'] ) ) {
$plugin = _get_plugin_from_callback( $box['callback'] );
if ( $plugin ) {
?>
<div class="error inline">
<p>
<?php
/* translators: %s: The name of the plugin that generated this meta box. */
printf( __( 'This meta box, from the %s plugin, is not compatible with the block editor.' ), "<strong>{$plugin['Name']}</strong>" );
?>
</p>
</div>
<?php
}
}
call_user_func( $box['callback'], $data_object, $box );
echo "</div>\n";
echo "</div>\n";
}
}
}
}
echo '</div>';
return $i;
}
```
| Uses | Description |
| --- | --- |
| [\_get\_plugin\_from\_callback()](_get_plugin_from_callback) wp-admin/includes/template.php | Internal helper function to find the plugin from a meta box callback. |
| [get\_current\_screen()](get_current_screen) wp-admin/includes/screen.php | Get the current screen object |
| [get\_hidden\_meta\_boxes()](get_hidden_meta_boxes) wp-admin/includes/screen.php | Gets an array of IDs of hidden meta boxes. |
| [convert\_to\_screen()](convert_to_screen) wp-admin/includes/template.php | Converts a screen string to a screen object. |
| [add\_meta\_box()](add_meta_box) wp-admin/includes/template.php | Adds a meta box to one or more screens. |
| [postbox\_classes()](postbox_classes) wp-admin/includes/post.php | Returns the list of classes to be used by a meta box. |
| [get\_user\_option()](get_user_option) wp-includes/user.php | Retrieves user option that can be either per Site or per Network. |
| [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. |
| [esc\_attr()](esc_attr) wp-includes/formatting.php | Escaping for HTML attributes. |
| Used By | Description |
| --- | --- |
| [the\_block\_editor\_meta\_boxes()](the_block_editor_meta_boxes) wp-admin/includes/post.php | Renders the meta boxes forms. |
| [wp\_dashboard()](wp_dashboard) wp-admin/includes/dashboard.php | Displays the dashboard. |
| Version | Description |
| --- | --- |
| [2.5.0](https://developer.wordpress.org/reference/since/2.5.0/) | Introduced. |
wordpress _nx_noop( string $singular, string $plural, string $context, string $domain = null ): array \_nx\_noop( string $singular, string $plural, string $context, string $domain = null ): array
=============================================================================================
Registers plural strings with gettext context in POT file, but does not translate them.
Used when you want to keep structures with translatable plural strings and use them later when the number is known.
Example of a generic phrase which is disambiguated via the context parameter:
```
$messages = array(
'people' => _nx_noop( '%s group', '%s groups', 'people', 'text-domain' ),
'animals' => _nx_noop( '%s group', '%s groups', 'animals', 'text-domain' ),
);
...
$message = $messages[ $type ];
printf( translate_nooped_plural( $message, $count, 'text-domain' ), number_format_i18n( $count ) );
```
`$singular` string Required Singular form to be localized. `$plural` string Required Plural form to be localized. `$context` string Required Context information for the translators. `$domain` string Optional Text domain. Unique identifier for retrieving translated strings.
Default: `null`
array Array of translation information for the strings.
* stringSingular form to be localized. No longer used.
* `1`stringPlural form to be localized. No longer used.
* `2`stringContext information for the translators. No longer used.
* `singular`stringSingular form to be localized.
* `plural`stringPlural form to be localized.
* `context`stringContext information for the translators.
* `domain`string|nullText domain.
File: `wp-includes/l10n.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/l10n.php/)
```
function _nx_noop( $singular, $plural, $context, $domain = null ) {
return array(
0 => $singular,
1 => $plural,
2 => $context,
'singular' => $singular,
'plural' => $plural,
'context' => $context,
'domain' => $domain,
);
}
```
| Used By | Description |
| --- | --- |
| [WP\_MS\_Sites\_List\_Table::get\_views()](../classes/wp_ms_sites_list_table/get_views) wp-admin/includes/class-wp-ms-sites-list-table.php | Gets links to filter sites by status. |
| [WP\_Comments\_List\_Table::get\_views()](../classes/wp_comments_list_table/get_views) wp-admin/includes/class-wp-comments-list-table.php | |
| Version | Description |
| --- | --- |
| [2.8.0](https://developer.wordpress.org/reference/since/2.8.0/) | Introduced. |
wordpress _e( string $text, string $domain = 'default' ) \_e( string $text, string $domain = 'default' )
===============================================
Displays translated text.
`$text` string Required Text to translate. `$domain` string Optional Text domain. Unique identifier for retrieving translated strings.
Default `'default'`. Default: `'default'`
File: `wp-includes/l10n.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/l10n.php/)
```
function _e( $text, $domain = 'default' ) {
echo translate( $text, $domain );
}
```
| Uses | Description |
| --- | --- |
| [translate()](translate) wp-includes/l10n.php | Retrieves the translation of $text. |
| Used By | Description |
| --- | --- |
| [WP\_Widget\_Block::form()](../classes/wp_widget_block/form) wp-includes/widgets/class-wp-widget-block.php | Outputs the Block widget settings form. |
| [WP\_Application\_Passwords\_List\_Table::display\_tablenav()](../classes/wp_application_passwords_list_table/display_tablenav) wp-admin/includes/class-wp-application-passwords-list-table.php | Generates custom table navigation to prevent conflicting nonces. |
| [core\_auto\_updates\_settings()](core_auto_updates_settings) wp-admin/update-core.php | Display WordPress auto-updates settings. |
| [wp\_dashboard\_site\_health()](wp_dashboard_site_health) wp-admin/includes/dashboard.php | Displays the Site Health Status widget. |
| [WP\_Privacy\_Data\_Removal\_Requests\_List\_Table::column\_next\_steps()](../classes/wp_privacy_data_removal_requests_list_table/column_next_steps) wp-admin/includes/class-wp-privacy-data-removal-requests-list-table.php | Next steps column. |
| [WP\_Privacy\_Data\_Export\_Requests\_List\_Table::column\_next\_steps()](../classes/wp_privacy_data_export_requests_list_table/column_next_steps) wp-admin/includes/class-wp-privacy-data-export-requests-list-table.php | Displays the next steps column. |
| [WP\_Posts\_List\_Table::formats\_dropdown()](../classes/wp_posts_list_table/formats_dropdown) wp-admin/includes/class-wp-posts-list-table.php | Displays a formats drop-down for filtering items. |
| [wp\_dashboard\_php\_nag()](wp_dashboard_php_nag) wp-admin/includes/dashboard.php | Displays the PHP update nag. |
| [do\_block\_editor\_incompatible\_meta\_box()](do_block_editor_incompatible_meta_box) wp-admin/includes/template.php | Renders a “fake” meta box with an information message, shown on the block editor, when an incompatible meta box is found. |
| [WP\_Privacy\_Policy\_Content::privacy\_policy\_guide()](../classes/wp_privacy_policy_content/privacy_policy_guide) wp-admin/includes/class-wp-privacy-policy-content.php | Output the privacy policy guide together with content from the theme and plugins. |
| [WP\_Widget\_Custom\_HTML::render\_control\_template\_scripts()](../classes/wp_widget_custom_html/render_control_template_scripts) wp-includes/widgets/class-wp-widget-custom-html.php | Render form template scripts. |
| [WP\_Customize\_Themes\_Panel::content\_template()](../classes/wp_customize_themes_panel/content_template) wp-includes/customize/class-wp-customize-themes-panel.php | An Underscore (JS) template for this panel’s content (but not its container). |
| [WP\_Customize\_Themes\_Section::render\_template()](../classes/wp_customize_themes_section/render_template) wp-includes/customize/class-wp-customize-themes-section.php | Render a themes section as a JS template. |
| [WP\_Customize\_Themes\_Section::filter\_bar\_content\_template()](../classes/wp_customize_themes_section/filter_bar_content_template) wp-includes/customize/class-wp-customize-themes-section.php | Render the filter bar portion of a themes section as a JS template. |
| [wp\_print\_plugin\_file\_tree()](wp_print_plugin_file_tree) wp-admin/includes/misc.php | Outputs the formatted file list for the plugin file editor. |
| [wp\_print\_theme\_file\_tree()](wp_print_theme_file_tree) wp-admin/includes/misc.php | Outputs the formatted file list for the theme file editor. |
| [wp\_print\_file\_editor\_templates()](wp_print_file_editor_templates) wp-admin/includes/file.php | Prints file editor templates (for plugins and themes). |
| [WP\_Widget\_Text::render\_control\_template\_scripts()](../classes/wp_widget_text/render_control_template_scripts) wp-includes/widgets/class-wp-widget-text.php | Render form template scripts. |
| [WP\_Widget\_Media\_Audio::render\_control\_template\_scripts()](../classes/wp_widget_media_audio/render_control_template_scripts) wp-includes/widgets/class-wp-widget-media-audio.php | Render form template scripts. |
| [WP\_Widget\_Media\_Video::render\_control\_template\_scripts()](../classes/wp_widget_media_video/render_control_template_scripts) wp-includes/widgets/class-wp-widget-media-video.php | Render form template scripts. |
| [WP\_Widget\_Media\_Image::render\_control\_template\_scripts()](../classes/wp_widget_media_image/render_control_template_scripts) wp-includes/widgets/class-wp-widget-media-image.php | Render form template scripts. |
| [wp\_print\_community\_events\_markup()](wp_print_community_events_markup) wp-admin/includes/dashboard.php | Prints the markup for the Community Events section of the Events and News Dashboard widget. |
| [WP\_Customize\_Nav\_Menus::print\_post\_type\_container()](../classes/wp_customize_nav_menus/print_post_type_container) wp-includes/class-wp-customize-nav-menus.php | Prints the markup for new menu items. |
| [WP\_Customize\_Nav\_Menus::print\_custom\_links\_available\_menu\_item()](../classes/wp_customize_nav_menus/print_custom_links_available_menu_item) wp-includes/class-wp-customize-nav-menus.php | Prints the markup for available menu item custom links. |
| [WP\_Customize\_Background\_Position\_Control::content\_template()](../classes/wp_customize_background_position_control/content_template) wp-includes/customize/class-wp-customize-background-position-control.php | Render a JS template for the content of the position control. |
| [wp\_print\_admin\_notice\_templates()](wp_print_admin_notice_templates) wp-admin/includes/update.php | Prints the JavaScript templates for update admin notices. |
| [print\_embed\_sharing\_dialog()](print_embed_sharing_dialog) wp-includes/embed.php | Prints the necessary markup for the embed sharing dialog. |
| [WP\_Screen::render\_meta\_boxes\_preferences()](../classes/wp_screen/render_meta_boxes_preferences) wp-admin/includes/class-wp-screen.php | Renders the meta boxes preferences. |
| [WP\_Screen::render\_view\_mode()](../classes/wp_screen/render_view_mode) wp-admin/includes/class-wp-screen.php | Renders the list table view mode preferences. |
| [WP\_Customize\_Nav\_Menu\_Auto\_Add\_Control::content\_template()](../classes/wp_customize_nav_menu_auto_add_control/content_template) wp-includes/customize/class-wp-customize-nav-menu-auto-add-control.php | Render the Underscore template for this control. |
| [WP\_Customize\_New\_Menu\_Control::render\_content()](../classes/wp_customize_new_menu_control/render_content) wp-includes/customize/class-wp-customize-new-menu-control.php | Render the control’s content. |
| [WP\_Customize\_Nav\_Menu\_Location\_Control::render\_content()](../classes/wp_customize_nav_menu_location_control/render_content) wp-includes/customize/class-wp-customize-nav-menu-location-control.php | Render content just like a normal select control. |
| [WP\_Customize\_Nav\_Menu\_Item\_Control::content\_template()](../classes/wp_customize_nav_menu_item_control/content_template) wp-includes/customize/class-wp-customize-nav-menu-item-control.php | JS/Underscore template for the control UI. |
| [WP\_Customize\_Nav\_Menu\_Control::content\_template()](../classes/wp_customize_nav_menu_control/content_template) wp-includes/customize/class-wp-customize-nav-menu-control.php | JS/Underscore template for the control UI. |
| [WP\_Customize\_Nav\_Menus\_Panel::content\_template()](../classes/wp_customize_nav_menus_panel/content_template) wp-includes/customize/class-wp-customize-nav-menus-panel.php | An Underscore (JS) template for this panel’s content (but not its container). |
| [WP\_Customize\_Panel::render\_template()](../classes/wp_customize_panel/render_template) wp-includes/class-wp-customize-panel.php | An Underscore (JS) template for rendering this panel’s container. |
| [WP\_Customize\_Panel::content\_template()](../classes/wp_customize_panel/content_template) wp-includes/class-wp-customize-panel.php | An Underscore (JS) template for this panel’s content (but not its container). |
| [WP\_Customize\_Nav\_Menus::print\_templates()](../classes/wp_customize_nav_menus/print_templates) wp-includes/class-wp-customize-nav-menus.php | Prints the JavaScript templates used to render Menu Customizer components. |
| [WP\_Customize\_Nav\_Menus::available\_items\_template()](../classes/wp_customize_nav_menus/available_items_template) wp-includes/class-wp-customize-nav-menus.php | Prints the HTML template used to render the add-menu-item frame. |
| [WP\_Customize\_Section::render\_template()](../classes/wp_customize_section/render_template) wp-includes/class-wp-customize-section.php | An Underscore (JS) template for rendering this section. |
| [WP\_Links\_List\_Table::column\_visible()](../classes/wp_links_list_table/column_visible) wp-admin/includes/class-wp-links-list-table.php | Handles the link visibility column output. |
| [WP\_MS\_Themes\_List\_Table::column\_cb()](../classes/wp_ms_themes_list_table/column_cb) wp-admin/includes/class-wp-ms-themes-list-table.php | Handles the checkbox column output. |
| [WP\_Media\_List\_Table::column\_parent()](../classes/wp_media_list_table/column_parent) wp-admin/includes/class-wp-media-list-table.php | Handles the parent column output. |
| [WP\_Media\_List\_Table::column\_title()](../classes/wp_media_list_table/column_title) wp-admin/includes/class-wp-media-list-table.php | Handles the title column output. |
| [WP\_Customize\_Theme\_Control::content\_template()](../classes/wp_customize_theme_control/content_template) wp-includes/customize/class-wp-customize-theme-control.php | Render a JS template for theme display. |
| [customize\_themes\_print\_templates()](customize_themes_print_templates) wp-admin/includes/theme.php | Prints JS templates for the theme-browsing UI in the Customizer. |
| [WP\_Customize\_Manager::render\_control\_templates()](../classes/wp_customize_manager/render_control_templates) wp-includes/class-wp-customize-manager.php | Renders JS templates for all registered control types. |
| [wp\_print\_revision\_templates()](wp_print_revision_templates) wp-admin/includes/revision.php | Print JavaScript templates required for the revisions experience. |
| [WP\_Media\_List\_Table::views()](../classes/wp_media_list_table/views) wp-admin/includes/class-wp-media-list-table.php | Override parent views so we can use the filter bar display. |
| [login\_footer()](login_footer) wp-login.php | Outputs the footer for the login page. |
| [show\_user\_form()](show_user_form) wp-signup.php | Displays the fields for the new user account registration form. |
| [signup\_another\_blog()](signup_another_blog) wp-signup.php | Shows a form for returning users to sign up for another site. |
| [signup\_user()](signup_user) wp-signup.php | Shows a form for a visitor to sign up for a new user account. |
| [confirm\_user\_signup()](confirm_user_signup) wp-signup.php | Shows a message confirming that the new user has been registered and is awaiting activation. |
| [confirm\_blog\_signup()](confirm_blog_signup) wp-signup.php | Shows a message confirming that the new site has been registered and is awaiting activation. |
| [show\_blog\_form()](show_blog_form) wp-signup.php | Generates and displays the Sign-up and Create Site forms. |
| [network\_step1()](network_step1) wp-admin/includes/network.php | Prints step 1 for Network installation process. |
| [network\_step2()](network_step2) wp-admin/includes/network.php | Prints step 2 for Network installation process. |
| [display\_header()](display_header) wp-admin/install.php | Display installation header. |
| [display\_setup\_form()](display_setup_form) wp-admin/install.php | Displays installer setup form. |
| [use\_ssl\_preference()](use_ssl_preference) wp-admin/includes/user.php | Optional SSL preference that can be turned on by hooking to the ‘personal\_options’ action. |
| [WP\_MS\_Users\_List\_Table::no\_items()](../classes/wp_ms_users_list_table/no_items) wp-admin/includes/class-wp-ms-users-list-table.php | |
| [WP\_Screen::render\_screen\_layout()](../classes/wp_screen/render_screen_layout) wp-admin/includes/class-wp-screen.php | Renders the option for number of columns on the page. |
| [WP\_Screen::render\_per\_page\_options()](../classes/wp_screen/render_per_page_options) wp-admin/includes/class-wp-screen.php | Renders the items per page option. |
| [WP\_Screen::render\_screen\_meta()](../classes/wp_screen/render_screen_meta) wp-admin/includes/class-wp-screen.php | Renders the screen’s help section. |
| [WP\_Plugins\_List\_Table::single\_row()](../classes/wp_plugins_list_table/single_row) wp-admin/includes/class-wp-plugins-list-table.php | |
| [WP\_Plugins\_List\_Table::no\_items()](../classes/wp_plugins_list_table/no_items) wp-admin/includes/class-wp-plugins-list-table.php | |
| [WP\_Links\_List\_Table::no\_items()](../classes/wp_links_list_table/no_items) wp-admin/includes/class-wp-links-list-table.php | |
| [install\_theme\_search\_form()](install_theme_search_form) wp-admin/includes/theme-install.php | Displays search form for searching themes. |
| [install\_themes\_dashboard()](install_themes_dashboard) wp-admin/includes/theme-install.php | Displays tags filter for themes. |
| [install\_themes\_upload()](install_themes_upload) wp-admin/includes/theme-install.php | Displays a form to upload themes from zip files. |
| [WP\_List\_Table::no\_items()](../classes/wp_list_table/no_items) wp-admin/includes/class-wp-list-table.php | Message to be displayed when there are no items |
| [WP\_List\_Table::months\_dropdown()](../classes/wp_list_table/months_dropdown) wp-admin/includes/class-wp-list-table.php | Displays a dropdown for filtering items in the list table by month. |
| [choose\_primary\_blog()](choose_primary_blog) wp-admin/includes/ms.php | Handles the display of choosing a user’s primary site. |
| [upload\_space\_setting()](upload_space_setting) wp-admin/includes/ms.php | Displays the site upload space quota setting form on the Edit Site Settings screen. |
| [wp\_image\_editor()](wp_image_editor) wp-admin/includes/image-edit.php | Loads the WP image-editing interface. |
| [WP\_MS\_Themes\_List\_Table::no\_items()](../classes/wp_ms_themes_list_table/no_items) wp-admin/includes/class-wp-ms-themes-list-table.php | |
| [admin\_color\_scheme\_picker()](admin_color_scheme_picker) wp-admin/includes/misc.php | Displays the default admin color scheme picker (Used in user-edit.php). |
| [WP\_Theme\_Install\_List\_Table::install\_theme\_info()](../classes/wp_theme_install_list_table/install_theme_info) wp-admin/includes/class-wp-theme-install-list-table.php | Prints the info for a theme (to be used in the theme installer modal). |
| [WP\_Theme\_Install\_List\_Table::no\_items()](../classes/wp_theme_install_list_table/no_items) wp-admin/includes/class-wp-theme-install-list-table.php | |
| [WP\_Theme\_Install\_List\_Table::single\_row()](../classes/wp_theme_install_list_table/single_row) wp-admin/includes/class-wp-theme-install-list-table.php | Prints a theme from the WordPress.org API. |
| [WP\_Theme\_Install\_List\_Table::theme\_installer()](../classes/wp_theme_install_list_table/theme_installer) wp-admin/includes/class-wp-theme-install-list-table.php | Prints the wrapper for the theme installer. |
| [wp\_welcome\_panel()](wp_welcome_panel) wp-admin/includes/dashboard.php | Displays a welcome panel to introduce users to WordPress. |
| [install\_dashboard()](install_dashboard) wp-admin/includes/plugin-install.php | Displays the Featured tab of Add Plugins screen. |
| [install\_search\_form()](install_search_form) wp-admin/includes/plugin-install.php | Displays a search form for searching plugins. |
| [install\_plugins\_upload()](install_plugins_upload) wp-admin/includes/plugin-install.php | Displays a form to upload plugins from zip files. |
| [install\_plugins\_favorites\_form()](install_plugins_favorites_form) wp-admin/includes/plugin-install.php | Shows a username form for the favorites page. |
| [install\_plugin\_information()](install_plugin_information) wp-admin/includes/plugin-install.php | Displays plugin information in dialog box form. |
| [wp\_dashboard\_quota()](wp_dashboard_quota) wp-admin/includes/dashboard.php | Displays file upload quota on dashboard. |
| [wp\_network\_dashboard\_right\_now()](wp_network_dashboard_right_now) wp-admin/includes/dashboard.php | |
| [wp\_dashboard\_quick\_press()](wp_dashboard_quick_press) wp-admin/includes/dashboard.php | The Quick Draft widget display and creation of drafts. |
| [default\_password\_nag()](default_password_nag) wp-admin/includes/user.php | |
| [WP\_Plugin\_Install\_List\_Table::display\_rows()](../classes/wp_plugin_install_list_table/display_rows) wp-admin/includes/class-wp-plugin-install-list-table.php | |
| [WP\_Plugin\_Install\_List\_Table::no\_items()](../classes/wp_plugin_install_list_table/no_items) wp-admin/includes/class-wp-plugin-install-list-table.php | |
| [\_local\_storage\_notice()](_local_storage_notice) wp-admin/includes/template.php | Outputs the HTML for restoring the post data from DOM storage |
| [find\_posts\_div()](find_posts_div) wp-admin/includes/template.php | Outputs the modal window used for attaching media to posts or pages in the media-listing screen. |
| [iframe\_header()](iframe_header) wp-admin/includes/template.php | Generic Iframe header for use with Thickbox. |
| [wp\_comment\_reply()](wp_comment_reply) wp-admin/includes/template.php | Outputs the in-line comment reply-to form in the Comments list table. |
| [wp\_comment\_trashnotice()](wp_comment_trashnotice) wp-admin/includes/template.php | Outputs ‘undo move to Trash’ text for comments. |
| [list\_meta()](list_meta) wp-admin/includes/template.php | Outputs a post’s public meta data in the Custom Fields meta box. |
| [meta\_form()](meta_form) wp-admin/includes/template.php | Prints the form in the Custom Fields meta box. |
| [touch\_time()](touch_time) wp-admin/includes/template.php | Prints out HTML form date elements for editing post or comment publish date. |
| [wp\_import\_upload\_form()](wp_import_upload_form) wp-admin/includes/template.php | Outputs the form used by the importers to accept the data to be imported. |
| [do\_accordion\_sections()](do_accordion_sections) wp-admin/includes/template.php | Meta Box Accordion Template Function. |
| [WP\_Themes\_List\_Table::no\_items()](../classes/wp_themes_list_table/no_items) wp-admin/includes/class-wp-themes-list-table.php | |
| [WP\_Themes\_List\_Table::display\_rows()](../classes/wp_themes_list_table/display_rows) wp-admin/includes/class-wp-themes-list-table.php | |
| [WP\_MS\_Sites\_List\_Table::no\_items()](../classes/wp_ms_sites_list_table/no_items) wp-admin/includes/class-wp-ms-sites-list-table.php | |
| [WP\_Users\_List\_Table::no\_items()](../classes/wp_users_list_table/no_items) wp-admin/includes/class-wp-users-list-table.php | Output ‘no users’ message. |
| [WP\_Users\_List\_Table::extra\_tablenav()](../classes/wp_users_list_table/extra_tablenav) wp-admin/includes/class-wp-users-list-table.php | Output the controls to allow user roles to be changed in bulk. |
| [media\_upload\_type\_form()](media_upload_type_form) wp-admin/includes/media.php | Outputs the legacy media upload form for a given media type. |
| [media\_upload\_type\_url\_form()](media_upload_type_url_form) wp-admin/includes/media.php | Outputs the legacy media upload form for external media. |
| [media\_upload\_gallery\_form()](media_upload_gallery_form) wp-admin/includes/media.php | Adds gallery form to upload iframe. |
| [media\_upload\_library\_form()](media_upload_library_form) wp-admin/includes/media.php | Outputs the legacy media upload form for the media library. |
| [media\_upload\_html\_bypass()](media_upload_html_bypass) wp-admin/includes/media.php | Displays the browser’s built-in uploader message. |
| [edit\_form\_image\_editor()](edit_form_image_editor) wp-admin/includes/media.php | Displays the image and editor in the post editor |
| [attachment\_submitbox\_metadata()](attachment_submitbox_metadata) wp-admin/includes/media.php | Displays non-editable attachment metadata in the publish meta box. |
| [media\_upload\_form()](media_upload_form) wp-admin/includes/media.php | Outputs the legacy media upload form. |
| [wp\_iframe()](wp_iframe) wp-admin/includes/media.php | Outputs the iframe to display the media upload page. |
| [\_admin\_notice\_post\_locked()](_admin_notice_post_locked) wp-admin/includes/post.php | Outputs the HTML for the notice to say that someone else is editing or has taken over editing of this post. |
| [post\_trackback\_meta\_box()](post_trackback_meta_box) wp-admin/includes/meta-boxes.php | Displays trackback links form fields. |
| [post\_comment\_status\_meta\_box()](post_comment_status_meta_box) wp-admin/includes/meta-boxes.php | Displays comments status form fields. |
| [post\_comment\_meta\_box()](post_comment_meta_box) wp-admin/includes/meta-boxes.php | Displays comments for post. |
| [post\_slug\_meta\_box()](post_slug_meta_box) wp-admin/includes/meta-boxes.php | Displays slug form fields. |
| [post\_author\_meta\_box()](post_author_meta_box) wp-admin/includes/meta-boxes.php | Displays form field with list of authors. |
| [page\_attributes\_meta\_box()](page_attributes_meta_box) wp-admin/includes/meta-boxes.php | Displays page attributes form fields. |
| [link\_submit\_meta\_box()](link_submit_meta_box) wp-admin/includes/meta-boxes.php | Displays link create form fields. |
| [link\_categories\_meta\_box()](link_categories_meta_box) wp-admin/includes/meta-boxes.php | Displays link categories form fields. |
| [link\_target\_meta\_box()](link_target_meta_box) wp-admin/includes/meta-boxes.php | Displays form fields for changing link target. |
| [link\_xfn\_meta\_box()](link_xfn_meta_box) wp-admin/includes/meta-boxes.php | Displays XFN form fields. |
| [link\_advanced\_meta\_box()](link_advanced_meta_box) wp-admin/includes/meta-boxes.php | Displays advanced link options form fields. |
| [post\_submit\_meta\_box()](post_submit_meta_box) wp-admin/includes/meta-boxes.php | Displays post submit form fields. |
| [post\_format\_meta\_box()](post_format_meta_box) wp-admin/includes/meta-boxes.php | Displays post format form elements. |
| [post\_excerpt\_meta\_box()](post_excerpt_meta_box) wp-admin/includes/meta-boxes.php | Displays post excerpt form fields. |
| [WP\_Media\_List\_Table::no\_items()](../classes/wp_media_list_table/no_items) wp-admin/includes/class-wp-media-list-table.php | |
| [WP\_Comments\_List\_Table::no\_items()](../classes/wp_comments_list_table/no_items) wp-admin/includes/class-wp-comments-list-table.php | |
| [WP\_Comments\_List\_Table::column\_cb()](../classes/wp_comments_list_table/column_cb) wp-admin/includes/class-wp-comments-list-table.php | |
| [WP\_Terms\_List\_Table::inline\_edit()](../classes/wp_terms_list_table/inline_edit) wp-admin/includes/class-wp-terms-list-table.php | Outputs the hidden row displayed when inline editing |
| [Walker\_Nav\_Menu\_Edit::start\_el()](../classes/walker_nav_menu_edit/start_el) wp-admin/includes/class-walker-nav-menu-edit.php | Start the element output. |
| [wp\_nav\_menu\_item\_link\_meta\_box()](wp_nav_menu_item_link_meta_box) wp-admin/includes/nav-menu.php | Displays a meta box for the custom links menu item. |
| [wp\_nav\_menu\_item\_post\_type\_meta\_box()](wp_nav_menu_item_post_type_meta_box) wp-admin/includes/nav-menu.php | Displays a meta box for a post type menu item. |
| [wp\_nav\_menu\_item\_taxonomy\_meta\_box()](wp_nav_menu_item_taxonomy_meta_box) wp-admin/includes/nav-menu.php | Displays a meta box for a taxonomy menu item. |
| [request\_filesystem\_credentials()](request_filesystem_credentials) wp-admin/includes/file.php | Displays a form to the user to request for their FTP/SSH details in order to connect to the filesystem. |
| [WP\_Posts\_List\_Table::inline\_edit()](../classes/wp_posts_list_table/inline_edit) wp-admin/includes/class-wp-posts-list-table.php | Outputs the hidden row displayed when inline editing |
| [wp\_widget\_control()](wp_widget_control) wp-admin/includes/widgets.php | Meta widget used to display the control form for a widget. |
| [Custom\_Image\_Header::step\_1()](../classes/custom_image_header/step_1) wp-admin/includes/class-custom-image-header.php | Display first step of custom header image page. |
| [Custom\_Image\_Header::step\_2()](../classes/custom_image_header/step_2) wp-admin/includes/class-custom-image-header.php | Display second step of custom header image page. |
| [Custom\_Image\_Header::show\_header\_selector()](../classes/custom_image_header/show_header_selector) wp-admin/includes/class-custom-image-header.php | Display UI for selecting one of several default headers. |
| [confirm\_delete\_users()](confirm_delete_users) wp-admin/includes/ms.php | |
| [core\_upgrade\_preamble()](core_upgrade_preamble) wp-admin/update-core.php | Display upgrade WordPress for downloading latest or upgrading automatically form. |
| [list\_plugin\_updates()](list_plugin_updates) wp-admin/update-core.php | Display the upgrade plugins form. |
| [list\_theme\_updates()](list_theme_updates) wp-admin/update-core.php | Display the upgrade themes form. |
| [list\_translation\_updates()](list_translation_updates) wp-admin/update-core.php | Display the update translations form. |
| [do\_core\_upgrade()](do_core_upgrade) wp-admin/update-core.php | Upgrade WordPress core display. |
| [Custom\_Background::admin\_page()](../classes/custom_background/admin_page) wp-admin/includes/class-custom-background.php | Displays the custom background page. |
| [wp\_auth\_check\_html()](wp_auth_check_html) wp-includes/functions.php | Outputs the HTML that shows the wp-login dialog when the user is no longer logged in. |
| [WP\_Nav\_Menu\_Widget::form()](../classes/wp_nav_menu_widget/form) wp-includes/widgets/class-wp-nav-menu-widget.php | Outputs the settings form for the Navigation Menu widget. |
| [WP\_Widget\_Recent\_Comments::form()](../classes/wp_widget_recent_comments/form) wp-includes/widgets/class-wp-widget-recent-comments.php | Outputs the settings form for the Recent Comments widget. |
| [WP\_Widget\_Tag\_Cloud::form()](../classes/wp_widget_tag_cloud/form) wp-includes/widgets/class-wp-widget-tag-cloud.php | Outputs the Tag Cloud widget settings form. |
| [WP\_Widget\_Recent\_Posts::form()](../classes/wp_widget_recent_posts/form) wp-includes/widgets/class-wp-widget-recent-posts.php | Outputs the settings form for the Recent Posts widget. |
| [WP\_Widget\_Categories::form()](../classes/wp_widget_categories/form) wp-includes/widgets/class-wp-widget-categories.php | Outputs the settings form for the Categories widget. |
| [WP\_Widget\_Text::form()](../classes/wp_widget_text/form) wp-includes/widgets/class-wp-widget-text.php | Outputs the Text widget settings form. |
| [WP\_Widget\_Calendar::form()](../classes/wp_widget_calendar/form) wp-includes/widgets/class-wp-widget-calendar.php | Outputs the settings form for the Calendar widget. |
| [WP\_Widget\_Meta::widget()](../classes/wp_widget_meta/widget) wp-includes/widgets/class-wp-widget-meta.php | Outputs the content for the current Meta widget instance. |
| [WP\_Widget\_Meta::form()](../classes/wp_widget_meta/form) wp-includes/widgets/class-wp-widget-meta.php | Outputs the settings form for the Meta widget. |
| [WP\_Widget\_Archives::form()](../classes/wp_widget_archives/form) wp-includes/widgets/class-wp-widget-archives.php | Outputs the settings form for the Archives widget. |
| [WP\_Widget\_Search::form()](../classes/wp_widget_search/form) wp-includes/widgets/class-wp-widget-search.php | Outputs the settings form for the Search widget. |
| [WP\_Widget\_Links::form()](../classes/wp_widget_links/form) wp-includes/widgets/class-wp-widget-links.php | Outputs the settings form for the Links widget. |
| [WP\_Widget\_Pages::form()](../classes/wp_widget_pages/form) wp-includes/widgets/class-wp-widget-pages.php | Outputs the settings form for the Pages widget. |
| [wp\_widget\_rss\_form()](wp_widget_rss_form) wp-includes/widgets.php | Display RSS widget options form. |
| [WP\_Admin\_Bar::\_render()](../classes/wp_admin_bar/_render) wp-includes/class-wp-admin-bar.php | |
| [wp\_rss()](wp_rss) wp-includes/rss.php | Display all RSS items in a HTML ordered list. |
| [WP\_Customize\_Header\_Image\_Control::print\_header\_image\_template()](../classes/wp_customize_header_image_control/print_header_image_template) wp-includes/customize/class-wp-customize-header-image-control.php | |
| [WP\_Customize\_Header\_Image\_Control::render\_content()](../classes/wp_customize_header_image_control/render_content) wp-includes/customize/class-wp-customize-header-image-control.php | |
| [WP\_Widget\_Area\_Customize\_Control::render\_content()](../classes/wp_widget_area_customize_control/render_content) wp-includes/customize/class-wp-widget-area-customize-control.php | Renders the control’s content. |
| [WP\_Customize\_Control::render\_content()](../classes/wp_customize_control/render_content) wp-includes/class-wp-customize-control.php | Render the control’s content. |
| [Walker\_Comment::ping()](../classes/walker_comment/ping) wp-includes/class-walker-comment.php | Outputs a pingback comment. |
| [comments\_popup\_link()](comments_popup_link) wp-includes/comment-template.php | Displays the link to the comments for the current post ID. |
| [WP\_Customize\_Widgets::output\_widget\_control\_templates()](../classes/wp_customize_widgets/output_widget_control_templates) wp-includes/class-wp-customize-widgets.php | Renders the widget form control templates into the DOM. |
| [\_WP\_Editors::wp\_link\_dialog()](../classes/_wp_editors/wp_link_dialog) wp-includes/class-wp-editor.php | Dialog for internal linking. |
| [wp\_print\_media\_templates()](wp_print_media_templates) wp-includes/media-template.php | Prints the templates used in the media manager. |
| Version | Description |
| --- | --- |
| [1.2.0](https://developer.wordpress.org/reference/since/1.2.0/) | Introduced. |
| programming_docs |
wordpress wp_get_attachment_image_url( int $attachment_id, string|int[] $size = 'thumbnail', bool $icon = false ): string|false wp\_get\_attachment\_image\_url( int $attachment\_id, string|int[] $size = 'thumbnail', bool $icon = false ): string|false
==========================================================================================================================
Gets the URL of an image attachment.
`$attachment_id` int Required Image attachment ID. `$size` string|int[] Optional Image size. Accepts any registered image size name, or an array of width and height values in pixels (in that order). Default `'thumbnail'`. Default: `'thumbnail'`
`$icon` bool Optional Whether the image should be treated as an icon. Default: `false`
string|false Attachment URL or false if no image is available. If `$size` does not match any registered image size, the original image URL will be returned.
File: `wp-includes/media.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/media.php/)
```
function wp_get_attachment_image_url( $attachment_id, $size = 'thumbnail', $icon = false ) {
$image = wp_get_attachment_image_src( $attachment_id, $size, $icon );
return isset( $image[0] ) ? $image[0] : false;
}
```
| Uses | Description |
| --- | --- |
| [wp\_get\_attachment\_image\_src()](wp_get_attachment_image_src) wp-includes/media.php | Retrieves an image to represent an attachment. |
| Used By | Description |
| --- | --- |
| [get\_the\_post\_thumbnail\_url()](get_the_post_thumbnail_url) wp-includes/post-thumbnail-template.php | Returns the post thumbnail URL. |
| [get\_site\_icon\_url()](get_site_icon_url) wp-includes/general-template.php | Returns the Site Icon URL. |
| [wp\_get\_attachment\_thumb\_url()](wp_get_attachment_thumb_url) wp-includes/post.php | Retrieves URL for an attachment thumbnail. |
| Version | Description |
| --- | --- |
| [4.4.0](https://developer.wordpress.org/reference/since/4.4.0/) | Introduced. |
wordpress wp_oembed_add_provider( string $format, string $provider, bool $regex = false ) wp\_oembed\_add\_provider( string $format, string $provider, bool $regex = false )
==================================================================================
Adds a URL format and oEmbed provider URL pair.
* [WP\_oEmbed](../classes/wp_oembed)
`$format` string Required The format of URL that this provider can handle. You can use asterisks as wildcards. `$provider` string Required The URL to the oEmbed provider. `$regex` bool Optional Whether the `$format` parameter is in a RegEx format. Default: `false`
File: `wp-includes/embed.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/embed.php/)
```
function wp_oembed_add_provider( $format, $provider, $regex = false ) {
if ( did_action( 'plugins_loaded' ) ) {
$oembed = _wp_oembed_get_object();
$oembed->providers[ $format ] = array( $provider, $regex );
} else {
WP_oEmbed::_add_provider_early( $format, $provider, $regex );
}
}
```
| Uses | Description |
| --- | --- |
| [WP\_oEmbed::\_add\_provider\_early()](../classes/wp_oembed/_add_provider_early) wp-includes/class-wp-oembed.php | Adds an oEmbed provider. |
| [\_wp\_oembed\_get\_object()](_wp_oembed_get_object) wp-includes/embed.php | Returns the initialized [WP\_oEmbed](../classes/wp_oembed) object. |
| [did\_action()](did_action) wp-includes/plugin.php | Retrieves the number of times an action has been fired during the current request. |
| Version | Description |
| --- | --- |
| [2.9.0](https://developer.wordpress.org/reference/since/2.9.0/) | Introduced. |
wordpress the_author_email() the\_author\_email()
====================
This function has been deprecated. Use [the\_author\_meta()](the_author_meta) instead.
Display the email of the author of the current post.
* [the\_author\_meta()](the_author_meta)
File: `wp-includes/deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/deprecated.php/)
```
function the_author_email() {
_deprecated_function( __FUNCTION__, '2.8.0', 'the_author_meta(\'email\')' );
the_author_meta('email');
}
```
| Uses | Description |
| --- | --- |
| [the\_author\_meta()](the_author_meta) wp-includes/author-template.php | Outputs the field from the user’s DB object. Defaults to current post’s author. |
| [\_deprecated\_function()](_deprecated_function) wp-includes/functions.php | Marks a function as deprecated and inform when it has been used. |
| Version | Description |
| --- | --- |
| [2.8.0](https://developer.wordpress.org/reference/since/2.8.0/) | Use [the\_author\_meta()](the_author_meta) |
| [0.71](https://developer.wordpress.org/reference/since/0.71/) | Introduced. |
wordpress do_all_enclosures() do\_all\_enclosures()
=====================
Performs all enclosures.
File: `wp-includes/comment.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/comment.php/)
```
function do_all_enclosures() {
$enclosures = get_posts(
array(
'post_type' => get_post_types(),
'suppress_filters' => false,
'nopaging' => true,
'meta_key' => '_encloseme',
'fields' => 'ids',
)
);
foreach ( $enclosures as $enclosure ) {
delete_post_meta( $enclosure, '_encloseme' );
do_enclose( null, $enclosure );
}
}
```
| Uses | Description |
| --- | --- |
| [do\_enclose()](do_enclose) wp-includes/functions.php | Checks content for video and audio links to add as enclosures. |
| [get\_posts()](get_posts) wp-includes/post.php | Retrieves an array of the latest posts, or posts matching the given criteria. |
| [delete\_post\_meta()](delete_post_meta) wp-includes/post.php | Deletes a post meta field for the given post ID. |
| [get\_post\_types()](get_post_types) wp-includes/post.php | Gets a list of all registered post type objects. |
| Version | Description |
| --- | --- |
| [5.6.0](https://developer.wordpress.org/reference/since/5.6.0/) | Introduced. |
wordpress wp_kses_split( string $string, array[]|string $allowed_html, string[] $allowed_protocols ): string wp\_kses\_split( string $string, array[]|string $allowed\_html, string[] $allowed\_protocols ): string
======================================================================================================
Searches for HTML tags, no matter how malformed.
It also matches stray `>` characters.
`$string` string Required Content to filter. `$allowed_html` array[]|string Required An array of allowed HTML elements and attributes, or a context name such as `'post'`. See [wp\_kses\_allowed\_html()](wp_kses_allowed_html) for the list of accepted context names. `$allowed_protocols` string[] Required Array of allowed URL protocols. string Content with fixed HTML tags
File: `wp-includes/kses.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/kses.php/)
```
function wp_kses_split( $string, $allowed_html, $allowed_protocols ) {
global $pass_allowed_html, $pass_allowed_protocols;
$pass_allowed_html = $allowed_html;
$pass_allowed_protocols = $allowed_protocols;
return preg_replace_callback( '%(<!--.*?(-->|$))|(<[^>]*(>|$)|>)%', '_wp_kses_split_callback', $string );
}
```
| Used By | Description |
| --- | --- |
| [wp\_kses()](wp_kses) wp-includes/kses.php | Filters text content and strips out disallowed HTML. |
| Version | Description |
| --- | --- |
| [1.0.0](https://developer.wordpress.org/reference/since/1.0.0/) | Introduced. |
wordpress wp_get_http_headers( string $url, bool $deprecated = false ): Requests_Utility_CaseInsensitiveDictionary|false wp\_get\_http\_headers( string $url, bool $deprecated = false ): Requests\_Utility\_CaseInsensitiveDictionary|false
===================================================================================================================
Retrieves HTTP Headers from URL.
`$url` string Required URL to retrieve HTTP headers from. `$deprecated` bool Optional Not Used. Default: `false`
[Requests\_Utility\_CaseInsensitiveDictionary](../classes/requests_utility_caseinsensitivedictionary)|false Headers on success, false on failure.
File: `wp-includes/functions.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/functions.php/)
```
function wp_get_http_headers( $url, $deprecated = false ) {
if ( ! empty( $deprecated ) ) {
_deprecated_argument( __FUNCTION__, '2.7.0' );
}
$response = wp_safe_remote_head( $url );
if ( is_wp_error( $response ) ) {
return false;
}
return wp_remote_retrieve_headers( $response );
}
```
| Uses | Description |
| --- | --- |
| [wp\_remote\_retrieve\_headers()](wp_remote_retrieve_headers) wp-includes/http.php | Retrieve only the headers from the raw response. |
| [wp\_safe\_remote\_head()](wp_safe_remote_head) wp-includes/http.php | Retrieve the raw response from a safe HTTP request using the HEAD method. |
| [\_deprecated\_argument()](_deprecated_argument) wp-includes/functions.php | Marks a function argument as deprecated and inform when it has been used. |
| [is\_wp\_error()](is_wp_error) wp-includes/load.php | Checks whether the given variable is a WordPress Error. |
| Used By | Description |
| --- | --- |
| [do\_enclose()](do_enclose) wp-includes/functions.php | Checks content for video and audio links to add as enclosures. |
| Version | Description |
| --- | --- |
| [1.5.1](https://developer.wordpress.org/reference/since/1.5.1/) | Introduced. |
wordpress wp_list_bookmarks( string|array $args = '' ): void|string wp\_list\_bookmarks( string|array $args = '' ): void|string
===========================================================
Retrieves or echoes all of the bookmarks.
List of default arguments are as follows:
These options define how the Category name will appear before the category links are displayed, if ‘categorize’ is 1. If ‘categorize’ is 0, then it will display for only the ‘title\_li’ string and only if ‘title\_li’ is not empty.
* [\_walk\_bookmarks()](_walk_bookmarks)
`$args` string|array Optional String or array of arguments to list bookmarks.
* `orderby`stringHow to order the links by. Accepts post fields. Default `'name'`.
* `order`stringWhether to order bookmarks in ascending or descending order.
Accepts `'ASC'` (ascending) or `'DESC'` (descending). Default `'ASC'`.
* `limit`intAmount of bookmarks to display. Accepts 1+ or -1 for all.
Default -1.
* `category`stringComma-separated list of category IDs to include links from.
* `category_name`stringCategory to retrieve links for by name.
* `hide_invisible`int|boolWhether to show or hide links marked as `'invisible'`. Accepts `1|true` or `0|false`. Default `1|true`.
* `show_updated`int|boolWhether to display the time the bookmark was last updated.
Accepts `1|true` or `0|false`. Default `0|false`.
* `echo`int|boolWhether to echo or return the formatted bookmarks. Accepts `1|true` (echo) or `0|false` (return). Default `1|true`.
* `categorize`int|boolWhether to show links listed by category or in a single column.
Accepts `1|true` (by category) or `0|false` (one column). Default `1|true`.
* `show_description`int|boolWhether to show the bookmark descriptions. Accepts `1|true` or `0|false`.
Default `0|false`.
* `title_li`stringWhat to show before the links appear. Default `'Bookmarks'`.
* `title_before`stringThe HTML or text to prepend to the $title\_li string. Default ``<h2>``.
* `title_after`stringThe HTML or text to append to the $title\_li string. Default ``</h2>``.
* `class`string|arrayThe CSS class or an array of classes to use for the $title\_li.
Default `'linkcat'`.
* `category_before`stringThe HTML or text to prepend to $title\_before if $categorize is true.
String must contain `'%id'` and `'%class'` to inherit the category ID and the $class argument used for formatting in themes.
Default `<li id="%id" class="%class">`.
* `category_after`stringThe HTML or text to append to $title\_after if $categorize is true.
Default ``</li>``.
* `category_orderby`stringHow to order the bookmark category based on term scheme if $categorize is true. Default `'name'`.
* `category_order`stringWhether to order categories in ascending or descending order if $categorize is true. Accepts `'ASC'` (ascending) or `'DESC'` (descending).
Default `'ASC'`.
Default: `''`
void|string Void if `'echo'` argument is true, HTML list of bookmarks if `'echo'` is false.
File: `wp-includes/bookmark-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/bookmark-template.php/)
```
function wp_list_bookmarks( $args = '' ) {
$defaults = array(
'orderby' => 'name',
'order' => 'ASC',
'limit' => -1,
'category' => '',
'exclude_category' => '',
'category_name' => '',
'hide_invisible' => 1,
'show_updated' => 0,
'echo' => 1,
'categorize' => 1,
'title_li' => __( 'Bookmarks' ),
'title_before' => '<h2>',
'title_after' => '</h2>',
'category_orderby' => 'name',
'category_order' => 'ASC',
'class' => 'linkcat',
'category_before' => '<li id="%id" class="%class">',
'category_after' => '</li>',
);
$parsed_args = wp_parse_args( $args, $defaults );
$output = '';
if ( ! is_array( $parsed_args['class'] ) ) {
$parsed_args['class'] = explode( ' ', $parsed_args['class'] );
}
$parsed_args['class'] = array_map( 'sanitize_html_class', $parsed_args['class'] );
$parsed_args['class'] = trim( implode( ' ', $parsed_args['class'] ) );
if ( $parsed_args['categorize'] ) {
$cats = get_terms(
array(
'taxonomy' => 'link_category',
'name__like' => $parsed_args['category_name'],
'include' => $parsed_args['category'],
'exclude' => $parsed_args['exclude_category'],
'orderby' => $parsed_args['category_orderby'],
'order' => $parsed_args['category_order'],
'hierarchical' => 0,
)
);
if ( empty( $cats ) ) {
$parsed_args['categorize'] = false;
}
}
if ( $parsed_args['categorize'] ) {
// Split the bookmarks into ul's for each category.
foreach ( (array) $cats as $cat ) {
$params = array_merge( $parsed_args, array( 'category' => $cat->term_id ) );
$bookmarks = get_bookmarks( $params );
if ( empty( $bookmarks ) ) {
continue;
}
$output .= str_replace(
array( '%id', '%class' ),
array( "linkcat-$cat->term_id", $parsed_args['class'] ),
$parsed_args['category_before']
);
/**
* Filters the category name.
*
* @since 2.2.0
*
* @param string $cat_name The category name.
*/
$catname = apply_filters( 'link_category', $cat->name );
$output .= $parsed_args['title_before'];
$output .= $catname;
$output .= $parsed_args['title_after'];
$output .= "\n\t<ul class='xoxo blogroll'>\n";
$output .= _walk_bookmarks( $bookmarks, $parsed_args );
$output .= "\n\t</ul>\n";
$output .= $parsed_args['category_after'] . "\n";
}
} else {
// Output one single list using title_li for the title.
$bookmarks = get_bookmarks( $parsed_args );
if ( ! empty( $bookmarks ) ) {
if ( ! empty( $parsed_args['title_li'] ) ) {
$output .= str_replace(
array( '%id', '%class' ),
array( 'linkcat-' . $parsed_args['category'], $parsed_args['class'] ),
$parsed_args['category_before']
);
$output .= $parsed_args['title_before'];
$output .= $parsed_args['title_li'];
$output .= $parsed_args['title_after'];
$output .= "\n\t<ul class='xoxo blogroll'>\n";
$output .= _walk_bookmarks( $bookmarks, $parsed_args );
$output .= "\n\t</ul>\n";
$output .= $parsed_args['category_after'] . "\n";
} else {
$output .= _walk_bookmarks( $bookmarks, $parsed_args );
}
}
}
/**
* Filters the bookmarks list before it is echoed or returned.
*
* @since 2.5.0
*
* @param string $html The HTML list of bookmarks.
*/
$html = apply_filters( 'wp_list_bookmarks', $output );
if ( $parsed_args['echo'] ) {
echo $html;
} else {
return $html;
}
}
```
[apply\_filters( 'link\_category', string $cat\_name )](../hooks/link_category)
Filters the category name.
[apply\_filters( 'wp\_list\_bookmarks', string $html )](../hooks/wp_list_bookmarks)
Filters the bookmarks list before it is echoed or returned.
| Uses | Description |
| --- | --- |
| [get\_terms()](get_terms) wp-includes/taxonomy.php | Retrieves the terms in a given taxonomy or list of taxonomies. |
| [\_walk\_bookmarks()](_walk_bookmarks) wp-includes/bookmark-template.php | The formatted output of a list of bookmarks. |
| [get\_bookmarks()](get_bookmarks) wp-includes/bookmark.php | Retrieves the list of bookmarks. |
| [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. |
| [wp\_parse\_args()](wp_parse_args) wp-includes/functions.php | Merges user defined arguments into defaults array. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| Used By | Description |
| --- | --- |
| [wp\_get\_links()](wp_get_links) wp-includes/deprecated.php | Gets the links associated with category. |
| [wp\_get\_linksbyname()](wp_get_linksbyname) wp-includes/deprecated.php | Gets the links associated with the named category. |
| [WP\_Widget\_Links::widget()](../classes/wp_widget_links/widget) wp-includes/widgets/class-wp-widget-links.php | Outputs the content for the current Links widget instance. |
| Version | Description |
| --- | --- |
| [2.1.0](https://developer.wordpress.org/reference/since/2.1.0/) | Introduced. |
wordpress get_usermeta( int $user_id, string $meta_key = '' ): mixed get\_usermeta( int $user\_id, string $meta\_key = '' ): mixed
=============================================================
This function has been deprecated. Use [get\_user\_meta()](get_user_meta) instead.
Retrieve user metadata.
If $user\_id is not a number, then the function will fail over with a ‘false’ boolean return value. Other returned values depend on whether there is only one item to be returned, which be that single item type. If there is more than one metadata value, then it will be list of metadata values.
* [get\_user\_meta()](get_user_meta)
`$user_id` int Required User ID `$meta_key` string Optional Metadata key. Default: `''`
mixed
File: `wp-includes/deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/deprecated.php/)
```
function get_usermeta( $user_id, $meta_key = '' ) {
_deprecated_function( __FUNCTION__, '3.0.0', 'get_user_meta()' );
global $wpdb;
$user_id = (int) $user_id;
if ( !$user_id )
return false;
if ( !empty($meta_key) ) {
$meta_key = preg_replace('|[^a-z0-9_]|i', '', $meta_key);
$user = wp_cache_get($user_id, 'users');
// Check the cached user object.
if ( false !== $user && isset($user->$meta_key) )
$metas = array($user->$meta_key);
else
$metas = $wpdb->get_col( $wpdb->prepare("SELECT meta_value FROM $wpdb->usermeta WHERE user_id = %d AND meta_key = %s", $user_id, $meta_key) );
} else {
$metas = $wpdb->get_col( $wpdb->prepare("SELECT meta_value FROM $wpdb->usermeta WHERE user_id = %d", $user_id) );
}
if ( empty($metas) ) {
if ( empty($meta_key) )
return array();
else
return '';
}
$metas = array_map('maybe_unserialize', $metas);
if ( count($metas) == 1 )
return $metas[0];
else
return $metas;
}
```
| Uses | Description |
| --- | --- |
| [wpdb::get\_col()](../classes/wpdb/get_col) wp-includes/class-wpdb.php | Retrieves one column from the database. |
| [wp\_cache\_get()](wp_cache_get) wp-includes/cache.php | Retrieves the cache contents from the cache by key and group. |
| [\_deprecated\_function()](_deprecated_function) wp-includes/functions.php | Marks a function as deprecated and inform when it has been used. |
| [wpdb::prepare()](../classes/wpdb/prepare) wp-includes/class-wpdb.php | Prepares a SQL query for safe execution. |
| Version | Description |
| --- | --- |
| [3.0.0](https://developer.wordpress.org/reference/since/3.0.0/) | Use [get\_user\_meta()](get_user_meta) |
| [2.0.0](https://developer.wordpress.org/reference/since/2.0.0/) | Introduced. |
| programming_docs |
wordpress wp_ajax_find_posts() wp\_ajax\_find\_posts()
=======================
Ajax handler for querying posts for the Find Posts modal.
* [window.findPosts](window-findposts)
File: `wp-admin/includes/ajax-actions.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/ajax-actions.php/)
```
function wp_ajax_find_posts() {
check_ajax_referer( 'find-posts' );
$post_types = get_post_types( array( 'public' => true ), 'objects' );
unset( $post_types['attachment'] );
$args = array(
'post_type' => array_keys( $post_types ),
'post_status' => 'any',
'posts_per_page' => 50,
);
$search = wp_unslash( $_POST['ps'] );
if ( '' !== $search ) {
$args['s'] = $search;
}
$posts = get_posts( $args );
if ( ! $posts ) {
wp_send_json_error( __( 'No items found.' ) );
}
$html = '<table class="widefat"><thead><tr><th class="found-radio"><br /></th><th>' . __( 'Title' ) . '</th><th class="no-break">' . __( 'Type' ) . '</th><th class="no-break">' . __( 'Date' ) . '</th><th class="no-break">' . __( 'Status' ) . '</th></tr></thead><tbody>';
$alt = '';
foreach ( $posts as $post ) {
$title = trim( $post->post_title ) ? $post->post_title : __( '(no title)' );
$alt = ( 'alternate' === $alt ) ? '' : 'alternate';
switch ( $post->post_status ) {
case 'publish':
case 'private':
$stat = __( 'Published' );
break;
case 'future':
$stat = __( 'Scheduled' );
break;
case 'pending':
$stat = __( 'Pending Review' );
break;
case 'draft':
$stat = __( 'Draft' );
break;
}
if ( '0000-00-00 00:00:00' === $post->post_date ) {
$time = '';
} else {
/* translators: Date format in table columns, see https://www.php.net/manual/datetime.format.php */
$time = mysql2date( __( 'Y/m/d' ), $post->post_date );
}
$html .= '<tr class="' . trim( 'found-posts ' . $alt ) . '"><td class="found-radio"><input type="radio" id="found-' . $post->ID . '" name="found_post_id" value="' . esc_attr( $post->ID ) . '"></td>';
$html .= '<td><label for="found-' . $post->ID . '">' . esc_html( $title ) . '</label></td><td class="no-break">' . esc_html( $post_types[ $post->post_type ]->labels->singular_name ) . '</td><td class="no-break">' . esc_html( $time ) . '</td><td class="no-break">' . esc_html( $stat ) . ' </td></tr>' . "\n\n";
}
$html .= '</tbody></table>';
wp_send_json_success( $html );
}
```
| Uses | Description |
| --- | --- |
| [get\_posts()](get_posts) wp-includes/post.php | Retrieves an array of the latest posts, or posts matching the given criteria. |
| [mysql2date()](mysql2date) wp-includes/functions.php | Converts given MySQL date string into a different format. |
| [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. |
| [wp\_unslash()](wp_unslash) wp-includes/formatting.php | Removes slashes from a string or recursively removes slashes from strings within an array. |
| [esc\_attr()](esc_attr) wp-includes/formatting.php | Escaping for HTML attributes. |
| [esc\_html()](esc_html) wp-includes/formatting.php | Escaping for HTML blocks. |
| [check\_ajax\_referer()](check_ajax_referer) wp-includes/pluggable.php | Verifies the Ajax request to prevent processing requests external of the blog. |
| [wp\_send\_json\_error()](wp_send_json_error) wp-includes/functions.php | Sends a JSON response back to an Ajax request, indicating failure. |
| [wp\_send\_json\_success()](wp_send_json_success) wp-includes/functions.php | Sends a JSON response back to an Ajax request, indicating success. |
| [get\_post\_types()](get_post_types) wp-includes/post.php | Gets a list of all registered post type objects. |
| Version | Description |
| --- | --- |
| [3.1.0](https://developer.wordpress.org/reference/since/3.1.0/) | Introduced. |
wordpress get_dashboard_blog(): WP_Site get\_dashboard\_blog(): WP\_Site
================================
This function has been deprecated. Use [get\_site()](get_site) instead.
Get the “dashboard blog”, the blog where users without a blog edit their profile data.
Dashboard blog functionality was removed in WordPress 3.1, replaced by the user admin.
* [get\_site()](get_site)
[WP\_Site](../classes/wp_site) Current site object.
File: `wp-includes/ms-deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/ms-deprecated.php/)
```
function get_dashboard_blog() {
_deprecated_function( __FUNCTION__, '3.1.0', 'get_site()' );
if ( $blog = get_site_option( 'dashboard_blog' ) ) {
return get_site( $blog );
}
return get_site( get_network()->site_id );
}
```
| Uses | Description |
| --- | --- |
| [get\_network()](get_network) wp-includes/ms-network.php | Retrieves network data given a network ID or network object. |
| [get\_site()](get_site) wp-includes/ms-site.php | Retrieves site data given a site ID or site object. |
| [\_deprecated\_function()](_deprecated_function) wp-includes/functions.php | Marks a function as deprecated and inform when it has been used. |
| [get\_site\_option()](get_site_option) wp-includes/option.php | Retrieve an option value for the current network based on name of option. |
| Version | Description |
| --- | --- |
| [3.1.0](https://developer.wordpress.org/reference/since/3.1.0/) | Use [get\_site()](get_site) |
| [MU (3.0.0)](https://developer.wordpress.org/reference/since/mu.3.0.0/) | Introduced. |
wordpress the_modified_author() the\_modified\_author()
=======================
Displays the name of the author who last edited the current post, if the author’s ID is available.
* [get\_the\_author()](get_the_author)
File: `wp-includes/author-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/author-template.php/)
```
function the_modified_author() {
echo get_the_modified_author();
}
```
| Uses | Description |
| --- | --- |
| [get\_the\_modified\_author()](get_the_modified_author) wp-includes/author-template.php | Retrieves the author who last edited the current post. |
| Version | Description |
| --- | --- |
| [2.8.0](https://developer.wordpress.org/reference/since/2.8.0/) | Introduced. |
wordpress filter_block_content( string $text, array[]|string $allowed_html = 'post', string[] $allowed_protocols = array() ): string filter\_block\_content( string $text, array[]|string $allowed\_html = 'post', string[] $allowed\_protocols = array() ): string
==============================================================================================================================
Filters and sanitizes block content to remove non-allowable HTML from parsed block attribute values.
`$text` string Required Text that may contain block content. `$allowed_html` array[]|string Optional An array of allowed HTML elements and attributes, or a context name such as `'post'`. See [wp\_kses\_allowed\_html()](wp_kses_allowed_html) for the list of accepted context names. Default `'post'`. Default: `'post'`
`$allowed_protocols` string[] Optional Array of allowed URL protocols.
Defaults to the result of [wp\_allowed\_protocols()](wp_allowed_protocols) . Default: `array()`
string The filtered and sanitized content result.
File: `wp-includes/blocks.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/blocks.php/)
```
function filter_block_content( $text, $allowed_html = 'post', $allowed_protocols = array() ) {
$result = '';
$blocks = parse_blocks( $text );
foreach ( $blocks as $block ) {
$block = filter_block_kses( $block, $allowed_html, $allowed_protocols );
$result .= serialize_block( $block );
}
return $result;
}
```
| Uses | Description |
| --- | --- |
| [filter\_block\_kses()](filter_block_kses) wp-includes/blocks.php | Filters and sanitizes a parsed block to remove non-allowable HTML from block attribute values. |
| [serialize\_block()](serialize_block) wp-includes/blocks.php | Returns the content of a block, including comment delimiters, serializing all attributes from the given parsed block. |
| [parse\_blocks()](parse_blocks) wp-includes/blocks.php | Parses blocks out of a content string. |
| Used By | Description |
| --- | --- |
| [wp\_pre\_kses\_block\_attributes()](wp_pre_kses_block_attributes) wp-includes/formatting.php | Removes non-allowable HTML from parsed block attribute values when filtering in the post context. |
| Version | Description |
| --- | --- |
| [5.3.1](https://developer.wordpress.org/reference/since/5.3.1/) | Introduced. |
wordpress _wp_die_process_input( string|WP_Error $message, string $title = '', string|array $args = array() ): array \_wp\_die\_process\_input( string|WP\_Error $message, string $title = '', string|array $args = array() ): array
===============================================================================================================
This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.
Processes arguments passed to [wp\_die()](wp_die) consistently for its handlers.
`$message` string|[WP\_Error](../classes/wp_error) Required Error message or [WP\_Error](../classes/wp_error) object. `$title` string Optional Error title. Default: `''`
`$args` string|array Optional Arguments to control behavior. Default: `array()`
array Processed arguments.
* stringError message.
* `1`stringError title.
* `2`arrayArguments to control behavior.
File: `wp-includes/functions.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/functions.php/)
```
function _wp_die_process_input( $message, $title = '', $args = array() ) {
$defaults = array(
'response' => 0,
'code' => '',
'exit' => true,
'back_link' => false,
'link_url' => '',
'link_text' => '',
'text_direction' => '',
'charset' => 'utf-8',
'additional_errors' => array(),
);
$args = wp_parse_args( $args, $defaults );
if ( function_exists( 'is_wp_error' ) && is_wp_error( $message ) ) {
if ( ! empty( $message->errors ) ) {
$errors = array();
foreach ( (array) $message->errors as $error_code => $error_messages ) {
foreach ( (array) $error_messages as $error_message ) {
$errors[] = array(
'code' => $error_code,
'message' => $error_message,
'data' => $message->get_error_data( $error_code ),
);
}
}
$message = $errors[0]['message'];
if ( empty( $args['code'] ) ) {
$args['code'] = $errors[0]['code'];
}
if ( empty( $args['response'] ) && is_array( $errors[0]['data'] ) && ! empty( $errors[0]['data']['status'] ) ) {
$args['response'] = $errors[0]['data']['status'];
}
if ( empty( $title ) && is_array( $errors[0]['data'] ) && ! empty( $errors[0]['data']['title'] ) ) {
$title = $errors[0]['data']['title'];
}
unset( $errors[0] );
$args['additional_errors'] = array_values( $errors );
} else {
$message = '';
}
}
$have_gettext = function_exists( '__' );
// The $title and these specific $args must always have a non-empty value.
if ( empty( $args['code'] ) ) {
$args['code'] = 'wp_die';
}
if ( empty( $args['response'] ) ) {
$args['response'] = 500;
}
if ( empty( $title ) ) {
$title = $have_gettext ? __( 'WordPress › Error' ) : 'WordPress › Error';
}
if ( empty( $args['text_direction'] ) || ! in_array( $args['text_direction'], array( 'ltr', 'rtl' ), true ) ) {
$args['text_direction'] = 'ltr';
if ( function_exists( 'is_rtl' ) && is_rtl() ) {
$args['text_direction'] = 'rtl';
}
}
if ( ! empty( $args['charset'] ) ) {
$args['charset'] = _canonical_charset( $args['charset'] );
}
return array( $message, $title, $args );
}
```
| Uses | Description |
| --- | --- |
| [\_canonical\_charset()](_canonical_charset) wp-includes/functions.php | Retrieves a canonical form of the provided charset appropriate for passing to PHP functions such as htmlspecialchars() and charset HTML attributes. |
| [is\_rtl()](is_rtl) wp-includes/l10n.php | Determines whether the current locale is right-to-left (RTL). |
| [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. |
| [wp\_parse\_args()](wp_parse_args) wp-includes/functions.php | Merges user defined arguments into defaults array. |
| [is\_wp\_error()](is_wp_error) wp-includes/load.php | Checks whether the given variable is a WordPress Error. |
| Used By | Description |
| --- | --- |
| [\_jsonp\_wp\_die\_handler()](_jsonp_wp_die_handler) wp-includes/functions.php | Kills WordPress execution and displays JSONP response with an error message. |
| [\_xml\_wp\_die\_handler()](_xml_wp_die_handler) wp-includes/functions.php | Kills WordPress execution and displays XML response with an error message. |
| [\_json\_wp\_die\_handler()](_json_wp_die_handler) wp-includes/functions.php | Kills WordPress execution and displays JSON response with an error message. |
| [\_scalar\_wp\_die\_handler()](_scalar_wp_die_handler) wp-includes/functions.php | Kills WordPress execution and displays an error message. |
| [\_default\_wp\_die\_handler()](_default_wp_die_handler) wp-includes/functions.php | Kills WordPress execution and displays HTML page with an error message. |
| [\_ajax\_wp\_die\_handler()](_ajax_wp_die_handler) wp-includes/functions.php | Kills WordPress execution and displays Ajax response with an error message. |
| [\_xmlrpc\_wp\_die\_handler()](_xmlrpc_wp_die_handler) wp-includes/functions.php | Kills WordPress execution and displays XML response with an error message. |
| Version | Description |
| --- | --- |
| [5.1.0](https://developer.wordpress.org/reference/since/5.1.0/) | Introduced. |
wordpress get_comment_author_email( int|WP_Comment $comment_ID ): string get\_comment\_author\_email( int|WP\_Comment $comment\_ID ): string
===================================================================
Retrieves the email of the author of the current comment.
`$comment_ID` int|[WP\_Comment](../classes/wp_comment) Optional [WP\_Comment](../classes/wp_comment) or the ID of the comment for which to get the author's email.
Default current comment. string The current comment author's email
File: `wp-includes/comment-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/comment-template.php/)
```
function get_comment_author_email( $comment_ID = 0 ) {
$comment = get_comment( $comment_ID );
/**
* Filters the comment author's returned email address.
*
* @since 1.5.0
* @since 4.1.0 The `$comment_ID` and `$comment` parameters were added.
*
* @param string $comment_author_email The comment author's email address.
* @param string $comment_ID The comment ID as a numeric string.
* @param WP_Comment $comment The comment object.
*/
return apply_filters( 'get_comment_author_email', $comment->comment_author_email, $comment->comment_ID, $comment );
}
```
[apply\_filters( 'get\_comment\_author\_email', string $comment\_author\_email, string $comment\_ID, WP\_Comment $comment )](../hooks/get_comment_author_email)
Filters the comment author’s returned email address.
| Uses | Description |
| --- | --- |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| [get\_comment()](get_comment) wp-includes/comment.php | Retrieves comment data given a comment ID or comment object. |
| Used By | Description |
| --- | --- |
| [comment\_author\_email()](comment_author_email) wp-includes/comment-template.php | Displays the email of the author of the current global $comment. |
| Version | Description |
| --- | --- |
| [4.4.0](https://developer.wordpress.org/reference/since/4.4.0/) | Added the ability for `$comment_ID` to also accept a [WP\_Comment](../classes/wp_comment) object. |
| [1.5.0](https://developer.wordpress.org/reference/since/1.5.0/) | Introduced. |
wordpress unregister_term_meta( string $taxonomy, string $meta_key ): bool unregister\_term\_meta( string $taxonomy, string $meta\_key ): bool
===================================================================
Unregisters a meta key for terms.
`$taxonomy` string Required Taxonomy the meta key is currently registered for. Pass an empty string if the meta key is registered across all existing taxonomies. `$meta_key` string Required The meta key to unregister. bool True on success, false if the meta key was not previously registered.
File: `wp-includes/taxonomy.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/taxonomy.php/)
```
function unregister_term_meta( $taxonomy, $meta_key ) {
return unregister_meta_key( 'term', $meta_key, $taxonomy );
}
```
| Uses | Description |
| --- | --- |
| [unregister\_meta\_key()](unregister_meta_key) wp-includes/meta.php | Unregisters a meta key from the list of registered keys. |
| Version | Description |
| --- | --- |
| [4.9.8](https://developer.wordpress.org/reference/since/4.9.8/) | Introduced. |
wordpress _sanitize_text_fields( string $str, bool $keep_newlines = false ): string \_sanitize\_text\_fields( string $str, bool $keep\_newlines = false ): string
=============================================================================
This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.
Internal helper function to sanitize a string from user input or from the database.
`$str` string Required String to sanitize. `$keep_newlines` bool Optional Whether to keep newlines. Default: false. Default: `false`
string Sanitized string.
File: `wp-includes/formatting.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/formatting.php/)
```
function _sanitize_text_fields( $str, $keep_newlines = false ) {
if ( is_object( $str ) || is_array( $str ) ) {
return '';
}
$str = (string) $str;
$filtered = wp_check_invalid_utf8( $str );
if ( strpos( $filtered, '<' ) !== false ) {
$filtered = wp_pre_kses_less_than( $filtered );
// This will strip extra whitespace for us.
$filtered = wp_strip_all_tags( $filtered, false );
// Use HTML entities in a special case to make sure no later
// newline stripping stage could lead to a functional tag.
$filtered = str_replace( "<\n", "<\n", $filtered );
}
if ( ! $keep_newlines ) {
$filtered = preg_replace( '/[\r\n\t ]+/', ' ', $filtered );
}
$filtered = trim( $filtered );
$found = false;
while ( preg_match( '/%[a-f0-9]{2}/i', $filtered, $match ) ) {
$filtered = str_replace( $match[0], '', $filtered );
$found = true;
}
if ( $found ) {
// Strip out the whitespace that may now exist after removing the octets.
$filtered = trim( preg_replace( '/ +/', ' ', $filtered ) );
}
return $filtered;
}
```
| Uses | Description |
| --- | --- |
| [wp\_strip\_all\_tags()](wp_strip_all_tags) wp-includes/formatting.php | Properly strips all HTML tags including script and style |
| [wp\_pre\_kses\_less\_than()](wp_pre_kses_less_than) wp-includes/formatting.php | Converts lone less than signs. |
| [wp\_check\_invalid\_utf8()](wp_check_invalid_utf8) wp-includes/formatting.php | Checks for invalid UTF8 in a string. |
| Used By | Description |
| --- | --- |
| [sanitize\_textarea\_field()](sanitize_textarea_field) wp-includes/formatting.php | Sanitizes a multiline string from user input or from the database. |
| [sanitize\_text\_field()](sanitize_text_field) wp-includes/formatting.php | Sanitizes a string from user input or from the database. |
| Version | Description |
| --- | --- |
| [4.7.0](https://developer.wordpress.org/reference/since/4.7.0/) | Introduced. |
| programming_docs |
wordpress wp_update_image_subsizes( int $attachment_id ): array|WP_Error wp\_update\_image\_subsizes( int $attachment\_id ): array|WP\_Error
===================================================================
If any of the currently registered image sub-sizes are missing, create them and update the image meta data.
`$attachment_id` int Required The image attachment post ID. array|[WP\_Error](../classes/wp_error) The updated image meta data array or [WP\_Error](../classes/wp_error) object if both the image meta and the attached file are missing.
File: `wp-admin/includes/image.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/image.php/)
```
function wp_update_image_subsizes( $attachment_id ) {
$image_meta = wp_get_attachment_metadata( $attachment_id );
$image_file = wp_get_original_image_path( $attachment_id );
if ( empty( $image_meta ) || ! is_array( $image_meta ) ) {
// Previously failed upload?
// If there is an uploaded file, make all sub-sizes and generate all of the attachment meta.
if ( ! empty( $image_file ) ) {
$image_meta = wp_create_image_subsizes( $image_file, $attachment_id );
} else {
return new WP_Error( 'invalid_attachment', __( 'The attached file cannot be found.' ) );
}
} else {
$missing_sizes = wp_get_missing_image_subsizes( $attachment_id );
if ( empty( $missing_sizes ) ) {
return $image_meta;
}
// This also updates the image meta.
$image_meta = _wp_make_subsizes( $missing_sizes, $image_file, $image_meta, $attachment_id );
}
/** This filter is documented in wp-admin/includes/image.php */
$image_meta = apply_filters( 'wp_generate_attachment_metadata', $image_meta, $attachment_id, 'update' );
// Save the updated metadata.
wp_update_attachment_metadata( $attachment_id, $image_meta );
return $image_meta;
}
```
[apply\_filters( 'wp\_generate\_attachment\_metadata', array $metadata, int $attachment\_id, string $context )](../hooks/wp_generate_attachment_metadata)
Filters the generated attachment meta data.
| Uses | Description |
| --- | --- |
| [wp\_get\_original\_image\_path()](wp_get_original_image_path) wp-includes/post.php | Retrieves the path to an uploaded image file. |
| [wp\_create\_image\_subsizes()](wp_create_image_subsizes) wp-admin/includes/image.php | Creates image sub-sizes, adds the new data to the image meta `sizes` array, and updates the image metadata. |
| [wp\_get\_missing\_image\_subsizes()](wp_get_missing_image_subsizes) wp-admin/includes/image.php | Compare the existing image sub-sizes (as saved in the attachment meta) to the currently registered image sub-sizes, and return the difference. |
| [\_wp\_make\_subsizes()](_wp_make_subsizes) wp-admin/includes/image.php | Low-level function to create image sub-sizes. |
| [wp\_get\_attachment\_metadata()](wp_get_attachment_metadata) wp-includes/post.php | Retrieves attachment metadata for attachment ID. |
| [wp\_update\_attachment\_metadata()](wp_update_attachment_metadata) wp-includes/post.php | Updates metadata for an attachment. |
| [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| [WP\_Error::\_\_construct()](../classes/wp_error/__construct) wp-includes/class-wp-error.php | Initializes the error. |
| Used By | Description |
| --- | --- |
| [WP\_REST\_Attachments\_Controller::post\_process\_item()](../classes/wp_rest_attachments_controller/post_process_item) wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php | Performs post processing on an attachment. |
| [wp\_ajax\_media\_create\_image\_subsizes()](wp_ajax_media_create_image_subsizes) wp-admin/includes/ajax-actions.php | Ajax handler for creating missing image sub-sizes for just uploaded images. |
| Version | Description |
| --- | --- |
| [5.3.0](https://developer.wordpress.org/reference/since/5.3.0/) | Introduced. |
wordpress wp_filter_global_styles_post( string $data ): string wp\_filter\_global\_styles\_post( string $data ): string
========================================================
Sanitizes global styles user content removing unsafe rules.
`$data` string Required Post content to filter. string Filtered post content with unsafe rules removed.
File: `wp-includes/kses.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/kses.php/)
```
function wp_filter_global_styles_post( $data ) {
$decoded_data = json_decode( wp_unslash( $data ), true );
$json_decoding_error = json_last_error();
if (
JSON_ERROR_NONE === $json_decoding_error &&
is_array( $decoded_data ) &&
isset( $decoded_data['isGlobalStylesUserThemeJSON'] ) &&
$decoded_data['isGlobalStylesUserThemeJSON']
) {
unset( $decoded_data['isGlobalStylesUserThemeJSON'] );
$data_to_encode = WP_Theme_JSON::remove_insecure_properties( $decoded_data );
$data_to_encode['isGlobalStylesUserThemeJSON'] = true;
return wp_slash( wp_json_encode( $data_to_encode ) );
}
return $data;
}
```
| Uses | Description |
| --- | --- |
| [WP\_Theme\_JSON::remove\_insecure\_properties()](../classes/wp_theme_json/remove_insecure_properties) wp-includes/class-wp-theme-json.php | Removes insecure data from theme.json. |
| [wp\_json\_encode()](wp_json_encode) wp-includes/functions.php | Encodes a variable into JSON, with some sanity checks. |
| [wp\_unslash()](wp_unslash) wp-includes/formatting.php | Removes slashes from a string or recursively removes slashes from strings within an array. |
| [wp\_slash()](wp_slash) wp-includes/formatting.php | Adds slashes to a string or recursively adds slashes to strings within an array. |
| Version | Description |
| --- | --- |
| [5.9.0](https://developer.wordpress.org/reference/since/5.9.0/) | Introduced. |
wordpress is_tax( string|string[] $taxonomy = '', int|string|int[]|string[] $term = '' ): bool is\_tax( string|string[] $taxonomy = '', int|string|int[]|string[] $term = '' ): bool
=====================================================================================
Determines whether the query is for an existing custom taxonomy archive page.
If the $taxonomy parameter is specified, this function will additionally check if the query is for that specific $taxonomy.
If the $term parameter is specified in addition to the $taxonomy parameter, this function will additionally check if the query is for one of the terms specified.
For more information on this and similar theme functions, check out the [Conditional Tags](https://developer.wordpress.org/themes/basics/conditional-tags/) article in the Theme Developer Handbook.
`$taxonomy` string|string[] Optional Taxonomy slug or slugs to check against.
Default: `''`
`$term` int|string|int[]|string[] Optional Term ID, name, slug, or array of such to check against. Default: `''`
bool Whether the query is for an existing custom taxonomy archive page.
True for custom taxonomy archive pages, false for built-in taxonomies (category and tag archives).
File: `wp-includes/query.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/query.php/)
```
function is_tax( $taxonomy = '', $term = '' ) {
global $wp_query;
if ( ! isset( $wp_query ) ) {
_doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the query is run. Before then, they always return false.' ), '3.1.0' );
return false;
}
return $wp_query->is_tax( $taxonomy, $term );
}
```
| Uses | Description |
| --- | --- |
| [WP\_Query::is\_tax()](../classes/wp_query/is_tax) wp-includes/class-wp-query.php | Is the query for an existing custom taxonomy archive page? |
| [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. |
| [\_doing\_it\_wrong()](_doing_it_wrong) wp-includes/functions.php | Marks something as being incorrectly called. |
| Used By | Description |
| --- | --- |
| [rest\_get\_queried\_resource\_route()](rest_get_queried_resource_route) wp-includes/rest-api.php | Gets the REST route for the currently queried object. |
| [wp\_get\_document\_title()](wp_get_document_title) wp-includes/general-template.php | Returns document title for the current page. |
| [get\_the\_archive\_title()](get_the_archive_title) wp-includes/general-template.php | Retrieves the archive title based on the queried object. |
| [term\_description()](term_description) wp-includes/category-template.php | Retrieves term description. |
| [wp\_list\_categories()](wp_list_categories) wp-includes/category-template.php | Displays or retrieves the HTML list of categories. |
| [feed\_links\_extra()](feed_links_extra) wp-includes/general-template.php | Displays the links to the extra feeds such as category feeds. |
| [wp\_title()](wp_title) wp-includes/general-template.php | Displays or retrieves page title for all areas of blog. |
| [single\_term\_title()](single_term_title) wp-includes/general-template.php | Displays or retrieves page title for taxonomy term archive. |
| [WP::handle\_404()](../classes/wp/handle_404) wp-includes/class-wp.php | Set the Headers for 404, if nothing is found for requested URL. |
| [get\_body\_class()](get_body_class) wp-includes/post-template.php | Retrieves an array of the class names for the body element. |
| [redirect\_canonical()](redirect_canonical) wp-includes/canonical.php | Redirects incoming links to the proper URL based on the site url. |
| Version | Description |
| --- | --- |
| [2.5.0](https://developer.wordpress.org/reference/since/2.5.0/) | Introduced. |
wordpress wp_switch_roles_and_user( int $new_site_id, int $old_site_id ) wp\_switch\_roles\_and\_user( int $new\_site\_id, int $old\_site\_id )
======================================================================
Switches the initialized roles and current user capabilities to another site.
`$new_site_id` int Required New site ID. `$old_site_id` int Required Old site ID. File: `wp-includes/ms-blogs.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/ms-blogs.php/)
```
function wp_switch_roles_and_user( $new_site_id, $old_site_id ) {
if ( $new_site_id == $old_site_id ) {
return;
}
if ( ! did_action( 'init' ) ) {
return;
}
wp_roles()->for_site( $new_site_id );
wp_get_current_user()->for_site( $new_site_id );
}
```
| Uses | Description |
| --- | --- |
| [WP\_Roles::for\_site()](../classes/wp_roles/for_site) wp-includes/class-wp-roles.php | Sets the site to operate on. Defaults to the current site. |
| [wp\_roles()](wp_roles) wp-includes/capabilities.php | Retrieves the global [WP\_Roles](../classes/wp_roles) instance and instantiates it if necessary. |
| [wp\_get\_current\_user()](wp_get_current_user) wp-includes/pluggable.php | Retrieves the current user object. |
| [did\_action()](did_action) wp-includes/plugin.php | Retrieves the number of times an action has been fired during the current request. |
| Version | Description |
| --- | --- |
| [4.9.0](https://developer.wordpress.org/reference/since/4.9.0/) | Introduced. |
wordpress get_blogs_of_user( int $user_id, bool $all = false ): object[] get\_blogs\_of\_user( int $user\_id, bool $all = false ): object[]
==================================================================
Gets the sites a user belongs to.
`$user_id` int Required User ID `$all` bool Optional Whether to retrieve all sites, or only sites that are not marked as deleted, archived, or spam. Default: `false`
object[] A list of the user's sites. An empty array if the user doesn't exist or belongs to no sites.
File: `wp-includes/user.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/user.php/)
```
function get_blogs_of_user( $user_id, $all = false ) {
global $wpdb;
$user_id = (int) $user_id;
// Logged out users can't have sites.
if ( empty( $user_id ) ) {
return array();
}
/**
* Filters the list of a user's sites before it is populated.
*
* Returning a non-null value from the filter will effectively short circuit
* get_blogs_of_user(), returning that value instead.
*
* @since 4.6.0
*
* @param null|object[] $sites An array of site objects of which the user is a member.
* @param int $user_id User ID.
* @param bool $all Whether the returned array should contain all sites, including
* those marked 'deleted', 'archived', or 'spam'. Default false.
*/
$sites = apply_filters( 'pre_get_blogs_of_user', null, $user_id, $all );
if ( null !== $sites ) {
return $sites;
}
$keys = get_user_meta( $user_id );
if ( empty( $keys ) ) {
return array();
}
if ( ! is_multisite() ) {
$site_id = get_current_blog_id();
$sites = array( $site_id => new stdClass );
$sites[ $site_id ]->userblog_id = $site_id;
$sites[ $site_id ]->blogname = get_option( 'blogname' );
$sites[ $site_id ]->domain = '';
$sites[ $site_id ]->path = '';
$sites[ $site_id ]->site_id = 1;
$sites[ $site_id ]->siteurl = get_option( 'siteurl' );
$sites[ $site_id ]->archived = 0;
$sites[ $site_id ]->spam = 0;
$sites[ $site_id ]->deleted = 0;
return $sites;
}
$site_ids = array();
if ( isset( $keys[ $wpdb->base_prefix . 'capabilities' ] ) && defined( 'MULTISITE' ) ) {
$site_ids[] = 1;
unset( $keys[ $wpdb->base_prefix . 'capabilities' ] );
}
$keys = array_keys( $keys );
foreach ( $keys as $key ) {
if ( 'capabilities' !== substr( $key, -12 ) ) {
continue;
}
if ( $wpdb->base_prefix && 0 !== strpos( $key, $wpdb->base_prefix ) ) {
continue;
}
$site_id = str_replace( array( $wpdb->base_prefix, '_capabilities' ), '', $key );
if ( ! is_numeric( $site_id ) ) {
continue;
}
$site_ids[] = (int) $site_id;
}
$sites = array();
if ( ! empty( $site_ids ) ) {
$args = array(
'number' => '',
'site__in' => $site_ids,
'update_site_meta_cache' => false,
);
if ( ! $all ) {
$args['archived'] = 0;
$args['spam'] = 0;
$args['deleted'] = 0;
}
$_sites = get_sites( $args );
foreach ( $_sites as $site ) {
$sites[ $site->id ] = (object) array(
'userblog_id' => $site->id,
'blogname' => $site->blogname,
'domain' => $site->domain,
'path' => $site->path,
'site_id' => $site->network_id,
'siteurl' => $site->siteurl,
'archived' => $site->archived,
'mature' => $site->mature,
'spam' => $site->spam,
'deleted' => $site->deleted,
);
}
}
/**
* Filters the list of sites a user belongs to.
*
* @since MU (3.0.0)
*
* @param object[] $sites An array of site objects belonging to the user.
* @param int $user_id User ID.
* @param bool $all Whether the returned sites array should contain all sites, including
* those marked 'deleted', 'archived', or 'spam'. Default false.
*/
return apply_filters( 'get_blogs_of_user', $sites, $user_id, $all );
}
```
[apply\_filters( 'get\_blogs\_of\_user', object[] $sites, int $user\_id, bool $all )](../hooks/get_blogs_of_user)
Filters the list of sites a user belongs to.
[apply\_filters( 'pre\_get\_blogs\_of\_user', null|object[] $sites, int $user\_id, bool $all )](../hooks/pre_get_blogs_of_user)
Filters the list of a user’s sites before it is populated.
| Uses | Description |
| --- | --- |
| [get\_sites()](get_sites) wp-includes/ms-site.php | Retrieves a list of sites matching requested arguments. |
| [get\_user\_meta()](get_user_meta) wp-includes/user.php | Retrieves user meta field for a user. |
| [is\_multisite()](is_multisite) wp-includes/load.php | If Multisite is enabled. |
| [get\_current\_blog\_id()](get_current_blog_id) wp-includes/load.php | Retrieve the current site ID. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| [get\_option()](get_option) wp-includes/option.php | Retrieves an option value based on an option name. |
| Used By | Description |
| --- | --- |
| [WP\_MS\_Users\_List\_Table::column\_blogs()](../classes/wp_ms_users_list_table/column_blogs) wp-admin/includes/class-wp-ms-users-list-table.php | Handles the sites column output. |
| [signup\_another\_blog()](signup_another_blog) wp-signup.php | Shows a form for returning users to sign up for another site. |
| [\_access\_denied\_splash()](_access_denied_splash) wp-admin/includes/ms.php | Displays an access denied message when a user tries to view a site’s dashboard they do not have access to. |
| [choose\_primary\_blog()](choose_primary_blog) wp-admin/includes/ms.php | Handles the display of choosing a user’s primary site. |
| [wpmu\_delete\_user()](wpmu_delete_user) wp-admin/includes/ms.php | Delete a user from the network and remove from all sites. |
| [wp\_dashboard\_quick\_press()](wp_dashboard_quick_press) wp-admin/includes/dashboard.php | The Quick Draft widget display and creation of drafts. |
| [confirm\_delete\_users()](confirm_delete_users) wp-admin/includes/ms.php | |
| [get\_dashboard\_url()](get_dashboard_url) wp-includes/link-template.php | Retrieves the URL to the user’s dashboard. |
| [WP\_Admin\_Bar::initialize()](../classes/wp_admin_bar/initialize) wp-includes/class-wp-admin-bar.php | Initializes the admin bar. |
| [get\_most\_recent\_post\_of\_user()](get_most_recent_post_of_user) wp-includes/ms-functions.php | Gets a user’s most recent post. |
| [get\_active\_blog\_for\_user()](get_active_blog_for_user) wp-includes/ms-functions.php | Gets one of a user’s active blogs. |
| [remove\_user\_from\_blog()](remove_user_from_blog) wp-includes/ms-functions.php | Removes a user from a blog. |
| [wp\_xmlrpc\_server::wp\_getUsersBlogs()](../classes/wp_xmlrpc_server/wp_getusersblogs) wp-includes/class-wp-xmlrpc-server.php | Retrieve the blogs of the user. |
| Version | Description |
| --- | --- |
| [4.7.0](https://developer.wordpress.org/reference/since/4.7.0/) | Converted to use `get_sites()`. |
| [3.0.0](https://developer.wordpress.org/reference/since/3.0.0/) | Introduced. |
wordpress add_shortcode( string $tag, callable $callback ) add\_shortcode( string $tag, callable $callback )
=================================================
Adds a new shortcode.
Care should be taken through prefixing or other means to ensure that the shortcode tag being added is unique and will not conflict with other, already-added shortcode tags. In the event of a duplicated tag, the tag loaded last will take precedence.
`$tag` string Required Shortcode tag to be searched in post content. `$callback` callable Required The callback function to run when the shortcode is found.
Every shortcode callback is passed three parameters by default, including an array of attributes (`$atts`), the shortcode content or null if not set (`$content`), and finally the shortcode tag itself (`$shortcode_tag`), in that order. The shortcode callback will be passed three arguments: the shortcode attributes, the shortcode content (if any), and the name of the shortcode.
There can only be one hook for each shortcode. This means that if another plugin has a similar shortcode, it will override yours, or yours will override theirs depending on which order the plugins are included and/or ran.
Shortcode attribute names are always converted to lowercase before they are passed into the handler function. Values are untouched.
Note that the function called by the shortcode should *never* produce an output of any kind. Shortcode functions should *return* the text that is to be used to replace the shortcode. Producing the output directly will lead to unexpected results. This is similar to the way filter functions should behave, in that they should not produce unexpected side effects from the call since you cannot control when and where they are called from.
File: `wp-includes/shortcodes.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/shortcodes.php/)
```
function add_shortcode( $tag, $callback ) {
global $shortcode_tags;
if ( '' === trim( $tag ) ) {
_doing_it_wrong(
__FUNCTION__,
__( 'Invalid shortcode name: Empty name given.' ),
'4.4.0'
);
return;
}
if ( 0 !== preg_match( '@[<>&/\[\]\x00-\x20=]@', $tag ) ) {
_doing_it_wrong(
__FUNCTION__,
sprintf(
/* translators: 1: Shortcode name, 2: Space-separated list of reserved characters. */
__( 'Invalid shortcode name: %1$s. Do not use spaces or reserved characters: %2$s' ),
$tag,
'& / < > [ ] ='
),
'4.4.0'
);
return;
}
$shortcode_tags[ $tag ] = $callback;
}
```
| Uses | Description |
| --- | --- |
| [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. |
| [\_doing\_it\_wrong()](_doing_it_wrong) wp-includes/functions.php | Marks something as being incorrectly called. |
| Used By | Description |
| --- | --- |
| [WP\_Embed::\_\_construct()](../classes/wp_embed/__construct) wp-includes/class-wp-embed.php | Constructor |
| [WP\_Embed::run\_shortcode()](../classes/wp_embed/run_shortcode) wp-includes/class-wp-embed.php | Processes the [embed] shortcode. |
| Version | Description |
| --- | --- |
| [2.5.0](https://developer.wordpress.org/reference/since/2.5.0/) | Introduced. |
| programming_docs |
wordpress wp_filter_object_list( array $list, array $args = array(), string $operator = 'and', bool|string $field = false ): array wp\_filter\_object\_list( array $list, array $args = array(), string $operator = 'and', bool|string $field = false ): array
===========================================================================================================================
Filters a list of objects, based on a set of key => value arguments.
Retrieves the objects from the list that match the given arguments.
Key represents property name, and value represents property value.
If an object has more properties than those specified in arguments, that will not disqualify it. When using the ‘AND’ operator, any missing properties will disqualify it.
When using the `$field` argument, this function can also retrieve a particular field from all matching objects, whereas [wp\_list\_filter()](wp_list_filter) only does the filtering.
`$list` array Required An array of objects to filter. `$args` array Optional An array of key => value arguments to match against each object. Default: `array()`
`$operator` string Optional The logical operation to perform. `'AND'` means all elements from the array must match. `'OR'` means only one element needs to match. `'NOT'` means no elements may match. Default `'AND'`. Default: `'and'`
`$field` bool|string Optional A field from the object to place instead of the entire object. Default: `false`
array A list of objects or object fields.
File: `wp-includes/functions.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/functions.php/)
```
function wp_filter_object_list( $list, $args = array(), $operator = 'and', $field = false ) {
if ( ! is_array( $list ) ) {
return array();
}
$util = new WP_List_Util( $list );
$util->filter( $args, $operator );
if ( $field ) {
$util->pluck( $field );
}
return $util->get_output();
}
```
| Uses | Description |
| --- | --- |
| [WP\_List\_Util::\_\_construct()](../classes/wp_list_util/__construct) wp-includes/class-wp-list-util.php | Constructor. |
| Used By | Description |
| --- | --- |
| [get\_post\_types\_by\_support()](get_post_types_by_support) wp-includes/post.php | Retrieves a list of post type names that support a specific feature. |
| [WP\_Plugin\_Install\_List\_Table::prepare\_items()](../classes/wp_plugin_install_list_table/prepare_items) wp-admin/includes/class-wp-plugin-install-list-table.php | |
| [WP\_Media\_List\_Table::get\_columns()](../classes/wp_media_list_table/get_columns) wp-admin/includes/class-wp-media-list-table.php | |
| [WP\_Posts\_List\_Table::get\_columns()](../classes/wp_posts_list_table/get_columns) wp-admin/includes/class-wp-posts-list-table.php | |
| [wp\_list\_filter()](wp_list_filter) wp-includes/functions.php | Filters a list of objects, based on a set of key => value arguments. |
| [get\_taxonomies()](get_taxonomies) wp-includes/taxonomy.php | Retrieves a list of registered taxonomy names or objects. |
| [get\_post\_stati()](get_post_stati) wp-includes/post.php | Gets a list of post statuses. |
| [get\_post\_types()](get_post_types) wp-includes/post.php | Gets a list of all registered post type objects. |
| Version | Description |
| --- | --- |
| [4.7.0](https://developer.wordpress.org/reference/since/4.7.0/) | Uses `WP_List_Util` class. |
| [3.0.0](https://developer.wordpress.org/reference/since/3.0.0/) | Introduced. |
wordpress excerpt_remove_blocks( string $content ): string excerpt\_remove\_blocks( string $content ): string
==================================================
Parses blocks out of a content string, and renders those appropriate for the excerpt.
As the excerpt should be a small string of text relevant to the full post content, this function renders the blocks that are most likely to contain such text.
`$content` string Required The content to parse. string The parsed and filtered content.
File: `wp-includes/blocks.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/blocks.php/)
```
function excerpt_remove_blocks( $content ) {
$allowed_inner_blocks = array(
// Classic blocks have their blockName set to null.
null,
'core/freeform',
'core/heading',
'core/html',
'core/list',
'core/media-text',
'core/paragraph',
'core/preformatted',
'core/pullquote',
'core/quote',
'core/table',
'core/verse',
);
$allowed_wrapper_blocks = array(
'core/columns',
'core/column',
'core/group',
);
/**
* Filters the list of blocks that can be used as wrapper blocks, allowing
* excerpts to be generated from the `innerBlocks` of these wrappers.
*
* @since 5.8.0
*
* @param string[] $allowed_wrapper_blocks The list of names of allowed wrapper blocks.
*/
$allowed_wrapper_blocks = apply_filters( 'excerpt_allowed_wrapper_blocks', $allowed_wrapper_blocks );
$allowed_blocks = array_merge( $allowed_inner_blocks, $allowed_wrapper_blocks );
/**
* Filters the list of blocks that can contribute to the excerpt.
*
* If a dynamic block is added to this list, it must not generate another
* excerpt, as this will cause an infinite loop to occur.
*
* @since 5.0.0
*
* @param string[] $allowed_blocks The list of names of allowed blocks.
*/
$allowed_blocks = apply_filters( 'excerpt_allowed_blocks', $allowed_blocks );
$blocks = parse_blocks( $content );
$output = '';
foreach ( $blocks as $block ) {
if ( in_array( $block['blockName'], $allowed_blocks, true ) ) {
if ( ! empty( $block['innerBlocks'] ) ) {
if ( in_array( $block['blockName'], $allowed_wrapper_blocks, true ) ) {
$output .= _excerpt_render_inner_blocks( $block, $allowed_blocks );
continue;
}
// Skip the block if it has disallowed or nested inner blocks.
foreach ( $block['innerBlocks'] as $inner_block ) {
if (
! in_array( $inner_block['blockName'], $allowed_inner_blocks, true ) ||
! empty( $inner_block['innerBlocks'] )
) {
continue 2;
}
}
}
$output .= render_block( $block );
}
}
return $output;
}
```
[apply\_filters( 'excerpt\_allowed\_blocks', string[] $allowed\_blocks )](../hooks/excerpt_allowed_blocks)
Filters the list of blocks that can contribute to the excerpt.
[apply\_filters( 'excerpt\_allowed\_wrapper\_blocks', string[] $allowed\_wrapper\_blocks )](../hooks/excerpt_allowed_wrapper_blocks)
Filters the list of blocks that can be used as wrapper blocks, allowing excerpts to be generated from the `innerBlocks` of these wrappers.
| Uses | Description |
| --- | --- |
| [\_excerpt\_render\_inner\_blocks()](_excerpt_render_inner_blocks) wp-includes/blocks.php | Renders inner blocks from the allowed wrapper blocks for generating an excerpt. |
| [parse\_blocks()](parse_blocks) wp-includes/blocks.php | Parses blocks out of a content string. |
| [render\_block()](render_block) wp-includes/blocks.php | Renders a single block into a HTML string. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| Used By | Description |
| --- | --- |
| [wp\_trim\_excerpt()](wp_trim_excerpt) wp-includes/formatting.php | Generates an excerpt from the content, if needed. |
| Version | Description |
| --- | --- |
| [5.0.0](https://developer.wordpress.org/reference/since/5.0.0/) | Introduced. |
wordpress wp_get_original_image_url( int $attachment_id ): string|false wp\_get\_original\_image\_url( int $attachment\_id ): string|false
==================================================================
Retrieves the URL to an original attachment image.
Similar to `wp_get_attachment_url()` however some images may have been processed after uploading. In this case this function returns the URL to the originally uploaded image file.
`$attachment_id` int Required Attachment post ID. string|false Attachment image URL, false on error or if the attachment is not an image.
File: `wp-includes/post.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/post.php/)
```
function wp_get_original_image_url( $attachment_id ) {
if ( ! wp_attachment_is_image( $attachment_id ) ) {
return false;
}
$image_url = wp_get_attachment_url( $attachment_id );
if ( ! $image_url ) {
return false;
}
$image_meta = wp_get_attachment_metadata( $attachment_id );
if ( empty( $image_meta['original_image'] ) ) {
$original_image_url = $image_url;
} else {
$original_image_url = path_join( dirname( $image_url ), $image_meta['original_image'] );
}
/**
* Filters the URL to the original attachment image.
*
* @since 5.3.0
*
* @param string $original_image_url URL to original image.
* @param int $attachment_id Attachment ID.
*/
return apply_filters( 'wp_get_original_image_url', $original_image_url, $attachment_id );
}
```
[apply\_filters( 'wp\_get\_original\_image\_url', string $original\_image\_url, int $attachment\_id )](../hooks/wp_get_original_image_url)
Filters the URL to the original attachment image.
| Uses | Description |
| --- | --- |
| [path\_join()](path_join) wp-includes/functions.php | Joins two filesystem paths together. |
| [wp\_attachment\_is\_image()](wp_attachment_is_image) wp-includes/post.php | Determines whether an attachment is an image. |
| [wp\_get\_attachment\_url()](wp_get_attachment_url) wp-includes/post.php | Retrieves the URL for an attachment. |
| [wp\_get\_attachment\_metadata()](wp_get_attachment_metadata) wp-includes/post.php | Retrieves attachment metadata for attachment ID. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| Used By | Description |
| --- | --- |
| [attachment\_submitbox\_metadata()](attachment_submitbox_metadata) wp-admin/includes/media.php | Displays non-editable attachment metadata in the publish meta box. |
| [wp\_prepare\_attachment\_for\_js()](wp_prepare_attachment_for_js) wp-includes/media.php | Prepares an attachment post object for JS, where it is expected to be JSON-encoded and fit into an Attachment model. |
| Version | Description |
| --- | --- |
| [5.3.0](https://developer.wordpress.org/reference/since/5.3.0/) | Introduced. |
wordpress delete_post_meta( int $post_id, string $meta_key, mixed $meta_value = '' ): bool delete\_post\_meta( int $post\_id, string $meta\_key, mixed $meta\_value = '' ): bool
=====================================================================================
Deletes a post meta field for the given post ID.
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 the key, if needed.
`$post_id` int Required Post ID. `$meta_key` string Required Metadata name. `$meta_value` mixed Optional Metadata value. If provided, rows will only be removed that match the value.
Must be serializable if non-scalar. Default: `''`
bool True on success, false on failure.
File: `wp-includes/post.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/post.php/)
```
function delete_post_meta( $post_id, $meta_key, $meta_value = '' ) {
// Make sure meta is deleted from the post, not from a revision.
$the_post = wp_is_post_revision( $post_id );
if ( $the_post ) {
$post_id = $the_post;
}
return delete_metadata( 'post', $post_id, $meta_key, $meta_value );
}
```
| Uses | Description |
| --- | --- |
| [wp\_is\_post\_revision()](wp_is_post_revision) wp-includes/revision.php | Determines if the specified post is a revision. |
| [delete\_metadata()](delete_metadata) wp-includes/meta.php | Deletes metadata for the specified object. |
| Used By | Description |
| --- | --- |
| [do\_all\_trackbacks()](do_all_trackbacks) wp-includes/comment.php | Performs all trackbacks. |
| [do\_all\_enclosures()](do_all_enclosures) wp-includes/comment.php | Performs all enclosures. |
| [do\_all\_pingbacks()](do_all_pingbacks) wp-includes/comment.php | Performs all pingbacks. |
| [wp\_check\_for\_changed\_dates()](wp_check_for_changed_dates) wp-includes/post.php | Checks for changed dates for published post objects and save the old date. |
| [WP\_Privacy\_Policy\_Content::get\_suggested\_policy\_text()](../classes/wp_privacy_policy_content/get_suggested_policy_text) wp-admin/includes/class-wp-privacy-policy-content.php | Check for updated, added or removed privacy policy information from plugins. |
| [WP\_Privacy\_Policy\_Content::\_policy\_page\_updated()](../classes/wp_privacy_policy_content/_policy_page_updated) wp-admin/includes/class-wp-privacy-policy-content.php | Update the cached policy info when the policy page is updated. |
| [wp\_privacy\_process\_personal\_data\_export\_page()](wp_privacy_process_personal_data_export_page) wp-admin/includes/privacy-tools.php | Intercept personal data exporter page Ajax responses in order to assemble the personal data export file. |
| [wp\_privacy\_generate\_personal\_data\_export\_file()](wp_privacy_generate_personal_data_export_file) wp-admin/includes/privacy-tools.php | Generate the personal data export file. |
| [WP\_Customize\_Manager::handle\_dismiss\_autosave\_or\_lock\_request()](../classes/wp_customize_manager/handle_dismiss_autosave_or_lock_request) wp-includes/class-wp-customize-manager.php | Deletes a given auto-draft changeset or the autosave revision for a given changeset or delete changeset lock. |
| [\_wp\_delete\_customize\_changeset\_dependent\_auto\_drafts()](_wp_delete_customize_changeset_dependent_auto_drafts) wp-includes/nav-menu.php | Deletes auto-draft posts associated with the supplied changeset. |
| [WP\_Customize\_Nav\_Menus::save\_nav\_menus\_created\_posts()](../classes/wp_customize_nav_menus/save_nav_menus_created_posts) wp-includes/class-wp-customize-nav-menus.php | Publishes the auto-draft posts that were created for nav menu items. |
| [Custom\_Image\_Header::ajax\_header\_remove()](../classes/custom_image_header/ajax_header_remove) wp-admin/includes/class-custom-image-header.php | Given an attachment ID for a header image, unsets it as a user-uploaded header image for the active theme. |
| [wp\_scheduled\_delete()](wp_scheduled_delete) wp-includes/functions.php | Permanently deletes comments or posts of any type that have held a status of ‘trash’ for the number of days defined in EMPTY\_TRASH\_DAYS. |
| [WP\_Embed::delete\_oembed\_caches()](../classes/wp_embed/delete_oembed_caches) wp-includes/class-wp-embed.php | Deletes all oEmbed caches. Unused by core as of 4.0.0. |
| [set\_post\_thumbnail()](set_post_thumbnail) wp-includes/post.php | Sets the post thumbnail (featured image) for the given post. |
| [delete\_post\_thumbnail()](delete_post_thumbnail) wp-includes/post.php | Removes the thumbnail (featured image) from the given post. |
| [wp\_check\_for\_changed\_slugs()](wp_check_for_changed_slugs) wp-includes/post.php | Checks for changed slugs for published post objects and save the old slug. |
| [wp\_delete\_attachment()](wp_delete_attachment) wp-includes/post.php | Trashes or deletes an attachment. |
| [wp\_update\_attachment\_metadata()](wp_update_attachment_metadata) wp-includes/post.php | Updates metadata for an attachment. |
| [wp\_untrash\_post\_comments()](wp_untrash_post_comments) wp-includes/post.php | Restores comments for a post from the Trash. |
| [wp\_insert\_post()](wp_insert_post) wp-includes/post.php | Inserts or update a post. |
| [wp\_delete\_post()](wp_delete_post) wp-includes/post.php | Trashes or deletes a post or page. |
| [wp\_untrash\_post()](wp_untrash_post) wp-includes/post.php | Restores a post from the Trash. |
| [update\_attached\_file()](update_attached_file) wp-includes/post.php | Updates attachment file path based on attachment ID. |
| [wp\_update\_nav\_menu\_item()](wp_update_nav_menu_item) wp-includes/nav-menu.php | Saves the properties of a menu item or create a new one. |
| Version | Description |
| --- | --- |
| [1.5.0](https://developer.wordpress.org/reference/since/1.5.0/) | Introduced. |
wordpress tag_exists( int|string $tag_name ): mixed tag\_exists( int|string $tag\_name ): mixed
===========================================
Checks whether a post tag with a given name exists.
`$tag_name` int|string Required mixed Returns null if the term does not exist.
Returns an array of the term ID and the term taxonomy ID if the pairing exists.
Returns 0 if term ID 0 is passed to the function.
File: `wp-admin/includes/taxonomy.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/taxonomy.php/)
```
function tag_exists( $tag_name ) {
return term_exists( $tag_name, 'post_tag' );
}
```
| Uses | Description |
| --- | --- |
| [term\_exists()](term_exists) wp-includes/taxonomy.php | Determines whether a taxonomy term exists. |
| Version | Description |
| --- | --- |
| [2.3.0](https://developer.wordpress.org/reference/since/2.3.0/) | Introduced. |
wordpress image_add_caption( string $html, int $id, string $caption, string $title, string $align, string $url, string $size, string $alt = '' ): string image\_add\_caption( string $html, int $id, string $caption, string $title, string $align, string $url, string $size, string $alt = '' ): string
================================================================================================================================================
Adds image shortcode with caption to editor.
`$html` string Required The image HTML markup to send. `$id` int Required Image attachment ID. `$caption` string Required Image caption. `$title` string Required Image title attribute (not used). `$align` string Required Image CSS alignment property. `$url` string Required Image source URL (not used). `$size` string Required Image size (not used). `$alt` string Optional Image `alt` attribute (not used). Default: `''`
string The image HTML markup with caption shortcode.
File: `wp-admin/includes/media.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/media.php/)
```
function image_add_caption( $html, $id, $caption, $title, $align, $url, $size, $alt = '' ) {
/**
* Filters the caption text.
*
* Note: If the caption text is empty, the caption shortcode will not be appended
* to the image HTML when inserted into the editor.
*
* Passing an empty value also prevents the {@see 'image_add_caption_shortcode'}
* Filters from being evaluated at the end of image_add_caption().
*
* @since 4.1.0
*
* @param string $caption The original caption text.
* @param int $id The attachment ID.
*/
$caption = apply_filters( 'image_add_caption_text', $caption, $id );
/**
* Filters whether to disable captions.
*
* Prevents image captions from being appended to image HTML when inserted into the editor.
*
* @since 2.6.0
*
* @param bool $bool Whether to disable appending captions. Returning true from the filter
* will disable captions. Default empty string.
*/
if ( empty( $caption ) || apply_filters( 'disable_captions', '' ) ) {
return $html;
}
$id = ( 0 < (int) $id ) ? 'attachment_' . $id : '';
if ( ! preg_match( '/width=["\']([0-9]+)/', $html, $matches ) ) {
return $html;
}
$width = $matches[1];
$caption = str_replace( array( "\r\n", "\r" ), "\n", $caption );
$caption = preg_replace_callback( '/<[a-zA-Z0-9]+(?: [^<>]+>)*/', '_cleanup_image_add_caption', $caption );
// Convert any remaining line breaks to <br />.
$caption = preg_replace( '/[ \n\t]*\n[ \t]*/', '<br />', $caption );
$html = preg_replace( '/(class=["\'][^\'"]*)align(none|left|right|center)\s?/', '$1', $html );
if ( empty( $align ) ) {
$align = 'none';
}
$shcode = '[caption id="' . $id . '" align="align' . $align . '" width="' . $width . '"]' . $html . ' ' . $caption . '[/caption]';
/**
* Filters the image HTML markup including the caption shortcode.
*
* @since 2.6.0
*
* @param string $shcode The image HTML markup with caption shortcode.
* @param string $html The image HTML markup.
*/
return apply_filters( 'image_add_caption_shortcode', $shcode, $html );
}
```
[apply\_filters( 'disable\_captions', bool $bool )](../hooks/disable_captions)
Filters whether to disable captions.
[apply\_filters( 'image\_add\_caption\_shortcode', string $shcode, string $html )](../hooks/image_add_caption_shortcode)
Filters the image HTML markup including the caption shortcode.
[apply\_filters( 'image\_add\_caption\_text', string $caption, int $id )](../hooks/image_add_caption_text)
Filters the caption text.
| Uses | Description |
| --- | --- |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| Version | Description |
| --- | --- |
| [2.6.0](https://developer.wordpress.org/reference/since/2.6.0/) | Introduced. |
| programming_docs |
wordpress paused_themes_notice() paused\_themes\_notice()
========================
Renders an admin notice in case some themes have been paused due to errors.
File: `wp-admin/includes/theme.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/theme.php/)
```
function paused_themes_notice() {
if ( 'themes.php' === $GLOBALS['pagenow'] ) {
return;
}
if ( ! current_user_can( 'resume_themes' ) ) {
return;
}
if ( ! isset( $GLOBALS['_paused_themes'] ) || empty( $GLOBALS['_paused_themes'] ) ) {
return;
}
printf(
'<div class="notice notice-error"><p><strong>%s</strong><br>%s</p><p><a href="%s">%s</a></p></div>',
__( 'One or more themes failed to load properly.' ),
__( 'You can find more details and make changes on the Themes screen.' ),
esc_url( admin_url( 'themes.php' ) ),
__( 'Go to the Themes screen' )
);
}
```
| Uses | Description |
| --- | --- |
| [current\_user\_can()](current_user_can) wp-includes/capabilities.php | Returns whether the current user has the specified capability. |
| [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. |
| [esc\_url()](esc_url) wp-includes/formatting.php | Checks and cleans a URL. |
| [admin\_url()](admin_url) wp-includes/link-template.php | Retrieves the URL to the admin area for the current site. |
| Version | Description |
| --- | --- |
| [5.2.0](https://developer.wordpress.org/reference/since/5.2.0/) | Introduced. |
wordpress wp_notify_moderator( int $comment_id ): true wp\_notify\_moderator( int $comment\_id ): true
===============================================
Notifies the moderator of the site about a new comment that is awaiting approval.
`$comment_id` int Required Comment ID. true Always returns true.
File: `wp-includes/pluggable.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/pluggable.php/)
```
function wp_notify_moderator( $comment_id ) {
global $wpdb;
$maybe_notify = get_option( 'moderation_notify' );
/**
* Filters whether to send the site moderator email notifications, overriding the site setting.
*
* @since 4.4.0
*
* @param bool $maybe_notify Whether to notify blog moderator.
* @param int $comment_ID The id of the comment for the notification.
*/
$maybe_notify = apply_filters( 'notify_moderator', $maybe_notify, $comment_id );
if ( ! $maybe_notify ) {
return true;
}
$comment = get_comment( $comment_id );
$post = get_post( $comment->comment_post_ID );
$user = get_userdata( $post->post_author );
// Send to the administration and to the post author if the author can modify the comment.
$emails = array( get_option( 'admin_email' ) );
if ( $user && user_can( $user->ID, 'edit_comment', $comment_id ) && ! empty( $user->user_email ) ) {
if ( 0 !== strcasecmp( $user->user_email, get_option( 'admin_email' ) ) ) {
$emails[] = $user->user_email;
}
}
$switched_locale = switch_to_locale( get_locale() );
$comment_author_domain = '';
if ( WP_Http::is_ip_address( $comment->comment_author_IP ) ) {
$comment_author_domain = gethostbyaddr( $comment->comment_author_IP );
}
$comments_waiting = $wpdb->get_var( "SELECT COUNT(*) FROM $wpdb->comments WHERE comment_approved = '0'" );
// The blogname option is escaped with esc_html() on the way into the database in sanitize_option().
// We want to reverse this for the plain text arena of emails.
$blogname = wp_specialchars_decode( get_option( 'blogname' ), ENT_QUOTES );
$comment_content = wp_specialchars_decode( $comment->comment_content );
switch ( $comment->comment_type ) {
case 'trackback':
/* translators: %s: Post title. */
$notify_message = sprintf( __( 'A new trackback on the post "%s" is waiting for your approval' ), $post->post_title ) . "\r\n";
$notify_message .= get_permalink( $comment->comment_post_ID ) . "\r\n\r\n";
/* translators: 1: Trackback/pingback website name, 2: Website IP address, 3: Website hostname. */
$notify_message .= sprintf( __( 'Website: %1$s (IP address: %2$s, %3$s)' ), $comment->comment_author, $comment->comment_author_IP, $comment_author_domain ) . "\r\n";
/* translators: %s: Trackback/pingback/comment author URL. */
$notify_message .= sprintf( __( 'URL: %s' ), $comment->comment_author_url ) . "\r\n";
$notify_message .= __( 'Trackback excerpt: ' ) . "\r\n" . $comment_content . "\r\n\r\n";
break;
case 'pingback':
/* translators: %s: Post title. */
$notify_message = sprintf( __( 'A new pingback on the post "%s" is waiting for your approval' ), $post->post_title ) . "\r\n";
$notify_message .= get_permalink( $comment->comment_post_ID ) . "\r\n\r\n";
/* translators: 1: Trackback/pingback website name, 2: Website IP address, 3: Website hostname. */
$notify_message .= sprintf( __( 'Website: %1$s (IP address: %2$s, %3$s)' ), $comment->comment_author, $comment->comment_author_IP, $comment_author_domain ) . "\r\n";
/* translators: %s: Trackback/pingback/comment author URL. */
$notify_message .= sprintf( __( 'URL: %s' ), $comment->comment_author_url ) . "\r\n";
$notify_message .= __( 'Pingback excerpt: ' ) . "\r\n" . $comment_content . "\r\n\r\n";
break;
default: // Comments.
/* translators: %s: Post title. */
$notify_message = sprintf( __( 'A new comment on the post "%s" is waiting for your approval' ), $post->post_title ) . "\r\n";
$notify_message .= get_permalink( $comment->comment_post_ID ) . "\r\n\r\n";
/* translators: 1: Comment author's name, 2: Comment author's IP address, 3: Comment author's hostname. */
$notify_message .= sprintf( __( 'Author: %1$s (IP address: %2$s, %3$s)' ), $comment->comment_author, $comment->comment_author_IP, $comment_author_domain ) . "\r\n";
/* translators: %s: Comment author email. */
$notify_message .= sprintf( __( 'Email: %s' ), $comment->comment_author_email ) . "\r\n";
/* translators: %s: Trackback/pingback/comment author URL. */
$notify_message .= sprintf( __( 'URL: %s' ), $comment->comment_author_url ) . "\r\n";
if ( $comment->comment_parent ) {
/* translators: Comment moderation. %s: Parent comment edit URL. */
$notify_message .= sprintf( __( 'In reply to: %s' ), admin_url( "comment.php?action=editcomment&c={$comment->comment_parent}#wpbody-content" ) ) . "\r\n";
}
/* translators: %s: Comment text. */
$notify_message .= sprintf( __( 'Comment: %s' ), "\r\n" . $comment_content ) . "\r\n\r\n";
break;
}
/* translators: Comment moderation. %s: Comment action URL. */
$notify_message .= sprintf( __( 'Approve it: %s' ), admin_url( "comment.php?action=approve&c={$comment_id}#wpbody-content" ) ) . "\r\n";
if ( EMPTY_TRASH_DAYS ) {
/* translators: Comment moderation. %s: Comment action URL. */
$notify_message .= sprintf( __( 'Trash it: %s' ), admin_url( "comment.php?action=trash&c={$comment_id}#wpbody-content" ) ) . "\r\n";
} else {
/* translators: Comment moderation. %s: Comment action URL. */
$notify_message .= sprintf( __( 'Delete it: %s' ), admin_url( "comment.php?action=delete&c={$comment_id}#wpbody-content" ) ) . "\r\n";
}
/* translators: Comment moderation. %s: Comment action URL. */
$notify_message .= sprintf( __( 'Spam it: %s' ), admin_url( "comment.php?action=spam&c={$comment_id}#wpbody-content" ) ) . "\r\n";
$notify_message .= sprintf(
/* translators: Comment moderation. %s: Number of comments awaiting approval. */
_n(
'Currently %s comment is waiting for approval. Please visit the moderation panel:',
'Currently %s comments are waiting for approval. Please visit the moderation panel:',
$comments_waiting
),
number_format_i18n( $comments_waiting )
) . "\r\n";
$notify_message .= admin_url( 'edit-comments.php?comment_status=moderated#wpbody-content' ) . "\r\n";
/* translators: Comment moderation notification email subject. 1: Site title, 2: Post title. */
$subject = sprintf( __( '[%1$s] Please moderate: "%2$s"' ), $blogname, $post->post_title );
$message_headers = '';
/**
* Filters the list of recipients for comment moderation emails.
*
* @since 3.7.0
*
* @param string[] $emails List of email addresses to notify for comment moderation.
* @param int $comment_id Comment ID.
*/
$emails = apply_filters( 'comment_moderation_recipients', $emails, $comment_id );
/**
* Filters the comment moderation email text.
*
* @since 1.5.2
*
* @param string $notify_message Text of the comment moderation email.
* @param int $comment_id Comment ID.
*/
$notify_message = apply_filters( 'comment_moderation_text', $notify_message, $comment_id );
/**
* Filters the comment moderation email subject.
*
* @since 1.5.2
*
* @param string $subject Subject of the comment moderation email.
* @param int $comment_id Comment ID.
*/
$subject = apply_filters( 'comment_moderation_subject', $subject, $comment_id );
/**
* Filters the comment moderation email headers.
*
* @since 2.8.0
*
* @param string $message_headers Headers for the comment moderation email.
* @param int $comment_id Comment ID.
*/
$message_headers = apply_filters( 'comment_moderation_headers', $message_headers, $comment_id );
foreach ( $emails as $email ) {
wp_mail( $email, wp_specialchars_decode( $subject ), $notify_message, $message_headers );
}
if ( $switched_locale ) {
restore_previous_locale();
}
return true;
}
```
[apply\_filters( 'comment\_moderation\_headers', string $message\_headers, int $comment\_id )](../hooks/comment_moderation_headers)
Filters the comment moderation email headers.
[apply\_filters( 'comment\_moderation\_recipients', string[] $emails, int $comment\_id )](../hooks/comment_moderation_recipients)
Filters the list of recipients for comment moderation emails.
[apply\_filters( 'comment\_moderation\_subject', string $subject, int $comment\_id )](../hooks/comment_moderation_subject)
Filters the comment moderation email subject.
[apply\_filters( 'comment\_moderation\_text', string $notify\_message, int $comment\_id )](../hooks/comment_moderation_text)
Filters the comment moderation email text.
[apply\_filters( 'notify\_moderator', bool $maybe\_notify, int $comment\_ID )](../hooks/notify_moderator)
Filters whether to send the site moderator email notifications, overriding the site setting.
| Uses | Description |
| --- | --- |
| [restore\_previous\_locale()](restore_previous_locale) wp-includes/l10n.php | Restores the translations according to the previous locale. |
| [wp\_specialchars\_decode()](wp_specialchars_decode) wp-includes/formatting.php | Converts a number of HTML entities into their special characters. |
| [switch\_to\_locale()](switch_to_locale) wp-includes/l10n.php | Switches the translations according to the given locale. |
| [wp\_mail()](wp_mail) wp-includes/pluggable.php | Sends an email, similar to PHP’s mail function. |
| [WP\_Http::is\_ip\_address()](../classes/wp_http/is_ip_address) wp-includes/class-wp-http.php | Determines if a specified string represents an IP address or not. |
| [get\_locale()](get_locale) wp-includes/l10n.php | Retrieves the current locale. |
| [\_n()](_n) wp-includes/l10n.php | Translates and retrieves the singular or plural form based on the supplied number. |
| [user\_can()](user_can) wp-includes/capabilities.php | Returns whether a particular user has the specified capability. |
| [get\_userdata()](get_userdata) wp-includes/pluggable.php | Retrieves user info by user ID. |
| [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. |
| [number\_format\_i18n()](number_format_i18n) wp-includes/functions.php | Converts float number to format based on the locale. |
| [admin\_url()](admin_url) wp-includes/link-template.php | Retrieves the URL to the admin area for the current site. |
| [get\_permalink()](get_permalink) wp-includes/link-template.php | Retrieves the full permalink for the current post or post ID. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| [get\_option()](get_option) wp-includes/option.php | Retrieves an option value based on an option name. |
| [get\_post()](get_post) wp-includes/post.php | Retrieves post data given a post ID or post object. |
| [wpdb::get\_var()](../classes/wpdb/get_var) wp-includes/class-wpdb.php | Retrieves one variable from the database. |
| [get\_comment()](get_comment) wp-includes/comment.php | Retrieves comment data given a comment ID or comment object. |
| Used By | Description |
| --- | --- |
| [wp\_new\_comment\_notify\_moderator()](wp_new_comment_notify_moderator) wp-includes/comment.php | Sends a comment moderation notification to the comment moderator. |
| Version | Description |
| --- | --- |
| [1.0.0](https://developer.wordpress.org/reference/since/1.0.0/) | Introduced. |
wordpress wp_get_sites( array $args = array() ): array[] wp\_get\_sites( array $args = array() ): array[]
================================================
This function has been deprecated. Use [get\_sites()](get_sites) instead.
Return an array of sites for a network or networks.
* [get\_sites()](get_sites)
`$args` array Optional Array of default arguments. Optional.
* `network_id`int|int[]A network ID or array of network IDs. Set to null to retrieve sites from all networks. Defaults to current network ID.
* `public`intRetrieve public or non-public sites. Default null, for any.
* `archived`intRetrieve archived or non-archived sites. Default null, for any.
* `mature`intRetrieve mature or non-mature sites. Default null, for any.
* `spam`intRetrieve spam or non-spam sites. Default null, for any.
* `deleted`intRetrieve deleted or non-deleted sites. Default null, for any.
* `limit`intNumber of sites to limit the query to. Default 100.
* `offset`intExclude the first x sites. Used in combination with the $limit parameter. Default 0.
Default: `array()`
array[] An empty array if the installation is considered "large" via [wp\_is\_large\_network()](wp_is_large_network) . Otherwise, an associative array of [WP\_Site](../classes/wp_site) data as arrays.
If [wp\_is\_large\_network()](wp_is_large_network) returns TRUE, [wp\_get\_sites()](wp_get_sites) will return an empty array. By default [wp\_is\_large\_network()](wp_is_large_network) returns TRUE if there are 10,000 or more sites in your network. This can be filtered using the [wp\_is\_large\_network](../hooks/wp_is_large_network "Plugin API/Filter Reference/wp is large network (page does not exist)") filter.
Each site’s array is composed entirely of string values, even for numeric values. This means that == or !=, not === or !==, should be used to compare [blog\_id] to [get\_current\_blog\_id()](get_current_blog_id) , which returns an integer value.
File: `wp-includes/ms-deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/ms-deprecated.php/)
```
function wp_get_sites( $args = array() ) {
_deprecated_function( __FUNCTION__, '4.6.0', 'get_sites()' );
if ( wp_is_large_network() )
return array();
$defaults = array(
'network_id' => get_current_network_id(),
'public' => null,
'archived' => null,
'mature' => null,
'spam' => null,
'deleted' => null,
'limit' => 100,
'offset' => 0,
);
$args = wp_parse_args( $args, $defaults );
// Backward compatibility.
if( is_array( $args['network_id'] ) ){
$args['network__in'] = $args['network_id'];
$args['network_id'] = null;
}
if( is_numeric( $args['limit'] ) ){
$args['number'] = $args['limit'];
$args['limit'] = null;
} elseif ( ! $args['limit'] ) {
$args['number'] = 0;
$args['limit'] = null;
}
// Make sure count is disabled.
$args['count'] = false;
$_sites = get_sites( $args );
$results = array();
foreach ( $_sites as $_site ) {
$_site = get_site( $_site );
$results[] = $_site->to_array();
}
return $results;
}
```
| Uses | Description |
| --- | --- |
| [get\_current\_network\_id()](get_current_network_id) wp-includes/load.php | Retrieves the current network ID. |
| [get\_sites()](get_sites) wp-includes/ms-site.php | Retrieves a list of sites matching requested arguments. |
| [get\_site()](get_site) wp-includes/ms-site.php | Retrieves site data given a site ID or site object. |
| [wp\_is\_large\_network()](wp_is_large_network) wp-includes/ms-functions.php | Determines whether or not we have a large network. |
| [\_deprecated\_function()](_deprecated_function) wp-includes/functions.php | Marks a function as deprecated and inform when it has been used. |
| [wp\_parse\_args()](wp_parse_args) wp-includes/functions.php | Merges user defined arguments into defaults array. |
| Version | Description |
| --- | --- |
| [4.6.0](https://developer.wordpress.org/reference/since/4.6.0/) | Use [get\_sites()](get_sites) |
| [3.7.0](https://developer.wordpress.org/reference/since/3.7.0/) | Introduced. |
wordpress wp_enqueue_global_styles_css_custom_properties() wp\_enqueue\_global\_styles\_css\_custom\_properties()
======================================================
Function that enqueues the CSS Custom Properties coming from theme.json.
File: `wp-includes/script-loader.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/script-loader.php/)
```
function wp_enqueue_global_styles_css_custom_properties() {
wp_register_style( 'global-styles-css-custom-properties', false, array(), true, true );
wp_add_inline_style( 'global-styles-css-custom-properties', wp_get_global_stylesheet( array( 'variables' ) ) );
wp_enqueue_style( 'global-styles-css-custom-properties' );
}
```
| Uses | Description |
| --- | --- |
| [wp\_get\_global\_stylesheet()](wp_get_global_stylesheet) wp-includes/global-styles-and-settings.php | Returns the stylesheet resulting of merging core, theme, and user data. |
| [wp\_register\_style()](wp_register_style) wp-includes/functions.wp-styles.php | Register a CSS stylesheet. |
| [wp\_add\_inline\_style()](wp_add_inline_style) wp-includes/functions.wp-styles.php | Add extra CSS styles to a registered stylesheet. |
| [wp\_enqueue\_style()](wp_enqueue_style) wp-includes/functions.wp-styles.php | Enqueue a CSS stylesheet. |
| Version | Description |
| --- | --- |
| [5.9.0](https://developer.wordpress.org/reference/since/5.9.0/) | Introduced. |
wordpress get_the_category_list( string $separator = '', string $parents = '', int $post_id = false ): string get\_the\_category\_list( string $separator = '', string $parents = '', int $post\_id = false ): string
=======================================================================================================
Retrieves category list for a post in either HTML list or custom format.
Generally used for quick, delimited (e.g. comma-separated) lists of categories, as part of a post entry meta.
For a more powerful, list-based function, see [wp\_list\_categories()](wp_list_categories) .
* [wp\_list\_categories()](wp_list_categories)
`$separator` string Optional Separator between the categories. By default, the links are placed in an unordered list. An empty string will result in the default behavior. Default: `''`
`$parents` string Optional How to display the parents. Accepts `'multiple'`, `'single'`, or empty.
Default: `''`
`$post_id` int Optional ID of the post to retrieve categories for. Defaults to the current post. Default: `false`
string Category list for a post.
File: `wp-includes/category-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/category-template.php/)
```
function get_the_category_list( $separator = '', $parents = '', $post_id = false ) {
global $wp_rewrite;
if ( ! is_object_in_taxonomy( get_post_type( $post_id ), 'category' ) ) {
/** This filter is documented in wp-includes/category-template.php */
return apply_filters( 'the_category', '', $separator, $parents );
}
/**
* Filters the categories before building the category list.
*
* @since 4.4.0
*
* @param WP_Term[] $categories An array of the post's categories.
* @param int|false $post_id ID of the post to retrieve categories for.
* When `false`, defaults to the current post in the loop.
*/
$categories = apply_filters( 'the_category_list', get_the_category( $post_id ), $post_id );
if ( empty( $categories ) ) {
/** This filter is documented in wp-includes/category-template.php */
return apply_filters( 'the_category', __( 'Uncategorized' ), $separator, $parents );
}
$rel = ( is_object( $wp_rewrite ) && $wp_rewrite->using_permalinks() ) ? 'rel="category tag"' : 'rel="category"';
$thelist = '';
if ( '' === $separator ) {
$thelist .= '<ul class="post-categories">';
foreach ( $categories as $category ) {
$thelist .= "\n\t<li>";
switch ( strtolower( $parents ) ) {
case 'multiple':
if ( $category->parent ) {
$thelist .= get_category_parents( $category->parent, true, $separator );
}
$thelist .= '<a href="' . esc_url( get_category_link( $category->term_id ) ) . '" ' . $rel . '>' . $category->name . '</a></li>';
break;
case 'single':
$thelist .= '<a href="' . esc_url( get_category_link( $category->term_id ) ) . '" ' . $rel . '>';
if ( $category->parent ) {
$thelist .= get_category_parents( $category->parent, false, $separator );
}
$thelist .= $category->name . '</a></li>';
break;
case '':
default:
$thelist .= '<a href="' . esc_url( get_category_link( $category->term_id ) ) . '" ' . $rel . '>' . $category->name . '</a></li>';
}
}
$thelist .= '</ul>';
} else {
$i = 0;
foreach ( $categories as $category ) {
if ( 0 < $i ) {
$thelist .= $separator;
}
switch ( strtolower( $parents ) ) {
case 'multiple':
if ( $category->parent ) {
$thelist .= get_category_parents( $category->parent, true, $separator );
}
$thelist .= '<a href="' . esc_url( get_category_link( $category->term_id ) ) . '" ' . $rel . '>' . $category->name . '</a>';
break;
case 'single':
$thelist .= '<a href="' . esc_url( get_category_link( $category->term_id ) ) . '" ' . $rel . '>';
if ( $category->parent ) {
$thelist .= get_category_parents( $category->parent, false, $separator );
}
$thelist .= "$category->name</a>";
break;
case '':
default:
$thelist .= '<a href="' . esc_url( get_category_link( $category->term_id ) ) . '" ' . $rel . '>' . $category->name . '</a>';
}
++$i;
}
}
/**
* Filters the category or list of categories.
*
* @since 1.2.0
*
* @param string $thelist List of categories for the current post.
* @param string $separator Separator used between the categories.
* @param string $parents How to display the category parents. Accepts 'multiple',
* 'single', or empty.
*/
return apply_filters( 'the_category', $thelist, $separator, $parents );
}
```
[apply\_filters( 'the\_category', string $thelist, string $separator, string $parents )](../hooks/the_category)
Filters the category or list of categories.
[apply\_filters( 'the\_category\_list', WP\_Term[] $categories, int|false $post\_id )](../hooks/the_category_list)
Filters the categories before building the category list.
| Uses | Description |
| --- | --- |
| [get\_the\_category()](get_the_category) wp-includes/category-template.php | Retrieves post categories. |
| [get\_category\_parents()](get_category_parents) wp-includes/category-template.php | Retrieves category parents with separator. |
| [get\_category\_link()](get_category_link) wp-includes/category-template.php | Retrieves category link URL. |
| [is\_object\_in\_taxonomy()](is_object_in_taxonomy) wp-includes/taxonomy.php | Determines if the given object type is associated with the given taxonomy. |
| [get\_post\_type()](get_post_type) wp-includes/post.php | Retrieves the post type of the current post or of a given post. |
| [WP\_Rewrite::using\_permalinks()](../classes/wp_rewrite/using_permalinks) wp-includes/class-wp-rewrite.php | Determines whether permalinks are being used. |
| [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. |
| [esc\_url()](esc_url) wp-includes/formatting.php | Checks and cleans a URL. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| Used By | Description |
| --- | --- |
| [the\_category()](the_category) wp-includes/category-template.php | Displays category list for a post in either HTML list or custom format. |
| Version | Description |
| --- | --- |
| [1.5.1](https://developer.wordpress.org/reference/since/1.5.1/) | Introduced. |
| programming_docs |
wordpress is_plugin_paused( string $plugin ): bool is\_plugin\_paused( string $plugin ): bool
==========================================
Determines whether a plugin is technically active but was paused while loading.
For more information on this and similar theme functions, check out the [Conditional Tags](https://developer.wordpress.org/themes/basics/conditional-tags/) article in the Theme Developer Handbook.
`$plugin` string Required Path to the plugin file relative to the plugins directory. bool True, if in the list of paused plugins. False, if not in the list.
File: `wp-admin/includes/plugin.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/plugin.php/)
```
function is_plugin_paused( $plugin ) {
if ( ! isset( $GLOBALS['_paused_plugins'] ) ) {
return false;
}
if ( ! is_plugin_active( $plugin ) ) {
return false;
}
list( $plugin ) = explode( '/', $plugin );
return array_key_exists( $plugin, $GLOBALS['_paused_plugins'] );
}
```
| Uses | Description |
| --- | --- |
| [is\_plugin\_active()](is_plugin_active) wp-admin/includes/plugin.php | Determines whether a plugin is active. |
| Used By | Description |
| --- | --- |
| [WP\_Plugins\_List\_Table::single\_row()](../classes/wp_plugins_list_table/single_row) wp-admin/includes/class-wp-plugins-list-table.php | |
| [WP\_Plugins\_List\_Table::prepare\_items()](../classes/wp_plugins_list_table/prepare_items) wp-admin/includes/class-wp-plugins-list-table.php | |
| Version | Description |
| --- | --- |
| [5.2.0](https://developer.wordpress.org/reference/since/5.2.0/) | Introduced. |
wordpress get_archives( string $type = '', string $limit = '', string $format = 'html', string $before = '', string $after = '', bool $show_post_count = false ): string|null get\_archives( string $type = '', string $limit = '', string $format = 'html', string $before = '', string $after = '', bool $show\_post\_count = false ): string|null
======================================================================================================================================================================
This function has been deprecated. Use [wp\_get\_archives()](wp_get_archives) instead.
Retrieves a list of archives.
* [wp\_get\_archives()](wp_get_archives)
`$type` string Optional Default: `''`
`$limit` string Optional Default: `''`
`$format` string Optional Default: `'html'`
`$before` string Optional Default: `''`
`$after` string Optional Default: `''`
`$show_post_count` bool Optional Default: `false`
string|null
File: `wp-includes/deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/deprecated.php/)
```
function get_archives($type='', $limit='', $format='html', $before = '', $after = '', $show_post_count = false) {
_deprecated_function( __FUNCTION__, '2.1.0', 'wp_get_archives()' );
$args = compact('type', 'limit', 'format', 'before', 'after', 'show_post_count');
return wp_get_archives($args);
}
```
| Uses | Description |
| --- | --- |
| [wp\_get\_archives()](wp_get_archives) wp-includes/general-template.php | Displays archive links based on type and format. |
| [\_deprecated\_function()](_deprecated_function) wp-includes/functions.php | Marks a function as deprecated and inform when it has been used. |
| Version | Description |
| --- | --- |
| [2.1.0](https://developer.wordpress.org/reference/since/2.1.0/) | Use [wp\_get\_archives()](wp_get_archives) |
| [0.71](https://developer.wordpress.org/reference/since/0.71/) | Introduced. |
wordpress wp_no_robots() wp\_no\_robots()
================
This function has been deprecated. Use [wp\_robots\_no\_robots()](wp_robots_no_robots) instead on ‘wp\_robots’ filter.
Display a `noindex` meta tag.
Outputs a `noindex` meta tag that tells web robots not to index the page content.
Typical usage is as a [‘wp\_head’](../hooks/wp_head) callback:
```
add_action( 'wp_head', 'wp_no_robots' );
```
File: `wp-includes/deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/deprecated.php/)
```
function wp_no_robots() {
_deprecated_function( __FUNCTION__, '5.7.0', 'wp_robots_no_robots()' );
if ( get_option( 'blog_public' ) ) {
echo "<meta name='robots' content='noindex,follow' />\n";
return;
}
echo "<meta name='robots' content='noindex,nofollow' />\n";
}
```
| Uses | Description |
| --- | --- |
| [\_deprecated\_function()](_deprecated_function) wp-includes/functions.php | Marks a function as deprecated and inform when it has been used. |
| [get\_option()](get_option) wp-includes/option.php | Retrieves an option value based on an option name. |
| Used By | Description |
| --- | --- |
| [noindex()](noindex) wp-includes/deprecated.php | Displays a `noindex` meta tag if required by the blog configuration. |
| Version | Description |
| --- | --- |
| [5.7.0](https://developer.wordpress.org/reference/since/5.7.0/) | Use [wp\_robots\_no\_robots()](wp_robots_no_robots) instead on `'wp_robots'` filter. |
| [5.3.0](https://developer.wordpress.org/reference/since/5.3.0/) | Echo `noindex,nofollow` if search engine visibility is discouraged. |
| [3.3.0](https://developer.wordpress.org/reference/since/3.3.0/) | Introduced. |
wordpress xmlrpc_getposttitle( string $content ): string xmlrpc\_getposttitle( string $content ): string
===============================================
Retrieves 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.
`$content` string Required XMLRPC XML Request content string Post title
File: `wp-includes/functions.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/functions.php/)
```
function xmlrpc_getposttitle( $content ) {
global $post_default_title;
if ( preg_match( '/<title>(.+?)<\/title>/is', $content, $matchtitle ) ) {
$post_title = $matchtitle[1];
} else {
$post_title = $post_default_title;
}
return $post_title;
}
```
| Used By | Description |
| --- | --- |
| [wp\_xmlrpc\_server::blogger\_newPost()](../classes/wp_xmlrpc_server/blogger_newpost) wp-includes/class-wp-xmlrpc-server.php | Creates new post. |
| [wp\_xmlrpc\_server::blogger\_editPost()](../classes/wp_xmlrpc_server/blogger_editpost) wp-includes/class-wp-xmlrpc-server.php | Edit a post. |
| Version | Description |
| --- | --- |
| [0.71](https://developer.wordpress.org/reference/since/0.71/) | Introduced. |
wordpress add_screen_option( string $option, mixed $args = array() ) add\_screen\_option( string $option, mixed $args = array() )
============================================================
Register and configure an admin screen option
`$option` string Required An option name. `$args` mixed Optional Option-dependent arguments. Default: `array()`
File: `wp-admin/includes/screen.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/screen.php/)
```
function add_screen_option( $option, $args = array() ) {
$current_screen = get_current_screen();
if ( ! $current_screen ) {
return;
}
$current_screen->add_option( $option, $args );
}
```
| Uses | Description |
| --- | --- |
| [get\_current\_screen()](get_current_screen) wp-admin/includes/screen.php | Get the current screen object |
| Version | Description |
| --- | --- |
| [3.1.0](https://developer.wordpress.org/reference/since/3.1.0/) | Introduced. |
wordpress require_if_theme_supports( string $feature, string $include ): bool require\_if\_theme\_supports( string $feature, string $include ): bool
======================================================================
Checks a theme’s support for a given feature before loading the functions which implement it.
`$feature` string Required The feature being checked. See [add\_theme\_support()](add_theme_support) for the list of possible values. More Arguments from add\_theme\_support( ... $feature ) The feature being added. Likely core values include:
* `'admin-bar'`
* `'align-wide'`
* `'automatic-feed-links'`
* `'core-block-patterns'`
* `'custom-background'`
* `'custom-header'`
* `'custom-line-height'`
* `'custom-logo'`
* `'customize-selective-refresh-widgets'`
* `'custom-spacing'`
* `'custom-units'`
* `'dark-editor-style'`
* `'disable-custom-colors'`
* `'disable-custom-font-sizes'`
* `'editor-color-palette'`
* `'editor-gradient-presets'`
* `'editor-font-sizes'`
* `'editor-styles'`
* `'featured-content'`
* `'html5'`
* `'menus'`
* `'post-formats'`
* `'post-thumbnails'`
* `'responsive-embeds'`
* `'starter-content'`
* `'title-tag'`
* `'wp-block-styles'`
* `'widgets'`
* `'widgets-block-editor'`
`$include` string Required Path to the file. bool True if the active theme supports the supplied feature, false otherwise.
File: `wp-includes/theme.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/theme.php/)
```
function require_if_theme_supports( $feature, $include ) {
if ( current_theme_supports( $feature ) ) {
require $include;
return true;
}
return false;
}
```
| Uses | Description |
| --- | --- |
| [current\_theme\_supports()](current_theme_supports) wp-includes/theme.php | Checks a theme’s support for a given feature. |
| Version | Description |
| --- | --- |
| [2.9.0](https://developer.wordpress.org/reference/since/2.9.0/) | Introduced. |
wordpress wp_get_object_terms( int|int[] $object_ids, string|string[] $taxonomies, array|string $args = array() ): WP_Term[]|int[]|string[]|string|WP_Error wp\_get\_object\_terms( int|int[] $object\_ids, string|string[] $taxonomies, array|string $args = array() ): WP\_Term[]|int[]|string[]|string|WP\_Error
=======================================================================================================================================================
Retrieves the terms associated with the given object(s), in the supplied taxonomies.
`$object_ids` int|int[] Required The ID(s) of the object(s) to retrieve. `$taxonomies` string|string[] Required The taxonomy names to retrieve terms from. `$args` array|string Optional See [WP\_Term\_Query::\_\_construct()](../classes/wp_term_query/__construct) for supported arguments. More Arguments from WP\_Term\_Query::\_\_construct( ... $query ) Array or query string of term query parameters.
* `taxonomy`string|string[]Taxonomy name, or array of taxonomy names, to which results should be limited.
* `object_ids`int|int[]Object ID, or array of object IDs. Results will be limited to terms associated with these objects.
* `orderby`stringField(s) to order terms by. Accepts:
+ Term fields (`'name'`, `'slug'`, `'term_group'`, `'term_id'`, `'id'`, `'description'`, `'parent'`, `'term_order'`). Unless `$object_ids` is not empty, `'term_order'` is treated the same as `'term_id'`.
+ `'count'` to use the number of objects associated with the term.
+ `'include'` to match the `'order'` of the `$include` param.
+ `'slug__in'` to match the `'order'` of the `$slug` param.
+ `'meta_value'`
+ `'meta_value_num'`.
+ The value of `$meta_key`.
+ The array keys of `$meta_query`.
+ `'none'` to omit the ORDER BY clause. Default `'name'`.
* `order`stringWhether to order terms in ascending or descending order.
Accepts `'ASC'` (ascending) or `'DESC'` (descending).
Default `'ASC'`.
* `hide_empty`bool|intWhether to hide terms not assigned to any posts. Accepts `1|true` or `0|false`. Default `1|true`.
* `include`int[]|stringArray or comma/space-separated string of term IDs to include.
Default empty array.
* `exclude`int[]|stringArray or comma/space-separated string of term IDs to exclude.
If `$include` is non-empty, `$exclude` is ignored.
Default empty array.
* `exclude_tree`int[]|stringArray or comma/space-separated string of term IDs to exclude along with all of their descendant terms. If `$include` is non-empty, `$exclude_tree` is ignored. Default empty array.
* `number`int|stringMaximum number of terms to return. Accepts ``''`|0` (all) or any positive number. Default ``''`|0` (all). Note that `$number` may not return accurate results when coupled with `$object_ids`.
See #41796 for details.
* `offset`intThe number by which to offset the terms query.
* `fields`stringTerm fields to query for. Accepts:
+ `'all'` Returns an array of complete term objects (`WP_Term[]`).
+ `'all_with_object_id'` Returns an array of term objects with the `'object_id'` param (`WP_Term[]`). Works only when the `$object_ids` parameter is populated.
+ `'ids'` Returns an array of term IDs (`int[]`).
+ `'tt_ids'` Returns an array of term taxonomy IDs (`int[]`).
+ `'names'` Returns an array of term names (`string[]`).
+ `'slugs'` Returns an array of term slugs (`string[]`).
+ `'count'` Returns the number of matching terms (`int`).
+ `'id=>parent'` Returns an associative array of parent term IDs, keyed by term ID (`int[]`).
+ `'id=>name'` Returns an associative array of term names, keyed by term ID (`string[]`).
+ `'id=>slug'` Returns an associative array of term slugs, keyed by term ID (`string[]`). Default `'all'`.
* `count`boolWhether to return a term count. If true, will take precedence over `$fields`. Default false.
* `name`string|string[]Name or array of names to return term(s) for.
* `slug`string|string[]Slug or array of slugs to return term(s) for.
* `term_taxonomy_id`int|int[]Term taxonomy ID, or array of term taxonomy IDs, to match when querying terms.
* `hierarchical`boolWhether to include terms that have non-empty descendants (even if `$hide_empty` is set to true). Default true.
* `search`stringSearch criteria to match terms. Will be SQL-formatted with wildcards before and after.
* `name__like`stringRetrieve terms with criteria by which a term is LIKE `$name__like`.
* `description__like`stringRetrieve terms where the description is LIKE `$description__like`.
* `pad_counts`boolWhether to pad the quantity of a term's children in the quantity of each term's "count" object variable. Default false.
* `get`stringWhether to return terms regardless of ancestry or whether the terms are empty. Accepts `'all'` or `''` (disabled). Default `''`.
* `child_of`intTerm ID to retrieve child terms of. If multiple taxonomies are passed, `$child_of` is ignored. Default 0.
* `parent`intParent term ID to retrieve direct-child terms of.
* `childless`boolTrue to limit results to terms that have no children.
This parameter has no effect on non-hierarchical taxonomies.
Default false.
* `cache_domain`stringUnique cache key to be produced when this query is stored in an object cache. Default `'core'`.
* `update_term_meta_cache`boolWhether to prime meta caches for matched terms. Default true.
* `meta_key`string|string[]Meta key or keys to filter by.
* `meta_value`string|string[]Meta value or values to filter by.
* `meta_compare`stringMySQL operator used for comparing the meta value.
See [WP\_Meta\_Query::\_\_construct()](../classes/wp_meta_query/__construct) for accepted values and default value.
* `meta_compare_key`stringMySQL operator used for comparing the meta key.
See [WP\_Meta\_Query::\_\_construct()](../classes/wp_meta_query/__construct) for accepted values and default value.
* `meta_type`stringMySQL data type that the meta\_value column will be CAST to for comparisons.
See [WP\_Meta\_Query::\_\_construct()](../classes/wp_meta_query/__construct) for accepted values and default value.
* `meta_type_key`stringMySQL data type that the meta\_key column will be CAST to for comparisons.
See [WP\_Meta\_Query::\_\_construct()](../classes/wp_meta_query/__construct) for accepted values and default value.
* `meta_query`arrayAn associative array of [WP\_Meta\_Query](../classes/wp_meta_query) arguments.
See [WP\_Meta\_Query::\_\_construct()](../classes/wp_meta_query/__construct) for accepted values.
Default: `array()`
[WP\_Term](../classes/wp_term)[]|int[]|string[]|string|[WP\_Error](../classes/wp_error) Array of terms, a count thereof as a numeric string, or [WP\_Error](../classes/wp_error) if any of the taxonomies do not exist.
See [WP\_Term\_Query::get\_terms()](../classes/wp_term_query/get_terms) for more information.
It should be noted that the results from wp\_get\_object\_terms are not cached which will result in a db call everytime this function is called. For performance, functions like [get\_the\_terms()](get_the_terms) (which the results of has been cached), should be used.
File: `wp-includes/taxonomy.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/taxonomy.php/)
```
function wp_get_object_terms( $object_ids, $taxonomies, $args = array() ) {
if ( empty( $object_ids ) || empty( $taxonomies ) ) {
return array();
}
if ( ! is_array( $taxonomies ) ) {
$taxonomies = array( $taxonomies );
}
foreach ( $taxonomies as $taxonomy ) {
if ( ! taxonomy_exists( $taxonomy ) ) {
return new WP_Error( 'invalid_taxonomy', __( 'Invalid taxonomy.' ) );
}
}
if ( ! is_array( $object_ids ) ) {
$object_ids = array( $object_ids );
}
$object_ids = array_map( 'intval', $object_ids );
$args = wp_parse_args( $args );
/**
* Filters arguments for retrieving object terms.
*
* @since 4.9.0
*
* @param array $args An array of arguments for retrieving terms for the given object(s).
* See {@see wp_get_object_terms()} for details.
* @param int[] $object_ids Array of object IDs.
* @param string[] $taxonomies Array of taxonomy names to retrieve terms from.
*/
$args = apply_filters( 'wp_get_object_terms_args', $args, $object_ids, $taxonomies );
/*
* When one or more queried taxonomies is registered with an 'args' array,
* those params override the `$args` passed to this function.
*/
$terms = array();
if ( count( $taxonomies ) > 1 ) {
foreach ( $taxonomies as $index => $taxonomy ) {
$t = get_taxonomy( $taxonomy );
if ( isset( $t->args ) && is_array( $t->args ) && array_merge( $args, $t->args ) != $args ) {
unset( $taxonomies[ $index ] );
$terms = array_merge( $terms, wp_get_object_terms( $object_ids, $taxonomy, array_merge( $args, $t->args ) ) );
}
}
} else {
$t = get_taxonomy( $taxonomies[0] );
if ( isset( $t->args ) && is_array( $t->args ) ) {
$args = array_merge( $args, $t->args );
}
}
$args['taxonomy'] = $taxonomies;
$args['object_ids'] = $object_ids;
// Taxonomies registered without an 'args' param are handled here.
if ( ! empty( $taxonomies ) ) {
$terms_from_remaining_taxonomies = get_terms( $args );
// Array keys should be preserved for values of $fields that use term_id for keys.
if ( ! empty( $args['fields'] ) && 0 === strpos( $args['fields'], 'id=>' ) ) {
$terms = $terms + $terms_from_remaining_taxonomies;
} else {
$terms = array_merge( $terms, $terms_from_remaining_taxonomies );
}
}
/**
* Filters the terms for a given object or objects.
*
* @since 4.2.0
*
* @param WP_Term[]|int[]|string[]|string $terms Array of terms or a count thereof as a numeric string.
* @param int[] $object_ids Array of object IDs for which terms were retrieved.
* @param string[] $taxonomies Array of taxonomy names from which terms were retrieved.
* @param array $args Array of arguments for retrieving terms for the given
* object(s). See wp_get_object_terms() for details.
*/
$terms = apply_filters( 'get_object_terms', $terms, $object_ids, $taxonomies, $args );
$object_ids = implode( ',', $object_ids );
$taxonomies = "'" . implode( "', '", array_map( 'esc_sql', $taxonomies ) ) . "'";
/**
* Filters the terms for a given object or objects.
*
* The `$taxonomies` parameter passed to this filter is formatted as a SQL fragment. The
* {@see 'get_object_terms'} filter is recommended as an alternative.
*
* @since 2.8.0
*
* @param WP_Term[]|int[]|string[]|string $terms Array of terms or a count thereof as a numeric string.
* @param string $object_ids Comma separated list of object IDs for which terms were retrieved.
* @param string $taxonomies SQL fragment of taxonomy names from which terms were retrieved.
* @param array $args Array of arguments for retrieving terms for the given
* object(s). See wp_get_object_terms() for details.
*/
return apply_filters( 'wp_get_object_terms', $terms, $object_ids, $taxonomies, $args );
}
```
[apply\_filters( 'get\_object\_terms', WP\_Term[]|int[]|string[]|string $terms, int[] $object\_ids, string[] $taxonomies, array $args )](../hooks/get_object_terms)
Filters the terms for a given object or objects.
[apply\_filters( 'wp\_get\_object\_terms', WP\_Term[]|int[]|string[]|string $terms, string $object\_ids, string $taxonomies, array $args )](../hooks/wp_get_object_terms)
Filters the terms for a given object or objects.
[apply\_filters( 'wp\_get\_object\_terms\_args', array $args, int[] $object\_ids, string[] $taxonomies )](../hooks/wp_get_object_terms_args)
Filters arguments for retrieving object terms.
| Uses | Description |
| --- | --- |
| [wp\_get\_object\_terms()](wp_get_object_terms) wp-includes/taxonomy.php | Retrieves the terms associated with the given object(s), in the supplied taxonomies. |
| [get\_terms()](get_terms) wp-includes/taxonomy.php | Retrieves the terms in a given taxonomy or list of taxonomies. |
| [taxonomy\_exists()](taxonomy_exists) wp-includes/taxonomy.php | Determines whether the taxonomy name exists. |
| [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. |
| [wp\_parse\_args()](wp_parse_args) wp-includes/functions.php | Merges user defined arguments into defaults array. |
| [get\_taxonomy()](get_taxonomy) wp-includes/taxonomy.php | Retrieves the taxonomy object of $taxonomy. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| [WP\_Error::\_\_construct()](../classes/wp_error/__construct) wp-includes/class-wp-error.php | Initializes the error. |
| Used By | Description |
| --- | --- |
| [WP\_REST\_Terms\_Controller::get\_items()](../classes/wp_rest_terms_controller/get_items) wp-includes/rest-api/endpoints/class-wp-rest-terms-controller.php | Retrieves terms associated with a taxonomy. |
| [wxr\_post\_taxonomy()](wxr_post_taxonomy) wp-admin/includes/export.php | Outputs list of taxonomy terms, in XML tag format, associated with a post. |
| [get\_terms\_to\_edit()](get_terms_to_edit) wp-admin/includes/taxonomy.php | Gets comma-separated list of terms available to edit for the given post ID. |
| [get\_inline\_data()](get_inline_data) wp-admin/includes/template.php | Adds hidden fields with the data for use in the inline editor for posts and pages. |
| [wp\_terms\_checklist()](wp_terms_checklist) wp-admin/includes/template.php | Outputs an unordered list of checkbox input elements labelled with term names. |
| [wp\_popular\_terms\_checklist()](wp_popular_terms_checklist) wp-admin/includes/template.php | Retrieves a list of the most popular terms from the specified taxonomy. |
| [get\_attachment\_fields\_to\_edit()](get_attachment_fields_to_edit) wp-admin/includes/media.php | Retrieves the attachment fields to edit form fields. |
| [get\_compat\_media\_markup()](get_compat_media_markup) wp-admin/includes/media.php | |
| [bulk\_edit\_posts()](bulk_edit_posts) wp-admin/includes/post.php | Processes the post data for the bulk editing of posts. |
| [wp\_get\_link\_cats()](wp_get_link_cats) wp-admin/includes/bookmark.php | Retrieves the link category IDs associated with the link specified. |
| [get\_the\_terms()](get_the_terms) wp-includes/category-template.php | Retrieves the terms of the taxonomy that are attached to the post. |
| [update\_object\_term\_cache()](update_object_term_cache) wp-includes/taxonomy.php | Updates the cache for the given term object ID(s). |
| [get\_the\_taxonomies()](get_the_taxonomies) wp-includes/taxonomy.php | Retrieves all taxonomies associated with a post. |
| [is\_object\_in\_term()](is_object_in_term) wp-includes/taxonomy.php | Determines if the given object is associated with any of the given terms. |
| [wp\_get\_object\_terms()](wp_get_object_terms) wp-includes/taxonomy.php | Retrieves the terms associated with the given object(s), in the supplied taxonomies. |
| [wp\_set\_object\_terms()](wp_set_object_terms) wp-includes/taxonomy.php | Creates term and taxonomy relationships. |
| [wp\_delete\_object\_term\_relationships()](wp_delete_object_term_relationships) wp-includes/taxonomy.php | Unlinks the object from the taxonomy or taxonomies. |
| [wp\_delete\_term()](wp_delete_term) wp-includes/taxonomy.php | Removes a term from the database. |
| [get\_adjacent\_post()](get_adjacent_post) wp-includes/link-template.php | Retrieves the adjacent post. |
| [get\_boundary\_post()](get_boundary_post) wp-includes/link-template.php | Retrieves the boundary post. |
| [\_wp\_menu\_item\_classes\_by\_context()](_wp_menu_item_classes_by_context) wp-includes/nav-menu-template.php | Adds the class property classes for the current context, if applicable. |
| [\_update\_term\_count\_on\_transition\_post\_status()](_update_term_count_on_transition_post_status) wp-includes/post.php | Updates the custom taxonomies’ term counts when a post’s status is changed. |
| [wp\_get\_post\_categories()](wp_get_post_categories) wp-includes/post.php | Retrieves the list of categories for a post. |
| [wp\_get\_post\_terms()](wp_get_post_terms) wp-includes/post.php | Retrieves the terms for a post. |
| [wp\_insert\_post()](wp_insert_post) wp-includes/post.php | Inserts or update a post. |
| [get\_bookmark()](get_bookmark) wp-includes/bookmark.php | Retrieves bookmark data. |
| [wp\_xmlrpc\_server::\_prepare\_post()](../classes/wp_xmlrpc_server/_prepare_post) wp-includes/class-wp-xmlrpc-server.php | Prepares post data for return in an XML-RPC object. |
| Version | Description |
| --- | --- |
| [4.7.0](https://developer.wordpress.org/reference/since/4.7.0/) | Refactored to use [WP\_Term\_Query](../classes/wp_term_query), and to support any [WP\_Term\_Query](../classes/wp_term_query) arguments. |
| [4.4.0](https://developer.wordpress.org/reference/since/4.4.0/) | Introduced `$meta_query` and `$update_term_meta_cache` arguments. When `$fields` is `'all'` or `'all_with_object_id'`, an array of `WP_Term` objects will be returned. |
| [4.2.0](https://developer.wordpress.org/reference/since/4.2.0/) | Added support for `'taxonomy'`, `'parent'`, and `'term_taxonomy_id'` values of `$orderby`. Introduced `$parent` argument. |
| [2.3.0](https://developer.wordpress.org/reference/since/2.3.0/) | Introduced. |
| programming_docs |
wordpress wp_ajax_delete_plugin() wp\_ajax\_delete\_plugin()
==========================
Ajax handler for deleting a plugin.
* [delete\_plugins()](delete_plugins)
File: `wp-admin/includes/ajax-actions.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/ajax-actions.php/)
```
function wp_ajax_delete_plugin() {
check_ajax_referer( 'updates' );
if ( empty( $_POST['slug'] ) || empty( $_POST['plugin'] ) ) {
wp_send_json_error(
array(
'slug' => '',
'errorCode' => 'no_plugin_specified',
'errorMessage' => __( 'No plugin specified.' ),
)
);
}
$plugin = plugin_basename( sanitize_text_field( wp_unslash( $_POST['plugin'] ) ) );
$status = array(
'delete' => 'plugin',
'slug' => sanitize_key( wp_unslash( $_POST['slug'] ) ),
);
if ( ! current_user_can( 'delete_plugins' ) || 0 !== validate_file( $plugin ) ) {
$status['errorMessage'] = __( 'Sorry, you are not allowed to delete plugins for this site.' );
wp_send_json_error( $status );
}
$plugin_data = get_plugin_data( WP_PLUGIN_DIR . '/' . $plugin );
$status['plugin'] = $plugin;
$status['pluginName'] = $plugin_data['Name'];
if ( is_plugin_active( $plugin ) ) {
$status['errorMessage'] = __( 'You cannot delete a plugin while it is active on the main site.' );
wp_send_json_error( $status );
}
// Check filesystem credentials. `delete_plugins()` will bail otherwise.
$url = wp_nonce_url( 'plugins.php?action=delete-selected&verify-delete=1&checked[]=' . $plugin, 'bulk-plugins' );
ob_start();
$credentials = request_filesystem_credentials( $url );
ob_end_clean();
if ( false === $credentials || ! WP_Filesystem( $credentials ) ) {
global $wp_filesystem;
$status['errorCode'] = 'unable_to_connect_to_filesystem';
$status['errorMessage'] = __( 'Unable to connect to the filesystem. Please confirm your credentials.' );
// Pass through the error from WP_Filesystem if one was raised.
if ( $wp_filesystem instanceof WP_Filesystem_Base && is_wp_error( $wp_filesystem->errors ) && $wp_filesystem->errors->has_errors() ) {
$status['errorMessage'] = esc_html( $wp_filesystem->errors->get_error_message() );
}
wp_send_json_error( $status );
}
$result = delete_plugins( array( $plugin ) );
if ( is_wp_error( $result ) ) {
$status['errorMessage'] = $result->get_error_message();
wp_send_json_error( $status );
} elseif ( false === $result ) {
$status['errorMessage'] = __( 'Plugin could not be deleted.' );
wp_send_json_error( $status );
}
wp_send_json_success( $status );
}
```
| Uses | Description |
| --- | --- |
| [is\_plugin\_active()](is_plugin_active) wp-admin/includes/plugin.php | Determines whether a plugin is active. |
| [validate\_file()](validate_file) wp-includes/functions.php | Validates a file name and path against an allowed set of rules. |
| [get\_plugin\_data()](get_plugin_data) wp-admin/includes/plugin.php | Parses the plugin contents to retrieve plugin’s metadata. |
| [request\_filesystem\_credentials()](request_filesystem_credentials) wp-admin/includes/file.php | Displays a form to the user to request for their FTP/SSH details in order to connect to the filesystem. |
| [WP\_Filesystem()](wp_filesystem) wp-admin/includes/file.php | Initializes and connects the WordPress Filesystem Abstraction classes. |
| [plugin\_basename()](plugin_basename) wp-includes/plugin.php | Gets the basename of a plugin. |
| [sanitize\_text\_field()](sanitize_text_field) wp-includes/formatting.php | Sanitizes a string from user input or from the database. |
| [delete\_plugins()](delete_plugins) wp-admin/includes/plugin.php | Removes directory and files of a plugin for a list of plugins. |
| [wp\_nonce\_url()](wp_nonce_url) wp-includes/functions.php | Retrieves URL with nonce added to URL query. |
| [wp\_send\_json\_success()](wp_send_json_success) wp-includes/functions.php | Sends a JSON response back to an Ajax request, indicating success. |
| [wp\_send\_json\_error()](wp_send_json_error) wp-includes/functions.php | Sends a JSON response back to an Ajax request, indicating failure. |
| [esc\_html()](esc_html) wp-includes/formatting.php | Escaping for HTML blocks. |
| [check\_ajax\_referer()](check_ajax_referer) wp-includes/pluggable.php | Verifies the Ajax request to prevent processing requests external of the blog. |
| [sanitize\_key()](sanitize_key) wp-includes/formatting.php | Sanitizes a string key. |
| [wp\_unslash()](wp_unslash) wp-includes/formatting.php | Removes slashes from a string or recursively removes slashes from strings within an array. |
| [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. |
| [current\_user\_can()](current_user_can) wp-includes/capabilities.php | Returns whether the current user has the specified capability. |
| [is\_wp\_error()](is_wp_error) wp-includes/load.php | Checks whether the given variable is a WordPress Error. |
| Version | Description |
| --- | --- |
| [4.6.0](https://developer.wordpress.org/reference/since/4.6.0/) | Introduced. |
wordpress add_blog_option( int $id, string $option, mixed $value ): bool add\_blog\_option( int $id, string $option, mixed $value ): bool
================================================================
Add a new option for a given blog ID.
You do not need to serialize values. If the value needs to be serialized, then it will be serialized before it is inserted into the database. Remember, resources can not be serialized or added as an option.
You can create options without values and then update the values later.
Existing options will not be updated and checks are performed to ensure that you aren’t adding a protected WordPress option. Care should be taken to not name options the same as the ones which are protected.
`$id` int Required A blog ID. Can be null to refer to the current blog. `$option` string Required Name of option to add. Expected to not be SQL-escaped. `$value` mixed Optional Option value, can be anything. Expected to not be SQL-escaped. bool True if the option was added, false otherwise.
File: `wp-includes/ms-blogs.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/ms-blogs.php/)
```
function add_blog_option( $id, $option, $value ) {
$id = (int) $id;
if ( empty( $id ) ) {
$id = get_current_blog_id();
}
if ( get_current_blog_id() == $id ) {
return add_option( $option, $value );
}
switch_to_blog( $id );
$return = add_option( $option, $value );
restore_current_blog();
return $return;
}
```
| Uses | Description |
| --- | --- |
| [switch\_to\_blog()](switch_to_blog) wp-includes/ms-blogs.php | Switch the current blog. |
| [add\_option()](add_option) wp-includes/option.php | Adds a new option. |
| [restore\_current\_blog()](restore_current_blog) wp-includes/ms-blogs.php | Restore the current blog, after calling [switch\_to\_blog()](switch_to_blog) . |
| [get\_current\_blog\_id()](get_current_blog_id) wp-includes/load.php | Retrieve the current site ID. |
| Version | Description |
| --- | --- |
| [MU (3.0.0)](https://developer.wordpress.org/reference/since/mu.3.0.0/) | Introduced. |
wordpress rest_get_allowed_schema_keywords(): string[] rest\_get\_allowed\_schema\_keywords(): string[]
================================================
Get all valid JSON schema properties.
string[] All valid JSON schema properties.
File: `wp-includes/rest-api.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/rest-api.php/)
```
function rest_get_allowed_schema_keywords() {
return array(
'title',
'description',
'default',
'type',
'format',
'enum',
'items',
'properties',
'additionalProperties',
'patternProperties',
'minProperties',
'maxProperties',
'minimum',
'maximum',
'exclusiveMinimum',
'exclusiveMaximum',
'multipleOf',
'minLength',
'maxLength',
'pattern',
'minItems',
'maxItems',
'uniqueItems',
'anyOf',
'oneOf',
);
}
```
| Used By | Description |
| --- | --- |
| [rest\_get\_endpoint\_args\_for\_schema()](rest_get_endpoint_args_for_schema) wp-includes/rest-api.php | Retrieves an array of endpoint arguments from the item schema and endpoint method. |
| [WP\_REST\_Server::get\_data\_for\_route()](../classes/wp_rest_server/get_data_for_route) wp-includes/rest-api/class-wp-rest-server.php | Retrieves publicly-visible data for the route. |
| Version | Description |
| --- | --- |
| [5.6.0](https://developer.wordpress.org/reference/since/5.6.0/) | Introduced. |
wordpress wp_print_update_row_templates() wp\_print\_update\_row\_templates()
===================================
Prints the JavaScript templates for update and deletion rows in list tables.
File: `wp-admin/includes/update.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/update.php/)
```
function wp_print_update_row_templates() {
?>
<script id="tmpl-item-update-row" type="text/template">
<tr class="plugin-update-tr update" id="{{ data.slug }}-update" data-slug="{{ data.slug }}" <# if ( data.plugin ) { #>data-plugin="{{ data.plugin }}"<# } #>>
<td colspan="{{ data.colspan }}" class="plugin-update colspanchange">
{{{ data.content }}}
</td>
</tr>
</script>
<script id="tmpl-item-deleted-row" type="text/template">
<tr class="plugin-deleted-tr inactive deleted" id="{{ data.slug }}-deleted" data-slug="{{ data.slug }}" <# if ( data.plugin ) { #>data-plugin="{{ data.plugin }}"<# } #>>
<td colspan="{{ data.colspan }}" class="plugin-update colspanchange">
<# if ( data.plugin ) { #>
<?php
printf(
/* translators: %s: Plugin name. */
_x( '%s was successfully deleted.', 'plugin' ),
'<strong>{{{ data.name }}}</strong>'
);
?>
<# } else { #>
<?php
printf(
/* translators: %s: Theme name. */
_x( '%s was successfully deleted.', 'theme' ),
'<strong>{{{ data.name }}}</strong>'
);
?>
<# } #>
</td>
</tr>
</script>
<?php
}
```
| Uses | Description |
| --- | --- |
| [\_x()](_x) wp-includes/l10n.php | Retrieves translated string with gettext context. |
| Version | Description |
| --- | --- |
| [4.6.0](https://developer.wordpress.org/reference/since/4.6.0/) | Introduced. |
wordpress remove_editor_styles(): bool remove\_editor\_styles(): bool
==============================
Removes all visual editor stylesheets.
bool True on success, false if there were no stylesheets to remove.
File: `wp-includes/theme.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/theme.php/)
```
function remove_editor_styles() {
if ( ! current_theme_supports( 'editor-style' ) ) {
return false;
}
_remove_theme_support( 'editor-style' );
if ( is_admin() ) {
$GLOBALS['editor_styles'] = array();
}
return true;
}
```
| Uses | Description |
| --- | --- |
| [\_remove\_theme\_support()](_remove_theme_support) wp-includes/theme.php | Do not use. Removes theme support internally without knowledge of those not used by themes directly. |
| [current\_theme\_supports()](current_theme_supports) wp-includes/theme.php | Checks a theme’s support for a given feature. |
| [is\_admin()](is_admin) wp-includes/load.php | Determines whether the current request is for an administrative interface page. |
| Version | Description |
| --- | --- |
| [3.1.0](https://developer.wordpress.org/reference/since/3.1.0/) | Introduced. |
wordpress wp_cache_get( int|string $key, string $group = '', bool $force = false, bool $found = null ): mixed|false wp\_cache\_get( int|string $key, string $group = '', bool $force = false, bool $found = null ): mixed|false
===========================================================================================================
Retrieves the cache contents from the cache by key and group.
* [WP\_Object\_Cache::get()](../classes/wp_object_cache/get)
`$key` int|string Required The key under which the cache contents are stored. `$group` string Optional Where the cache contents are grouped. Default: `''`
`$force` bool Optional Whether to force an update of the local cache from the persistent cache. Default: `false`
`$found` bool Optional Whether the key was found in the cache (passed by reference).
Disambiguates a return of false, a storable value. Default: `null`
mixed|false The cache contents on success, false on failure to retrieve contents.
File: `wp-includes/cache.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/cache.php/)
```
function wp_cache_get( $key, $group = '', $force = false, &$found = null ) {
global $wp_object_cache;
return $wp_object_cache->get( $key, $group, $force, $found );
}
```
| Uses | Description |
| --- | --- |
| [WP\_Object\_Cache::get()](../classes/wp_object_cache/get) wp-includes/class-wp-object-cache.php | Retrieves the cache contents, if it exists. |
| Used By | Description |
| --- | --- |
| [get\_metadata\_raw()](get_metadata_raw) wp-includes/meta.php | Retrieves raw metadata value for the specified object. |
| [\_find\_post\_by\_old\_slug()](_find_post_by_old_slug) wp-includes/query.php | Find the post ID for redirecting an old slug. |
| [\_find\_post\_by\_old\_date()](_find_post_by_old_date) wp-includes/query.php | Find the post ID for redirecting an old date. |
| [WP\_Privacy\_Requests\_Table::get\_request\_counts()](../classes/wp_privacy_requests_table/get_request_counts) wp-admin/includes/class-wp-privacy-requests-table.php | Count number of requests for each status. |
| [WP\_Embed::find\_oembed\_post\_id()](../classes/wp_embed/find_oembed_post_id) wp-includes/class-wp-embed.php | Finds the oEmbed cache post ID for a given cache key. |
| [WP\_Customize\_Manager::find\_changeset\_post\_id()](../classes/wp_customize_manager/find_changeset_post_id) wp-includes/class-wp-customize-manager.php | Finds the changeset post ID for a given changeset UUID. |
| [wp\_cache\_get\_last\_changed()](wp_cache_get_last_changed) wp-includes/functions.php | Gets last changed date for the specified cache group. |
| [WP\_Term\_Query::get\_terms()](../classes/wp_term_query/get_terms) wp-includes/class-wp-term-query.php | Retrieves the query results. |
| [WP\_Network\_Query::get\_networks()](../classes/wp_network_query/get_networks) wp-includes/class-wp-network-query.php | Gets a list of networks matching the query vars. |
| [WP\_Site::get\_details()](../classes/wp_site/get_details) wp-includes/class-wp-site.php | Retrieves the details for this site. |
| [ms\_load\_current\_site\_and\_network()](ms_load_current_site_and_network) wp-includes/ms-load.php | Identifies the network and site of a requested domain and path and populates the corresponding network and site global objects as part of the multisite bootstrap process. |
| [WP\_Site\_Query::get\_sites()](../classes/wp_site_query/get_sites) wp-includes/class-wp-site-query.php | Retrieves a list of sites matching the query vars. |
| [WP\_Site::get\_instance()](../classes/wp_site/get_instance) wp-includes/class-wp-site.php | Retrieves a site from the database by its ID. |
| [WP\_Network::get\_instance()](../classes/wp_network/get_instance) wp-includes/class-wp-network.php | Retrieves a network from the database by its ID. |
| [WP\_Comment::get\_instance()](../classes/wp_comment/get_instance) wp-includes/class-wp-comment.php | Retrieves a [WP\_Comment](../classes/wp_comment) instance. |
| [WP\_Comment\_Query::fill\_descendants()](../classes/wp_comment_query/fill_descendants) wp-includes/class-wp-comment-query.php | Fetch descendants for located comments. |
| [WP\_Term::get\_instance()](../classes/wp_term/get_instance) wp-includes/class-wp-term.php | Retrieve [WP\_Term](../classes/wp_term) instance. |
| [update\_network\_option()](update_network_option) wp-includes/option.php | Updates the value of a network option that was already added. |
| [add\_network\_option()](add_network_option) wp-includes/option.php | Adds a new network option. |
| [get\_network\_option()](get_network_option) wp-includes/option.php | Retrieves a network’s option value based on the option name. |
| [WP\_MS\_Sites\_List\_Table::column\_users()](../classes/wp_ms_sites_list_table/column_users) wp-admin/includes/class-wp-ms-sites-list-table.php | Handles the users column output. |
| [WP\_Comment\_Query::get\_comments()](../classes/wp_comment_query/get_comments) wp-includes/class-wp-comment-query.php | Get a list of comments matching the query vars. |
| [get\_plugins()](get_plugins) wp-admin/includes/plugin.php | Checks the plugins directory and retrieve all plugin files with plugin data. |
| [WP\_User::get\_data\_by()](../classes/wp_user/get_data_by) wp-includes/class-wp-user.php | Returns only the main user fields. |
| [wp\_get\_archives()](wp_get_archives) wp-includes/general-template.php | Displays archive links based on type and format. |
| [get\_calendar()](get_calendar) wp-includes/general-template.php | Displays calendar with days that have posts as links. |
| [get\_usermeta()](get_usermeta) wp-includes/deprecated.php | Retrieve user metadata. |
| [WP\_Theme::cache\_get()](../classes/wp_theme/cache_get) wp-includes/class-wp-theme.php | Gets theme data from cache. |
| [WP\_Query::get\_posts()](../classes/wp_query/get_posts) wp-includes/class-wp-query.php | Retrieves an array of posts based on query variables. |
| [is\_blog\_installed()](is_blog_installed) wp-includes/functions.php | Determines whether WordPress is already installed. |
| [get\_object\_term\_cache()](get_object_term_cache) wp-includes/taxonomy.php | Retrieves the cached term objects for the given object ID. |
| [get\_objects\_in\_term()](get_objects_in_term) wp-includes/taxonomy.php | Retrieves object IDs of valid taxonomy and term. |
| [get\_adjacent\_post()](get_adjacent_post) wp-includes/link-template.php | Retrieves the adjacent post. |
| [get\_site\_transient()](get_site_transient) wp-includes/option.php | Retrieves the value of a site transient. |
| [get\_transient()](get_transient) wp-includes/option.php | Retrieves the value of a transient. |
| [wp\_load\_alloptions()](wp_load_alloptions) wp-includes/option.php | Loads and caches all autoloaded options, if available or all options. |
| [update\_option()](update_option) wp-includes/option.php | Updates the value of an option that was already added. |
| [add\_option()](add_option) wp-includes/option.php | Adds a new option. |
| [get\_option()](get_option) wp-includes/option.php | Retrieves an option value based on an option name. |
| [WP\_Post::get\_instance()](../classes/wp_post/get_instance) wp-includes/class-wp-post.php | Retrieve [WP\_Post](../classes/wp_post) instance. |
| [wp\_mime\_type\_icon()](wp_mime_type_icon) wp-includes/post.php | Retrieves the icon for a MIME type or attachment. |
| [\_get\_last\_post\_time()](_get_last_post_time) wp-includes/post.php | Gets the timestamp of the last time any post was modified or published. |
| [get\_all\_page\_ids()](get_all_page_ids) wp-includes/post.php | Gets a list of page IDs. |
| [get\_page\_by\_path()](get_page_by_path) wp-includes/post.php | Retrieves a page given its path. |
| [get\_pages()](get_pages) wp-includes/post.php | Retrieves an array of pages (or hierarchical post type items). |
| [wp\_count\_posts()](wp_count_posts) wp-includes/post.php | Counts number of posts of a post type and if user has permissions to view. |
| [wp\_count\_attachments()](wp_count_attachments) wp-includes/post.php | Counts number of attachments for the mime type(s). |
| [get\_blog\_id\_from\_url()](get_blog_id_from_url) wp-includes/ms-functions.php | Gets a blog’s numeric ID from its URL. |
| [get\_bookmark()](get_bookmark) wp-includes/bookmark.php | Retrieves bookmark data. |
| [get\_bookmarks()](get_bookmarks) wp-includes/bookmark.php | Retrieves the list of bookmarks. |
| [get\_blog\_details()](get_blog_details) wp-includes/ms-blogs.php | Retrieve the details for a blog from the blogs table and blog options. |
| [wp\_count\_comments()](wp_count_comments) wp-includes/comment.php | Retrieves the total comment counts for the whole site or a single post. |
| [get\_lastcommentmodified()](get_lastcommentmodified) wp-includes/comment.php | Retrieves the date the last comment was modified. |
| [metadata\_exists()](metadata_exists) wp-includes/meta.php | Determines if a meta field with the given key exists for the given object ID. |
| Version | Description |
| --- | --- |
| [2.0.0](https://developer.wordpress.org/reference/since/2.0.0/) | Introduced. |
| programming_docs |
wordpress wp_enqueue_editor_format_library_assets() wp\_enqueue\_editor\_format\_library\_assets()
==============================================
Enqueues the assets required for the format library within the block editor.
File: `wp-includes/script-loader.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/script-loader.php/)
```
function wp_enqueue_editor_format_library_assets() {
wp_enqueue_script( 'wp-format-library' );
wp_enqueue_style( 'wp-format-library' );
}
```
| Uses | Description |
| --- | --- |
| [wp\_enqueue\_script()](wp_enqueue_script) wp-includes/functions.wp-scripts.php | Enqueue a script. |
| [wp\_enqueue\_style()](wp_enqueue_style) wp-includes/functions.wp-styles.php | Enqueue a CSS stylesheet. |
| Version | Description |
| --- | --- |
| [5.8.0](https://developer.wordpress.org/reference/since/5.8.0/) | Introduced. |
wordpress _wp_privacy_send_request_confirmation_notification( int $request_id ) \_wp\_privacy\_send\_request\_confirmation\_notification( int $request\_id )
============================================================================
Notifies the site administrator via email when a request is confirmed.
Without this, the admin would have to manually check the site to see if any action was needed on their part yet.
`$request_id` int Required The ID of the request. File: `wp-includes/user.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/user.php/)
```
function _wp_privacy_send_request_confirmation_notification( $request_id ) {
$request = wp_get_user_request( $request_id );
if ( ! is_a( $request, 'WP_User_Request' ) || 'request-confirmed' !== $request->status ) {
return;
}
$already_notified = (bool) get_post_meta( $request_id, '_wp_admin_notified', true );
if ( $already_notified ) {
return;
}
if ( 'export_personal_data' === $request->action_name ) {
$manage_url = admin_url( 'export-personal-data.php' );
} elseif ( 'remove_personal_data' === $request->action_name ) {
$manage_url = admin_url( 'erase-personal-data.php' );
}
$action_description = wp_user_request_action_description( $request->action_name );
/**
* Filters the recipient of the data request confirmation notification.
*
* In a Multisite environment, this will default to the email address of the
* network admin because, by default, single site admins do not have the
* capabilities required to process requests. Some networks may wish to
* delegate those capabilities to a single-site admin, or a dedicated person
* responsible for managing privacy requests.
*
* @since 4.9.6
*
* @param string $admin_email The email address of the notification recipient.
* @param WP_User_Request $request The request that is initiating the notification.
*/
$admin_email = apply_filters( 'user_request_confirmed_email_to', get_site_option( 'admin_email' ), $request );
$email_data = array(
'request' => $request,
'user_email' => $request->email,
'description' => $action_description,
'manage_url' => $manage_url,
'sitename' => wp_specialchars_decode( get_option( 'blogname' ), ENT_QUOTES ),
'siteurl' => home_url(),
'admin_email' => $admin_email,
);
$subject = sprintf(
/* translators: Privacy data request confirmed notification email subject. 1: Site title, 2: Name of the confirmed action. */
__( '[%1$s] Action Confirmed: %2$s' ),
$email_data['sitename'],
$action_description
);
/**
* Filters the subject of the user request confirmation email.
*
* @since 4.9.8
*
* @param string $subject The email subject.
* @param string $sitename The name of the site.
* @param array $email_data {
* Data relating to the account action email.
*
* @type WP_User_Request $request User request object.
* @type string $user_email The email address confirming a request
* @type string $description Description of the action being performed so the user knows what the email is for.
* @type string $manage_url The link to click manage privacy requests of this type.
* @type string $sitename The site name sending the mail.
* @type string $siteurl The site URL sending the mail.
* @type string $admin_email The administrator email receiving the mail.
* }
*/
$subject = apply_filters( 'user_request_confirmed_email_subject', $subject, $email_data['sitename'], $email_data );
/* translators: Do not translate SITENAME, USER_EMAIL, DESCRIPTION, MANAGE_URL, SITEURL; those are placeholders. */
$content = __(
'Howdy,
A user data privacy request has been confirmed on ###SITENAME###:
User: ###USER_EMAIL###
Request: ###DESCRIPTION###
You can view and manage these data privacy requests here:
###MANAGE_URL###
Regards,
All at ###SITENAME###
###SITEURL###'
);
/**
* Filters the body of the user request confirmation email.
*
* The email is sent to an administrator when a user request is confirmed.
*
* The following strings have a special meaning and will get replaced dynamically:
*
* ###SITENAME### The name of the site.
* ###USER_EMAIL### The user email for the request.
* ###DESCRIPTION### Description of the action being performed so the user knows what the email is for.
* ###MANAGE_URL### The URL to manage requests.
* ###SITEURL### The URL to the site.
*
* @since 4.9.6
* @deprecated 5.8.0 Use {@see 'user_request_confirmed_email_content'} instead.
* For user erasure fulfillment email content
* use {@see 'user_erasure_fulfillment_email_content'} instead.
*
* @param string $content The email content.
* @param array $email_data {
* Data relating to the account action email.
*
* @type WP_User_Request $request User request object.
* @type string $user_email The email address confirming a request
* @type string $description Description of the action being performed
* so the user knows what the email is for.
* @type string $manage_url The link to click manage privacy requests of this type.
* @type string $sitename The site name sending the mail.
* @type string $siteurl The site URL sending the mail.
* @type string $admin_email The administrator email receiving the mail.
* }
*/
$content = apply_filters_deprecated(
'user_confirmed_action_email_content',
array( $content, $email_data ),
'5.8.0',
sprintf(
/* translators: 1 & 2: Deprecation replacement options. */
__( '%1$s or %2$s' ),
'user_request_confirmed_email_content',
'user_erasure_fulfillment_email_content'
)
);
/**
* Filters the body of the user request confirmation email.
*
* The email is sent to an administrator when a user request is confirmed.
* The following strings have a special meaning and will get replaced dynamically:
*
* ###SITENAME### The name of the site.
* ###USER_EMAIL### The user email for the request.
* ###DESCRIPTION### Description of the action being performed so the user knows what the email is for.
* ###MANAGE_URL### The URL to manage requests.
* ###SITEURL### The URL to the site.
*
* @since 5.8.0
*
* @param string $content The email content.
* @param array $email_data {
* Data relating to the account action email.
*
* @type WP_User_Request $request User request object.
* @type string $user_email The email address confirming a request
* @type string $description Description of the action being performed so the user knows what the email is for.
* @type string $manage_url The link to click manage privacy requests of this type.
* @type string $sitename The site name sending the mail.
* @type string $siteurl The site URL sending the mail.
* @type string $admin_email The administrator email receiving the mail.
* }
*/
$content = apply_filters( 'user_request_confirmed_email_content', $content, $email_data );
$content = str_replace( '###SITENAME###', $email_data['sitename'], $content );
$content = str_replace( '###USER_EMAIL###', $email_data['user_email'], $content );
$content = str_replace( '###DESCRIPTION###', $email_data['description'], $content );
$content = str_replace( '###MANAGE_URL###', sanitize_url( $email_data['manage_url'] ), $content );
$content = str_replace( '###SITEURL###', sanitize_url( $email_data['siteurl'] ), $content );
$headers = '';
/**
* Filters the headers of the user request confirmation email.
*
* @since 5.4.0
*
* @param string|array $headers The email headers.
* @param string $subject The email subject.
* @param string $content The email content.
* @param int $request_id The request ID.
* @param array $email_data {
* Data relating to the account action email.
*
* @type WP_User_Request $request User request object.
* @type string $user_email The email address confirming a request
* @type string $description Description of the action being performed so the user knows what the email is for.
* @type string $manage_url The link to click manage privacy requests of this type.
* @type string $sitename The site name sending the mail.
* @type string $siteurl The site URL sending the mail.
* @type string $admin_email The administrator email receiving the mail.
* }
*/
$headers = apply_filters( 'user_request_confirmed_email_headers', $headers, $subject, $content, $request_id, $email_data );
$email_sent = wp_mail( $email_data['admin_email'], $subject, $content, $headers );
if ( $email_sent ) {
update_post_meta( $request_id, '_wp_admin_notified', true );
}
}
```
[apply\_filters\_deprecated( 'user\_confirmed\_action\_email\_content', string $content, array $email\_data )](../hooks/user_confirmed_action_email_content)
Filters the body of the data erasure fulfillment notification.
[apply\_filters( 'user\_request\_confirmed\_email\_content', string $content, array $email\_data )](../hooks/user_request_confirmed_email_content)
Filters the body of the user request confirmation email.
[apply\_filters( 'user\_request\_confirmed\_email\_headers', string|array $headers, string $subject, string $content, int $request\_id, array $email\_data )](../hooks/user_request_confirmed_email_headers)
Filters the headers of the user request confirmation email.
[apply\_filters( 'user\_request\_confirmed\_email\_subject', string $subject, string $sitename, array $email\_data )](../hooks/user_request_confirmed_email_subject)
Filters the subject of the user request confirmation email.
[apply\_filters( 'user\_request\_confirmed\_email\_to', string $admin\_email, WP\_User\_Request $request )](../hooks/user_request_confirmed_email_to)
Filters the recipient of the data request confirmation notification.
| Uses | Description |
| --- | --- |
| [wp\_get\_user\_request()](wp_get_user_request) wp-includes/user.php | Returns the user request object for the specified request ID. |
| [wp\_user\_request\_action\_description()](wp_user_request_action_description) wp-includes/user.php | Gets action description from the name and return a string. |
| [apply\_filters\_deprecated()](apply_filters_deprecated) wp-includes/plugin.php | Fires functions attached to a deprecated filter hook. |
| [wp\_specialchars\_decode()](wp_specialchars_decode) wp-includes/formatting.php | Converts a number of HTML entities into their special characters. |
| [wp\_mail()](wp_mail) wp-includes/pluggable.php | Sends an email, similar to PHP’s mail function. |
| [sanitize\_url()](sanitize_url) wp-includes/formatting.php | Sanitizes a URL for database or redirect usage. |
| [update\_post\_meta()](update_post_meta) wp-includes/post.php | Updates a post meta field based on the given post ID. |
| [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. |
| [admin\_url()](admin_url) wp-includes/link-template.php | Retrieves the URL to the admin area for the current site. |
| [home\_url()](home_url) wp-includes/link-template.php | Retrieves the URL for the current site where the front end is accessible. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| [get\_site\_option()](get_site_option) wp-includes/option.php | Retrieve an option value for the current network based on name of option. |
| [get\_option()](get_option) wp-includes/option.php | Retrieves an option value based on an option name. |
| [get\_post\_meta()](get_post_meta) wp-includes/post.php | Retrieves a post meta field for the given post ID. |
| Version | Description |
| --- | --- |
| [4.9.6](https://developer.wordpress.org/reference/since/4.9.6/) | Introduced. |
wordpress maybe_drop_column( string $table_name, string $column_name, string $drop_ddl ): bool maybe\_drop\_column( string $table\_name, string $column\_name, string $drop\_ddl ): bool
=========================================================================================
Drops column from database table, if it exists.
`$table_name` string Required Database table name. `$column_name` string Required Table column name. `$drop_ddl` string Required SQL statement to drop column. bool True on success or if the column doesn't exist. False on failure.
File: `wp-admin/install-helper.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/install-helper.php/)
```
function maybe_drop_column( $table_name, $column_name, $drop_ddl ) {
global $wpdb;
foreach ( $wpdb->get_col( "DESC $table_name", 0 ) as $column ) {
if ( $column === $column_name ) {
// Found it, so try to drop it.
$wpdb->query( $drop_ddl );
// We cannot directly tell that whether this succeeded!
foreach ( $wpdb->get_col( "DESC $table_name", 0 ) as $column ) {
if ( $column === $column_name ) {
return false;
}
}
}
}
// Else didn't find it.
return true;
}
```
| Uses | Description |
| --- | --- |
| [wpdb::get\_col()](../classes/wpdb/get_col) wp-includes/class-wpdb.php | Retrieves one column from the database. |
| [wpdb::query()](../classes/wpdb/query) wp-includes/class-wpdb.php | Performs a database query, using current database connection. |
| Version | Description |
| --- | --- |
| [1.0.0](https://developer.wordpress.org/reference/since/1.0.0/) | Introduced. |
wordpress wp_get_server_protocol(): string wp\_get\_server\_protocol(): string
===================================
Return the HTTP protocol sent by the server.
string The HTTP protocol. Default: HTTP/1.0.
File: `wp-includes/load.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/load.php/)
```
function wp_get_server_protocol() {
$protocol = isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : '';
if ( ! in_array( $protocol, array( 'HTTP/1.1', 'HTTP/2', 'HTTP/2.0', 'HTTP/3' ), true ) ) {
$protocol = 'HTTP/1.0';
}
return $protocol;
}
```
| Used By | Description |
| --- | --- |
| [wp\_check\_php\_mysql\_versions()](wp_check_php_mysql_versions) wp-includes/load.php | Check for the required PHP version, and the MySQL extension or a database drop-in. |
| [status\_header()](status_header) wp-includes/functions.php | Sets HTTP status header. |
| Version | Description |
| --- | --- |
| [4.4.0](https://developer.wordpress.org/reference/since/4.4.0/) | Introduced. |
wordpress upgrade_network() upgrade\_network()
==================
Executes network-level upgrade routines.
File: `wp-admin/includes/upgrade.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/upgrade.php/)
```
function upgrade_network() {
global $wp_current_db_version, $wpdb;
// Always clear expired transients.
delete_expired_transients( true );
// 2.8.0
if ( $wp_current_db_version < 11549 ) {
$wpmu_sitewide_plugins = get_site_option( 'wpmu_sitewide_plugins' );
$active_sitewide_plugins = get_site_option( 'active_sitewide_plugins' );
if ( $wpmu_sitewide_plugins ) {
if ( ! $active_sitewide_plugins ) {
$sitewide_plugins = (array) $wpmu_sitewide_plugins;
} else {
$sitewide_plugins = array_merge( (array) $active_sitewide_plugins, (array) $wpmu_sitewide_plugins );
}
update_site_option( 'active_sitewide_plugins', $sitewide_plugins );
}
delete_site_option( 'wpmu_sitewide_plugins' );
delete_site_option( 'deactivated_sitewide_plugins' );
$start = 0;
while ( $rows = $wpdb->get_results( "SELECT meta_key, meta_value FROM {$wpdb->sitemeta} ORDER BY meta_id LIMIT $start, 20" ) ) {
foreach ( $rows as $row ) {
$value = $row->meta_value;
if ( ! @unserialize( $value ) ) {
$value = stripslashes( $value );
}
if ( $value !== $row->meta_value ) {
update_site_option( $row->meta_key, $value );
}
}
$start += 20;
}
}
// 3.0.0
if ( $wp_current_db_version < 13576 ) {
update_site_option( 'global_terms_enabled', '1' );
}
// 3.3.0
if ( $wp_current_db_version < 19390 ) {
update_site_option( 'initial_db_version', $wp_current_db_version );
}
if ( $wp_current_db_version < 19470 ) {
if ( false === get_site_option( 'active_sitewide_plugins' ) ) {
update_site_option( 'active_sitewide_plugins', array() );
}
}
// 3.4.0
if ( $wp_current_db_version < 20148 ) {
// 'allowedthemes' keys things by stylesheet. 'allowed_themes' keyed things by name.
$allowedthemes = get_site_option( 'allowedthemes' );
$allowed_themes = get_site_option( 'allowed_themes' );
if ( false === $allowedthemes && is_array( $allowed_themes ) && $allowed_themes ) {
$converted = array();
$themes = wp_get_themes();
foreach ( $themes as $stylesheet => $theme_data ) {
if ( isset( $allowed_themes[ $theme_data->get( 'Name' ) ] ) ) {
$converted[ $stylesheet ] = true;
}
}
update_site_option( 'allowedthemes', $converted );
delete_site_option( 'allowed_themes' );
}
}
// 3.5.0
if ( $wp_current_db_version < 21823 ) {
update_site_option( 'ms_files_rewriting', '1' );
}
// 3.5.2
if ( $wp_current_db_version < 24448 ) {
$illegal_names = get_site_option( 'illegal_names' );
if ( is_array( $illegal_names ) && count( $illegal_names ) === 1 ) {
$illegal_name = reset( $illegal_names );
$illegal_names = explode( ' ', $illegal_name );
update_site_option( 'illegal_names', $illegal_names );
}
}
// 4.2.0
if ( $wp_current_db_version < 31351 && 'utf8mb4' === $wpdb->charset ) {
if ( wp_should_upgrade_global_tables() ) {
$wpdb->query( "ALTER TABLE $wpdb->usermeta DROP INDEX meta_key, ADD INDEX meta_key(meta_key(191))" );
$wpdb->query( "ALTER TABLE $wpdb->site DROP INDEX domain, ADD INDEX domain(domain(140),path(51))" );
$wpdb->query( "ALTER TABLE $wpdb->sitemeta DROP INDEX meta_key, ADD INDEX meta_key(meta_key(191))" );
$wpdb->query( "ALTER TABLE $wpdb->signups DROP INDEX domain_path, ADD INDEX domain_path(domain(140),path(51))" );
$tables = $wpdb->tables( 'global' );
// sitecategories may not exist.
if ( ! $wpdb->get_var( "SHOW TABLES LIKE '{$tables['sitecategories']}'" ) ) {
unset( $tables['sitecategories'] );
}
foreach ( $tables as $table ) {
maybe_convert_table_to_utf8mb4( $table );
}
}
}
// 4.3.0
if ( $wp_current_db_version < 33055 && 'utf8mb4' === $wpdb->charset ) {
if ( wp_should_upgrade_global_tables() ) {
$upgrade = false;
$indexes = $wpdb->get_results( "SHOW INDEXES FROM $wpdb->signups" );
foreach ( $indexes as $index ) {
if ( 'domain_path' === $index->Key_name && 'domain' === $index->Column_name && 140 != $index->Sub_part ) {
$upgrade = true;
break;
}
}
if ( $upgrade ) {
$wpdb->query( "ALTER TABLE $wpdb->signups DROP INDEX domain_path, ADD INDEX domain_path(domain(140),path(51))" );
}
$tables = $wpdb->tables( 'global' );
// sitecategories may not exist.
if ( ! $wpdb->get_var( "SHOW TABLES LIKE '{$tables['sitecategories']}'" ) ) {
unset( $tables['sitecategories'] );
}
foreach ( $tables as $table ) {
maybe_convert_table_to_utf8mb4( $table );
}
}
}
// 5.1.0
if ( $wp_current_db_version < 44467 ) {
$network_id = get_main_network_id();
delete_network_option( $network_id, 'site_meta_supported' );
is_site_meta_supported();
}
}
```
| Uses | Description |
| --- | --- |
| [is\_site\_meta\_supported()](is_site_meta_supported) wp-includes/functions.php | Determines whether site meta is enabled. |
| [delete\_expired\_transients()](delete_expired_transients) wp-includes/option.php | Deletes all expired transients. |
| [delete\_network\_option()](delete_network_option) wp-includes/option.php | Removes a network option by name. |
| [get\_main\_network\_id()](get_main_network_id) wp-includes/functions.php | Gets the main network ID. |
| [wp\_should\_upgrade\_global\_tables()](wp_should_upgrade_global_tables) wp-admin/includes/upgrade.php | Determine if global tables should be upgraded. |
| [maybe\_convert\_table\_to\_utf8mb4()](maybe_convert_table_to_utf8mb4) wp-admin/includes/upgrade.php | If a table only contains utf8 or utf8mb4 columns, convert it to utf8mb4. |
| [wp\_get\_themes()](wp_get_themes) wp-includes/theme.php | Returns an array of [WP\_Theme](../classes/wp_theme) objects based on the arguments. |
| [update\_site\_option()](update_site_option) wp-includes/option.php | Updates the value of an option that was already added for the current network. |
| [delete\_site\_option()](delete_site_option) wp-includes/option.php | Removes a option by name for the current network. |
| [wpdb::query()](../classes/wpdb/query) wp-includes/class-wpdb.php | Performs a database query, using current database connection. |
| [wpdb::tables()](../classes/wpdb/tables) wp-includes/class-wpdb.php | Returns an array of WordPress tables. |
| [get\_site\_option()](get_site_option) wp-includes/option.php | Retrieve an option value for the current network based on name of option. |
| [wpdb::get\_results()](../classes/wpdb/get_results) wp-includes/class-wpdb.php | Retrieves an entire SQL result set from the database (i.e., many rows). |
| [wpdb::get\_var()](../classes/wpdb/get_var) wp-includes/class-wpdb.php | Retrieves one variable from the database. |
| Used By | Description |
| --- | --- |
| [wp\_upgrade()](wp_upgrade) wp-admin/includes/upgrade.php | Runs WordPress Upgrade functions. |
| Version | Description |
| --- | --- |
| [3.0.0](https://developer.wordpress.org/reference/since/3.0.0/) | Introduced. |
| programming_docs |
wordpress do_settings_sections( string $page ) do\_settings\_sections( string $page )
======================================
Prints out all settings sections added to a particular settings page.
Part of the Settings API. Use this in a settings page callback function to output all the sections and fields that were added to that $page with [add\_settings\_section()](add_settings_section) and [add\_settings\_field()](add_settings_field)
`$page` string Required The slug name of the page whose settings sections you want to output. This will output the section titles wrapped in h3 tags and the settings fields wrapped in tables.
File: `wp-admin/includes/template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/template.php/)
```
function do_settings_sections( $page ) {
global $wp_settings_sections, $wp_settings_fields;
if ( ! isset( $wp_settings_sections[ $page ] ) ) {
return;
}
foreach ( (array) $wp_settings_sections[ $page ] as $section ) {
if ( '' !== $section['before_section'] ) {
if ( '' !== $section['section_class'] ) {
echo wp_kses_post( sprintf( $section['before_section'], esc_attr( $section['section_class'] ) ) );
} else {
echo wp_kses_post( $section['before_section'] );
}
}
if ( $section['title'] ) {
echo "<h2>{$section['title']}</h2>\n";
}
if ( $section['callback'] ) {
call_user_func( $section['callback'], $section );
}
if ( ! isset( $wp_settings_fields ) || ! isset( $wp_settings_fields[ $page ] ) || ! isset( $wp_settings_fields[ $page ][ $section['id'] ] ) ) {
continue;
}
echo '<table class="form-table" role="presentation">';
do_settings_fields( $page, $section['id'] );
echo '</table>';
if ( '' !== $section['after_section'] ) {
echo wp_kses_post( $section['after_section'] );
}
}
}
```
| Uses | Description |
| --- | --- |
| [do\_settings\_fields()](do_settings_fields) wp-admin/includes/template.php | Prints out the settings fields for a particular settings section. |
| [wp\_kses\_post()](wp_kses_post) wp-includes/kses.php | Sanitizes content for allowed HTML tags for post content. |
| [esc\_attr()](esc_attr) wp-includes/formatting.php | Escaping for HTML attributes. |
| Version | Description |
| --- | --- |
| [2.7.0](https://developer.wordpress.org/reference/since/2.7.0/) | Introduced. |
wordpress wp_ajax_imgedit_preview() wp\_ajax\_imgedit\_preview()
============================
Ajax handler for image editor previews.
File: `wp-admin/includes/ajax-actions.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/ajax-actions.php/)
```
function wp_ajax_imgedit_preview() {
$post_id = (int) $_GET['postid'];
if ( empty( $post_id ) || ! current_user_can( 'edit_post', $post_id ) ) {
wp_die( -1 );
}
check_ajax_referer( "image_editor-$post_id" );
include_once ABSPATH . 'wp-admin/includes/image-edit.php';
if ( ! stream_preview_image( $post_id ) ) {
wp_die( -1 );
}
wp_die();
}
```
| Uses | Description |
| --- | --- |
| [stream\_preview\_image()](stream_preview_image) wp-admin/includes/image-edit.php | Streams image in post to browser, along with enqueued changes in `$_REQUEST['history']`. |
| [current\_user\_can()](current_user_can) wp-includes/capabilities.php | Returns whether the current user has the specified capability. |
| [check\_ajax\_referer()](check_ajax_referer) wp-includes/pluggable.php | Verifies the Ajax request to prevent processing requests external of the blog. |
| [wp\_die()](wp_die) wp-includes/functions.php | Kills WordPress execution and displays HTML page with an error message. |
| Version | Description |
| --- | --- |
| [3.1.0](https://developer.wordpress.org/reference/since/3.1.0/) | Introduced. |
wordpress update_gallery_tab( array $tabs ): array update\_gallery\_tab( array $tabs ): array
==========================================
Adds the gallery tab back to the tabs array if post has image attachments.
`$tabs` array Required array $tabs with gallery if post has image attachment
File: `wp-admin/includes/media.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/media.php/)
```
function update_gallery_tab( $tabs ) {
global $wpdb;
if ( ! isset( $_REQUEST['post_id'] ) ) {
unset( $tabs['gallery'] );
return $tabs;
}
$post_id = (int) $_REQUEST['post_id'];
if ( $post_id ) {
$attachments = (int) $wpdb->get_var( $wpdb->prepare( "SELECT count(*) FROM $wpdb->posts WHERE post_type = 'attachment' AND post_status != 'trash' AND post_parent = %d", $post_id ) );
}
if ( empty( $attachments ) ) {
unset( $tabs['gallery'] );
return $tabs;
}
/* translators: %s: Number of attachments. */
$tabs['gallery'] = sprintf( __( 'Gallery (%s)' ), "<span id='attachments-count'>$attachments</span>" );
return $tabs;
}
```
| Uses | Description |
| --- | --- |
| [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. |
| [wpdb::get\_var()](../classes/wpdb/get_var) wp-includes/class-wpdb.php | Retrieves one variable from the database. |
| [wpdb::prepare()](../classes/wpdb/prepare) wp-includes/class-wpdb.php | Prepares a SQL query for safe execution. |
| Version | Description |
| --- | --- |
| [2.5.0](https://developer.wordpress.org/reference/since/2.5.0/) | Introduced. |
wordpress get_settings( string $option ): string get\_settings( string $option ): string
=======================================
This function has been deprecated. Use [get\_option()](get_option) instead.
Get value based on option.
* [get\_option()](get_option)
`$option` string Required string
File: `wp-includes/deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/deprecated.php/)
```
function get_settings($option) {
_deprecated_function( __FUNCTION__, '2.1.0', 'get_option()' );
return get_option($option);
}
```
| Uses | Description |
| --- | --- |
| [\_deprecated\_function()](_deprecated_function) wp-includes/functions.php | Marks a function as deprecated and inform when it has been used. |
| [get\_option()](get_option) wp-includes/option.php | Retrieves an option value based on an option name. |
| Version | Description |
| --- | --- |
| [2.1.0](https://developer.wordpress.org/reference/since/2.1.0/) | Use [get\_option()](get_option) |
| [0.71](https://developer.wordpress.org/reference/since/0.71/) | Introduced. |
wordpress rest_validate_integer_value_from_schema( mixed $value, array $args, string $param ): true|WP_Error rest\_validate\_integer\_value\_from\_schema( mixed $value, array $args, string $param ): true|WP\_Error
========================================================================================================
Validates an integer value based on a schema.
`$value` mixed Required The value to validate. `$args` array Required Schema array to use for validation. `$param` string Required The parameter name, used in error messages. true|[WP\_Error](../classes/wp_error)
File: `wp-includes/rest-api.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/rest-api.php/)
```
function rest_validate_integer_value_from_schema( $value, $args, $param ) {
$is_valid_number = rest_validate_number_value_from_schema( $value, $args, $param );
if ( is_wp_error( $is_valid_number ) ) {
return $is_valid_number;
}
if ( ! rest_is_integer( $value ) ) {
return new WP_Error(
'rest_invalid_type',
/* translators: 1: Parameter, 2: Type name. */
sprintf( __( '%1$s is not of type %2$s.' ), $param, 'integer' ),
array( 'param' => $param )
);
}
return true;
}
```
| Uses | Description |
| --- | --- |
| [rest\_validate\_number\_value\_from\_schema()](rest_validate_number_value_from_schema) wp-includes/rest-api.php | Validates a number value based on a schema. |
| [rest\_is\_integer()](rest_is_integer) wp-includes/rest-api.php | Determines if a given value is integer-like. |
| [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. |
| [is\_wp\_error()](is_wp_error) wp-includes/load.php | Checks whether the given variable is a WordPress Error. |
| [WP\_Error::\_\_construct()](../classes/wp_error/__construct) wp-includes/class-wp-error.php | Initializes the error. |
| Used By | Description |
| --- | --- |
| [rest\_validate\_value\_from\_schema()](rest_validate_value_from_schema) wp-includes/rest-api.php | Validate a value based on a schema. |
| Version | Description |
| --- | --- |
| [5.7.0](https://developer.wordpress.org/reference/since/5.7.0/) | Introduced. |
wordpress core_upgrade_preamble() core\_upgrade\_preamble()
=========================
Display upgrade WordPress for downloading latest or upgrading automatically form.
File: `wp-admin/update-core.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/update-core.php/)
```
function core_upgrade_preamble() {
global $required_php_version, $required_mysql_version;
$updates = get_core_updates();
// Include an unmodified $wp_version.
require ABSPATH . WPINC . '/version.php';
$is_development_version = preg_match( '/alpha|beta|RC/', $wp_version );
if ( isset( $updates[0]->version ) && version_compare( $updates[0]->version, $wp_version, '>' ) ) {
echo '<h2 class="response">';
_e( 'An updated version of WordPress is available.' );
echo '</h2>';
echo '<div class="notice notice-warning inline"><p>';
printf(
/* translators: 1: Documentation on WordPress backups, 2: Documentation on updating WordPress. */
__( '<strong>Important:</strong> Before updating, please <a href="%1$s">back up your database and files</a>. For help with updates, visit the <a href="%2$s">Updating WordPress</a> documentation page.' ),
__( 'https://wordpress.org/support/article/wordpress-backups/' ),
__( 'https://wordpress.org/support/article/updating-wordpress/' )
);
echo '</p></div>';
} elseif ( $is_development_version ) {
echo '<h2 class="response">' . __( 'You are using a development version of WordPress.' ) . '</h2>';
} else {
echo '<h2 class="response">' . __( 'You have the latest version of WordPress.' ) . '</h2>';
}
echo '<ul class="core-updates">';
foreach ( (array) $updates as $update ) {
echo '<li>';
list_core_update( $update );
echo '</li>';
}
echo '</ul>';
// Don't show the maintenance mode notice when we are only showing a single re-install option.
if ( $updates && ( count( $updates ) > 1 || 'latest' !== $updates[0]->response ) ) {
echo '<p>' . __( 'While your site is being updated, it will be in maintenance mode. As soon as your updates are complete, this mode will be deactivated.' ) . '</p>';
} elseif ( ! $updates ) {
list( $normalized_version ) = explode( '-', $wp_version );
echo '<p>' . sprintf(
/* translators: 1: URL to About screen, 2: WordPress version. */
__( '<a href="%1$s">Learn more about WordPress %2$s</a>.' ),
esc_url( self_admin_url( 'about.php' ) ),
$normalized_version
) . '</p>';
}
dismissed_updates();
}
```
| Uses | Description |
| --- | --- |
| [get\_core\_updates()](get_core_updates) wp-admin/includes/update.php | Gets available core updates. |
| [list\_core\_update()](list_core_update) wp-admin/update-core.php | Lists available core updates. |
| [dismissed\_updates()](dismissed_updates) wp-admin/update-core.php | Display dismissed updates. |
| [self\_admin\_url()](self_admin_url) wp-includes/link-template.php | Retrieves the URL to the admin area for either the current site or the network depending on context. |
| [\_e()](_e) wp-includes/l10n.php | Displays translated text. |
| [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. |
| [esc\_url()](esc_url) wp-includes/formatting.php | Checks and cleans a URL. |
| Version | Description |
| --- | --- |
| [2.7.0](https://developer.wordpress.org/reference/since/2.7.0/) | Introduced. |
wordpress wxr_site_url(): string wxr\_site\_url(): string
========================
Returns the URL of the site.
string Site URL.
File: `wp-admin/includes/export.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/export.php/)
```
function wxr_site_url() {
if ( is_multisite() ) {
// Multisite: the base URL.
return network_home_url();
} else {
// WordPress (single site): the blog URL.
return get_bloginfo_rss( 'url' );
}
}
```
| Uses | Description |
| --- | --- |
| [get\_bloginfo\_rss()](get_bloginfo_rss) wp-includes/feed.php | Retrieves RSS container for the bloginfo function. |
| [network\_home\_url()](network_home_url) wp-includes/link-template.php | Retrieves the home URL for the current network. |
| [is\_multisite()](is_multisite) wp-includes/load.php | If Multisite is enabled. |
| Used By | Description |
| --- | --- |
| [export\_wp()](export_wp) wp-admin/includes/export.php | Generates the WXR export file for download. |
| Version | Description |
| --- | --- |
| [2.5.0](https://developer.wordpress.org/reference/since/2.5.0/) | Introduced. |
wordpress _get_post_ancestors( WP_Post $post ) \_get\_post\_ancestors( WP\_Post $post )
========================================
This function has been deprecated. Use [get\_post\_ancestors()](get_post_ancestors) instead.
Retrieve post ancestors.
This is no longer needed as [WP\_Post](../classes/wp_post) lazy-loads the ancestors property with [get\_post\_ancestors()](get_post_ancestors) .
* [get\_post\_ancestors()](get_post_ancestors)
`$post` [WP\_Post](../classes/wp_post) Required Post object, passed by reference (unused). File: `wp-includes/deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/deprecated.php/)
```
function _get_post_ancestors( &$post ) {
_deprecated_function( __FUNCTION__, '3.5.0' );
}
```
| Uses | Description |
| --- | --- |
| [\_deprecated\_function()](_deprecated_function) wp-includes/functions.php | Marks a function as deprecated and inform when it has been used. |
| Version | Description |
| --- | --- |
| [3.5.0](https://developer.wordpress.org/reference/since/3.5.0/) | Use [get\_post\_ancestors()](get_post_ancestors) |
| [2.3.4](https://developer.wordpress.org/reference/since/2.3.4/) | Introduced. |
wordpress get_taxonomies_for_attachments( string $output = 'names' ): string[]|WP_Taxonomy[] get\_taxonomies\_for\_attachments( string $output = 'names' ): string[]|WP\_Taxonomy[]
======================================================================================
Retrieves all of the taxonomies that are registered for attachments.
Handles mime-type-specific taxonomies such as attachment:image and attachment:video.
* [get\_taxonomies()](get_taxonomies)
`$output` string Optional The type of taxonomy output to return. Accepts `'names'` or `'objects'`.
Default `'names'`. Default: `'names'`
string[]|[WP\_Taxonomy](../classes/wp_taxonomy)[] Array of names or objects of registered taxonomies for attachments.
File: `wp-includes/media.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/media.php/)
```
function get_taxonomies_for_attachments( $output = 'names' ) {
$taxonomies = array();
foreach ( get_taxonomies( array(), 'objects' ) as $taxonomy ) {
foreach ( $taxonomy->object_type as $object_type ) {
if ( 'attachment' === $object_type || 0 === strpos( $object_type, 'attachment:' ) ) {
if ( 'names' === $output ) {
$taxonomies[] = $taxonomy->name;
} else {
$taxonomies[ $taxonomy->name ] = $taxonomy;
}
break;
}
}
}
return $taxonomies;
}
```
| Uses | Description |
| --- | --- |
| [get\_taxonomies()](get_taxonomies) wp-includes/taxonomy.php | Retrieves a list of registered taxonomy names or objects. |
| Used By | Description |
| --- | --- |
| [wp\_ajax\_query\_attachments()](wp_ajax_query_attachments) wp-admin/includes/ajax-actions.php | Ajax handler for querying attachments. |
| [WP\_Media\_List\_Table::get\_columns()](../classes/wp_media_list_table/get_columns) wp-admin/includes/class-wp-media-list-table.php | |
| [WP\_Query::get\_posts()](../classes/wp_query/get_posts) wp-includes/class-wp-query.php | Retrieves an array of posts based on query variables. |
| Version | Description |
| --- | --- |
| [3.5.0](https://developer.wordpress.org/reference/since/3.5.0/) | Introduced. |
wordpress _wp_post_revision_fields( array|WP_Post $post = array(), bool $deprecated = false ): string[] \_wp\_post\_revision\_fields( array|WP\_Post $post = array(), bool $deprecated = false ): string[]
==================================================================================================
This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.
Determines which fields of posts are to be saved in revisions.
`$post` array|[WP\_Post](../classes/wp_post) Optional A post array or a [WP\_Post](../classes/wp_post) object being processed for insertion as a post revision. Default: `array()`
`$deprecated` bool Optional Not used. Default: `false`
string[] Array of fields that can be versioned.
File: `wp-includes/revision.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/revision.php/)
```
function _wp_post_revision_fields( $post = array(), $deprecated = false ) {
static $fields = null;
if ( ! is_array( $post ) ) {
$post = get_post( $post, ARRAY_A );
}
if ( is_null( $fields ) ) {
// Allow these to be versioned.
$fields = array(
'post_title' => __( 'Title' ),
'post_content' => __( 'Content' ),
'post_excerpt' => __( 'Excerpt' ),
);
}
/**
* Filters the list of fields saved in post revisions.
*
* Included by default: 'post_title', 'post_content' and 'post_excerpt'.
*
* Disallowed fields: 'ID', 'post_name', 'post_parent', 'post_date',
* 'post_date_gmt', 'post_status', 'post_type', 'comment_count',
* and 'post_author'.
*
* @since 2.6.0
* @since 4.5.0 The `$post` parameter was added.
*
* @param string[] $fields List of fields to revision. Contains 'post_title',
* 'post_content', and 'post_excerpt' by default.
* @param array $post A post array being processed for insertion as a post revision.
*/
$fields = apply_filters( '_wp_post_revision_fields', $fields, $post );
// WP uses these internally either in versioning or elsewhere - they cannot be versioned.
foreach ( array( 'ID', 'post_name', 'post_parent', 'post_date', 'post_date_gmt', 'post_status', 'post_type', 'comment_count', 'post_author' ) as $protect ) {
unset( $fields[ $protect ] );
}
return $fields;
}
```
[apply\_filters( '\_wp\_post\_revision\_fields', string[] $fields, array $post )](../hooks/_wp_post_revision_fields)
Filters the list of fields saved in post revisions.
| Uses | Description |
| --- | --- |
| [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| [get\_post()](get_post) wp-includes/post.php | Retrieves post data given a post ID or post object. |
| Used By | Description |
| --- | --- |
| [WP\_REST\_Autosaves\_Controller::create\_post\_autosave()](../classes/wp_rest_autosaves_controller/create_post_autosave) wp-includes/rest-api/endpoints/class-wp-rest-autosaves-controller.php | Creates autosave for the specified post. |
| [\_wp\_post\_revision\_data()](_wp_post_revision_data) wp-includes/revision.php | Returns a post array ready to be inserted into the posts table as a post revision. |
| [wp\_create\_post\_autosave()](wp_create_post_autosave) wp-admin/includes/post.php | Creates autosave data for the specified post from `$_POST` data. |
| [wp\_get\_revision\_ui\_diff()](wp_get_revision_ui_diff) wp-admin/includes/revision.php | Get the revision UI diff. |
| [wp\_restore\_post\_revision()](wp_restore_post_revision) wp-includes/revision.php | Restores a post to the specified revision. |
| [wp\_save\_post\_revision()](wp_save_post_revision) wp-includes/revision.php | Creates a revision for the current version of a post. |
| Version | Description |
| --- | --- |
| [4.5.0](https://developer.wordpress.org/reference/since/4.5.0/) | The optional `$autosave` parameter was deprecated and renamed to `$deprecated`. |
| [2.6.0](https://developer.wordpress.org/reference/since/2.6.0/) | Introduced. |
| programming_docs |
wordpress addslashes_gpc( string|array $gpc ): string|array addslashes\_gpc( string|array $gpc ): string|array
==================================================
Adds slashes to a string or recursively adds slashes to strings within an array.
`$gpc` string|array Required String or array of data to slash. string|array Slashed `$gpc`.
File: `wp-includes/formatting.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/formatting.php/)
```
function addslashes_gpc( $gpc ) {
return wp_slash( $gpc );
}
```
| Uses | Description |
| --- | --- |
| [wp\_slash()](wp_slash) wp-includes/formatting.php | Adds slashes to a string or recursively adds slashes to strings within an array. |
| Used By | Description |
| --- | --- |
| [WP\_Query::get\_posts()](../classes/wp_query/get_posts) wp-includes/class-wp-query.php | Retrieves an array of posts based on query variables. |
| Version | Description |
| --- | --- |
| [0.71](https://developer.wordpress.org/reference/since/0.71/) | Introduced. |
wordpress _truncate_post_slug( string $slug, int $length = 200 ): string \_truncate\_post\_slug( string $slug, int $length = 200 ): string
=================================================================
This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness. Use [utf8\_uri\_encode()](utf8_uri_encode) instead.
Truncates a post slug.
* [utf8\_uri\_encode()](utf8_uri_encode)
`$slug` string Required The slug to truncate. `$length` int Optional Max length of the slug. Default 200 (characters). Default: `200`
string The truncated slug.
File: `wp-includes/post.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/post.php/)
```
function _truncate_post_slug( $slug, $length = 200 ) {
if ( strlen( $slug ) > $length ) {
$decoded_slug = urldecode( $slug );
if ( $decoded_slug === $slug ) {
$slug = substr( $slug, 0, $length );
} else {
$slug = utf8_uri_encode( $decoded_slug, $length, true );
}
}
return rtrim( $slug, '-' );
}
```
| Uses | Description |
| --- | --- |
| [utf8\_uri\_encode()](utf8_uri_encode) wp-includes/formatting.php | Encodes the Unicode values to be used in the URI. |
| Used By | Description |
| --- | --- |
| [wp\_filter\_wp\_template\_unique\_post\_slug()](wp_filter_wp_template_unique_post_slug) wp-includes/theme-templates.php | Generates a unique slug for templates. |
| [wp\_add\_trashed\_suffix\_to\_post\_name\_for\_post()](wp_add_trashed_suffix_to_post_name_for_post) wp-includes/post.php | Adds a trashed suffix for a given post. |
| [wp\_unique\_post\_slug()](wp_unique_post_slug) wp-includes/post.php | Computes a unique slug for the post, when given the desired slug and some post details. |
| Version | Description |
| --- | --- |
| [3.6.0](https://developer.wordpress.org/reference/since/3.6.0/) | Introduced. |
wordpress wp_schedule_update_user_counts() wp\_schedule\_update\_user\_counts()
====================================
Schedules a recurring recalculation of the total count of users.
File: `wp-includes/user.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/user.php/)
```
function wp_schedule_update_user_counts() {
if ( ! is_main_site() ) {
return;
}
if ( ! wp_next_scheduled( 'wp_update_user_counts' ) && ! wp_installing() ) {
wp_schedule_event( time(), 'twicedaily', 'wp_update_user_counts' );
}
}
```
| Uses | Description |
| --- | --- |
| [wp\_installing()](wp_installing) wp-includes/load.php | Check or set whether WordPress is in “installation” mode. |
| [wp\_next\_scheduled()](wp_next_scheduled) wp-includes/cron.php | Retrieve the next timestamp for an event. |
| [wp\_schedule\_event()](wp_schedule_event) wp-includes/cron.php | Schedules a recurring event. |
| [is\_main\_site()](is_main_site) wp-includes/functions.php | Determines whether a site is the main site of the current network. |
| Version | Description |
| --- | --- |
| [6.0.0](https://developer.wordpress.org/reference/since/6.0.0/) | Introduced. |
wordpress wp_import_handle_upload(): array wp\_import\_handle\_upload(): array
===================================
Handles importer uploading and adds attachment.
array Uploaded file's details on success, error message on failure.
File: `wp-admin/includes/import.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/import.php/)
```
function wp_import_handle_upload() {
if ( ! isset( $_FILES['import'] ) ) {
return array(
'error' => sprintf(
/* translators: 1: php.ini, 2: post_max_size, 3: upload_max_filesize */
__( 'File is empty. Please upload something more substantial. This error could also be caused by uploads being disabled in your %1$s file or by %2$s being defined as smaller than %3$s in %1$s.' ),
'php.ini',
'post_max_size',
'upload_max_filesize'
),
);
}
$overrides = array(
'test_form' => false,
'test_type' => false,
);
$_FILES['import']['name'] .= '.txt';
$upload = wp_handle_upload( $_FILES['import'], $overrides );
if ( isset( $upload['error'] ) ) {
return $upload;
}
// Construct the attachment array.
$attachment = array(
'post_title' => wp_basename( $upload['file'] ),
'post_content' => $upload['url'],
'post_mime_type' => $upload['type'],
'guid' => $upload['url'],
'context' => 'import',
'post_status' => 'private',
);
// Save the data.
$id = wp_insert_attachment( $attachment, $upload['file'] );
/*
* Schedule a cleanup for one day from now in case of failed
* import or missing wp_import_cleanup() call.
*/
wp_schedule_single_event( time() + DAY_IN_SECONDS, 'importer_scheduled_cleanup', array( $id ) );
return array(
'file' => $upload['file'],
'id' => $id,
);
}
```
| Uses | Description |
| --- | --- |
| [wp\_handle\_upload()](wp_handle_upload) wp-admin/includes/file.php | Wrapper for [\_wp\_handle\_upload()](_wp_handle_upload) . |
| [wp\_schedule\_single\_event()](wp_schedule_single_event) wp-includes/cron.php | Schedules an event to run only once. |
| [wp\_insert\_attachment()](wp_insert_attachment) wp-includes/post.php | Inserts an attachment. |
| [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. |
| [wp\_basename()](wp_basename) wp-includes/formatting.php | i18n-friendly version of basename(). |
| Version | Description |
| --- | --- |
| [2.0.0](https://developer.wordpress.org/reference/since/2.0.0/) | Introduced. |
wordpress _deprecated_constructor( string $class, string $version, string $parent_class = '' ) \_deprecated\_constructor( string $class, string $version, string $parent\_class = '' )
=======================================================================================
Marks a constructor as deprecated and informs when it has been used.
Similar to [\_deprecated\_function()](_deprecated_function) , but with different strings. Used to remove PHP4 style constructors.
The current behavior is to trigger a user error if `WP_DEBUG` is true.
This function is to be used in every PHP4 style constructor method that is deprecated.
`$class` string Required The class containing the deprecated constructor. `$version` string Required The version of WordPress that deprecated the function. `$parent_class` string Optional The parent class calling the deprecated constructor.
Default: `''`
File: `wp-includes/functions.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/functions.php/)
```
function _deprecated_constructor( $class, $version, $parent_class = '' ) {
/**
* Fires when a deprecated constructor is called.
*
* @since 4.3.0
* @since 4.5.0 Added the `$parent_class` parameter.
*
* @param string $class The class containing the deprecated constructor.
* @param string $version The version of WordPress that deprecated the function.
* @param string $parent_class The parent class calling the deprecated constructor.
*/
do_action( 'deprecated_constructor_run', $class, $version, $parent_class );
/**
* Filters whether to trigger an error for deprecated functions.
*
* `WP_DEBUG` must be true in addition to the filter evaluating to true.
*
* @since 4.3.0
*
* @param bool $trigger Whether to trigger the error for deprecated functions. Default true.
*/
if ( WP_DEBUG && apply_filters( 'deprecated_constructor_trigger_error', true ) ) {
if ( function_exists( '__' ) ) {
if ( $parent_class ) {
trigger_error(
sprintf(
/* translators: 1: PHP class name, 2: PHP parent class name, 3: Version number, 4: __construct() method. */
__( 'The called constructor method for %1$s class in %2$s is <strong>deprecated</strong> since version %3$s! Use %4$s instead.' ),
$class,
$parent_class,
$version,
'<code>__construct()</code>'
),
E_USER_DEPRECATED
);
} else {
trigger_error(
sprintf(
/* translators: 1: PHP class name, 2: Version number, 3: __construct() method. */
__( 'The called constructor method for %1$s class is <strong>deprecated</strong> since version %2$s! Use %3$s instead.' ),
$class,
$version,
'<code>__construct()</code>'
),
E_USER_DEPRECATED
);
}
} else {
if ( $parent_class ) {
trigger_error(
sprintf(
'The called constructor method for %1$s class in %2$s is <strong>deprecated</strong> since version %3$s! Use %4$s instead.',
$class,
$parent_class,
$version,
'<code>__construct()</code>'
),
E_USER_DEPRECATED
);
} else {
trigger_error(
sprintf(
'The called constructor method for %1$s class is <strong>deprecated</strong> since version %2$s! Use %3$s instead.',
$class,
$version,
'<code>__construct()</code>'
),
E_USER_DEPRECATED
);
}
}
}
}
```
[do\_action( 'deprecated\_constructor\_run', string $class, string $version, string $parent\_class )](../hooks/deprecated_constructor_run)
Fires when a deprecated constructor is called.
[apply\_filters( 'deprecated\_constructor\_trigger\_error', bool $trigger )](../hooks/deprecated_constructor_trigger_error)
Filters whether to trigger an error for deprecated functions.
| Uses | Description |
| --- | --- |
| [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. |
| [do\_action()](do_action) wp-includes/plugin.php | Calls the callback functions that have been added to an action hook. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| Used By | Description |
| --- | --- |
| [POMO\_CachedFileReader::POMO\_CachedFileReader()](../classes/pomo_cachedfilereader/pomo_cachedfilereader) wp-includes/pomo/streams.php | PHP4 constructor. |
| [POMO\_CachedIntFileReader::POMO\_CachedIntFileReader()](../classes/pomo_cachedintfilereader/pomo_cachedintfilereader) wp-includes/pomo/streams.php | PHP4 constructor. |
| [POMO\_FileReader::POMO\_FileReader()](../classes/pomo_filereader/pomo_filereader) wp-includes/pomo/streams.php | PHP4 constructor. |
| [POMO\_StringReader::POMO\_StringReader()](../classes/pomo_stringreader/pomo_stringreader) wp-includes/pomo/streams.php | PHP4 constructor. |
| [POMO\_Reader::POMO\_Reader()](../classes/pomo_reader/pomo_reader) wp-includes/pomo/streams.php | PHP4 constructor. |
| [Translation\_Entry::Translation\_Entry()](../classes/translation_entry/translation_entry) wp-includes/pomo/entry.php | PHP4 constructor. |
| [WP\_Widget\_Factory::WP\_Widget\_Factory()](../classes/wp_widget_factory/wp_widget_factory) wp-includes/class-wp-widget-factory.php | PHP4 constructor. |
| [WP\_Widget::WP\_Widget()](../classes/wp_widget/wp_widget) wp-includes/class-wp-widget.php | PHP4 constructor. |
| Version | Description |
| --- | --- |
| [5.4.0](https://developer.wordpress.org/reference/since/5.4.0/) | The error type is now classified as E\_USER\_DEPRECATED (used to default to E\_USER\_NOTICE). |
| [4.5.0](https://developer.wordpress.org/reference/since/4.5.0/) | Added the `$parent_class` parameter. |
| [4.3.0](https://developer.wordpress.org/reference/since/4.3.0/) | Introduced. |
wordpress ms_load_current_site_and_network( string $domain, string $path, bool $subdomain = false ): bool|string ms\_load\_current\_site\_and\_network( string $domain, string $path, bool $subdomain = false ): bool|string
===========================================================================================================
This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.
Identifies the network and site of a requested domain and path and populates the corresponding network and site global objects as part of the multisite bootstrap process.
Prior to 4.6.0, this was a procedural block in `ms-settings.php`. It was wrapped into a function to facilitate unit tests. It should not be used outside of core.
Usually, it’s easier to query the site first, which then declares its network.
In limited situations, we either can or must find the network first.
If a network and site are found, a `true` response will be returned so that the request can continue.
If neither a network or site is found, `false` or a URL string will be returned so that either an error can be shown or a redirect can occur.
`$domain` string Required The requested domain. `$path` string Required The requested path. `$subdomain` bool Optional Whether a subdomain (true) or subdirectory (false) configuration.
Default: `false`
bool|string True if bootstrap successfully populated `$current_blog` and `$current_site`.
False if bootstrap could not be properly completed.
Redirect URL if parts exist, but the request as a whole can not be fulfilled.
File: `wp-includes/ms-load.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/ms-load.php/)
```
function ms_load_current_site_and_network( $domain, $path, $subdomain = false ) {
global $current_site, $current_blog;
// If the network is defined in wp-config.php, we can simply use that.
if ( defined( 'DOMAIN_CURRENT_SITE' ) && defined( 'PATH_CURRENT_SITE' ) ) {
$current_site = new stdClass;
$current_site->id = defined( 'SITE_ID_CURRENT_SITE' ) ? SITE_ID_CURRENT_SITE : 1;
$current_site->domain = DOMAIN_CURRENT_SITE;
$current_site->path = PATH_CURRENT_SITE;
if ( defined( 'BLOG_ID_CURRENT_SITE' ) ) {
$current_site->blog_id = BLOG_ID_CURRENT_SITE;
} elseif ( defined( 'BLOGID_CURRENT_SITE' ) ) { // Deprecated.
$current_site->blog_id = BLOGID_CURRENT_SITE;
}
if ( 0 === strcasecmp( $current_site->domain, $domain ) && 0 === strcasecmp( $current_site->path, $path ) ) {
$current_blog = get_site_by_path( $domain, $path );
} elseif ( '/' !== $current_site->path && 0 === strcasecmp( $current_site->domain, $domain ) && 0 === stripos( $path, $current_site->path ) ) {
// If the current network has a path and also matches the domain and path of the request,
// we need to look for a site using the first path segment following the network's path.
$current_blog = get_site_by_path( $domain, $path, 1 + count( explode( '/', trim( $current_site->path, '/' ) ) ) );
} else {
// Otherwise, use the first path segment (as usual).
$current_blog = get_site_by_path( $domain, $path, 1 );
}
} elseif ( ! $subdomain ) {
/*
* A "subdomain" installation can be re-interpreted to mean "can support any domain".
* If we're not dealing with one of these installations, then the important part is determining
* the network first, because we need the network's path to identify any sites.
*/
$current_site = wp_cache_get( 'current_network', 'site-options' );
if ( ! $current_site ) {
// Are there even two networks installed?
$networks = get_networks( array( 'number' => 2 ) );
if ( count( $networks ) === 1 ) {
$current_site = array_shift( $networks );
wp_cache_add( 'current_network', $current_site, 'site-options' );
} elseif ( empty( $networks ) ) {
// A network not found hook should fire here.
return false;
}
}
if ( empty( $current_site ) ) {
$current_site = WP_Network::get_by_path( $domain, $path, 1 );
}
if ( empty( $current_site ) ) {
/**
* Fires when a network cannot be found based on the requested domain and path.
*
* At the time of this action, the only recourse is to redirect somewhere
* and exit. If you want to declare a particular network, do so earlier.
*
* @since 4.4.0
*
* @param string $domain The domain used to search for a network.
* @param string $path The path used to search for a path.
*/
do_action( 'ms_network_not_found', $domain, $path );
return false;
} elseif ( $path === $current_site->path ) {
$current_blog = get_site_by_path( $domain, $path );
} else {
// Search the network path + one more path segment (on top of the network path).
$current_blog = get_site_by_path( $domain, $path, substr_count( $current_site->path, '/' ) );
}
} else {
// Find the site by the domain and at most the first path segment.
$current_blog = get_site_by_path( $domain, $path, 1 );
if ( $current_blog ) {
$current_site = WP_Network::get_instance( $current_blog->site_id ? $current_blog->site_id : 1 );
} else {
// If you don't have a site with the same domain/path as a network, you're pretty screwed, but:
$current_site = WP_Network::get_by_path( $domain, $path, 1 );
}
}
// The network declared by the site trumps any constants.
if ( $current_blog && $current_blog->site_id != $current_site->id ) {
$current_site = WP_Network::get_instance( $current_blog->site_id );
}
// No network has been found, bail.
if ( empty( $current_site ) ) {
/** This action is documented in wp-includes/ms-settings.php */
do_action( 'ms_network_not_found', $domain, $path );
return false;
}
// During activation of a new subdomain, the requested site does not yet exist.
if ( empty( $current_blog ) && wp_installing() ) {
$current_blog = new stdClass;
$current_blog->blog_id = 1;
$blog_id = 1;
$current_blog->public = 1;
}
// No site has been found, bail.
if ( empty( $current_blog ) ) {
// We're going to redirect to the network URL, with some possible modifications.
$scheme = is_ssl() ? 'https' : 'http';
$destination = "$scheme://{$current_site->domain}{$current_site->path}";
/**
* Fires when a network can be determined but a site cannot.
*
* At the time of this action, the only recourse is to redirect somewhere
* and exit. If you want to declare a particular site, do so earlier.
*
* @since 3.9.0
*
* @param WP_Network $current_site The network that had been determined.
* @param string $domain The domain used to search for a site.
* @param string $path The path used to search for a site.
*/
do_action( 'ms_site_not_found', $current_site, $domain, $path );
if ( $subdomain && ! defined( 'NOBLOGREDIRECT' ) ) {
// For a "subdomain" installation, redirect to the signup form specifically.
$destination .= 'wp-signup.php?new=' . str_replace( '.' . $current_site->domain, '', $domain );
} elseif ( $subdomain ) {
/*
* For a "subdomain" installation, the NOBLOGREDIRECT constant
* can be used to avoid a redirect to the signup form.
* Using the ms_site_not_found action is preferred to the constant.
*/
if ( '%siteurl%' !== NOBLOGREDIRECT ) {
$destination = NOBLOGREDIRECT;
}
} elseif ( 0 === strcasecmp( $current_site->domain, $domain ) ) {
/*
* If the domain we were searching for matches the network's domain,
* it's no use redirecting back to ourselves -- it'll cause a loop.
* As we couldn't find a site, we're simply not installed.
*/
return false;
}
return $destination;
}
// Figure out the current network's main site.
if ( empty( $current_site->blog_id ) ) {
$current_site->blog_id = get_main_site_id( $current_site->id );
}
return true;
}
```
[do\_action( 'ms\_network\_not\_found', string $domain, string $path )](../hooks/ms_network_not_found)
Fires when a network cannot be found based on the requested domain and path.
[do\_action( 'ms\_site\_not\_found', WP\_Network $current\_site, string $domain, string $path )](../hooks/ms_site_not_found)
Fires when a network can be determined but a site cannot.
| Uses | Description |
| --- | --- |
| [stripos()](stripos) wp-includes/class-pop3.php | |
| [get\_main\_site\_id()](get_main_site_id) wp-includes/functions.php | Gets the main site ID. |
| [get\_networks()](get_networks) wp-includes/ms-network.php | Retrieves a list of networks. |
| [WP\_Network::get\_by\_path()](../classes/wp_network/get_by_path) wp-includes/class-wp-network.php | Retrieves the closest matching network for a domain and path. |
| [WP\_Network::get\_instance()](../classes/wp_network/get_instance) wp-includes/class-wp-network.php | Retrieves a network from the database by its ID. |
| [wp\_installing()](wp_installing) wp-includes/load.php | Check or set whether WordPress is in “installation” mode. |
| [wp\_cache\_add()](wp_cache_add) wp-includes/cache.php | Adds data to the cache, if the cache key doesn’t already exist. |
| [is\_ssl()](is_ssl) wp-includes/load.php | Determines if SSL is used. |
| [get\_site\_by\_path()](get_site_by_path) wp-includes/ms-load.php | Retrieves the closest matching site object by its domain and path. |
| [wp\_cache\_get()](wp_cache_get) wp-includes/cache.php | Retrieves the cache contents from the cache by key and group. |
| [do\_action()](do_action) wp-includes/plugin.php | Calls the callback functions that have been added to an action hook. |
| Version | Description |
| --- | --- |
| [4.6.0](https://developer.wordpress.org/reference/since/4.6.0/) | Introduced. |
| programming_docs |
wordpress get_network( WP_Network|int|null $network = null ): WP_Network|null get\_network( WP\_Network|int|null $network = null ): WP\_Network|null
======================================================================
Retrieves network data given a network ID or network object.
Network data will be cached and returned after being passed through a filter.
If the provided network is empty, the current network global will be used.
`$network` [WP\_Network](../classes/wp_network)|int|null Optional Network to retrieve. Default is the current network. Default: `null`
[WP\_Network](../classes/wp_network)|null The network object or null if not found.
File: `wp-includes/ms-network.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/ms-network.php/)
```
function get_network( $network = null ) {
global $current_site;
if ( empty( $network ) && isset( $current_site ) ) {
$network = $current_site;
}
if ( $network instanceof WP_Network ) {
$_network = $network;
} elseif ( is_object( $network ) ) {
$_network = new WP_Network( $network );
} else {
$_network = WP_Network::get_instance( $network );
}
if ( ! $_network ) {
return null;
}
/**
* Fires after a network is retrieved.
*
* @since 4.6.0
*
* @param WP_Network $_network Network data.
*/
$_network = apply_filters( 'get_network', $_network );
return $_network;
}
```
[apply\_filters( 'get\_network', WP\_Network $\_network )](../hooks/get_network)
Fires after a network is retrieved.
| Uses | Description |
| --- | --- |
| [WP\_Network::\_\_construct()](../classes/wp_network/__construct) wp-includes/class-wp-network.php | Creates a new [WP\_Network](../classes/wp_network) object. |
| [WP\_Network::get\_instance()](../classes/wp_network/get_instance) wp-includes/class-wp-network.php | Retrieves a network from the database by its ID. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| Used By | Description |
| --- | --- |
| [wpmu\_new\_site\_admin\_notification()](wpmu_new_site_admin_notification) wp-includes/ms-functions.php | Notifies the Multisite network administrator that a new site was created. |
| [wp\_initialize\_site()](wp_initialize_site) wp-includes/ms-site.php | Runs the initialization routine for a given site. |
| [get\_oembed\_response\_data\_for\_url()](get_oembed_response_data_for_url) wp-includes/embed.php | Retrieves the oEmbed response data for a given URL. |
| [get\_main\_site\_id()](get_main_site_id) wp-includes/functions.php | Gets the main site ID. |
| [get\_current\_network\_id()](get_current_network_id) wp-includes/load.php | Retrieves the current network ID. |
| [WP\_Network\_Query::get\_networks()](../classes/wp_network_query/get_networks) wp-includes/class-wp-network-query.php | Gets a list of networks matching the query vars. |
| [get\_main\_network\_id()](get_main_network_id) wp-includes/functions.php | Gets the main network ID. |
| [WP\_MS\_Sites\_List\_Table::handle\_row\_actions()](../classes/wp_ms_sites_list_table/handle_row_actions) wp-admin/includes/class-wp-ms-sites-list-table.php | Generates and displays row action links. |
| [WP\_MS\_Users\_List\_Table::column\_blogs()](../classes/wp_ms_users_list_table/column_blogs) wp-admin/includes/class-wp-ms-users-list-table.php | Handles the sites column output. |
| [retrieve\_password()](retrieve_password) wp-includes/user.php | Handles sending a password retrieval email to a user. |
| [signup\_another\_blog()](signup_another_blog) wp-signup.php | Shows a form for returning users to sign up for another site. |
| [signup\_user()](signup_user) wp-signup.php | Shows a form for a visitor to sign up for a new user account. |
| [show\_blog\_form()](show_blog_form) wp-signup.php | Generates and displays the Sign-up and Create Site forms. |
| [wpmu\_delete\_blog()](wpmu_delete_blog) wp-admin/includes/ms.php | Delete a site. |
| [populate\_network()](populate_network) wp-admin/includes/schema.php | Populate network settings. |
| [wp\_install\_defaults()](wp_install_defaults) wp-admin/includes/upgrade.php | Creates the initial content for a newly-installed site. |
| [network\_site\_url()](network_site_url) wp-includes/link-template.php | Retrieves the site URL for the current network. |
| [network\_home\_url()](network_home_url) wp-includes/link-template.php | Retrieves the home URL for the current network. |
| [ms\_allowed\_http\_request\_hosts()](ms_allowed_http_request_hosts) wp-includes/http.php | Adds any domain in a multisite installation for safe HTTP requests to the allowed list. |
| [wp\_admin\_bar\_site\_menu()](wp_admin_bar_site_menu) wp-includes/admin-bar.php | Adds the “Site Name” menu. |
| [add\_new\_user\_to\_blog()](add_new_user_to_blog) wp-includes/ms-functions.php | Adds a newly created user to the appropriate blog |
| [fix\_phpmailer\_messageid()](fix_phpmailer_messageid) wp-includes/ms-functions.php | Corrects From host on outgoing mail to match the site domain |
| [wpmu\_welcome\_user\_notification()](wpmu_welcome_user_notification) wp-includes/ms-functions.php | Notifies a user that their account activation has been successful. |
| [redirect\_this\_site()](redirect_this_site) wp-includes/ms-functions.php | Ensures that the current site’s domain is listed in the allowed redirect host list. |
| [install\_blog()](install_blog) wp-includes/ms-deprecated.php | Install an empty blog. |
| [wpmu\_welcome\_notification()](wpmu_welcome_notification) wp-includes/ms-functions.php | Notifies the site administrator that their site activation was successful. |
| [wpmu\_validate\_blog\_signup()](wpmu_validate_blog_signup) wp-includes/ms-functions.php | Processes new site registrations. |
| [wp\_get\_network()](wp_get_network) wp-includes/ms-load.php | Retrieves an object containing information about the requested network. |
| [ms\_site\_check()](ms_site_check) wp-includes/ms-load.php | Checks status of current blog. |
| [get\_dashboard\_blog()](get_dashboard_blog) wp-includes/ms-deprecated.php | Get the “dashboard blog”, the blog where users without a blog edit their profile data. |
| [get\_id\_from\_blogname()](get_id_from_blogname) wp-includes/ms-blogs.php | Retrieves a site’s ID given its (subdomain or directory) slug. |
| [ms\_cookie\_constants()](ms_cookie_constants) wp-includes/ms-default-constants.php | Defines Multisite cookie constants. |
| Version | Description |
| --- | --- |
| [4.6.0](https://developer.wordpress.org/reference/since/4.6.0/) | Introduced. |
wordpress get_linkcatname( int $id ): string get\_linkcatname( int $id ): string
===================================
This function has been deprecated. Use [get\_category()](get_category) instead.
Gets the name of category by ID.
* [get\_category()](get_category)
`$id` int Required The category to get. If no category supplied uses 0 string
File: `wp-includes/deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/deprecated.php/)
```
function get_linkcatname($id = 0) {
_deprecated_function( __FUNCTION__, '2.1.0', 'get_category()' );
$id = (int) $id;
if ( empty($id) )
return '';
$cats = wp_get_link_cats($id);
if ( empty($cats) || ! is_array($cats) )
return '';
$cat_id = (int) $cats[0]; // Take the first cat.
$cat = get_category($cat_id);
return $cat->name;
}
```
| Uses | Description |
| --- | --- |
| [wp\_get\_link\_cats()](wp_get_link_cats) wp-admin/includes/bookmark.php | Retrieves the link category IDs associated with the link specified. |
| [get\_category()](get_category) wp-includes/category.php | Retrieves category data given a category ID or category object. |
| [\_deprecated\_function()](_deprecated_function) wp-includes/functions.php | Marks a function as deprecated and inform when it has been used. |
| Version | Description |
| --- | --- |
| [2.1.0](https://developer.wordpress.org/reference/since/2.1.0/) | Use [get\_category()](get_category) |
| [0.71](https://developer.wordpress.org/reference/since/0.71/) | Introduced. |
wordpress wp_ajax_upload_attachment() wp\_ajax\_upload\_attachment()
==============================
Ajax handler for uploading attachments
File: `wp-admin/includes/ajax-actions.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/ajax-actions.php/)
```
function wp_ajax_upload_attachment() {
check_ajax_referer( 'media-form' );
/*
* This function does not use wp_send_json_success() / wp_send_json_error()
* as the html4 Plupload handler requires a text/html content-type for older IE.
* See https://core.trac.wordpress.org/ticket/31037
*/
if ( ! current_user_can( 'upload_files' ) ) {
echo wp_json_encode(
array(
'success' => false,
'data' => array(
'message' => __( 'Sorry, you are not allowed to upload files.' ),
'filename' => esc_html( $_FILES['async-upload']['name'] ),
),
)
);
wp_die();
}
if ( isset( $_REQUEST['post_id'] ) ) {
$post_id = $_REQUEST['post_id'];
if ( ! current_user_can( 'edit_post', $post_id ) ) {
echo wp_json_encode(
array(
'success' => false,
'data' => array(
'message' => __( 'Sorry, you are not allowed to attach files to this post.' ),
'filename' => esc_html( $_FILES['async-upload']['name'] ),
),
)
);
wp_die();
}
} else {
$post_id = null;
}
$post_data = ! empty( $_REQUEST['post_data'] ) ? _wp_get_allowed_postdata( _wp_translate_postdata( false, (array) $_REQUEST['post_data'] ) ) : array();
if ( is_wp_error( $post_data ) ) {
wp_die( $post_data->get_error_message() );
}
// If the context is custom header or background, make sure the uploaded file is an image.
if ( isset( $post_data['context'] ) && in_array( $post_data['context'], array( 'custom-header', 'custom-background' ), true ) ) {
$wp_filetype = wp_check_filetype_and_ext( $_FILES['async-upload']['tmp_name'], $_FILES['async-upload']['name'] );
if ( ! wp_match_mime_types( 'image', $wp_filetype['type'] ) ) {
echo wp_json_encode(
array(
'success' => false,
'data' => array(
'message' => __( 'The uploaded file is not a valid image. Please try again.' ),
'filename' => esc_html( $_FILES['async-upload']['name'] ),
),
)
);
wp_die();
}
}
$attachment_id = media_handle_upload( 'async-upload', $post_id, $post_data );
if ( is_wp_error( $attachment_id ) ) {
echo wp_json_encode(
array(
'success' => false,
'data' => array(
'message' => $attachment_id->get_error_message(),
'filename' => esc_html( $_FILES['async-upload']['name'] ),
),
)
);
wp_die();
}
if ( isset( $post_data['context'] ) && isset( $post_data['theme'] ) ) {
if ( 'custom-background' === $post_data['context'] ) {
update_post_meta( $attachment_id, '_wp_attachment_is_custom_background', $post_data['theme'] );
}
if ( 'custom-header' === $post_data['context'] ) {
update_post_meta( $attachment_id, '_wp_attachment_is_custom_header', $post_data['theme'] );
}
}
$attachment = wp_prepare_attachment_for_js( $attachment_id );
if ( ! $attachment ) {
wp_die();
}
echo wp_json_encode(
array(
'success' => true,
'data' => $attachment,
)
);
wp_die();
}
```
| Uses | Description |
| --- | --- |
| [\_wp\_get\_allowed\_postdata()](_wp_get_allowed_postdata) wp-admin/includes/post.php | Returns only allowed post data fields. |
| [media\_handle\_upload()](media_handle_upload) wp-admin/includes/media.php | Saves a file submitted from a POST request and create an attachment post for it. |
| [\_wp\_translate\_postdata()](_wp_translate_postdata) wp-admin/includes/post.php | Renames `$_POST` data from form names to DB post columns. |
| [wp\_check\_filetype\_and\_ext()](wp_check_filetype_and_ext) wp-includes/functions.php | Attempts to determine the real file type of a file. |
| [wp\_prepare\_attachment\_for\_js()](wp_prepare_attachment_for_js) wp-includes/media.php | Prepares an attachment post object for JS, where it is expected to be JSON-encoded and fit into an Attachment model. |
| [wp\_match\_mime\_types()](wp_match_mime_types) wp-includes/post.php | Checks a MIME-Type against a list. |
| [update\_post\_meta()](update_post_meta) wp-includes/post.php | Updates a post meta field based on the given post ID. |
| [wp\_json\_encode()](wp_json_encode) wp-includes/functions.php | Encodes a variable into JSON, with some sanity checks. |
| [current\_user\_can()](current_user_can) wp-includes/capabilities.php | Returns whether the current user has the specified capability. |
| [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. |
| [esc\_html()](esc_html) wp-includes/formatting.php | Escaping for HTML blocks. |
| [check\_ajax\_referer()](check_ajax_referer) wp-includes/pluggable.php | Verifies the Ajax request to prevent processing requests external of the blog. |
| [wp\_die()](wp_die) wp-includes/functions.php | Kills WordPress execution and displays HTML page with an error message. |
| [is\_wp\_error()](is_wp_error) wp-includes/load.php | Checks whether the given variable is a WordPress Error. |
| Version | Description |
| --- | --- |
| [3.3.0](https://developer.wordpress.org/reference/since/3.3.0/) | Introduced. |
wordpress wp_list_users( string|array $args = array() ): string|null wp\_list\_users( string|array $args = array() ): string|null
============================================================
Lists all the users of the site, with several options available.
`$args` string|array Optional Array or string of default arguments.
* `orderby`stringHow to sort the users. Accepts `'nicename'`, `'email'`, `'url'`, `'registered'`, `'user_nicename'`, `'user_email'`, `'user_url'`, `'user_registered'`, `'name'`, `'display_name'`, `'post_count'`, `'ID'`, `'meta_value'`, `'user_login'`. Default `'name'`.
* `order`stringSorting direction for $orderby. Accepts `'ASC'`, `'DESC'`. Default `'ASC'`.
* `number`intMaximum users to return or display. Default empty (all users).
* `exclude_admin`boolWhether to exclude the `'admin'` account, if it exists. Default false.
* `show_fullname`boolWhether to show the user's full name. Default false.
* `feed`stringIf not empty, show a link to the user's feed and use this text as the alt parameter of the link.
* `feed_image`stringIf not empty, show a link to the user's feed and use this image URL as clickable anchor.
* `feed_type`stringThe feed type to link to, such as `'rss2'`. Defaults to default feed type.
* `echo`boolWhether to output the result or instead return it. Default true.
* `style`stringIf `'list'`, each user is wrapped in an `<li>` element, otherwise the users will be separated by commas.
* `html`boolWhether to list the items in HTML form or plaintext. Default true.
* `exclude`stringAn array, comma-, or space-separated list of user IDs to exclude.
* `include`stringAn array, comma-, or space-separated list of user IDs to include.
Default: `array()`
string|null The output if echo is false. Otherwise null.
File: `wp-includes/user.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/user.php/)
```
function wp_list_users( $args = array() ) {
$defaults = array(
'orderby' => 'name',
'order' => 'ASC',
'number' => '',
'exclude_admin' => true,
'show_fullname' => false,
'feed' => '',
'feed_image' => '',
'feed_type' => '',
'echo' => true,
'style' => 'list',
'html' => true,
'exclude' => '',
'include' => '',
);
$parsed_args = wp_parse_args( $args, $defaults );
$return = '';
$query_args = wp_array_slice_assoc( $parsed_args, array( 'orderby', 'order', 'number', 'exclude', 'include' ) );
$query_args['fields'] = 'ids';
/**
* Filters the query arguments for the list of all users of the site.
*
* @since 6.1.0
*
* @param array $query_args The query arguments for get_users().
* @param array $parsed_args The arguments passed to wp_list_users() combined with the defaults.
*/
$query_args = apply_filters( 'wp_list_users_args', $query_args, $parsed_args );
$users = get_users( $query_args );
foreach ( $users as $user_id ) {
$user = get_userdata( $user_id );
if ( $parsed_args['exclude_admin'] && 'admin' === $user->display_name ) {
continue;
}
if ( $parsed_args['show_fullname'] && '' !== $user->first_name && '' !== $user->last_name ) {
$name = sprintf(
/* translators: 1: User's first name, 2: Last name. */
_x( '%1$s %2$s', 'Display name based on first name and last name' ),
$user->first_name,
$user->last_name
);
} else {
$name = $user->display_name;
}
if ( ! $parsed_args['html'] ) {
$return .= $name . ', ';
continue; // No need to go further to process HTML.
}
if ( 'list' === $parsed_args['style'] ) {
$return .= '<li>';
}
$row = $name;
if ( ! empty( $parsed_args['feed_image'] ) || ! empty( $parsed_args['feed'] ) ) {
$row .= ' ';
if ( empty( $parsed_args['feed_image'] ) ) {
$row .= '(';
}
$row .= '<a href="' . get_author_feed_link( $user->ID, $parsed_args['feed_type'] ) . '"';
$alt = '';
if ( ! empty( $parsed_args['feed'] ) ) {
$alt = ' alt="' . esc_attr( $parsed_args['feed'] ) . '"';
$name = $parsed_args['feed'];
}
$row .= '>';
if ( ! empty( $parsed_args['feed_image'] ) ) {
$row .= '<img src="' . esc_url( $parsed_args['feed_image'] ) . '" style="border: none;"' . $alt . ' />';
} else {
$row .= $name;
}
$row .= '</a>';
if ( empty( $parsed_args['feed_image'] ) ) {
$row .= ')';
}
}
$return .= $row;
$return .= ( 'list' === $parsed_args['style'] ) ? '</li>' : ', ';
}
$return = rtrim( $return, ', ' );
if ( ! $parsed_args['echo'] ) {
return $return;
}
echo $return;
}
```
[apply\_filters( 'wp\_list\_users\_args', array $query\_args, array $parsed\_args )](../hooks/wp_list_users_args)
Filters the query arguments for the list of all users of the site.
| Uses | Description |
| --- | --- |
| [get\_author\_feed\_link()](get_author_feed_link) wp-includes/link-template.php | Retrieves the feed link for a given author. |
| [wp\_array\_slice\_assoc()](wp_array_slice_assoc) wp-includes/functions.php | Extracts a slice of an array, given a list of keys. |
| [get\_users()](get_users) wp-includes/user.php | Retrieves list of users matching criteria. |
| [\_x()](_x) wp-includes/l10n.php | Retrieves translated string with gettext context. |
| [esc\_attr()](esc_attr) wp-includes/formatting.php | Escaping for HTML attributes. |
| [esc\_url()](esc_url) wp-includes/formatting.php | Checks and cleans a URL. |
| [get\_userdata()](get_userdata) wp-includes/pluggable.php | Retrieves user info by user ID. |
| [wp\_parse\_args()](wp_parse_args) wp-includes/functions.php | Merges user defined arguments into defaults array. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| Version | Description |
| --- | --- |
| [5.9.0](https://developer.wordpress.org/reference/since/5.9.0/) | Introduced. |
wordpress register_importer( string $id, string $name, string $description, callable $callback ): void|WP_Error register\_importer( string $id, string $name, string $description, callable $callback ): void|WP\_Error
=======================================================================================================
Registers importer for WordPress.
`$id` string Required Importer tag. Used to uniquely identify importer. `$name` string Required Importer name and title. `$description` string Required Importer description. `$callback` callable Required Callback to run. void|[WP\_Error](../classes/wp_error) Void on success. [WP\_Error](../classes/wp_error) when $callback is [WP\_Error](../classes/wp_error).
File: `wp-admin/includes/import.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/import.php/)
```
function register_importer( $id, $name, $description, $callback ) {
global $wp_importers;
if ( is_wp_error( $callback ) ) {
return $callback;
}
$wp_importers[ $id ] = array( $name, $description, $callback );
}
```
| Uses | Description |
| --- | --- |
| [is\_wp\_error()](is_wp_error) wp-includes/load.php | Checks whether the given variable is a WordPress Error. |
| Version | Description |
| --- | --- |
| [2.0.0](https://developer.wordpress.org/reference/since/2.0.0/) | Introduced. |
| programming_docs |
wordpress wp_remote_request( string $url, array $args = array() ): array|WP_Error wp\_remote\_request( string $url, array $args = array() ): array|WP\_Error
==========================================================================
Performs an HTTP request and returns its response.
There are other API functions available which abstract away the HTTP method:
* Default ‘GET’ for [wp\_remote\_get()](wp_remote_get)
* Default ‘POST’ for [wp\_remote\_post()](wp_remote_post)
* Default ‘HEAD’ for [wp\_remote\_head()](wp_remote_head)
* [WP\_Http::request()](../classes/wp_http/request): For information on default arguments.
`$url` string Required URL to retrieve. `$args` array Optional Request arguments. Default: `array()`
array|[WP\_Error](../classes/wp_error) The response array or a [WP\_Error](../classes/wp_error) on failure.
* `headers`string[]Array of response headers keyed by their name.
* `body`stringResponse body.
* `response`array Data about the HTTP response.
+ `code`int|falseHTTP response code.
+ `message`string|falseHTTP response message.
+ `cookies`[WP\_HTTP\_Cookie](../classes/wp_http_cookie)[]Array of response cookies.
+ `http_response`[WP\_HTTP\_Requests\_Response](../classes/wp_http_requests_response)|nullRaw HTTP response object. File: `wp-includes/http.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/http.php/)
```
function wp_remote_request( $url, $args = array() ) {
$http = _wp_http_get_object();
return $http->request( $url, $args );
}
```
| Uses | Description |
| --- | --- |
| [\_wp\_http\_get\_object()](_wp_http_get_object) wp-includes/http.php | Returns the initialized [WP\_Http](../classes/wp_http) Object |
| Used By | Description |
| --- | --- |
| [wp\_update\_https\_detection\_errors()](wp_update_https_detection_errors) wp-includes/https-detection.php | Runs a remote HTTPS request to detect whether HTTPS supported, and stores potential errors. |
| [WP\_Http::handle\_redirects()](../classes/wp_http/handle_redirects) wp-includes/class-wp-http.php | Handles an HTTP redirect and follows it if appropriate. |
| Version | Description |
| --- | --- |
| [2.7.0](https://developer.wordpress.org/reference/since/2.7.0/) | Introduced. |
wordpress user_can_edit_post( int $user_id, int $post_id, int $blog_id = 1 ): bool user\_can\_edit\_post( int $user\_id, int $post\_id, int $blog\_id = 1 ): bool
==============================================================================
This function has been deprecated. Use [current\_user\_can()](current_user_can) instead.
Whether user can edit a post.
* [current\_user\_can()](current_user_can)
`$user_id` int Required `$post_id` int Required `$blog_id` int Optional Not Used Default: `1`
bool
File: `wp-includes/deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/deprecated.php/)
```
function user_can_edit_post($user_id, $post_id, $blog_id = 1) {
_deprecated_function( __FUNCTION__, '2.0.0', 'current_user_can()' );
$author_data = get_userdata($user_id);
$post = get_post($post_id);
$post_author_data = get_userdata($post->post_author);
if ( (($user_id == $post_author_data->ID) && !($post->post_status == 'publish' && $author_data->user_level < 2))
|| ($author_data->user_level > $post_author_data->user_level)
|| ($author_data->user_level >= 10) ) {
return true;
} else {
return false;
}
}
```
| Uses | Description |
| --- | --- |
| [get\_userdata()](get_userdata) wp-includes/pluggable.php | Retrieves user info by user ID. |
| [\_deprecated\_function()](_deprecated_function) wp-includes/functions.php | Marks a function as deprecated and inform when it has been used. |
| [get\_post()](get_post) wp-includes/post.php | Retrieves post data given a post ID or post object. |
| Used By | Description |
| --- | --- |
| [user\_can\_delete\_post()](user_can_delete_post) wp-includes/deprecated.php | Whether user can delete a post. |
| [user\_can\_edit\_post\_date()](user_can_edit_post_date) wp-includes/deprecated.php | Whether user can delete a post. |
| [user\_can\_edit\_post\_comments()](user_can_edit_post_comments) wp-includes/deprecated.php | Whether user can delete a post. |
| Version | Description |
| --- | --- |
| [2.0.0](https://developer.wordpress.org/reference/since/2.0.0/) | Use [current\_user\_can()](current_user_can) |
| [1.5.0](https://developer.wordpress.org/reference/since/1.5.0/) | Introduced. |
wordpress wp_widgets_add_menu() wp\_widgets\_add\_menu()
========================
Appends the Widgets menu to the themes main menu.
File: `wp-includes/functions.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/functions.php/)
```
function wp_widgets_add_menu() {
global $submenu;
if ( ! current_theme_supports( 'widgets' ) ) {
return;
}
$menu_name = __( 'Widgets' );
if ( wp_is_block_theme() || current_theme_supports( 'block-template-parts' ) ) {
$submenu['themes.php'][] = array( $menu_name, 'edit_theme_options', 'widgets.php' );
} else {
$submenu['themes.php'][7] = array( $menu_name, 'edit_theme_options', 'widgets.php' );
}
ksort( $submenu['themes.php'], SORT_NUMERIC );
}
```
| Uses | Description |
| --- | --- |
| [wp\_is\_block\_theme()](wp_is_block_theme) wp-includes/theme.php | Returns whether the active theme is a block-based theme or not. |
| [current\_theme\_supports()](current_theme_supports) wp-includes/theme.php | Checks a theme’s support for a given feature. |
| [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. |
| Version | Description |
| --- | --- |
| [5.9.3](https://developer.wordpress.org/reference/since/5.9.3/) | Don't specify menu order when the active theme is a block theme. |
| [2.2.0](https://developer.wordpress.org/reference/since/2.2.0/) | Introduced. |
wordpress show_admin_bar( bool $show ) show\_admin\_bar( bool $show )
==============================
Sets the display status of the admin bar.
This can be called immediately upon plugin load. It does not need to be called from a function hooked to the [‘init’](../hooks/init) action.
`$show` bool Required Whether to allow the admin bar to show. This function should be called immediately upon plugin load or placed in the theme’s functions.php file.
This function will also affect the display of the Toolbar in the dashboard for WordPress versions prior to [Version 3.3](https://codex.wordpress.org/Version_3.3 "Version 3.3").
File: `wp-includes/admin-bar.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/admin-bar.php/)
```
function show_admin_bar( $show ) {
global $show_admin_bar;
$show_admin_bar = (bool) $show;
}
```
| Used By | Description |
| --- | --- |
| [iframe\_header()](iframe_header) wp-admin/includes/template.php | Generic Iframe header for use with Thickbox. |
| [WP\_Customize\_Manager::setup\_theme()](../classes/wp_customize_manager/setup_theme) wp-includes/class-wp-customize-manager.php | Starts preview and customize theme. |
| Version | Description |
| --- | --- |
| [3.1.0](https://developer.wordpress.org/reference/since/3.1.0/) | Introduced. |
wordpress wp_admin_bar_dashboard_view_site_menu( WP_Admin_Bar $wp_admin_bar ) wp\_admin\_bar\_dashboard\_view\_site\_menu( WP\_Admin\_Bar $wp\_admin\_bar )
=============================================================================
This function has been deprecated.
Add the “Dashboard”/”Visit Site” menu.
`$wp_admin_bar` [WP\_Admin\_Bar](../classes/wp_admin_bar) Required [WP\_Admin\_Bar](../classes/wp_admin_bar) instance. File: `wp-includes/deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/deprecated.php/)
```
function wp_admin_bar_dashboard_view_site_menu( $wp_admin_bar ) {
_deprecated_function( __FUNCTION__, '3.3.0' );
$user_id = get_current_user_id();
if ( 0 != $user_id ) {
if ( is_admin() )
$wp_admin_bar->add_menu( array( 'id' => 'view-site', 'title' => __( 'Visit Site' ), 'href' => home_url() ) );
elseif ( is_multisite() )
$wp_admin_bar->add_menu( array( 'id' => 'dashboard', 'title' => __( 'Dashboard' ), 'href' => get_dashboard_url( $user_id ) ) );
else
$wp_admin_bar->add_menu( array( 'id' => 'dashboard', 'title' => __( 'Dashboard' ), 'href' => admin_url() ) );
}
}
```
| Uses | Description |
| --- | --- |
| [get\_dashboard\_url()](get_dashboard_url) wp-includes/link-template.php | Retrieves the URL to the user’s dashboard. |
| [WP\_Admin\_Bar::add\_menu()](../classes/wp_admin_bar/add_menu) wp-includes/class-wp-admin-bar.php | Adds a node (menu item) to the admin bar menu. |
| [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. |
| [is\_admin()](is_admin) wp-includes/load.php | Determines whether the current request is for an administrative interface page. |
| [is\_multisite()](is_multisite) wp-includes/load.php | If Multisite is enabled. |
| [\_deprecated\_function()](_deprecated_function) wp-includes/functions.php | Marks a function as deprecated and inform when it has been used. |
| [admin\_url()](admin_url) wp-includes/link-template.php | Retrieves the URL to the admin area for the current site. |
| [home\_url()](home_url) wp-includes/link-template.php | Retrieves the URL for the current site where the front end is accessible. |
| [get\_current\_user\_id()](get_current_user_id) wp-includes/user.php | Gets the current user’s ID. |
| Version | Description |
| --- | --- |
| [3.3.0](https://developer.wordpress.org/reference/since/3.3.0/) | This function has been deprecated. |
| [3.2.0](https://developer.wordpress.org/reference/since/3.2.0/) | Introduced. |
wordpress populate_roles_260() populate\_roles\_260()
======================
Create and modify WordPress roles for WordPress 2.6.
File: `wp-admin/includes/schema.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/schema.php/)
```
function populate_roles_260() {
$role = get_role( 'administrator' );
if ( ! empty( $role ) ) {
$role->add_cap( 'update_plugins' );
$role->add_cap( 'delete_plugins' );
}
}
```
| Uses | Description |
| --- | --- |
| [get\_role()](get_role) wp-includes/capabilities.php | Retrieves role object. |
| Used By | Description |
| --- | --- |
| [populate\_roles()](populate_roles) wp-admin/includes/schema.php | Execute WordPress role creation for the various WordPress versions. |
| Version | Description |
| --- | --- |
| [2.6.0](https://developer.wordpress.org/reference/since/2.6.0/) | Introduced. |
wordpress get_theme_starter_content(): array get\_theme\_starter\_content(): array
=====================================
Expands a theme’s starter content configuration using core-provided data.
array Array of starter content.
File: `wp-includes/theme.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/theme.php/)
```
function get_theme_starter_content() {
$theme_support = get_theme_support( 'starter-content' );
if ( is_array( $theme_support ) && ! empty( $theme_support[0] ) && is_array( $theme_support[0] ) ) {
$config = $theme_support[0];
} else {
$config = array();
}
$core_content = array(
'widgets' => array(
'text_business_info' => array(
'text',
array(
'title' => _x( 'Find Us', 'Theme starter content' ),
'text' => implode(
'',
array(
'<strong>' . _x( 'Address', 'Theme starter content' ) . "</strong>\n",
_x( '123 Main Street', 'Theme starter content' ) . "\n",
_x( 'New York, NY 10001', 'Theme starter content' ) . "\n\n",
'<strong>' . _x( 'Hours', 'Theme starter content' ) . "</strong>\n",
_x( 'Monday–Friday: 9:00AM–5:00PM', 'Theme starter content' ) . "\n",
_x( 'Saturday & Sunday: 11:00AM–3:00PM', 'Theme starter content' ),
)
),
'filter' => true,
'visual' => true,
),
),
'text_about' => array(
'text',
array(
'title' => _x( 'About This Site', 'Theme starter content' ),
'text' => _x( 'This may be a good place to introduce yourself and your site or include some credits.', 'Theme starter content' ),
'filter' => true,
'visual' => true,
),
),
'archives' => array(
'archives',
array(
'title' => _x( 'Archives', 'Theme starter content' ),
),
),
'calendar' => array(
'calendar',
array(
'title' => _x( 'Calendar', 'Theme starter content' ),
),
),
'categories' => array(
'categories',
array(
'title' => _x( 'Categories', 'Theme starter content' ),
),
),
'meta' => array(
'meta',
array(
'title' => _x( 'Meta', 'Theme starter content' ),
),
),
'recent-comments' => array(
'recent-comments',
array(
'title' => _x( 'Recent Comments', 'Theme starter content' ),
),
),
'recent-posts' => array(
'recent-posts',
array(
'title' => _x( 'Recent Posts', 'Theme starter content' ),
),
),
'search' => array(
'search',
array(
'title' => _x( 'Search', 'Theme starter content' ),
),
),
),
'nav_menus' => array(
'link_home' => array(
'type' => 'custom',
'title' => _x( 'Home', 'Theme starter content' ),
'url' => home_url( '/' ),
),
'page_home' => array( // Deprecated in favor of 'link_home'.
'type' => 'post_type',
'object' => 'page',
'object_id' => '{{home}}',
),
'page_about' => array(
'type' => 'post_type',
'object' => 'page',
'object_id' => '{{about}}',
),
'page_blog' => array(
'type' => 'post_type',
'object' => 'page',
'object_id' => '{{blog}}',
),
'page_news' => array(
'type' => 'post_type',
'object' => 'page',
'object_id' => '{{news}}',
),
'page_contact' => array(
'type' => 'post_type',
'object' => 'page',
'object_id' => '{{contact}}',
),
'link_email' => array(
'title' => _x( 'Email', 'Theme starter content' ),
'url' => 'mailto:[email protected]',
),
'link_facebook' => array(
'title' => _x( 'Facebook', 'Theme starter content' ),
'url' => 'https://www.facebook.com/wordpress',
),
'link_foursquare' => array(
'title' => _x( 'Foursquare', 'Theme starter content' ),
'url' => 'https://foursquare.com/',
),
'link_github' => array(
'title' => _x( 'GitHub', 'Theme starter content' ),
'url' => 'https://github.com/wordpress/',
),
'link_instagram' => array(
'title' => _x( 'Instagram', 'Theme starter content' ),
'url' => 'https://www.instagram.com/explore/tags/wordcamp/',
),
'link_linkedin' => array(
'title' => _x( 'LinkedIn', 'Theme starter content' ),
'url' => 'https://www.linkedin.com/company/1089783',
),
'link_pinterest' => array(
'title' => _x( 'Pinterest', 'Theme starter content' ),
'url' => 'https://www.pinterest.com/',
),
'link_twitter' => array(
'title' => _x( 'Twitter', 'Theme starter content' ),
'url' => 'https://twitter.com/wordpress',
),
'link_yelp' => array(
'title' => _x( 'Yelp', 'Theme starter content' ),
'url' => 'https://www.yelp.com',
),
'link_youtube' => array(
'title' => _x( 'YouTube', 'Theme starter content' ),
'url' => 'https://www.youtube.com/channel/UCdof4Ju7amm1chz1gi1T2ZA',
),
),
'posts' => array(
'home' => array(
'post_type' => 'page',
'post_title' => _x( 'Home', 'Theme starter content' ),
'post_content' => sprintf(
"<!-- wp:paragraph -->\n<p>%s</p>\n<!-- /wp:paragraph -->",
_x( 'Welcome to your site! This is your homepage, which is what most visitors will see when they come to your site for the first time.', 'Theme starter content' )
),
),
'about' => array(
'post_type' => 'page',
'post_title' => _x( 'About', 'Theme starter content' ),
'post_content' => sprintf(
"<!-- wp:paragraph -->\n<p>%s</p>\n<!-- /wp:paragraph -->",
_x( 'You might be an artist who would like to introduce yourself and your work here or maybe you’re a business with a mission to describe.', 'Theme starter content' )
),
),
'contact' => array(
'post_type' => 'page',
'post_title' => _x( 'Contact', 'Theme starter content' ),
'post_content' => sprintf(
"<!-- wp:paragraph -->\n<p>%s</p>\n<!-- /wp:paragraph -->",
_x( 'This is a page with some basic contact information, such as an address and phone number. You might also try a plugin to add a contact form.', 'Theme starter content' )
),
),
'blog' => array(
'post_type' => 'page',
'post_title' => _x( 'Blog', 'Theme starter content' ),
),
'news' => array(
'post_type' => 'page',
'post_title' => _x( 'News', 'Theme starter content' ),
),
'homepage-section' => array(
'post_type' => 'page',
'post_title' => _x( 'A homepage section', 'Theme starter content' ),
'post_content' => sprintf(
"<!-- wp:paragraph -->\n<p>%s</p>\n<!-- /wp:paragraph -->",
_x( 'This is an example of a homepage section. Homepage sections can be any page other than the homepage itself, including the page that shows your latest blog posts.', 'Theme starter content' )
),
),
),
);
$content = array();
foreach ( $config as $type => $args ) {
switch ( $type ) {
// Use options and theme_mods as-is.
case 'options':
case 'theme_mods':
$content[ $type ] = $config[ $type ];
break;
// Widgets are grouped into sidebars.
case 'widgets':
foreach ( $config[ $type ] as $sidebar_id => $widgets ) {
foreach ( $widgets as $id => $widget ) {
if ( is_array( $widget ) ) {
// Item extends core content.
if ( ! empty( $core_content[ $type ][ $id ] ) ) {
$widget = array(
$core_content[ $type ][ $id ][0],
array_merge( $core_content[ $type ][ $id ][1], $widget ),
);
}
$content[ $type ][ $sidebar_id ][] = $widget;
} elseif ( is_string( $widget )
&& ! empty( $core_content[ $type ] )
&& ! empty( $core_content[ $type ][ $widget ] )
) {
$content[ $type ][ $sidebar_id ][] = $core_content[ $type ][ $widget ];
}
}
}
break;
// And nav menu items are grouped into nav menus.
case 'nav_menus':
foreach ( $config[ $type ] as $nav_menu_location => $nav_menu ) {
// Ensure nav menus get a name.
if ( empty( $nav_menu['name'] ) ) {
$nav_menu['name'] = $nav_menu_location;
}
$content[ $type ][ $nav_menu_location ]['name'] = $nav_menu['name'];
foreach ( $nav_menu['items'] as $id => $nav_menu_item ) {
if ( is_array( $nav_menu_item ) ) {
// Item extends core content.
if ( ! empty( $core_content[ $type ][ $id ] ) ) {
$nav_menu_item = array_merge( $core_content[ $type ][ $id ], $nav_menu_item );
}
$content[ $type ][ $nav_menu_location ]['items'][] = $nav_menu_item;
} elseif ( is_string( $nav_menu_item )
&& ! empty( $core_content[ $type ] )
&& ! empty( $core_content[ $type ][ $nav_menu_item ] )
) {
$content[ $type ][ $nav_menu_location ]['items'][] = $core_content[ $type ][ $nav_menu_item ];
}
}
}
break;
// Attachments are posts but have special treatment.
case 'attachments':
foreach ( $config[ $type ] as $id => $item ) {
if ( ! empty( $item['file'] ) ) {
$content[ $type ][ $id ] = $item;
}
}
break;
// All that's left now are posts (besides attachments).
// Not a default case for the sake of clarity and future work.
case 'posts':
foreach ( $config[ $type ] as $id => $item ) {
if ( is_array( $item ) ) {
// Item extends core content.
if ( ! empty( $core_content[ $type ][ $id ] ) ) {
$item = array_merge( $core_content[ $type ][ $id ], $item );
}
// Enforce a subset of fields.
$content[ $type ][ $id ] = wp_array_slice_assoc(
$item,
array(
'post_type',
'post_title',
'post_excerpt',
'post_name',
'post_content',
'menu_order',
'comment_status',
'thumbnail',
'template',
)
);
} elseif ( is_string( $item ) && ! empty( $core_content[ $type ][ $item ] ) ) {
$content[ $type ][ $item ] = $core_content[ $type ][ $item ];
}
}
break;
}
}
/**
* Filters the expanded array of starter content.
*
* @since 4.7.0
*
* @param array $content Array of starter content.
* @param array $config Array of theme-specific starter content configuration.
*/
return apply_filters( 'get_theme_starter_content', $content, $config );
}
```
[apply\_filters( 'get\_theme\_starter\_content', array $content, array $config )](../hooks/get_theme_starter_content)
Filters the expanded array of starter content.
| Uses | Description |
| --- | --- |
| [get\_theme\_support()](get_theme_support) wp-includes/theme.php | Gets the theme support arguments passed when registering that support. |
| [wp\_array\_slice\_assoc()](wp_array_slice_assoc) wp-includes/functions.php | Extracts a slice of an array, given a list of keys. |
| [\_x()](_x) wp-includes/l10n.php | Retrieves translated string with gettext context. |
| [home\_url()](home_url) wp-includes/link-template.php | Retrieves the URL for the current site where the front end is accessible. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| Used By | Description |
| --- | --- |
| [WP\_Customize\_Manager::import\_theme\_starter\_content()](../classes/wp_customize_manager/import_theme_starter_content) wp-includes/class-wp-customize-manager.php | Imports theme starter content into the customized state. |
| Version | Description |
| --- | --- |
| [4.7.0](https://developer.wordpress.org/reference/since/4.7.0/) | Introduced. |
| programming_docs |
wordpress wp_set_current_user( int|null $id, string $name = '' ): WP_User wp\_set\_current\_user( int|null $id, string $name = '' ): WP\_User
===================================================================
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. Therefore, it opens the ability to edit and perform actions on users who aren’t signed in.
`$id` int|null Required User ID. `$name` string Optional User's username. Default: `''`
[WP\_User](../classes/wp_user) Current user User object.
This function can be replaced via plugins. If plugins do not redefine these functions, then this will be used instead.
File: `wp-includes/pluggable.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/pluggable.php/)
```
function wp_set_current_user( $id, $name = '' ) {
global $current_user;
// If `$id` matches the current user, there is nothing to do.
if ( isset( $current_user )
&& ( $current_user instanceof WP_User )
&& ( $id == $current_user->ID )
&& ( null !== $id )
) {
return $current_user;
}
$current_user = new WP_User( $id, $name );
setup_userdata( $current_user->ID );
/**
* Fires after the current user is set.
*
* @since 2.0.1
*/
do_action( 'set_current_user' );
return $current_user;
}
```
[do\_action( 'set\_current\_user' )](../hooks/set_current_user)
Fires after the current user is set.
| Uses | Description |
| --- | --- |
| [WP\_User::\_\_construct()](../classes/wp_user/__construct) wp-includes/class-wp-user.php | Constructor. |
| [setup\_userdata()](setup_userdata) wp-includes/user.php | Sets up global user vars. |
| [do\_action()](do_action) wp-includes/plugin.php | Calls the callback functions that have been added to an action hook. |
| Used By | Description |
| --- | --- |
| [WP\_Customize\_Manager::\_publish\_changeset\_values()](../classes/wp_customize_manager/_publish_changeset_values) wp-includes/class-wp-customize-manager.php | Publishes the values of a changeset. |
| [\_wp\_get\_current\_user()](_wp_get_current_user) wp-includes/user.php | Retrieves the current user object. |
| [rest\_cookie\_check\_errors()](rest_cookie_check_errors) wp-includes/rest-api.php | Checks for errors when using cookie-based authentication. |
| [WP\_Importer::set\_user()](../classes/wp_importer/set_user) wp-admin/includes/class-wp-importer.php | |
| [wp\_logout()](wp_logout) wp-includes/pluggable.php | Logs the current user out. |
| [set\_current\_user()](set_current_user) wp-includes/pluggable-deprecated.php | Changes the current user by ID or name. |
| [wp\_xmlrpc\_server::login()](../classes/wp_xmlrpc_server/login) wp-includes/class-wp-xmlrpc-server.php | Log user in. |
| Version | Description |
| --- | --- |
| [2.0.3](https://developer.wordpress.org/reference/since/2.0.3/) | Introduced. |
wordpress get_site_option( string $option, mixed $default = false, bool $deprecated = true ): mixed get\_site\_option( string $option, mixed $default = false, bool $deprecated = true ): mixed
===========================================================================================
Retrieve an option value for the current network based on name of option.
* [get\_network\_option()](get_network_option)
`$option` string Required Name of the option to retrieve. Expected to not be SQL-escaped. `$default` mixed Optional Value to return if the option doesn't exist. Default: `false`
`$deprecated` bool Optional Whether to use cache. Multisite only. Always set to true. Default: `true`
mixed Value set for the option.
This function is almost identical to [get\_option()](get_option) , except that in multisite, it returns the network-wide option. For non-multisite installs, it uses get\_option.
It is easy to get confused about the difference between [get\_option()](get_option) and [get\_site\_option()](get_site_option) , because multisite used different terms before. Now there are different “sites” on a “network”, before there where different “blogs” on a “site”. Many functions and variables were introduced before this change, such as this one. Think of this function as “get\_*network*\_option()“
File: `wp-includes/option.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/option.php/)
```
function get_site_option( $option, $default = false, $deprecated = true ) {
return get_network_option( null, $option, $default );
}
```
| Uses | Description |
| --- | --- |
| [get\_network\_option()](get_network_option) wp-includes/option.php | Retrieves a network’s option value based on the option name. |
| Used By | Description |
| --- | --- |
| [deactivated\_plugins\_notice()](deactivated_plugins_notice) wp-admin/includes/plugin.php | Renders an admin notice when a plugin was deactivated during an update. |
| [wpmu\_new\_site\_admin\_notification()](wpmu_new_site_admin_notification) wp-includes/ms-functions.php | Notifies the Multisite network administrator that a new site was created. |
| [core\_auto\_updates\_settings()](core_auto_updates_settings) wp-admin/update-core.php | Display WordPress auto-updates settings. |
| [WP\_Automatic\_Updater::send\_plugin\_theme\_email()](../classes/wp_automatic_updater/send_plugin_theme_email) wp-admin/includes/class-wp-automatic-updater.php | Sends an email upon the completion or failure of a plugin or theme background update. |
| [WP\_MS\_Themes\_List\_Table::column\_autoupdates()](../classes/wp_ms_themes_list_table/column_autoupdates) wp-admin/includes/class-wp-ms-themes-list-table.php | Handles the auto-updates column output. |
| [wp\_ajax\_toggle\_auto\_updates()](wp_ajax_toggle_auto_updates) wp-admin/includes/ajax-actions.php | Ajax handler to enable or disable plugin and theme auto-updates. |
| [WP\_Recovery\_Mode\_Cookie\_Service::recovery\_mode\_hash()](../classes/wp_recovery_mode_cookie_service/recovery_mode_hash) wp-includes/class-wp-recovery-mode-cookie-service.php | Gets a form of `wp_hash()` specific to Recovery Mode. |
| [WP\_Debug\_Data::debug\_data()](../classes/wp_debug_data/debug_data) wp-admin/includes/class-wp-debug-data.php | Static function for generating site debug data when required. |
| [WP\_Site\_Health\_Auto\_Updates::test\_if\_failed\_update()](../classes/wp_site_health_auto_updates/test_if_failed_update) wp-admin/includes/class-wp-site-health-auto-updates.php | Checks if automatic updates have tried to run, but failed, previously. |
| [populate\_network\_meta()](populate_network_meta) wp-admin/includes/schema.php | Creates WordPress network meta and sets the default values. |
| [WP\_REST\_Attachments\_Controller::check\_upload\_size()](../classes/wp_rest_attachments_controller/check_upload_size) wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php | Determine if uploaded file exceeds space quota on multisite. |
| [\_wp\_privacy\_send\_request\_confirmation\_notification()](_wp_privacy_send_request_confirmation_notification) wp-includes/user.php | Notifies the site administrator via email when a request is confirmed. |
| [update\_network\_option\_new\_admin\_email()](update_network_option_new_admin_email) wp-includes/ms-functions.php | Sends a confirmation request email when a change of network admin email address is attempted. |
| [wp\_network\_admin\_email\_change\_notification()](wp_network_admin_email_change_notification) wp-includes/ms-functions.php | Sends an email to the old network admin email address when the network admin email address changes. |
| [WP\_Theme::network\_enable\_theme()](../classes/wp_theme/network_enable_theme) wp-includes/class-wp-theme.php | Enables a theme for all sites on the current network. |
| [WP\_Theme::network\_disable\_theme()](../classes/wp_theme/network_disable_theme) wp-includes/class-wp-theme.php | Disables a theme for all sites on the current network. |
| [\_wp\_upload\_dir()](_wp_upload_dir) wp-includes/functions.php | A non-filtered, non-cached version of [wp\_upload\_dir()](wp_upload_dir) that doesn’t check the path. |
| [show\_blog\_form()](show_blog_form) wp-signup.php | Generates and displays the Sign-up and Create Site forms. |
| [network\_step2()](network_step2) wp-admin/includes/network.php | Prints step 2 for Network installation process. |
| [WP\_Automatic\_Updater::after\_core\_update()](../classes/wp_automatic_updater/after_core_update) wp-admin/includes/class-wp-automatic-updater.php | If we tried to perform a core update, check if we should send an email, and if we need to avoid processing future updates. |
| [WP\_Automatic\_Updater::send\_email()](../classes/wp_automatic_updater/send_email) wp-admin/includes/class-wp-automatic-updater.php | Sends an email upon the completion or failure of a background core update. |
| [WP\_Automatic\_Updater::send\_debug\_email()](../classes/wp_automatic_updater/send_debug_email) wp-admin/includes/class-wp-automatic-updater.php | Prepares and sends an email of a full log of background update results, useful for debugging and geekery. |
| [WP\_Automatic\_Updater::should\_update()](../classes/wp_automatic_updater/should_update) wp-admin/includes/class-wp-automatic-updater.php | Tests to see if we can and should update a specific item. |
| [WP\_Automatic\_Updater::send\_core\_update\_notification\_email()](../classes/wp_automatic_updater/send_core_update_notification_email) wp-admin/includes/class-wp-automatic-updater.php | Notifies an administrator of a core update. |
| [Core\_Upgrader::should\_update\_to\_version()](../classes/core_upgrader/should_update_to_version) wp-admin/includes/class-core-upgrader.php | Determines if this WordPress Core version should update to an offered version or not. |
| [wp\_prepare\_themes\_for\_js()](wp_prepare_themes_for_js) wp-admin/includes/theme.php | Prepares themes for JavaScript. |
| [WP\_Plugins\_List\_Table::single\_row()](../classes/wp_plugins_list_table/single_row) wp-admin/includes/class-wp-plugins-list-table.php | |
| [WP\_Plugins\_List\_Table::prepare\_items()](../classes/wp_plugins_list_table/prepare_items) wp-admin/includes/class-wp-plugins-list-table.php | |
| [site\_admin\_notice()](site_admin_notice) wp-admin/includes/ms.php | Displays an admin notice to upgrade all sites after a core upgrade. |
| [grant\_super\_admin()](grant_super_admin) wp-includes/capabilities.php | Grants Super Admin privileges. |
| [revoke\_super\_admin()](revoke_super_admin) wp-includes/capabilities.php | Revokes Super Admin privileges. |
| [upload\_is\_user\_over\_quota()](upload_is_user_over_quota) wp-admin/includes/ms.php | Check whether a site has used its allotted upload space. |
| [check\_upload\_size()](check_upload_size) wp-admin/includes/ms.php | Determine if uploaded file exceeds space quota. |
| [wpmu\_delete\_blog()](wpmu_delete_blog) wp-admin/includes/ms.php | Delete a site. |
| [WP\_MS\_Themes\_List\_Table::prepare\_items()](../classes/wp_ms_themes_list_table/prepare_items) wp-admin/includes/class-wp-ms-themes-list-table.php | |
| [maintenance\_nag()](maintenance_nag) wp-admin/includes/update.php | Displays maintenance nag HTML message. |
| [get\_core\_updates()](get_core_updates) wp-admin/includes/update.php | Gets available core updates. |
| [dismiss\_core\_update()](dismiss_core_update) wp-admin/includes/update.php | Dismisses core update. |
| [undismiss\_core\_update()](undismiss_core_update) wp-admin/includes/update.php | Undismisses core update. |
| [wp\_dashboard\_quota()](wp_dashboard_quota) wp-admin/includes/dashboard.php | Displays file upload quota on dashboard. |
| [upgrade\_network()](upgrade_network) wp-admin/includes/upgrade.php | Executes network-level upgrade routines. |
| [wp\_install\_defaults()](wp_install_defaults) wp-admin/includes/upgrade.php | Creates the initial content for a newly-installed site. |
| [is\_plugin\_active\_for\_network()](is_plugin_active_for_network) wp-admin/includes/plugin.php | Determines whether the plugin is active for the entire network. |
| [activate\_plugin()](activate_plugin) wp-admin/includes/plugin.php | Attempts activation of plugin in a “sandbox” and redirects on success. |
| [deactivate\_plugins()](deactivate_plugins) wp-admin/includes/plugin.php | Deactivates a single plugin or multiple plugins. |
| [validate\_active\_plugins()](validate_active_plugins) wp-admin/includes/plugin.php | Validates active plugins. |
| [WP\_Themes\_List\_Table::no\_items()](../classes/wp_themes_list_table/no_items) wp-admin/includes/class-wp-themes-list-table.php | |
| [list\_plugin\_updates()](list_plugin_updates) wp-admin/update-core.php | Display the upgrade plugins form. |
| [list\_theme\_updates()](list_theme_updates) wp-admin/update-core.php | Display the upgrade themes form. |
| [get\_super\_admins()](get_super_admins) wp-includes/capabilities.php | Retrieves a list of super admins. |
| [map\_meta\_cap()](map_meta_cap) wp-includes/capabilities.php | Maps a capability to the primitive capabilities required of the given user to satisfy the capability being checked. |
| [get\_locale()](get_locale) wp-includes/l10n.php | Retrieves the current locale. |
| [wp\_salt()](wp_salt) wp-includes/pluggable.php | Returns a salt to add to hashes. |
| [WP\_Theme::get\_allowed\_on\_network()](../classes/wp_theme/get_allowed_on_network) wp-includes/class-wp-theme.php | Returns array of stylesheet names of themes allowed on the network. |
| [wp\_cookie\_constants()](wp_cookie_constants) wp-includes/default-constants.php | Defines cookie-related WordPress constants. |
| [wp\_version\_check()](wp_version_check) wp-includes/update.php | Checks WordPress version against the newest version. |
| [set\_site\_transient()](set_site_transient) wp-includes/option.php | Sets/updates the value of a site transient. |
| [get\_site\_transient()](get_site_transient) wp-includes/option.php | Retrieves the value of a site transient. |
| [wp\_get\_user\_contact\_methods()](wp_get_user_contact_methods) wp-includes/user.php | Sets up the user contact methods. |
| [get\_space\_allowed()](get_space_allowed) wp-includes/ms-functions.php | Returns the upload quota for the current blog. |
| [get\_upload\_space\_available()](get_upload_space_available) wp-includes/ms-functions.php | Determines if there is any upload space left in the current blog’s quota. |
| [is\_upload\_space\_available()](is_upload_space_available) wp-includes/ms-functions.php | Determines if there is any upload space left in the current blog’s quota. |
| [upload\_size\_limit\_filter()](upload_size_limit_filter) wp-includes/ms-functions.php | Filters the maximum upload file size allowed, in bytes. |
| [users\_can\_register\_signup\_filter()](users_can_register_signup_filter) wp-includes/ms-functions.php | Determines whether users can self-register, based on Network settings. |
| [wpmu\_welcome\_user\_notification()](wpmu_welcome_user_notification) wp-includes/ms-functions.php | Notifies a user that their account activation has been successful. |
| [check\_upload\_mimes()](check_upload_mimes) wp-includes/ms-functions.php | Checks an array of MIME types against a list of allowed types. |
| [upload\_is\_file\_too\_big()](upload_is_file_too_big) wp-includes/ms-functions.php | Checks whether an upload is too big. |
| [install\_blog()](install_blog) wp-includes/ms-deprecated.php | Install an empty blog. |
| [newblog\_notify\_siteadmin()](newblog_notify_siteadmin) wp-includes/ms-functions.php | Notifies the network admin that a new site has been activated. |
| [newuser\_notify\_siteadmin()](newuser_notify_siteadmin) wp-includes/ms-functions.php | Notifies the network admin that a new user has been activated. |
| [wpmu\_welcome\_notification()](wpmu_welcome_notification) wp-includes/ms-functions.php | Notifies the site administrator that their site activation was successful. |
| [is\_email\_address\_unsafe()](is_email_address_unsafe) wp-includes/ms-functions.php | Checks an email address against a list of banned domains. |
| [wpmu\_validate\_user\_signup()](wpmu_validate_user_signup) wp-includes/ms-functions.php | Sanitizes and validates data required for a user sign-up. |
| [wpmu\_validate\_blog\_signup()](wpmu_validate_blog_signup) wp-includes/ms-functions.php | Processes new site registrations. |
| [wpmu\_signup\_blog\_notification()](wpmu_signup_blog_notification) wp-includes/ms-functions.php | Sends a confirmation request email to a user when they sign up for a new site. The new site will not become active until the confirmation link is clicked. |
| [wpmu\_signup\_user\_notification()](wpmu_signup_user_notification) wp-includes/ms-functions.php | Sends a confirmation request email to a user when they sign up for a new user account (without signing up for a site at the same time). The user account will not become active until the confirmation link is clicked. |
| [wp\_get\_active\_network\_plugins()](wp_get_active_network_plugins) wp-includes/ms-load.php | Returns array of network plugin files to be included in global scope. |
| [ms\_site\_check()](ms_site_check) wp-includes/ms-load.php | Checks status of current blog. |
| [get\_dashboard\_blog()](get_dashboard_blog) wp-includes/ms-deprecated.php | Get the “dashboard blog”, the blog where users without a blog edit their profile data. |
| [ms\_upload\_constants()](ms_upload_constants) wp-includes/ms-default-constants.php | Defines Multisite upload constants. |
| [script\_concat\_settings()](script_concat_settings) wp-includes/script-loader.php | Determines the concatenation and compression settings for scripts and styles. |
| Version | Description |
| --- | --- |
| [4.4.0](https://developer.wordpress.org/reference/since/4.4.0/) | Modified into wrapper for [get\_network\_option()](get_network_option) |
| [2.8.0](https://developer.wordpress.org/reference/since/2.8.0/) | Introduced. |
wordpress wp_delete_file( string $file ) wp\_delete\_file( string $file )
================================
Deletes a file.
`$file` string Required The path to the file to delete. File: `wp-includes/functions.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/functions.php/)
```
function wp_delete_file( $file ) {
/**
* Filters the path of the file to delete.
*
* @since 2.1.0
*
* @param string $file Path to the file to delete.
*/
$delete = apply_filters( 'wp_delete_file', $file );
if ( ! empty( $delete ) ) {
@unlink( $delete );
}
}
```
[apply\_filters( 'wp\_delete\_file', string $file )](../hooks/wp_delete_file)
Filters the path of the file to delete.
| Uses | Description |
| --- | --- |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| Used By | Description |
| --- | --- |
| [wp\_delete\_file\_from\_directory()](wp_delete_file_from_directory) wp-includes/functions.php | Deletes a file if its path is within the given directory. |
| [wp\_privacy\_generate\_personal\_data\_export\_file()](wp_privacy_generate_personal_data_export_file) wp-admin/includes/privacy-tools.php | Generate the personal data export file. |
| [wp\_ajax\_crop\_image()](wp_ajax_crop_image) wp-admin/includes/ajax-actions.php | Ajax handler for cropping an image. |
| [wp\_restore\_image()](wp_restore_image) wp-admin/includes/image-edit.php | Restores the metadata for a given attachment. |
| [wp\_save\_image()](wp_save_image) wp-admin/includes/image-edit.php | Saves image to post, along with enqueued changes in `$_REQUEST['history']`. |
| [Custom\_Image\_Header::step\_3()](../classes/custom_image_header/step_3) wp-admin/includes/class-custom-image-header.php | Display third step of custom header image page. |
| Version | Description |
| --- | --- |
| [4.2.0](https://developer.wordpress.org/reference/since/4.2.0/) | Introduced. |
| programming_docs |
wordpress add_media_page( string $page_title, string $menu_title, string $capability, string $menu_slug, callable $callback = '', int $position = null ): string|false add\_media\_page( string $page\_title, string $menu\_title, string $capability, string $menu\_slug, callable $callback = '', int $position = null ): string|false
=================================================================================================================================================================
Adds a submenu page to the Media main menu.
This function takes a capability which will be used to determine whether or not a page is included in the menu.
The function which is hooked in to handle the output of the page must check that the user has the required capability as well.
`$page_title` string Required The text to be displayed in the title tags of the page when the menu is selected. `$menu_title` string Required The text to be used for the menu. `$capability` string Required The capability required for this menu to be displayed to the user. `$menu_slug` string Required The slug name to refer to this menu by (should be unique for this menu). `$callback` callable Optional The function to be called to output the content for this page. Default: `''`
`$position` int Optional The position in the menu order this item should appear. Default: `null`
string|false The resulting page's hook\_suffix, or false if the user does not have the capability required.
##### Usage:
```
add_media_page( $page_title, $menu_title, $capability, $menu_slug, $function);
```
##### Notes:
* If you’re running into the »*You do not have sufficient permissions to access this page.*« message in a `wp_die()` screen, then you’ve hooked too early. The hook you should use is `admin_menu`.
* This function is a simple wrapper for a call to [add\_submenu\_page()](add_submenu_page) , passing the received arguments and specifying ‘`upload.php`‘ as the `$parent_slug` argument. This means the new page will be added as a sub-menu to the *Media* menu.
* The `$capability` parameter is used to determine whether or not the page is included in the menu based on the [Roles and Capabilities](https://wordpress.org/support/article/roles-and-capabilities/ "Roles and Capabilities")) of the current user.
* The function handling the output of the options page should also verify the user’s capabilities.
File: `wp-admin/includes/plugin.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/plugin.php/)
```
function add_media_page( $page_title, $menu_title, $capability, $menu_slug, $callback = '', $position = null ) {
return add_submenu_page( 'upload.php', $page_title, $menu_title, $capability, $menu_slug, $callback, $position );
}
```
| Uses | Description |
| --- | --- |
| [add\_submenu\_page()](add_submenu_page) wp-admin/includes/plugin.php | Adds a submenu page. |
| Version | Description |
| --- | --- |
| [5.3.0](https://developer.wordpress.org/reference/since/5.3.0/) | Added the `$position` parameter. |
| [2.7.0](https://developer.wordpress.org/reference/since/2.7.0/) | Introduced. |
wordpress wp_kses_html_error( string $string ): string wp\_kses\_html\_error( string $string ): string
===============================================
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.
`$string` string Required string
File: `wp-includes/kses.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/kses.php/)
```
function wp_kses_html_error( $string ) {
return preg_replace( '/^("[^"]*("|$)|\'[^\']*(\'|$)|\S)*\s*/', '', $string );
}
```
| Used By | Description |
| --- | --- |
| [wp\_kses\_hair()](wp_kses_hair) wp-includes/kses.php | Builds an attribute list from string containing attributes. |
| Version | Description |
| --- | --- |
| [1.0.0](https://developer.wordpress.org/reference/since/1.0.0/) | Introduced. |
wordpress insert_blog( string $domain, string $path, int $site_id ): int|false insert\_blog( string $domain, string $path, int $site\_id ): int|false
======================================================================
This function has been deprecated. Use [wp\_insert\_site()](wp_insert_site) instead.
Store basic site info in the blogs table.
This function creates a row in the wp\_blogs table and returns the new blog’s ID. It is the first step in creating a new blog.
* [wp\_insert\_site()](wp_insert_site)
`$domain` string Required The domain of the new site. `$path` string Required The path of the new site. `$site_id` int Required Unless you're running a multi-network install, be sure to set this value to 1. int|false The ID of the new row
File: `wp-includes/ms-deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/ms-deprecated.php/)
```
function insert_blog($domain, $path, $site_id) {
_deprecated_function( __FUNCTION__, '5.1.0', 'wp_insert_site()' );
$data = array(
'domain' => $domain,
'path' => $path,
'site_id' => $site_id,
);
$site_id = wp_insert_site( $data );
if ( is_wp_error( $site_id ) ) {
return false;
}
clean_blog_cache( $site_id );
return $site_id;
}
```
| Uses | Description |
| --- | --- |
| [wp\_insert\_site()](wp_insert_site) wp-includes/ms-site.php | Inserts a new site into the database. |
| [clean\_blog\_cache()](clean_blog_cache) wp-includes/ms-site.php | Clean the blog cache |
| [\_deprecated\_function()](_deprecated_function) wp-includes/functions.php | Marks a function as deprecated and inform when it has been used. |
| [is\_wp\_error()](is_wp_error) wp-includes/load.php | Checks whether the given variable is a WordPress Error. |
| Used By | Description |
| --- | --- |
| [create\_empty\_blog()](create_empty_blog) wp-includes/ms-deprecated.php | Create an empty blog. |
| Version | Description |
| --- | --- |
| [5.1.0](https://developer.wordpress.org/reference/since/5.1.0/) | Use [wp\_insert\_site()](wp_insert_site) |
| [MU (3.0.0)](https://developer.wordpress.org/reference/since/mu.3.0.0/) | Introduced. |
wordpress wp_expand_dimensions( int $example_width, int $example_height, int $max_width, int $max_height ): int[] wp\_expand\_dimensions( int $example\_width, int $example\_height, int $max\_width, int $max\_height ): int[]
=============================================================================================================
Based on a supplied width/height example, returns the biggest possible dimensions based on the max width/height.
* [wp\_constrain\_dimensions()](wp_constrain_dimensions)
`$example_width` int Required The width of an example embed. `$example_height` int Required The height of an example embed. `$max_width` int Required The maximum allowed width. `$max_height` int Required The maximum allowed height. int[] An array of maximum width and height values.
* intThe maximum width in pixels.
* `1`intThe maximum height in pixels.
File: `wp-includes/media.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/media.php/)
```
function wp_expand_dimensions( $example_width, $example_height, $max_width, $max_height ) {
$example_width = (int) $example_width;
$example_height = (int) $example_height;
$max_width = (int) $max_width;
$max_height = (int) $max_height;
return wp_constrain_dimensions( $example_width * 1000000, $example_height * 1000000, $max_width, $max_height );
}
```
| Uses | Description |
| --- | --- |
| [wp\_constrain\_dimensions()](wp_constrain_dimensions) wp-includes/media.php | Calculates the new dimensions for a down-sampled image. |
| Version | Description |
| --- | --- |
| [2.9.0](https://developer.wordpress.org/reference/since/2.9.0/) | Introduced. |
wordpress in_category( int|string|int[]|string[] $category, int|WP_Post $post = null ): bool in\_category( int|string|int[]|string[] $category, int|WP\_Post $post = null ): bool
====================================================================================
Checks if the current post is within any of the given categories.
The given categories are checked against the post’s categories’ term\_ids, names and slugs.
Categories given as integers will only be checked against the post’s categories’ term\_ids.
Prior to v2.5 of WordPress, category names were not supported.
Prior to v2.7, category slugs were not supported.
Prior to v2.7, only one category could be compared: in\_category( $single\_category ).
Prior to v2.7, this function could only be used in the WordPress Loop.
As of 2.7, the function can be used anywhere if it is provided a post ID or post object.
For more information on this and similar theme functions, check out the [Conditional Tags](https://developer.wordpress.org/themes/basics/conditional-tags/) article in the Theme Developer Handbook.
`$category` int|string|int[]|string[] Required Category ID, name, slug, or array of such to check against. `$post` int|[WP\_Post](../classes/wp_post) Optional Post to check. Defaults to the current post. Default: `null`
bool True if the current post is in any of the given categories.
File: `wp-includes/category-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/category-template.php/)
```
function in_category( $category, $post = null ) {
if ( empty( $category ) ) {
return false;
}
return has_category( $category, $post );
}
```
| Uses | Description |
| --- | --- |
| [has\_category()](has_category) wp-includes/category-template.php | Checks if the current post has any of given category. |
| Version | Description |
| --- | --- |
| [2.7.0](https://developer.wordpress.org/reference/since/2.7.0/) | The `$post` parameter was added. |
| [1.2.0](https://developer.wordpress.org/reference/since/1.2.0/) | Introduced. |
wordpress is_main_blog() is\_main\_blog()
================
This function has been deprecated. Use [is\_main\_site()](is_main_site) instead.
Deprecated functionality to determin if the current site is the main site.
* [is\_main\_site()](is_main_site)
File: `wp-includes/ms-deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/ms-deprecated.php/)
```
function is_main_blog() {
_deprecated_function( __FUNCTION__, '3.0.0', 'is_main_site()' );
return is_main_site();
}
```
| Uses | Description |
| --- | --- |
| [is\_main\_site()](is_main_site) wp-includes/functions.php | Determines whether a site is the main site of the current network. |
| [\_deprecated\_function()](_deprecated_function) wp-includes/functions.php | Marks a function as deprecated and inform when it has been used. |
| Version | Description |
| --- | --- |
| [3.0.0](https://developer.wordpress.org/reference/since/3.0.0/) | Use [is\_main\_site()](is_main_site) |
| [MU (3.0.0)](https://developer.wordpress.org/reference/since/mu.3.0.0/) | Introduced. |
wordpress _pad_term_counts( object[]|WP_Term[] $terms, string $taxonomy ) \_pad\_term\_counts( object[]|WP\_Term[] $terms, string $taxonomy )
===================================================================
This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.
Adds count of children to parent count.
Recalculates term counts by including items from child terms. Assumes all relevant children are already in the $terms argument.
`$terms` object[]|[WP\_Term](../classes/wp_term)[] Required List of term objects (passed by reference). `$taxonomy` string Required Term context. File: `wp-includes/taxonomy.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/taxonomy.php/)
```
function _pad_term_counts( &$terms, $taxonomy ) {
global $wpdb;
// This function only works for hierarchical taxonomies like post categories.
if ( ! is_taxonomy_hierarchical( $taxonomy ) ) {
return;
}
$term_hier = _get_term_hierarchy( $taxonomy );
if ( empty( $term_hier ) ) {
return;
}
$term_items = array();
$terms_by_id = array();
$term_ids = array();
foreach ( (array) $terms as $key => $term ) {
$terms_by_id[ $term->term_id ] = & $terms[ $key ];
$term_ids[ $term->term_taxonomy_id ] = $term->term_id;
}
// Get the object and term IDs and stick them in a lookup table.
$tax_obj = get_taxonomy( $taxonomy );
$object_types = esc_sql( $tax_obj->object_type );
$results = $wpdb->get_results( "SELECT object_id, term_taxonomy_id FROM $wpdb->term_relationships INNER JOIN $wpdb->posts ON object_id = ID WHERE term_taxonomy_id IN (" . implode( ',', array_keys( $term_ids ) ) . ") AND post_type IN ('" . implode( "', '", $object_types ) . "') AND post_status = 'publish'" );
foreach ( $results as $row ) {
$id = $term_ids[ $row->term_taxonomy_id ];
$term_items[ $id ][ $row->object_id ] = isset( $term_items[ $id ][ $row->object_id ] ) ? ++$term_items[ $id ][ $row->object_id ] : 1;
}
// Touch every ancestor's lookup row for each post in each term.
foreach ( $term_ids as $term_id ) {
$child = $term_id;
$ancestors = array();
while ( ! empty( $terms_by_id[ $child ] ) && $parent = $terms_by_id[ $child ]->parent ) {
$ancestors[] = $child;
if ( ! empty( $term_items[ $term_id ] ) ) {
foreach ( $term_items[ $term_id ] as $item_id => $touches ) {
$term_items[ $parent ][ $item_id ] = isset( $term_items[ $parent ][ $item_id ] ) ? ++$term_items[ $parent ][ $item_id ] : 1;
}
}
$child = $parent;
if ( in_array( $parent, $ancestors, true ) ) {
break;
}
}
}
// Transfer the touched cells.
foreach ( (array) $term_items as $id => $items ) {
if ( isset( $terms_by_id[ $id ] ) ) {
$terms_by_id[ $id ]->count = count( $items );
}
}
}
```
| Uses | Description |
| --- | --- |
| [esc\_sql()](esc_sql) wp-includes/formatting.php | Escapes data for use in a MySQL query. |
| [\_get\_term\_hierarchy()](_get_term_hierarchy) wp-includes/taxonomy.php | Retrieves children of taxonomy as term IDs. |
| [is\_taxonomy\_hierarchical()](is_taxonomy_hierarchical) wp-includes/taxonomy.php | Determines whether the taxonomy object is hierarchical. |
| [get\_taxonomy()](get_taxonomy) wp-includes/taxonomy.php | Retrieves the taxonomy object of $taxonomy. |
| [wpdb::get\_results()](../classes/wpdb/get_results) wp-includes/class-wpdb.php | Retrieves an entire SQL result set from the database (i.e., many rows). |
| Used By | Description |
| --- | --- |
| [WP\_Term\_Query::get\_terms()](../classes/wp_term_query/get_terms) wp-includes/class-wp-term-query.php | Retrieves the query results. |
| Version | Description |
| --- | --- |
| [2.3.0](https://developer.wordpress.org/reference/since/2.3.0/) | Introduced. |
wordpress wp_render_duotone_filter_preset( array $preset ): string wp\_render\_duotone\_filter\_preset( array $preset ): string
============================================================
This function has been deprecated. Use [wp\_get\_duotone\_filter\_property()](wp_get_duotone_filter_property) instead.
Renders the duotone filter SVG and returns the CSS filter property to reference the rendered SVG.
* [wp\_get\_duotone\_filter\_property()](wp_get_duotone_filter_property)
`$preset` array Required Duotone preset value as seen in theme.json. string Duotone CSS filter property.
File: `wp-includes/deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/deprecated.php/)
```
function wp_render_duotone_filter_preset( $preset ) {
_deprecated_function( __FUNCTION__, '5.9.1', 'wp_get_duotone_filter_property()' );
return wp_get_duotone_filter_property( $preset );
}
```
| Uses | Description |
| --- | --- |
| [\_deprecated\_function()](_deprecated_function) wp-includes/functions.php | Marks a function as deprecated and inform when it has been used. |
| Version | Description |
| --- | --- |
| [5.9.1](https://developer.wordpress.org/reference/since/5.9.1/) | Use wp\_get\_duotone\_filter\_property() introduced in 5.9.1. |
| [5.9.0](https://developer.wordpress.org/reference/since/5.9.0/) | Introduced. |
wordpress get_post_thumbnail_id( int|WP_Post $post = null ): int|false get\_post\_thumbnail\_id( int|WP\_Post $post = null ): int|false
================================================================
Retrieves the post thumbnail ID.
`$post` int|[WP\_Post](../classes/wp_post) Optional Post ID or [WP\_Post](../classes/wp_post) object. Default is global `$post`. Default: `null`
int|false Post thumbnail ID (which can be 0 if the thumbnail is not set), or false if the post does not exist.
* To enable featured images, see post thumbnails, the current theme must include `add_theme_support( 'post-thumbnails' );` in its [functions.php](https://developer.wordpress.org/themes/basics/theme-functions/) file. See also [Post Thumbnails](https://developer.wordpress.org/themes/functionality/featured-images-post-thumbnails/).
* “Post Thumbnail” is an outdated term for “Featured Image”. This function returns the ID of the post’s featured image. It does not return IDs of other images attached to posts that are thumbnail sized.
File: `wp-includes/post-thumbnail-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/post-thumbnail-template.php/)
```
function get_post_thumbnail_id( $post = null ) {
$post = get_post( $post );
if ( ! $post ) {
return false;
}
$thumbnail_id = (int) get_post_meta( $post->ID, '_thumbnail_id', true );
/**
* Filters the post thumbnail ID.
*
* @since 5.9.0
*
* @param int|false $thumbnail_id Post thumbnail ID or false if the post does not exist.
* @param int|WP_Post|null $post Post ID or WP_Post object. Default is global `$post`.
*/
return (int) apply_filters( 'post_thumbnail_id', $thumbnail_id, $post );
}
```
[apply\_filters( 'post\_thumbnail\_id', int|false $thumbnail\_id, int|WP\_Post|null $post )](../hooks/post_thumbnail_id)
Filters the post thumbnail ID.
| Uses | Description |
| --- | --- |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| [get\_post\_meta()](get_post_meta) wp-includes/post.php | Retrieves a post meta field for the given post ID. |
| [get\_post()](get_post) wp-includes/post.php | Retrieves post data given a post ID or post object. |
| Used By | Description |
| --- | --- |
| [WP\_REST\_Posts\_Controller::prepare\_links()](../classes/wp_rest_posts_controller/prepare_links) wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php | Prepares links for the request. |
| [WP\_REST\_Posts\_Controller::prepare\_item\_for\_response()](../classes/wp_rest_posts_controller/prepare_item_for_response) wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php | Prepares a single post output for response. |
| [get\_the\_post\_thumbnail\_caption()](get_the_post_thumbnail_caption) wp-includes/post-thumbnail-template.php | Returns the post thumbnail caption. |
| [get\_oembed\_response\_data\_rich()](get_oembed_response_data_rich) wp-includes/embed.php | Filters the oEmbed response data to return an iframe embed code. |
| [get\_the\_post\_thumbnail\_url()](get_the_post_thumbnail_url) wp-includes/post-thumbnail-template.php | Returns the post thumbnail URL. |
| [edit\_form\_image\_editor()](edit_form_image_editor) wp-admin/includes/media.php | Displays the image and editor in the post editor |
| [get\_media\_item()](get_media_item) wp-admin/includes/media.php | Retrieves HTML form for modifying the image attachment. |
| [has\_post\_thumbnail()](has_post_thumbnail) wp-includes/post-thumbnail-template.php | Determines whether a post has an image attached. |
| [update\_post\_thumbnail\_cache()](update_post_thumbnail_cache) wp-includes/post-thumbnail-template.php | Updates cache for thumbnails in the current loop. |
| [get\_the\_post\_thumbnail()](get_the_post_thumbnail) wp-includes/post-thumbnail-template.php | Retrieves the post thumbnail. |
| [prepend\_attachment()](prepend_attachment) wp-includes/post-template.php | Wraps attachment in paragraph tag before content. |
| [wp\_prepare\_attachment\_for\_js()](wp_prepare_attachment_for_js) wp-includes/media.php | Prepares an attachment post object for JS, where it is expected to be JSON-encoded and fit into an Attachment model. |
| [wp\_playlist\_shortcode()](wp_playlist_shortcode) wp-includes/media.php | Builds the Playlist shortcode output. |
| [wp\_xmlrpc\_server::mw\_getPost()](../classes/wp_xmlrpc_server/mw_getpost) wp-includes/class-wp-xmlrpc-server.php | Retrieve post. |
| [wp\_xmlrpc\_server::mw\_getRecentPosts()](../classes/wp_xmlrpc_server/mw_getrecentposts) wp-includes/class-wp-xmlrpc-server.php | Retrieve list of recent posts. |
| [wp\_xmlrpc\_server::\_prepare\_post()](../classes/wp_xmlrpc_server/_prepare_post) wp-includes/class-wp-xmlrpc-server.php | Prepares post data for return in an XML-RPC object. |
| Version | Description |
| --- | --- |
| [5.5.0](https://developer.wordpress.org/reference/since/5.5.0/) | The return value for a non-existing post was changed to false instead of an empty string. |
| [4.4.0](https://developer.wordpress.org/reference/since/4.4.0/) | `$post` can be a post ID or [WP\_Post](../classes/wp_post) object. |
| [2.9.0](https://developer.wordpress.org/reference/since/2.9.0/) | Introduced. |
| programming_docs |
wordpress get_header_image_tag( array $attr = array() ): string get\_header\_image\_tag( array $attr = array() ): string
========================================================
Creates image tag markup for a custom header image.
`$attr` array Optional Additional attributes for the image tag. Can be used to override the default attributes. Default: `array()`
string HTML image element markup or empty string on failure.
File: `wp-includes/theme.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/theme.php/)
```
function get_header_image_tag( $attr = array() ) {
$header = get_custom_header();
$header->url = get_header_image();
if ( ! $header->url ) {
return '';
}
$width = absint( $header->width );
$height = absint( $header->height );
$alt = '';
// Use alternative text assigned to the image, if available. Otherwise, leave it empty.
if ( ! empty( $header->attachment_id ) ) {
$image_alt = get_post_meta( $header->attachment_id, '_wp_attachment_image_alt', true );
if ( is_string( $image_alt ) ) {
$alt = $image_alt;
}
}
$attr = wp_parse_args(
$attr,
array(
'src' => $header->url,
'width' => $width,
'height' => $height,
'alt' => $alt,
)
);
// Generate 'srcset' and 'sizes' if not already present.
if ( empty( $attr['srcset'] ) && ! empty( $header->attachment_id ) ) {
$image_meta = get_post_meta( $header->attachment_id, '_wp_attachment_metadata', true );
$size_array = array( $width, $height );
if ( is_array( $image_meta ) ) {
$srcset = wp_calculate_image_srcset( $size_array, $header->url, $image_meta, $header->attachment_id );
if ( ! empty( $attr['sizes'] ) ) {
$sizes = $attr['sizes'];
} else {
$sizes = wp_calculate_image_sizes( $size_array, $header->url, $image_meta, $header->attachment_id );
}
if ( $srcset && $sizes ) {
$attr['srcset'] = $srcset;
$attr['sizes'] = $sizes;
}
}
}
/**
* Filters the list of header image attributes.
*
* @since 5.9.0
*
* @param array $attr Array of the attributes for the image tag.
* @param object $header The custom header object returned by 'get_custom_header()'.
*/
$attr = apply_filters( 'get_header_image_tag_attributes', $attr, $header );
$attr = array_map( 'esc_attr', $attr );
$html = '<img';
foreach ( $attr as $name => $value ) {
$html .= ' ' . $name . '="' . $value . '"';
}
$html .= ' />';
/**
* Filters the markup of header images.
*
* @since 4.4.0
*
* @param string $html The HTML image tag markup being filtered.
* @param object $header The custom header object returned by 'get_custom_header()'.
* @param array $attr Array of the attributes for the image tag.
*/
return apply_filters( 'get_header_image_tag', $html, $header, $attr );
}
```
[apply\_filters( 'get\_header\_image\_tag', string $html, object $header, array $attr )](../hooks/get_header_image_tag)
Filters the markup of header images.
[apply\_filters( 'get\_header\_image\_tag\_attributes', array $attr, object $header )](../hooks/get_header_image_tag_attributes)
Filters the list of header image attributes.
| Uses | Description |
| --- | --- |
| [wp\_calculate\_image\_srcset()](wp_calculate_image_srcset) wp-includes/media.php | A helper function to calculate the image sources to include in a ‘srcset’ attribute. |
| [wp\_calculate\_image\_sizes()](wp_calculate_image_sizes) wp-includes/media.php | Creates a ‘sizes’ attribute value for an image. |
| [get\_custom\_header()](get_custom_header) wp-includes/theme.php | Gets the header image data. |
| [get\_header\_image()](get_header_image) wp-includes/theme.php | Retrieves header image for custom header. |
| [absint()](absint) wp-includes/functions.php | Converts a value to non-negative integer. |
| [wp\_parse\_args()](wp_parse_args) wp-includes/functions.php | Merges user defined arguments into defaults array. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| [get\_post\_meta()](get_post_meta) wp-includes/post.php | Retrieves a post meta field for the given post ID. |
| Used By | Description |
| --- | --- |
| [get\_custom\_header\_markup()](get_custom_header_markup) wp-includes/theme.php | Retrieves the markup for a custom header. |
| [the\_header\_image\_tag()](the_header_image_tag) wp-includes/theme.php | Displays the image markup for a custom header image. |
| Version | Description |
| --- | --- |
| [4.4.0](https://developer.wordpress.org/reference/since/4.4.0/) | Introduced. |
wordpress wp_set_internal_encoding() wp\_set\_internal\_encoding()
=============================
This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.
Set internal encoding.
In most cases the default internal encoding is latin1, which is of no use, since we want to use the `mb_` functions for `utf-8` strings.
File: `wp-includes/load.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/load.php/)
```
function wp_set_internal_encoding() {
if ( function_exists( 'mb_internal_encoding' ) ) {
$charset = get_option( 'blog_charset' );
// phpcs:ignore WordPress.PHP.NoSilencedErrors.Discouraged
if ( ! $charset || ! @mb_internal_encoding( $charset ) ) {
mb_internal_encoding( 'UTF-8' );
}
}
}
```
| Uses | Description |
| --- | --- |
| [get\_option()](get_option) wp-includes/option.php | Retrieves an option value based on an option name. |
| Version | Description |
| --- | --- |
| [3.0.0](https://developer.wordpress.org/reference/since/3.0.0/) | Introduced. |
wordpress wp_import_cleanup( string $id ) wp\_import\_cleanup( string $id )
=================================
Cleanup importer.
Removes attachment based on ID.
`$id` string Required Importer ID. File: `wp-admin/includes/import.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/import.php/)
```
function wp_import_cleanup( $id ) {
wp_delete_attachment( $id );
}
```
| Uses | Description |
| --- | --- |
| [wp\_delete\_attachment()](wp_delete_attachment) wp-includes/post.php | Trashes or deletes an attachment. |
| Version | Description |
| --- | --- |
| [2.0.0](https://developer.wordpress.org/reference/since/2.0.0/) | Introduced. |
wordpress _wp_get_iframed_editor_assets(): array \_wp\_get\_iframed\_editor\_assets(): array
===========================================
This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.
Collect the block editor assets that need to be loaded into the editor’s iframe.
array The block editor assets.
* `styles`string|falseString containing the HTML for styles.
* `scripts`string|falseString containing the HTML for scripts.
File: `wp-includes/block-editor.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/block-editor.php/)
```
function _wp_get_iframed_editor_assets() {
global $pagenow;
$script_handles = array();
$style_handles = array(
'wp-block-editor',
'wp-block-library',
'wp-edit-blocks',
);
if ( current_theme_supports( 'wp-block-styles' ) ) {
$style_handles[] = 'wp-block-library-theme';
}
if ( 'widgets.php' === $pagenow || 'customize.php' === $pagenow ) {
$style_handles[] = 'wp-widgets';
$style_handles[] = 'wp-edit-widgets';
}
$block_registry = WP_Block_Type_Registry::get_instance();
foreach ( $block_registry->get_all_registered() as $block_type ) {
$style_handles = array_merge(
$style_handles,
$block_type->style_handles,
$block_type->editor_style_handles
);
$script_handles = array_merge(
$script_handles,
$block_type->script_handles
);
}
$style_handles = array_unique( $style_handles );
$done = wp_styles()->done;
ob_start();
// We do not need reset styles for the iframed editor.
wp_styles()->done = array( 'wp-reset-editor-styles' );
wp_styles()->do_items( $style_handles );
wp_styles()->done = $done;
$styles = ob_get_clean();
$script_handles = array_unique( $script_handles );
$done = wp_scripts()->done;
ob_start();
wp_scripts()->done = array();
wp_scripts()->do_items( $script_handles );
wp_scripts()->done = $done;
$scripts = ob_get_clean();
return array(
'styles' => $styles,
'scripts' => $scripts,
);
}
```
| Uses | Description |
| --- | --- |
| [WP\_Block\_Type\_Registry::get\_instance()](../classes/wp_block_type_registry/get_instance) wp-includes/class-wp-block-type-registry.php | Utility method to retrieve the main instance of the class. |
| [wp\_styles()](wp_styles) wp-includes/functions.wp-styles.php | Initialize $wp\_styles if it has not been set. |
| [wp\_scripts()](wp_scripts) wp-includes/functions.wp-scripts.php | Initialize $wp\_scripts if it has not been set. |
| [current\_theme\_supports()](current_theme_supports) wp-includes/theme.php | Checks a theme’s support for a given feature. |
| Used By | Description |
| --- | --- |
| [get\_block\_editor\_settings()](get_block_editor_settings) wp-includes/block-editor.php | Returns the contextualized block editor settings for a selected editor context. |
| Version | Description |
| --- | --- |
| [6.0.0](https://developer.wordpress.org/reference/since/6.0.0/) | Introduced. |
wordpress the_editor( string $content, string $id = 'content', string $prev_id = 'title', bool $media_buttons = true, int $tab_index = 2, bool $extended = true ) the\_editor( string $content, string $id = 'content', string $prev\_id = 'title', bool $media\_buttons = true, int $tab\_index = 2, bool $extended = true )
===========================================================================================================================================================
This function has been deprecated. Use [wp\_editor()](wp_editor) instead.
Displays an editor: TinyMCE, HTML, or both.
* [wp\_editor()](wp_editor)
`$content` string Required Textarea content. `$id` string Optional HTML ID attribute value. Default `'content'`. Default: `'content'`
`$prev_id` string Optional Unused. Default: `'title'`
`$media_buttons` bool Optional Whether to display media buttons. Default: `true`
`$tab_index` int Optional Unused. Default: `2`
`$extended` bool Optional Unused. Default: `true`
File: `wp-includes/deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/deprecated.php/)
```
function the_editor($content, $id = 'content', $prev_id = 'title', $media_buttons = true, $tab_index = 2, $extended = true) {
_deprecated_function( __FUNCTION__, '3.3.0', 'wp_editor()' );
wp_editor( $content, $id, array( 'media_buttons' => $media_buttons ) );
}
```
| Uses | Description |
| --- | --- |
| [wp\_editor()](wp_editor) wp-includes/general-template.php | Renders an editor. |
| [\_deprecated\_function()](_deprecated_function) wp-includes/functions.php | Marks a function as deprecated and inform when it has been used. |
| Version | Description |
| --- | --- |
| [3.3.0](https://developer.wordpress.org/reference/since/3.3.0/) | Use [wp\_editor()](wp_editor) |
| [2.1.0](https://developer.wordpress.org/reference/since/2.1.0/) | Introduced. |
wordpress wp_admin_bar_edit_site_menu( WP_Admin_Bar $wp_admin_bar ) wp\_admin\_bar\_edit\_site\_menu( WP\_Admin\_Bar $wp\_admin\_bar )
==================================================================
Adds the “Edit site” link to the Toolbar.
`$wp_admin_bar` [WP\_Admin\_Bar](../classes/wp_admin_bar) Required The [WP\_Admin\_Bar](../classes/wp_admin_bar) instance. File: `wp-includes/admin-bar.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/admin-bar.php/)
```
function wp_admin_bar_edit_site_menu( $wp_admin_bar ) {
// Don't show if a block theme is not activated.
if ( ! wp_is_block_theme() ) {
return;
}
// Don't show for users who can't edit theme options or when in the admin.
if ( ! current_user_can( 'edit_theme_options' ) || is_admin() ) {
return;
}
$wp_admin_bar->add_node(
array(
'id' => 'site-editor',
'title' => __( 'Edit site' ),
'href' => admin_url( 'site-editor.php' ),
)
);
}
```
| Uses | Description |
| --- | --- |
| [wp\_is\_block\_theme()](wp_is_block_theme) wp-includes/theme.php | Returns whether the active theme is a block-based theme or not. |
| [WP\_Admin\_Bar::add\_node()](../classes/wp_admin_bar/add_node) wp-includes/class-wp-admin-bar.php | Adds a node to the menu. |
| [current\_user\_can()](current_user_can) wp-includes/capabilities.php | Returns whether the current user has the specified capability. |
| [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. |
| [is\_admin()](is_admin) wp-includes/load.php | Determines whether the current request is for an administrative interface page. |
| [admin\_url()](admin_url) wp-includes/link-template.php | Retrieves the URL to the admin area for the current site. |
| Version | Description |
| --- | --- |
| [5.9.0](https://developer.wordpress.org/reference/since/5.9.0/) | Introduced. |
wordpress get_pages( array|string $args = array() ): WP_Post[]|false get\_pages( array|string $args = array() ): WP\_Post[]|false
============================================================
Retrieves an array of pages (or hierarchical post type items).
`$args` array|string Optional Array or string of arguments to retrieve pages.
* `child_of`intPage ID to return child and grandchild pages of. Note: The value of `$hierarchical` has no bearing on whether `$child_of` returns hierarchical results. Default 0, or no restriction.
* `sort_order`stringHow to sort retrieved pages. Accepts `'ASC'`, `'DESC'`. Default `'ASC'`.
* `sort_column`stringWhat columns to sort pages by, comma-separated. Accepts `'post_author'`, `'post_date'`, `'post_title'`, `'post_name'`, `'post_modified'`, `'menu_order'`, `'post_modified_gmt'`, `'post_parent'`, `'ID'`, `'rand'`, `'comment*count'`.
`'post*'` can be omitted for any values that start with it.
Default `'post_title'`.
* `hierarchical`boolWhether to return pages hierarchically. If false in conjunction with `$child_of` also being false, both arguments will be disregarded.
Default true.
* `exclude`int[]Array of page IDs to exclude.
* `include`int[]Array of page IDs to include. Cannot be used with `$child_of`, `$parent`, `$exclude`, `$meta_key`, `$meta_value`, or `$hierarchical`.
* `meta_key`stringOnly include pages with this meta key.
* `meta_value`stringOnly include pages with this meta value. Requires `$meta_key`.
* `authors`stringA comma-separated list of author IDs.
* `parent`intPage ID to return direct children of. Default -1, or no restriction.
* `exclude_tree`string|int[]Comma-separated string or array of page IDs to exclude.
* `number`intThe number of pages to return. Default 0, or all pages.
* `offset`intThe number of pages to skip before returning. Requires `$number`.
Default 0.
* `post_type`stringThe post type to query. Default `'page'`.
* `post_status`string|arrayA comma-separated list or array of post statuses to include.
Default `'publish'`.
Default: `array()`
[WP\_Post](../classes/wp_post)[]|false Array of pages (or hierarchical post type items). Boolean false if the specified post type is not hierarchical or the specified status is not supported by the post type.
File: `wp-includes/post.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/post.php/)
```
function get_pages( $args = array() ) {
global $wpdb;
$defaults = array(
'child_of' => 0,
'sort_order' => 'ASC',
'sort_column' => 'post_title',
'hierarchical' => 1,
'exclude' => array(),
'include' => array(),
'meta_key' => '',
'meta_value' => '',
'authors' => '',
'parent' => -1,
'exclude_tree' => array(),
'number' => '',
'offset' => 0,
'post_type' => 'page',
'post_status' => 'publish',
);
$parsed_args = wp_parse_args( $args, $defaults );
$number = (int) $parsed_args['number'];
$offset = (int) $parsed_args['offset'];
$child_of = (int) $parsed_args['child_of'];
$hierarchical = $parsed_args['hierarchical'];
$exclude = $parsed_args['exclude'];
$meta_key = $parsed_args['meta_key'];
$meta_value = $parsed_args['meta_value'];
$parent = $parsed_args['parent'];
$post_status = $parsed_args['post_status'];
// Make sure the post type is hierarchical.
$hierarchical_post_types = get_post_types( array( 'hierarchical' => true ) );
if ( ! in_array( $parsed_args['post_type'], $hierarchical_post_types, true ) ) {
return false;
}
if ( $parent > 0 && ! $child_of ) {
$hierarchical = false;
}
// Make sure we have a valid post status.
if ( ! is_array( $post_status ) ) {
$post_status = explode( ',', $post_status );
}
if ( array_diff( $post_status, get_post_stati() ) ) {
return false;
}
// $args can be whatever, only use the args defined in defaults to compute the key.
$key = md5( serialize( wp_array_slice_assoc( $parsed_args, array_keys( $defaults ) ) ) );
$last_changed = wp_cache_get_last_changed( 'posts' );
$cache_key = "get_pages:$key:$last_changed";
$cache = wp_cache_get( $cache_key, 'posts' );
if ( false !== $cache ) {
_prime_post_caches( $cache, false, false );
// Convert to WP_Post instances.
$pages = array_map( 'get_post', $cache );
/** This filter is documented in wp-includes/post.php */
$pages = apply_filters( 'get_pages', $pages, $parsed_args );
return $pages;
}
$inclusions = '';
if ( ! empty( $parsed_args['include'] ) ) {
$child_of = 0; // Ignore child_of, parent, exclude, meta_key, and meta_value params if using include.
$parent = -1;
$exclude = '';
$meta_key = '';
$meta_value = '';
$hierarchical = false;
$incpages = wp_parse_id_list( $parsed_args['include'] );
if ( ! empty( $incpages ) ) {
$inclusions = ' AND ID IN (' . implode( ',', $incpages ) . ')';
}
}
$exclusions = '';
if ( ! empty( $exclude ) ) {
$expages = wp_parse_id_list( $exclude );
if ( ! empty( $expages ) ) {
$exclusions = ' AND ID NOT IN (' . implode( ',', $expages ) . ')';
}
}
$author_query = '';
if ( ! empty( $parsed_args['authors'] ) ) {
$post_authors = wp_parse_list( $parsed_args['authors'] );
if ( ! empty( $post_authors ) ) {
foreach ( $post_authors as $post_author ) {
// Do we have an author id or an author login?
if ( 0 == (int) $post_author ) {
$post_author = get_user_by( 'login', $post_author );
if ( empty( $post_author ) ) {
continue;
}
if ( empty( $post_author->ID ) ) {
continue;
}
$post_author = $post_author->ID;
}
if ( '' === $author_query ) {
$author_query = $wpdb->prepare( ' post_author = %d ', $post_author );
} else {
$author_query .= $wpdb->prepare( ' OR post_author = %d ', $post_author );
}
}
if ( '' !== $author_query ) {
$author_query = " AND ($author_query)";
}
}
}
$join = '';
$where = "$exclusions $inclusions ";
if ( '' !== $meta_key || '' !== $meta_value ) {
$join = " LEFT JOIN $wpdb->postmeta ON ( $wpdb->posts.ID = $wpdb->postmeta.post_id )";
// meta_key and meta_value might be slashed.
$meta_key = wp_unslash( $meta_key );
$meta_value = wp_unslash( $meta_value );
if ( '' !== $meta_key ) {
$where .= $wpdb->prepare( " AND $wpdb->postmeta.meta_key = %s", $meta_key );
}
if ( '' !== $meta_value ) {
$where .= $wpdb->prepare( " AND $wpdb->postmeta.meta_value = %s", $meta_value );
}
}
if ( is_array( $parent ) ) {
$post_parent__in = implode( ',', array_map( 'absint', (array) $parent ) );
if ( ! empty( $post_parent__in ) ) {
$where .= " AND post_parent IN ($post_parent__in)";
}
} elseif ( $parent >= 0 ) {
$where .= $wpdb->prepare( ' AND post_parent = %d ', $parent );
}
if ( 1 === count( $post_status ) ) {
$where_post_type = $wpdb->prepare( 'post_type = %s AND post_status = %s', $parsed_args['post_type'], reset( $post_status ) );
} else {
$post_status = implode( "', '", $post_status );
$where_post_type = $wpdb->prepare( "post_type = %s AND post_status IN ('$post_status')", $parsed_args['post_type'] );
}
$orderby_array = array();
$allowed_keys = array(
'author',
'post_author',
'date',
'post_date',
'title',
'post_title',
'name',
'post_name',
'modified',
'post_modified',
'modified_gmt',
'post_modified_gmt',
'menu_order',
'parent',
'post_parent',
'ID',
'rand',
'comment_count',
);
foreach ( explode( ',', $parsed_args['sort_column'] ) as $orderby ) {
$orderby = trim( $orderby );
if ( ! in_array( $orderby, $allowed_keys, true ) ) {
continue;
}
switch ( $orderby ) {
case 'menu_order':
break;
case 'ID':
$orderby = "$wpdb->posts.ID";
break;
case 'rand':
$orderby = 'RAND()';
break;
case 'comment_count':
$orderby = "$wpdb->posts.comment_count";
break;
default:
if ( 0 === strpos( $orderby, 'post_' ) ) {
$orderby = "$wpdb->posts." . $orderby;
} else {
$orderby = "$wpdb->posts.post_" . $orderby;
}
}
$orderby_array[] = $orderby;
}
$sort_column = ! empty( $orderby_array ) ? implode( ',', $orderby_array ) : "$wpdb->posts.post_title";
$sort_order = strtoupper( $parsed_args['sort_order'] );
if ( '' !== $sort_order && ! in_array( $sort_order, array( 'ASC', 'DESC' ), true ) ) {
$sort_order = 'ASC';
}
$query = "SELECT * FROM $wpdb->posts $join WHERE ($where_post_type) $where ";
$query .= $author_query;
$query .= ' ORDER BY ' . $sort_column . ' ' . $sort_order;
if ( ! empty( $number ) ) {
$query .= ' LIMIT ' . $offset . ',' . $number;
}
$pages = $wpdb->get_results( $query );
if ( empty( $pages ) ) {
wp_cache_set( $cache_key, array(), 'posts' );
/** This filter is documented in wp-includes/post.php */
$pages = apply_filters( 'get_pages', array(), $parsed_args );
return $pages;
}
// Sanitize before caching so it'll only get done once.
$num_pages = count( $pages );
for ( $i = 0; $i < $num_pages; $i++ ) {
$pages[ $i ] = sanitize_post( $pages[ $i ], 'raw' );
}
// Update cache.
update_post_cache( $pages );
if ( $child_of || $hierarchical ) {
$pages = get_page_children( $child_of, $pages );
}
if ( ! empty( $parsed_args['exclude_tree'] ) ) {
$exclude = wp_parse_id_list( $parsed_args['exclude_tree'] );
foreach ( $exclude as $id ) {
$children = get_page_children( $id, $pages );
foreach ( $children as $child ) {
$exclude[] = $child->ID;
}
}
$num_pages = count( $pages );
for ( $i = 0; $i < $num_pages; $i++ ) {
if ( in_array( $pages[ $i ]->ID, $exclude, true ) ) {
unset( $pages[ $i ] );
}
}
}
$page_structure = array();
foreach ( $pages as $page ) {
$page_structure[] = $page->ID;
}
wp_cache_set( $cache_key, $page_structure, 'posts' );
// Convert to WP_Post instances.
$pages = array_map( 'get_post', $pages );
/**
* Filters the retrieved list of pages.
*
* @since 2.1.0
*
* @param WP_Post[] $pages Array of page objects.
* @param array $parsed_args Array of get_pages() arguments.
*/
return apply_filters( 'get_pages', $pages, $parsed_args );
}
```
[apply\_filters( 'get\_pages', WP\_Post[] $pages, array $parsed\_args )](../hooks/get_pages)
Filters the retrieved list of pages.
| Uses | Description |
| --- | --- |
| [wp\_parse\_list()](wp_parse_list) wp-includes/functions.php | Converts a comma- or space-separated list of scalar values to an array. |
| [sanitize\_post()](sanitize_post) wp-includes/post.php | Sanitizes every post field. |
| [wp\_cache\_set()](wp_cache_set) wp-includes/cache.php | Saves the data to the cache. |
| [get\_post\_stati()](get_post_stati) wp-includes/post.php | Gets a list of post statuses. |
| [get\_user\_by()](get_user_by) wp-includes/pluggable.php | Retrieves user info by a given field. |
| [wp\_array\_slice\_assoc()](wp_array_slice_assoc) wp-includes/functions.php | Extracts a slice of an array, given a list of keys. |
| [wp\_parse\_id\_list()](wp_parse_id_list) wp-includes/functions.php | Cleans up an array, comma- or space-separated list of IDs. |
| [wp\_cache\_get\_last\_changed()](wp_cache_get_last_changed) wp-includes/functions.php | Gets last changed date for the specified cache group. |
| [\_prime\_post\_caches()](_prime_post_caches) wp-includes/post.php | Adds any posts from the given IDs to the cache that do not already exist in cache. |
| [update\_post\_cache()](update_post_cache) wp-includes/post.php | Updates posts in cache. |
| [get\_page\_children()](get_page_children) wp-includes/post.php | Identifies descendants of a given page ID in a list of page objects. |
| [wpdb::get\_results()](../classes/wpdb/get_results) wp-includes/class-wpdb.php | Retrieves an entire SQL result set from the database (i.e., many rows). |
| [get\_post\_types()](get_post_types) wp-includes/post.php | Gets a list of all registered post type objects. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| [wp\_parse\_args()](wp_parse_args) wp-includes/functions.php | Merges user defined arguments into defaults array. |
| [wp\_unslash()](wp_unslash) wp-includes/formatting.php | Removes slashes from a string or recursively removes slashes from strings within an array. |
| [wp\_cache\_get()](wp_cache_get) wp-includes/cache.php | Retrieves the cache contents from the cache by key and group. |
| [wpdb::prepare()](../classes/wpdb/prepare) wp-includes/class-wpdb.php | Prepares a SQL query for safe execution. |
| Used By | Description |
| --- | --- |
| [WP\_Customize\_Manager::has\_published\_pages()](../classes/wp_customize_manager/has_published_pages) wp-includes/class-wp-customize-manager.php | Returns whether there are published pages. |
| [WP\_Posts\_List\_Table::\_display\_rows\_hierarchical()](../classes/wp_posts_list_table/_display_rows_hierarchical) wp-admin/includes/class-wp-posts-list-table.php | |
| [wp\_dropdown\_pages()](wp_dropdown_pages) wp-includes/post-template.php | Retrieves or displays a list of pages as a dropdown (select list). |
| [wp\_list\_pages()](wp_list_pages) wp-includes/post-template.php | Retrieves or displays a list of pages (or hierarchical post type items) in list (li) format. |
| [get\_body\_class()](get_body_class) wp-includes/post-template.php | Retrieves an array of the class names for the body element. |
| Version | Description |
| --- | --- |
| [1.5.0](https://developer.wordpress.org/reference/since/1.5.0/) | Introduced. |
| programming_docs |
wordpress wp_initial_nav_menu_meta_boxes() wp\_initial\_nav\_menu\_meta\_boxes()
=====================================
Limit the amount of meta boxes to pages, posts, links, and categories for first time users.
File: `wp-admin/includes/nav-menu.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/nav-menu.php/)
```
function wp_initial_nav_menu_meta_boxes() {
global $wp_meta_boxes;
if ( get_user_option( 'metaboxhidden_nav-menus' ) !== false || ! is_array( $wp_meta_boxes ) ) {
return;
}
$initial_meta_boxes = array( 'add-post-type-page', 'add-post-type-post', 'add-custom-links', 'add-category' );
$hidden_meta_boxes = array();
foreach ( array_keys( $wp_meta_boxes['nav-menus'] ) as $context ) {
foreach ( array_keys( $wp_meta_boxes['nav-menus'][ $context ] ) as $priority ) {
foreach ( $wp_meta_boxes['nav-menus'][ $context ][ $priority ] as $box ) {
if ( in_array( $box['id'], $initial_meta_boxes, true ) ) {
unset( $box['id'] );
} else {
$hidden_meta_boxes[] = $box['id'];
}
}
}
}
$user = wp_get_current_user();
update_user_meta( $user->ID, 'metaboxhidden_nav-menus', $hidden_meta_boxes );
}
```
| Uses | Description |
| --- | --- |
| [wp\_get\_current\_user()](wp_get_current_user) wp-includes/pluggable.php | Retrieves the current user object. |
| [update\_user\_meta()](update_user_meta) wp-includes/user.php | Updates user meta field based on user ID. |
| [get\_user\_option()](get_user_option) wp-includes/user.php | Retrieves user option that can be either per Site or per Network. |
| Version | Description |
| --- | --- |
| [3.0.0](https://developer.wordpress.org/reference/since/3.0.0/) | Introduced. |
wordpress _usort_terms_by_ID( object $a, object $b ): int \_usort\_terms\_by\_ID( object $a, object $b ): int
===================================================
This function has been deprecated. Use [wp\_list\_sort()](wp_list_sort) instead.
This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.
Sort categories by ID.
Used by usort() as a callback, should not be used directly. Can actually be used to sort any term object.
`$a` object Required `$b` object Required int
File: `wp-includes/deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/deprecated.php/)
```
function _usort_terms_by_ID( $a, $b ) {
_deprecated_function( __FUNCTION__, '4.7.0', 'wp_list_sort()' );
if ( $a->term_id > $b->term_id )
return 1;
elseif ( $a->term_id < $b->term_id )
return -1;
else
return 0;
}
```
| Uses | Description |
| --- | --- |
| [\_deprecated\_function()](_deprecated_function) wp-includes/functions.php | Marks a function as deprecated and inform when it has been used. |
| Version | Description |
| --- | --- |
| [4.7.0](https://developer.wordpress.org/reference/since/4.7.0/) | Use [wp\_list\_sort()](wp_list_sort) |
| [2.3.0](https://developer.wordpress.org/reference/since/2.3.0/) | Introduced. |
wordpress wp_get_post_terms( int $post_id, string|string[] $taxonomy = 'post_tag', array $args = array() ): array|WP_Error wp\_get\_post\_terms( int $post\_id, string|string[] $taxonomy = 'post\_tag', array $args = array() ): array|WP\_Error
======================================================================================================================
Retrieves the terms for a post.
`$post_id` int Optional The Post ID. Does not default to the ID of the global $post. Default 0. `$taxonomy` string|string[] Optional The taxonomy slug or array of slugs for which to retrieve terms. Default `'post_tag'`. Default: `'post_tag'`
`$args` array Optional Term query parameters. See [WP\_Term\_Query::\_\_construct()](../classes/wp_term_query/__construct) for supported arguments.
* `fields`stringTerm fields to retrieve. Default `'all'`.
More Arguments from WP\_Term\_Query::\_\_construct( ... $query ) Array or query string of term query parameters.
* `taxonomy`string|string[]Taxonomy name, or array of taxonomy names, to which results should be limited.
* `object_ids`int|int[]Object ID, or array of object IDs. Results will be limited to terms associated with these objects.
* `orderby`stringField(s) to order terms by. Accepts:
+ Term fields (`'name'`, `'slug'`, `'term_group'`, `'term_id'`, `'id'`, `'description'`, `'parent'`, `'term_order'`). Unless `$object_ids` is not empty, `'term_order'` is treated the same as `'term_id'`.
+ `'count'` to use the number of objects associated with the term.
+ `'include'` to match the `'order'` of the `$include` param.
+ `'slug__in'` to match the `'order'` of the `$slug` param.
+ `'meta_value'`
+ `'meta_value_num'`.
+ The value of `$meta_key`.
+ The array keys of `$meta_query`.
+ `'none'` to omit the ORDER BY clause. Default `'name'`.
* `order`stringWhether to order terms in ascending or descending order.
Accepts `'ASC'` (ascending) or `'DESC'` (descending).
Default `'ASC'`.
* `hide_empty`bool|intWhether to hide terms not assigned to any posts. Accepts `1|true` or `0|false`. Default `1|true`.
* `include`int[]|stringArray or comma/space-separated string of term IDs to include.
Default empty array.
* `exclude`int[]|stringArray or comma/space-separated string of term IDs to exclude.
If `$include` is non-empty, `$exclude` is ignored.
Default empty array.
* `exclude_tree`int[]|stringArray or comma/space-separated string of term IDs to exclude along with all of their descendant terms. If `$include` is non-empty, `$exclude_tree` is ignored. Default empty array.
* `number`int|stringMaximum number of terms to return. Accepts ``''`|0` (all) or any positive number. Default ``''`|0` (all). Note that `$number` may not return accurate results when coupled with `$object_ids`.
See #41796 for details.
* `offset`intThe number by which to offset the terms query.
* `fields`stringTerm fields to query for. Accepts:
+ `'all'` Returns an array of complete term objects (`WP_Term[]`).
+ `'all_with_object_id'` Returns an array of term objects with the `'object_id'` param (`WP_Term[]`). Works only when the `$object_ids` parameter is populated.
+ `'ids'` Returns an array of term IDs (`int[]`).
+ `'tt_ids'` Returns an array of term taxonomy IDs (`int[]`).
+ `'names'` Returns an array of term names (`string[]`).
+ `'slugs'` Returns an array of term slugs (`string[]`).
+ `'count'` Returns the number of matching terms (`int`).
+ `'id=>parent'` Returns an associative array of parent term IDs, keyed by term ID (`int[]`).
+ `'id=>name'` Returns an associative array of term names, keyed by term ID (`string[]`).
+ `'id=>slug'` Returns an associative array of term slugs, keyed by term ID (`string[]`). Default `'all'`.
* `count`boolWhether to return a term count. If true, will take precedence over `$fields`. Default false.
* `name`string|string[]Name or array of names to return term(s) for.
* `slug`string|string[]Slug or array of slugs to return term(s) for.
* `term_taxonomy_id`int|int[]Term taxonomy ID, or array of term taxonomy IDs, to match when querying terms.
* `hierarchical`boolWhether to include terms that have non-empty descendants (even if `$hide_empty` is set to true). Default true.
* `search`stringSearch criteria to match terms. Will be SQL-formatted with wildcards before and after.
* `name__like`stringRetrieve terms with criteria by which a term is LIKE `$name__like`.
* `description__like`stringRetrieve terms where the description is LIKE `$description__like`.
* `pad_counts`boolWhether to pad the quantity of a term's children in the quantity of each term's "count" object variable. Default false.
* `get`stringWhether to return terms regardless of ancestry or whether the terms are empty. Accepts `'all'` or `''` (disabled). Default `''`.
* `child_of`intTerm ID to retrieve child terms of. If multiple taxonomies are passed, `$child_of` is ignored. Default 0.
* `parent`intParent term ID to retrieve direct-child terms of.
* `childless`boolTrue to limit results to terms that have no children.
This parameter has no effect on non-hierarchical taxonomies.
Default false.
* `cache_domain`stringUnique cache key to be produced when this query is stored in an object cache. Default `'core'`.
* `update_term_meta_cache`boolWhether to prime meta caches for matched terms. Default true.
* `meta_key`string|string[]Meta key or keys to filter by.
* `meta_value`string|string[]Meta value or values to filter by.
* `meta_compare`stringMySQL operator used for comparing the meta value.
See [WP\_Meta\_Query::\_\_construct()](../classes/wp_meta_query/__construct) for accepted values and default value.
* `meta_compare_key`stringMySQL operator used for comparing the meta key.
See [WP\_Meta\_Query::\_\_construct()](../classes/wp_meta_query/__construct) for accepted values and default value.
* `meta_type`stringMySQL data type that the meta\_value column will be CAST to for comparisons.
See [WP\_Meta\_Query::\_\_construct()](../classes/wp_meta_query/__construct) for accepted values and default value.
* `meta_type_key`stringMySQL data type that the meta\_key column will be CAST to for comparisons.
See [WP\_Meta\_Query::\_\_construct()](../classes/wp_meta_query/__construct) for accepted values and default value.
* `meta_query`arrayAn associative array of [WP\_Meta\_Query](../classes/wp_meta_query) arguments.
See [WP\_Meta\_Query::\_\_construct()](../classes/wp_meta_query/__construct) for accepted values.
Default: `array()`
array|[WP\_Error](../classes/wp_error) Array of [WP\_Term](../classes/wp_term) objects on success or empty array if no terms were found.
[WP\_Error](../classes/wp_error) object if `$taxonomy` doesn't exist.
File: `wp-includes/post.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/post.php/)
```
function wp_get_post_terms( $post_id = 0, $taxonomy = 'post_tag', $args = array() ) {
$post_id = (int) $post_id;
$defaults = array( 'fields' => 'all' );
$args = wp_parse_args( $args, $defaults );
$tags = wp_get_object_terms( $post_id, $taxonomy, $args );
return $tags;
}
```
| Uses | Description |
| --- | --- |
| [wp\_get\_object\_terms()](wp_get_object_terms) wp-includes/taxonomy.php | Retrieves the terms associated with the given object(s), in the supplied taxonomies. |
| [wp\_parse\_args()](wp_parse_args) wp-includes/functions.php | Merges user defined arguments into defaults array. |
| Used By | Description |
| --- | --- |
| [WP\_REST\_Menu\_Items\_Controller::get\_menu\_id()](../classes/wp_rest_menu_items_controller/get_menu_id) wp-includes/rest-api/endpoints/class-wp-rest-menu-items-controller.php | Gets the id of the menu that the given menu item belongs to. |
| [WP\_Customize\_Nav\_Menu\_Item\_Setting::populate\_value()](../classes/wp_customize_nav_menu_item_setting/populate_value) wp-includes/customize/class-wp-customize-nav-menu-item-setting.php | Ensure that the value is fully populated with the necessary properties. |
| [wp\_get\_post\_tags()](wp_get_post_tags) wp-includes/post.php | Retrieves the tags for a post. |
| Version | Description |
| --- | --- |
| [2.8.0](https://developer.wordpress.org/reference/since/2.8.0/) | Introduced. |
wordpress links_add_base_url( string $content, string $base, array $attrs = array('src', 'href') ): string links\_add\_base\_url( string $content, string $base, array $attrs = array('src', 'href') ): string
===================================================================================================
Adds a base URL to relative links in passed content.
By default it supports the ‘src’ and ‘href’ attributes. However this can be changed via the 3rd param.
`$content` string Required String to search for links in. `$base` string Required The base URL to prefix to links. `$attrs` array Optional The attributes which should be processed. Default: `array('src', 'href')`
string The processed content.
File: `wp-includes/formatting.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/formatting.php/)
```
function links_add_base_url( $content, $base, $attrs = array( 'src', 'href' ) ) {
global $_links_add_base;
$_links_add_base = $base;
$attrs = implode( '|', (array) $attrs );
return preg_replace_callback( "!($attrs)=(['\"])(.+?)\\2!i", '_links_add_base', $content );
}
```
| Used By | Description |
| --- | --- |
| [install\_plugin\_information()](install_plugin_information) wp-admin/includes/plugin-install.php | Displays plugin information in dialog box form. |
| Version | Description |
| --- | --- |
| [2.7.0](https://developer.wordpress.org/reference/since/2.7.0/) | Introduced. |
wordpress wp_get_available_translations(): array[] wp\_get\_available\_translations(): array[]
===========================================
Get available translations from the WordPress.org API.
* [translations\_api()](translations_api)
array[] Array of translations, each an array of data, keyed by the language. If the API response results in an error, an empty array will be returned.
File: `wp-admin/includes/translation-install.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/translation-install.php/)
```
function wp_get_available_translations() {
if ( ! wp_installing() ) {
$translations = get_site_transient( 'available_translations' );
if ( false !== $translations ) {
return $translations;
}
}
// Include an unmodified $wp_version.
require ABSPATH . WPINC . '/version.php';
$api = translations_api( 'core', array( 'version' => $wp_version ) );
if ( is_wp_error( $api ) || empty( $api['translations'] ) ) {
return array();
}
$translations = array();
// Key the array with the language code for now.
foreach ( $api['translations'] as $translation ) {
$translations[ $translation['language'] ] = $translation;
}
if ( ! defined( 'WP_INSTALLING' ) ) {
set_site_transient( 'available_translations', $translations, 3 * HOUR_IN_SECONDS );
}
return $translations;
}
```
| Uses | Description |
| --- | --- |
| [wp\_installing()](wp_installing) wp-includes/load.php | Check or set whether WordPress is in “installation” mode. |
| [translations\_api()](translations_api) wp-admin/includes/translation-install.php | Retrieve translations from WordPress Translation API. |
| [set\_site\_transient()](set_site_transient) wp-includes/option.php | Sets/updates the value of a site transient. |
| [get\_site\_transient()](get_site_transient) wp-includes/option.php | Retrieves the value of a site transient. |
| [is\_wp\_error()](is_wp_error) wp-includes/load.php | Checks whether the given variable is a WordPress Error. |
| Used By | Description |
| --- | --- |
| [wp\_dropdown\_languages()](wp_dropdown_languages) wp-includes/l10n.php | Displays or returns a Language selector. |
| [wp\_download\_language\_pack()](wp_download_language_pack) wp-admin/includes/translation-install.php | Download a language pack. |
| Version | Description |
| --- | --- |
| [4.0.0](https://developer.wordpress.org/reference/since/4.0.0/) | Introduced. |
wordpress wp_term_is_shared( int $term_id ): bool wp\_term\_is\_shared( int $term\_id ): bool
===========================================
Determines whether a term is shared between multiple taxonomies.
Shared taxonomy terms began to be split in 4.3, but failed cron tasks or other delays in upgrade routines may cause shared terms to remain.
`$term_id` int Required Term ID. bool Returns false if a term is not shared between multiple taxonomies or if splitting shared taxonomy terms is finished.
File: `wp-includes/taxonomy.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/taxonomy.php/)
```
function wp_term_is_shared( $term_id ) {
global $wpdb;
if ( get_option( 'finished_splitting_shared_terms' ) ) {
return false;
}
$tt_count = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM $wpdb->term_taxonomy WHERE term_id = %d", $term_id ) );
return $tt_count > 1;
}
```
| Uses | Description |
| --- | --- |
| [get\_option()](get_option) wp-includes/option.php | Retrieves an option value based on an option name. |
| [wpdb::get\_var()](../classes/wpdb/get_var) wp-includes/class-wpdb.php | Retrieves one variable from the database. |
| [wpdb::prepare()](../classes/wpdb/prepare) wp-includes/class-wpdb.php | Prepares a SQL query for safe execution. |
| Used By | Description |
| --- | --- |
| [add\_term\_meta()](add_term_meta) wp-includes/taxonomy.php | Adds metadata to a term. |
| [update\_term\_meta()](update_term_meta) wp-includes/taxonomy.php | Updates term metadata. |
| Version | Description |
| --- | --- |
| [4.4.0](https://developer.wordpress.org/reference/since/4.4.0/) | Introduced. |
wordpress get_themes(): array get\_themes(): array
====================
This function has been deprecated. Use [wp\_get\_themes()](wp_get_themes) instead.
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 and, or index.php. If the theme has a parent theme then it is broken, if it is missing style.css; index.php is optional.
* [wp\_get\_themes()](wp_get_themes)
array Theme list with theme data.
File: `wp-includes/deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/deprecated.php/)
```
function get_themes() {
_deprecated_function( __FUNCTION__, '3.4.0', 'wp_get_themes()' );
global $wp_themes;
if ( isset( $wp_themes ) )
return $wp_themes;
$themes = wp_get_themes();
$wp_themes = array();
foreach ( $themes as $theme ) {
$name = $theme->get('Name');
if ( isset( $wp_themes[ $name ] ) )
$wp_themes[ $name . '/' . $theme->get_stylesheet() ] = $theme;
else
$wp_themes[ $name ] = $theme;
}
return $wp_themes;
}
```
| Uses | Description |
| --- | --- |
| [wp\_get\_themes()](wp_get_themes) wp-includes/theme.php | Returns an array of [WP\_Theme](../classes/wp_theme) objects based on the arguments. |
| [\_deprecated\_function()](_deprecated_function) wp-includes/functions.php | Marks a function as deprecated and inform when it has been used. |
| Used By | Description |
| --- | --- |
| [get\_theme()](get_theme) wp-includes/deprecated.php | Retrieve theme data. |
| Version | Description |
| --- | --- |
| [3.4.0](https://developer.wordpress.org/reference/since/3.4.0/) | Use [wp\_get\_themes()](wp_get_themes) |
| [1.5.0](https://developer.wordpress.org/reference/since/1.5.0/) | Introduced. |
wordpress meta_box_prefs( WP_Screen $screen ) meta\_box\_prefs( WP\_Screen $screen )
======================================
Prints the meta box preferences for screen meta.
`$screen` [WP\_Screen](../classes/wp_screen) Required File: `wp-admin/includes/screen.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/screen.php/)
```
function meta_box_prefs( $screen ) {
global $wp_meta_boxes;
if ( is_string( $screen ) ) {
$screen = convert_to_screen( $screen );
}
if ( empty( $wp_meta_boxes[ $screen->id ] ) ) {
return;
}
$hidden = get_hidden_meta_boxes( $screen );
foreach ( array_keys( $wp_meta_boxes[ $screen->id ] ) as $context ) {
foreach ( array( 'high', 'core', 'default', 'low' ) as $priority ) {
if ( ! isset( $wp_meta_boxes[ $screen->id ][ $context ][ $priority ] ) ) {
continue;
}
foreach ( $wp_meta_boxes[ $screen->id ][ $context ][ $priority ] as $box ) {
if ( false === $box || ! $box['title'] ) {
continue;
}
// Submit box cannot be hidden.
if ( 'submitdiv' === $box['id'] || 'linksubmitdiv' === $box['id'] ) {
continue;
}
$widget_title = $box['title'];
if ( is_array( $box['args'] ) && isset( $box['args']['__widget_basename'] ) ) {
$widget_title = $box['args']['__widget_basename'];
}
$is_hidden = in_array( $box['id'], $hidden, true );
printf(
'<label for="%1$s-hide"><input class="hide-postbox-tog" name="%1$s-hide" type="checkbox" id="%1$s-hide" value="%1$s" %2$s />%3$s</label>',
esc_attr( $box['id'] ),
checked( $is_hidden, false, false ),
$widget_title
);
}
}
}
}
```
| Uses | Description |
| --- | --- |
| [get\_hidden\_meta\_boxes()](get_hidden_meta_boxes) wp-admin/includes/screen.php | Gets an array of IDs of hidden meta boxes. |
| [convert\_to\_screen()](convert_to_screen) wp-admin/includes/template.php | Converts a screen string to a screen object. |
| [checked()](checked) wp-includes/general-template.php | Outputs the HTML checked attribute. |
| [esc\_attr()](esc_attr) wp-includes/formatting.php | Escaping for HTML attributes. |
| Used By | Description |
| --- | --- |
| [WP\_Screen::render\_meta\_boxes\_preferences()](../classes/wp_screen/render_meta_boxes_preferences) wp-admin/includes/class-wp-screen.php | Renders the meta boxes preferences. |
| Version | Description |
| --- | --- |
| [2.7.0](https://developer.wordpress.org/reference/since/2.7.0/) | Introduced. |
| programming_docs |
wordpress wp_style_add_data( string $handle, string $key, mixed $value ): bool wp\_style\_add\_data( string $handle, string $key, mixed $value ): bool
=======================================================================
Add metadata to a CSS stylesheet.
Works only if the stylesheet has already been registered.
Possible values for $key and $value: ‘conditional’ string Comments for IE 6, lte IE 7 etc.
‘rtl’ bool|string To declare an RTL stylesheet.
‘suffix’ string Optional suffix, used in combination with RTL.
‘alt’ bool For rel="alternate stylesheet".
‘title’ string For preferred/alternate stylesheets.
‘path’ string The absolute path to a stylesheet. Stylesheet will load inline when ‘path” is set.
* [WP\_Dependencies::add\_data()](../classes/wp_dependencies/add_data)
`$handle` string Required Name of the stylesheet. `$key` string Required Name of data point for which we're storing a value.
Accepts `'conditional'`, `'rtl'` and `'suffix'`, `'alt'`, `'title'` and `'path'`. `$value` mixed Required String containing the CSS data to be added. bool True on success, false on failure.
File: `wp-includes/functions.wp-styles.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/functions-wp-styles.php/)
```
function wp_style_add_data( $handle, $key, $value ) {
return wp_styles()->add_data( $handle, $key, $value );
}
```
| Uses | Description |
| --- | --- |
| [wp\_styles()](wp_styles) wp-includes/functions.wp-styles.php | Initialize $wp\_styles if it has not been set. |
| Used By | Description |
| --- | --- |
| [wp\_enqueue\_block\_style()](wp_enqueue_block_style) wp-includes/script-loader.php | Enqueues a stylesheet for a specific block. |
| [register\_block\_style\_handle()](register_block_style_handle) wp-includes/blocks.php | Finds a style handle for the block metadata field. It detects when a path to file was provided and registers the style under automatically generated handle name. It returns unprocessed style handle otherwise. |
| Version | Description |
| --- | --- |
| [5.8.0](https://developer.wordpress.org/reference/since/5.8.0/) | Added `'path'` as an official value for $key. See [wp\_maybe\_inline\_styles()](wp_maybe_inline_styles) . |
| [3.6.0](https://developer.wordpress.org/reference/since/3.6.0/) | Introduced. |
wordpress get_bloginfo( string $show = '', string $filter = 'raw' ): string get\_bloginfo( string $show = '', string $filter = 'raw' ): string
==================================================================
Retrieves information about the current site.
Possible values for `$show` include:
* ‘name’ – Site title (set in Settings > General)
* ‘description’ – Site tagline (set in Settings > General)
* ‘wpurl’ – The WordPress address (URL) (set in Settings > General)
* ‘url’ – The Site address (URL) (set in Settings > General)
* ‘admin\_email’ – Admin email (set in Settings > General)
* ‘charset’ – The "Encoding for pages and feeds" (set in Settings > Reading)
* ‘version’ – The current WordPress version
* ‘html\_type’ – The content-type (default: "text/html"). Themes and plugins can override the default value using the [‘pre\_option\_html\_type’](../hooks/pre_option_html_type) filter
* ‘text\_direction’ – The text direction determined by the site’s language. [is\_rtl()](is_rtl) should be used instead
* ‘language’ – Language code for the current site
* ‘stylesheet\_url’ – URL to the stylesheet for the active theme. An active child theme will take precedence over this value
* ‘stylesheet\_directory’ – Directory path for the active theme. An active child theme will take precedence over this value
* ‘template\_url’ / ‘template\_directory’ – URL of the active theme’s directory. An active child theme will NOT take precedence over this value
* ‘pingback\_url’ – The pingback XML-RPC file URL (xmlrpc.php)
* ‘atom\_url’ – The Atom feed URL (/feed/atom)
* ‘rdf\_url’ – The RDF/RSS 1.0 feed URL (/feed/rdf)
* ‘rss\_url’ – The RSS 0.92 feed URL (/feed/rss)
* ‘rss2\_url’ – The RSS 2.0 feed URL (/feed)
* ‘comments\_atom\_url’ – The comments Atom feed URL (/comments/feed)
* ‘comments\_rss2\_url’ – The comments RSS 2.0 feed URL (/comments/feed)
Some `$show` values are deprecated and will be removed in future versions.
These options will trigger the [\_deprecated\_argument()](_deprecated_argument) function.
Deprecated arguments include:
* ‘siteurl’ – Use ‘url’ instead
* ‘home’ – Use ‘url’ instead
`$show` string Optional Site info to retrieve. Default empty (site name). Default: `''`
`$filter` string Optional How to filter what is retrieved. Default `'raw'`. Default: `'raw'`
string Mostly string values, might be empty.
```
$bloginfo = get_bloginfo( $show, $filter );
```
File: `wp-includes/general-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/general-template.php/)
```
function get_bloginfo( $show = '', $filter = 'raw' ) {
switch ( $show ) {
case 'home': // Deprecated.
case 'siteurl': // Deprecated.
_deprecated_argument(
__FUNCTION__,
'2.2.0',
sprintf(
/* translators: 1: 'siteurl'/'home' argument, 2: bloginfo() function name, 3: 'url' argument. */
__( 'The %1$s option is deprecated for the family of %2$s functions. Use the %3$s option instead.' ),
'<code>' . $show . '</code>',
'<code>bloginfo()</code>',
'<code>url</code>'
)
);
// Intentional fall-through to be handled by the 'url' case.
case 'url':
$output = home_url();
break;
case 'wpurl':
$output = site_url();
break;
case 'description':
$output = get_option( 'blogdescription' );
break;
case 'rdf_url':
$output = get_feed_link( 'rdf' );
break;
case 'rss_url':
$output = get_feed_link( 'rss' );
break;
case 'rss2_url':
$output = get_feed_link( 'rss2' );
break;
case 'atom_url':
$output = get_feed_link( 'atom' );
break;
case 'comments_atom_url':
$output = get_feed_link( 'comments_atom' );
break;
case 'comments_rss2_url':
$output = get_feed_link( 'comments_rss2' );
break;
case 'pingback_url':
$output = site_url( 'xmlrpc.php' );
break;
case 'stylesheet_url':
$output = get_stylesheet_uri();
break;
case 'stylesheet_directory':
$output = get_stylesheet_directory_uri();
break;
case 'template_directory':
case 'template_url':
$output = get_template_directory_uri();
break;
case 'admin_email':
$output = get_option( 'admin_email' );
break;
case 'charset':
$output = get_option( 'blog_charset' );
if ( '' === $output ) {
$output = 'UTF-8';
}
break;
case 'html_type':
$output = get_option( 'html_type' );
break;
case 'version':
global $wp_version;
$output = $wp_version;
break;
case 'language':
/*
* translators: Translate this to the correct language tag for your locale,
* see https://www.w3.org/International/articles/language-tags/ for reference.
* Do not translate into your own language.
*/
$output = __( 'html_lang_attribute' );
if ( 'html_lang_attribute' === $output || preg_match( '/[^a-zA-Z0-9-]/', $output ) ) {
$output = determine_locale();
$output = str_replace( '_', '-', $output );
}
break;
case 'text_direction':
_deprecated_argument(
__FUNCTION__,
'2.2.0',
sprintf(
/* translators: 1: 'text_direction' argument, 2: bloginfo() function name, 3: is_rtl() function name. */
__( 'The %1$s option is deprecated for the family of %2$s functions. Use the %3$s function instead.' ),
'<code>' . $show . '</code>',
'<code>bloginfo()</code>',
'<code>is_rtl()</code>'
)
);
if ( function_exists( 'is_rtl' ) ) {
$output = is_rtl() ? 'rtl' : 'ltr';
} else {
$output = 'ltr';
}
break;
case 'name':
default:
$output = get_option( 'blogname' );
break;
}
$url = true;
if ( strpos( $show, 'url' ) === false &&
strpos( $show, 'directory' ) === false &&
strpos( $show, 'home' ) === false ) {
$url = false;
}
if ( 'display' === $filter ) {
if ( $url ) {
/**
* Filters the URL returned by get_bloginfo().
*
* @since 2.0.5
*
* @param string $output The URL returned by bloginfo().
* @param string $show Type of information requested.
*/
$output = apply_filters( 'bloginfo_url', $output, $show );
} else {
/**
* Filters the site information returned by get_bloginfo().
*
* @since 0.71
*
* @param mixed $output The requested non-URL site information.
* @param string $show Type of information requested.
*/
$output = apply_filters( 'bloginfo', $output, $show );
}
}
return $output;
}
```
[apply\_filters( 'bloginfo', mixed $output, string $show )](../hooks/bloginfo)
Filters the site information returned by [get\_bloginfo()](get_bloginfo) .
[apply\_filters( 'bloginfo\_url', string $output, string $show )](../hooks/bloginfo_url)
Filters the URL returned by [get\_bloginfo()](get_bloginfo) .
| Uses | Description |
| --- | --- |
| [determine\_locale()](determine_locale) wp-includes/l10n.php | Determines the current locale desired for the request. |
| [get\_stylesheet\_uri()](get_stylesheet_uri) wp-includes/theme.php | Retrieves stylesheet URI for the active theme. |
| [get\_stylesheet\_directory\_uri()](get_stylesheet_directory_uri) wp-includes/theme.php | Retrieves stylesheet directory URI for the active theme. |
| [get\_template\_directory\_uri()](get_template_directory_uri) wp-includes/theme.php | Retrieves template directory URI for the active theme. |
| [is\_rtl()](is_rtl) wp-includes/l10n.php | Determines whether the current locale is right-to-left (RTL). |
| [site\_url()](site_url) wp-includes/link-template.php | Retrieves the URL for the current site where WordPress application files (e.g. wp-blog-header.php or the wp-admin/ folder) are accessible. |
| [get\_feed\_link()](get_feed_link) wp-includes/link-template.php | Retrieves the permalink for the feed type. |
| [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. |
| [\_deprecated\_argument()](_deprecated_argument) wp-includes/functions.php | Marks a function argument as deprecated and inform when it has been used. |
| [home\_url()](home_url) wp-includes/link-template.php | Retrieves the URL for the current site where the front end is accessible. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| [get\_option()](get_option) wp-includes/option.php | Retrieves an option value based on an option name. |
| Used By | Description |
| --- | --- |
| [WP\_REST\_URL\_Details\_Controller::prepare\_metadata\_for\_output()](../classes/wp_rest_url_details_controller/prepare_metadata_for_output) wp-includes/rest-api/endpoints/class-wp-rest-url-details-controller.php | Prepares the metadata by: – stripping all HTML tags and tag entities. |
| [WP\_REST\_URL\_Details\_Controller::get\_remote\_url()](../classes/wp_rest_url_details_controller/get_remote_url) wp-includes/rest-api/endpoints/class-wp-rest-url-details-controller.php | Retrieves the document title from a remote URL. |
| [WP\_REST\_Widget\_Types\_Controller::get\_widgets()](../classes/wp_rest_widget_types_controller/get_widgets) wp-includes/rest-api/endpoints/class-wp-rest-widget-types-controller.php | Normalize array of widgets. |
| [core\_auto\_updates\_settings()](core_auto_updates_settings) wp-admin/update-core.php | Display WordPress auto-updates settings. |
| [Plugin\_Installer\_Skin::do\_overwrite()](../classes/plugin_installer_skin/do_overwrite) wp-admin/includes/class-plugin-installer-skin.php | Check if the plugin can be overwritten and output the HTML for overwriting a plugin on upload. |
| [Theme\_Installer\_Skin::do\_overwrite()](../classes/theme_installer_skin/do_overwrite) wp-admin/includes/class-theme-installer-skin.php | Check if the theme can be overwritten and output the HTML for overwriting a theme on upload. |
| [WP\_Recovery\_Mode\_Email\_Service::get\_debug()](../classes/wp_recovery_mode_email_service/get_debug) wp-includes/class-wp-recovery-mode-email-service.php | Return debug information in an easy to manipulate format. |
| [WP\_Debug\_Data::debug\_data()](../classes/wp_debug_data/debug_data) wp-admin/includes/class-wp-debug-data.php | Static function for generating site debug data when required. |
| [WP\_Site\_Health::get\_test\_wordpress\_version()](../classes/wp_site_health/get_test_wordpress_version) wp-admin/includes/class-wp-site-health.php | Tests for WordPress version and outputs it. |
| [validate\_plugin\_requirements()](validate_plugin_requirements) wp-admin/includes/plugin.php | Validates the plugin requirements for WordPress version and PHP version. |
| [WP\_Privacy\_Policy\_Content::get\_default\_content()](../classes/wp_privacy_policy_content/get_default_content) wp-admin/includes/class-wp-privacy-policy-content.php | Return the default suggested privacy policy content. |
| [wp\_privacy\_generate\_personal\_data\_export\_file()](wp_privacy_generate_personal_data_export_file) wp-admin/includes/privacy-tools.php | Generate the personal data export file. |
| [WP\_Widget\_Text::is\_legacy\_instance()](../classes/wp_widget_text/is_legacy_instance) wp-includes/widgets/class-wp-widget-text.php | Determines whether a given instance is legacy and should bypass using TinyMCE. |
| [\_WP\_Editors::default\_settings()](../classes/_wp_editors/default_settings) wp-includes/class-wp-editor.php | Returns the default TinyMCE settings. |
| [WP\_Customize\_Nav\_Menu\_Item\_Setting::get\_original\_title()](../classes/wp_customize_nav_menu_item_setting/get_original_title) wp-includes/customize/class-wp-customize-nav-menu-item-setting.php | Get original title. |
| [the\_embed\_site\_title()](the_embed_site_title) wp-includes/embed.php | Prints the necessary markup for the site title in an embed template. |
| [get\_custom\_logo()](get_custom_logo) wp-includes/general-template.php | Returns a custom logo, linked to home unless the theme supports removing the link on the home page. |
| [WP\_Customize\_Site\_Icon\_Control::content\_template()](../classes/wp_customize_site_icon_control/content_template) wp-includes/customize/class-wp-customize-site-icon-control.php | Renders a JS template for the content of the site icon control. |
| [get\_post\_embed\_html()](get_post_embed_html) wp-includes/embed.php | Retrieves the embed code for a specific post. |
| [get\_oembed\_response\_data()](get_oembed_response_data) wp-includes/embed.php | Retrieves the oEmbed response data for a given post. |
| [wp\_get\_document\_title()](wp_get_document_title) wp-includes/general-template.php | Returns document title for the current page. |
| [get\_language\_attributes()](get_language_attributes) wp-includes/general-template.php | Gets the language attributes for the ‘html’ tag. |
| [WP\_Customize\_Nav\_Menus::search\_available\_items\_query()](../classes/wp_customize_nav_menus/search_available_items_query) wp-includes/class-wp-customize-nav-menus.php | Performs post queries for available-item searching. |
| [WP\_Customize\_Nav\_Menus::customize\_register()](../classes/wp_customize_nav_menus/customize_register) wp-includes/class-wp-customize-nav-menus.php | Adds the customizer settings and controls. |
| [WP\_Customize\_Nav\_Menus::load\_available\_items\_query()](../classes/wp_customize_nav_menus/load_available_items_query) wp-includes/class-wp-customize-nav-menus.php | Performs the post\_type and taxonomy queries for loading available menu items. |
| [WP\_Customize\_Media\_Control::to\_json()](../classes/wp_customize_media_control/to_json) wp-includes/customize/class-wp-customize-media-control.php | Refresh the parameters passed to the JavaScript via JSON. |
| [wp\_install\_maybe\_enable\_pretty\_permalinks()](wp_install_maybe_enable_pretty_permalinks) wp-admin/includes/upgrade.php | Maybe enable pretty permalinks on installation. |
| [WP\_Customize\_Panel::json()](../classes/wp_customize_panel/json) wp-includes/class-wp-customize-panel.php | Gather the parameters passed to client JavaScript via JSON. |
| [WP\_Customize\_Section::json()](../classes/wp_customize_section/json) wp-includes/class-wp-customize-section.php | Gather the parameters passed to client JavaScript via JSON. |
| [wpview\_media\_sandbox\_styles()](wpview_media_sandbox_styles) wp-includes/media.php | Returns the URLs for CSS files used in an iframe-sandbox’d TinyMCE media view. |
| [login\_footer()](login_footer) wp-login.php | Outputs the footer for the login page. |
| [login\_header()](login_header) wp-login.php | Output the login page header. |
| [WP\_Automatic\_Updater::run()](../classes/wp_automatic_updater/run) wp-admin/includes/class-wp-automatic-updater.php | Kicks off the background update process, looping through all pending updates. |
| [WP\_Automatic\_Updater::after\_core\_update()](../classes/wp_automatic_updater/after_core_update) wp-admin/includes/class-wp-automatic-updater.php | If we tried to perform a core update, check if we should send an email, and if we need to avoid processing future updates. |
| [WP\_Automatic\_Updater::send\_email()](../classes/wp_automatic_updater/send_email) wp-admin/includes/class-wp-automatic-updater.php | Sends an email upon the completion or failure of a background core update. |
| [WP\_Automatic\_Updater::send\_debug\_email()](../classes/wp_automatic_updater/send_debug_email) wp-admin/includes/class-wp-automatic-updater.php | Prepares and sends an email of a full log of background update results, useful for debugging and geekery. |
| [export\_wp()](export_wp) wp-admin/includes/export.php | Generates the WXR export file for download. |
| [\_access\_denied\_splash()](_access_denied_splash) wp-admin/includes/ms.php | Displays an access denied message when a user tries to view a site’s dashboard they do not have access to. |
| [core\_update\_footer()](core_update_footer) wp-admin/includes/update.php | Returns core update footer message. |
| [update\_right\_now\_message()](update_right_now_message) wp-admin/includes/update.php | Displays WordPress version and active theme in the ‘At a Glance’ dashboard widget. |
| [wp\_welcome\_panel()](wp_welcome_panel) wp-admin/includes/dashboard.php | Displays a welcome panel to introduce users to WordPress. |
| [install\_plugin\_information()](install_plugin_information) wp-admin/includes/plugin-install.php | Displays plugin information in dialog box form. |
| [WP\_Plugin\_Install\_List\_Table::display\_rows()](../classes/wp_plugin_install_list_table/display_rows) wp-admin/includes/class-wp-plugin-install-list-table.php | |
| [WP\_Plugin\_Install\_List\_Table::prepare\_items()](../classes/wp_plugin_install_list_table/prepare_items) wp-admin/includes/class-wp-plugin-install-list-table.php | |
| [\_fix\_attachment\_links()](_fix_attachment_links) wp-admin/includes/post.php | Replaces hrefs of attachment anchors with up-to-date permalinks. |
| [admin\_created\_user\_email()](admin_created_user_email) wp-admin/includes/user.php | |
| [list\_core\_update()](list_core_update) wp-admin/update-core.php | Lists available core updates. |
| [list\_plugin\_updates()](list_plugin_updates) wp-admin/update-core.php | Display the upgrade plugins form. |
| [wp\_mail()](wp_mail) wp-includes/pluggable.php | Sends an email, similar to PHP’s mail function. |
| [wp\_admin\_css\_uri()](wp_admin_css_uri) wp-includes/general-template.php | Displays the URL of a WordPress admin CSS file. |
| [get\_the\_generator()](get_the_generator) wp-includes/general-template.php | Creates the generator XML or Comment for RSS, ATOM, etc. |
| [feed\_links()](feed_links) wp-includes/general-template.php | Displays the links to the general feeds. |
| [feed\_links\_extra()](feed_links_extra) wp-includes/general-template.php | Displays the links to the extra feeds such as category feeds. |
| [bloginfo()](bloginfo) wp-includes/general-template.php | Displays information about the current site. |
| [get\_index\_rel\_link()](get_index_rel_link) wp-includes/deprecated.php | Get site index relational link. |
| [WP::send\_headers()](../classes/wp/send_headers) wp-includes/class-wp.php | Sends additional HTTP headers for caching, content type, etc. |
| [WP\_Http::request()](../classes/wp_http/request) wp-includes/class-wp-http.php | Send an HTTP request to a URI. |
| [wp\_nonce\_ays()](wp_nonce_ays) wp-includes/functions.php | Displays “Are You Sure” message to confirm the action being taken. |
| [cache\_javascript\_headers()](cache_javascript_headers) wp-includes/functions.php | Sets the headers for caching for 10 days with JavaScript content type. |
| [WP\_Widget\_Meta::widget()](../classes/wp_widget_meta/widget) wp-includes/widgets/class-wp-widget-meta.php | Outputs the content for the current Meta widget instance. |
| [get\_pagenum\_link()](get_pagenum_link) wp-includes/link-template.php | Retrieves the link for a page number. |
| [wp\_admin\_bar\_site\_menu()](wp_admin_bar_site_menu) wp-includes/admin-bar.php | Adds the “Site Name” menu. |
| [html\_type\_rss()](html_type_rss) wp-includes/feed.php | Displays the HTML type based on the blog setting. |
| [get\_bloginfo\_rss()](get_bloginfo_rss) wp-includes/feed.php | Retrieves RSS container for the bloginfo function. |
| [wp\_prepare\_attachment\_for\_js()](wp_prepare_attachment_for_js) wp-includes/media.php | Prepares an attachment post object for JS, where it is expected to be JSON-encoded and fit into an Attachment model. |
| [filter\_SSL()](filter_ssl) wp-includes/ms-functions.php | Formats a URL to use https. |
| [wp\_xmlrpc\_server::pingback\_ping()](../classes/wp_xmlrpc_server/pingback_ping) wp-includes/class-wp-xmlrpc-server.php | Retrieves a pingback and registers it. |
| [wp\_xmlrpc\_server::initialise\_blog\_option\_info()](../classes/wp_xmlrpc_server/initialise_blog_option_info) wp-includes/class-wp-xmlrpc-server.php | Set up blog options property. |
| [WP\_Customize\_Widgets::enqueue\_scripts()](../classes/wp_customize_widgets/enqueue_scripts) wp-includes/class-wp-customize-widgets.php | Enqueues scripts and styles for Customizer panel and export data to JavaScript. |
| [wp\_default\_styles()](wp_default_styles) wp-includes/script-loader.php | Assigns default styles to $styles object. |
| [wp\_default\_scripts()](wp_default_scripts) wp-includes/script-loader.php | Registers all WordPress scripts. |
| [weblog\_ping()](weblog_ping) wp-includes/comment.php | Sends a pingback. |
| [pingback()](pingback) wp-includes/comment.php | Pings back the links found in a post. |
| [wp\_print\_media\_templates()](wp_print_media_templates) wp-includes/media-template.php | Prints the templates used in the media manager. |
| Version | Description |
| --- | --- |
| [0.71](https://developer.wordpress.org/reference/since/0.71/) | Introduced. |
| programming_docs |
wordpress dashboard_php_nag_class( string[] $classes ): string[] dashboard\_php\_nag\_class( string[] $classes ): string[]
=========================================================
Adds an additional class to the PHP nag if the current version is insecure.
`$classes` string[] Required Array of meta box classes. string[] Modified array of meta box classes.
File: `wp-admin/includes/dashboard.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/dashboard.php/)
```
function dashboard_php_nag_class( $classes ) {
$response = wp_check_php_version();
if ( ! $response ) {
return $classes;
}
if ( isset( $response['is_secure'] ) && ! $response['is_secure'] ) {
$classes[] = 'php-no-security-updates';
} elseif ( $response['is_lower_than_future_minimum'] ) {
$classes[] = 'php-version-lower-than-future-minimum';
}
return $classes;
}
```
| Uses | Description |
| --- | --- |
| [wp\_check\_php\_version()](wp_check_php_version) wp-admin/includes/misc.php | Checks if the user needs to update PHP. |
| Version | Description |
| --- | --- |
| [5.1.0](https://developer.wordpress.org/reference/since/5.1.0/) | Introduced. |
wordpress flush_rewrite_rules( bool $hard = true ) flush\_rewrite\_rules( bool $hard = true )
==========================================
Removes rewrite rules and then recreate rewrite rules.
`$hard` bool Optional Whether to update .htaccess (hard flush) or just update rewrite\_rules option (soft flush). Default is true (hard). Default: `true`
This function is useful when used with custom post types as it allows for automatic flushing of the WordPress rewrite rules (usually needs to be done manually for new custom post types). However, **this is an expensive operation** so it should only be used when necessary.
File: `wp-includes/rewrite.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/rewrite.php/)
```
function flush_rewrite_rules( $hard = true ) {
global $wp_rewrite;
if ( is_callable( array( $wp_rewrite, 'flush_rules' ) ) ) {
$wp_rewrite->flush_rules( $hard );
}
}
```
| Uses | Description |
| --- | --- |
| [WP\_Rewrite::flush\_rules()](../classes/wp_rewrite/flush_rules) wp-includes/class-wp-rewrite.php | Removes rewrite rules and then recreate rewrite rules. |
| Used By | Description |
| --- | --- |
| [update\_home\_siteurl()](update_home_siteurl) wp-admin/includes/misc.php | Flushes rewrite rules if siteurl, home or page\_on\_front changed. |
| [populate\_network()](populate_network) wp-admin/includes/schema.php | Populate network settings. |
| [wp\_install()](wp_install) wp-admin/includes/upgrade.php | Installs the site. |
| [check\_theme\_switched()](check_theme_switched) wp-includes/theme.php | Checks if a theme has been changed and runs ‘after\_switch\_theme’ hook on the next WP load. |
| Version | Description |
| --- | --- |
| [3.0.0](https://developer.wordpress.org/reference/since/3.0.0/) | Introduced. |
wordpress previous_post( string $format = '%', string $previous = 'previous post: ', string $title = 'yes', string $in_same_cat = 'no', int $limitprev = 1, string $excluded_categories = '' ) previous\_post( string $format = '%', string $previous = 'previous post: ', string $title = 'yes', string $in\_same\_cat = 'no', int $limitprev = 1, string $excluded\_categories = '' )
========================================================================================================================================================================================
This function has been deprecated. Use [previous\_post\_link()](previous_post_link) instead.
Prints a link to the previous post.
* [previous\_post\_link()](previous_post_link)
`$format` string Optional Default: `'%'`
`$previous` string Optional Default: `'previous post: '`
`$title` string Optional Default: `'yes'`
`$in_same_cat` string Optional Default: `'no'`
`$limitprev` int Optional Default: `1`
`$excluded_categories` string Optional Default: `''`
File: `wp-includes/deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/deprecated.php/)
```
function previous_post($format='%', $previous='previous post: ', $title='yes', $in_same_cat='no', $limitprev=1, $excluded_categories='') {
_deprecated_function( __FUNCTION__, '2.0.0', 'previous_post_link()' );
if ( empty($in_same_cat) || 'no' == $in_same_cat )
$in_same_cat = false;
else
$in_same_cat = true;
$post = get_previous_post($in_same_cat, $excluded_categories);
if ( !$post )
return;
$string = '<a href="'.get_permalink($post->ID).'">'.$previous;
if ( 'yes' == $title )
$string .= apply_filters('the_title', $post->post_title, $post->ID);
$string .= '</a>';
$format = str_replace('%', $string, $format);
echo $format;
}
```
[apply\_filters( 'the\_title', string $post\_title, int $post\_id )](../hooks/the_title)
Filters the post title.
| Uses | Description |
| --- | --- |
| [get\_previous\_post()](get_previous_post) wp-includes/link-template.php | Retrieves the previous post that is adjacent to the current post. |
| [\_deprecated\_function()](_deprecated_function) wp-includes/functions.php | Marks a function as deprecated and inform when it has been used. |
| [get\_permalink()](get_permalink) wp-includes/link-template.php | Retrieves the full permalink for the current post or post ID. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| Version | Description |
| --- | --- |
| [2.0.0](https://developer.wordpress.org/reference/since/2.0.0/) | Use [previous\_post\_link()](previous_post_link) |
| [1.5.0](https://developer.wordpress.org/reference/since/1.5.0/) | Introduced. |
wordpress _draft_or_post_title( int|WP_Post $post ): string \_draft\_or\_post\_title( int|WP\_Post $post ): string
======================================================
Gets the post title.
The post title is fetched and if it is blank then a default string is returned.
`$post` int|[WP\_Post](../classes/wp_post) Optional Post ID or [WP\_Post](../classes/wp_post) object. Default is global $post. string The post title if set.
File: `wp-admin/includes/template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/template.php/)
```
function _draft_or_post_title( $post = 0 ) {
$title = get_the_title( $post );
if ( empty( $title ) ) {
$title = __( '(no title)' );
}
return esc_html( $title );
}
```
| Uses | Description |
| --- | --- |
| [get\_the\_title()](get_the_title) wp-includes/post-template.php | Retrieves the post title. |
| [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. |
| [esc\_html()](esc_html) wp-includes/formatting.php | Escaping for HTML blocks. |
| Used By | Description |
| --- | --- |
| [WP\_Posts\_List\_Table::handle\_row\_actions()](../classes/wp_posts_list_table/handle_row_actions) wp-admin/includes/class-wp-posts-list-table.php | Generates and displays row action links. |
| [WP\_Posts\_List\_Table::column\_cb()](../classes/wp_posts_list_table/column_cb) wp-admin/includes/class-wp-posts-list-table.php | Handles the checkbox column output. |
| [WP\_Posts\_List\_Table::column\_title()](../classes/wp_posts_list_table/column_title) wp-admin/includes/class-wp-posts-list-table.php | Handles the title column output. |
| [WP\_Media\_List\_Table::handle\_row\_actions()](../classes/wp_media_list_table/handle_row_actions) wp-admin/includes/class-wp-media-list-table.php | Generates and displays row action links. |
| [WP\_Media\_List\_Table::column\_parent()](../classes/wp_media_list_table/column_parent) wp-admin/includes/class-wp-media-list-table.php | Handles the parent column output. |
| [WP\_Media\_List\_Table::column\_cb()](../classes/wp_media_list_table/column_cb) wp-admin/includes/class-wp-media-list-table.php | Handles the checkbox column output. |
| [WP\_Media\_List\_Table::column\_title()](../classes/wp_media_list_table/column_title) wp-admin/includes/class-wp-media-list-table.php | Handles the title column output. |
| [wp\_dashboard\_recent\_posts()](wp_dashboard_recent_posts) wp-admin/includes/dashboard.php | Generates Publishing Soon and Recently Published sections. |
| [wp\_dashboard\_recent\_drafts()](wp_dashboard_recent_drafts) wp-admin/includes/dashboard.php | Show recent drafts of the user on the dashboard. |
| [\_wp\_dashboard\_recent\_comments\_row()](_wp_dashboard_recent_comments_row) wp-admin/includes/dashboard.php | Outputs a row for the Recent Comments widget. |
| Version | Description |
| --- | --- |
| [2.7.0](https://developer.wordpress.org/reference/since/2.7.0/) | Introduced. |
wordpress wp_authenticate_cookie( WP_User|WP_Error|null $user, string $username, string $password ): WP_User|WP_Error wp\_authenticate\_cookie( WP\_User|WP\_Error|null $user, string $username, string $password ): WP\_User|WP\_Error
=================================================================================================================
Authenticates the user using the WordPress auth cookie.
`$user` [WP\_User](../classes/wp_user)|[WP\_Error](../classes/wp_error)|null Required [WP\_User](../classes/wp_user) or [WP\_Error](../classes/wp_error) object from a previous callback. Default null. `$username` string Required Username. If not empty, cancels the cookie authentication. `$password` string Required Password. If not empty, cancels the cookie authentication. [WP\_User](../classes/wp_user)|[WP\_Error](../classes/wp_error) [WP\_User](../classes/wp_user) on success, [WP\_Error](../classes/wp_error) on failure.
File: `wp-includes/user.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/user.php/)
```
function wp_authenticate_cookie( $user, $username, $password ) {
if ( $user instanceof WP_User ) {
return $user;
}
if ( empty( $username ) && empty( $password ) ) {
$user_id = wp_validate_auth_cookie();
if ( $user_id ) {
return new WP_User( $user_id );
}
global $auth_secure_cookie;
if ( $auth_secure_cookie ) {
$auth_cookie = SECURE_AUTH_COOKIE;
} else {
$auth_cookie = AUTH_COOKIE;
}
if ( ! empty( $_COOKIE[ $auth_cookie ] ) ) {
return new WP_Error( 'expired_session', __( 'Please log in again.' ) );
}
// If the cookie is not set, be silent.
}
return $user;
}
```
| Uses | Description |
| --- | --- |
| [WP\_User::\_\_construct()](../classes/wp_user/__construct) wp-includes/class-wp-user.php | Constructor. |
| [wp\_validate\_auth\_cookie()](wp_validate_auth_cookie) wp-includes/pluggable.php | Validates authentication cookie. |
| [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. |
| [WP\_Error::\_\_construct()](../classes/wp_error/__construct) wp-includes/class-wp-error.php | Initializes the error. |
| Version | Description |
| --- | --- |
| [2.8.0](https://developer.wordpress.org/reference/since/2.8.0/) | Introduced. |
wordpress _media_states( WP_Post $post, bool $display = true ): string \_media\_states( WP\_Post $post, bool $display = true ): string
===============================================================
Outputs the attachment media states as HTML.
`$post` [WP\_Post](../classes/wp_post) Required The attachment post to retrieve states for. `$display` bool Optional Whether to display the post states as an HTML string.
Default: `true`
string Media states string.
File: `wp-admin/includes/template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/template.php/)
```
function _media_states( $post, $display = true ) {
$media_states = get_media_states( $post );
$media_states_string = '';
if ( ! empty( $media_states ) ) {
$state_count = count( $media_states );
$i = 0;
$media_states_string .= ' — ';
foreach ( $media_states as $state ) {
++$i;
$separator = ( $i < $state_count ) ? ', ' : '';
$media_states_string .= "<span class='post-state'>{$state}{$separator}</span>";
}
}
if ( $display ) {
echo $media_states_string;
}
return $media_states_string;
}
```
| Uses | Description |
| --- | --- |
| [get\_media\_states()](get_media_states) wp-admin/includes/template.php | Retrieves an array of media states from an attachment. |
| Used By | Description |
| --- | --- |
| [WP\_Media\_List\_Table::column\_title()](../classes/wp_media_list_table/column_title) wp-admin/includes/class-wp-media-list-table.php | Handles the title column output. |
| Version | Description |
| --- | --- |
| [5.6.0](https://developer.wordpress.org/reference/since/5.6.0/) | Added the `$display` parameter and a return value. |
| [3.2.0](https://developer.wordpress.org/reference/since/3.2.0/) | Introduced. |
wordpress deactivate_plugins( string|string[] $plugins, bool $silent = false, bool|null $network_wide = null ) deactivate\_plugins( string|string[] $plugins, bool $silent = false, bool|null $network\_wide = null )
======================================================================================================
Deactivates a single plugin or multiple plugins.
The deactivation hook is disabled by the plugin upgrader by using the $silent parameter.
`$plugins` string|string[] Required Single plugin or list of plugins to deactivate. `$silent` bool Optional Prevent calling deactivation hooks. Default: `false`
`$network_wide` bool|null Optional Whether to deactivate the plugin for all sites in the network.
A value of null will deactivate plugins for both the network and the current site. Multisite only. Default: `null`
This function is often used by a plugin to deactivate itself if the plugin requires the presence of certain features that are missing in environment after an administrator has activated it. This is usually the last step in a dependency-checking function.
File: `wp-admin/includes/plugin.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/plugin.php/)
```
function deactivate_plugins( $plugins, $silent = false, $network_wide = null ) {
if ( is_multisite() ) {
$network_current = get_site_option( 'active_sitewide_plugins', array() );
}
$current = get_option( 'active_plugins', array() );
$do_blog = false;
$do_network = false;
foreach ( (array) $plugins as $plugin ) {
$plugin = plugin_basename( trim( $plugin ) );
if ( ! is_plugin_active( $plugin ) ) {
continue;
}
$network_deactivating = ( false !== $network_wide ) && is_plugin_active_for_network( $plugin );
if ( ! $silent ) {
/**
* Fires before a plugin is deactivated.
*
* If a plugin is silently deactivated (such as during an update),
* this hook does not fire.
*
* @since 2.9.0
*
* @param string $plugin Path to the plugin file relative to the plugins directory.
* @param bool $network_deactivating Whether the plugin is deactivated for all sites in the network
* or just the current site. Multisite only. Default false.
*/
do_action( 'deactivate_plugin', $plugin, $network_deactivating );
}
if ( false !== $network_wide ) {
if ( is_plugin_active_for_network( $plugin ) ) {
$do_network = true;
unset( $network_current[ $plugin ] );
} elseif ( $network_wide ) {
continue;
}
}
if ( true !== $network_wide ) {
$key = array_search( $plugin, $current, true );
if ( false !== $key ) {
$do_blog = true;
unset( $current[ $key ] );
}
}
if ( $do_blog && wp_is_recovery_mode() ) {
list( $extension ) = explode( '/', $plugin );
wp_paused_plugins()->delete( $extension );
}
if ( ! $silent ) {
/**
* Fires as a specific plugin is being deactivated.
*
* This hook is the "deactivation" hook used internally by register_deactivation_hook().
* The dynamic portion of the hook name, `$plugin`, refers to the plugin basename.
*
* If a plugin is silently deactivated (such as during an update), this hook does not fire.
*
* @since 2.0.0
*
* @param bool $network_deactivating Whether the plugin is deactivated for all sites in the network
* or just the current site. Multisite only. Default false.
*/
do_action( "deactivate_{$plugin}", $network_deactivating );
/**
* Fires after a plugin is deactivated.
*
* If a plugin is silently deactivated (such as during an update),
* this hook does not fire.
*
* @since 2.9.0
*
* @param string $plugin Path to the plugin file relative to the plugins directory.
* @param bool $network_deactivating Whether the plugin is deactivated for all sites in the network
* or just the current site. Multisite only. Default false.
*/
do_action( 'deactivated_plugin', $plugin, $network_deactivating );
}
}
if ( $do_blog ) {
update_option( 'active_plugins', $current );
}
if ( $do_network ) {
update_site_option( 'active_sitewide_plugins', $network_current );
}
}
```
[do\_action( 'deactivated\_plugin', string $plugin, bool $network\_deactivating )](../hooks/deactivated_plugin)
Fires after a plugin is deactivated.
[do\_action( "deactivate\_{$plugin}", bool $network\_deactivating )](../hooks/deactivate_plugin)
Fires as a specific plugin is being deactivated.
| Uses | Description |
| --- | --- |
| [wp\_is\_recovery\_mode()](wp_is_recovery_mode) wp-includes/load.php | Is WordPress in Recovery Mode. |
| [wp\_paused\_plugins()](wp_paused_plugins) wp-includes/error-protection.php | Get the instance for storing paused plugins. |
| [is\_plugin\_active()](is_plugin_active) wp-admin/includes/plugin.php | Determines whether a plugin is active. |
| [is\_plugin\_active\_for\_network()](is_plugin_active_for_network) wp-admin/includes/plugin.php | Determines whether the plugin is active for the entire network. |
| [plugin\_basename()](plugin_basename) wp-includes/plugin.php | Gets the basename of a plugin. |
| [update\_site\_option()](update_site_option) wp-includes/option.php | Updates the value of an option that was already added for the current network. |
| [is\_multisite()](is_multisite) wp-includes/load.php | If Multisite is enabled. |
| [do\_action()](do_action) wp-includes/plugin.php | Calls the callback functions that have been added to an action hook. |
| [get\_site\_option()](get_site_option) wp-includes/option.php | Retrieve an option value for the current network based on name of option. |
| [update\_option()](update_option) wp-includes/option.php | Updates the value of an option that was already added. |
| [get\_option()](get_option) wp-includes/option.php | Retrieves an option value based on an option name. |
| Used By | Description |
| --- | --- |
| [WP\_REST\_Plugins\_Controller::handle\_plugin\_status()](../classes/wp_rest_plugins_controller/handle_plugin_status) wp-includes/rest-api/endpoints/class-wp-rest-plugins-controller.php | Handle updating a plugin’s status. |
| [Plugin\_Upgrader::deactivate\_plugin\_before\_upgrade()](../classes/plugin_upgrader/deactivate_plugin_before_upgrade) wp-admin/includes/class-plugin-upgrader.php | Deactivates a plugin before it is upgraded. |
| [validate\_active\_plugins()](validate_active_plugins) wp-admin/includes/plugin.php | Validates active plugins. |
| Version | Description |
| --- | --- |
| [2.5.0](https://developer.wordpress.org/reference/since/2.5.0/) | Introduced. |
wordpress _wp_personal_data_cleanup_requests() \_wp\_personal\_data\_cleanup\_requests()
=========================================
This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.
Cleans up failed and expired requests before displaying the list table.
File: `wp-admin/includes/privacy-tools.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/privacy-tools.php/)
```
function _wp_personal_data_cleanup_requests() {
/** This filter is documented in wp-includes/user.php */
$expires = (int) apply_filters( 'user_request_key_expiration', DAY_IN_SECONDS );
$requests_query = new WP_Query(
array(
'post_type' => 'user_request',
'posts_per_page' => -1,
'post_status' => 'request-pending',
'fields' => 'ids',
'date_query' => array(
array(
'column' => 'post_modified_gmt',
'before' => $expires . ' seconds ago',
),
),
)
);
$request_ids = $requests_query->posts;
foreach ( $request_ids as $request_id ) {
wp_update_post(
array(
'ID' => $request_id,
'post_status' => 'request-failed',
'post_password' => '',
)
);
}
}
```
[apply\_filters( 'user\_request\_key\_expiration', int $expiration )](../hooks/user_request_key_expiration)
Filters the expiration time of confirm keys.
| Uses | Description |
| --- | --- |
| [WP\_Query::\_\_construct()](../classes/wp_query/__construct) wp-includes/class-wp-query.php | Constructor. |
| [wp\_update\_post()](wp_update_post) wp-includes/post.php | Updates a post with new post data. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| Version | Description |
| --- | --- |
| [4.9.6](https://developer.wordpress.org/reference/since/4.9.6/) | Introduced. |
| programming_docs |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.