code
stringlengths 2.5k
150k
| kind
stringclasses 1
value |
---|---|
wordpress header_image() header\_image()
===============
Displays header image URL.
File: `wp-includes/theme.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/theme.php/)
```
function header_image() {
$image = get_header_image();
if ( $image ) {
echo esc_url( $image );
}
}
```
| Uses | Description |
| --- | --- |
| [get\_header\_image()](get_header_image) wp-includes/theme.php | Retrieves header image for custom header. |
| [esc\_url()](esc_url) wp-includes/formatting.php | Checks and cleans a URL. |
| Version | Description |
| --- | --- |
| [2.1.0](https://developer.wordpress.org/reference/since/2.1.0/) | Introduced. |
wordpress wp_upload_dir( string $time = null, bool $create_dir = true, bool $refresh_cache = false ): array wp\_upload\_dir( string $time = null, bool $create\_dir = true, bool $refresh\_cache = false ): array
=====================================================================================================
Returns an array containing the current upload directory’s path and URL.
Checks the ‘upload\_path’ option, which should be from the web root folder, and if it isn’t empty it will be used. If it is empty, then the path will be ‘WP\_CONTENT\_DIR/uploads’. If the ‘UPLOADS’ constant is defined, then it will override the ‘upload\_path’ option and ‘WP\_CONTENT\_DIR/uploads’ path.
The upload URL path is set either by the ‘upload\_url\_path’ option or by using the ‘WP\_CONTENT\_URL’ constant and appending ‘/uploads’ to the path.
If the ‘uploads\_use\_yearmonth\_folders’ is set to true (checkbox if checked in the administration settings panel), then the time will be used. The format will be year first and then month.
If the path couldn’t be created, then an error will be returned with the key ‘error’ containing the error message. The error suggests that the parent directory is not writable by the server.
`$time` string Optional Time formatted in `'yyyy/mm'`. Default: `null`
`$create_dir` bool Optional Whether to check and create the uploads directory.
Default true for backward compatibility. Default: `true`
`$refresh_cache` bool Optional Whether to refresh the cache. Default: `false`
array Array of information about the upload directory.
* `path`stringBase directory and subdirectory or full path to upload directory.
* `url`stringBase URL and subdirectory or absolute URL to upload directory.
* `subdir`stringSubdirectory if uploads use year/month folders option is on.
* `basedir`stringPath without subdir.
* `baseurl`stringURL path without subdir.
* `error`string|falseFalse or error message.
Note that using this function **will create a subfolder in your Uploads folder** corresponding to the queried month (or current month, if no `$time` argument is provided), if that folder is not already there. You don’t have to upload anything in order for this folder to be created.
For creating custom folder for users
```
$current_user = wp_get_current_user();
$upload_dir = wp_upload_dir();
if ( isset( $current_user->user_login ) && ! empty( $upload_dir['basedir'] ) ) {
$user_dirname = $upload_dir['basedir'].'/'.$current_user->user_login;
if ( ! file_exists( $user_dirname ) ) {
wp_mkdir_p( $user_dirname );
}
}
```
In case you want to move the `/uploads` folder, you’ll have to use the `UPLOADS` constant. It normally shouldn’t get used, as it only get’s defined when `ms_default_constants()` is run (only multisite), but you can simply set:
```
define( 'UPLOADS', trailingslashit( WP_CONTENT_DIR ) . 'custom_uploads_name' );
```
in a single site install and it will just work, as the public directory structure function `wp_upload_dir()` sets it up, when it was defined:
```
$dir = ABSPATH . UPLOADS;
```
*Note:* You can extract the folder name with the following line:
```
// returns `false` if the UPLOADS constant is not defined
$upload_dir_name = false;
if ( defined( 'UPLOADS' ) ) {
str_replace( trailingslashit( WP_CONTENT_DIR ), '', untrailingslashit( UPLOADS ) );
}
```
File: `wp-includes/functions.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/functions.php/)
```
function wp_upload_dir( $time = null, $create_dir = true, $refresh_cache = false ) {
static $cache = array(), $tested_paths = array();
$key = sprintf( '%d-%s', get_current_blog_id(), (string) $time );
if ( $refresh_cache || empty( $cache[ $key ] ) ) {
$cache[ $key ] = _wp_upload_dir( $time );
}
/**
* Filters the uploads directory data.
*
* @since 2.0.0
*
* @param array $uploads {
* Array of information about the upload directory.
*
* @type string $path Base directory and subdirectory or full path to upload directory.
* @type string $url Base URL and subdirectory or absolute URL to upload directory.
* @type string $subdir Subdirectory if uploads use year/month folders option is on.
* @type string $basedir Path without subdir.
* @type string $baseurl URL path without subdir.
* @type string|false $error False or error message.
* }
*/
$uploads = apply_filters( 'upload_dir', $cache[ $key ] );
if ( $create_dir ) {
$path = $uploads['path'];
if ( array_key_exists( $path, $tested_paths ) ) {
$uploads['error'] = $tested_paths[ $path ];
} else {
if ( ! wp_mkdir_p( $path ) ) {
if ( 0 === strpos( $uploads['basedir'], ABSPATH ) ) {
$error_path = str_replace( ABSPATH, '', $uploads['basedir'] ) . $uploads['subdir'];
} else {
$error_path = wp_basename( $uploads['basedir'] ) . $uploads['subdir'];
}
$uploads['error'] = sprintf(
/* translators: %s: Directory path. */
__( 'Unable to create directory %s. Is its parent directory writable by the server?' ),
esc_html( $error_path )
);
}
$tested_paths[ $path ] = $uploads['error'];
}
}
return $uploads;
}
```
[apply\_filters( 'upload\_dir', array $uploads )](../hooks/upload_dir)
Filters the uploads directory data.
| Uses | Description |
| --- | --- |
| [\_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. |
| [wp\_mkdir\_p()](wp_mkdir_p) wp-includes/functions.php | Recursive directory creation based on full path. |
| [\_\_()](__) 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. |
| [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. |
| 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\_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\_privacy\_exports\_dir()](wp_privacy_exports_dir) wp-includes/functions.php | Returns the directory used to store personal data export files. |
| [wp\_privacy\_exports\_url()](wp_privacy_exports_url) wp-includes/functions.php | Returns the URL of the directory used to store personal data export files. |
| [wp\_get\_upload\_dir()](wp_get_upload_dir) wp-includes/functions.php | Retrieves uploads directory information. |
| [\_wp\_handle\_upload()](_wp_handle_upload) wp-admin/includes/file.php | Handles PHP uploads in WordPress. |
| [File\_Upload\_Upgrader::\_\_construct()](../classes/file_upload_upgrader/__construct) wp-admin/includes/class-file-upload-upgrader.php | Construct the upgrader for a form. |
| [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\_upload\_bits()](wp_upload_bits) wp-includes/functions.php | Creates a file in the upload folder with given content. |
| [get\_space\_used()](get_space_used) wp-includes/ms-functions.php | Returns the space used by the current site. |
| Version | Description |
| --- | --- |
| [2.0.0](https://developer.wordpress.org/reference/since/2.0.0/) | Introduced. |
wordpress _wp_get_image_size_from_meta( string $size_name, array $image_meta ): array|false \_wp\_get\_image\_size\_from\_meta( string $size\_name, array $image\_meta ): array|false
=========================================================================================
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 image size as array from its meta data.
Used for responsive images.
`$size_name` string Required Image size. Accepts any registered image size name. `$image_meta` array Required The image meta data. array|false Array of width and height or false if the size isn't present in the meta data.
* intImage width.
* `1`intImage height.
File: `wp-includes/media.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/media.php/)
```
function _wp_get_image_size_from_meta( $size_name, $image_meta ) {
if ( 'full' === $size_name ) {
return array(
absint( $image_meta['width'] ),
absint( $image_meta['height'] ),
);
} elseif ( ! empty( $image_meta['sizes'][ $size_name ] ) ) {
return array(
absint( $image_meta['sizes'][ $size_name ]['width'] ),
absint( $image_meta['sizes'][ $size_name ]['height'] ),
);
}
return false;
}
```
| Uses | Description |
| --- | --- |
| [absint()](absint) wp-includes/functions.php | Converts a value to non-negative integer. |
| 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. |
| [wp\_calculate\_image\_sizes()](wp_calculate_image_sizes) wp-includes/media.php | Creates a ‘sizes’ attribute value for an image. |
| Version | Description |
| --- | --- |
| [4.4.0](https://developer.wordpress.org/reference/since/4.4.0/) | Introduced. |
wordpress avoid_blog_page_permalink_collision( array $data, array $postarr ): array avoid\_blog\_page\_permalink\_collision( array $data, array $postarr ): array
=============================================================================
Avoids a collision between a site slug and a permalink slug.
In a subdirectory installation this will make sure that a site and a post do not use the same subdirectory by checking for a site with the same name as a new post.
`$data` array Required An array of post data. `$postarr` array Required An array of posts. Not currently used. array The new array of post data after checking for collisions.
File: `wp-admin/includes/ms.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/ms.php/)
```
function avoid_blog_page_permalink_collision( $data, $postarr ) {
if ( is_subdomain_install() ) {
return $data;
}
if ( 'page' !== $data['post_type'] ) {
return $data;
}
if ( ! isset( $data['post_name'] ) || '' === $data['post_name'] ) {
return $data;
}
if ( ! is_main_site() ) {
return $data;
}
if ( isset( $data['post_parent'] ) && $data['post_parent'] ) {
return $data;
}
$post_name = $data['post_name'];
$c = 0;
while ( $c < 10 && get_id_from_blogname( $post_name ) ) {
$post_name .= mt_rand( 1, 10 );
$c++;
}
if ( $post_name !== $data['post_name'] ) {
$data['post_name'] = $post_name;
}
return $data;
}
```
| Uses | Description |
| --- | --- |
| [is\_main\_site()](is_main_site) wp-includes/functions.php | Determines whether a site is the main site of the current network. |
| [is\_subdomain\_install()](is_subdomain_install) wp-includes/ms-load.php | Whether a subdomain configuration is enabled. |
| [get\_id\_from\_blogname()](get_id_from_blogname) wp-includes/ms-blogs.php | Retrieves a site’s ID given its (subdomain or directory) slug. |
| Version | Description |
| --- | --- |
| [3.0.0](https://developer.wordpress.org/reference/since/3.0.0/) | Introduced. |
wordpress translate_settings_using_i18n_schema( string|string[]|array[]|object $i18n_schema, string|string[]|array[] $settings, string $textdomain ): string|string[]|array[] translate\_settings\_using\_i18n\_schema( string|string[]|array[]|object $i18n\_schema, string|string[]|array[] $settings, string $textdomain ): string|string[]|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.
Translates the provided settings value using its i18n schema.
`$i18n_schema` string|string[]|array[]|object Required I18n schema for the setting. `$settings` string|string[]|array[] Required Value for the settings. `$textdomain` string Required Textdomain to use with translations. string|string[]|array[] Translated settings.
File: `wp-includes/l10n.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/l10n.php/)
```
function translate_settings_using_i18n_schema( $i18n_schema, $settings, $textdomain ) {
if ( empty( $i18n_schema ) || empty( $settings ) || empty( $textdomain ) ) {
return $settings;
}
if ( is_string( $i18n_schema ) && is_string( $settings ) ) {
return translate_with_gettext_context( $settings, $i18n_schema, $textdomain );
}
if ( is_array( $i18n_schema ) && is_array( $settings ) ) {
$translated_settings = array();
foreach ( $settings as $value ) {
$translated_settings[] = translate_settings_using_i18n_schema( $i18n_schema[0], $value, $textdomain );
}
return $translated_settings;
}
if ( is_object( $i18n_schema ) && is_array( $settings ) ) {
$group_key = '*';
$translated_settings = array();
foreach ( $settings as $key => $value ) {
if ( isset( $i18n_schema->$key ) ) {
$translated_settings[ $key ] = translate_settings_using_i18n_schema( $i18n_schema->$key, $value, $textdomain );
} elseif ( isset( $i18n_schema->$group_key ) ) {
$translated_settings[ $key ] = translate_settings_using_i18n_schema( $i18n_schema->$group_key, $value, $textdomain );
} else {
$translated_settings[ $key ] = $value;
}
}
return $translated_settings;
}
return $settings;
}
```
| Uses | Description |
| --- | --- |
| [translate\_settings\_using\_i18n\_schema()](translate_settings_using_i18n_schema) wp-includes/l10n.php | Translates the provided settings value using its i18n schema. |
| [translate\_with\_gettext\_context()](translate_with_gettext_context) wp-includes/l10n.php | Retrieves the translation of $text in the context defined in $context. |
| Used By | Description |
| --- | --- |
| [translate\_settings\_using\_i18n\_schema()](translate_settings_using_i18n_schema) wp-includes/l10n.php | Translates the provided settings value using its i18n schema. |
| [WP\_Theme\_JSON\_Resolver::translate()](../classes/wp_theme_json_resolver/translate) wp-includes/class-wp-theme-json-resolver.php | Given a theme.json structure modifies it in place to update certain values by its translated strings according to the language set by the user. |
| [register\_block\_type\_from\_metadata()](register_block_type_from_metadata) wp-includes/blocks.php | Registers a block type from the metadata stored in the `block.json` file. |
| Version | Description |
| --- | --- |
| [5.9.0](https://developer.wordpress.org/reference/since/5.9.0/) | Introduced. |
wordpress wxr_term_description( WP_Term $term ) wxr\_term\_description( WP\_Term $term )
========================================
Outputs a term\_description XML tag from a given term object.
`$term` [WP\_Term](../classes/wp_term) Required Term Object. File: `wp-admin/includes/export.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/export.php/)
```
function wxr_term_description( $term ) {
if ( empty( $term->description ) ) {
return;
}
echo "\t\t<wp:term_description>" . wxr_cdata( $term->description ) . "</wp:term_description>\n";
}
```
| Uses | Description |
| --- | --- |
| [wxr\_cdata()](wxr_cdata) wp-admin/includes/export.php | Wraps given string in XML CDATA tag. |
| Used By | Description |
| --- | --- |
| [export\_wp()](export_wp) wp-admin/includes/export.php | Generates the WXR export file for download. |
| Version | Description |
| --- | --- |
| [2.9.0](https://developer.wordpress.org/reference/since/2.9.0/) | Introduced. |
wordpress is_main_query(): bool is\_main\_query(): bool
=======================
Determines whether the query is the main query.
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 the main query.
The `is_main_query()` function is a [conditional function](https://developer.wordpress.org/themes/basics/conditional-tags/) that can be used to evaluate whether the current query (such as within the loop) is the “main” query (as opposed to a secondary query).
This function is most commonly used within hooks to distinguish WordPress’ main query (for a page, post, or archive) from a custom/secondary query.
`is_main_query()` may be used with both front-end queries (theme templates, plugins, etc.), as well as admin queries. It will return `true` if the current query is the main query, and `false` if not.
```
if ( is_main_query() ) {
// do stuff
}
```
This function does not accept any parameters. Instead, it automatically compares the $wp\_query object (i.e., the “current query”) with the `$wp_the_query` object (the “main query”)
This function is an alias for the method `WP_Query::is_main_query()`. In filter or action hook callbacks that are passed the `WP_Query` object, such as ‘`pre_get_posts`‘, it is circular to call this function. Instead, directly call the passed object’s method. For example, if your filter callback assigns the passed `WP_Query` object to `$query`, you would call the method like so:
`$query->is_main_query()`
```
add_action( 'pre_get_posts', 'foo_modify_query_exclude_category' );
function foo_modify_query_exclude_category( $query ) {
if ( ! is_admin() && $query->is_main_query() && ! $query->get( 'cat' ) )
$query->set( 'cat', '-5' );
}
```
File: `wp-includes/query.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/query.php/)
```
function is_main_query() {
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.' ), '6.1.0' );
return false;
}
if ( 'pre_get_posts' === current_filter() ) {
_doing_it_wrong(
__FUNCTION__,
sprintf(
/* translators: 1: pre_get_posts, 2: WP_Query->is_main_query(), 3: is_main_query(), 4: Documentation URL. */
__( 'In %1$s, use the %2$s method, not the %3$s function. See %4$s.' ),
'<code>pre_get_posts</code>',
'<code>WP_Query->is_main_query()</code>',
'<code>is_main_query()</code>',
__( 'https://developer.wordpress.org/reference/functions/is_main_query/' )
),
'3.7.0'
);
}
return $wp_query->is_main_query();
}
```
| Uses | Description |
| --- | --- |
| [WP\_Query::is\_main\_query()](../classes/wp_query/is_main_query) wp-includes/class-wp-query.php | Is the query the main query? |
| [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. |
| [\_doing\_it\_wrong()](_doing_it_wrong) wp-includes/functions.php | Marks something as being incorrectly called. |
| Used By | Description |
| --- | --- |
| [wp\_get\_loading\_attr\_default()](wp_get_loading_attr_default) wp-includes/media.php | Gets the default value to use for a `loading` attribute on an element. |
| Version | Description |
| --- | --- |
| [3.3.0](https://developer.wordpress.org/reference/since/3.3.0/) | Introduced. |
| programming_docs |
wordpress get_attachment_icon( int $id, bool $fullsize = false, array $max_dims = false ): string|false get\_attachment\_icon( int $id, bool $fullsize = false, array $max\_dims = false ): string|false
================================================================================================
This function has been deprecated. Use [wp\_get\_attachment\_image()](wp_get_attachment_image) instead.
Retrieve HTML content of icon attachment image element.
* [wp\_get\_attachment\_image()](wp_get_attachment_image)
`$id` int Optional Post ID. `$fullsize` bool Optional Whether to have full size image. Default: `false`
`$max_dims` array Optional Dimensions of image. Default: `false`
string|false HTML content.
File: `wp-includes/deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/deprecated.php/)
```
function get_attachment_icon( $id = 0, $fullsize = false, $max_dims = false ) {
_deprecated_function( __FUNCTION__, '2.5.0', 'wp_get_attachment_image()' );
$id = (int) $id;
if ( !$post = get_post($id) )
return false;
if ( !$src = get_attachment_icon_src( $post->ID, $fullsize ) )
return false;
list($src, $src_file) = $src;
// Do we need to constrain the image?
if ( ($max_dims = apply_filters('attachment_max_dims', $max_dims)) && file_exists($src_file) ) {
$imagesize = wp_getimagesize($src_file);
if (($imagesize[0] > $max_dims[0]) || $imagesize[1] > $max_dims[1] ) {
$actual_aspect = $imagesize[0] / $imagesize[1];
$desired_aspect = $max_dims[0] / $max_dims[1];
if ( $actual_aspect >= $desired_aspect ) {
$height = $actual_aspect * $max_dims[0];
$constraint = "width='{$max_dims[0]}' ";
$post->iconsize = array($max_dims[0], $height);
} else {
$width = $max_dims[1] / $actual_aspect;
$constraint = "height='{$max_dims[1]}' ";
$post->iconsize = array($width, $max_dims[1]);
}
} else {
$post->iconsize = array($imagesize[0], $imagesize[1]);
$constraint = '';
}
} else {
$constraint = '';
}
$post_title = esc_attr($post->post_title);
$icon = "<img src='$src' title='$post_title' alt='$post_title' $constraint/>";
return apply_filters( 'attachment_icon', $icon, $post->ID );
}
```
| Uses | Description |
| --- | --- |
| [wp\_getimagesize()](wp_getimagesize) wp-includes/media.php | Allows PHP’s getimagesize() to be debuggable when necessary. |
| [get\_attachment\_icon\_src()](get_attachment_icon_src) wp-includes/deprecated.php | Retrieve icon URL and Path. |
| [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. |
| [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\_attachment\_innerHTML()](get_attachment_innerhtml) wp-includes/deprecated.php | Retrieve HTML content of image element. |
| Version | Description |
| --- | --- |
| [2.5.0](https://developer.wordpress.org/reference/since/2.5.0/) | Use [wp\_get\_attachment\_image()](wp_get_attachment_image) |
| [2.0.0](https://developer.wordpress.org/reference/since/2.0.0/) | Introduced. |
wordpress wp_clean_update_cache() wp\_clean\_update\_cache()
==========================
Clears existing update caches for plugins, themes, and core.
File: `wp-includes/update.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/update.php/)
```
function wp_clean_update_cache() {
if ( function_exists( 'wp_clean_plugins_cache' ) ) {
wp_clean_plugins_cache();
} else {
delete_site_transient( 'update_plugins' );
}
wp_clean_themes_cache();
delete_site_transient( 'update_core' );
}
```
| Uses | Description |
| --- | --- |
| [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. |
| [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). |
| [delete\_site\_transient()](delete_site_transient) wp-includes/option.php | Deletes a site transient. |
| Used By | Description |
| --- | --- |
| [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. |
| [Language\_Pack\_Upgrader::bulk\_upgrade()](../classes/language_pack_upgrader/bulk_upgrade) wp-admin/includes/class-language-pack-upgrader.php | Bulk upgrade language packs. |
| Version | Description |
| --- | --- |
| [4.1.0](https://developer.wordpress.org/reference/since/4.1.0/) | Introduced. |
wordpress wp_sprintf_l( string $pattern, array $args ): string wp\_sprintf\_l( string $pattern, array $args ): string
======================================================
Localizes list items before the rest of the content.
The ‘%l’ must be at the first characters can then contain the rest of the content. The list items will have ‘, ‘, ‘, and’, and ‘ and ‘ added depending on the amount of list items in the $args parameter.
`$pattern` string Required Content containing `'%l'` at the beginning. `$args` array Required List items to prepend to the content and replace `'%l'`. string Localized list items and rest of the content.
File: `wp-includes/formatting.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/formatting.php/)
```
function wp_sprintf_l( $pattern, $args ) {
// Not a match.
if ( '%l' !== substr( $pattern, 0, 2 ) ) {
return $pattern;
}
// Nothing to work with.
if ( empty( $args ) ) {
return '';
}
/**
* Filters the translated delimiters used by wp_sprintf_l().
* Placeholders (%s) are included to assist translators and then
* removed before the array of strings reaches the filter.
*
* Please note: Ampersands and entities should be avoided here.
*
* @since 2.5.0
*
* @param array $delimiters An array of translated delimiters.
*/
$l = apply_filters(
'wp_sprintf_l',
array(
/* translators: Used to join items in a list with more than 2 items. */
'between' => sprintf( __( '%1$s, %2$s' ), '', '' ),
/* translators: Used to join last two items in a list with more than 2 times. */
'between_last_two' => sprintf( __( '%1$s, and %2$s' ), '', '' ),
/* translators: Used to join items in a list with only 2 items. */
'between_only_two' => sprintf( __( '%1$s and %2$s' ), '', '' ),
)
);
$args = (array) $args;
$result = array_shift( $args );
if ( count( $args ) == 1 ) {
$result .= $l['between_only_two'] . array_shift( $args );
}
// Loop when more than two args.
$i = count( $args );
while ( $i ) {
$arg = array_shift( $args );
$i--;
if ( 0 == $i ) {
$result .= $l['between_last_two'] . $arg;
} else {
$result .= $l['between'] . $arg;
}
}
return $result . substr( $pattern, 2 );
}
```
[apply\_filters( 'wp\_sprintf\_l', array $delimiters )](../hooks/wp_sprintf_l)
Filters the translated delimiters used by [wp\_sprintf\_l()](wp_sprintf_l) .
| 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. |
| Version | Description |
| --- | --- |
| [2.5.0](https://developer.wordpress.org/reference/since/2.5.0/) | Introduced. |
wordpress wp_privacy_exports_url(): string wp\_privacy\_exports\_url(): string
===================================
Returns the URL of the directory used to store personal data export files.
* <wp_privacy_exports_dir>
string Exports directory URL.
File: `wp-includes/functions.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/functions.php/)
```
function wp_privacy_exports_url() {
$upload_dir = wp_upload_dir();
$exports_url = trailingslashit( $upload_dir['baseurl'] ) . 'wp-personal-data-exports/';
/**
* Filters the URL of the directory used to store personal data export files.
*
* @since 4.9.6
* @since 5.5.0 Exports now use relative paths, so changes to the directory URL
* via this filter should be reflected on the server.
*
* @param string $exports_url Exports directory URL.
*/
return apply_filters( 'wp_privacy_exports_url', $exports_url );
}
```
[apply\_filters( 'wp\_privacy\_exports\_url', string $exports\_url )](../hooks/wp_privacy_exports_url)
Filters the URL of the directory used to store personal data export files.
| Uses | Description |
| --- | --- |
| [wp\_upload\_dir()](wp_upload_dir) wp-includes/functions.php | Returns an array containing the current upload directory’s path and URL. |
| [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\_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 |
| Version | Description |
| --- | --- |
| [4.9.6](https://developer.wordpress.org/reference/since/4.9.6/) | Introduced. |
wordpress get_next_post_link( string $format = '%link »', string $link = '%title', bool $in_same_term = false, int[]|string $excluded_terms = '', string $taxonomy = 'category' ): string get\_next\_post\_link( string $format = '%link »', string $link = '%title', bool $in\_same\_term = false, int[]|string $excluded\_terms = '', string $taxonomy = 'category' ): string
===========================================================================================================================================================================================
Retrieves the next 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 next 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_next_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, false, $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. |
| [next\_post\_link()](next_post_link) wp-includes/link-template.php | Displays the next 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_style_is( string $handle, string $list = 'enqueued' ): bool wp\_style\_is( string $handle, string $list = 'enqueued' ): bool
================================================================
Check whether a CSS stylesheet has been added to the queue.
`$handle` string Required Name of the stylesheet. `$list` string Optional Status of the stylesheet to check. Default `'enqueued'`.
Accepts `'enqueued'`, `'registered'`, `'queue'`, `'to_do'`, and `'done'`. Default: `'enqueued'`
bool Whether style is queued.
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_is( $handle, $list = 'enqueued' ) {
_wp_scripts_maybe_doing_it_wrong( __FUNCTION__, $handle );
return (bool) wp_styles()->query( $handle, $list );
}
```
| Uses | Description |
| --- | --- |
| [wp\_styles()](wp_styles) wp-includes/functions.wp-styles.php | Initialize $wp\_styles if it has not been set. |
| Version | Description |
| --- | --- |
| [2.8.0](https://developer.wordpress.org/reference/since/2.8.0/) | Introduced. |
wordpress sticky_class( int $post_id = null ) sticky\_class( int $post\_id = null )
=====================================
This function has been deprecated. Use [post\_class()](post_class) instead.
Display “sticky” CSS class, if a post is sticky.
* [post\_class()](post_class)
`$post_id` int Optional An optional post ID. Default: `null`
File: `wp-includes/deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/deprecated.php/)
```
function sticky_class( $post_id = null ) {
_deprecated_function( __FUNCTION__, '3.5.0', 'post_class()' );
if ( is_sticky( $post_id ) )
echo ' sticky';
}
```
| Uses | Description |
| --- | --- |
| [is\_sticky()](is_sticky) wp-includes/post.php | Determines whether a post is sticky. |
| [\_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 [post\_class()](post_class) |
| [2.7.0](https://developer.wordpress.org/reference/since/2.7.0/) | Introduced. |
wordpress wp_update_link( array $linkdata ): int|WP_Error wp\_update\_link( array $linkdata ): int|WP\_Error
==================================================
Updates a link in the database.
`$linkdata` array Required Link data to update. See [wp\_insert\_link()](wp_insert_link) for accepted arguments. More Arguments from wp\_insert\_link( ... $linkdata ) Elements that make up the link to insert.
* `link_id`intOptional. The ID of the existing link if updating.
* `link_url`stringThe URL the link points to.
* `link_name`stringThe title of the link.
* `link_image`stringOptional. A URL of an image.
* `link_target`stringOptional. The target element for the anchor tag.
* `link_description`stringOptional. A short description of the link.
* `link_visible`stringOptional. `'Y'` means visible, anything else means not.
* `link_owner`intOptional. A user ID.
* `link_rating`intOptional. A rating for the link.
* `link_rel`stringOptional. A relationship of the link to you.
* `link_notes`stringOptional. An extended description of or notes on the link.
* `link_rss`stringOptional. A URL of an associated RSS feed.
* `link_category`intOptional. The term ID of the link category.
If empty, uses default link category.
int|[WP\_Error](../classes/wp_error) Value 0 or [WP\_Error](../classes/wp_error) on failure. The updated link ID on success.
File: `wp-admin/includes/bookmark.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/bookmark.php/)
```
function wp_update_link( $linkdata ) {
$link_id = (int) $linkdata['link_id'];
$link = get_bookmark( $link_id, ARRAY_A );
// Escape data pulled from DB.
$link = wp_slash( $link );
// Passed link category list overwrites existing category list if not empty.
if ( isset( $linkdata['link_category'] ) && is_array( $linkdata['link_category'] )
&& count( $linkdata['link_category'] ) > 0
) {
$link_cats = $linkdata['link_category'];
} else {
$link_cats = $link['link_category'];
}
// Merge old and new fields with new fields overwriting old ones.
$linkdata = array_merge( $link, $linkdata );
$linkdata['link_category'] = $link_cats;
return wp_insert_link( $linkdata );
}
```
| Uses | Description |
| --- | --- |
| [wp\_insert\_link()](wp_insert_link) wp-admin/includes/bookmark.php | Inserts a link into the database, or updates an existing link. |
| [get\_bookmark()](get_bookmark) wp-includes/bookmark.php | Retrieves bookmark data. |
| [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 |
| --- | --- |
| [edit\_link()](edit_link) wp-admin/includes/bookmark.php | Updates or inserts a link using values provided in $\_POST. |
| Version | Description |
| --- | --- |
| [2.0.0](https://developer.wordpress.org/reference/since/2.0.0/) | Introduced. |
wordpress the_author( string $deprecated = '', bool $deprecated_echo = true ): string|null the\_author( string $deprecated = '', bool $deprecated\_echo = true ): string|null
==================================================================================
Displays the name of the author of the current post.
The behavior of this function is based off of old functionality predating [get\_the\_author()](get_the_author) . This function is not deprecated, but is designed to echo the value from [get\_the\_author()](get_the_author) and as an result of any old theme that might still use the old behavior will also pass the value from [get\_the\_author()](get_the_author) .
The normal, expected behavior of this function is to echo the author and not return it. However, backward compatibility has to be maintained.
* [get\_the\_author()](get_the_author)
`$deprecated` string Optional Deprecated. Default: `''`
`$deprecated_echo` bool Optional Deprecated. Use [get\_the\_author()](get_the_author) . Echo the string or return it. Default: `true`
string|null The author's display name, from [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_author( $deprecated = '', $deprecated_echo = true ) {
if ( ! empty( $deprecated ) ) {
_deprecated_argument( __FUNCTION__, '2.1.0' );
}
if ( true !== $deprecated_echo ) {
_deprecated_argument(
__FUNCTION__,
'1.5.0',
sprintf(
/* translators: %s: get_the_author() */
__( 'Use %s instead if you do not want the value echoed.' ),
'<code>get_the_author()</code>'
)
);
}
if ( $deprecated_echo ) {
echo get_the_author();
}
return get_the_author();
}
```
| Uses | Description |
| --- | --- |
| [get\_the\_author()](get_the_author) wp-includes/author-template.php | Retrieves the author of the current post. |
| [\_\_()](__) 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. |
| Version | Description |
| --- | --- |
| [0.71](https://developer.wordpress.org/reference/since/0.71/) | Introduced. |
| programming_docs |
wordpress apply_filters_deprecated( string $hook_name, array $args, string $version, string $replacement = '', string $message = '' ) apply\_filters\_deprecated( string $hook\_name, array $args, string $version, string $replacement = '', string $message = '' )
==============================================================================================================================
Fires functions attached to a deprecated filter hook.
When a filter hook is deprecated, the [apply\_filters()](apply_filters) call is replaced with [apply\_filters\_deprecated()](apply_filters_deprecated) , which triggers a deprecation notice and then fires the original filter hook.
Note: the value and extra arguments passed to the original [apply\_filters()](apply_filters) call must be passed here to `$args` as an array. For example:
```
// Old filter.
return apply_filters( 'wpdocs_filter', $value, $extra_arg );
// Deprecated.
return apply_filters_deprecated( 'wpdocs_filter', array( $value, $extra_arg ), '4.9.0', 'wpdocs_new_filter' );
```
* [\_deprecated\_hook()](_deprecated_hook)
`$hook_name` string Required The name of the filter hook. `$args` array Required Array of additional function arguments to be passed to [apply\_filters()](apply_filters) . More Arguments from apply\_filters( ... $args ) Additional parameters to pass to the callback functions. `$version` string Required The version of WordPress that deprecated the hook. `$replacement` string Optional The hook that should have been used. Default: `''`
`$message` string Optional A message regarding the change. Default: `''`
File: `wp-includes/plugin.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/plugin.php/)
```
function apply_filters_deprecated( $hook_name, $args, $version, $replacement = '', $message = '' ) {
if ( ! has_filter( $hook_name ) ) {
return $args[0];
}
_deprecated_hook( $hook_name, $version, $replacement, $message );
return apply_filters_ref_array( $hook_name, $args );
}
```
| Uses | Description |
| --- | --- |
| [\_deprecated\_hook()](_deprecated_hook) wp-includes/functions.php | Marks a deprecated action or filter hook as deprecated and throws a notice. |
| [has\_filter()](has_filter) wp-includes/plugin.php | Checks if any filter has been registered for a 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. |
| 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. |
| [block\_editor\_rest\_api\_preload()](block_editor_rest_api_preload) wp-includes/block-editor.php | 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. |
| [get\_allowed\_block\_types()](get_allowed_block_types) wp-includes/block-editor.php | Gets the list of allowed block types to use in the block editor. |
| [get\_block\_categories()](get_block_categories) wp-includes/block-editor.php | Returns all the categories for block types that will be shown in the block editor. |
| [\_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\_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\_Site::get\_details()](../classes/wp_site/get_details) wp-includes/class-wp-site.php | Retrieves the details for this site. |
| [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. |
| [login\_header()](login_header) wp-login.php | Output the login page header. |
| [validate\_another\_blog\_signup()](validate_another_blog_signup) wp-signup.php | Validates a new site sign-up for an existing user. |
| [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\_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\_stream\_image()](wp_stream_image) wp-admin/includes/image-edit.php | Streams image in [WP\_Image\_Editor](../classes/wp_image_editor) to browser. |
| [media\_buttons()](media_buttons) wp-admin/includes/media.php | Adds the media button to the editor. |
| [WP\_Terms\_List\_Table::prepare\_items()](../classes/wp_terms_list_table/prepare_items) wp-admin/includes/class-wp-terms-list-table.php | |
| [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::build\_query\_string()](../classes/wp/build_query_string) wp-includes/class-wp.php | Sets the query string property based off of the query variable property. |
| [get\_posts\_by\_author\_sql()](get_posts_by_author_sql) wp-includes/post.php | Retrieves the post SQL based on capability, author, and type. |
| [WP\_Rewrite::mod\_rewrite\_rules()](../classes/wp_rewrite/mod_rewrite_rules) wp-includes/class-wp-rewrite.php | Retrieves mod\_rewrite-formatted rewrite rules to write to .htaccess. |
| [WP\_Rewrite::rewrite\_rules()](../classes/wp_rewrite/rewrite_rules) wp-includes/class-wp-rewrite.php | Constructs rewrite matches and queries from permalink structure. |
| [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\_Editors::editor()](../classes/_wp_editors/editor) wp-includes/class-wp-editor.php | Outputs the HTML for a single instance of the editor. |
| Version | Description |
| --- | --- |
| [4.6.0](https://developer.wordpress.org/reference/since/4.6.0/) | Introduced. |
wordpress bloginfo_rss( string $show = '' ) bloginfo\_rss( string $show = '' )
==================================
Displays RSS container for the bloginfo function.
You can retrieve anything that you can using the [get\_bloginfo()](get_bloginfo) function.
Everything will be stripped of tags and characters converted, when the values are retrieved for use in the feeds.
* [get\_bloginfo()](get_bloginfo) : For the list of possible values to display.
`$show` string Optional See [get\_bloginfo()](get_bloginfo) for possible values. More Arguments from get\_bloginfo( ... $show ) Site info to retrieve. Default empty (site name). Default: `''`
File: `wp-includes/feed.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/feed.php/)
```
function bloginfo_rss( $show = '' ) {
/**
* Filters the bloginfo for display in RSS feeds.
*
* @since 2.1.0
*
* @see get_bloginfo()
*
* @param string $rss_container RSS container for the blog information.
* @param string $show The type of blog information to retrieve.
*/
echo apply_filters( 'bloginfo_rss', get_bloginfo_rss( $show ), $show );
}
```
[apply\_filters( 'bloginfo\_rss', string $rss\_container, string $show )](../hooks/bloginfo_rss)
Filters the bloginfo for display in RSS feeds.
| Uses | Description |
| --- | --- |
| [get\_bloginfo\_rss()](get_bloginfo_rss) wp-includes/feed.php | Retrieves RSS container for the bloginfo function. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| Used By | Description |
| --- | --- |
| [export\_wp()](export_wp) wp-admin/includes/export.php | Generates the WXR export file for download. |
| Version | Description |
| --- | --- |
| [0.71](https://developer.wordpress.org/reference/since/0.71/) | Introduced. |
wordpress _wp_privacy_send_erasure_fulfillment_notification( int $request_id ) \_wp\_privacy\_send\_erasure\_fulfillment\_notification( int $request\_id )
===========================================================================
Notifies the user when their erasure request is fulfilled.
Without this, the user would never know if their data was actually erased.
`$request_id` int Required The privacy request post ID associated with this request. File: `wp-includes/user.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/user.php/)
```
function _wp_privacy_send_erasure_fulfillment_notification( $request_id ) {
$request = wp_get_user_request( $request_id );
if ( ! is_a( $request, 'WP_User_Request' ) || 'request-completed' !== $request->status ) {
return;
}
$already_notified = (bool) get_post_meta( $request_id, '_wp_user_notified', true );
if ( $already_notified ) {
return;
}
// Localize message content for user; fallback to site default for visitors.
if ( ! empty( $request->user_id ) ) {
$locale = get_user_locale( $request->user_id );
} else {
$locale = get_locale();
}
$switched_locale = switch_to_locale( $locale );
/**
* Filters the recipient of the data erasure fulfillment notification.
*
* @since 4.9.6
*
* @param string $user_email The email address of the notification recipient.
* @param WP_User_Request $request The request that is initiating the notification.
*/
$user_email = apply_filters( 'user_erasure_fulfillment_email_to', $request->email, $request );
$email_data = array(
'request' => $request,
'message_recipient' => $user_email,
'privacy_policy_url' => get_privacy_policy_url(),
'sitename' => wp_specialchars_decode( get_option( 'blogname' ), ENT_QUOTES ),
'siteurl' => home_url(),
);
$subject = sprintf(
/* translators: Erasure request fulfilled notification email subject. %s: Site title. */
__( '[%s] Erasure Request Fulfilled' ),
$email_data['sitename']
);
/**
* Filters the subject of the email sent when an erasure request is completed.
*
* @since 4.9.8
* @deprecated 5.8.0 Use {@see 'user_erasure_fulfillment_email_subject'} instead.
*
* @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 $message_recipient The address that the email will be sent to. Defaults
* to the value of `$request->email`, but can be changed
* by the `user_erasure_fulfillment_email_to` filter.
* @type string $privacy_policy_url Privacy policy URL.
* @type string $sitename The site name sending the mail.
* @type string $siteurl The site URL sending the mail.
* }
*/
$subject = apply_filters_deprecated(
'user_erasure_complete_email_subject',
array( $subject, $email_data['sitename'], $email_data ),
'5.8.0',
'user_erasure_fulfillment_email_subject'
);
/**
* Filters the subject of the email sent when an erasure request is completed.
*
* @since 5.8.0
*
* @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 $message_recipient The address that the email will be sent to. Defaults
* to the value of `$request->email`, but can be changed
* by the `user_erasure_fulfillment_email_to` filter.
* @type string $privacy_policy_url Privacy policy URL.
* @type string $sitename The site name sending the mail.
* @type string $siteurl The site URL sending the mail.
* }
*/
$subject = apply_filters( 'user_erasure_fulfillment_email_subject', $subject, $email_data['sitename'], $email_data );
/* translators: Do not translate SITENAME, SITEURL; those are placeholders. */
$content = __(
'Howdy,
Your request to erase your personal data on ###SITENAME### has been completed.
If you have any follow-up questions or concerns, please contact the site administrator.
Regards,
All at ###SITENAME###
###SITEURL###'
);
if ( ! empty( $email_data['privacy_policy_url'] ) ) {
/* translators: Do not translate SITENAME, SITEURL, PRIVACY_POLICY_URL; those are placeholders. */
$content = __(
'Howdy,
Your request to erase your personal data on ###SITENAME### has been completed.
If you have any follow-up questions or concerns, please contact the site administrator.
For more information, you can also read our privacy policy: ###PRIVACY_POLICY_URL###
Regards,
All at ###SITENAME###
###SITEURL###'
);
}
/**
* Filters the body of the data erasure fulfillment notification.
*
* The email is sent to a user when their data erasure request is fulfilled
* by an administrator.
*
* The following strings have a special meaning and will get replaced dynamically:
*
* ###SITENAME### The name of the site.
* ###PRIVACY_POLICY_URL### Privacy policy page URL.
* ###SITEURL### The URL to the site.
*
* @since 4.9.6
* @deprecated 5.8.0 Use {@see 'user_erasure_fulfillment_email_content'} instead.
* For user request confirmation email content
* use {@see 'user_request_confirmed_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 $message_recipient The address that the email will be sent to. Defaults
* to the value of `$request->email`, but can be changed
* by the `user_erasure_fulfillment_email_to` filter.
* @type string $privacy_policy_url Privacy policy URL.
* @type string $sitename The site name sending the mail.
* @type string $siteurl The site URL sending 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_erasure_fulfillment_email_content',
'user_request_confirmed_email_content'
)
);
/**
* Filters the body of the data erasure fulfillment notification.
*
* The email is sent to a user when their data erasure request is fulfilled
* by an administrator.
*
* The following strings have a special meaning and will get replaced dynamically:
*
* ###SITENAME### The name of the site.
* ###PRIVACY_POLICY_URL### Privacy policy page URL.
* ###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 $message_recipient The address that the email will be sent to. Defaults
* to the value of `$request->email`, but can be changed
* by the `user_erasure_fulfillment_email_to` filter.
* @type string $privacy_policy_url Privacy policy URL.
* @type string $sitename The site name sending the mail.
* @type string $siteurl The site URL sending the mail.
* }
*/
$content = apply_filters( 'user_erasure_fulfillment_email_content', $content, $email_data );
$content = str_replace( '###SITENAME###', $email_data['sitename'], $content );
$content = str_replace( '###PRIVACY_POLICY_URL###', $email_data['privacy_policy_url'], $content );
$content = str_replace( '###SITEURL###', sanitize_url( $email_data['siteurl'] ), $content );
$headers = '';
/**
* Filters the headers of the data erasure fulfillment notification.
*
* @since 5.4.0
* @deprecated 5.8.0 Use {@see 'user_erasure_fulfillment_email_headers'} instead.
*
* @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 $message_recipient The address that the email will be sent to. Defaults
* to the value of `$request->email`, but can be changed
* by the `user_erasure_fulfillment_email_to` filter.
* @type string $privacy_policy_url Privacy policy URL.
* @type string $sitename The site name sending the mail.
* @type string $siteurl The site URL sending the mail.
* }
*/
$headers = apply_filters_deprecated(
'user_erasure_complete_email_headers',
array( $headers, $subject, $content, $request_id, $email_data ),
'5.8.0',
'user_erasure_fulfillment_email_headers'
);
/**
* Filters the headers of the data erasure fulfillment notification.
*
* @since 5.8.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 $message_recipient The address that the email will be sent to. Defaults
* to the value of `$request->email`, but can be changed
* by the `user_erasure_fulfillment_email_to` filter.
* @type string $privacy_policy_url Privacy policy URL.
* @type string $sitename The site name sending the mail.
* @type string $siteurl The site URL sending the mail.
* }
*/
$headers = apply_filters( 'user_erasure_fulfillment_email_headers', $headers, $subject, $content, $request_id, $email_data );
$email_sent = wp_mail( $user_email, $subject, $content, $headers );
if ( $switched_locale ) {
restore_previous_locale();
}
if ( $email_sent ) {
update_post_meta( $request_id, '_wp_user_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\_deprecated( 'user\_erasure\_complete\_email\_headers', string|array $headers, string $subject, string $content, int $request\_id, array $email\_data )](../hooks/user_erasure_complete_email_headers)
Filters the headers of the data erasure fulfillment notification.
[apply\_filters\_deprecated( 'user\_erasure\_complete\_email\_subject', string $subject, string $sitename, array $email\_data )](../hooks/user_erasure_complete_email_subject)
Filters the subject of the email sent when an erasure request is completed.
[apply\_filters( 'user\_erasure\_fulfillment\_email\_content', string $content, array $email\_data )](../hooks/user_erasure_fulfillment_email_content)
Filters the body of the data erasure fulfillment notification.
[apply\_filters( 'user\_erasure\_fulfillment\_email\_headers', string|array $headers, string $subject, string $content, int $request\_id, array $email\_data )](../hooks/user_erasure_fulfillment_email_headers)
Filters the headers of the data erasure fulfillment notification.
[apply\_filters( 'user\_erasure\_fulfillment\_email\_subject', string $subject, string $sitename, array $email\_data )](../hooks/user_erasure_fulfillment_email_subject)
Filters the subject of the email sent when an erasure request is completed.
[apply\_filters( 'user\_erasure\_fulfillment\_email\_to', string $user\_email, WP\_User\_Request $request )](../hooks/user_erasure_fulfillment_email_to)
Filters the recipient of the data erasure fulfillment 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. |
| [get\_privacy\_policy\_url()](get_privacy_policy_url) wp-includes/link-template.php | Retrieves the URL to the privacy policy page. |
| [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. |
| [apply\_filters\_deprecated()](apply_filters_deprecated) wp-includes/plugin.php | Fires functions attached to a deprecated filter hook. |
| [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. |
| [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. |
| [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. |
| [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. |
| programming_docs |
wordpress wp_trim_excerpt( string $text = '', WP_Post|object|int $post = null ): string wp\_trim\_excerpt( string $text = '', WP\_Post|object|int $post = null ): string
================================================================================
Generates an excerpt from the content, if needed.
Returns a maximum of 55 words with an ellipsis appended if necessary.
The 55 word limit can be modified by plugins/themes using the [‘excerpt\_length’](../hooks/excerpt_length) filter The ‘ […]’ string can be modified by plugins/themes using the [‘excerpt\_more’](../hooks/excerpt_more) filter
`$text` string Optional The excerpt. If set to empty, an excerpt is generated. Default: `''`
`$post` [WP\_Post](../classes/wp_post)|object|int Optional [WP\_Post](../classes/wp_post) instance or Post ID/object. Default: `null`
string The excerpt.
File: `wp-includes/formatting.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/formatting.php/)
```
function wp_trim_excerpt( $text = '', $post = null ) {
$raw_excerpt = $text;
if ( '' === trim( $text ) ) {
$post = get_post( $post );
$text = get_the_content( '', false, $post );
$text = strip_shortcodes( $text );
$text = excerpt_remove_blocks( $text );
/** This filter is documented in wp-includes/post-template.php */
$text = apply_filters( 'the_content', $text );
$text = str_replace( ']]>', ']]>', $text );
/* translators: Maximum number of words used in a post excerpt. */
$excerpt_length = (int) _x( '55', 'excerpt_length' );
/**
* Filters the maximum number of words in a post excerpt.
*
* @since 2.7.0
*
* @param int $number The maximum number of words. Default 55.
*/
$excerpt_length = (int) apply_filters( 'excerpt_length', $excerpt_length );
/**
* Filters the string in the "more" link displayed after a trimmed excerpt.
*
* @since 2.9.0
*
* @param string $more_string The string shown within the more link.
*/
$excerpt_more = apply_filters( 'excerpt_more', ' ' . '[…]' );
$text = wp_trim_words( $text, $excerpt_length, $excerpt_more );
}
/**
* Filters the trimmed excerpt string.
*
* @since 2.8.0
*
* @param string $text The trimmed text.
* @param string $raw_excerpt The text prior to trimming.
*/
return apply_filters( 'wp_trim_excerpt', $text, $raw_excerpt );
}
```
[apply\_filters( 'excerpt\_length', int $number )](../hooks/excerpt_length)
Filters the maximum number of words in a post excerpt.
[apply\_filters( 'excerpt\_more', string $more\_string )](../hooks/excerpt_more)
Filters the string in the “more” link displayed after a trimmed excerpt.
[apply\_filters( 'the\_content', string $content )](../hooks/the_content)
Filters the post content.
[apply\_filters( 'wp\_trim\_excerpt', string $text, string $raw\_excerpt )](../hooks/wp_trim_excerpt)
Filters the trimmed excerpt string.
| Uses | Description |
| --- | --- |
| [excerpt\_remove\_blocks()](excerpt_remove_blocks) wp-includes/blocks.php | Parses blocks out of a content string, and renders those appropriate for the excerpt. |
| [wp\_trim\_words()](wp_trim_words) wp-includes/formatting.php | Trims text to a certain number of words. |
| [strip\_shortcodes()](strip_shortcodes) wp-includes/shortcodes.php | Removes all shortcode tags from the given content. |
| [get\_the\_content()](get_the_content) wp-includes/post-template.php | Retrieves the post content. |
| [\_x()](_x) wp-includes/l10n.php | Retrieves translated string with gettext context. |
| [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 |
| --- | --- |
| [5.2.0](https://developer.wordpress.org/reference/since/5.2.0/) | Added the `$post` parameter. |
| [1.5.0](https://developer.wordpress.org/reference/since/1.5.0/) | Introduced. |
wordpress get_terms_to_edit( int $post_id, string $taxonomy = 'post_tag' ): string|false|WP_Error get\_terms\_to\_edit( int $post\_id, string $taxonomy = 'post\_tag' ): string|false|WP\_Error
=============================================================================================
Gets comma-separated list of terms available to edit for the given post ID.
`$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_terms_to_edit( $post_id, $taxonomy = 'post_tag' ) {
$post_id = (int) $post_id;
if ( ! $post_id ) {
return false;
}
$terms = get_object_term_cache( $post_id, $taxonomy );
if ( false === $terms ) {
$terms = wp_get_object_terms( $post_id, $taxonomy );
wp_cache_add( $post_id, wp_list_pluck( $terms, 'term_id' ), $taxonomy . '_relationships' );
}
if ( ! $terms ) {
return false;
}
if ( is_wp_error( $terms ) ) {
return $terms;
}
$term_names = array();
foreach ( $terms as $term ) {
$term_names[] = $term->name;
}
$terms_to_edit = esc_attr( implode( ',', $term_names ) );
/**
* Filters the comma-separated list of terms available to edit.
*
* @since 2.8.0
*
* @see get_terms_to_edit()
*
* @param string $terms_to_edit A comma-separated list of term names.
* @param string $taxonomy The taxonomy name for which to retrieve terms.
*/
$terms_to_edit = apply_filters( 'terms_to_edit', $terms_to_edit, $taxonomy );
return $terms_to_edit;
}
```
[apply\_filters( 'terms\_to\_edit', string $terms\_to\_edit, string $taxonomy )](../hooks/terms_to_edit)
Filters the comma-separated list of terms available to edit.
| Uses | Description |
| --- | --- |
| [wp\_cache\_add()](wp_cache_add) wp-includes/cache.php | Adds data to the cache, if the cache key doesn’t already exist. |
| [wp\_list\_pluck()](wp_list_pluck) wp-includes/functions.php | Plucks a certain field out of each object or array in an array. |
| [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. |
| [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. |
| [is\_wp\_error()](is_wp_error) wp-includes/load.php | Checks whether the given variable is a WordPress Error. |
| Used By | Description |
| --- | --- |
| [get\_tags\_to\_edit()](get_tags_to_edit) wp-admin/includes/taxonomy.php | Gets comma-separated list of tags available to edit. |
| [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\_tags\_meta\_box()](post_tags_meta_box) wp-admin/includes/meta-boxes.php | Displays post tags form fields. |
| Version | Description |
| --- | --- |
| [2.8.0](https://developer.wordpress.org/reference/since/2.8.0/) | Introduced. |
wordpress wpmu_admin_do_redirect( string $url = '' ) wpmu\_admin\_do\_redirect( string $url = '' )
=============================================
This function has been deprecated. Use [wp\_redirect()](wp_redirect) instead.
Redirect a user based on $\_GET or $\_POST arguments.
The function looks for redirect arguments in the following order: 1) $\_GET[‘ref’] 2) $\_POST[‘ref’] 3) $\_SERVER[‘HTTP\_REFERER’] 4) $\_GET[‘redirect’] 5) $\_POST[‘redirect’] 6) $url
* [wp\_redirect()](wp_redirect)
`$url` string Optional Redirect URL. Default: `''`
File: `wp-includes/ms-deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/ms-deprecated.php/)
```
function wpmu_admin_do_redirect( $url = '' ) {
_deprecated_function( __FUNCTION__, '3.3.0', 'wp_redirect()' );
$ref = '';
if ( isset( $_GET['ref'] ) && isset( $_POST['ref'] ) && $_GET['ref'] !== $_POST['ref'] ) {
wp_die( __( 'A variable mismatch has been detected.' ), __( 'Sorry, you are not allowed to view this item.' ), 400 );
} elseif ( isset( $_POST['ref'] ) ) {
$ref = $_POST['ref'];
} elseif ( isset( $_GET['ref'] ) ) {
$ref = $_GET['ref'];
}
if ( $ref ) {
$ref = wpmu_admin_redirect_add_updated_param( $ref );
wp_redirect( $ref );
exit;
}
if ( ! empty( $_SERVER['HTTP_REFERER'] ) ) {
wp_redirect( $_SERVER['HTTP_REFERER'] );
exit;
}
$url = wpmu_admin_redirect_add_updated_param( $url );
if ( isset( $_GET['redirect'] ) && isset( $_POST['redirect'] ) && $_GET['redirect'] !== $_POST['redirect'] ) {
wp_die( __( 'A variable mismatch has been detected.' ), __( 'Sorry, you are not allowed to view this item.' ), 400 );
} elseif ( isset( $_GET['redirect'] ) ) {
if ( 's_' === substr( $_GET['redirect'], 0, 2 ) )
$url .= '&action=blogs&s='. esc_html( substr( $_GET['redirect'], 2 ) );
} elseif ( isset( $_POST['redirect'] ) ) {
$url = wpmu_admin_redirect_add_updated_param( $_POST['redirect'] );
}
wp_redirect( $url );
exit;
}
```
| Uses | Description |
| --- | --- |
| [wp\_redirect()](wp_redirect) wp-includes/pluggable.php | Redirects to another page. |
| [wpmu\_admin\_redirect\_add\_updated\_param()](wpmu_admin_redirect_add_updated_param) wp-includes/ms-deprecated.php | Adds an ‘updated=true’ argument to a URL. |
| [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. |
| [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. |
| [wp\_die()](wp_die) wp-includes/functions.php | Kills WordPress execution and displays HTML page with an error message. |
| Version | Description |
| --- | --- |
| [3.3.0](https://developer.wordpress.org/reference/since/3.3.0/) | Use [wp\_redirect()](wp_redirect) |
| [MU (3.0.0)](https://developer.wordpress.org/reference/since/mu.3.0.0/) | Introduced. |
wordpress update_meta( int $meta_id, string $meta_key, string $meta_value ): bool update\_meta( int $meta\_id, string $meta\_key, string $meta\_value ): bool
===========================================================================
Updates post meta data by meta ID.
`$meta_id` int Required Meta ID. `$meta_key` string Required Meta key. Expect slashed. `$meta_value` string Required Meta value. Expect slashed. bool
File: `wp-admin/includes/post.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/post.php/)
```
function update_meta( $meta_id, $meta_key, $meta_value ) {
$meta_key = wp_unslash( $meta_key );
$meta_value = wp_unslash( $meta_value );
return update_metadata_by_mid( 'post', $meta_id, $meta_value, $meta_key );
}
```
| Uses | Description |
| --- | --- |
| [update\_metadata\_by\_mid()](update_metadata_by_mid) wp-includes/meta.php | Updates metadata by meta ID. |
| [wp\_unslash()](wp_unslash) wp-includes/formatting.php | Removes slashes from a string or recursively removes slashes from strings within an array. |
| Used By | Description |
| --- | --- |
| [edit\_post()](edit_post) wp-admin/includes/post.php | Updates an existing post with values provided in `$_POST`. |
| Version | Description |
| --- | --- |
| [1.2.0](https://developer.wordpress.org/reference/since/1.2.0/) | Introduced. |
wordpress wp_print_community_events_templates() wp\_print\_community\_events\_templates()
=========================================
Renders the events templates for the Event and News widget.
File: `wp-admin/includes/dashboard.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/dashboard.php/)
```
function wp_print_community_events_templates() {
?>
<script id="tmpl-community-events-attend-event-near" type="text/template">
<?php
printf(
/* translators: %s: The name of a city. */
__( 'Attend an upcoming event near %s.' ),
'<strong>{{ data.location.description }}</strong>'
);
?>
</script>
<script id="tmpl-community-events-could-not-locate" type="text/template">
<?php
printf(
/* translators: %s is the name of the city we couldn't locate.
* Replace the examples with cities in your locale, but test
* that they match the expected location before including them.
* Use endonyms (native locale names) whenever possible.
*/
__( '%s could not be located. Please try another nearby city. For example: Kansas City; Springfield; Portland.' ),
'<em>{{data.unknownCity}}</em>'
);
?>
</script>
<script id="tmpl-community-events-event-list" type="text/template">
<# _.each( data.events, function( event ) { #>
<li class="event event-{{ event.type }} wp-clearfix">
<div class="event-info">
<div class="dashicons event-icon" aria-hidden="true"></div>
<div class="event-info-inner">
<a class="event-title" href="{{ event.url }}">{{ event.title }}</a>
<span class="event-city">{{ event.location.location }}</span>
</div>
</div>
<div class="event-date-time">
<span class="event-date">{{ event.user_formatted_date }}</span>
<# if ( 'meetup' === event.type ) { #>
<span class="event-time">
{{ event.user_formatted_time }} {{ event.timeZoneAbbreviation }}
</span>
<# } #>
</div>
</li>
<# } ) #>
<# if ( data.events.length <= 2 ) { #>
<li class="event-none">
<?php
printf(
/* translators: %s: Localized meetup organization documentation URL. */
__( 'Want more events? <a href="%s">Help organize the next one</a>!' ),
__( 'https://make.wordpress.org/community/organize-event-landing-page/' )
);
?>
</li>
<# } #>
</script>
<script id="tmpl-community-events-no-upcoming-events" type="text/template">
<li class="event-none">
<# if ( data.location.description ) { #>
<?php
printf(
/* translators: 1: The city the user searched for, 2: Meetup organization documentation URL. */
__( 'There are no events scheduled near %1$s at the moment. Would you like to <a href="%2$s">organize a WordPress event</a>?' ),
'{{ data.location.description }}',
__( 'https://make.wordpress.org/community/handbook/meetup-organizer/welcome/' )
);
?>
<# } else { #>
<?php
printf(
/* translators: %s: Meetup organization documentation URL. */
__( 'There are no events scheduled near you at the moment. Would you like to <a href="%s">organize a WordPress event</a>?' ),
__( 'https://make.wordpress.org/community/handbook/meetup-organizer/welcome/' )
);
?>
<# } #>
</li>
</script>
<?php
}
```
| Uses | Description |
| --- | --- |
| [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. |
| Version | Description |
| --- | --- |
| [4.8.0](https://developer.wordpress.org/reference/since/4.8.0/) | Introduced. |
wordpress wp_ajax_update_widget() wp\_ajax\_update\_widget()
==========================
Ajax handler for updating a widget.
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_update_widget() {
global $wp_customize;
$wp_customize->widgets->wp_ajax_update_widget();
}
```
| Version | Description |
| --- | --- |
| [3.9.0](https://developer.wordpress.org/reference/since/3.9.0/) | Introduced. |
wordpress wp_robots_noindex_embeds( array $robots ): array wp\_robots\_noindex\_embeds( array $robots ): array
===================================================
Adds `noindex` to the robots meta tag for embeds.
Typical usage is as a [‘wp\_robots’](../hooks/wp_robots) callback:
```
add_filter( 'wp_robots', 'wp_robots_noindex_embeds' );
```
* [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_embeds( array $robots ) {
if ( is_embed() ) {
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\_embed()](is_embed) wp-includes/query.php | Is the query for an embedded post? |
| Version | Description |
| --- | --- |
| [5.7.0](https://developer.wordpress.org/reference/since/5.7.0/) | Introduced. |
wordpress wp_check_comment_disallowed_list( string $author, string $email, string $url, string $comment, string $user_ip, string $user_agent ): bool wp\_check\_comment\_disallowed\_list( string $author, string $email, string $url, string $comment, string $user\_ip, string $user\_agent ): bool
================================================================================================================================================
Checks if a comment contains disallowed characters or words.
`$author` string Required The author of the comment `$email` string Required The email of the comment `$url` string Required The url used in the comment `$comment` string Required The comment content `$user_ip` string Required The comment author's IP address `$user_agent` string Required The author's browser user agent bool True if comment contains disallowed content, false if comment does not
File: `wp-includes/comment.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/comment.php/)
```
function wp_check_comment_disallowed_list( $author, $email, $url, $comment, $user_ip, $user_agent ) {
/**
* Fires before the comment is tested for disallowed characters or words.
*
* @since 1.5.0
* @deprecated 5.5.0 Use {@see 'wp_check_comment_disallowed_list'} instead.
*
* @param string $author Comment author.
* @param string $email Comment author's email.
* @param string $url Comment author's URL.
* @param string $comment Comment content.
* @param string $user_ip Comment author's IP address.
* @param string $user_agent Comment author's browser user agent.
*/
do_action_deprecated(
'wp_blacklist_check',
array( $author, $email, $url, $comment, $user_ip, $user_agent ),
'5.5.0',
'wp_check_comment_disallowed_list',
__( 'Please consider writing more inclusive code.' )
);
/**
* Fires before the comment is tested for disallowed characters or words.
*
* @since 5.5.0
*
* @param string $author Comment author.
* @param string $email Comment author's email.
* @param string $url Comment author's URL.
* @param string $comment Comment content.
* @param string $user_ip Comment author's IP address.
* @param string $user_agent Comment author's browser user agent.
*/
do_action( 'wp_check_comment_disallowed_list', $author, $email, $url, $comment, $user_ip, $user_agent );
$mod_keys = trim( get_option( 'disallowed_keys' ) );
if ( '' === $mod_keys ) {
return false; // If moderation keys are empty.
}
// Ensure HTML tags are not being used to bypass the list of disallowed characters and words.
$comment_without_html = wp_strip_all_tags( $comment );
$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 '#' chars
// in the spam words don't break things:
$word = preg_quote( $word, '#' );
$pattern = "#$word#i";
if ( preg_match( $pattern, $author )
|| preg_match( $pattern, $email )
|| preg_match( $pattern, $url )
|| preg_match( $pattern, $comment )
|| preg_match( $pattern, $comment_without_html )
|| preg_match( $pattern, $user_ip )
|| preg_match( $pattern, $user_agent )
) {
return true;
}
}
return false;
}
```
[do\_action\_deprecated( 'wp\_blacklist\_check', string $author, string $email, string $url, string $comment, string $user\_ip, string $user\_agent )](../hooks/wp_blacklist_check)
Fires before the comment is tested for disallowed characters or words.
[do\_action( 'wp\_check\_comment\_disallowed\_list', string $author, string $email, string $url, string $comment, string $user\_ip, string $user\_agent )](../hooks/wp_check_comment_disallowed_list)
Fires before the comment is tested for disallowed characters or words.
| Uses | Description |
| --- | --- |
| [do\_action\_deprecated()](do_action_deprecated) wp-includes/plugin.php | Fires functions attached to a deprecated action hook. |
| [wp\_strip\_all\_tags()](wp_strip_all_tags) wp-includes/formatting.php | Properly strips all HTML tags including script and style |
| [\_\_()](__) 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. |
| [get\_option()](get_option) wp-includes/option.php | Retrieves an option value based on an option name. |
| Used By | Description |
| --- | --- |
| [wp\_blacklist\_check()](wp_blacklist_check) wp-includes/deprecated.php | Does comment contain disallowed characters or words. |
| [wp\_allow\_comment()](wp_allow_comment) wp-includes/comment.php | Validates whether this comment is allowed to be made. |
| Version | Description |
| --- | --- |
| [5.5.0](https://developer.wordpress.org/reference/since/5.5.0/) | Introduced. |
| programming_docs |
wordpress rest_parse_hex_color( string $color ): string|false rest\_parse\_hex\_color( string $color ): string|false
======================================================
Parses a 3 or 6 digit hex color (with #).
`$color` string Required 3 or 6 digit hex color (with #). string|false
File: `wp-includes/rest-api.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/rest-api.php/)
```
function rest_parse_hex_color( $color ) {
$regex = '|^#([A-Fa-f0-9]{3}){1,2}$|';
if ( ! preg_match( $regex, $color, $matches ) ) {
return false;
}
return $color;
}
```
| 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.4.0](https://developer.wordpress.org/reference/since/5.4.0/) | Introduced. |
wordpress wp_maybe_decline_date( string $date, string $format = '' ): string wp\_maybe\_decline\_date( string $date, string $format = '' ): string
=====================================================================
Determines if the date should be declined.
If the locale specifies that month names require a genitive case in certain formats (like ‘j F Y’), the month name will be replaced with a correct form.
`$date` string Required Formatted date string. `$format` string Optional Date format to check. Default: `''`
string The date, declined if locale specifies it.
File: `wp-includes/functions.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/functions.php/)
```
function wp_maybe_decline_date( $date, $format = '' ) {
global $wp_locale;
// i18n functions are not available in SHORTINIT mode.
if ( ! function_exists( '_x' ) ) {
return $date;
}
/*
* translators: If months in your language require a genitive case,
* translate this to 'on'. Do not translate into your own language.
*/
if ( 'on' === _x( 'off', 'decline months names: on or off' ) ) {
$months = $wp_locale->month;
$months_genitive = $wp_locale->month_genitive;
/*
* Match a format like 'j F Y' or 'j. F' (day of the month, followed by month name)
* and decline the month.
*/
if ( $format ) {
$decline = preg_match( '#[dj]\.? F#', $format );
} else {
// If the format is not passed, try to guess it from the date string.
$decline = preg_match( '#\b\d{1,2}\.? [^\d ]+\b#u', $date );
}
if ( $decline ) {
foreach ( $months as $key => $month ) {
$months[ $key ] = '# ' . preg_quote( $month, '#' ) . '\b#u';
}
foreach ( $months_genitive as $key => $month ) {
$months_genitive[ $key ] = ' ' . $month;
}
$date = preg_replace( $months, $months_genitive, $date );
}
/*
* Match a format like 'F jS' or 'F j' (month name, followed by day with an optional ordinal suffix)
* and change it to declined 'j F'.
*/
if ( $format ) {
$decline = preg_match( '#F [dj]#', $format );
} else {
// If the format is not passed, try to guess it from the date string.
$decline = preg_match( '#\b[^\d ]+ \d{1,2}(st|nd|rd|th)?\b#u', trim( $date ) );
}
if ( $decline ) {
foreach ( $months as $key => $month ) {
$months[ $key ] = '#\b' . preg_quote( $month, '#' ) . ' (\d{1,2})(st|nd|rd|th)?([-–]\d{1,2})?(st|nd|rd|th)?\b#u';
}
foreach ( $months_genitive as $key => $month ) {
$months_genitive[ $key ] = '$1$3 ' . $month;
}
$date = preg_replace( $months, $months_genitive, $date );
}
}
// Used for locale-specific rules.
$locale = get_locale();
if ( 'ca' === $locale ) {
// " de abril| de agost| de octubre..." -> " d'abril| d'agost| d'octubre..."
$date = preg_replace( '# de ([ao])#i', " d'\\1", $date );
}
return $date;
}
```
| Uses | Description |
| --- | --- |
| [get\_locale()](get_locale) wp-includes/l10n.php | Retrieves the current locale. |
| [\_x()](_x) wp-includes/l10n.php | Retrieves translated string with gettext context. |
| Used By | Description |
| --- | --- |
| [wp\_date()](wp_date) wp-includes/functions.php | Retrieves the date, in localized format. |
| [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. |
| Version | Description |
| --- | --- |
| [5.4.0](https://developer.wordpress.org/reference/since/5.4.0/) | The `$format` parameter was added. |
| [4.4.0](https://developer.wordpress.org/reference/since/4.4.0/) | Introduced. |
wordpress media_buttons( string $editor_id = 'content' ) media\_buttons( string $editor\_id = 'content' )
================================================
Adds the media button to the editor.
`$editor_id` string Optional Default: `'content'`
File: `wp-admin/includes/media.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/media.php/)
```
function media_buttons( $editor_id = 'content' ) {
static $instance = 0;
$instance++;
$post = get_post();
if ( ! $post && ! empty( $GLOBALS['post_ID'] ) ) {
$post = $GLOBALS['post_ID'];
}
wp_enqueue_media( array( 'post' => $post ) );
$img = '<span class="wp-media-buttons-icon"></span> ';
$id_attribute = 1 === $instance ? ' id="insert-media-button"' : '';
printf(
'<button type="button"%s class="button insert-media add_media" data-editor="%s">%s</button>',
$id_attribute,
esc_attr( $editor_id ),
$img . __( 'Add Media' )
);
/**
* Filters the legacy (pre-3.5.0) media buttons.
*
* Use {@see 'media_buttons'} action instead.
*
* @since 2.5.0
* @deprecated 3.5.0 Use {@see 'media_buttons'} action instead.
*
* @param string $string Media buttons context. Default empty.
*/
$legacy_filter = apply_filters_deprecated( 'media_buttons_context', array( '' ), '3.5.0', 'media_buttons' );
if ( $legacy_filter ) {
// #WP22559. Close <a> if a plugin started by closing <a> to open their own <a> tag.
if ( 0 === stripos( trim( $legacy_filter ), '</a>' ) ) {
$legacy_filter .= '</a>';
}
echo $legacy_filter;
}
}
```
[apply\_filters\_deprecated( 'media\_buttons\_context', string $string )](../hooks/media_buttons_context)
Filters the legacy (pre-3.5.0) media buttons.
| Uses | Description |
| --- | --- |
| [stripos()](stripos) wp-includes/class-pop3.php | |
| [apply\_filters\_deprecated()](apply_filters_deprecated) wp-includes/plugin.php | Fires functions attached to a deprecated filter hook. |
| [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-includes/l10n.php | Retrieves the translation of $text. |
| [esc\_attr()](esc_attr) wp-includes/formatting.php | Escaping for HTML attributes. |
| [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/) | Introduced. |
wordpress add_users_page( string $page_title, string $menu_title, string $capability, string $menu_slug, callable $callback = '', int $position = null ): string|false add\_users\_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 Users/Profile 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.
* NOTE: If you’re running into the »*You do not have sufficient permissions to access this page.*« message in a `[wp\_die()](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 ‘`users.php`‘ or ‘`profile.php`‘ (depending upon the users’ capability) as the `$parent_slug` argument. This means the new page will be added as a sub-menu to the *Users* or *Profile* menu.
* The *Users* menu is only available to users with the ability to edit other users. Users with capability below this level will see a *Profile* menu instead.
File: `wp-admin/includes/plugin.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/plugin.php/)
```
function add_users_page( $page_title, $menu_title, $capability, $menu_slug, $callback = '', $position = null ) {
if ( current_user_can( 'edit_users' ) ) {
$parent = 'users.php';
} else {
$parent = 'profile.php';
}
return add_submenu_page( $parent, $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. |
| [current\_user\_can()](current_user_can) wp-includes/capabilities.php | Returns whether the current user has the specified capability. |
| Version | Description |
| --- | --- |
| [5.3.0](https://developer.wordpress.org/reference/since/5.3.0/) | Added the `$position` parameter. |
| [2.1.3](https://developer.wordpress.org/reference/since/2.1.3/) | Introduced. |
wordpress _wp_upload_dir( string $time = null ): array \_wp\_upload\_dir( string $time = null ): 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.
A non-filtered, non-cached version of [wp\_upload\_dir()](wp_upload_dir) that doesn’t check the path.
`$time` string Optional Time formatted in `'yyyy/mm'`. Default: `null`
array See [wp\_upload\_dir()](wp_upload_dir)
File: `wp-includes/functions.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/functions.php/)
```
function _wp_upload_dir( $time = null ) {
$siteurl = get_option( 'siteurl' );
$upload_path = trim( get_option( 'upload_path' ) );
if ( empty( $upload_path ) || 'wp-content/uploads' === $upload_path ) {
$dir = WP_CONTENT_DIR . '/uploads';
} elseif ( 0 !== strpos( $upload_path, ABSPATH ) ) {
// $dir is absolute, $upload_path is (maybe) relative to ABSPATH.
$dir = path_join( ABSPATH, $upload_path );
} else {
$dir = $upload_path;
}
$url = get_option( 'upload_url_path' );
if ( ! $url ) {
if ( empty( $upload_path ) || ( 'wp-content/uploads' === $upload_path ) || ( $upload_path == $dir ) ) {
$url = WP_CONTENT_URL . '/uploads';
} else {
$url = trailingslashit( $siteurl ) . $upload_path;
}
}
/*
* Honor the value of UPLOADS. This happens as long as ms-files rewriting is disabled.
* We also sometimes obey UPLOADS when rewriting is enabled -- see the next block.
*/
if ( defined( 'UPLOADS' ) && ! ( is_multisite() && get_site_option( 'ms_files_rewriting' ) ) ) {
$dir = ABSPATH . UPLOADS;
$url = trailingslashit( $siteurl ) . UPLOADS;
}
// If multisite (and if not the main site in a post-MU network).
if ( is_multisite() && ! ( is_main_network() && is_main_site() && defined( 'MULTISITE' ) ) ) {
if ( ! get_site_option( 'ms_files_rewriting' ) ) {
/*
* If ms-files rewriting is disabled (networks created post-3.5), it is fairly
* straightforward: Append sites/%d if we're not on the main site (for post-MU
* networks). (The extra directory prevents a four-digit ID from conflicting with
* a year-based directory for the main site. But if a MU-era network has disabled
* ms-files rewriting manually, they don't need the extra directory, as they never
* had wp-content/uploads for the main site.)
*/
if ( defined( 'MULTISITE' ) ) {
$ms_dir = '/sites/' . get_current_blog_id();
} else {
$ms_dir = '/' . get_current_blog_id();
}
$dir .= $ms_dir;
$url .= $ms_dir;
} elseif ( defined( 'UPLOADS' ) && ! ms_is_switched() ) {
/*
* Handle the old-form ms-files.php rewriting if the network still has that enabled.
* When ms-files rewriting is enabled, then we only listen to UPLOADS when:
* 1) We are not on the main site in a post-MU network, as wp-content/uploads is used
* there, and
* 2) We are not switched, as ms_upload_constants() hardcodes these constants to reflect
* the original blog ID.
*
* Rather than UPLOADS, we actually use BLOGUPLOADDIR if it is set, as it is absolute.
* (And it will be set, see ms_upload_constants().) Otherwise, UPLOADS can be used, as
* as it is relative to ABSPATH. For the final piece: when UPLOADS is used with ms-files
* rewriting in multisite, the resulting URL is /files. (#WP22702 for background.)
*/
if ( defined( 'BLOGUPLOADDIR' ) ) {
$dir = untrailingslashit( BLOGUPLOADDIR );
} else {
$dir = ABSPATH . UPLOADS;
}
$url = trailingslashit( $siteurl ) . 'files';
}
}
$basedir = $dir;
$baseurl = $url;
$subdir = '';
if ( get_option( 'uploads_use_yearmonth_folders' ) ) {
// Generate the yearly and monthly directories.
if ( ! $time ) {
$time = current_time( 'mysql' );
}
$y = substr( $time, 0, 4 );
$m = substr( $time, 5, 2 );
$subdir = "/$y/$m";
}
$dir .= $subdir;
$url .= $subdir;
return array(
'path' => $dir,
'url' => $url,
'subdir' => $subdir,
'basedir' => $basedir,
'baseurl' => $baseurl,
'error' => false,
);
}
```
| Uses | Description |
| --- | --- |
| [untrailingslashit()](untrailingslashit) wp-includes/formatting.php | Removes trailing forward slashes and backslashes if they exist. |
| [is\_main\_network()](is_main_network) wp-includes/functions.php | Determines whether a network is the main network of the Multisite installation. |
| [is\_main\_site()](is_main_site) wp-includes/functions.php | Determines whether a site is the main site of the current network. |
| [path\_join()](path_join) wp-includes/functions.php | Joins two filesystem paths together. |
| [current\_time()](current_time) wp-includes/functions.php | Retrieves the current time based on specified type. |
| [ms\_is\_switched()](ms_is_switched) wp-includes/ms-blogs.php | Determines if [switch\_to\_blog()](switch_to_blog) is in effect |
| [trailingslashit()](trailingslashit) wp-includes/formatting.php | Appends a trailing slash. |
| [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. |
| [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. |
| Used By | Description |
| --- | --- |
| [wp\_upload\_dir()](wp_upload_dir) wp-includes/functions.php | Returns an array containing the current upload directory’s path and URL. |
| Version | Description |
| --- | --- |
| [4.5.0](https://developer.wordpress.org/reference/since/4.5.0/) | Introduced. |
wordpress wp_ajax_add_user( string $action ) wp\_ajax\_add\_user( string $action )
=====================================
Ajax handler for adding a user.
`$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_user( $action ) {
if ( empty( $action ) ) {
$action = 'add-user';
}
check_ajax_referer( $action );
if ( ! current_user_can( 'create_users' ) ) {
wp_die( -1 );
}
$user_id = edit_user();
if ( ! $user_id ) {
wp_die( 0 );
} elseif ( is_wp_error( $user_id ) ) {
$x = new WP_Ajax_Response(
array(
'what' => 'user',
'id' => $user_id,
)
);
$x->send();
}
$user_object = get_userdata( $user_id );
$wp_list_table = _get_list_table( 'WP_Users_List_Table' );
$role = current( $user_object->roles );
$x = new WP_Ajax_Response(
array(
'what' => 'user',
'id' => $user_id,
'data' => $wp_list_table->single_row( $user_object, '', $role ),
'supplemental' => array(
'show-link' => sprintf(
/* translators: %s: The new user. */
__( 'User %s added' ),
'<a href="#user-' . $user_id . '">' . $user_object->user_login . '</a>'
),
'role' => $role,
),
)
);
$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\_user()](edit_user) wp-admin/includes/user.php | Edit user settings based on contents of $\_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. |
| [get\_userdata()](get_userdata) wp-includes/pluggable.php | Retrieves user info by user ID. |
| [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.1.0](https://developer.wordpress.org/reference/since/3.1.0/) | Introduced. |
wordpress _prime_post_caches( int[] $ids, bool $update_term_cache = true, bool $update_meta_cache = true ) \_prime\_post\_caches( int[] $ids, bool $update\_term\_cache = true, bool $update\_meta\_cache = true )
=======================================================================================================
Adds any posts from the given IDs to the cache that do not already exist in cache.
* [update\_post\_caches()](update_post_caches)
`$ids` int[] Required ID list. `$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`
File: `wp-includes/post.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/post.php/)
```
function _prime_post_caches( $ids, $update_term_cache = true, $update_meta_cache = true ) {
global $wpdb;
$non_cached_ids = _get_non_cached_ids( $ids, 'posts' );
if ( ! empty( $non_cached_ids ) ) {
$fresh_posts = $wpdb->get_results( sprintf( "SELECT $wpdb->posts.* FROM $wpdb->posts WHERE ID IN (%s)", implode( ',', $non_cached_ids ) ) );
update_post_caches( $fresh_posts, 'any', $update_term_cache, $update_meta_cache );
}
}
```
| Uses | Description |
| --- | --- |
| [\_get\_non\_cached\_ids()](_get_non_cached_ids) wp-includes/functions.php | Retrieves IDs that are not already present in the cache. |
| [update\_post\_caches()](update_post_caches) wp-includes/post.php | Updates post, term, and metadata caches for a list of post 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). |
| Used By | Description |
| --- | --- |
| [update\_menu\_item\_cache()](update_menu_item_cache) wp-includes/nav-menu.php | Updates post and term caches for all linked objects for a list of menu items. |
| [update\_post\_parent\_caches()](update_post_parent_caches) wp-includes/post.php | Updates parent post caches for a list of post objects. |
| [wp\_filter\_content\_tags()](wp_filter_content_tags) wp-includes/media.php | Filters specific tags in post content and modifies their markup. |
| [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. |
| [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\_Query::get\_posts()](../classes/wp_query/get_posts) wp-includes/class-wp-query.php | Retrieves an array of posts based on query variables. |
| [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. |
| [update\_post\_thumbnail\_cache()](update_post_thumbnail_cache) wp-includes/post-thumbnail-template.php | Updates cache for thumbnails in the current loop. |
| [get\_pages()](get_pages) wp-includes/post.php | Retrieves an array of pages (or hierarchical post type items). |
| 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. |
| programming_docs |
wordpress wp_filesize( string $path ): int wp\_filesize( string $path ): int
=================================
Wrapper for PHP filesize with filters and casting the result as an integer.
`$path` string Required Path to the file. int The size of the file in bytes, or 0 in the event of an error.
File: `wp-includes/functions.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/functions.php/)
```
function wp_filesize( $path ) {
/**
* Filters the result of wp_filesize before the PHP function is run.
*
* @since 6.0.0
*
* @param null|int $size The unfiltered value. Returning an int from the callback bypasses the filesize call.
* @param string $path Path to the file.
*/
$size = apply_filters( 'pre_wp_filesize', null, $path );
if ( is_int( $size ) ) {
return $size;
}
$size = file_exists( $path ) ? (int) filesize( $path ) : 0;
/**
* Filters the size of the file.
*
* @since 6.0.0
*
* @param int $size The result of PHP filesize on the file.
* @param string $path Path to the file.
*/
return (int) apply_filters( 'wp_filesize', $size, $path );
}
```
[apply\_filters( 'pre\_wp\_filesize', null|int $size, string $path )](../hooks/pre_wp_filesize)
Filters the result of wp\_filesize before the PHP function is run.
[apply\_filters( 'wp\_filesize', int $size, string $path )](../hooks/wp_filesize)
Filters the size of the file.
| 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\_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\_generate\_attachment\_metadata()](wp_generate_attachment_metadata) wp-admin/includes/image.php | Generates attachment meta data and create image sub-sizes for images. |
| [attachment\_submitbox\_metadata()](attachment_submitbox_metadata) wp-admin/includes/media.php | Displays non-editable attachment metadata in the publish meta box. |
| [WP\_Image\_Editor\_Imagick::\_save()](../classes/wp_image_editor_imagick/_save) wp-includes/class-wp-image-editor-imagick.php | |
| [WP\_Image\_Editor\_GD::\_save()](../classes/wp_image_editor_gd/_save) wp-includes/class-wp-image-editor-gd.php | |
| [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 |
| --- | --- |
| [6.0.0](https://developer.wordpress.org/reference/since/6.0.0/) | Introduced. |
wordpress wp_img_tag_add_width_and_height_attr( string $image, string $context, int $attachment_id ): string wp\_img\_tag\_add\_width\_and\_height\_attr( string $image, string $context, int $attachment\_id ): string
==========================================================================================================
Adds `width` and `height` attributes to an `img` HTML tag.
`$image` string Required The HTML `img` tag where the attribute should be added. `$context` string Required Additional context to pass to the filters. `$attachment_id` int Required Image attachment ID. string Converted `'img'` element with `'width'` and `'height'` attributes added.
File: `wp-includes/media.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/media.php/)
```
function wp_img_tag_add_width_and_height_attr( $image, $context, $attachment_id ) {
$image_src = preg_match( '/src="([^"]+)"/', $image, $match_src ) ? $match_src[1] : '';
list( $image_src ) = explode( '?', $image_src );
// Return early if we couldn't get the image source.
if ( ! $image_src ) {
return $image;
}
/**
* Filters whether to add the missing `width` and `height` HTML attributes to the img tag. Default `true`.
*
* Returning anything else than `true` will not add the attributes.
*
* @since 5.5.0
*
* @param bool $value The filtered value, defaults to `true`.
* @param string $image The HTML `img` tag where the attribute should be added.
* @param string $context Additional context about how the function was called or where the img tag is.
* @param int $attachment_id The image attachment ID.
*/
$add = apply_filters( 'wp_img_tag_add_width_and_height_attr', true, $image, $context, $attachment_id );
if ( true === $add ) {
$image_meta = wp_get_attachment_metadata( $attachment_id );
$size_array = wp_image_src_get_dimensions( $image_src, $image_meta, $attachment_id );
if ( $size_array ) {
$hw = trim( image_hwstring( $size_array[0], $size_array[1] ) );
return str_replace( '<img', "<img {$hw}", $image );
}
}
return $image;
}
```
[apply\_filters( 'wp\_img\_tag\_add\_width\_and\_height\_attr', bool $value, string $image, string $context, int $attachment\_id )](../hooks/wp_img_tag_add_width_and_height_attr)
Filters whether to add the missing `width` and `height` HTML attributes to the img tag. Default `true`.
| Uses | Description |
| --- | --- |
| [wp\_image\_src\_get\_dimensions()](wp_image_src_get_dimensions) wp-includes/media.php | Determines an image’s width and height dimensions based on the source file. |
| [image\_hwstring()](image_hwstring) wp-includes/media.php | Retrieves width and height attributes using given width and height values. |
| [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 |
| --- | --- |
| [wp\_filter\_content\_tags()](wp_filter_content_tags) wp-includes/media.php | Filters specific tags in post content and modifies their markup. |
| Version | Description |
| --- | --- |
| [5.5.0](https://developer.wordpress.org/reference/since/5.5.0/) | Introduced. |
wordpress get_post_embed_url( int|WP_Post $post = null ): string|false get\_post\_embed\_url( int|WP\_Post $post = null ): string|false
================================================================
Retrieves the URL to embed a specific post in an iframe.
`$post` int|[WP\_Post](../classes/wp_post) Optional Post ID or object. Defaults to the current post. Default: `null`
string|false The post embed URL on success, false if the post doesn't exist.
File: `wp-includes/embed.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/embed.php/)
```
function get_post_embed_url( $post = null ) {
$post = get_post( $post );
if ( ! $post ) {
return false;
}
$embed_url = trailingslashit( get_permalink( $post ) ) . user_trailingslashit( 'embed' );
$path_conflict = get_page_by_path( str_replace( home_url(), '', $embed_url ), OBJECT, get_post_types( array( 'public' => true ) ) );
if ( ! get_option( 'permalink_structure' ) || $path_conflict ) {
$embed_url = add_query_arg( array( 'embed' => 'true' ), get_permalink( $post ) );
}
/**
* Filters the URL to embed a specific post.
*
* @since 4.4.0
*
* @param string $embed_url The post embed URL.
* @param WP_Post $post The corresponding post object.
*/
return sanitize_url( apply_filters( 'post_embed_url', $embed_url, $post ) );
}
```
[apply\_filters( 'post\_embed\_url', string $embed\_url, WP\_Post $post )](../hooks/post_embed_url)
Filters the URL to embed a specific post.
| Uses | Description |
| --- | --- |
| [sanitize\_url()](sanitize_url) wp-includes/formatting.php | Sanitizes a URL for database or redirect usage. |
| [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\_by\_path()](get_page_by_path) wp-includes/post.php | Retrieves a page given its path. |
| [trailingslashit()](trailingslashit) wp-includes/formatting.php | Appends a trailing slash. |
| [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. |
| [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. |
| [get\_post\_types()](get_post_types) wp-includes/post.php | Gets a list of all registered post type objects. |
| Used By | Description |
| --- | --- |
| [get\_post\_embed\_html()](get_post_embed_html) wp-includes/embed.php | Retrieves the embed code for a specific post. |
| Version | Description |
| --- | --- |
| [4.4.0](https://developer.wordpress.org/reference/since/4.4.0/) | Introduced. |
wordpress wp_get_revision_ui_diff( WP_Post|int $post, int $compare_from, int $compare_to ): array|false wp\_get\_revision\_ui\_diff( WP\_Post|int $post, int $compare\_from, int $compare\_to ): array|false
====================================================================================================
Get the revision UI diff.
`$post` [WP\_Post](../classes/wp_post)|int Required The post object or post ID. `$compare_from` int Required The revision ID to compare from. `$compare_to` int Required The revision ID to come to. array|false Associative array of a post's revisioned fields and their diffs.
Or, false on failure.
File: `wp-admin/includes/revision.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/revision.php/)
```
function wp_get_revision_ui_diff( $post, $compare_from, $compare_to ) {
$post = get_post( $post );
if ( ! $post ) {
return false;
}
if ( $compare_from ) {
$compare_from = get_post( $compare_from );
if ( ! $compare_from ) {
return false;
}
} else {
// If we're dealing with the first revision...
$compare_from = false;
}
$compare_to = get_post( $compare_to );
if ( ! $compare_to ) {
return false;
}
// If comparing revisions, make sure we're dealing with the right post parent.
// The parent post may be a 'revision' when revisions are disabled and we're looking at autosaves.
if ( $compare_from && $compare_from->post_parent !== $post->ID && $compare_from->ID !== $post->ID ) {
return false;
}
if ( $compare_to->post_parent !== $post->ID && $compare_to->ID !== $post->ID ) {
return false;
}
if ( $compare_from && strtotime( $compare_from->post_date_gmt ) > strtotime( $compare_to->post_date_gmt ) ) {
$temp = $compare_from;
$compare_from = $compare_to;
$compare_to = $temp;
}
// Add default title if title field is empty.
if ( $compare_from && empty( $compare_from->post_title ) ) {
$compare_from->post_title = __( '(no title)' );
}
if ( empty( $compare_to->post_title ) ) {
$compare_to->post_title = __( '(no title)' );
}
$return = array();
foreach ( _wp_post_revision_fields( $post ) as $field => $name ) {
/**
* Contextually filter a post revision field.
*
* The dynamic portion of the hook name, `$field`, corresponds to a name of a
* field of the revision object.
*
* Possible hook names include:
*
* - `_wp_post_revision_field_post_title`
* - `_wp_post_revision_field_post_content`
* - `_wp_post_revision_field_post_excerpt`
*
* @since 3.6.0
*
* @param string $revision_field The current revision field to compare to or from.
* @param string $field The current revision field.
* @param WP_Post $compare_from The revision post object to compare to or from.
* @param string $context The context of whether the current revision is the old
* or the new one. Values are 'to' or 'from'.
*/
$content_from = $compare_from ? apply_filters( "_wp_post_revision_field_{$field}", $compare_from->$field, $field, $compare_from, 'from' ) : '';
/** This filter is documented in wp-admin/includes/revision.php */
$content_to = apply_filters( "_wp_post_revision_field_{$field}", $compare_to->$field, $field, $compare_to, 'to' );
$args = array(
'show_split_view' => true,
'title_left' => __( 'Removed' ),
'title_right' => __( 'Added' ),
);
/**
* Filters revisions text diff options.
*
* Filters the options passed to wp_text_diff() when viewing a post revision.
*
* @since 4.1.0
*
* @param array $args {
* Associative array of options to pass to wp_text_diff().
*
* @type bool $show_split_view True for split view (two columns), false for
* un-split view (single column). Default true.
* }
* @param string $field The current revision field.
* @param WP_Post $compare_from The revision post to compare from.
* @param WP_Post $compare_to The revision post to compare to.
*/
$args = apply_filters( 'revision_text_diff_options', $args, $field, $compare_from, $compare_to );
$diff = wp_text_diff( $content_from, $content_to, $args );
if ( ! $diff && 'post_title' === $field ) {
// It's a better user experience to still show the Title, even if it didn't change.
// No, you didn't see this.
$diff = '<table class="diff"><colgroup><col class="content diffsplit left"><col class="content diffsplit middle"><col class="content diffsplit right"></colgroup><tbody><tr>';
// In split screen mode, show the title before/after side by side.
if ( true === $args['show_split_view'] ) {
$diff .= '<td>' . esc_html( $compare_from->post_title ) . '</td><td></td><td>' . esc_html( $compare_to->post_title ) . '</td>';
} else {
$diff .= '<td>' . esc_html( $compare_from->post_title ) . '</td>';
// In single column mode, only show the title once if unchanged.
if ( $compare_from->post_title !== $compare_to->post_title ) {
$diff .= '</tr><tr><td>' . esc_html( $compare_to->post_title ) . '</td>';
}
}
$diff .= '</tr></tbody>';
$diff .= '</table>';
}
if ( $diff ) {
$return[] = array(
'id' => $field,
'name' => $name,
'diff' => $diff,
);
}
}
/**
* Filters the fields displayed in the post revision diff UI.
*
* @since 4.1.0
*
* @param array[] $return Array of revision UI fields. Each item is an array of id, name, and diff.
* @param WP_Post $compare_from The revision post to compare from.
* @param WP_Post $compare_to The revision post to compare to.
*/
return apply_filters( 'wp_get_revision_ui_diff', $return, $compare_from, $compare_to );
}
```
[apply\_filters( 'revision\_text\_diff\_options', array $args, string $field, WP\_Post $compare\_from, WP\_Post $compare\_to )](../hooks/revision_text_diff_options)
Filters revisions text diff options.
[apply\_filters( 'wp\_get\_revision\_ui\_diff', array[] $return, WP\_Post $compare\_from, WP\_Post $compare\_to )](../hooks/wp_get_revision_ui_diff)
Filters the fields displayed in the post revision diff UI.
[apply\_filters( "\_wp\_post\_revision\_field\_{$field}", string $revision\_field, string $field, WP\_Post $compare\_from, string $context )](../hooks/_wp_post_revision_field_field)
Contextually filter a post revision field.
| Uses | Description |
| --- | --- |
| [wp\_text\_diff()](wp_text_diff) wp-includes/pluggable.php | Displays a human readable HTML representation of the difference between two strings. |
| [\_wp\_post\_revision\_fields()](_wp_post_revision_fields) wp-includes/revision.php | Determines which fields of posts are to be saved in revisions. |
| [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. |
| [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\_post()](get_post) wp-includes/post.php | Retrieves post data given a post ID or post object. |
| Used By | Description |
| --- | --- |
| [wp\_ajax\_get\_revision\_diffs()](wp_ajax_get_revision_diffs) wp-admin/includes/ajax-actions.php | Ajax handler for getting revision diffs. |
| [wp\_prepare\_revisions\_for\_js()](wp_prepare_revisions_for_js) wp-admin/includes/revision.php | Prepare revisions for JavaScript. |
| Version | Description |
| --- | --- |
| [3.6.0](https://developer.wordpress.org/reference/since/3.6.0/) | Introduced. |
wordpress wp_staticize_emoji( string $text ): string wp\_staticize\_emoji( string $text ): string
============================================
Converts emoji to a static img element.
`$text` string Required The content to encode. string The encoded content.
File: `wp-includes/formatting.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/formatting.php/)
```
function wp_staticize_emoji( $text ) {
if ( false === strpos( $text, '&#x' ) ) {
if ( ( function_exists( 'mb_check_encoding' ) && mb_check_encoding( $text, 'ASCII' ) ) || ! preg_match( '/[^\x00-\x7F]/', $text ) ) {
// The text doesn't contain anything that might be emoji, so we can return early.
return $text;
} else {
$encoded_text = wp_encode_emoji( $text );
if ( $encoded_text === $text ) {
return $encoded_text;
}
$text = $encoded_text;
}
}
$emoji = _wp_emoji_list( 'entities' );
// Quickly narrow down the list of emoji that might be in the text and need replacing.
$possible_emoji = array();
foreach ( $emoji as $emojum ) {
if ( false !== strpos( $text, $emojum ) ) {
$possible_emoji[ $emojum ] = html_entity_decode( $emojum );
}
}
if ( ! $possible_emoji ) {
return $text;
}
/** This filter is documented in wp-includes/formatting.php */
$cdn_url = apply_filters( 'emoji_url', 'https://s.w.org/images/core/emoji/14.0.0/72x72/' );
/** This filter is documented in wp-includes/formatting.php */
$ext = apply_filters( 'emoji_ext', '.png' );
$output = '';
/*
* HTML loop taken from smiley function, which was taken from texturize function.
* It'll never be consolidated.
*
* First, capture the tags as well as in between.
*/
$textarr = preg_split( '/(<.*>)/U', $text, -1, PREG_SPLIT_DELIM_CAPTURE );
$stop = count( $textarr );
// Ignore processing of specific tags.
$tags_to_ignore = 'code|pre|style|script|textarea';
$ignore_block_element = '';
for ( $i = 0; $i < $stop; $i++ ) {
$content = $textarr[ $i ];
// If we're in an ignore block, wait until we find its closing tag.
if ( '' === $ignore_block_element && preg_match( '/^<(' . $tags_to_ignore . ')>/', $content, $matches ) ) {
$ignore_block_element = $matches[1];
}
// If it's not a tag and not in ignore block.
if ( '' === $ignore_block_element && strlen( $content ) > 0 && '<' !== $content[0] && false !== strpos( $content, '&#x' ) ) {
foreach ( $possible_emoji as $emojum => $emoji_char ) {
if ( false === strpos( $content, $emojum ) ) {
continue;
}
$file = str_replace( ';&#x', '-', $emojum );
$file = str_replace( array( '&#x', ';' ), '', $file );
$entity = sprintf( '<img src="%s" alt="%s" class="wp-smiley" style="height: 1em; max-height: 1em;" />', $cdn_url . $file . $ext, $emoji_char );
$content = str_replace( $emojum, $entity, $content );
}
}
// Did we exit ignore block?
if ( '' !== $ignore_block_element && '</' . $ignore_block_element . '>' === $content ) {
$ignore_block_element = '';
}
$output .= $content;
}
// Finally, remove any stray U+FE0F characters.
$output = str_replace( '️', '', $output );
return $output;
}
```
[apply\_filters( 'emoji\_ext', string $extension )](../hooks/emoji_ext)
Filters the extension of the emoji png files.
[apply\_filters( 'emoji\_url', string $url )](../hooks/emoji_url)
Filters the URL where emoji png images are hosted.
| Uses | Description |
| --- | --- |
| [\_wp\_emoji\_list()](_wp_emoji_list) wp-includes/formatting.php | Returns arrays of emoji data. |
| [wp\_encode\_emoji()](wp_encode_emoji) wp-includes/formatting.php | Converts emoji characters to their equivalent HTML entity. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| Used By | Description |
| --- | --- |
| [wp\_staticize\_emoji\_for\_email()](wp_staticize_emoji_for_email) wp-includes/formatting.php | Converts emoji in emails into static images. |
| Version | Description |
| --- | --- |
| [4.2.0](https://developer.wordpress.org/reference/since/4.2.0/) | Introduced. |
| programming_docs |
wordpress wp_encode_emoji( string $content ): string wp\_encode\_emoji( string $content ): string
============================================
Converts emoji characters to their equivalent HTML entity.
This allows us to store emoji in a DB using the utf8 character set.
`$content` string Required The content to encode. string The encoded content.
File: `wp-includes/formatting.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/formatting.php/)
```
function wp_encode_emoji( $content ) {
$emoji = _wp_emoji_list( 'partials' );
foreach ( $emoji as $emojum ) {
$emoji_char = html_entity_decode( $emojum );
if ( false !== strpos( $content, $emoji_char ) ) {
$content = preg_replace( "/$emoji_char/", $emojum, $content );
}
}
return $content;
}
```
| Uses | Description |
| --- | --- |
| [\_wp\_emoji\_list()](_wp_emoji_list) wp-includes/formatting.php | Returns arrays of emoji data. |
| Used By | Description |
| --- | --- |
| [wp\_staticize\_emoji()](wp_staticize_emoji) wp-includes/formatting.php | Converts emoji to a static img element. |
| [sanitize\_option()](sanitize_option) wp-includes/formatting.php | Sanitizes various option values based on the nature of the option. |
| [wp\_insert\_post()](wp_insert_post) wp-includes/post.php | Inserts or update a post. |
| Version | Description |
| --- | --- |
| [4.2.0](https://developer.wordpress.org/reference/since/4.2.0/) | Introduced. |
wordpress wp_salt( string $scheme = 'auth' ): string wp\_salt( string $scheme = 'auth' ): string
===========================================
Returns a salt to add to hashes.
Salts are created using secret keys. Secret keys are located in two places: in the database and in the wp-config.php file. The secret key in the database is randomly generated and will be appended to the secret keys in wp-config.php.
The secret keys in wp-config.php should be updated to strong, random keys to maximize security. Below is an example of how the secret key constants are defined.
Do not paste this example directly into wp-config.php. Instead, have a [secret key created](https://api.wordpress.org/secret-key/1.1/salt/) just for you.
```
define('AUTH_KEY', ' Xakm<o xQy rw4EMsLKM-?!T+,PFF})H4lzcW57AF0U@N@< >M%G4Yt>f`z]MON');
define('SECURE_AUTH_KEY', 'LzJ}op]mr|6+![P}Ak:uNdJCJZd>(Hx.-Mh#Tz)pCIU#uGEnfFz|f ;;eU%/U^O~');
define('LOGGED_IN_KEY', '|i|Ux`9<p-h$aFf(qnT:sDO:D1P^wZ$$/Ra@miTJi9G;ddp_<q}6H1)o|a +&JCM');
define('NONCE_KEY', '%:R{[P|,s.KuMltH5}cI;/k<Gx~j!f0I)m_sIyu+&NJZ)-iO>z7X>QYR0Z_XnZ@|');
define('AUTH_SALT', 'eZyT)-Naw]F8CwA*VaW#q*|.)g@o}||wf~@C-YSt}(dh_r6EbI#A,y|nU2{B#JBW');
define('SECURE_AUTH_SALT', '!=oLUTXh,QW=H `}`L|9/^4-3 STz},T(w}W<I`.JjPi)<Bmf1v,HpGe}T1:Xt7n');
define('LOGGED_IN_SALT', '+XSqHc;@Q*K_b|Z?NC[3H!!EONbh.n<+=uKR:>*c(u`g~EJBf#8u#R{mUEZrozmm');
define('NONCE_SALT', 'h`GXHhD>SLWVfg1(1(N{;.V!MoE(SfbA_ksP@&`+AycHcAV$+?@3q+rxV{%^VyKT');
```
Salting passwords helps against tools which has stored hashed values of common dictionary strings. The added values makes it harder to crack.
`$scheme` string Optional Authentication scheme (auth, secure\_auth, logged\_in, nonce). Default: `'auth'`
string Salt value
##### Usage:
```
wp_salt( $scheme );
```
##### Notes:
* This function can be replaced via [plugins](https://codex.wordpress.org/Glossary#plugins "Glossary"). If plugins do not redefine these functions, then this will be used instead.
* See Also: [Create a Secret Key for wp-config.php](https://api.wordpress.org/secret-key/1.0/)
File: `wp-includes/pluggable.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/pluggable.php/)
```
function wp_salt( $scheme = 'auth' ) {
static $cached_salts = array();
if ( isset( $cached_salts[ $scheme ] ) ) {
/**
* Filters the WordPress salt.
*
* @since 2.5.0
*
* @param string $cached_salt Cached salt for the given scheme.
* @param string $scheme Authentication scheme. Values include 'auth',
* 'secure_auth', 'logged_in', and 'nonce'.
*/
return apply_filters( 'salt', $cached_salts[ $scheme ], $scheme );
}
static $duplicated_keys;
if ( null === $duplicated_keys ) {
$duplicated_keys = array(
'put your unique phrase here' => true,
/*
* translators: This string should only be translated if wp-config-sample.php is localized.
* You can check the localized release package or
* https://i18n.svn.wordpress.org/<locale code>/branches/<wp version>/dist/wp-config-sample.php
*/
__( 'put your unique phrase here' ) => true,
);
foreach ( array( 'AUTH', 'SECURE_AUTH', 'LOGGED_IN', 'NONCE', 'SECRET' ) as $first ) {
foreach ( array( 'KEY', 'SALT' ) as $second ) {
if ( ! defined( "{$first}_{$second}" ) ) {
continue;
}
$value = constant( "{$first}_{$second}" );
$duplicated_keys[ $value ] = isset( $duplicated_keys[ $value ] );
}
}
}
$values = array(
'key' => '',
'salt' => '',
);
if ( defined( 'SECRET_KEY' ) && SECRET_KEY && empty( $duplicated_keys[ SECRET_KEY ] ) ) {
$values['key'] = SECRET_KEY;
}
if ( 'auth' === $scheme && defined( 'SECRET_SALT' ) && SECRET_SALT && empty( $duplicated_keys[ SECRET_SALT ] ) ) {
$values['salt'] = SECRET_SALT;
}
if ( in_array( $scheme, array( 'auth', 'secure_auth', 'logged_in', 'nonce' ), true ) ) {
foreach ( array( 'key', 'salt' ) as $type ) {
$const = strtoupper( "{$scheme}_{$type}" );
if ( defined( $const ) && constant( $const ) && empty( $duplicated_keys[ constant( $const ) ] ) ) {
$values[ $type ] = constant( $const );
} elseif ( ! $values[ $type ] ) {
$values[ $type ] = get_site_option( "{$scheme}_{$type}" );
if ( ! $values[ $type ] ) {
$values[ $type ] = wp_generate_password( 64, true, true );
update_site_option( "{$scheme}_{$type}", $values[ $type ] );
}
}
}
} else {
if ( ! $values['key'] ) {
$values['key'] = get_site_option( 'secret_key' );
if ( ! $values['key'] ) {
$values['key'] = wp_generate_password( 64, true, true );
update_site_option( 'secret_key', $values['key'] );
}
}
$values['salt'] = hash_hmac( 'md5', $scheme, $values['key'] );
}
$cached_salts[ $scheme ] = $values['key'] . $values['salt'];
/** This filter is documented in wp-includes/pluggable.php */
return apply_filters( 'salt', $cached_salts[ $scheme ], $scheme );
}
```
[apply\_filters( 'salt', string $cached\_salt, string $scheme )](../hooks/salt)
Filters the WordPress salt.
| Uses | Description |
| --- | --- |
| [wp\_generate\_password()](wp_generate_password) wp-includes/pluggable.php | Generates a random password drawn from the defined set of characters. |
| [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-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\_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\_hash()](wp_hash) wp-includes/pluggable.php | Gets hash of given string. |
| Version | Description |
| --- | --- |
| [2.5.0](https://developer.wordpress.org/reference/since/2.5.0/) | Introduced. |
wordpress balanceTags( string $text, bool $force = false ): string balanceTags( string $text, bool $force = false ): string
========================================================
Balances tags if forced to, or if the ‘use\_balanceTags’ option is set to true.
`$text` string Required Text to be balanced `$force` bool Optional If true, forces balancing, ignoring the value of the option. Default: `false`
string Balanced text
The option ‘use\_balanceTags’ is used for whether the tags will be balanced. Either the `$force` parameter or ‘use\_balanceTags’ option need to be true before the tags will be balanced.
File: `wp-includes/formatting.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/formatting.php/)
```
function balanceTags( $text, $force = false ) { // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.FunctionNameInvalid
if ( $force || (int) get_option( 'use_balanceTags' ) === 1 ) {
return force_balance_tags( $text );
} else {
return $text;
}
}
```
| Uses | Description |
| --- | --- |
| [force\_balance\_tags()](force_balance_tags) wp-includes/formatting.php | Balances tags of string using a modified stack. |
| [get\_option()](get_option) wp-includes/option.php | Retrieves an option value based on an option name. |
| Version | Description |
| --- | --- |
| [0.71](https://developer.wordpress.org/reference/since/0.71/) | Introduced. |
wordpress wp_dashboard_plugins_output( string $rss, array $args = array() ) wp\_dashboard\_plugins\_output( string $rss, array $args = array() )
====================================================================
This function has been deprecated.
Display plugins text for the WordPress news widget.
`$rss` string Required The RSS feed URL. `$args` array Optional Array of arguments for this RSS feed. Default: `array()`
File: `wp-admin/includes/deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/deprecated.php/)
```
function wp_dashboard_plugins_output( $rss, $args = array() ) {
_deprecated_function( __FUNCTION__, '4.8.0' );
// Plugin feeds plus link to install them.
$popular = fetch_feed( $args['url']['popular'] );
if ( false === $plugin_slugs = get_transient( 'plugin_slugs' ) ) {
$plugin_slugs = array_keys( get_plugins() );
set_transient( 'plugin_slugs', $plugin_slugs, DAY_IN_SECONDS );
}
echo '<ul>';
foreach ( array( $popular ) as $feed ) {
if ( is_wp_error( $feed ) || ! $feed->get_item_quantity() )
continue;
$items = $feed->get_items(0, 5);
// Pick a random, non-installed plugin.
while ( true ) {
// Abort this foreach loop iteration if there's no plugins left of this type.
if ( 0 === count($items) )
continue 2;
$item_key = array_rand($items);
$item = $items[$item_key];
list($link, $frag) = explode( '#', $item->get_link() );
$link = esc_url($link);
if ( preg_match( '|/([^/]+?)/?$|', $link, $matches ) )
$slug = $matches[1];
else {
unset( $items[$item_key] );
continue;
}
// Is this random plugin's slug already installed? If so, try again.
reset( $plugin_slugs );
foreach ( $plugin_slugs as $plugin_slug ) {
if ( $slug == substr( $plugin_slug, 0, strlen( $slug ) ) ) {
unset( $items[$item_key] );
continue 2;
}
}
// If we get to this point, then the random plugin isn't installed and we can stop the while().
break;
}
// Eliminate some common badly formed plugin descriptions.
while ( ( null !== $item_key = array_rand($items) ) && false !== strpos( $items[$item_key]->get_description(), 'Plugin Name:' ) )
unset($items[$item_key]);
if ( !isset($items[$item_key]) )
continue;
$raw_title = $item->get_title();
$ilink = wp_nonce_url('plugin-install.php?tab=plugin-information&plugin=' . $slug, 'install-plugin_' . $slug) . '&TB_iframe=true&width=600&height=800';
echo '<li class="dashboard-news-plugin"><span>' . __( 'Popular Plugin' ) . ':</span> ' . esc_html( $raw_title ) .
' <a href="' . $ilink . '" class="thickbox open-plugin-details-modal" aria-label="' .
/* translators: %s: Plugin name. */
esc_attr( sprintf( _x( 'Install %s', 'plugin' ), $raw_title ) ) . '">(' . __( 'Install' ) . ')</a></li>';
$feed->__destruct();
unset( $feed );
}
echo '</ul>';
}
```
| Uses | Description |
| --- | --- |
| [fetch\_feed()](fetch_feed) wp-includes/feed.php | Builds SimplePie object based on RSS or Atom feed from URL. |
| [get\_plugins()](get_plugins) wp-admin/includes/plugin.php | Checks the plugins directory and retrieve all plugin files with plugin data. |
| [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-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. |
| [esc\_html()](esc_html) wp-includes/formatting.php | Escaping for HTML blocks. |
| [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. |
| [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.8.0](https://developer.wordpress.org/reference/since/4.8.0/) | This function has been deprecated. |
| [2.5.0](https://developer.wordpress.org/reference/since/2.5.0/) | Introduced. |
wordpress get_extended( string $post ): string[] get\_extended( string $post ): string[]
=======================================
Gets extended entry info (`<!--more-->`).
There should not be any space after the second dash and before the word ‘more’. There can be text or space(s) after the word ‘more’, but won’t be referenced.
The returned array has ‘main’, ‘extended’, and ‘more\_text’ keys. Main has the text before the `<!--more-->`. The ‘extended’ key has the content after the `<!--more-->` comment. The ‘more\_text’ key has the custom "Read More" text.
`$post` string Required Post content. string[] Extended entry info.
* `main`stringContent before the more tag.
* `extended`stringContent after the more tag.
* `more_text`stringCustom read more text, or empty string.
File: `wp-includes/post.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/post.php/)
```
function get_extended( $post ) {
// Match the new style more links.
if ( preg_match( '/<!--more(.*?)?-->/', $post, $matches ) ) {
list($main, $extended) = explode( $matches[0], $post, 2 );
$more_text = $matches[1];
} else {
$main = $post;
$extended = '';
$more_text = '';
}
// Leading and trailing whitespace.
$main = preg_replace( '/^[\s]*(.*)[\s]*$/', '\\1', $main );
$extended = preg_replace( '/^[\s]*(.*)[\s]*$/', '\\1', $extended );
$more_text = preg_replace( '/^[\s]*(.*)[\s]*$/', '\\1', $more_text );
return array(
'main' => $main,
'extended' => $extended,
'more_text' => $more_text,
);
}
```
| Used By | Description |
| --- | --- |
| [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\_page()](../classes/wp_xmlrpc_server/_prepare_page) wp-includes/class-wp-xmlrpc-server.php | Prepares page data for return in an XML-RPC object. |
| Version | Description |
| --- | --- |
| [1.0.0](https://developer.wordpress.org/reference/since/1.0.0/) | Introduced. |
wordpress register_taxonomy_for_object_type( string $taxonomy, string $object_type ): bool register\_taxonomy\_for\_object\_type( string $taxonomy, string $object\_type ): bool
=====================================================================================
Adds an already registered taxonomy to an object type.
`$taxonomy` string Required Name of taxonomy object. `$object_type` string Required Name of the object type. bool True if successful, false if not.
File: `wp-includes/taxonomy.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/taxonomy.php/)
```
function register_taxonomy_for_object_type( $taxonomy, $object_type ) {
global $wp_taxonomies;
if ( ! isset( $wp_taxonomies[ $taxonomy ] ) ) {
return false;
}
if ( ! get_post_type_object( $object_type ) ) {
return false;
}
if ( ! in_array( $object_type, $wp_taxonomies[ $taxonomy ]->object_type, true ) ) {
$wp_taxonomies[ $taxonomy ]->object_type[] = $object_type;
}
// Filter out empties.
$wp_taxonomies[ $taxonomy ]->object_type = array_filter( $wp_taxonomies[ $taxonomy ]->object_type );
/**
* Fires after a taxonomy is registered for an object type.
*
* @since 5.1.0
*
* @param string $taxonomy Taxonomy name.
* @param string $object_type Name of the object type.
*/
do_action( 'registered_taxonomy_for_object_type', $taxonomy, $object_type );
return true;
}
```
[do\_action( 'registered\_taxonomy\_for\_object\_type', string $taxonomy, string $object\_type )](../hooks/registered_taxonomy_for_object_type)
Fires after a taxonomy is registered for an object type.
| Uses | Description |
| --- | --- |
| [do\_action()](do_action) wp-includes/plugin.php | Calls the callback functions that have been added to an action hook. |
| [get\_post\_type\_object()](get_post_type_object) wp-includes/post.php | Retrieves a post type object by name. |
| Used By | Description |
| --- | --- |
| [WP\_Post\_Type::register\_taxonomies()](../classes/wp_post_type/register_taxonomies) wp-includes/class-wp-post-type.php | Registers the taxonomies for the post type. |
| Version | Description |
| --- | --- |
| [3.0.0](https://developer.wordpress.org/reference/since/3.0.0/) | Introduced. |
wordpress print_embed_comments_button() print\_embed\_comments\_button()
================================
Prints the necessary markup for the embed comments button.
File: `wp-includes/embed.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/embed.php/)
```
function print_embed_comments_button() {
if ( is_404() || ! ( get_comments_number() || comments_open() ) ) {
return;
}
?>
<div class="wp-embed-comments">
<a href="<?php comments_link(); ?>" target="_top">
<span class="dashicons dashicons-admin-comments"></span>
<?php
printf(
/* translators: %s: Number of comments. */
_n(
'%s <span class="screen-reader-text">Comment</span>',
'%s <span class="screen-reader-text">Comments</span>',
get_comments_number()
),
number_format_i18n( get_comments_number() )
);
?>
</a>
</div>
<?php
}
```
| Uses | Description |
| --- | --- |
| [\_n()](_n) wp-includes/l10n.php | Translates and retrieves the singular or plural form based on the supplied number. |
| [is\_404()](is_404) wp-includes/query.php | Determines whether the query has resulted in a 404 (returns no results). |
| [comments\_open()](comments_open) wp-includes/comment-template.php | Determines whether the current post is open for comments. |
| [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. |
| [number\_format\_i18n()](number_format_i18n) wp-includes/functions.php | Converts float number to format based on the locale. |
| Version | Description |
| --- | --- |
| [4.4.0](https://developer.wordpress.org/reference/since/4.4.0/) | Introduced. |
wordpress wp_upload_bits( string $name, null|string $deprecated, string $bits, string $time = null ): array wp\_upload\_bits( string $name, null|string $deprecated, string $bits, string $time = null ): array
===================================================================================================
Creates a file in the upload folder with given content.
If there is an error, then the key ‘error’ will exist with the error message.
If success, then the key ‘file’ will have the unique file path, the ‘url’ key will have the link to the new file. and the ‘error’ key will be set to false.
This function will not move an uploaded file to the upload folder. It will create a new file with the content in $bits parameter. If you move the upload file, read the content of the uploaded file, and then you can give the filename and content to this function, which will add it to the upload folder.
The permissions will be set on the new file automatically by this function.
`$name` string Required Filename. `$deprecated` null|string Required Never used. Set to null. `$bits` string Required File content `$time` string Optional Time formatted in `'yyyy/mm'`. Default: `null`
array Information about the newly-uploaded file.
* `file`stringFilename of the newly-uploaded file.
* `url`stringURL of the uploaded file.
* `type`stringFile type.
* `error`string|falseError message, if there has been an error.
File: `wp-includes/functions.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/functions.php/)
```
function wp_upload_bits( $name, $deprecated, $bits, $time = null ) {
if ( ! empty( $deprecated ) ) {
_deprecated_argument( __FUNCTION__, '2.0.0' );
}
if ( empty( $name ) ) {
return array( 'error' => __( 'Empty filename' ) );
}
$wp_filetype = wp_check_filetype( $name );
if ( ! $wp_filetype['ext'] && ! current_user_can( 'unfiltered_upload' ) ) {
return array( 'error' => __( 'Sorry, you are not allowed to upload this file type.' ) );
}
$upload = wp_upload_dir( $time );
if ( false !== $upload['error'] ) {
return $upload;
}
/**
* Filters whether to treat the upload bits as an error.
*
* Returning a non-array from the filter will effectively short-circuit preparing the upload bits
* and return that value instead. An error message should be returned as a string.
*
* @since 3.0.0
*
* @param array|string $upload_bits_error An array of upload bits data, or error message to return.
*/
$upload_bits_error = apply_filters(
'wp_upload_bits',
array(
'name' => $name,
'bits' => $bits,
'time' => $time,
)
);
if ( ! is_array( $upload_bits_error ) ) {
$upload['error'] = $upload_bits_error;
return $upload;
}
$filename = wp_unique_filename( $upload['path'], $name );
$new_file = $upload['path'] . "/$filename";
if ( ! wp_mkdir_p( dirname( $new_file ) ) ) {
if ( 0 === strpos( $upload['basedir'], ABSPATH ) ) {
$error_path = str_replace( ABSPATH, '', $upload['basedir'] ) . $upload['subdir'];
} else {
$error_path = wp_basename( $upload['basedir'] ) . $upload['subdir'];
}
$message = sprintf(
/* translators: %s: Directory path. */
__( 'Unable to create directory %s. Is its parent directory writable by the server?' ),
$error_path
);
return array( 'error' => $message );
}
$ifp = @fopen( $new_file, 'wb' );
if ( ! $ifp ) {
return array(
/* translators: %s: File name. */
'error' => sprintf( __( 'Could not write file %s' ), $new_file ),
);
}
fwrite( $ifp, $bits );
fclose( $ifp );
clearstatcache();
// Set correct file permissions.
$stat = @ stat( dirname( $new_file ) );
$perms = $stat['mode'] & 0007777;
$perms = $perms & 0000666;
chmod( $new_file, $perms );
clearstatcache();
// Compute the URL.
$url = $upload['url'] . "/$filename";
if ( is_multisite() ) {
clean_dirsize_cache( $new_file );
}
/** This filter is documented in wp-admin/includes/file.php */
return apply_filters(
'wp_handle_upload',
array(
'file' => $new_file,
'url' => $url,
'type' => $wp_filetype['type'],
'error' => false,
),
'sideload'
);
}
```
[apply\_filters( 'wp\_handle\_upload', array $upload, string $context )](../hooks/wp_handle_upload)
Filters the data array for the uploaded file.
[apply\_filters( 'wp\_upload\_bits', array|string $upload\_bits\_error )](../hooks/wp_upload_bits)
Filters whether to treat the upload bits as an error.
| Uses | Description |
| --- | --- |
| [wp\_check\_filetype()](wp_check_filetype) wp-includes/functions.php | Retrieves the file type from the file name. |
| [clean\_dirsize\_cache()](clean_dirsize_cache) wp-includes/functions.php | Cleans directory size cache used by [recurse\_dirsize()](recurse_dirsize) . |
| [wp\_upload\_dir()](wp_upload_dir) wp-includes/functions.php | Returns an array containing the current upload directory’s path and URL. |
| [wp\_unique\_filename()](wp_unique_filename) wp-includes/functions.php | Gets a filename that is sanitized and unique for the given directory. |
| [wp\_mkdir\_p()](wp_mkdir_p) wp-includes/functions.php | Recursive directory creation based on full path. |
| [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\_basename()](wp_basename) wp-includes/formatting.php | i18n-friendly version of basename(). |
| [is\_multisite()](is_multisite) wp-includes/load.php | If Multisite is enabled. |
| [\_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 |
| --- | --- |
| [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\_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 |
| --- | --- |
| [2.0.0](https://developer.wordpress.org/reference/since/2.0.0/) | Introduced. |
| programming_docs |
wordpress wpmu_signup_user_notification( string $user_login, string $user_email, string $key, array $meta = array() ): bool wpmu\_signup\_user\_notification( string $user\_login, string $user\_email, string $key, array $meta = array() ): bool
======================================================================================================================
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.
This is the notification function used when no new site has been requested.
Filter [‘wpmu\_signup\_user\_notification’](../hooks/wpmu_signup_user_notification) to bypass this function or replace it with your own notification behavior.
Filter [‘wpmu\_signup\_user\_notification\_email’](../hooks/wpmu_signup_user_notification_email) and [‘wpmu\_signup\_user\_notification\_subject’](../hooks/wpmu_signup_user_notification_subject) to change the content and subject line of the email sent to newly registered users.
`$user_login` string Required The user's login name. `$user_email` string Required The user's email address. `$key` string Required The activation key created in [wpmu\_signup\_user()](wpmu_signup_user) `$meta` array Optional Signup meta data. Default: `array()`
bool
File: `wp-includes/ms-functions.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/ms-functions.php/)
```
function wpmu_signup_user_notification( $user_login, $user_email, $key, $meta = array() ) {
/**
* Filters whether to bypass the email notification for new user sign-up.
*
* @since MU (3.0.0)
*
* @param string $user_login User login name.
* @param string $user_email User email address.
* @param string $key Activation key created in wpmu_signup_user().
* @param array $meta Signup meta data. Default empty array.
*/
if ( ! apply_filters( 'wpmu_signup_user_notification', $user_login, $user_email, $key, $meta ) ) {
return false;
}
$user = get_user_by( 'login', $user_login );
$switched_locale = switch_to_locale( get_user_locale( $user ) );
// Send email with activation link.
$admin_email = get_site_option( 'admin_email' );
if ( '' === $admin_email ) {
$admin_email = 'support@' . wp_parse_url( network_home_url(), PHP_URL_HOST );
}
$from_name = ( '' !== get_site_option( 'site_name' ) ) ? esc_html( get_site_option( 'site_name' ) ) : 'WordPress';
$message_headers = "From: \"{$from_name}\" <{$admin_email}>\n" . 'Content-Type: text/plain; charset="' . get_option( 'blog_charset' ) . "\"\n";
$message = sprintf(
/**
* Filters the content of the notification email for new user sign-up.
*
* Content should be formatted for transmission via wp_mail().
*
* @since MU (3.0.0)
*
* @param string $content Content of the notification email.
* @param string $user_login User login name.
* @param string $user_email User email address.
* @param string $key Activation key created in wpmu_signup_user().
* @param array $meta Signup meta data. Default empty array.
*/
apply_filters(
'wpmu_signup_user_notification_email',
/* translators: New user notification email. %s: Activation URL. */
__( "To activate your user, please click the following link:\n\n%s\n\nAfter you activate, you will receive *another email* with your login." ),
$user_login,
$user_email,
$key,
$meta
),
site_url( "wp-activate.php?key=$key" )
);
$subject = sprintf(
/**
* Filters the subject of the notification email of new user signup.
*
* @since MU (3.0.0)
*
* @param string $subject Subject of the notification email.
* @param string $user_login User login name.
* @param string $user_email User email address.
* @param string $key Activation key created in wpmu_signup_user().
* @param array $meta Signup meta data. Default empty array.
*/
apply_filters(
'wpmu_signup_user_notification_subject',
/* translators: New user notification email subject. 1: Network title, 2: New user login. */
_x( '[%1$s] Activate %2$s', 'New user notification email subject' ),
$user_login,
$user_email,
$key,
$meta
),
$from_name,
$user_login
);
wp_mail( $user_email, wp_specialchars_decode( $subject ), $message, $message_headers );
if ( $switched_locale ) {
restore_previous_locale();
}
return true;
}
```
[apply\_filters( 'wpmu\_signup\_user\_notification', string $user\_login, string $user\_email, string $key, array $meta )](../hooks/wpmu_signup_user_notification)
Filters whether to bypass the email notification for new user sign-up.
[apply\_filters( 'wpmu\_signup\_user\_notification\_email', string $content, string $user\_login, string $user\_email, string $key, array $meta )](../hooks/wpmu_signup_user_notification_email)
Filters the content of the notification email for new user sign-up.
[apply\_filters( 'wpmu\_signup\_user\_notification\_subject', string $subject, string $user\_login, string $user\_email, string $key, array $meta )](../hooks/wpmu_signup_user_notification_subject)
Filters the subject of the notification email of new user signup.
| 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. |
| [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. |
| [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. |
| [network\_home\_url()](network_home_url) wp-includes/link-template.php | Retrieves the home URL for the current network. |
| [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-includes/l10n.php | Retrieves the translation of $text. |
| [\_x()](_x) wp-includes/l10n.php | Retrieves translated string with gettext context. |
| [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\_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 |
| --- | --- |
| [MU (3.0.0)](https://developer.wordpress.org/reference/since/mu.3.0.0/) | Introduced. |
wordpress get_the_guid( int|WP_Post $post ): string get\_the\_guid( int|WP\_Post $post ): string
============================================
Retrieves the Post Global Unique Identifier (guid).
The guid will appear to be a link, but should not be used as an link to the post. The reason you should not use it as a link, is because of moving the blog across domains.
`$post` int|[WP\_Post](../classes/wp_post) Optional Post ID or post object. Default is global $post. string
File: `wp-includes/post-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/post-template.php/)
```
function get_the_guid( $post = 0 ) {
$post = get_post( $post );
$post_guid = isset( $post->guid ) ? $post->guid : '';
$post_id = isset( $post->ID ) ? $post->ID : 0;
/**
* Filters the Global Unique Identifier (guid) of the post.
*
* @since 1.5.0
*
* @param string $post_guid Global Unique Identifier (guid) of the post.
* @param int $post_id The post ID.
*/
return apply_filters( 'get_the_guid', $post_guid, $post_id );
}
```
[apply\_filters( 'get\_the\_guid', string $post\_guid, int $post\_id )](../hooks/get_the_guid)
Filters the Global Unique Identifier (guid) of the post.
| 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\_comment\_guid()](get_comment_guid) wp-includes/feed.php | Retrieves the feed GUID for the current comment. |
| [the\_guid()](the_guid) wp-includes/post-template.php | Displays the Post Global Unique Identifier (guid). |
| [\_transition\_post\_status()](_transition_post_status) wp-includes/post.php | Hook for managing future post transitions to published. |
| [wp\_get\_attachment\_url()](wp_get_attachment_url) wp-includes/post.php | Retrieves the URL for an attachment. |
| Version | Description |
| --- | --- |
| [1.5.0](https://developer.wordpress.org/reference/since/1.5.0/) | Introduced. |
wordpress wpmu_signup_blog( string $domain, string $path, string $title, string $user, string $user_email, array $meta = array() ) wpmu\_signup\_blog( string $domain, string $path, string $title, string $user, string $user\_email, array $meta = array() )
===========================================================================================================================
Records site signup information for future activation.
`$domain` string Required The requested domain. `$path` string Required The requested path. `$title` string Required The requested site title. `$user` string Required The user's requested login name. `$user_email` string Required The user's email address. `$meta` array Optional Signup meta data. By default, contains the requested privacy setting and lang\_id. Default: `array()`
File: `wp-includes/ms-functions.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/ms-functions.php/)
```
function wpmu_signup_blog( $domain, $path, $title, $user, $user_email, $meta = array() ) {
global $wpdb;
$key = substr( md5( time() . wp_rand() . $domain ), 0, 16 );
/**
* Filters the metadata for a site signup.
*
* The metadata will be serialized prior to storing it in the database.
*
* @since 4.8.0
*
* @param array $meta Signup meta data. Default empty array.
* @param string $domain The requested domain.
* @param string $path The requested path.
* @param string $title The requested site title.
* @param string $user The user's requested login name.
* @param string $user_email The user's email address.
* @param string $key The user's activation key.
*/
$meta = apply_filters( 'signup_site_meta', $meta, $domain, $path, $title, $user, $user_email, $key );
$wpdb->insert(
$wpdb->signups,
array(
'domain' => $domain,
'path' => $path,
'title' => $title,
'user_login' => $user,
'user_email' => $user_email,
'registered' => current_time( 'mysql', true ),
'activation_key' => $key,
'meta' => serialize( $meta ),
)
);
/**
* Fires after site signup information has been written to the database.
*
* @since 4.4.0
*
* @param string $domain The requested domain.
* @param string $path The requested path.
* @param string $title The requested site title.
* @param string $user The user's requested login name.
* @param string $user_email The user's email address.
* @param string $key The user's activation key.
* @param array $meta Signup meta data. By default, contains the requested privacy setting and lang_id.
*/
do_action( 'after_signup_site', $domain, $path, $title, $user, $user_email, $key, $meta );
}
```
[do\_action( 'after\_signup\_site', string $domain, string $path, string $title, string $user, string $user\_email, string $key, array $meta )](../hooks/after_signup_site)
Fires after site signup information has been written to the database.
[apply\_filters( 'signup\_site\_meta', array $meta, string $domain, string $path, string $title, string $user, string $user\_email, string $key )](../hooks/signup_site_meta)
Filters the metadata for a site signup.
| Uses | Description |
| --- | --- |
| [wp\_rand()](wp_rand) wp-includes/pluggable.php | Generates a random non-negative number. |
| [current\_time()](current_time) wp-includes/functions.php | Retrieves the current time based on specified type. |
| [wpdb::insert()](../classes/wpdb/insert) wp-includes/class-wpdb.php | Inserts a row into the table. |
| [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 |
| --- | --- |
| [validate\_blog\_signup()](validate_blog_signup) wp-signup.php | Validates new site signup. |
| Version | Description |
| --- | --- |
| [MU (3.0.0)](https://developer.wordpress.org/reference/since/mu.3.0.0/) | Introduced. |
wordpress image_link_input_fields( WP_Post $post, string $url_type = '' ): string image\_link\_input\_fields( WP\_Post $post, string $url\_type = '' ): string
============================================================================
Retrieves HTML for the Link URL buttons with the default link type as specified.
`$post` [WP\_Post](../classes/wp_post) Required `$url_type` string Optional Default: `''`
string
File: `wp-admin/includes/media.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/media.php/)
```
function image_link_input_fields( $post, $url_type = '' ) {
$file = wp_get_attachment_url( $post->ID );
$link = get_attachment_link( $post->ID );
if ( empty( $url_type ) ) {
$url_type = get_user_setting( 'urlbutton', 'post' );
}
$url = '';
if ( 'file' === $url_type ) {
$url = $file;
} elseif ( 'post' === $url_type ) {
$url = $link;
}
return "
<input type='text' class='text urlfield' name='attachments[$post->ID][url]' value='" . esc_attr( $url ) . "' /><br />
<button type='button' class='button urlnone' data-link-url=''>" . __( 'None' ) . "</button>
<button type='button' class='button urlfile' data-link-url='" . esc_url( $file ) . "'>" . __( 'File URL' ) . "</button>
<button type='button' class='button urlpost' data-link-url='" . esc_url( $link ) . "'>" . __( 'Attachment Post URL' ) . '</button>
';
}
```
| Uses | Description |
| --- | --- |
| [get\_attachment\_link()](get_attachment_link) wp-includes/link-template.php | Retrieves the permalink for an attachment. |
| [get\_user\_setting()](get_user_setting) wp-includes/option.php | Retrieves user interface setting value based on setting name. |
| [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. |
| [esc\_url()](esc_url) wp-includes/formatting.php | Checks and cleans a URL. |
| Used By | Description |
| --- | --- |
| [get\_attachment\_fields\_to\_edit()](get_attachment_fields_to_edit) wp-admin/includes/media.php | Retrieves the attachment fields to edit form fields. |
| Version | Description |
| --- | --- |
| [2.7.0](https://developer.wordpress.org/reference/since/2.7.0/) | Introduced. |
wordpress _deprecated_file( string $file, string $version, string $replacement = '', string $message = '' ) \_deprecated\_file( string $file, string $version, string $replacement = '', string $message = '' )
===================================================================================================
Marks a file as deprecated and inform when it has been used.
There is a hook [‘deprecated\_file\_included’](../hooks/deprecated_file_included) that will be called that can be used to get the backtrace up to what file and function included the deprecated file.
The current behavior is to trigger a user error if `WP_DEBUG` is true.
This function is to be used in every file that is deprecated.
`$file` string Required The file that was included. `$version` string Required The version of WordPress that deprecated the file. `$replacement` string Optional The file that should have been included based on ABSPATH.
Default: `''`
`$message` string Optional A message regarding the change. Default: `''`
File: `wp-includes/functions.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/functions.php/)
```
function _deprecated_file( $file, $version, $replacement = '', $message = '' ) {
/**
* Fires when a deprecated file is called.
*
* @since 2.5.0
*
* @param string $file The file that was called.
* @param string $replacement The file that should have been included based on ABSPATH.
* @param string $version The version of WordPress that deprecated the file.
* @param string $message A message regarding the change.
*/
do_action( 'deprecated_file_included', $file, $replacement, $version, $message );
/**
* Filters whether to trigger an error for deprecated files.
*
* @since 2.5.0
*
* @param bool $trigger Whether to trigger the error for deprecated files. Default true.
*/
if ( WP_DEBUG && apply_filters( 'deprecated_file_trigger_error', true ) ) {
$message = empty( $message ) ? '' : ' ' . $message;
if ( function_exists( '__' ) ) {
if ( $replacement ) {
trigger_error(
sprintf(
/* translators: 1: PHP file name, 2: Version number, 3: Alternative file name. */
__( 'File %1$s is <strong>deprecated</strong> since version %2$s! Use %3$s instead.' ),
$file,
$version,
$replacement
) . $message,
E_USER_DEPRECATED
);
} else {
trigger_error(
sprintf(
/* translators: 1: PHP file name, 2: Version number. */
__( 'File %1$s is <strong>deprecated</strong> since version %2$s with no alternative available.' ),
$file,
$version
) . $message,
E_USER_DEPRECATED
);
}
} else {
if ( $replacement ) {
trigger_error(
sprintf(
'File %1$s is <strong>deprecated</strong> since version %2$s! Use %3$s instead.',
$file,
$version,
$replacement
) . $message,
E_USER_DEPRECATED
);
} else {
trigger_error(
sprintf(
'File %1$s is <strong>deprecated</strong> since version %2$s with no alternative available.',
$file,
$version
) . $message,
E_USER_DEPRECATED
);
}
}
}
}
```
[do\_action( 'deprecated\_file\_included', string $file, string $replacement, string $version, string $message )](../hooks/deprecated_file_included)
Fires when a deprecated file is called.
[apply\_filters( 'deprecated\_file\_trigger\_error', bool $trigger )](../hooks/deprecated_file_trigger_error)
Filters whether to trigger an error for deprecated files.
| 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\_get\_active\_and\_valid\_plugins()](wp_get_active_and_valid_plugins) wp-includes/load.php | Retrieve an array of active and valid plugin files. |
| 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). |
| [2.5.0](https://developer.wordpress.org/reference/since/2.5.0/) | Introduced. |
| programming_docs |
wordpress size_format( int|string $bytes, int $decimals ): string|false size\_format( int|string $bytes, int $decimals ): string|false
==============================================================
Converts a number of bytes to the largest unit the bytes will fit into.
It is easier to read 1 KB than 1024 bytes and 1 MB than 1048576 bytes. Converts number of bytes to human readable number by taking the number of that unit that the bytes will go into it. Supports YB value.
Please note that integers in PHP are limited to 32 bits, unless they are on 64 bit architecture, then they have 64 bit size. If you need to place the larger size then what PHP integer type will hold, then use a string. It will be converted to a double, which should always have 64 bit length.
Technically the correct unit names for powers of 1024 are KiB, MiB etc.
`$bytes` int|string Required Number of bytes. Note max integer size for integers. `$decimals` int Optional Precision of number of decimal places. Default 0. string|false Number string on success, false on failure.
##### Usage:
```
// Returns the string '1 KiB'
<?php $size_to_display = size_format(1024); ?>
```
File: `wp-includes/functions.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/functions.php/)
```
function size_format( $bytes, $decimals = 0 ) {
$quant = array(
/* translators: Unit symbol for yottabyte. */
_x( 'YB', 'unit symbol' ) => YB_IN_BYTES,
/* translators: Unit symbol for zettabyte. */
_x( 'ZB', 'unit symbol' ) => ZB_IN_BYTES,
/* translators: Unit symbol for exabyte. */
_x( 'EB', 'unit symbol' ) => EB_IN_BYTES,
/* translators: Unit symbol for petabyte. */
_x( 'PB', 'unit symbol' ) => PB_IN_BYTES,
/* translators: Unit symbol for terabyte. */
_x( 'TB', 'unit symbol' ) => TB_IN_BYTES,
/* translators: Unit symbol for gigabyte. */
_x( 'GB', 'unit symbol' ) => GB_IN_BYTES,
/* translators: Unit symbol for megabyte. */
_x( 'MB', 'unit symbol' ) => MB_IN_BYTES,
/* translators: Unit symbol for kilobyte. */
_x( 'KB', 'unit symbol' ) => KB_IN_BYTES,
/* translators: Unit symbol for byte. */
_x( 'B', 'unit symbol' ) => 1,
);
if ( 0 === $bytes ) {
/* translators: Unit symbol for byte. */
return number_format_i18n( 0, $decimals ) . ' ' . _x( 'B', 'unit symbol' );
}
foreach ( $quant as $unit => $mag ) {
if ( (float) $bytes >= $mag ) {
return number_format_i18n( $bytes / $mag, $decimals ) . ' ' . $unit;
}
}
return false;
}
```
| Uses | Description |
| --- | --- |
| [\_x()](_x) wp-includes/l10n.php | Retrieves translated string with gettext context. |
| [number\_format\_i18n()](number_format_i18n) wp-includes/functions.php | Converts float number to format based on the locale. |
| 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`. |
| [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. |
| [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. |
| [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. |
| [multisite\_over\_quota\_message()](multisite_over_quota_message) wp-admin/includes/media.php | Displays the out of storage quota message in Multisite. |
| [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. |
| [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\_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\_xmlrpc\_server::mw\_newMediaObject()](../classes/wp_xmlrpc_server/mw_newmediaobject) wp-includes/class-wp-xmlrpc-server.php | Uploads a file, following your settings. |
| [wp\_print\_media\_templates()](wp_print_media_templates) wp-includes/media-template.php | Prints the templates used in the media manager. |
| Version | Description |
| --- | --- |
| [6.0.0](https://developer.wordpress.org/reference/since/6.0.0/) | Support for PB, EB, ZB, and YB was added. |
| [2.3.0](https://developer.wordpress.org/reference/since/2.3.0/) | Introduced. |
wordpress wp_send_json_success( mixed $data = null, int $status_code = null, int $options ) wp\_send\_json\_success( mixed $data = null, int $status\_code = null, int $options )
=====================================================================================
Sends a JSON response back to an Ajax request, indicating success.
`$data` mixed Optional Data to encode as JSON, then print and die. Default: `null`
`$status_code` int Optional The HTTP status code to output. Default: `null`
`$options` int Optional Options to be passed to json\_encode(). Default 0. The response object will always have a `success` key with the value `true`. If anything is passed to the function it will be encoded as the value for a `data` key.
Example arrays such as the following are converted to JSON:
```
$response = array( 'success' => true ); //if $data is empty
$response = array( 'success' => true, 'data' => $data ); //if $data is set
```
File: `wp-includes/functions.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/functions.php/)
```
function wp_send_json_success( $data = null, $status_code = null, $options = 0 ) {
$response = array( 'success' => true );
if ( isset( $data ) ) {
$response['data'] = $data;
}
wp_send_json( $response, $status_code, $options );
}
```
| Uses | Description |
| --- | --- |
| [wp\_send\_json()](wp_send_json) wp-includes/functions.php | Sends a JSON response back to an Ajax request. |
| Used By | Description |
| --- | --- |
| [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\_ajax\_send\_password\_reset()](wp_ajax_send_password_reset) wp-admin/includes/ajax-actions.php | Ajax handler sends a password reset link. |
| [wp\_ajax\_nopriv\_generate\_password()](wp_ajax_nopriv_generate_password) wp-admin/includes/ajax-actions.php | Ajax handler for generating a password in the no-privilege context. |
| [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\_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\_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\_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\_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\_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\_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\_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::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\_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\_ajax\_get\_community\_events()](wp_ajax_get_community_events) wp-admin/includes/ajax-actions.php | Handles Ajax requests for community events |
| [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\_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\_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\_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. |
| [wp\_ajax\_generate\_password()](wp_ajax_generate_password) wp-admin/includes/ajax-actions.php | Ajax handler for generating a password. |
| [wp\_ajax\_save\_wporg\_username()](wp_ajax_save_wporg_username) wp-admin/includes/ajax-actions.php | Ajax handler for saving the user’s WordPress.org username. |
| [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\_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\_ajax\_crop\_image()](wp_ajax_crop_image) wp-admin/includes/ajax-actions.php | Ajax handler for cropping an image. |
| [WP\_Customize\_Manager::refresh\_nonces()](../classes/wp_customize_manager/refresh_nonces) wp-includes/class-wp-customize-manager.php | Refreshes nonces for the current preview. |
| [wp\_ajax\_update\_plugin()](wp_ajax_update_plugin) wp-admin/includes/ajax-actions.php | Ajax handler for updating a plugin. |
| [wp\_ajax\_destroy\_sessions()](wp_ajax_destroy_sessions) wp-admin/includes/ajax-actions.php | Ajax handler for destroying multiple open sessions for a user. |
| [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\_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\_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\_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\_send\_link\_to\_editor()](wp_ajax_send_link_to_editor) wp-admin/includes/ajax-actions.php | Ajax handler for sending a link to the editor. |
| [wp\_ajax\_get\_revision\_diffs()](wp_ajax_get_revision_diffs) wp-admin/includes/ajax-actions.php | Ajax handler for getting revision diffs. |
| [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\_query\_themes()](wp_ajax_query_themes) wp-admin/includes/ajax-actions.php | Ajax handler for getting themes from [themes\_api()](themes_api) . |
| [wp\_ajax\_image\_editor()](wp_ajax_image_editor) wp-admin/includes/ajax-actions.php | Ajax handler for image editing. |
| [wp\_ajax\_set\_post\_thumbnail()](wp_ajax_set_post_thumbnail) wp-admin/includes/ajax-actions.php | Ajax handler for setting the featured image. |
| [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\_get\_attachment()](wp_ajax_get_attachment) wp-admin/includes/ajax-actions.php | Ajax handler for getting an attachment. |
| [wp\_ajax\_query\_attachments()](wp_ajax_query_attachments) wp-admin/includes/ajax-actions.php | Ajax handler for querying attachments. |
| [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\_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\_find\_posts()](wp_ajax_find_posts) wp-admin/includes/ajax-actions.php | Ajax handler for querying posts for the Find Posts modal. |
| [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::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::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\_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\_Widgets::wp\_ajax\_update\_widget()](../classes/wp_customize_widgets/wp_ajax_update_widget) wp-includes/class-wp-customize-widgets.php | Updates widget settings asynchronously. |
| 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. |
wordpress _wp_dashboard_control_callback( mixed $dashboard, array $meta_box ) \_wp\_dashboard\_control\_callback( mixed $dashboard, array $meta\_box )
========================================================================
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 controls for the current dashboard widget.
`$dashboard` mixed Required `$meta_box` array Required File: `wp-admin/includes/dashboard.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/dashboard.php/)
```
function _wp_dashboard_control_callback( $dashboard, $meta_box ) {
echo '<form method="post" class="dashboard-widget-control-form wp-clearfix">';
wp_dashboard_trigger_widget_control( $meta_box['id'] );
wp_nonce_field( 'edit-dashboard-widget_' . $meta_box['id'], 'dashboard-widget-nonce' );
echo '<input type="hidden" name="widget_id" value="' . esc_attr( $meta_box['id'] ) . '" />';
submit_button( __( 'Save Changes' ) );
echo '</form>';
}
```
| Uses | Description |
| --- | --- |
| [wp\_dashboard\_trigger\_widget\_control()](wp_dashboard_trigger_widget_control) wp-admin/includes/dashboard.php | Calls widget control callback. |
| [submit\_button()](submit_button) wp-admin/includes/template.php | Echoes a submit button, with provided text and appropriate class(es). |
| [wp\_nonce\_field()](wp_nonce_field) wp-includes/functions.php | Retrieves or display nonce hidden field for forms. |
| [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. |
| [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 remove_action( string $hook_name, callable|string|array $callback, int $priority = 10 ): bool remove\_action( string $hook\_name, callable|string|array $callback, int $priority = 10 ): bool
===============================================================================================
Removes a callback function from an action hook.
This can be used to remove default functions attached to a specific action 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 action hook to which the function to be removed is hooked. `$callback` callable|string|array Required The name of the function which should be removed.
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 action callback. Default: `10`
bool Whether the function is removed.
* This function is an alias to [remove\_filter()](remove_filter) .
* See also [add\_action()](add_action) and [add\_filter()](add_filter) .
* To remove a hook, the $function\_to\_remove 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.
File: `wp-includes/plugin.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/plugin.php/)
```
function remove_action( $hook_name, $callback, $priority = 10 ) {
return remove_filter( $hook_name, $callback, $priority );
}
```
| Uses | Description |
| --- | --- |
| [remove\_filter()](remove_filter) wp-includes/plugin.php | Removes a callback function from a filter hook. |
| Used By | Description |
| --- | --- |
| [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\_is\_site\_initialized()](wp_is_site_initialized) wp-includes/ms-site.php | Checks whether a site is initialized. |
| [WP\_Roles::get\_roles\_data()](../classes/wp_roles/get_roles_data) wp-includes/class-wp-roles.php | Gets the available roles data. |
| [\_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\_publish\_changeset()](_wp_customize_publish_changeset) wp-includes/theme.php | Publishes a snapshot’s changes. |
| [WP\_Post\_Type::unregister\_meta\_boxes()](../classes/wp_post_type/unregister_meta_boxes) wp-includes/class-wp-post-type.php | Unregisters the post type meta box if a custom callback was specified. |
| [WP\_Post\_Type::remove\_hooks()](../classes/wp_post_type/remove_hooks) wp-includes/class-wp-post-type.php | Removes the future post hook action for the post type. |
| [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. |
| [Language\_Pack\_Upgrader::bulk\_upgrade()](../classes/language_pack_upgrader/bulk_upgrade) wp-admin/includes/class-language-pack-upgrader.php | Bulk upgrade language packs. |
| [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. |
| [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. |
| [WP\_MS\_Themes\_List\_Table::single\_row()](../classes/wp_ms_themes_list_table/single_row) wp-admin/includes/class-wp-ms-themes-list-table.php | |
| [WP\_Customize\_Manager::\_\_construct()](../classes/wp_customize_manager/__construct) wp-includes/class-wp-customize-manager.php | Constructor. |
| [\_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. |
| [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. |
| [automatic\_feed\_links()](automatic_feed_links) wp-includes/deprecated.php | Enable/disable automatic general feed link outputting. |
| [add\_feed()](add_feed) wp-includes/rewrite.php | Adds a new feed type like /atom1/. |
| [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_script_is( string $handle, string $list = 'enqueued' ): bool wp\_script\_is( string $handle, string $list = 'enqueued' ): bool
=================================================================
Determines whether a script has been added to the queue.
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.
`$handle` string Required Name of the script. `$list` string Optional Status of the script to check. Default `'enqueued'`.
Accepts `'enqueued'`, `'registered'`, `'queue'`, `'to_do'`, and `'done'`. Default: `'enqueued'`
bool Whether the script is queued.
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_is( $handle, $list = 'enqueued' ) {
_wp_scripts_maybe_doing_it_wrong( __FUNCTION__, $handle );
return (bool) wp_scripts()->query( $handle, $list );
}
```
| Uses | Description |
| --- | --- |
| [wp\_scripts()](wp_scripts) wp-includes/functions.wp-scripts.php | Initialize $wp\_scripts if it has not been set. |
| Used By | Description |
| --- | --- |
| [the\_block\_editor\_meta\_boxes()](the_block_editor_meta_boxes) wp-admin/includes/post.php | Renders the meta boxes forms. |
| [wp\_localize\_community\_events()](wp_localize_community_events) wp-includes/script-loader.php | Localizes community events data that needs to be passed to dashboard.js. |
| [wp\_localize\_jquery\_ui\_datepicker()](wp_localize_jquery_ui_datepicker) wp-includes/script-loader.php | Localizes the jQuery UI datepicker. |
| Version | Description |
| --- | --- |
| [3.5.0](https://developer.wordpress.org/reference/since/3.5.0/) | `'enqueued'` added as an alias of the `'queue'` list. |
| [2.8.0](https://developer.wordpress.org/reference/since/2.8.0/) | Introduced. |
wordpress wp_delete_post_revision( int|WP_Post $revision ): WP_Post|false|null wp\_delete\_post\_revision( int|WP\_Post $revision ): WP\_Post|false|null
=========================================================================
Deletes a revision.
Deletes the row from the posts table corresponding to the specified revision.
`$revision` int|[WP\_Post](../classes/wp_post) Required Revision ID or revision object. [WP\_Post](../classes/wp_post)|false|null Null or false if error, deleted post object if success.
File: `wp-includes/revision.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/revision.php/)
```
function wp_delete_post_revision( $revision ) {
$revision = wp_get_post_revision( $revision );
if ( ! $revision ) {
return $revision;
}
$delete = wp_delete_post( $revision->ID );
if ( $delete ) {
/**
* Fires once a post revision has been deleted.
*
* @since 2.6.0
*
* @param int $revision_id Post revision ID.
* @param WP_Post $revision Post revision object.
*/
do_action( 'wp_delete_post_revision', $revision->ID, $revision );
}
return $delete;
}
```
[do\_action( 'wp\_delete\_post\_revision', int $revision\_id, WP\_Post $revision )](../hooks/wp_delete_post_revision)
Fires once a post revision has been deleted.
| Uses | Description |
| --- | --- |
| [wp\_get\_post\_revision()](wp_get_post_revision) wp-includes/revision.php | Gets a post revision. |
| [wp\_delete\_post()](wp_delete_post) wp-includes/post.php | Trashes or deletes a post or page. |
| [do\_action()](do_action) wp-includes/plugin.php | Calls the callback functions that have been added to an action hook. |
| 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\_create\_post\_autosave()](wp_create_post_autosave) wp-admin/includes/post.php | Creates autosave data for the specified post from `$_POST` data. |
| [wp\_delete\_post()](wp_delete_post) wp-includes/post.php | Trashes or deletes a post or page. |
| [wp\_save\_post\_revision()](wp_save_post_revision) wp-includes/revision.php | Creates a revision for the current version of a post. |
| Version | Description |
| --- | --- |
| [2.6.0](https://developer.wordpress.org/reference/since/2.6.0/) | Introduced. |
wordpress wp_register_media_personal_data_exporter( array[] $exporters ): array[] wp\_register\_media\_personal\_data\_exporter( array[] $exporters ): array[]
============================================================================
Registers the personal data exporter for media.
`$exporters` array[] Required An array of personal data exporters, keyed by their ID. array[] Updated array of personal data exporters.
File: `wp-includes/media.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/media.php/)
```
function wp_register_media_personal_data_exporter( $exporters ) {
$exporters['wordpress-media'] = array(
'exporter_friendly_name' => __( 'WordPress Media' ),
'callback' => 'wp_media_personal_data_exporter',
);
return $exporters;
}
```
| Uses | Description |
| --- | --- |
| [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. |
wordpress wp_insert_link( array $linkdata, bool $wp_error = false ): int|WP_Error wp\_insert\_link( array $linkdata, bool $wp\_error = false ): int|WP\_Error
===========================================================================
Inserts a link into the database, or updates an existing link.
Runs all the necessary sanitizing, provides default values if arguments are missing, and finally saves the link.
`$linkdata` array Required Elements that make up the link to insert.
* `link_id`intOptional. The ID of the existing link if updating.
* `link_url`stringThe URL the link points to.
* `link_name`stringThe title of the link.
* `link_image`stringOptional. A URL of an image.
* `link_target`stringOptional. The target element for the anchor tag.
* `link_description`stringOptional. A short description of the link.
* `link_visible`stringOptional. `'Y'` means visible, anything else means not.
* `link_owner`intOptional. A user ID.
* `link_rating`intOptional. A rating for the link.
* `link_rel`stringOptional. A relationship of the link to you.
* `link_notes`stringOptional. An extended description of or notes on the link.
* `link_rss`stringOptional. A URL of an associated RSS feed.
* `link_category`intOptional. The term ID of the link category.
If empty, uses default link category.
`$wp_error` bool Optional Whether to return a [WP\_Error](../classes/wp_error) object on failure. Default: `false`
int|[WP\_Error](../classes/wp_error) Value 0 or [WP\_Error](../classes/wp_error) on failure. The link ID on success.
* Specifying the *link\_id* value for $linkdata array will update any link that exists with that ID. If that ID does not exist, the ID will be disregarded and a new link will be created.
* You can specify as much as you’d like within the $linkdata array. Only *link\_name* and *link\_url* must be specified for the link to be successfully saved.
File: `wp-admin/includes/bookmark.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/bookmark.php/)
```
function wp_insert_link( $linkdata, $wp_error = false ) {
global $wpdb;
$defaults = array(
'link_id' => 0,
'link_name' => '',
'link_url' => '',
'link_rating' => 0,
);
$parsed_args = wp_parse_args( $linkdata, $defaults );
$parsed_args = wp_unslash( sanitize_bookmark( $parsed_args, 'db' ) );
$link_id = $parsed_args['link_id'];
$link_name = $parsed_args['link_name'];
$link_url = $parsed_args['link_url'];
$update = false;
if ( ! empty( $link_id ) ) {
$update = true;
}
if ( '' === trim( $link_name ) ) {
if ( '' !== trim( $link_url ) ) {
$link_name = $link_url;
} else {
return 0;
}
}
if ( '' === trim( $link_url ) ) {
return 0;
}
$link_rating = ( ! empty( $parsed_args['link_rating'] ) ) ? $parsed_args['link_rating'] : 0;
$link_image = ( ! empty( $parsed_args['link_image'] ) ) ? $parsed_args['link_image'] : '';
$link_target = ( ! empty( $parsed_args['link_target'] ) ) ? $parsed_args['link_target'] : '';
$link_visible = ( ! empty( $parsed_args['link_visible'] ) ) ? $parsed_args['link_visible'] : 'Y';
$link_owner = ( ! empty( $parsed_args['link_owner'] ) ) ? $parsed_args['link_owner'] : get_current_user_id();
$link_notes = ( ! empty( $parsed_args['link_notes'] ) ) ? $parsed_args['link_notes'] : '';
$link_description = ( ! empty( $parsed_args['link_description'] ) ) ? $parsed_args['link_description'] : '';
$link_rss = ( ! empty( $parsed_args['link_rss'] ) ) ? $parsed_args['link_rss'] : '';
$link_rel = ( ! empty( $parsed_args['link_rel'] ) ) ? $parsed_args['link_rel'] : '';
$link_category = ( ! empty( $parsed_args['link_category'] ) ) ? $parsed_args['link_category'] : array();
// Make sure we set a valid category.
if ( ! is_array( $link_category ) || 0 === count( $link_category ) ) {
$link_category = array( get_option( 'default_link_category' ) );
}
if ( $update ) {
if ( false === $wpdb->update( $wpdb->links, compact( 'link_url', 'link_name', 'link_image', 'link_target', 'link_description', 'link_visible', 'link_owner', 'link_rating', 'link_rel', 'link_notes', 'link_rss' ), compact( 'link_id' ) ) ) {
if ( $wp_error ) {
return new WP_Error( 'db_update_error', __( 'Could not update link in the database.' ), $wpdb->last_error );
} else {
return 0;
}
}
} else {
if ( false === $wpdb->insert( $wpdb->links, compact( 'link_url', 'link_name', 'link_image', 'link_target', 'link_description', 'link_visible', 'link_owner', 'link_rating', 'link_rel', 'link_notes', 'link_rss' ) ) ) {
if ( $wp_error ) {
return new WP_Error( 'db_insert_error', __( 'Could not insert link into the database.' ), $wpdb->last_error );
} else {
return 0;
}
}
$link_id = (int) $wpdb->insert_id;
}
wp_set_link_cats( $link_id, $link_category );
if ( $update ) {
/**
* Fires after a link was updated in the database.
*
* @since 2.0.0
*
* @param int $link_id ID of the link that was updated.
*/
do_action( 'edit_link', $link_id );
} else {
/**
* Fires after a link was added to the database.
*
* @since 2.0.0
*
* @param int $link_id ID of the link that was added.
*/
do_action( 'add_link', $link_id );
}
clean_bookmark_cache( $link_id );
return $link_id;
}
```
[do\_action( 'add\_link', int $link\_id )](../hooks/add_link)
Fires after a link was added to the database.
[do\_action( 'edit\_link', int $link\_id )](../hooks/edit_link)
Fires after a link was updated in the database.
| Uses | Description |
| --- | --- |
| [wp\_set\_link\_cats()](wp_set_link_cats) wp-admin/includes/bookmark.php | Update link with the specified link categories. |
| [sanitize\_bookmark()](sanitize_bookmark) wp-includes/bookmark.php | Sanitizes all bookmark fields. |
| [clean\_bookmark\_cache()](clean_bookmark_cache) wp-includes/bookmark.php | Deletes the bookmark cache. |
| [wpdb::update()](../classes/wpdb/update) wp-includes/class-wpdb.php | Updates a row in the table. |
| [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. |
| [wp\_unslash()](wp_unslash) wp-includes/formatting.php | Removes slashes from a string or recursively removes slashes from strings within an array. |
| [wp\_parse\_args()](wp_parse_args) wp-includes/functions.php | Merges user defined arguments into defaults array. |
| [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\_current\_user\_id()](get_current_user_id) wp-includes/user.php | Gets the current user’s ID. |
| [WP\_Error::\_\_construct()](../classes/wp_error/__construct) wp-includes/class-wp-error.php | Initializes the error. |
| Used By | Description |
| --- | --- |
| [wp\_update\_link()](wp_update_link) wp-admin/includes/bookmark.php | Updates a link in the database. |
| [edit\_link()](edit_link) wp-admin/includes/bookmark.php | Updates or inserts a link using values provided in $\_POST. |
| Version | Description |
| --- | --- |
| [2.0.0](https://developer.wordpress.org/reference/since/2.0.0/) | Introduced. |
wordpress get_to_ping( int|WP_Post $post ): string[]|false get\_to\_ping( int|WP\_Post $post ): string[]|false
===================================================
Retrieves URLs that need to be pinged.
`$post` int|[WP\_Post](../classes/wp_post) Required Post ID or post object. string[]|false List of URLs yet to ping.
File: `wp-includes/post.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/post.php/)
```
function get_to_ping( $post ) {
$post = get_post( $post );
if ( ! $post ) {
return false;
}
$to_ping = sanitize_trackback_urls( $post->to_ping );
$to_ping = preg_split( '/\s/', $to_ping, -1, PREG_SPLIT_NO_EMPTY );
/**
* Filters the list of URLs yet to ping for the given post.
*
* @since 2.0.0
*
* @param string[] $to_ping List of URLs yet to ping.
*/
return apply_filters( 'get_to_ping', $to_ping );
}
```
[apply\_filters( 'get\_to\_ping', string[] $to\_ping )](../hooks/get_to_ping)
Filters the list of URLs yet to ping for the given post.
| Uses | Description |
| --- | --- |
| [sanitize\_trackback\_urls()](sanitize_trackback_urls) wp-includes/formatting.php | Sanitizes space or carriage return separated URLs that are used to send trackbacks. |
| [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 |
| --- | --- |
| [\_publish\_post\_hook()](_publish_post_hook) wp-includes/post.php | Hook to schedule pings and enclosures when a post is published. |
| [do\_trackbacks()](do_trackbacks) wp-includes/comment.php | Performs trackbacks. |
| Version | Description |
| --- | --- |
| [4.7.0](https://developer.wordpress.org/reference/since/4.7.0/) | `$post` can be a [WP\_Post](../classes/wp_post) object. |
| [1.5.0](https://developer.wordpress.org/reference/since/1.5.0/) | Introduced. |
wordpress remove_allowed_options( array $del_options, string|array $options = '' ): array remove\_allowed\_options( array $del\_options, string|array $options = '' ): array
==================================================================================
Removes a list of options from the allowed options list.
`$del_options` array Required `$options` string|array Optional Default: `''`
array
File: `wp-admin/includes/plugin.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/plugin.php/)
```
function remove_allowed_options( $del_options, $options = '' ) {
if ( '' === $options ) {
global $allowed_options;
} else {
$allowed_options = $options;
}
foreach ( $del_options as $page => $keys ) {
foreach ( $keys as $key ) {
if ( isset( $allowed_options[ $page ] ) && is_array( $allowed_options[ $page ] ) ) {
$pos = array_search( $key, $allowed_options[ $page ], true );
if ( false !== $pos ) {
unset( $allowed_options[ $page ][ $pos ] );
}
}
}
}
return $allowed_options;
}
```
| Used By | Description |
| --- | --- |
| [remove\_option\_whitelist()](remove_option_whitelist) wp-includes/deprecated.php | Removes a list of options from the allowed options list. |
| Version | Description |
| --- | --- |
| [5.5.0](https://developer.wordpress.org/reference/since/5.5.0/) | Introduced. |
wordpress get_author_rss_link( bool $display = false, int $author_id = 1 ): string get\_author\_rss\_link( bool $display = false, int $author\_id = 1 ): string
============================================================================
This function has been deprecated. Use [get\_author\_feed\_link()](get_author_feed_link) instead.
Print/Return link to author RSS feed.
* [get\_author\_feed\_link()](get_author_feed_link)
`$display` bool Optional Default: `false`
`$author_id` int Optional Default: `1`
string
File: `wp-includes/deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/deprecated.php/)
```
function get_author_rss_link($display = false, $author_id = 1) {
_deprecated_function( __FUNCTION__, '2.5.0', 'get_author_feed_link()' );
$link = get_author_feed_link($author_id);
if ( $display )
echo $link;
return $link;
}
```
| Uses | Description |
| --- | --- |
| [get\_author\_feed\_link()](get_author_feed_link) wp-includes/link-template.php | Retrieves the feed link for a given author. |
| [\_deprecated\_function()](_deprecated_function) wp-includes/functions.php | Marks a function as deprecated and inform when it has been used. |
| Version | Description |
| --- | --- |
| [2.5.0](https://developer.wordpress.org/reference/since/2.5.0/) | Use [get\_author\_feed\_link()](get_author_feed_link) |
| [1.2.0](https://developer.wordpress.org/reference/since/1.2.0/) | Introduced. |
wordpress _delete_attachment_theme_mod( int $id ) \_delete\_attachment\_theme\_mod( int $id )
===========================================
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.
Checks an attachment being deleted to see if it’s a header or background image.
If true it removes the theme modification which would be pointing at the deleted attachment.
`$id` int Required The attachment ID. File: `wp-includes/theme.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/theme.php/)
```
function _delete_attachment_theme_mod( $id ) {
$attachment_image = wp_get_attachment_url( $id );
$header_image = get_header_image();
$background_image = get_background_image();
$custom_logo_id = get_theme_mod( 'custom_logo' );
if ( $custom_logo_id && $custom_logo_id == $id ) {
remove_theme_mod( 'custom_logo' );
remove_theme_mod( 'header_text' );
}
if ( $header_image && $header_image == $attachment_image ) {
remove_theme_mod( 'header_image' );
remove_theme_mod( 'header_image_data' );
}
if ( $background_image && $background_image == $attachment_image ) {
remove_theme_mod( 'background_image' );
}
}
```
| Uses | Description |
| --- | --- |
| [get\_header\_image()](get_header_image) wp-includes/theme.php | Retrieves header image for custom header. |
| [get\_background\_image()](get_background_image) wp-includes/theme.php | Retrieves background image for custom background. |
| [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. |
| [wp\_get\_attachment\_url()](wp_get_attachment_url) wp-includes/post.php | Retrieves the URL for an attachment. |
| Version | Description |
| --- | --- |
| [4.5.0](https://developer.wordpress.org/reference/since/4.5.0/) | Also removes custom logo theme mods. |
| [4.3.0](https://developer.wordpress.org/reference/since/4.3.0/) | Also removes `header_image_data`. |
| [3.0.0](https://developer.wordpress.org/reference/since/3.0.0/) | Introduced. |
| programming_docs |
wordpress wp_untrash_post_comments( int|WP_Post|null $post = null ): true|void wp\_untrash\_post\_comments( int|WP\_Post|null $post = null ): true|void
========================================================================
Restores comments for a post from the Trash.
`$post` int|[WP\_Post](../classes/wp_post)|null Optional Post ID or post object. Defaults to global $post. Default: `null`
true|void
File: `wp-includes/post.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/post.php/)
```
function wp_untrash_post_comments( $post = null ) {
global $wpdb;
$post = get_post( $post );
if ( ! $post ) {
return;
}
$post_id = $post->ID;
$statuses = get_post_meta( $post_id, '_wp_trash_meta_comments_status', true );
if ( ! $statuses ) {
return true;
}
/**
* Fires before comments are restored for a post from the Trash.
*
* @since 2.9.0
*
* @param int $post_id Post ID.
*/
do_action( 'untrash_post_comments', $post_id );
// Restore each comment to its original status.
$group_by_status = array();
foreach ( $statuses as $comment_id => $comment_status ) {
$group_by_status[ $comment_status ][] = $comment_id;
}
foreach ( $group_by_status as $status => $comments ) {
// Sanity check. This shouldn't happen.
if ( 'post-trashed' === $status ) {
$status = '0';
}
$comments_in = implode( ', ', array_map( 'intval', $comments ) );
$wpdb->query( $wpdb->prepare( "UPDATE $wpdb->comments SET comment_approved = %s WHERE comment_ID IN ($comments_in)", $status ) );
}
clean_comment_cache( array_keys( $statuses ) );
delete_post_meta( $post_id, '_wp_trash_meta_comments_status' );
/**
* Fires after comments are restored for a post from the Trash.
*
* @since 2.9.0
*
* @param int $post_id Post ID.
*/
do_action( 'untrashed_post_comments', $post_id );
}
```
[do\_action( 'untrashed\_post\_comments', int $post\_id )](../hooks/untrashed_post_comments)
Fires after comments are restored for a post from the Trash.
[do\_action( 'untrash\_post\_comments', int $post\_id )](../hooks/untrash_post_comments)
Fires before comments are restored for a post from the Trash.
| Uses | Description |
| --- | --- |
| [delete\_post\_meta()](delete_post_meta) wp-includes/post.php | Deletes a post meta field for the given post ID. |
| [wpdb::query()](../classes/wpdb/query) wp-includes/class-wpdb.php | Performs a database query, using current database connection. |
| [clean\_comment\_cache()](clean_comment_cache) wp-includes/comment.php | Removes a comment from the object cache. |
| [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\_post()](get_post) wp-includes/post.php | Retrieves post data given a post ID or post object. |
| [wpdb::prepare()](../classes/wpdb/prepare) wp-includes/class-wpdb.php | Prepares a SQL query for safe execution. |
| Used By | Description |
| --- | --- |
| [wp\_untrash\_post()](wp_untrash_post) wp-includes/post.php | Restores a post from the Trash. |
| Version | Description |
| --- | --- |
| [2.9.0](https://developer.wordpress.org/reference/since/2.9.0/) | Introduced. |
wordpress get_space_allowed(): int get\_space\_allowed(): int
==========================
Returns the upload quota for the current blog.
int Quota in megabytes
File: `wp-includes/ms-functions.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/ms-functions.php/)
```
function get_space_allowed() {
$space_allowed = get_option( 'blog_upload_space' );
if ( ! is_numeric( $space_allowed ) ) {
$space_allowed = get_site_option( 'blog_upload_space' );
}
if ( ! is_numeric( $space_allowed ) ) {
$space_allowed = 100;
}
/**
* Filters the upload quota for the current site.
*
* @since 3.7.0
*
* @param int $space_allowed Upload quota in megabytes for the current blog.
*/
return apply_filters( 'get_space_allowed', $space_allowed );
}
```
[apply\_filters( 'get\_space\_allowed', int $space\_allowed )](../hooks/get_space_allowed)
Filters the upload quota for the current site.
| Uses | Description |
| --- | --- |
| [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. |
| Used By | Description |
| --- | --- |
| [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. |
| [wp\_dashboard\_quota()](wp_dashboard_quota) wp-admin/includes/dashboard.php | Displays file upload quota on dashboard. |
| [multisite\_over\_quota\_message()](multisite_over_quota_message) wp-admin/includes/media.php | Displays the out of storage quota message in Multisite. |
| [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. |
| [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. |
| [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 |
| --- | --- |
| [MU (3.0.0)](https://developer.wordpress.org/reference/since/mu.3.0.0/) | Introduced. |
wordpress get_allowed_mime_types( int|WP_User $user = null ): string[] get\_allowed\_mime\_types( int|WP\_User $user = null ): string[]
================================================================
Retrieves the list of allowed mime types and file extensions.
`$user` int|[WP\_User](../classes/wp_user) Optional User to check. Defaults to current user. Default: `null`
string[] Array of mime types keyed by the file extension regex corresponding to those types.
File: `wp-includes/functions.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/functions.php/)
```
function get_allowed_mime_types( $user = null ) {
$t = wp_get_mime_types();
unset( $t['swf'], $t['exe'] );
if ( function_exists( 'current_user_can' ) ) {
$unfiltered = $user ? user_can( $user, 'unfiltered_html' ) : current_user_can( 'unfiltered_html' );
}
if ( empty( $unfiltered ) ) {
unset( $t['htm|html'], $t['js'] );
}
/**
* Filters the list of allowed mime types and file extensions.
*
* @since 2.0.0
*
* @param array $t Mime types keyed by the file extension regex corresponding to those types.
* @param int|WP_User|null $user User ID, User object or null if not provided (indicates current user).
*/
return apply_filters( 'upload_mimes', $t, $user );
}
```
[apply\_filters( 'upload\_mimes', array $t, int|WP\_User|null $user )](../hooks/upload_mimes)
Filters the list of allowed mime types and file extensions.
| Uses | Description |
| --- | --- |
| [user\_can()](user_can) wp-includes/capabilities.php | Returns whether a particular user has the specified capability. |
| [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 |
| --- | --- |
| [get\_default\_block\_editor\_settings()](get_default_block_editor_settings) wp-includes/block-editor.php | Returns the default block editor settings. |
| [WP\_REST\_Attachments\_Controller::get\_media\_types()](../classes/wp_rest_attachments_controller/get_media_types) wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php | Retrieves the supported media types. |
| [sanitize\_file\_name()](sanitize_file_name) wp-includes/formatting.php | Sanitizes a filename, replacing whitespace with dashes. |
| [wp\_check\_filetype()](wp_check_filetype) wp-includes/functions.php | Retrieves the file type from the file name. |
| [wp\_check\_filetype\_and\_ext()](wp_check_filetype_and_ext) wp-includes/functions.php | Attempts to determine the real file type of a file. |
| [atom\_enclosure()](atom_enclosure) wp-includes/feed.php | Displays the atom enclosure for the current post. |
| [wp\_plupload\_default\_settings()](wp_plupload_default_settings) wp-includes/media.php | Prints default Plupload arguments. |
| [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 |
| --- | --- |
| [2.8.6](https://developer.wordpress.org/reference/since/2.8.6/) | Introduced. |
wordpress _local_storage_notice() \_local\_storage\_notice()
==========================
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 HTML for restoring the post data from DOM storage
File: `wp-admin/includes/template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/template.php/)
```
function _local_storage_notice() {
?>
<div id="local-storage-notice" class="hidden notice is-dismissible">
<p class="local-restore">
<?php _e( 'The backup of this post in your browser is different from the version below.' ); ?>
<button type="button" class="button restore-backup"><?php _e( 'Restore the backup' ); ?></button>
</p>
<p class="help">
<?php _e( 'This will replace the current editor content with the last backup version. You can use undo and redo in the editor to get the old content back or to return to the restored version.' ); ?>
</p>
</div>
<?php
}
```
| Uses | Description |
| --- | --- |
| [\_e()](_e) wp-includes/l10n.php | Displays translated text. |
| Version | Description |
| --- | --- |
| [3.6.0](https://developer.wordpress.org/reference/since/3.6.0/) | Introduced. |
wordpress wp_customize_support_script() wp\_customize\_support\_script()
================================
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.
This function MUST be called inside the body tag.
Ideally, call this function immediately after the body tag is opened.
This prevents a flash of unstyled content.
It is also recommended that you add the "no-customize-support" class to the body tag by default.
File: `wp-includes/theme.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/theme.php/)
```
function wp_customize_support_script() {
$admin_origin = parse_url( admin_url() );
$home_origin = parse_url( home_url() );
$cross_domain = ( strtolower( $admin_origin['host'] ) != strtolower( $home_origin['host'] ) );
$type_attr = current_theme_supports( 'html5', 'script' ) ? '' : ' type="text/javascript"';
?>
<script<?php echo $type_attr; ?>>
(function() {
var request, b = document.body, c = 'className', cs = 'customize-support', rcs = new RegExp('(^|\\s+)(no-)?'+cs+'(\\s+|$)');
<?php if ( $cross_domain ) : ?>
request = (function(){ var xhr = new XMLHttpRequest(); return ('withCredentials' in xhr); })();
<?php else : ?>
request = true;
<?php endif; ?>
b[c] = b[c].replace( rcs, ' ' );
// The customizer requires postMessage and CORS (if the site is cross domain).
b[c] += ( window.postMessage && request ? ' ' : ' no-' ) + cs;
}());
</script>
<?php
}
```
| Uses | Description |
| --- | --- |
| [current\_theme\_supports()](current_theme_supports) wp-includes/theme.php | Checks a theme’s support for a given feature. |
| [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 |
| --- | --- |
| [5.5.0](https://developer.wordpress.org/reference/since/5.5.0/) | IE8 and older are no longer supported. |
| [4.7.0](https://developer.wordpress.org/reference/since/4.7.0/) | Support for IE8 and below is explicitly removed via conditional comments. |
| [3.4.0](https://developer.wordpress.org/reference/since/3.4.0/) | Introduced. |
wordpress register_block_type( string|WP_Block_Type $block_type, array $args = array() ): WP_Block_Type|false register\_block\_type( string|WP\_Block\_Type $block\_type, array $args = array() ): WP\_Block\_Type|false
==========================================================================================================
Registers a block type. The recommended way is to register a block type using the metadata stored in the `block.json` file.
`$block_type` string|[WP\_Block\_Type](../classes/wp_block_type) Required Block type name including namespace, or alternatively a path to the JSON file with metadata definition for the block, or a path to the folder where the `block.json` file is located, or a complete [WP\_Block\_Type](../classes/wp_block_type) instance.
In case a [WP\_Block\_Type](../classes/wp_block_type) is provided, the $args parameter will be ignored. `$args` array Optional Array of block type arguments. Accepts any public property of `WP_Block_Type`. See [WP\_Block\_Type::\_\_construct()](../classes/wp_block_type/__construct) for information on accepted arguments. More Arguments from WP\_Block\_Type::\_\_construct( ... $args ) Array or string of arguments for registering a block type. Any arguments may be defined, however the ones described below are supported by default.
* `api_version`stringBlock API version.
* `title`stringHuman-readable block type label.
* `category`string|nullBlock type category classification, used in search interfaces to arrange block types by category.
* `parent`string[]|nullSetting parent lets a block require that it is only available when nested within the specified blocks.
* `ancestor`string[]|nullSetting ancestor makes a block available only inside the specified block types at any position of the ancestor's block subtree.
* `icon`string|nullBlock type icon.
* `description`stringA detailed block type description.
* `keywords`string[]Additional keywords to produce block type as result in search interfaces.
* `textdomain`string|nullThe translation textdomain.
* `styles`array[]Alternative block styles.
* `variations`array[]Block variations.
* `supports`array|nullSupported features.
* `example`array|nullStructured data for the block preview.
* `render_callback`callable|nullBlock type render callback.
* `attributes`array|nullBlock type attributes property schemas.
* `uses_context`string[]Context values inherited by blocks of this type.
* `provides_context`string[]|nullContext provided by blocks of this type.
* `editor_script_handles`string[]Block type editor only script handles.
* `script_handles`string[]Block type front end and editor script handles.
* `view_script_handles`string[]Block type front end only script handles.
* `editor_style_handles`string[]Block type editor only style handles.
* `style_handles`string[]Block type front end and editor style handles.
Default: `array()`
[WP\_Block\_Type](../classes/wp_block_type)|false The registered block type on success, or false on failure.
File: `wp-includes/blocks.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/blocks.php/)
```
function register_block_type( $block_type, $args = array() ) {
if ( is_string( $block_type ) && file_exists( $block_type ) ) {
return register_block_type_from_metadata( $block_type, $args );
}
return WP_Block_Type_Registry::get_instance()->register( $block_type, $args );
}
```
| Uses | Description |
| --- | --- |
| [register\_block\_type\_from\_metadata()](register_block_type_from_metadata) wp-includes/blocks.php | Registers a block type from the metadata stored in the `block.json` file. |
| [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. |
| Version | Description |
| --- | --- |
| [5.8.0](https://developer.wordpress.org/reference/since/5.8.0/) | First parameter now accepts a path to the `block.json` file. |
| [5.0.0](https://developer.wordpress.org/reference/since/5.0.0/) | Introduced. |
wordpress wp_get_video_extensions(): string[] wp\_get\_video\_extensions(): string[]
======================================
Returns a filtered list of supported video formats.
string[] List of supported video formats.
File: `wp-includes/media.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/media.php/)
```
function wp_get_video_extensions() {
/**
* Filters the list of supported video formats.
*
* @since 3.6.0
*
* @param string[] $extensions An array of supported video formats. Defaults are
* 'mp4', 'm4v', 'webm', 'ogv', 'flv'.
*/
return apply_filters( 'wp_video_extensions', array( 'mp4', 'm4v', 'webm', 'ogv', 'flv' ) );
}
```
[apply\_filters( 'wp\_video\_extensions', string[] $extensions )](../hooks/wp_video_extensions)
Filters the list of supported video formats.
| 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 |
| --- | --- |
| [populate\_network\_meta()](populate_network_meta) wp-admin/includes/schema.php | Creates WordPress network meta and sets the default values. |
| [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\_attachment\_is()](wp_attachment_is) wp-includes/post.php | Verifies an attachment is of a given type. |
| [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\_maybe\_load\_embeds()](wp_maybe_load_embeds) wp-includes/embed.php | Determines if default embed handlers should be loaded. |
| [wp\_video\_shortcode()](wp_video_shortcode) wp-includes/media.php | Builds the Video shortcode output. |
| [wp\_underscore\_video\_template()](wp_underscore_video_template) wp-includes/media-template.php | Outputs the markup for a video tag to be used in an Underscore template when data.model is passed. |
| [wp\_print\_media\_templates()](wp_print_media_templates) wp-includes/media-template.php | Prints the templates used in the media manager. |
| Version | Description |
| --- | --- |
| [3.6.0](https://developer.wordpress.org/reference/since/3.6.0/) | Introduced. |
wordpress get_lastcommentmodified( string $timezone = 'server' ): string|false get\_lastcommentmodified( string $timezone = 'server' ): string|false
=====================================================================
Retrieves the date the last comment was modified.
`$timezone` string Optional Which timezone to use in reference to `'gmt'`, `'blog'`, or `'server'` locations. Default: `'server'`
string|false Last comment modified date on success, false on failure.
File: `wp-includes/comment.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/comment.php/)
```
function get_lastcommentmodified( $timezone = 'server' ) {
global $wpdb;
$timezone = strtolower( $timezone );
$key = "lastcommentmodified:$timezone";
$comment_modified_date = wp_cache_get( $key, 'timeinfo' );
if ( false !== $comment_modified_date ) {
return $comment_modified_date;
}
switch ( $timezone ) {
case 'gmt':
$comment_modified_date = $wpdb->get_var( "SELECT comment_date_gmt FROM $wpdb->comments WHERE comment_approved = '1' ORDER BY comment_date_gmt DESC LIMIT 1" );
break;
case 'blog':
$comment_modified_date = $wpdb->get_var( "SELECT comment_date FROM $wpdb->comments WHERE comment_approved = '1' ORDER BY comment_date_gmt DESC LIMIT 1" );
break;
case 'server':
$add_seconds_server = gmdate( 'Z' );
$comment_modified_date = $wpdb->get_var( $wpdb->prepare( "SELECT DATE_ADD(comment_date_gmt, INTERVAL %s SECOND) FROM $wpdb->comments WHERE comment_approved = '1' ORDER BY comment_date_gmt DESC LIMIT 1", $add_seconds_server ) );
break;
}
if ( $comment_modified_date ) {
wp_cache_set( $key, $comment_modified_date, 'timeinfo' );
return $comment_modified_date;
}
return false;
}
```
| Uses | Description |
| --- | --- |
| [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. |
| [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::send\_headers()](../classes/wp/send_headers) wp-includes/class-wp.php | Sends additional HTTP headers for caching, content type, etc. |
| Version | Description |
| --- | --- |
| [4.7.0](https://developer.wordpress.org/reference/since/4.7.0/) | Replaced caching the modified date in a local static variable with the Object Cache API. |
| [1.5.0](https://developer.wordpress.org/reference/since/1.5.0/) | Introduced. |
| programming_docs |
wordpress rest_is_integer( mixed $maybe_integer ): bool rest\_is\_integer( mixed $maybe\_integer ): bool
================================================
Determines if a given value is integer-like.
`$maybe_integer` mixed Required The value being evaluated. bool True if an integer, 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_integer( $maybe_integer ) {
return is_numeric( $maybe_integer ) && round( (float) $maybe_integer ) === (float) $maybe_integer;
}
```
| 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. |
| Version | Description |
| --- | --- |
| [5.5.0](https://developer.wordpress.org/reference/since/5.5.0/) | Introduced. |
wordpress wp_find_hierarchy_loop( callable $callback, int $start, int $start_parent, array $callback_args = array() ): array wp\_find\_hierarchy\_loop( callable $callback, int $start, int $start\_parent, array $callback\_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.
Finds hierarchy loops using a callback function that maps object IDs to parent IDs.
`$callback` callable Required Function that accepts ( ID, $callback\_args ) and outputs parent\_ID. `$start` int Required The ID to start the loop check at. `$start_parent` int Required The parent\_ID of $start to use instead of calling $callback( $start ).
Use null to always use $callback `$callback_args` array Optional Additional arguments to send to $callback. Default: `array()`
array IDs of all members of loop.
File: `wp-includes/functions.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/functions.php/)
```
function wp_find_hierarchy_loop( $callback, $start, $start_parent, $callback_args = array() ) {
$override = is_null( $start_parent ) ? array() : array( $start => $start_parent );
$arbitrary_loop_member = wp_find_hierarchy_loop_tortoise_hare( $callback, $start, $override, $callback_args );
if ( ! $arbitrary_loop_member ) {
return array();
}
return wp_find_hierarchy_loop_tortoise_hare( $callback, $arbitrary_loop_member, $override, $callback_args, true );
}
```
| Uses | Description |
| --- | --- |
| [wp\_find\_hierarchy\_loop\_tortoise\_hare()](wp_find_hierarchy_loop_tortoise_hare) wp-includes/functions.php | Uses the “The Tortoise and the Hare” algorithm to detect loops. |
| Used By | Description |
| --- | --- |
| [wp\_check\_term\_hierarchy\_for\_loops()](wp_check_term_hierarchy_for_loops) wp-includes/taxonomy.php | Checks the given subset of the term hierarchy for hierarchy loops. |
| [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. |
| Version | Description |
| --- | --- |
| [3.1.0](https://developer.wordpress.org/reference/since/3.1.0/) | Introduced. |
wordpress get_default_block_editor_settings(): array get\_default\_block\_editor\_settings(): array
==============================================
Returns the default block editor settings.
array The default 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_default_block_editor_settings() {
// Media settings.
$max_upload_size = wp_max_upload_size();
if ( ! $max_upload_size ) {
$max_upload_size = 0;
}
/** This filter is documented in wp-admin/includes/media.php */
$image_size_names = apply_filters(
'image_size_names_choose',
array(
'thumbnail' => __( 'Thumbnail' ),
'medium' => __( 'Medium' ),
'large' => __( 'Large' ),
'full' => __( 'Full Size' ),
)
);
$available_image_sizes = array();
foreach ( $image_size_names as $image_size_slug => $image_size_name ) {
$available_image_sizes[] = array(
'slug' => $image_size_slug,
'name' => $image_size_name,
);
}
$default_size = get_option( 'image_default_size', 'large' );
$image_default_size = in_array( $default_size, array_keys( $image_size_names ), true ) ? $default_size : 'large';
$image_dimensions = array();
$all_sizes = wp_get_registered_image_subsizes();
foreach ( $available_image_sizes as $size ) {
$key = $size['slug'];
if ( isset( $all_sizes[ $key ] ) ) {
$image_dimensions[ $key ] = $all_sizes[ $key ];
}
}
// These styles are used if the "no theme styles" options is triggered or on
// themes without their own editor styles.
$default_editor_styles_file = ABSPATH . WPINC . '/css/dist/block-editor/default-editor-styles.css';
static $default_editor_styles_file_contents = false;
if ( ! $default_editor_styles_file_contents && file_exists( $default_editor_styles_file ) ) {
$default_editor_styles_file_contents = file_get_contents( $default_editor_styles_file );
}
$default_editor_styles = array();
if ( $default_editor_styles_file_contents ) {
$default_editor_styles = array(
array( 'css' => $default_editor_styles_file_contents ),
);
}
$editor_settings = array(
'alignWide' => get_theme_support( 'align-wide' ),
'allowedBlockTypes' => true,
'allowedMimeTypes' => get_allowed_mime_types(),
'defaultEditorStyles' => $default_editor_styles,
'blockCategories' => get_default_block_categories(),
'disableCustomColors' => get_theme_support( 'disable-custom-colors' ),
'disableCustomFontSizes' => get_theme_support( 'disable-custom-font-sizes' ),
'disableCustomGradients' => get_theme_support( 'disable-custom-gradients' ),
'disableLayoutStyles' => get_theme_support( 'disable-layout-styles' ),
'enableCustomLineHeight' => get_theme_support( 'custom-line-height' ),
'enableCustomSpacing' => get_theme_support( 'custom-spacing' ),
'enableCustomUnits' => get_theme_support( 'custom-units' ),
'isRTL' => is_rtl(),
'imageDefaultSize' => $image_default_size,
'imageDimensions' => $image_dimensions,
'imageEditing' => true,
'imageSizes' => $available_image_sizes,
'maxUploadFileSize' => $max_upload_size,
// The following flag is required to enable the new Gallery block format on the mobile apps in 5.9.
'__unstableGalleryWithImageBlocks' => true,
);
// Theme settings.
$color_palette = current( (array) get_theme_support( 'editor-color-palette' ) );
if ( false !== $color_palette ) {
$editor_settings['colors'] = $color_palette;
}
$font_sizes = current( (array) get_theme_support( 'editor-font-sizes' ) );
if ( false !== $font_sizes ) {
$editor_settings['fontSizes'] = $font_sizes;
}
$gradient_presets = current( (array) get_theme_support( 'editor-gradient-presets' ) );
if ( false !== $gradient_presets ) {
$editor_settings['gradients'] = $gradient_presets;
}
return $editor_settings;
}
```
[apply\_filters( 'image\_size\_names\_choose', string[] $size\_names )](../hooks/image_size_names_choose)
Filters the names and labels of the default image sizes.
| Uses | Description |
| --- | --- |
| [get\_default\_block\_categories()](get_default_block_categories) wp-includes/block-editor.php | Returns the list of default categories for block types. |
| [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. |
| [get\_theme\_support()](get_theme_support) wp-includes/theme.php | Gets the theme support arguments passed when registering that support. |
| [get\_allowed\_mime\_types()](get_allowed_mime_types) wp-includes/functions.php | Retrieves the list of allowed mime types and file extensions. |
| [is\_rtl()](is_rtl) wp-includes/l10n.php | Determines whether the current locale is right-to-left (RTL). |
| [wp\_max\_upload\_size()](wp_max_upload_size) wp-includes/media.php | Determines the maximum upload size allowed in php.ini. |
| [\_\_()](__) 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\_option()](get_option) wp-includes/option.php | Retrieves an option value based on an option name. |
| Used By | Description |
| --- | --- |
| [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. |
| [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 |
| --- | --- |
| [5.8.0](https://developer.wordpress.org/reference/since/5.8.0/) | Introduced. |
wordpress get_page_hierarchy( WP_Post[] $pages, int $page_id ): string[] get\_page\_hierarchy( WP\_Post[] $pages, int $page\_id ): string[]
==================================================================
Orders the pages with children under parents in a flat list.
It uses auxiliary structure to hold parent-children relationships and runs in O(N) complexity
`$pages` [WP\_Post](../classes/wp_post)[] Required Posts array (passed by reference). `$page_id` int Optional Parent page ID. Default 0. string[] Array of post names keyed by ID and arranged by hierarchy. Children immediately follow their parents.
File: `wp-includes/post.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/post.php/)
```
function get_page_hierarchy( &$pages, $page_id = 0 ) {
if ( empty( $pages ) ) {
return array();
}
$children = array();
foreach ( (array) $pages as $p ) {
$parent_id = (int) $p->post_parent;
$children[ $parent_id ][] = $p;
}
$result = array();
_page_traverse_name( $page_id, $children, $result );
return $result;
}
```
| Uses | Description |
| --- | --- |
| [\_page\_traverse\_name()](_page_traverse_name) wp-includes/post.php | Traverses and return all the nested children post names of a root page. |
| Used By | Description |
| --- | --- |
| [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 |
| --- | --- |
| [2.0.0](https://developer.wordpress.org/reference/since/2.0.0/) | Introduced. |
wordpress wp_media_personal_data_exporter( string $email_address, int $page = 1 ): array wp\_media\_personal\_data\_exporter( string $email\_address, int $page = 1 ): array
===================================================================================
Finds and exports attachments associated with an email address.
`$email_address` string Required The attachment owner email address. `$page` int Optional Attachment page. Default: `1`
array An array of personal data.
File: `wp-includes/media.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/media.php/)
```
function wp_media_personal_data_exporter( $email_address, $page = 1 ) {
// Limit us to 50 attachments at a time to avoid timing out.
$number = 50;
$page = (int) $page;
$data_to_export = array();
$user = get_user_by( 'email', $email_address );
if ( false === $user ) {
return array(
'data' => $data_to_export,
'done' => true,
);
}
$post_query = new WP_Query(
array(
'author' => $user->ID,
'posts_per_page' => $number,
'paged' => $page,
'post_type' => 'attachment',
'post_status' => 'any',
'orderby' => 'ID',
'order' => 'ASC',
)
);
foreach ( (array) $post_query->posts as $post ) {
$attachment_url = wp_get_attachment_url( $post->ID );
if ( $attachment_url ) {
$post_data_to_export = array(
array(
'name' => __( 'URL' ),
'value' => $attachment_url,
),
);
$data_to_export[] = array(
'group_id' => 'media',
'group_label' => __( 'Media' ),
'group_description' => __( 'User’s media data.' ),
'item_id' => "post-{$post->ID}",
'data' => $post_data_to_export,
);
}
}
$done = $post_query->max_num_pages <= $page;
return array(
'data' => $data_to_export,
'done' => $done,
);
}
```
| Uses | Description |
| --- | --- |
| [WP\_Query::\_\_construct()](../classes/wp_query/__construct) wp-includes/class-wp-query.php | Constructor. |
| [get\_user\_by()](get_user_by) wp-includes/pluggable.php | Retrieves user info by a given field. |
| [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. |
| Version | Description |
| --- | --- |
| [4.9.6](https://developer.wordpress.org/reference/since/4.9.6/) | Introduced. |
wordpress trackback_url_list( string $tb_list, int $post_id ) trackback\_url\_list( string $tb\_list, int $post\_id )
=======================================================
Does trackbacks for a list of URLs.
`$tb_list` string Required Comma separated list of URLs. `$post_id` int Required Post ID. File: `wp-includes/post.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/post.php/)
```
function trackback_url_list( $tb_list, $post_id ) {
if ( ! empty( $tb_list ) ) {
// Get post data.
$postdata = get_post( $post_id, ARRAY_A );
// Form an excerpt.
$excerpt = strip_tags( $postdata['post_excerpt'] ? $postdata['post_excerpt'] : $postdata['post_content'] );
if ( strlen( $excerpt ) > 255 ) {
$excerpt = substr( $excerpt, 0, 252 ) . '…';
}
$trackback_urls = explode( ',', $tb_list );
foreach ( (array) $trackback_urls as $tb_url ) {
$tb_url = trim( $tb_url );
trackback( $tb_url, wp_unslash( $postdata['post_title'] ), $excerpt, $post_id );
}
}
}
```
| Uses | Description |
| --- | --- |
| [trackback()](trackback) wp-includes/comment.php | Sends a Trackback. |
| [wp\_unslash()](wp_unslash) wp-includes/formatting.php | Removes slashes from a string or recursively removes slashes from strings within an array. |
| [get\_post()](get_post) wp-includes/post.php | Retrieves post data given a post ID or post object. |
| Version | Description |
| --- | --- |
| [1.0.0](https://developer.wordpress.org/reference/since/1.0.0/) | Introduced. |
wordpress wp_cache_get_multiple( array $keys, string $group = '', bool $force = false ): array wp\_cache\_get\_multiple( array $keys, string $group = '', bool $force = false ): array
=======================================================================================
Retrieves multiple values from the cache in one call.
* [WP\_Object\_Cache::get\_multiple()](../classes/wp_object_cache/get_multiple)
`$keys` array Required Array of keys 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`
array Array of return values, grouped by key. Each value is either the cache contents on success, or false on failure.
File: `wp-includes/cache.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/cache.php/)
```
function wp_cache_get_multiple( $keys, $group = '', $force = false ) {
global $wp_object_cache;
return $wp_object_cache->get_multiple( $keys, $group, $force );
}
```
| Uses | Description |
| --- | --- |
| [WP\_Object\_Cache::get\_multiple()](../classes/wp_object_cache/get_multiple) wp-includes/class-wp-object-cache.php | Retrieves multiple values from the cache in one call. |
| Used By | Description |
| --- | --- |
| [\_get\_non\_cached\_ids()](_get_non_cached_ids) wp-includes/functions.php | Retrieves IDs that are not already present in the cache. |
| [update\_object\_term\_cache()](update_object_term_cache) wp-includes/taxonomy.php | Updates the cache for the given term object ID(s). |
| [update\_meta\_cache()](update_meta_cache) wp-includes/meta.php | Updates the metadata cache for the specified objects. |
| Version | Description |
| --- | --- |
| [5.5.0](https://developer.wordpress.org/reference/since/5.5.0/) | Introduced. |
wordpress body_class( string|string[] $class = '' ) body\_class( string|string[] $class = '' )
==========================================
Displays the class names for the body element.
`$class` string|string[] Optional Space-separated string or array of class names to add to the class list. Default: `''`
This function gives the body element different classes and can be added, typically, in the header.php’s HTML body tag.
**Basic Usage**
The following example shows how to implement the body\_class template tag into a theme.
```
<body <?php body_class(); ?>>
```
The actual HTML output might resemble something like this (the About the Tests page from the Theme Unit Test):
[html]
<body class="page page-id-2 page-parent page-template-default logged-in">
[/html]
In the WordPress Theme stylesheet, add the appropriate styles, such as:
```
.page {
/* styles for all posts within the page class */
}
.page-id-2 {
/* styles for only page ID number 2 */
}
.logged-in {
/* styles for all pageviews when the user is logged in */
}
```
File: `wp-includes/post-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/post-template.php/)
```
function body_class( $class = '' ) {
// Separates class names with a single space, collates class names for body element.
echo 'class="' . esc_attr( implode( ' ', get_body_class( $class ) ) ) . '"';
}
```
| Uses | Description |
| --- | --- |
| [get\_body\_class()](get_body_class) wp-includes/post-template.php | Retrieves an array of the class names for the body element. |
| [esc\_attr()](esc_attr) wp-includes/formatting.php | Escaping for HTML attributes. |
| Used By | Description |
| --- | --- |
| [WP\_REST\_Widget\_Types\_Controller::render\_legacy\_widget\_preview\_iframe()](../classes/wp_rest_widget_types_controller/render_legacy_widget_preview_iframe) wp-includes/rest-api/endpoints/class-wp-rest-widget-types-controller.php | Renders a page containing a preview of the requested Legacy Widget block. |
| Version | Description |
| --- | --- |
| [2.8.0](https://developer.wordpress.org/reference/since/2.8.0/) | Introduced. |
wordpress fix_import_form_size( int $size ): int fix\_import\_form\_size( int $size ): int
=========================================
Get the remaining upload space for this site.
`$size` int Required Current max size in bytes int Max size in bytes
File: `wp-admin/includes/ms.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/ms.php/)
```
function fix_import_form_size( $size ) {
if ( upload_is_user_over_quota( false ) ) {
return 0;
}
$available = get_upload_space_available();
return min( $size, $available );
}
```
| Uses | Description |
| --- | --- |
| [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. |
| [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. |
| Version | Description |
| --- | --- |
| [MU (3.0.0)](https://developer.wordpress.org/reference/since/mu.3.0.0/) | Introduced. |
| programming_docs |
wordpress list_meta( array $meta ) list\_meta( array $meta )
=========================
Outputs a post’s public meta data in the Custom Fields meta box.
`$meta` array Required File: `wp-admin/includes/template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/template.php/)
```
function list_meta( $meta ) {
// Exit if no meta.
if ( ! $meta ) {
echo '
<table id="list-table" style="display: none;">
<thead>
<tr>
<th class="left">' . _x( 'Name', 'meta name' ) . '</th>
<th>' . __( 'Value' ) . '</th>
</tr>
</thead>
<tbody id="the-list" data-wp-lists="list:meta">
<tr><td></td></tr>
</tbody>
</table>'; // TBODY needed for list-manipulation JS.
return;
}
$count = 0;
?>
<table id="list-table">
<thead>
<tr>
<th class="left"><?php _ex( 'Name', 'meta name' ); ?></th>
<th><?php _e( 'Value' ); ?></th>
</tr>
</thead>
<tbody id='the-list' data-wp-lists='list:meta'>
<?php
foreach ( $meta as $entry ) {
echo _list_meta_row( $entry, $count );
}
?>
</tbody>
</table>
<?php
}
```
| Uses | Description |
| --- | --- |
| [\_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. |
| [\_ex()](_ex) wp-includes/l10n.php | Displays translated string with gettext context. |
| [\_x()](_x) wp-includes/l10n.php | Retrieves translated string with gettext context. |
| [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. |
| [\_e()](_e) wp-includes/l10n.php | Displays translated text. |
| Used By | Description |
| --- | --- |
| [post\_custom\_meta\_box()](post_custom_meta_box) wp-admin/includes/meta-boxes.php | Displays custom fields form fields. |
| Version | Description |
| --- | --- |
| [1.2.0](https://developer.wordpress.org/reference/since/1.2.0/) | Introduced. |
wordpress wp_post_preview_js() wp\_post\_preview\_js()
=======================
Outputs a small JS snippet on preview tabs/windows to remove `window.name` on unload.
This prevents reusing the same tab for a preview when the user has navigated away.
File: `wp-includes/functions.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/functions.php/)
```
function wp_post_preview_js() {
global $post;
if ( ! is_preview() || empty( $post ) ) {
return;
}
// Has to match the window name used in post_submit_meta_box().
$name = 'wp-preview-' . (int) $post->ID;
?>
<script>
( function() {
var query = document.location.search;
if ( query && query.indexOf( 'preview=true' ) !== -1 ) {
window.name = '<?php echo $name; ?>';
}
if ( window.addEventListener ) {
window.addEventListener( 'unload', function() { window.name = ''; }, false );
}
}());
</script>
<?php
}
```
| Uses | Description |
| --- | --- |
| [is\_preview()](is_preview) wp-includes/query.php | Determines whether the query is for a post or page preview. |
| Version | Description |
| --- | --- |
| [4.3.0](https://developer.wordpress.org/reference/since/4.3.0/) | Introduced. |
wordpress add_meta_box( string $id, string $title, callable $callback, string|array|WP_Screen $screen = null, string $context = 'advanced', string $priority = 'default', array $callback_args = null ) add\_meta\_box( string $id, string $title, callable $callback, string|array|WP\_Screen $screen = null, string $context = 'advanced', string $priority = 'default', array $callback\_args = null )
=================================================================================================================================================================================================
Adds a meta box to one or more screens.
`$id` string Required Meta box ID (used in the `'id'` attribute for the meta box). `$title` string Required Title of the meta box. `$callback` callable Required Function that fills the box with the desired content.
The function should echo its output. `$screen` string|array|[WP\_Screen](../classes/wp_screen) Optional The screen or screens on which to show the box (such as a post type, `'link'`, or `'comment'`). Accepts a single screen ID, [WP\_Screen](../classes/wp_screen) object, or array of screen IDs. Default is the current screen. 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. Default: `null`
`$context` string Optional The context within the screen where the box should display. Available contexts vary from screen to screen. Post edit screen contexts include `'normal'`, `'side'`, and `'advanced'`. Comments screen contexts include `'normal'` and `'side'`. Menus meta boxes (accordion sections) all use the `'side'` context. Global default is `'advanced'`. Default: `'advanced'`
`$priority` string Optional The priority within the context where the box should show.
Accepts `'high'`, `'core'`, `'default'`, or `'low'`. Default `'default'`. Default: `'default'`
`$callback_args` array Optional Data that should be set as the $args property of the box array (which is the second parameter passed to your callback). Default: `null`
File: `wp-admin/includes/template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/template.php/)
```
function add_meta_box( $id, $title, $callback, $screen = null, $context = 'advanced', $priority = 'default', $callback_args = null ) {
global $wp_meta_boxes;
if ( empty( $screen ) ) {
$screen = get_current_screen();
} elseif ( is_string( $screen ) ) {
$screen = convert_to_screen( $screen );
} elseif ( is_array( $screen ) ) {
foreach ( $screen as $single_screen ) {
add_meta_box( $id, $title, $callback, $single_screen, $context, $priority, $callback_args );
}
}
if ( ! isset( $screen->id ) ) {
return;
}
$page = $screen->id;
if ( ! isset( $wp_meta_boxes ) ) {
$wp_meta_boxes = array();
}
if ( ! isset( $wp_meta_boxes[ $page ] ) ) {
$wp_meta_boxes[ $page ] = array();
}
if ( ! isset( $wp_meta_boxes[ $page ][ $context ] ) ) {
$wp_meta_boxes[ $page ][ $context ] = array();
}
foreach ( array_keys( $wp_meta_boxes[ $page ] ) as $a_context ) {
foreach ( array( 'high', 'core', 'default', 'low' ) as $a_priority ) {
if ( ! isset( $wp_meta_boxes[ $page ][ $a_context ][ $a_priority ][ $id ] ) ) {
continue;
}
// If a core box was previously removed, don't add.
if ( ( 'core' === $priority || 'sorted' === $priority )
&& false === $wp_meta_boxes[ $page ][ $a_context ][ $a_priority ][ $id ]
) {
return;
}
// If a core box was previously added by a plugin, don't add.
if ( 'core' === $priority ) {
/*
* If the box was added with default priority, give it core priority
* to maintain sort order.
*/
if ( 'default' === $a_priority ) {
$wp_meta_boxes[ $page ][ $a_context ]['core'][ $id ] = $wp_meta_boxes[ $page ][ $a_context ]['default'][ $id ];
unset( $wp_meta_boxes[ $page ][ $a_context ]['default'][ $id ] );
}
return;
}
// If no priority given and ID already present, use existing priority.
if ( empty( $priority ) ) {
$priority = $a_priority;
/*
* Else, if we're adding to the sorted priority, we don't know the title
* or callback. Grab them from the previously added context/priority.
*/
} elseif ( 'sorted' === $priority ) {
$title = $wp_meta_boxes[ $page ][ $a_context ][ $a_priority ][ $id ]['title'];
$callback = $wp_meta_boxes[ $page ][ $a_context ][ $a_priority ][ $id ]['callback'];
$callback_args = $wp_meta_boxes[ $page ][ $a_context ][ $a_priority ][ $id ]['args'];
}
// An ID can be in only one priority and one context.
if ( $priority !== $a_priority || $context !== $a_context ) {
unset( $wp_meta_boxes[ $page ][ $a_context ][ $a_priority ][ $id ] );
}
}
}
if ( empty( $priority ) ) {
$priority = 'low';
}
if ( ! isset( $wp_meta_boxes[ $page ][ $context ][ $priority ] ) ) {
$wp_meta_boxes[ $page ][ $context ][ $priority ] = array();
}
$wp_meta_boxes[ $page ][ $context ][ $priority ][ $id ] = array(
'id' => $id,
'title' => $title,
'callback' => $callback,
'args' => $callback_args,
);
}
```
| 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. |
| [add\_meta\_box()](add_meta_box) wp-admin/includes/template.php | Adds a meta box to one or more screens. |
| 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\_add\_dashboard\_widget()](wp_add_dashboard_widget) wp-admin/includes/dashboard.php | Adds a new dashboard widget. |
| [add\_meta\_box()](add_meta_box) wp-admin/includes/template.php | Adds a meta box to one or more screens. |
| [do\_meta\_boxes()](do_meta_boxes) wp-admin/includes/template.php | Meta-Box template function. |
| [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\_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. |
| Version | Description |
| --- | --- |
| [4.4.0](https://developer.wordpress.org/reference/since/4.4.0/) | The `$screen` parameter now accepts an array of screen IDs. |
| [2.5.0](https://developer.wordpress.org/reference/since/2.5.0/) | Introduced. |
wordpress wp_handle_sideload( array $file, array|false $overrides = false, string $time = null ): array wp\_handle\_sideload( array $file, array|false $overrides = false, string $time = null ): array
===============================================================================================
Wrapper for [\_wp\_handle\_upload()](_wp_handle_upload) .
Passes the [‘wp\_handle\_sideload’](../hooks/wp_handle_sideload) 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_sideload( &$file, $overrides = false, $time = null ) {
/*
* $_POST['action'] must be set and its value must equal $overrides['action']
* or this:
*/
$action = 'wp_handle_sideload';
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\_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. |
| [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) . |
| Version | Description |
| --- | --- |
| [2.6.0](https://developer.wordpress.org/reference/since/2.6.0/) | Introduced. |
wordpress wp_ajax_update_theme() wp\_ajax\_update\_theme()
=========================
Ajax handler for updating a theme.
* [Theme\_Upgrader](../classes/theme_upgrader)
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_update_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(
'update' => 'theme',
'slug' => $stylesheet,
'oldVersion' => '',
'newVersion' => '',
);
if ( ! current_user_can( 'update_themes' ) ) {
$status['errorMessage'] = __( 'Sorry, you are not allowed to update themes for this site.' );
wp_send_json_error( $status );
}
$theme = wp_get_theme( $stylesheet );
if ( $theme->exists() ) {
$status['oldVersion'] = $theme->get( 'Version' );
}
require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
$current = get_site_transient( 'update_themes' );
if ( empty( $current ) ) {
wp_update_themes();
}
$skin = new WP_Ajax_Upgrader_Skin();
$upgrader = new Theme_Upgrader( $skin );
$result = $upgrader->bulk_upgrade( array( $stylesheet ) );
if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) {
$status['debug'] = $skin->get_upgrade_messages();
}
if ( is_wp_error( $skin->result ) ) {
$status['errorCode'] = $skin->result->get_error_code();
$status['errorMessage'] = $skin->result->get_error_message();
wp_send_json_error( $status );
} elseif ( $skin->get_errors()->has_errors() ) {
$status['errorMessage'] = $skin->get_error_messages();
wp_send_json_error( $status );
} elseif ( is_array( $result ) && ! empty( $result[ $stylesheet ] ) ) {
// Theme is already at the latest version.
if ( true === $result[ $stylesheet ] ) {
$status['errorMessage'] = $upgrader->strings['up_to_date'];
wp_send_json_error( $status );
}
$theme = wp_get_theme( $stylesheet );
if ( $theme->exists() ) {
$status['newVersion'] = $theme->get( 'Version' );
}
wp_send_json_success( $status );
} elseif ( false === $result ) {
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 );
}
// An unhandled error occurred.
$status['errorMessage'] = __( 'Theme update failed.' );
wp_send_json_error( $status );
}
```
| Uses | Description |
| --- | --- |
| [WP\_Ajax\_Upgrader\_Skin::\_\_construct()](../classes/wp_ajax_upgrader_skin/__construct) wp-admin/includes/class-wp-ajax-upgrader-skin.php | Constructor. |
| [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. |
| [get\_site\_transient()](get_site_transient) wp-includes/option.php | Retrieves the value of a site transient. |
| [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. |
| [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 the_attachment_link( int|WP_Post $post, bool $fullsize = false, bool $deprecated = false, bool $permalink = false ) the\_attachment\_link( int|WP\_Post $post, bool $fullsize = false, bool $deprecated = false, bool $permalink = false )
======================================================================================================================
Displays an attachment page link using an image or icon.
`$post` int|[WP\_Post](../classes/wp_post) Optional Post ID or post object. `$fullsize` bool Optional Whether to use full size. Default: `false`
`$deprecated` bool Optional Deprecated. Not used. Default: `false`
`$permalink` bool Optional Whether to include permalink. Default: `false`
Outputs an HTML hyperlink to an [attachment](https://wordpress.org/support/article/using-image-and-file-attachments/ "Using Image and File Attachments") file or page, containing either
1. A full-size image or thumbnail for image attachments; or
2. The attachment’s title (as text) for non-image attachments
If no attachment can be found, the function displays the string Missing Attachment.
Use [wp\_get\_attachment\_link()](wp_get_attachment_link) instead if you just want to get the hyperlink, not print it.
File: `wp-includes/post-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/post-template.php/)
```
function the_attachment_link( $post = 0, $fullsize = false, $deprecated = false, $permalink = false ) {
if ( ! empty( $deprecated ) ) {
_deprecated_argument( __FUNCTION__, '2.5.0' );
}
if ( $fullsize ) {
echo wp_get_attachment_link( $post, 'full', $permalink );
} else {
echo wp_get_attachment_link( $post, 'thumbnail', $permalink );
}
}
```
| Uses | Description |
| --- | --- |
| [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. |
| [\_deprecated\_argument()](_deprecated_argument) wp-includes/functions.php | Marks a function argument as deprecated and inform when it has been used. |
| Version | Description |
| --- | --- |
| [2.0.0](https://developer.wordpress.org/reference/since/2.0.0/) | Introduced. |
| programming_docs |
wordpress wp_skip_spacing_serialization( WP_Block_Type $block_type ): bool wp\_skip\_spacing\_serialization( WP\_Block\_Type $block\_type ): bool
======================================================================
This function has been deprecated. Use [wp\_should\_skip\_block\_supports\_serialization()](wp_should_skip_block_supports_serialization) 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 [wp\_should\_skip\_block\_supports\_serialization()](wp_should_skip_block_supports_serialization) instead.
Checks whether serialization of the current block’s spacing properties should occur.
* [wp\_should\_skip\_block\_supports\_serialization()](wp_should_skip_block_supports_serialization)
`$block_type` [WP\_Block\_Type](../classes/wp_block_type) Required Block type. bool Whether to serialize spacing support styles & classes.
File: `wp-includes/deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/deprecated.php/)
```
function wp_skip_spacing_serialization( $block_type ) {
_deprecated_function( __FUNCTION__, '6.0.0', 'wp_should_skip_block_supports_serialization()' );
$spacing_support = _wp_array_get( $block_type->supports, array( 'spacing' ), false );
return is_array( $spacing_support ) &&
array_key_exists( '__experimentalSkipSerialization', $spacing_support ) &&
$spacing_support['__experimentalSkipSerialization'];
}
```
| Uses | Description |
| --- | --- |
| [\_wp\_array\_get()](_wp_array_get) wp-includes/functions.php | Accesses an array in depth based on a path of keys. |
| [\_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/) | Use wp\_should\_skip\_block\_supports\_serialization() introduced in 6.0.0. |
| [5.9.0](https://developer.wordpress.org/reference/since/5.9.0/) | Introduced. |
wordpress get_delete_post_link( int|WP_Post $post, string $deprecated = '', bool $force_delete = false ): string|void get\_delete\_post\_link( int|WP\_Post $post, string $deprecated = '', bool $force\_delete = false ): string|void
================================================================================================================
Retrieves the delete posts link for post.
Can be used within the WordPress loop or outside of it, with any post type.
`$post` int|[WP\_Post](../classes/wp_post) Optional Post ID or post object. Default is the global `$post`. `$deprecated` string Optional Not used. Default: `''`
`$force_delete` bool Optional Whether to bypass Trash and force deletion. Default: `false`
string|void The delete post link URL for the given post.
File: `wp-includes/link-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/link-template.php/)
```
function get_delete_post_link( $post = 0, $deprecated = '', $force_delete = false ) {
if ( ! empty( $deprecated ) ) {
_deprecated_argument( __FUNCTION__, '3.0.0' );
}
$post = get_post( $post );
if ( ! $post ) {
return;
}
$post_type_object = get_post_type_object( $post->post_type );
if ( ! $post_type_object ) {
return;
}
if ( ! current_user_can( 'delete_post', $post->ID ) ) {
return;
}
$action = ( $force_delete || ! EMPTY_TRASH_DAYS ) ? 'delete' : 'trash';
$delete_link = add_query_arg( 'action', $action, admin_url( sprintf( $post_type_object->_edit_link, $post->ID ) ) );
/**
* Filters the post delete link.
*
* @since 2.9.0
*
* @param string $link The delete link.
* @param int $post_id Post ID.
* @param bool $force_delete Whether to bypass the Trash and force deletion. Default false.
*/
return apply_filters( 'get_delete_post_link', wp_nonce_url( $delete_link, "$action-post_{$post->ID}" ), $post->ID, $force_delete );
}
```
[apply\_filters( 'get\_delete\_post\_link', string $link, int $post\_id, bool $force\_delete )](../hooks/get_delete_post_link)
Filters the post delete link.
| Uses | Description |
| --- | --- |
| [current\_user\_can()](current_user_can) wp-includes/capabilities.php | Returns whether the current user has the specified capability. |
| [\_deprecated\_argument()](_deprecated_argument) wp-includes/functions.php | Marks a function argument as deprecated and inform when it has been used. |
| [wp\_nonce\_url()](wp_nonce_url) wp-includes/functions.php | Retrieves URL with nonce added to URL query. |
| [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. |
| [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\_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. |
| [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. |
| Version | Description |
| --- | --- |
| [2.9.0](https://developer.wordpress.org/reference/since/2.9.0/) | Introduced. |
wordpress validate_active_plugins(): WP_Error[] validate\_active\_plugins(): WP\_Error[]
========================================
Validates active plugins.
Validate all active plugins, deactivates invalid and returns an array of deactivated ones.
[WP\_Error](../classes/wp_error)[] Array of plugin errors keyed by plugin file name.
File: `wp-admin/includes/plugin.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/plugin.php/)
```
function validate_active_plugins() {
$plugins = get_option( 'active_plugins', array() );
// Validate vartype: array.
if ( ! is_array( $plugins ) ) {
update_option( 'active_plugins', array() );
$plugins = array();
}
if ( is_multisite() && current_user_can( 'manage_network_plugins' ) ) {
$network_plugins = (array) get_site_option( 'active_sitewide_plugins', array() );
$plugins = array_merge( $plugins, array_keys( $network_plugins ) );
}
if ( empty( $plugins ) ) {
return array();
}
$invalid = array();
// Invalid plugins get deactivated.
foreach ( $plugins as $plugin ) {
$result = validate_plugin( $plugin );
if ( is_wp_error( $result ) ) {
$invalid[ $plugin ] = $result;
deactivate_plugins( $plugin, true );
}
}
return $invalid;
}
```
| Uses | Description |
| --- | --- |
| [validate\_plugin()](validate_plugin) wp-admin/includes/plugin.php | Validates the plugin path. |
| [deactivate\_plugins()](deactivate_plugins) wp-admin/includes/plugin.php | Deactivates a single plugin or multiple plugins. |
| [current\_user\_can()](current_user_can) wp-includes/capabilities.php | Returns whether the current user has the specified capability. |
| [is\_multisite()](is_multisite) wp-includes/load.php | If Multisite is enabled. |
| [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. |
| [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 get_attachment_fields_to_edit( WP_Post $post, array $errors = null ): array get\_attachment\_fields\_to\_edit( WP\_Post $post, array $errors = null ): array
================================================================================
Retrieves the attachment fields to edit form fields.
`$post` [WP\_Post](../classes/wp_post) Required `$errors` 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_attachment_fields_to_edit( $post, $errors = null ) {
if ( is_int( $post ) ) {
$post = get_post( $post );
}
if ( is_array( $post ) ) {
$post = new WP_Post( (object) $post );
}
$image_url = wp_get_attachment_url( $post->ID );
$edit_post = sanitize_post( $post, 'edit' );
$form_fields = array(
'post_title' => array(
'label' => __( 'Title' ),
'value' => $edit_post->post_title,
),
'image_alt' => array(),
'post_excerpt' => array(
'label' => __( 'Caption' ),
'input' => 'html',
'html' => wp_caption_input_textarea( $edit_post ),
),
'post_content' => array(
'label' => __( 'Description' ),
'value' => $edit_post->post_content,
'input' => 'textarea',
),
'url' => array(
'label' => __( 'Link URL' ),
'input' => 'html',
'html' => image_link_input_fields( $post, get_option( 'image_default_link_type' ) ),
'helps' => __( 'Enter a link URL or click above for presets.' ),
),
'menu_order' => array(
'label' => __( 'Order' ),
'value' => $edit_post->menu_order,
),
'image_url' => array(
'label' => __( 'File URL' ),
'input' => 'html',
'html' => "<input type='text' class='text urlfield' readonly='readonly' name='attachments[$post->ID][url]' value='" . esc_attr( $image_url ) . "' /><br />",
'value' => wp_get_attachment_url( $post->ID ),
'helps' => __( 'Location of the uploaded file.' ),
),
);
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 );
$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) $errors );
// This was formerly in image_attachment_fields_to_edit().
if ( 'image' === substr( $post->post_mime_type, 0, 5 ) ) {
$alt = get_post_meta( $post->ID, '_wp_attachment_image_alt', true );
if ( empty( $alt ) ) {
$alt = '';
}
$form_fields['post_title']['required'] = true;
$form_fields['image_alt'] = array(
'value' => $alt,
'label' => __( 'Alternative Text' ),
'helps' => __( 'Alt text for the image, e.g. “The Mona Lisa”' ),
);
$form_fields['align'] = array(
'label' => __( 'Alignment' ),
'input' => 'html',
'html' => image_align_input_fields( $post, get_option( 'image_default_align' ) ),
);
$form_fields['image-size'] = image_size_input_fields( $post, get_option( 'image_default_size', 'medium' ) );
} else {
unset( $form_fields['image_alt'] );
}
/**
* Filters the attachment fields to edit.
*
* @since 2.5.0
*
* @param array $form_fields An array of attachment form fields.
* @param WP_Post $post The WP_Post attachment object.
*/
$form_fields = apply_filters( 'attachment_fields_to_edit', $form_fields, $post );
return $form_fields;
}
```
[apply\_filters( 'attachment\_fields\_to\_edit', array $form\_fields, WP\_Post $post )](../hooks/attachment_fields_to_edit)
Filters the attachment fields to edit.
| Uses | Description |
| --- | --- |
| [wp\_caption\_input\_textarea()](wp_caption_input_textarea) wp-admin/includes/media.php | Outputs a textarea element for inputting an attachment caption. |
| [get\_attachment\_taxonomies()](get_attachment_taxonomies) wp-includes/media.php | Retrieves taxonomies attached to given the attachment. |
| [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. |
| [sanitize\_post()](sanitize_post) wp-includes/post.php | Sanitizes every post field. |
| [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. |
| [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. |
| [wp\_get\_attachment\_url()](wp_get_attachment_url) wp-includes/post.php | Retrieves the URL for an attachment. |
| [WP\_Post::\_\_construct()](../classes/wp_post/__construct) wp-includes/class-wp-post.php | Constructor. |
| [get\_post\_meta()](get_post_meta) wp-includes/post.php | Retrieves a post meta field for the given post ID. |
| [get\_taxonomy()](get_taxonomy) wp-includes/taxonomy.php | Retrieves the taxonomy object of $taxonomy. |
| [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. |
| [esc\_attr()](esc_attr) wp-includes/formatting.php | Escaping for HTML attributes. |
| [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. |
| [get\_post()](get_post) wp-includes/post.php | Retrieves post data given a post ID or post object. |
| Used By | Description |
| --- | --- |
| [get\_media\_item()](get_media_item) wp-admin/includes/media.php | Retrieves HTML form for modifying the image attachment. |
| Version | Description |
| --- | --- |
| [2.5.0](https://developer.wordpress.org/reference/since/2.5.0/) | Introduced. |
wordpress wp_get_active_network_plugins(): string[] wp\_get\_active\_network\_plugins(): 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 array of network plugin files to be included in global scope.
The default directory is wp-content/plugins. To change the default directory manually, define `WP_PLUGIN_DIR` and `WP_PLUGIN_URL` in `wp-config.php`.
string[] Array of absolute paths to files to include.
File: `wp-includes/ms-load.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/ms-load.php/)
```
function wp_get_active_network_plugins() {
$active_plugins = (array) get_site_option( 'active_sitewide_plugins', array() );
if ( empty( $active_plugins ) ) {
return array();
}
$plugins = array();
$active_plugins = array_keys( $active_plugins );
sort( $active_plugins );
foreach ( $active_plugins as $plugin ) {
if ( ! validate_file( $plugin ) // $plugin must validate as file.
&& '.php' === substr( $plugin, -4 ) // $plugin must end with '.php'.
&& file_exists( WP_PLUGIN_DIR . '/' . $plugin ) // $plugin must exist.
) {
$plugins[] = WP_PLUGIN_DIR . '/' . $plugin;
}
}
return $plugins;
}
```
| Uses | Description |
| --- | --- |
| [validate\_file()](validate_file) wp-includes/functions.php | Validates a file name and path against an allowed set of rules. |
| [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\_Recovery\_Mode::is\_network\_plugin()](../classes/wp_recovery_mode/is_network_plugin) wp-includes/class-wp-recovery-mode.php | Checks whether the given extension a network activated plugin. |
| [wp\_get\_active\_and\_valid\_plugins()](wp_get_active_and_valid_plugins) wp-includes/load.php | Retrieve an array of active and valid plugin files. |
| Version | Description |
| --- | --- |
| [3.1.0](https://developer.wordpress.org/reference/since/3.1.0/) | Introduced. |
wordpress url_shorten( string $url, int $length = 35 ): string url\_shorten( string $url, int $length = 35 ): string
=====================================================
Shortens a URL, to be used as link text.
`$url` string Required URL to shorten. `$length` int Optional Maximum length of the shortened URL. Default 35 characters. Default: `35`
string Shortened URL.
File: `wp-includes/formatting.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/formatting.php/)
```
function url_shorten( $url, $length = 35 ) {
$stripped = str_replace( array( 'https://', 'http://', 'www.' ), '', $url );
$short_url = untrailingslashit( $stripped );
if ( strlen( $short_url ) > $length ) {
$short_url = substr( $short_url, 0, $length - 3 ) . '…';
}
return $short_url;
}
```
| Uses | Description |
| --- | --- |
| [untrailingslashit()](untrailingslashit) wp-includes/formatting.php | Removes trailing forward slashes and backslashes if they exist. |
| Used By | Description |
| --- | --- |
| [WP\_Links\_List\_Table::column\_url()](../classes/wp_links_list_table/column_url) wp-admin/includes/class-wp-links-list-table.php | Handles the link URL column output. |
| Version | Description |
| --- | --- |
| [4.4.0](https://developer.wordpress.org/reference/since/4.4.0/) | Moved to wp-includes/formatting.php from wp-admin/includes/misc.php and added $length param. |
| [1.2.0](https://developer.wordpress.org/reference/since/1.2.0/) | Introduced. |
wordpress next_post( string $format = '%', string $next = 'next post: ', string $title = 'yes', string $in_same_cat = 'no', int $limitnext = 1, string $excluded_categories = '' ) next\_post( string $format = '%', string $next = 'next post: ', string $title = 'yes', string $in\_same\_cat = 'no', int $limitnext = 1, string $excluded\_categories = '' )
============================================================================================================================================================================
This function has been deprecated. Use [next\_post\_link()](next_post_link) instead.
Prints link to the next post.
* [next\_post\_link()](next_post_link)
`$format` string Optional Default: `'%'`
`$next` string Optional Default: `'next post: '`
`$title` string Optional Default: `'yes'`
`$in_same_cat` string Optional Default: `'no'`
`$limitnext` 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 next_post($format='%', $next='next post: ', $title='yes', $in_same_cat='no', $limitnext=1, $excluded_categories='') {
_deprecated_function( __FUNCTION__, '2.0.0', 'next_post_link()' );
if ( empty($in_same_cat) || 'no' == $in_same_cat )
$in_same_cat = false;
else
$in_same_cat = true;
$post = get_next_post($in_same_cat, $excluded_categories);
if ( !$post )
return;
$string = '<a href="'.get_permalink($post->ID).'">'.$next;
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\_next\_post()](get_next_post) wp-includes/link-template.php | Retrieves the next 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 [next\_post\_link()](next_post_link) |
| [0.71](https://developer.wordpress.org/reference/since/0.71/) | Introduced. |
| programming_docs |
wordpress get_comments_number_text( string $zero = false, string $one = false, string $more = false, int|WP_Post $post ): string get\_comments\_number\_text( string $zero = false, string $one = false, string $more = false, int|WP\_Post $post ): string
==========================================================================================================================
Displays the language string for the number of comments the current post has.
`$zero` string Optional Text for no comments. Default: `false`
`$one` string Optional Text for one comment. Default: `false`
`$more` string Optional Text for more than one comment. Default: `false`
`$post` int|[WP\_Post](../classes/wp_post) Optional Post ID or [WP\_Post](../classes/wp_post) object. Default is the global `$post`. string Language string for the number of comments a post has.
File: `wp-includes/comment-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/comment-template.php/)
```
function get_comments_number_text( $zero = false, $one = false, $more = false, $post = 0 ) {
$number = get_comments_number( $post );
if ( $number > 1 ) {
if ( false === $more ) {
/* translators: %s: Number of comments. */
$output = sprintf( _n( '%s Comment', '%s Comments', $number ), number_format_i18n( $number ) );
} else {
// % Comments
/*
* translators: If comment number in your language requires declension,
* translate this to 'on'. Do not translate into your own language.
*/
if ( 'on' === _x( 'off', 'Comment number declension: on or off' ) ) {
$text = preg_replace( '#<span class="screen-reader-text">.+?</span>#', '', $more );
$text = preg_replace( '/&.+?;/', '', $text ); // Kill entities.
$text = trim( strip_tags( $text ), '% ' );
// Replace '% Comments' with a proper plural form.
if ( $text && ! preg_match( '/[0-9]+/', $text ) && false !== strpos( $more, '%' ) ) {
/* translators: %s: Number of comments. */
$new_text = _n( '%s Comment', '%s Comments', $number );
$new_text = trim( sprintf( $new_text, '' ) );
$more = str_replace( $text, $new_text, $more );
if ( false === strpos( $more, '%' ) ) {
$more = '% ' . $more;
}
}
}
$output = str_replace( '%', number_format_i18n( $number ), $more );
}
} elseif ( 0 == $number ) {
$output = ( false === $zero ) ? __( 'No Comments' ) : $zero;
} else { // Must be one.
$output = ( false === $one ) ? __( '1 Comment' ) : $one;
}
/**
* Filters the comments count for display.
*
* @since 1.5.0
*
* @see _n()
*
* @param string $output A translatable string formatted based on whether the count
* is equal to 0, 1, or 1+.
* @param int $number The number of post comments.
*/
return apply_filters( 'comments_number', $output, $number );
}
```
[apply\_filters( 'comments\_number', string $output, int $number )](../hooks/comments_number)
Filters the comments count for display.
| Uses | Description |
| --- | --- |
| [\_n()](_n) wp-includes/l10n.php | Translates and retrieves the singular or plural form based on the supplied number. |
| [get\_comments\_number()](get_comments_number) wp-includes/comment-template.php | Retrieves the amount of comments a post has. |
| [\_x()](_x) wp-includes/l10n.php | Retrieves translated string with gettext context. |
| [\_\_()](__) 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. |
| Used By | Description |
| --- | --- |
| [comments\_number()](comments_number) wp-includes/comment-template.php | Displays the language string for the number of comments the current post has. |
| Version | Description |
| --- | --- |
| [5.4.0](https://developer.wordpress.org/reference/since/5.4.0/) | Added the `$post` parameter to allow using the function outside of the loop. |
| [4.0.0](https://developer.wordpress.org/reference/since/4.0.0/) | Introduced. |
wordpress wp_ajax_delete_inactive_widgets() wp\_ajax\_delete\_inactive\_widgets()
=====================================
Ajax handler for removing inactive 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_delete_inactive_widgets() {
check_ajax_referer( 'remove-inactive-widgets', 'removeinactivewidgets' );
if ( ! current_user_can( 'edit_theme_options' ) ) {
wp_die( -1 );
}
unset( $_POST['removeinactivewidgets'], $_POST['action'] );
/** This action is documented in wp-admin/includes/ajax-actions.php */
do_action( 'load-widgets.php' ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
/** This action is documented in wp-admin/includes/ajax-actions.php */
do_action( 'widgets.php' ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
/** This action is documented in wp-admin/widgets.php */
do_action( 'sidebar_admin_setup' );
$sidebars_widgets = wp_get_sidebars_widgets();
foreach ( $sidebars_widgets['wp_inactive_widgets'] as $key => $widget_id ) {
$pieces = explode( '-', $widget_id );
$multi_number = array_pop( $pieces );
$id_base = implode( '-', $pieces );
$widget = get_option( 'widget_' . $id_base );
unset( $widget[ $multi_number ] );
update_option( 'widget_' . $id_base, $widget );
unset( $sidebars_widgets['wp_inactive_widgets'][ $key ] );
}
wp_set_sidebars_widgets( $sidebars_widgets );
wp_die();
}
```
[do\_action( 'load-widgets.php' )](../hooks/load-widgets-php)
Fires early when editing the widgets displayed in sidebars.
[do\_action( 'sidebar\_admin\_setup' )](../hooks/sidebar_admin_setup)
Fires early before the Widgets administration screen loads, after scripts are enqueued.
[do\_action( 'widgets.php' )](../hooks/widgets-php)
Fires early when editing the widgets displayed in 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. |
| [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. |
| [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. |
| Version | Description |
| --- | --- |
| [4.4.0](https://developer.wordpress.org/reference/since/4.4.0/) | Introduced. |
wordpress get_blogaddress_by_id( int $blog_id ): string get\_blogaddress\_by\_id( int $blog\_id ): string
=================================================
Get a full blog URL, given a blog ID.
`$blog_id` int Required Blog ID. string Full URL of the blog if found. Empty string if not.
File: `wp-includes/ms-blogs.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/ms-blogs.php/)
```
function get_blogaddress_by_id( $blog_id ) {
$bloginfo = get_site( (int) $blog_id );
if ( empty( $bloginfo ) ) {
return '';
}
$scheme = parse_url( $bloginfo->home, PHP_URL_SCHEME );
$scheme = empty( $scheme ) ? 'http' : $scheme;
return esc_url( $scheme . '://' . $bloginfo->domain . $bloginfo->path );
}
```
| Uses | Description |
| --- | --- |
| [get\_site()](get_site) wp-includes/ms-site.php | Retrieves site data given a site ID or site object. |
| [esc\_url()](esc_url) wp-includes/formatting.php | Checks and cleans a URL. |
| Used By | Description |
| --- | --- |
| [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. |
| Version | Description |
| --- | --- |
| [MU (3.0.0)](https://developer.wordpress.org/reference/since/mu.3.0.0/) | Introduced. |
wordpress wp_ajax_nopriv_heartbeat() wp\_ajax\_nopriv\_heartbeat()
=============================
Ajax handler for the Heartbeat API in the no-privilege context.
Runs when the user is not logged in.
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_nopriv_heartbeat() {
$response = array();
// 'screen_id' is the same as $current_screen->id and the JS global 'pagenow'.
if ( ! empty( $_POST['screen_id'] ) ) {
$screen_id = sanitize_key( $_POST['screen_id'] );
} else {
$screen_id = 'front';
}
if ( ! empty( $_POST['data'] ) ) {
$data = wp_unslash( (array) $_POST['data'] );
/**
* Filters Heartbeat Ajax response in no-privilege environments.
*
* @since 3.6.0
*
* @param array $response The no-priv Heartbeat response.
* @param array $data The $_POST data sent.
* @param string $screen_id The screen ID.
*/
$response = apply_filters( 'heartbeat_nopriv_received', $response, $data, $screen_id );
}
/**
* Filters Heartbeat Ajax response in no-privilege environments when no data is passed.
*
* @since 3.6.0
*
* @param array $response The no-priv Heartbeat response.
* @param string $screen_id The screen ID.
*/
$response = apply_filters( 'heartbeat_nopriv_send', $response, $screen_id );
/**
* Fires when Heartbeat ticks in no-privilege environments.
*
* Allows the transport to be easily replaced with long-polling.
*
* @since 3.6.0
*
* @param array $response The no-priv Heartbeat response.
* @param string $screen_id The screen ID.
*/
do_action( 'heartbeat_nopriv_tick', $response, $screen_id );
// Send the current time according to the server.
$response['server_time'] = time();
wp_send_json( $response );
}
```
[apply\_filters( 'heartbeat\_nopriv\_received', array $response, array $data, string $screen\_id )](../hooks/heartbeat_nopriv_received)
Filters Heartbeat Ajax response in no-privilege environments.
[apply\_filters( 'heartbeat\_nopriv\_send', array $response, string $screen\_id )](../hooks/heartbeat_nopriv_send)
Filters Heartbeat Ajax response in no-privilege environments when no data is passed.
[do\_action( 'heartbeat\_nopriv\_tick', array $response, string $screen\_id )](../hooks/heartbeat_nopriv_tick)
Fires when Heartbeat ticks in no-privilege environments.
| Uses | Description |
| --- | --- |
| [wp\_send\_json()](wp_send_json) wp-includes/functions.php | Sends a JSON response back to an Ajax request. |
| [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. |
| [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.6.0](https://developer.wordpress.org/reference/since/3.6.0/) | Introduced. |
wordpress wp_get_sidebars_widgets( bool $deprecated = true ): array wp\_get\_sidebars\_widgets( bool $deprecated = true ): 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.
Retrieve full list of sidebars and their widget instance IDs.
Will upgrade sidebar widget list, if needed. Will also save updated list, if needed.
`$deprecated` bool Optional Not used (argument deprecated). Default: `true`
array Upgraded list of widgets to version 3 array format when called from the admin.
File: `wp-includes/widgets.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/widgets.php/)
```
function wp_get_sidebars_widgets( $deprecated = true ) {
if ( true !== $deprecated ) {
_deprecated_argument( __FUNCTION__, '2.8.1' );
}
global $_wp_sidebars_widgets, $sidebars_widgets;
// If loading from front page, consult $_wp_sidebars_widgets rather than options
// to see if wp_convert_widget_settings() has made manipulations in memory.
if ( ! is_admin() ) {
if ( empty( $_wp_sidebars_widgets ) ) {
$_wp_sidebars_widgets = get_option( 'sidebars_widgets', array() );
}
$sidebars_widgets = $_wp_sidebars_widgets;
} else {
$sidebars_widgets = get_option( 'sidebars_widgets', array() );
}
if ( is_array( $sidebars_widgets ) && isset( $sidebars_widgets['array_version'] ) ) {
unset( $sidebars_widgets['array_version'] );
}
/**
* Filters the list of sidebars and their widgets.
*
* @since 2.7.0
*
* @param array $sidebars_widgets An associative array of sidebars and their widgets.
*/
return apply_filters( 'sidebars_widgets', $sidebars_widgets );
}
```
[apply\_filters( 'sidebars\_widgets', array $sidebars\_widgets )](../hooks/sidebars_widgets)
Filters the list of sidebars and their widgets.
| Uses | Description |
| --- | --- |
| [is\_admin()](is_admin) wp-includes/load.php | Determines whether the current request is for an administrative interface page. |
| [\_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. |
| [get\_option()](get_option) wp-includes/option.php | Retrieves an option value based on an option name. |
| Used By | Description |
| --- | --- |
| [WP\_REST\_Widgets\_Controller::get\_items\_permissions\_check()](../classes/wp_rest_widgets_controller/get_items_permissions_check) wp-includes/rest-api/endpoints/class-wp-rest-widgets-controller.php | Checks if a given request has access to get widgets. |
| [WP\_REST\_Widgets\_Controller::get\_items()](../classes/wp_rest_widgets_controller/get_items) wp-includes/rest-api/endpoints/class-wp-rest-widgets-controller.php | Retrieves a collection of widgets. |
| [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\_Sidebars\_Controller::get\_items\_permissions\_check()](../classes/wp_rest_sidebars_controller/get_items_permissions_check) wp-includes/rest-api/endpoints/class-wp-rest-sidebars-controller.php | Checks if a given request has access to get sidebars. |
| [WP\_REST\_Sidebars\_Controller::get\_items()](../classes/wp_rest_sidebars_controller/get_items) wp-includes/rest-api/endpoints/class-wp-rest-sidebars-controller.php | Retrieves the list of sidebars (active or inactive). |
| [WP\_REST\_Sidebars\_Controller::update\_item()](../classes/wp_rest_sidebars_controller/update_item) wp-includes/rest-api/endpoints/class-wp-rest-sidebars-controller.php | Updates a sidebar. |
| [WP\_REST\_Sidebars\_Controller::prepare\_item\_for\_response()](../classes/wp_rest_sidebars_controller/prepare_item_for_response) wp-includes/rest-api/endpoints/class-wp-rest-sidebars-controller.php | Prepares a single sidebar output for response. |
| [wp\_find\_widgets\_sidebar()](wp_find_widgets_sidebar) wp-includes/widgets.php | Finds the sidebar that a given widget belongs to. |
| [wp\_assign\_widget\_to\_sidebar()](wp_assign_widget_to_sidebar) wp-includes/widgets.php | Assigns a widget to the given sidebar. |
| [wp\_ajax\_delete\_inactive\_widgets()](wp_ajax_delete_inactive_widgets) wp-admin/includes/ajax-actions.php | Ajax handler for removing inactive widgets. |
| [wp\_ajax\_save\_widget()](wp_ajax_save_widget) wp-admin/includes/ajax-actions.php | Ajax handler for saving a widget. |
| [\_wp\_sidebars\_changed()](_wp_sidebars_changed) wp-includes/widgets.php | Handle sidebars config after theme change |
| [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. |
| [is\_active\_widget()](is_active_widget) wp-includes/widgets.php | Determines whether a given widget is displayed on the front end. |
| [WP\_Customize\_Widgets::override\_sidebars\_widgets\_for\_theme\_switch()](../classes/wp_customize_widgets/override_sidebars_widgets_for_theme_switch) wp-includes/class-wp-customize-widgets.php | Override sidebars\_widgets for theme switch. |
| [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 |
| --- | --- |
| [2.2.0](https://developer.wordpress.org/reference/since/2.2.0/) | Introduced. |
wordpress redirect_this_site( array|string $deprecated = '' ): string[] redirect\_this\_site( array|string $deprecated = '' ): string[]
===============================================================
Ensures that the current site’s domain is listed in the allowed redirect host list.
* [wp\_validate\_redirect()](wp_validate_redirect)
`$deprecated` array|string Optional Not used. Default: `''`
string[] An array containing the current site's domain.
* stringThe current site's domain.
File: `wp-includes/ms-functions.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/ms-functions.php/)
```
function redirect_this_site( $deprecated = '' ) {
return array( get_network()->domain );
}
```
| Uses | Description |
| --- | --- |
| [get\_network()](get_network) wp-includes/ms-network.php | Retrieves network data given a network ID or network object. |
| Version | Description |
| --- | --- |
| [MU (3.0.0)](https://developer.wordpress.org/reference/since/mu.3.0.0/) | Introduced. |
wordpress adjacent_post_link( string $format, string $link, bool $in_same_term = false, int[]|string $excluded_terms = '', bool $previous = true, string $taxonomy = 'category' ) adjacent\_post\_link( string $format, string $link, bool $in\_same\_term = false, int[]|string $excluded\_terms = '', bool $previous = true, string $taxonomy = 'category' )
============================================================================================================================================================================
Displays the adjacent post link.
Can be either next post link or previous.
`$format` string Required Link anchor format. `$link` string Required Link permalink format. `$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 category IDs. Default: `''`
`$previous` bool Optional Whether to display link to previous or next post. Default: `true`
`$taxonomy` string Optional Taxonomy, if $in\_same\_term is true. Default `'category'`. Default: `'category'`
File: `wp-includes/link-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/link-template.php/)
```
function adjacent_post_link( $format, $link, $in_same_term = false, $excluded_terms = '', $previous = true, $taxonomy = 'category' ) {
echo get_adjacent_post_link( $format, $link, $in_same_term, $excluded_terms, $previous, $taxonomy );
}
```
| Uses | Description |
| --- | --- |
| [get\_adjacent\_post\_link()](get_adjacent_post_link) wp-includes/link-template.php | Retrieves the adjacent post link. |
| Version | Description |
| --- | --- |
| [2.5.0](https://developer.wordpress.org/reference/since/2.5.0/) | Introduced. |
| programming_docs |
wordpress wp_check_widget_editor_deps() wp\_check\_widget\_editor\_deps()
=================================
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 [\_doing\_it\_wrong()](_doing_it_wrong) message for conflicting widget editor scripts.
The ‘wp-editor’ script module is exposed as window.wp.editor. This overrides the legacy TinyMCE editor module which is required by the widgets editor.
Because of that conflict, these two shouldn’t be enqueued together.
See <https://core.trac.wordpress.org/ticket/53569>.
There is also another conflict related to styles where the block widgets editor is hidden if a block enqueues ‘wp-edit-post’ stylesheet.
See <https://core.trac.wordpress.org/ticket/53569>.
File: `wp-includes/widgets.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/widgets.php/)
```
function wp_check_widget_editor_deps() {
global $wp_scripts, $wp_styles;
if (
$wp_scripts->query( 'wp-edit-widgets', 'enqueued' ) ||
$wp_scripts->query( 'wp-customize-widgets', 'enqueued' )
) {
if ( $wp_scripts->query( 'wp-editor', 'enqueued' ) ) {
_doing_it_wrong(
'wp_enqueue_script()',
sprintf(
/* translators: 1: 'wp-editor', 2: 'wp-edit-widgets', 3: 'wp-customize-widgets'. */
__( '"%1$s" script should not be enqueued together with the new widgets editor (%2$s or %3$s).' ),
'wp-editor',
'wp-edit-widgets',
'wp-customize-widgets'
),
'5.8.0'
);
}
if ( $wp_styles->query( 'wp-edit-post', 'enqueued' ) ) {
_doing_it_wrong(
'wp_enqueue_style()',
sprintf(
/* translators: 1: 'wp-edit-post', 2: 'wp-edit-widgets', 3: 'wp-customize-widgets'. */
__( '"%1$s" style should not be enqueued together with the new widgets editor (%2$s or %3$s).' ),
'wp-edit-post',
'wp-edit-widgets',
'wp-customize-widgets'
),
'5.8.0'
);
}
}
}
```
| 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. |
| Version | Description |
| --- | --- |
| [5.8.0](https://developer.wordpress.org/reference/since/5.8.0/) | Introduced. |
wordpress wptexturize( string $text, bool $reset = false ): string wptexturize( string $text, bool $reset = false ): string
========================================================
Replaces common plain text characters with formatted entities.
Returns given text with transformations of quotes into smart quotes, apostrophes, dashes, ellipses, the trademark symbol, and the multiplication symbol.
As an example,
```
'cause today's effort makes it worth tomorrow's "holiday" ...
```
Becomes:
```
’cause today’s effort makes it worth tomorrow’s “holiday” …
```
Code within certain HTML blocks are skipped.
Do not use this function before the [‘init’](../hooks/init) action hook; everything will break.
`$text` string Required The text to be formatted. `$reset` bool Optional Set to true for unit testing. Translated patterns will reset. Default: `false`
string The string replaced with HTML entities.
* Text enclosed in the tags <pre>, <code>, <kbd>, <style>, <script>, and <tt> will be skipped. This list of tags can be changed with the `[no\_texturize\_tags](../hooks/no_texturize_tags)` filter.
* Text in the ‘' shortcode will also be ignored. The list of shortcodes can be changed with the [`no_texturize_shortcodes`](../hooks/no_texturize_shortcodes) filter.
* The entire function can be turned off with the [run\_wptexturize](../hooks/run_wptexturize "Plugin API/Filter Reference/run wptexturize") filter.
* Do not use this function before the [init](../hooks/init "Plugin API/Action Reference/init") action hook. All of the settings must be initialized before the first call to wptexturize or it will fail on every subsequent use.
* Opening and closing quotes can be customized in a WordPress translation file. Here are some of the text transformations:
| source text | transformed text | symbol name |
| --- | --- | --- |
| "---" | "—" | em-dash |
| " -- " | "—" | em-dash |
| "--" | "–" | en-dash |
| " - " | "–" | en-dash |
| "..." | "…" | ellipsis |
| `` | “ | opening quote |
| "hello | “hello | opening quote |
| 'hello | ‘hello | opening quote |
| '' | ” | closing quote |
| world." | world.” | closing quote |
| world.' | world.’ | closing quote |
| " (tm)" | " ™" | trademark symbol |
| 1234" | 1234″ | double prime symbol |
| 1234' | 1234′ | prime symbol |
| '99 | ’99 | apostrophe before abbreviated year |
| Webster's | Webster’s | apostrophe in a word |
| 1234x1234 | 1234×1234 | multiplication symbol |
* There is a small "cockney" list of transformations, as well. They can be replaced if the variable $wp\_cockneyreplace is defined and contains an associative array with the keys containing the source strings and the values containing the transformed strings. By default the following strings will be transformed:
* 'tain't
* 'twere
* 'twas
* 'tis
* 'twill
* 'til
* 'bout
* 'nuff
* 'round
* 'cause
File: `wp-includes/formatting.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/formatting.php/)
```
function wptexturize( $text, $reset = false ) {
global $wp_cockneyreplace, $shortcode_tags;
static $static_characters = null,
$static_replacements = null,
$dynamic_characters = null,
$dynamic_replacements = null,
$default_no_texturize_tags = null,
$default_no_texturize_shortcodes = null,
$run_texturize = true,
$apos = null,
$prime = null,
$double_prime = null,
$opening_quote = null,
$closing_quote = null,
$opening_single_quote = null,
$closing_single_quote = null,
$open_q_flag = '<!--oq-->',
$open_sq_flag = '<!--osq-->',
$apos_flag = '<!--apos-->';
// If there's nothing to do, just stop.
if ( empty( $text ) || false === $run_texturize ) {
return $text;
}
// Set up static variables. Run once only.
if ( $reset || ! isset( $static_characters ) ) {
/**
* Filters whether to skip running wptexturize().
*
* Returning false from the filter will effectively short-circuit wptexturize()
* and return the original text passed to the function instead.
*
* The filter runs only once, the first time wptexturize() is called.
*
* @since 4.0.0
*
* @see wptexturize()
*
* @param bool $run_texturize Whether to short-circuit wptexturize().
*/
$run_texturize = apply_filters( 'run_wptexturize', $run_texturize );
if ( false === $run_texturize ) {
return $text;
}
/* translators: Opening curly double quote. */
$opening_quote = _x( '“', 'opening curly double quote' );
/* translators: Closing curly double quote. */
$closing_quote = _x( '”', 'closing curly double quote' );
/* translators: Apostrophe, for example in 'cause or can't. */
$apos = _x( '’', 'apostrophe' );
/* translators: Prime, for example in 9' (nine feet). */
$prime = _x( '′', 'prime' );
/* translators: Double prime, for example in 9" (nine inches). */
$double_prime = _x( '″', 'double prime' );
/* translators: Opening curly single quote. */
$opening_single_quote = _x( '‘', 'opening curly single quote' );
/* translators: Closing curly single quote. */
$closing_single_quote = _x( '’', 'closing curly single quote' );
/* translators: En dash. */
$en_dash = _x( '–', 'en dash' );
/* translators: Em dash. */
$em_dash = _x( '—', 'em dash' );
$default_no_texturize_tags = array( 'pre', 'code', 'kbd', 'style', 'script', 'tt' );
$default_no_texturize_shortcodes = array( 'code' );
// If a plugin has provided an autocorrect array, use it.
if ( isset( $wp_cockneyreplace ) ) {
$cockney = array_keys( $wp_cockneyreplace );
$cockneyreplace = array_values( $wp_cockneyreplace );
} else {
/*
* translators: This is a comma-separated list of words that defy the syntax of quotations in normal use,
* for example... 'We do not have enough words yet'... is a typical quoted phrase. But when we write
* lines of code 'til we have enough of 'em, then we need to insert apostrophes instead of quotes.
*/
$cockney = explode(
',',
_x(
"'tain't,'twere,'twas,'tis,'twill,'til,'bout,'nuff,'round,'cause,'em",
'Comma-separated list of words to texturize in your language'
)
);
$cockneyreplace = explode(
',',
_x(
'’tain’t,’twere,’twas,’tis,’twill,’til,’bout,’nuff,’round,’cause,’em',
'Comma-separated list of replacement words in your language'
)
);
}
$static_characters = array_merge( array( '...', '``', '\'\'', ' (tm)' ), $cockney );
$static_replacements = array_merge( array( '…', $opening_quote, $closing_quote, ' ™' ), $cockneyreplace );
// Pattern-based replacements of characters.
// Sort the remaining patterns into several arrays for performance tuning.
$dynamic_characters = array(
'apos' => array(),
'quote' => array(),
'dash' => array(),
);
$dynamic_replacements = array(
'apos' => array(),
'quote' => array(),
'dash' => array(),
);
$dynamic = array();
$spaces = wp_spaces_regexp();
// '99' and '99" are ambiguous among other patterns; assume it's an abbreviated year at the end of a quotation.
if ( "'" !== $apos || "'" !== $closing_single_quote ) {
$dynamic[ '/\'(\d\d)\'(?=\Z|[.,:;!?)}\-\]]|>|' . $spaces . ')/' ] = $apos_flag . '$1' . $closing_single_quote;
}
if ( "'" !== $apos || '"' !== $closing_quote ) {
$dynamic[ '/\'(\d\d)"(?=\Z|[.,:;!?)}\-\]]|>|' . $spaces . ')/' ] = $apos_flag . '$1' . $closing_quote;
}
// '99 '99s '99's (apostrophe) But never '9 or '99% or '999 or '99.0.
if ( "'" !== $apos ) {
$dynamic['/\'(?=\d\d(?:\Z|(?![%\d]|[.,]\d)))/'] = $apos_flag;
}
// Quoted numbers like '0.42'.
if ( "'" !== $opening_single_quote && "'" !== $closing_single_quote ) {
$dynamic[ '/(?<=\A|' . $spaces . ')\'(\d[.,\d]*)\'/' ] = $open_sq_flag . '$1' . $closing_single_quote;
}
// Single quote at start, or preceded by (, {, <, [, ", -, or spaces.
if ( "'" !== $opening_single_quote ) {
$dynamic[ '/(?<=\A|[([{"\-]|<|' . $spaces . ')\'/' ] = $open_sq_flag;
}
// Apostrophe in a word. No spaces, double apostrophes, or other punctuation.
if ( "'" !== $apos ) {
$dynamic[ '/(?<!' . $spaces . ')\'(?!\Z|[.,:;!?"\'(){}[\]\-]|&[lg]t;|' . $spaces . ')/' ] = $apos_flag;
}
$dynamic_characters['apos'] = array_keys( $dynamic );
$dynamic_replacements['apos'] = array_values( $dynamic );
$dynamic = array();
// Quoted numbers like "42".
if ( '"' !== $opening_quote && '"' !== $closing_quote ) {
$dynamic[ '/(?<=\A|' . $spaces . ')"(\d[.,\d]*)"/' ] = $open_q_flag . '$1' . $closing_quote;
}
// Double quote at start, or preceded by (, {, <, [, -, or spaces, and not followed by spaces.
if ( '"' !== $opening_quote ) {
$dynamic[ '/(?<=\A|[([{\-]|<|' . $spaces . ')"(?!' . $spaces . ')/' ] = $open_q_flag;
}
$dynamic_characters['quote'] = array_keys( $dynamic );
$dynamic_replacements['quote'] = array_values( $dynamic );
$dynamic = array();
// Dashes and spaces.
$dynamic['/---/'] = $em_dash;
$dynamic[ '/(?<=^|' . $spaces . ')--(?=$|' . $spaces . ')/' ] = $em_dash;
$dynamic['/(?<!xn)--/'] = $en_dash;
$dynamic[ '/(?<=^|' . $spaces . ')-(?=$|' . $spaces . ')/' ] = $en_dash;
$dynamic_characters['dash'] = array_keys( $dynamic );
$dynamic_replacements['dash'] = array_values( $dynamic );
}
// Must do this every time in case plugins use these filters in a context sensitive manner.
/**
* Filters the list of HTML elements not to texturize.
*
* @since 2.8.0
*
* @param string[] $default_no_texturize_tags An array of HTML element names.
*/
$no_texturize_tags = apply_filters( 'no_texturize_tags', $default_no_texturize_tags );
/**
* Filters the list of shortcodes not to texturize.
*
* @since 2.8.0
*
* @param string[] $default_no_texturize_shortcodes An array of shortcode names.
*/
$no_texturize_shortcodes = apply_filters( 'no_texturize_shortcodes', $default_no_texturize_shortcodes );
$no_texturize_tags_stack = array();
$no_texturize_shortcodes_stack = array();
// Look for shortcodes and HTML elements.
preg_match_all( '@\[/?([^<>&/\[\]\x00-\x20=]++)@', $text, $matches );
$tagnames = array_intersect( array_keys( $shortcode_tags ), $matches[1] );
$found_shortcodes = ! empty( $tagnames );
$shortcode_regex = $found_shortcodes ? _get_wptexturize_shortcode_regex( $tagnames ) : '';
$regex = _get_wptexturize_split_regex( $shortcode_regex );
$textarr = preg_split( $regex, $text, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY );
foreach ( $textarr as &$curl ) {
// Only call _wptexturize_pushpop_element if $curl is a delimiter.
$first = $curl[0];
if ( '<' === $first ) {
if ( '<!--' === substr( $curl, 0, 4 ) ) {
// This is an HTML comment delimiter.
continue;
} else {
// This is an HTML element delimiter.
// Replace each & with & unless it already looks like an entity.
$curl = preg_replace( '/&(?!#(?:\d+|x[a-f0-9]+);|[a-z1-4]{1,8};)/i', '&', $curl );
_wptexturize_pushpop_element( $curl, $no_texturize_tags_stack, $no_texturize_tags );
}
} elseif ( '' === trim( $curl ) ) {
// This is a newline between delimiters. Performance improves when we check this.
continue;
} elseif ( '[' === $first && $found_shortcodes && 1 === preg_match( '/^' . $shortcode_regex . '$/', $curl ) ) {
// This is a shortcode delimiter.
if ( '[[' !== substr( $curl, 0, 2 ) && ']]' !== substr( $curl, -2 ) ) {
// Looks like a normal shortcode.
_wptexturize_pushpop_element( $curl, $no_texturize_shortcodes_stack, $no_texturize_shortcodes );
} else {
// Looks like an escaped shortcode.
continue;
}
} elseif ( empty( $no_texturize_shortcodes_stack ) && empty( $no_texturize_tags_stack ) ) {
// This is neither a delimiter, nor is this content inside of no_texturize pairs. Do texturize.
$curl = str_replace( $static_characters, $static_replacements, $curl );
if ( false !== strpos( $curl, "'" ) ) {
$curl = preg_replace( $dynamic_characters['apos'], $dynamic_replacements['apos'], $curl );
$curl = wptexturize_primes( $curl, "'", $prime, $open_sq_flag, $closing_single_quote );
$curl = str_replace( $apos_flag, $apos, $curl );
$curl = str_replace( $open_sq_flag, $opening_single_quote, $curl );
}
if ( false !== strpos( $curl, '"' ) ) {
$curl = preg_replace( $dynamic_characters['quote'], $dynamic_replacements['quote'], $curl );
$curl = wptexturize_primes( $curl, '"', $double_prime, $open_q_flag, $closing_quote );
$curl = str_replace( $open_q_flag, $opening_quote, $curl );
}
if ( false !== strpos( $curl, '-' ) ) {
$curl = preg_replace( $dynamic_characters['dash'], $dynamic_replacements['dash'], $curl );
}
// 9x9 (times), but never 0x9999.
if ( 1 === preg_match( '/(?<=\d)x\d/', $curl ) ) {
// Searching for a digit is 10 times more expensive than for the x, so we avoid doing this one!
$curl = preg_replace( '/\b(\d(?(?<=0)[\d\.,]+|[\d\.,]*))x(\d[\d\.,]*)\b/', '$1×$2', $curl );
}
// Replace each & with & unless it already looks like an entity.
$curl = preg_replace( '/&(?!#(?:\d+|x[a-f0-9]+);|[a-z1-4]{1,8};)/i', '&', $curl );
}
}
return implode( '', $textarr );
}
```
[apply\_filters( 'no\_texturize\_shortcodes', string[] $default\_no\_texturize\_shortcodes )](../hooks/no_texturize_shortcodes)
Filters the list of shortcodes not to texturize.
[apply\_filters( 'no\_texturize\_tags', string[] $default\_no\_texturize\_tags )](../hooks/no_texturize_tags)
Filters the list of HTML elements not to texturize.
[apply\_filters( 'run\_wptexturize', bool $run\_texturize )](../hooks/run_wptexturize)
Filters whether to skip running [wptexturize()](wptexturize) .
| Uses | Description |
| --- | --- |
| [wptexturize\_primes()](wptexturize_primes) wp-includes/formatting.php | Implements a logic tree to determine whether or not “7′.” represents seven feet, then converts the special char into either a prime char or a closing quote char. |
| [wp\_spaces\_regexp()](wp_spaces_regexp) wp-includes/formatting.php | Returns the regexp for common whitespace characters. |
| [\_wptexturize\_pushpop\_element()](_wptexturize_pushpop_element) wp-includes/formatting.php | Searches for disabled element tags. Pushes element to stack on tag open and pops on tag close. |
| [\_x()](_x) wp-includes/l10n.php | Retrieves translated string with gettext context. |
| [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. |
| [\_get\_plugin\_data\_markup\_translate()](_get_plugin_data_markup_translate) wp-admin/includes/plugin.php | Sanitizes plugin data, optionally adds markup, optionally translates. |
| [\_wp\_menu\_output()](_wp_menu_output) wp-admin/menu-header.php | Display menu. |
| [get\_archives\_link()](get_archives_link) wp-includes/general-template.php | Retrieves archive link content based on predefined or custom code. |
| [WP\_Theme::markup\_header()](../classes/wp_theme/markup_header) wp-includes/class-wp-theme.php | Marks up a theme header. |
| [gallery\_shortcode()](gallery_shortcode) wp-includes/media.php | Builds the Gallery shortcode output. |
| [trackback\_rdf()](trackback_rdf) wp-includes/comment-template.php | Generates and displays the RDF for the trackback information of current post. |
| Version | Description |
| --- | --- |
| [0.71](https://developer.wordpress.org/reference/since/0.71/) | Introduced. |
wordpress wp_save_image( int $post_id ): stdClass wp\_save\_image( int $post\_id ): stdClass
==========================================
Saves image to post, along with enqueued changes in `$_REQUEST['history']`.
`$post_id` int Required Attachment post ID. stdClass
File: `wp-admin/includes/image-edit.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/image-edit.php/)
```
function wp_save_image( $post_id ) {
$_wp_additional_image_sizes = wp_get_additional_image_sizes();
$return = new stdClass;
$success = false;
$delete = false;
$scaled = false;
$nocrop = false;
$post = get_post( $post_id );
$img = wp_get_image_editor( _load_image_to_edit_path( $post_id, 'full' ) );
if ( is_wp_error( $img ) ) {
$return->error = esc_js( __( 'Unable to create new image.' ) );
return $return;
}
$fwidth = ! empty( $_REQUEST['fwidth'] ) ? (int) $_REQUEST['fwidth'] : 0;
$fheight = ! empty( $_REQUEST['fheight'] ) ? (int) $_REQUEST['fheight'] : 0;
$target = ! empty( $_REQUEST['target'] ) ? preg_replace( '/[^a-z0-9_-]+/i', '', $_REQUEST['target'] ) : '';
$scale = ! empty( $_REQUEST['do'] ) && 'scale' === $_REQUEST['do'];
if ( $scale && $fwidth > 0 && $fheight > 0 ) {
$size = $img->get_size();
$sX = $size['width'];
$sY = $size['height'];
// Check if it has roughly the same w / h ratio.
$diff = round( $sX / $sY, 2 ) - round( $fwidth / $fheight, 2 );
if ( -0.1 < $diff && $diff < 0.1 ) {
// Scale the full size image.
if ( $img->resize( $fwidth, $fheight ) ) {
$scaled = true;
}
}
if ( ! $scaled ) {
$return->error = esc_js( __( 'Error while saving the scaled image. Please reload the page and try again.' ) );
return $return;
}
} elseif ( ! empty( $_REQUEST['history'] ) ) {
$changes = json_decode( wp_unslash( $_REQUEST['history'] ) );
if ( $changes ) {
$img = image_edit_apply_changes( $img, $changes );
}
} else {
$return->error = esc_js( __( 'Nothing to save, the image has not changed.' ) );
return $return;
}
$meta = wp_get_attachment_metadata( $post_id );
$backup_sizes = get_post_meta( $post->ID, '_wp_attachment_backup_sizes', true );
if ( ! is_array( $meta ) ) {
$return->error = esc_js( __( 'Image data does not exist. Please re-upload the image.' ) );
return $return;
}
if ( ! is_array( $backup_sizes ) ) {
$backup_sizes = array();
}
// Generate new filename.
$path = get_attached_file( $post_id );
$basename = pathinfo( $path, PATHINFO_BASENAME );
$dirname = pathinfo( $path, PATHINFO_DIRNAME );
$ext = pathinfo( $path, PATHINFO_EXTENSION );
$filename = pathinfo( $path, PATHINFO_FILENAME );
$suffix = time() . rand( 100, 999 );
if ( defined( 'IMAGE_EDIT_OVERWRITE' ) && IMAGE_EDIT_OVERWRITE &&
isset( $backup_sizes['full-orig'] ) && $backup_sizes['full-orig']['file'] != $basename ) {
if ( 'thumbnail' === $target ) {
$new_path = "{$dirname}/{$filename}-temp.{$ext}";
} else {
$new_path = $path;
}
} else {
while ( true ) {
$filename = preg_replace( '/-e([0-9]+)$/', '', $filename );
$filename .= "-e{$suffix}";
$new_filename = "{$filename}.{$ext}";
$new_path = "{$dirname}/$new_filename";
if ( file_exists( $new_path ) ) {
$suffix++;
} else {
break;
}
}
}
// Save the full-size file, also needed to create sub-sizes.
if ( ! wp_save_image_file( $new_path, $img, $post->post_mime_type, $post_id ) ) {
$return->error = esc_js( __( 'Unable to save the image.' ) );
return $return;
}
if ( 'nothumb' === $target || 'all' === $target || 'full' === $target || $scaled ) {
$tag = false;
if ( isset( $backup_sizes['full-orig'] ) ) {
if ( ( ! defined( 'IMAGE_EDIT_OVERWRITE' ) || ! IMAGE_EDIT_OVERWRITE ) && $backup_sizes['full-orig']['file'] !== $basename ) {
$tag = "full-$suffix";
}
} else {
$tag = 'full-orig';
}
if ( $tag ) {
$backup_sizes[ $tag ] = array(
'width' => $meta['width'],
'height' => $meta['height'],
'file' => $basename,
);
}
$success = ( $path === $new_path ) || update_attached_file( $post_id, $new_path );
$meta['file'] = _wp_relative_upload_path( $new_path );
$size = $img->get_size();
$meta['width'] = $size['width'];
$meta['height'] = $size['height'];
if ( $success ) {
$sizes = get_intermediate_image_sizes();
if ( 'nothumb' === $target || 'all' === $target ) {
if ( 'nothumb' === $target ) {
$sizes = array_diff( $sizes, array( 'thumbnail' ) );
}
} elseif ( 'thumbnail' !== $target ) {
$sizes = array_diff( $sizes, array( $target ) );
}
}
$return->fw = $meta['width'];
$return->fh = $meta['height'];
} elseif ( 'thumbnail' === $target ) {
$sizes = array( 'thumbnail' );
$success = true;
$delete = true;
$nocrop = true;
} else {
$sizes = array( $target );
$success = true;
$delete = true;
$nocrop = $_wp_additional_image_sizes[ $size ]['crop'];
}
/*
* We need to remove any existing resized image files because
* a new crop or rotate could generate different sizes (and hence, filenames),
* keeping the new resized images from overwriting the existing image files.
* https://core.trac.wordpress.org/ticket/32171
*/
if ( defined( 'IMAGE_EDIT_OVERWRITE' ) && IMAGE_EDIT_OVERWRITE && ! empty( $meta['sizes'] ) ) {
foreach ( $meta['sizes'] as $size ) {
if ( ! empty( $size['file'] ) && preg_match( '/-e[0-9]{13}-/', $size['file'] ) ) {
$delete_file = path_join( $dirname, $size['file'] );
wp_delete_file( $delete_file );
}
}
}
if ( isset( $sizes ) ) {
$_sizes = array();
foreach ( $sizes as $size ) {
$tag = false;
if ( isset( $meta['sizes'][ $size ] ) ) {
if ( isset( $backup_sizes[ "$size-orig" ] ) ) {
if ( ( ! defined( 'IMAGE_EDIT_OVERWRITE' ) || ! IMAGE_EDIT_OVERWRITE ) && $backup_sizes[ "$size-orig" ]['file'] != $meta['sizes'][ $size ]['file'] ) {
$tag = "$size-$suffix";
}
} else {
$tag = "$size-orig";
}
if ( $tag ) {
$backup_sizes[ $tag ] = $meta['sizes'][ $size ];
}
}
if ( isset( $_wp_additional_image_sizes[ $size ] ) ) {
$width = (int) $_wp_additional_image_sizes[ $size ]['width'];
$height = (int) $_wp_additional_image_sizes[ $size ]['height'];
$crop = ( $nocrop ) ? false : $_wp_additional_image_sizes[ $size ]['crop'];
} else {
$height = get_option( "{$size}_size_h" );
$width = get_option( "{$size}_size_w" );
$crop = ( $nocrop ) ? false : get_option( "{$size}_crop" );
}
$_sizes[ $size ] = array(
'width' => $width,
'height' => $height,
'crop' => $crop,
);
}
$meta['sizes'] = array_merge( $meta['sizes'], $img->multi_resize( $_sizes ) );
}
unset( $img );
if ( $success ) {
wp_update_attachment_metadata( $post_id, $meta );
update_post_meta( $post_id, '_wp_attachment_backup_sizes', $backup_sizes );
if ( 'thumbnail' === $target || 'all' === $target || 'full' === $target ) {
// Check if it's an image edit from attachment edit screen.
if ( ! empty( $_REQUEST['context'] ) && 'edit-attachment' === $_REQUEST['context'] ) {
$thumb_url = wp_get_attachment_image_src( $post_id, array( 900, 600 ), true );
$return->thumbnail = $thumb_url[0];
} else {
$file_url = wp_get_attachment_url( $post_id );
if ( ! empty( $meta['sizes']['thumbnail'] ) ) {
$thumb = $meta['sizes']['thumbnail'];
$return->thumbnail = path_join( dirname( $file_url ), $thumb['file'] );
} else {
$return->thumbnail = "$file_url?w=128&h=128";
}
}
}
} else {
$delete = true;
}
if ( $delete ) {
wp_delete_file( $new_path );
}
$return->msg = esc_js( __( 'Image saved' ) );
return $return;
}
```
| Uses | Description |
| --- | --- |
| [wp\_get\_additional\_image\_sizes()](wp_get_additional_image_sizes) wp-includes/media.php | Retrieves additional image sizes. |
| [wp\_delete\_file()](wp_delete_file) wp-includes/functions.php | Deletes a file. |
| [\_wp\_relative\_upload\_path()](_wp_relative_upload_path) wp-includes/post.php | Returns relative path to an uploaded file. |
| [update\_attached\_file()](update_attached_file) wp-includes/post.php | Updates attachment file path based on attachment ID. |
| [get\_attached\_file()](get_attached_file) wp-includes/post.php | Retrieves attached file path based on attachment ID. |
| [update\_post\_meta()](update_post_meta) wp-includes/post.php | Updates a post meta field based on the given post ID. |
| [wp\_get\_attachment\_url()](wp_get_attachment_url) wp-includes/post.php | Retrieves the URL for an attachment. |
| [wp\_update\_attachment\_metadata()](wp_update_attachment_metadata) wp-includes/post.php | Updates metadata for an attachment. |
| [wp\_get\_attachment\_metadata()](wp_get_attachment_metadata) wp-includes/post.php | Retrieves attachment metadata for attachment ID. |
| [wp\_get\_attachment\_image\_src()](wp_get_attachment_image_src) wp-includes/media.php | Retrieves an image to represent an attachment. |
| [get\_intermediate\_image\_sizes()](get_intermediate_image_sizes) wp-includes/media.php | Gets the available intermediate image size names. |
| [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. |
| [path\_join()](path_join) wp-includes/functions.php | Joins two filesystem paths together. |
| [esc\_js()](esc_js) wp-includes/formatting.php | Escapes single quotes, `"`, , `&`, and fixes line endings. |
| [\_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\_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. |
| [get\_option()](get_option) wp-includes/option.php | Retrieves an option value based on an option name. |
| [wp\_unslash()](wp_unslash) wp-includes/formatting.php | Removes slashes from a string or recursively removes slashes from strings within an array. |
| [get\_post\_meta()](get_post_meta) wp-includes/post.php | Retrieves a post meta field for the given post ID. |
| [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. |
| [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\_ajax\_image\_editor()](wp_ajax_image_editor) wp-admin/includes/ajax-actions.php | Ajax handler for image editing. |
| Version | Description |
| --- | --- |
| [2.9.0](https://developer.wordpress.org/reference/since/2.9.0/) | Introduced. |
| programming_docs |
wordpress get_comments( string|array $args = '' ): WP_Comment[]|int[]|int get\_comments( string|array $args = '' ): WP\_Comment[]|int[]|int
=================================================================
Retrieves a list of comments.
The comment list can be for the blog as a whole or for an individual post.
`$args` string|array Optional Array or string of arguments. See [WP\_Comment\_Query::\_\_construct()](../classes/wp_comment_query/__construct) for information on accepted arguments. More Arguments from WP\_Comment\_Query::\_\_construct( ... $query ) Array or query string of comment query parameters.
* `author_email`stringComment author email address.
* `author_url`stringComment author URL.
* `author__in`int[]Array of author IDs to include comments for.
* `author__not_in`int[]Array of author IDs to exclude comments for.
* `comment__in`int[]Array of comment IDs to include.
* `comment__not_in`int[]Array of comment IDs to exclude.
* `count`boolWhether to return a comment count (true) or array of comment objects (false). Default false.
* `date_query`arrayDate query clauses to limit comments by. See [WP\_Date\_Query](../classes/wp_date_query).
Default null.
* `fields`stringComment fields to return. Accepts `'ids'` for comment IDs only or empty for all fields.
* `include_unapproved`arrayArray of IDs or email addresses of users whose unapproved comments will be returned by the query regardless of `$status`.
* `karma`intKarma score to retrieve matching comments for.
* `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.
* `number`intMaximum number of comments to retrieve.
Default empty (no limit).
* `paged`intWhen used with `$number`, defines the page of results to return.
When used with `$offset`, `$offset` takes precedence. Default 1.
* `offset`intNumber of comments to offset the query. Used to build LIMIT clause. Default 0.
* `no_found_rows`boolWhether to disable the `SQL_CALC_FOUND_ROWS` query.
Default: true.
* `orderby`string|arrayComment status or array of statuses. To use `'meta_value'` or `'meta_value_num'`, `$meta_key` must also be defined.
To sort by a specific `$meta_query` clause, use that clause's array key. Accepts:
+ `'comment_agent'`
+ `'comment_approved'`
+ `'comment_author'`
+ `'comment_author_email'`
+ `'comment_author_IP'`
+ `'comment_author_url'`
+ `'comment_content'`
+ `'comment_date'`
+ `'comment_date_gmt'`
+ `'comment_ID'`
+ `'comment_karma'`
+ `'comment_parent'`
+ `'comment_post_ID'`
+ `'comment_type'`
+ `'user_id'`
+ `'comment__in'`
+ `'meta_value'`
+ `'meta_value_num'`
+ The value of `$meta_key`
+ The array keys of `$meta_query`
+ false, an empty array, or `'none'` to disable `ORDER BY` clause. Default: `'comment_date_gmt'`.
* `order`stringHow to order retrieved comments. Accepts `'ASC'`, `'DESC'`.
Default: `'DESC'`.
* `parent`intParent ID of comment to retrieve children of.
* `parent__in`int[]Array of parent IDs of comments to retrieve children for.
* `parent__not_in`int[]Array of parent IDs of comments \*not\* to retrieve children for.
* `post_author__in`int[]Array of author IDs to retrieve comments for.
* `post_author__not_in`int[]Array of author IDs \*not\* to retrieve comments for.
* `post_id`intLimit results to those affiliated with a given post ID.
Default 0.
* `post__in`int[]Array of post IDs to include affiliated comments for.
* `post__not_in`int[]Array of post IDs to exclude affiliated comments for.
* `post_author`intPost author ID to limit results by.
* `post_status`string|string[]Post status or array of post statuses to retrieve affiliated comments for. Pass `'any'` to match any value.
* `post_type`string|string[]Post type or array of post types to retrieve affiliated comments for. Pass `'any'` to match any value.
* `post_name`stringPost name to retrieve affiliated comments for.
* `post_parent`intPost parent ID to retrieve affiliated comments for.
* `search`stringSearch term(s) to retrieve matching comments for.
* `status`string|arrayComment statuses to limit results by. Accepts an array or space/comma-separated list of `'hold'` (`comment_status=0`), `'approve'` (`comment_status=1`), `'all'`, or a custom comment status. Default `'all'`.
* `type`string|string[]Include comments of a given type, or array of types.
Accepts `'comment'`, `'pings'` (includes `'pingback'` and `'trackback'`), or any custom type string.
* `type__in`string[]Include comments from a given array of comment types.
* `type__not_in`string[]Exclude comments from a given array of comment types.
* `user_id`intInclude comments for a specific user ID.
* `hierarchical`bool|stringWhether to include comment descendants in the results.
+ `'threaded'` returns a tree, with each comment's children stored in a `children` property on the `WP_Comment` object.
+ `'flat'` returns a flat array of found comments plus their children.
+ Boolean `false` leaves out descendants. The parameter is ignored (forced to `false`) when `$fields` is `'ids'` or `'counts'`. Accepts `'threaded'`, `'flat'`, or false. Default: false.
* `cache_domain`stringUnique cache key to be produced when this query is stored in an object cache. Default is `'core'`.
* `update_comment_meta_cache`boolWhether to prime the metadata cache for found comments.
Default true.
* `update_comment_post_cache`boolWhether to prime the cache for comment posts.
Default false.
Default: `''`
[WP\_Comment](../classes/wp_comment)[]|int[]|int List of comments or number of found comments if `$count` argument is true.
File: `wp-includes/comment.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/comment.php/)
```
function get_comments( $args = '' ) {
$query = new WP_Comment_Query;
return $query->query( $args );
}
```
| Uses | Description |
| --- | --- |
| [WP\_Comment\_Query::\_\_construct()](../classes/wp_comment_query/__construct) wp-includes/class-wp-comment-query.php | Constructor. |
| 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\_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. |
| [WP\_Comment::get\_children()](../classes/wp_comment/get_children) wp-includes/class-wp-comment.php | Get the children of a comment. |
| [WP\_Comment\_Query::fill\_descendants()](../classes/wp_comment_query/fill_descendants) wp-includes/class-wp-comment-query.php | Fetch descendants for located comments. |
| [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. |
| [WP\_Comments\_List\_Table::get\_views()](../classes/wp_comments_list_table/get_views) wp-admin/includes/class-wp-comments-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 | |
| [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\_xmlrpc\_server::wp\_getComments()](../classes/wp_xmlrpc_server/wp_getcomments) wp-includes/class-wp-xmlrpc-server.php | Retrieve comments. |
| [wp\_list\_comments()](wp_list_comments) wp-includes/comment-template.php | Displays a list of comments. |
| [get\_comment\_count()](get_comment_count) wp-includes/comment.php | Retrieves the total comment counts for the whole site or a single post. |
| Version | Description |
| --- | --- |
| [2.7.0](https://developer.wordpress.org/reference/since/2.7.0/) | Introduced. |
wordpress rest_output_link_wp_head() rest\_output\_link\_wp\_head()
==============================
Outputs the REST API link tag into page header.
* [get\_rest\_url()](get_rest_url)
File: `wp-includes/rest-api.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/rest-api.php/)
```
function rest_output_link_wp_head() {
$api_root = get_rest_url();
if ( empty( $api_root ) ) {
return;
}
printf( '<link rel="https://api.w.org/" href="%s" />', esc_url( $api_root ) );
$resource = rest_get_queried_resource_route();
if ( $resource ) {
printf( '<link rel="alternate" type="application/json" href="%s" />', esc_url( rest_url( $resource ) ) );
}
}
```
| 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. |
| [rest\_url()](rest_url) wp-includes/rest-api.php | Retrieves the URL to a REST endpoint. |
| [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 upload_space_setting( int $id ) upload\_space\_setting( int $id )
=================================
Displays the site upload space quota setting form on the Edit Site Settings screen.
`$id` int Required The ID of the site to display the setting for. File: `wp-admin/includes/ms.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/ms.php/)
```
function upload_space_setting( $id ) {
switch_to_blog( $id );
$quota = get_option( 'blog_upload_space' );
restore_current_blog();
if ( ! $quota ) {
$quota = '';
}
?>
<tr>
<th><label for="blog-upload-space-number"><?php _e( 'Site Upload Space Quota' ); ?></label></th>
<td>
<input type="number" step="1" min="0" style="width: 100px" name="option[blog_upload_space]" id="blog-upload-space-number" aria-describedby="blog-upload-space-desc" value="<?php echo $quota; ?>" />
<span id="blog-upload-space-desc"><span class="screen-reader-text"><?php _e( 'Size in megabytes' ); ?></span> <?php _e( 'MB (Leave blank for network default)' ); ?></span>
</td>
</tr>
<?php
}
```
| 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) . |
| [\_e()](_e) wp-includes/l10n.php | Displays translated text. |
| [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 codepress_footer_js() codepress\_footer\_js()
=======================
This function has been deprecated.
Adds JavaScript required to make CodePress work on the theme/plugin file editors.
File: `wp-admin/includes/deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/deprecated.php/)
```
function codepress_footer_js() {
_deprecated_function( __FUNCTION__, '3.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 |
| --- | --- |
| [3.0.0](https://developer.wordpress.org/reference/since/3.0.0/) | This function has been deprecated. |
| [2.8.0](https://developer.wordpress.org/reference/since/2.8.0/) | Introduced. |
wordpress get_editable_user_ids( int $user_id, bool $exclude_zeros = true, $post_type = 'post' ): array get\_editable\_user\_ids( int $user\_id, bool $exclude\_zeros = true, $post\_type = 'post' ): array
===================================================================================================
This function has been deprecated. Use [get\_users()](get_users) instead.
Gets the IDs of any users who can edit posts.
`$user_id` int Required User ID. `$exclude_zeros` bool Optional Whether to exclude zeroes. Default: `true`
array Array of editable user IDs, empty array otherwise.
File: `wp-admin/includes/deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/deprecated.php/)
```
function get_editable_user_ids( $user_id, $exclude_zeros = true, $post_type = 'post' ) {
_deprecated_function( __FUNCTION__, '3.1.0', 'get_users()' );
global $wpdb;
if ( ! $user = get_userdata( $user_id ) )
return array();
$post_type_obj = get_post_type_object($post_type);
if ( ! $user->has_cap($post_type_obj->cap->edit_others_posts) ) {
if ( $user->has_cap($post_type_obj->cap->edit_posts) || ! $exclude_zeros )
return array($user->ID);
else
return array();
}
if ( !is_multisite() )
$level_key = $wpdb->get_blog_prefix() . 'user_level';
else
$level_key = $wpdb->get_blog_prefix() . 'capabilities'; // WPMU site admins don't have user_levels.
$query = $wpdb->prepare("SELECT user_id FROM $wpdb->usermeta WHERE meta_key = %s", $level_key);
if ( $exclude_zeros )
$query .= " AND meta_value != '0'";
return $wpdb->get_col( $query );
}
```
| Uses | Description |
| --- | --- |
| [wpdb::get\_blog\_prefix()](../classes/wpdb/get_blog_prefix) wp-includes/class-wpdb.php | Gets blog prefix. |
| [wpdb::get\_col()](../classes/wpdb/get_col) wp-includes/class-wpdb.php | Retrieves one column from the database. |
| [get\_userdata()](get_userdata) wp-includes/pluggable.php | Retrieves user info by user ID. |
| [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. |
| [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. |
| Used By | Description |
| --- | --- |
| [get\_editable\_authors()](get_editable_authors) wp-admin/includes/deprecated.php | Gets author users who can edit posts. |
| [get\_others\_unpublished\_posts()](get_others_unpublished_posts) wp-admin/includes/deprecated.php | Retrieves editable posts from other users. |
| Version | Description |
| --- | --- |
| [3.1.0](https://developer.wordpress.org/reference/since/3.1.0/) | Introduced. |
wordpress path_is_absolute( string $path ): bool path\_is\_absolute( string $path ): bool
========================================
Tests if a given filesystem path is absolute.
For example, ‘/foo/bar’, or ‘c:\windows’.
`$path` string Required File path. bool True if path is absolute, false is not absolute.
File: `wp-includes/functions.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/functions.php/)
```
function path_is_absolute( $path ) {
/*
* Check to see if the path is a stream and check to see if its an actual
* path or file as realpath() does not support stream wrappers.
*/
if ( wp_is_stream( $path ) && ( is_dir( $path ) || is_file( $path ) ) ) {
return true;
}
/*
* This is definitive if true but fails if $path does not exist or contains
* a symbolic link.
*/
if ( realpath( $path ) === $path ) {
return true;
}
if ( strlen( $path ) === 0 || '.' === $path[0] ) {
return false;
}
// Windows allows absolute paths like this.
if ( preg_match( '#^[a-zA-Z]:\\\\#', $path ) ) {
return true;
}
// A path starting with / or \ is absolute; anything else is relative.
return ( '/' === $path[0] || '\\' === $path[0] );
}
```
| Uses | Description |
| --- | --- |
| [wp\_is\_stream()](wp_is_stream) wp-includes/functions.php | Tests if a given path is a stream URL |
| Used By | Description |
| --- | --- |
| [path\_join()](path_join) wp-includes/functions.php | Joins two filesystem paths together. |
| Version | Description |
| --- | --- |
| [2.5.0](https://developer.wordpress.org/reference/since/2.5.0/) | Introduced. |
wordpress wp_calculate_image_srcset( int[] $size_array, string $image_src, array $image_meta, int $attachment_id ): string|false wp\_calculate\_image\_srcset( int[] $size\_array, string $image\_src, array $image\_meta, int $attachment\_id ): string|false
=============================================================================================================================
A helper function to calculate the image sources to include in a ‘srcset’ attribute.
`$size_array` int[] Required An array of width and height values.
* intThe width in pixels.
* `1`intThe height in pixels.
`$image_src` string Required The `'src'` of the image. `$image_meta` array Required The image meta data as returned by '[wp\_get\_attachment\_metadata()](wp_get_attachment_metadata) '. `$attachment_id` int Optional The image attachment ID. Default 0. string|false The `'srcset'` attribute value. False on error or when only one source exists.
File: `wp-includes/media.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/media.php/)
```
function wp_calculate_image_srcset( $size_array, $image_src, $image_meta, $attachment_id = 0 ) {
/**
* Pre-filters the image meta to be able to fix inconsistencies in the stored data.
*
* @since 4.5.0
*
* @param array $image_meta The image meta data as returned by 'wp_get_attachment_metadata()'.
* @param int[] $size_array {
* An array of requested width and height values.
*
* @type int $0 The width in pixels.
* @type int $1 The height in pixels.
* }
* @param string $image_src The 'src' of the image.
* @param int $attachment_id The image attachment ID or 0 if not supplied.
*/
$image_meta = apply_filters( 'wp_calculate_image_srcset_meta', $image_meta, $size_array, $image_src, $attachment_id );
if ( empty( $image_meta['sizes'] ) || ! isset( $image_meta['file'] ) || strlen( $image_meta['file'] ) < 4 ) {
return false;
}
$image_sizes = $image_meta['sizes'];
// Get the width and height of the image.
$image_width = (int) $size_array[0];
$image_height = (int) $size_array[1];
// Bail early if error/no width.
if ( $image_width < 1 ) {
return false;
}
$image_basename = wp_basename( $image_meta['file'] );
/*
* WordPress flattens animated GIFs into one frame when generating intermediate sizes.
* To avoid hiding animation in user content, if src is a full size GIF, a srcset attribute is not generated.
* If src is an intermediate size GIF, the full size is excluded from srcset to keep a flattened GIF from becoming animated.
*/
if ( ! isset( $image_sizes['thumbnail']['mime-type'] ) || 'image/gif' !== $image_sizes['thumbnail']['mime-type'] ) {
$image_sizes[] = array(
'width' => $image_meta['width'],
'height' => $image_meta['height'],
'file' => $image_basename,
);
} elseif ( strpos( $image_src, $image_meta['file'] ) ) {
return false;
}
// Retrieve the uploads sub-directory from the full size image.
$dirname = _wp_get_attachment_relative_path( $image_meta['file'] );
if ( $dirname ) {
$dirname = trailingslashit( $dirname );
}
$upload_dir = wp_get_upload_dir();
$image_baseurl = trailingslashit( $upload_dir['baseurl'] ) . $dirname;
/*
* If currently on HTTPS, prefer HTTPS URLs when we know they're supported by the domain
* (which is to say, when they share the domain name of the current request).
*/
if ( is_ssl() && 'https' !== substr( $image_baseurl, 0, 5 ) && parse_url( $image_baseurl, PHP_URL_HOST ) === $_SERVER['HTTP_HOST'] ) {
$image_baseurl = set_url_scheme( $image_baseurl, 'https' );
}
/*
* Images that have been edited in WordPress after being uploaded will
* contain a unique hash. Look for that hash and use it later to filter
* out images that are leftovers from previous versions.
*/
$image_edited = preg_match( '/-e[0-9]{13}/', wp_basename( $image_src ), $image_edit_hash );
/**
* Filters the maximum image width to be included in a 'srcset' attribute.
*
* @since 4.4.0
*
* @param int $max_width The maximum image width to be included in the 'srcset'. Default '2048'.
* @param int[] $size_array {
* An array of requested width and height values.
*
* @type int $0 The width in pixels.
* @type int $1 The height in pixels.
* }
*/
$max_srcset_image_width = apply_filters( 'max_srcset_image_width', 2048, $size_array );
// Array to hold URL candidates.
$sources = array();
/**
* To make sure the ID matches our image src, we will check to see if any sizes in our attachment
* meta match our $image_src. If no matches are found we don't return a srcset to avoid serving
* an incorrect image. See #35045.
*/
$src_matched = false;
/*
* Loop through available images. Only use images that are resized
* versions of the same edit.
*/
foreach ( $image_sizes as $image ) {
$is_src = false;
// Check if image meta isn't corrupted.
if ( ! is_array( $image ) ) {
continue;
}
// If the file name is part of the `src`, we've confirmed a match.
if ( ! $src_matched && false !== strpos( $image_src, $dirname . $image['file'] ) ) {
$src_matched = true;
$is_src = true;
}
// Filter out images that are from previous edits.
if ( $image_edited && ! strpos( $image['file'], $image_edit_hash[0] ) ) {
continue;
}
/*
* Filters out images that are wider than '$max_srcset_image_width' unless
* that file is in the 'src' attribute.
*/
if ( $max_srcset_image_width && $image['width'] > $max_srcset_image_width && ! $is_src ) {
continue;
}
// If the image dimensions are within 1px of the expected size, use it.
if ( wp_image_matches_ratio( $image_width, $image_height, $image['width'], $image['height'] ) ) {
// Add the URL, descriptor, and value to the sources array to be returned.
$source = array(
'url' => $image_baseurl . $image['file'],
'descriptor' => 'w',
'value' => $image['width'],
);
// The 'src' image has to be the first in the 'srcset', because of a bug in iOS8. See #35030.
if ( $is_src ) {
$sources = array( $image['width'] => $source ) + $sources;
} else {
$sources[ $image['width'] ] = $source;
}
}
}
/**
* Filters an image's 'srcset' sources.
*
* @since 4.4.0
*
* @param array $sources {
* One or more arrays of source data to include in the 'srcset'.
*
* @type array $width {
* @type string $url The URL of an image source.
* @type string $descriptor The descriptor type used in the image candidate string,
* either 'w' or 'x'.
* @type int $value The source width if paired with a 'w' descriptor, or a
* pixel density value if paired with an 'x' descriptor.
* }
* }
* @param array $size_array {
* An array of requested width and height values.
*
* @type int $0 The width in pixels.
* @type int $1 The height in pixels.
* }
* @param string $image_src The 'src' of the image.
* @param array $image_meta The image meta data as returned by 'wp_get_attachment_metadata()'.
* @param int $attachment_id Image attachment ID or 0.
*/
$sources = apply_filters( 'wp_calculate_image_srcset', $sources, $size_array, $image_src, $image_meta, $attachment_id );
// Only return a 'srcset' value if there is more than one source.
if ( ! $src_matched || ! is_array( $sources ) || count( $sources ) < 2 ) {
return false;
}
$srcset = '';
foreach ( $sources as $source ) {
$srcset .= str_replace( ' ', '%20', $source['url'] ) . ' ' . $source['value'] . $source['descriptor'] . ', ';
}
return rtrim( $srcset, ', ' );
}
```
[apply\_filters( 'max\_srcset\_image\_width', int $max\_width, int[] $size\_array )](../hooks/max_srcset_image_width)
Filters the maximum image width to be included in a ‘srcset’ attribute.
[apply\_filters( 'wp\_calculate\_image\_srcset', array $sources, array $size\_array, string $image\_src, array $image\_meta, int $attachment\_id )](../hooks/wp_calculate_image_srcset)
Filters an image’s ‘srcset’ sources.
[apply\_filters( 'wp\_calculate\_image\_srcset\_meta', array $image\_meta, int[] $size\_array, string $image\_src, int $attachment\_id )](../hooks/wp_calculate_image_srcset_meta)
Pre-filters the image meta to be able to fix inconsistencies in the stored data.
| Uses | Description |
| --- | --- |
| [wp\_image\_matches\_ratio()](wp_image_matches_ratio) wp-includes/media.php | Helper function to test if aspect ratios for two images match. |
| [wp\_get\_upload\_dir()](wp_get_upload_dir) wp-includes/functions.php | Retrieves uploads directory information. |
| [\_wp\_get\_attachment\_relative\_path()](_wp_get_attachment_relative_path) wp-includes/media.php | Gets the attachment path relative to the upload directory. |
| [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. |
| [wp\_basename()](wp_basename) wp-includes/formatting.php | i18n-friendly version of basename(). |
| [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 |
| --- | --- |
| [get\_header\_image\_tag()](get_header_image_tag) wp-includes/theme.php | Creates image tag markup for a custom header image. |
| [wp\_image\_add\_srcset\_and\_sizes()](wp_image_add_srcset_and_sizes) wp-includes/media.php | Adds ‘srcset’ and ‘sizes’ attributes to an existing ‘img’ element. |
| [wp\_get\_attachment\_image\_srcset()](wp_get_attachment_image_srcset) wp-includes/media.php | Retrieves the value for an image attachment’s ‘srcset’ attribute. |
| [wp\_get\_attachment\_image()](wp_get_attachment_image) wp-includes/media.php | Gets an HTML img element representing an image attachment. |
| Version | Description |
| --- | --- |
| [4.4.0](https://developer.wordpress.org/reference/since/4.4.0/) | Introduced. |
| programming_docs |
wordpress _get_plugin_data_markup_translate( string $plugin_file, array $plugin_data, bool $markup = true, bool $translate = true ): array \_get\_plugin\_data\_markup\_translate( string $plugin\_file, array $plugin\_data, bool $markup = true, bool $translate = true ): 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. Use [get\_plugin\_data()](get_plugin_data) instead.
Sanitizes plugin data, optionally adds markup, optionally translates.
* [get\_plugin\_data()](get_plugin_data)
`$plugin_file` string Required Path to the main plugin file. `$plugin_data` array Required An array of plugin data. See [get\_plugin\_data()](get_plugin_data) . `$markup` bool Optional If the returned data should have HTML markup applied.
Default: `true`
`$translate` bool Optional If the returned data should be translated. Default: `true`
array Plugin data. Values will be empty if not supplied by the plugin.
See [get\_plugin\_data()](get_plugin_data) for the list of possible values.
File: `wp-admin/includes/plugin.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/plugin.php/)
```
function _get_plugin_data_markup_translate( $plugin_file, $plugin_data, $markup = true, $translate = true ) {
// Sanitize the plugin filename to a WP_PLUGIN_DIR relative path.
$plugin_file = plugin_basename( $plugin_file );
// Translate fields.
if ( $translate ) {
$textdomain = $plugin_data['TextDomain'];
if ( $textdomain ) {
if ( ! is_textdomain_loaded( $textdomain ) ) {
if ( $plugin_data['DomainPath'] ) {
load_plugin_textdomain( $textdomain, false, dirname( $plugin_file ) . $plugin_data['DomainPath'] );
} else {
load_plugin_textdomain( $textdomain, false, dirname( $plugin_file ) );
}
}
} elseif ( 'hello.php' === basename( $plugin_file ) ) {
$textdomain = 'default';
}
if ( $textdomain ) {
foreach ( array( 'Name', 'PluginURI', 'Description', 'Author', 'AuthorURI', 'Version' ) as $field ) {
if ( ! empty( $plugin_data[ $field ] ) ) {
// phpcs:ignore WordPress.WP.I18n.LowLevelTranslationFunction,WordPress.WP.I18n.NonSingularStringLiteralText,WordPress.WP.I18n.NonSingularStringLiteralDomain
$plugin_data[ $field ] = translate( $plugin_data[ $field ], $textdomain );
}
}
}
}
// Sanitize fields.
$allowed_tags_in_links = array(
'abbr' => array( 'title' => true ),
'acronym' => array( 'title' => true ),
'code' => true,
'em' => true,
'strong' => true,
);
$allowed_tags = $allowed_tags_in_links;
$allowed_tags['a'] = array(
'href' => true,
'title' => true,
);
// Name is marked up inside <a> tags. Don't allow these.
// Author is too, but some plugins have used <a> here (omitting Author URI).
$plugin_data['Name'] = wp_kses( $plugin_data['Name'], $allowed_tags_in_links );
$plugin_data['Author'] = wp_kses( $plugin_data['Author'], $allowed_tags );
$plugin_data['Description'] = wp_kses( $plugin_data['Description'], $allowed_tags );
$plugin_data['Version'] = wp_kses( $plugin_data['Version'], $allowed_tags );
$plugin_data['PluginURI'] = esc_url( $plugin_data['PluginURI'] );
$plugin_data['AuthorURI'] = esc_url( $plugin_data['AuthorURI'] );
$plugin_data['Title'] = $plugin_data['Name'];
$plugin_data['AuthorName'] = $plugin_data['Author'];
// Apply markup.
if ( $markup ) {
if ( $plugin_data['PluginURI'] && $plugin_data['Name'] ) {
$plugin_data['Title'] = '<a href="' . $plugin_data['PluginURI'] . '">' . $plugin_data['Name'] . '</a>';
}
if ( $plugin_data['AuthorURI'] && $plugin_data['Author'] ) {
$plugin_data['Author'] = '<a href="' . $plugin_data['AuthorURI'] . '">' . $plugin_data['Author'] . '</a>';
}
$plugin_data['Description'] = wptexturize( $plugin_data['Description'] );
if ( $plugin_data['Author'] ) {
$plugin_data['Description'] .= sprintf(
/* translators: %s: Plugin author. */
' <cite>' . __( 'By %s.' ) . '</cite>',
$plugin_data['Author']
);
}
}
return $plugin_data;
}
```
| Uses | Description |
| --- | --- |
| [is\_textdomain\_loaded()](is_textdomain_loaded) wp-includes/l10n.php | Determines whether there are translations for the text domain. |
| [load\_plugin\_textdomain()](load_plugin_textdomain) wp-includes/l10n.php | Loads a plugin’s translated strings. |
| [translate()](translate) wp-includes/l10n.php | Retrieves the translation of $text. |
| [wptexturize()](wptexturize) wp-includes/formatting.php | Replaces common plain text characters with formatted entities. |
| [wp\_kses()](wp_kses) wp-includes/kses.php | Filters text content and strips out disallowed HTML. |
| [plugin\_basename()](plugin_basename) wp-includes/plugin.php | Gets the basename of a plugin. |
| [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. |
| [esc\_url()](esc_url) wp-includes/formatting.php | Checks and cleans a URL. |
| Used By | Description |
| --- | --- |
| [WP\_REST\_Plugins\_Controller::prepare\_item\_for\_response()](../classes/wp_rest_plugins_controller/prepare_item_for_response) wp-includes/rest-api/endpoints/class-wp-rest-plugins-controller.php | Prepares the plugin for the REST response. |
| [WP\_Plugins\_List\_Table::prepare\_items()](../classes/wp_plugins_list_table/prepare_items) wp-admin/includes/class-wp-plugins-list-table.php | |
| [get\_plugin\_data()](get_plugin_data) wp-admin/includes/plugin.php | Parses the plugin contents to retrieve plugin’s metadata. |
| [list\_plugin\_updates()](list_plugin_updates) wp-admin/update-core.php | Display the upgrade plugins form. |
| Version | Description |
| --- | --- |
| [2.7.0](https://developer.wordpress.org/reference/since/2.7.0/) | Introduced. |
wordpress wp_link_category_checklist( int $link_id ) wp\_link\_category\_checklist( int $link\_id )
==============================================
Outputs a link category checklist element.
`$link_id` int Required File: `wp-admin/includes/template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/template.php/)
```
function wp_link_category_checklist( $link_id = 0 ) {
$default = 1;
$checked_categories = array();
if ( $link_id ) {
$checked_categories = wp_get_link_cats( $link_id );
// No selected categories, strange.
if ( ! count( $checked_categories ) ) {
$checked_categories[] = $default;
}
} else {
$checked_categories[] = $default;
}
$categories = get_terms(
array(
'taxonomy' => 'link_category',
'orderby' => 'name',
'hide_empty' => 0,
)
);
if ( empty( $categories ) ) {
return;
}
foreach ( $categories as $category ) {
$cat_id = $category->term_id;
/** This filter is documented in wp-includes/category-template.php */
$name = esc_html( apply_filters( 'the_category', $category->name, '', '' ) );
$checked = in_array( $cat_id, $checked_categories, true ) ? ' checked="checked"' : '';
echo '<li id="link-category-', $cat_id, '"><label for="in-link-category-', $cat_id, '" class="selectit"><input value="', $cat_id, '" type="checkbox" name="link_category[]" id="in-link-category-', $cat_id, '"', $checked, '/> ', $name, '</label></li>';
}
}
```
[apply\_filters( 'the\_category', string $thelist, string $separator, string $parents )](../hooks/the_category)
Filters the category or list of categories.
| 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\_terms()](get_terms) wp-includes/taxonomy.php | Retrieves the terms in a given taxonomy or list of taxonomies. |
| [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. |
| Used By | Description |
| --- | --- |
| [dropdown\_link\_categories()](dropdown_link_categories) wp-admin/includes/deprecated.php | Legacy function used to generate a link categories checklist control. |
| [link\_categories\_meta\_box()](link_categories_meta_box) wp-admin/includes/meta-boxes.php | Displays link categories form fields. |
| Version | Description |
| --- | --- |
| [2.5.1](https://developer.wordpress.org/reference/since/2.5.1/) | Introduced. |
wordpress wp_using_themes(): bool wp\_using\_themes(): bool
=========================
Determines whether the current request should use themes.
bool True if themes should be used, false otherwise.
File: `wp-includes/load.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/load.php/)
```
function wp_using_themes() {
/**
* Filters whether the current request should use themes.
*
* @since 5.1.0
*
* @param bool $wp_using_themes Whether the current request should use themes.
*/
return apply_filters( 'wp_using_themes', defined( 'WP_USE_THEMES' ) && WP_USE_THEMES );
}
```
[apply\_filters( 'wp\_using\_themes', bool $wp\_using\_themes )](../hooks/wp_using_themes)
Filters whether the current request should use themes.
| Uses | Description |
| --- | --- |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| Version | Description |
| --- | --- |
| [5.1.0](https://developer.wordpress.org/reference/since/5.1.0/) | Introduced. |
wordpress dropdown_link_categories( int $default_link_category ) dropdown\_link\_categories( int $default\_link\_category )
==========================================================
This function has been deprecated. Use [wp\_link\_category\_checklist()](wp_link_category_checklist) instead.
Legacy function used to generate a link categories checklist control.
* [wp\_link\_category\_checklist()](wp_link_category_checklist)
`$default_link_category` int Required Unused. File: `wp-admin/includes/deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/deprecated.php/)
```
function dropdown_link_categories( $default_link_category = 0 ) {
_deprecated_function( __FUNCTION__, '2.6.0', 'wp_link_category_checklist()' );
global $link_id;
wp_link_category_checklist( $link_id );
}
```
| Uses | Description |
| --- | --- |
| [wp\_link\_category\_checklist()](wp_link_category_checklist) wp-admin/includes/template.php | Outputs a link category checklist element. |
| [\_deprecated\_function()](_deprecated_function) wp-includes/functions.php | Marks a function as deprecated and inform when it has been used. |
| Version | Description |
| --- | --- |
| [2.6.0](https://developer.wordpress.org/reference/since/2.6.0/) | Use [wp\_link\_category\_checklist()](wp_link_category_checklist) |
| [2.1.0](https://developer.wordpress.org/reference/since/2.1.0/) | Introduced. |
wordpress _links_add_target( string $m ): string \_links\_add\_target( string $m ): 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 add a target attribute to all links in passed content.
`$m` string Required The matched link. string The processed link.
File: `wp-includes/formatting.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/formatting.php/)
```
function _links_add_target( $m ) {
global $_links_add_target;
$tag = $m[1];
$link = preg_replace( '|( target=([\'"])(.*?)\2)|i', '', $m[2] );
return '<' . $tag . $link . ' target="' . esc_attr( $_links_add_target ) . '">';
}
```
| Uses | Description |
| --- | --- |
| [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 _restore_wpautop_hook( string $content ): string \_restore\_wpautop\_hook( string $content ): 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.
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.
`$content` string Required The post content running through this filter. string The unmodified content.
File: `wp-includes/blocks.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/blocks.php/)
```
function _restore_wpautop_hook( $content ) {
$current_priority = has_filter( 'the_content', '_restore_wpautop_hook' );
add_filter( 'the_content', 'wpautop', $current_priority - 1 );
remove_filter( 'the_content', '_restore_wpautop_hook', $current_priority );
return $content;
}
```
| Uses | Description |
| --- | --- |
| [has\_filter()](has_filter) wp-includes/plugin.php | Checks if any filter has been registered for a hook. |
| [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.0.0](https://developer.wordpress.org/reference/since/5.0.0/) | Introduced. |
wordpress wp_cache_init() wp\_cache\_init()
=================
Sets up Object Cache Global and assigns it.
File: `wp-includes/cache.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/cache.php/)
```
function wp_cache_init() {
$GLOBALS['wp_object_cache'] = new WP_Object_Cache();
}
```
| Uses | Description |
| --- | --- |
| [WP\_Object\_Cache::\_\_construct()](../classes/wp_object_cache/__construct) wp-includes/class-wp-object-cache.php | Sets up object properties; PHP 5 style constructor. |
| Used By | Description |
| --- | --- |
| [wp\_start\_object\_cache()](wp_start_object_cache) wp-includes/load.php | Start the WordPress object cache. |
| [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) . |
| Version | Description |
| --- | --- |
| [2.0.0](https://developer.wordpress.org/reference/since/2.0.0/) | Introduced. |
wordpress esc_textarea( string $text ): string esc\_textarea( string $text ): string
=====================================
Escaping for textarea values.
`$text` string Required string
File: `wp-includes/formatting.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/formatting.php/)
```
function esc_textarea( $text ) {
$safe_text = htmlspecialchars( $text, ENT_QUOTES, get_option( 'blog_charset' ) );
/**
* Filters a string cleaned and escaped for output in a textarea element.
*
* @since 3.1.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_textarea', $safe_text, $text );
}
```
[apply\_filters( 'esc\_textarea', string $safe\_text, string $text )](../hooks/esc_textarea)
Filters a string cleaned and escaped for output in a textarea element.
| 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. |
| 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\_Widget\_Custom\_HTML::form()](../classes/wp_widget_custom_html/form) wp-includes/widgets/class-wp-widget-custom-html.php | Outputs the Custom HTML widget settings form. |
| [print\_embed\_sharing\_dialog()](print_embed_sharing_dialog) wp-includes/embed.php | Prints the necessary markup for the embed sharing dialog. |
| [network\_step2()](network_step2) wp-admin/includes/network.php | Prints step 2 for Network installation process. |
| [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. |
| [\_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. |
| [WP\_Comments\_List\_Table::column\_comment()](../classes/wp_comments_list_table/column_comment) wp-admin/includes/class-wp-comments-list-table.php | |
| [format\_to\_edit()](format_to_edit) wp-includes/formatting.php | Acts on text which is about to be edited. |
| [WP\_Widget\_Text::form()](../classes/wp_widget_text/form) wp-includes/widgets/class-wp-widget-text.php | Outputs the Text widget settings form. |
| [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 |
| --- | --- |
| [3.1.0](https://developer.wordpress.org/reference/since/3.1.0/) | Introduced. |
wordpress _count_posts_cache_key( string $type = 'post', string $perm = '' ): string \_count\_posts\_cache\_key( string $type = 'post', string $perm = '' ): 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 the cache key for [wp\_count\_posts()](wp_count_posts) based on the passed arguments.
`$type` string Optional Post type to retrieve count Default `'post'`. Default: `'post'`
`$perm` string Optional `'readable'` or empty. Default: `''`
string The cache key.
File: `wp-includes/post.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/post.php/)
```
function _count_posts_cache_key( $type = 'post', $perm = '' ) {
$cache_key = 'posts-' . $type;
if ( 'readable' === $perm && is_user_logged_in() ) {
$post_type_object = get_post_type_object( $type );
if ( $post_type_object && ! current_user_can( $post_type_object->cap->read_private_posts ) ) {
$cache_key .= '_' . $perm . '_' . get_current_user_id();
}
}
return $cache_key;
}
```
| Uses | Description |
| --- | --- |
| [current\_user\_can()](current_user_can) wp-includes/capabilities.php | Returns whether the current user has the specified capability. |
| [is\_user\_logged\_in()](is_user_logged_in) wp-includes/pluggable.php | Determines whether the current visitor is a logged in user. |
| [get\_current\_user\_id()](get_current_user_id) wp-includes/user.php | Gets the current user’s ID. |
| [get\_post\_type\_object()](get_post_type_object) wp-includes/post.php | Retrieves a post type object by name. |
| Used By | Description |
| --- | --- |
| [\_transition\_post\_status()](_transition_post_status) wp-includes/post.php | Hook for managing future post transitions to published. |
| [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. |
| Version | Description |
| --- | --- |
| [3.9.0](https://developer.wordpress.org/reference/since/3.9.0/) | Introduced. |
| programming_docs |
wordpress get_template(): string get\_template(): string
=======================
Retrieves name of the active theme.
string Template name.
This function retrieves the directory name of the current theme, without the trailing slash. In the case a child theme is being used, the directory name of the parent theme will be returned. Use [[get\_stylesheet()](get_stylesheet)](https://codex.wordpress.org/Function_Reference/get_stylesheet "Function Reference/get stylesheet") to get the directory name of the child theme.
File: `wp-includes/theme.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/theme.php/)
```
function get_template() {
/**
* Filters the name of the active theme.
*
* @since 1.5.0
*
* @param string $template active theme's directory name.
*/
return apply_filters( 'template', get_option( 'template' ) );
}
```
[apply\_filters( 'template', string $template )](../hooks/template)
Filters the name of the active theme.
| 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. |
| 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: |
| [\_get\_block\_template\_file()](_get_block_template_file) wp-includes/block-template-utils.php | Retrieves the template file from the theme for a given slug. |
| [\_get\_block\_templates\_files()](_get_block_templates_files) wp-includes/block-template-utils.php | Retrieves the template files from the theme. |
| [resolve\_block\_template()](resolve_block_template) wp-includes/block-template.php | Returns the correct ‘wp\_template’ to render for the request template type. |
| [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. |
| [is\_theme\_paused()](is_theme_paused) wp-admin/includes/theme.php | Determines whether a theme is technically active but was paused while loading. |
| [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. |
| [Theme\_Upgrader::bulk\_upgrade()](../classes/theme_upgrader/bulk_upgrade) wp-admin/includes/class-theme-upgrader.php | Upgrade several themes at once. |
| [get\_template\_directory()](get_template_directory) wp-includes/theme.php | Retrieves template directory path for the active theme. |
| [get\_template\_directory\_uri()](get_template_directory_uri) wp-includes/theme.php | Retrieves template directory URI for the active theme. |
| Version | Description |
| --- | --- |
| [1.5.0](https://developer.wordpress.org/reference/since/1.5.0/) | Introduced. |
wordpress wp_nav_menu_taxonomy_meta_boxes() wp\_nav\_menu\_taxonomy\_meta\_boxes()
======================================
Creates meta boxes for any taxonomy 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_taxonomy_meta_boxes() {
$taxonomies = get_taxonomies( array( 'show_in_nav_menus' => true ), 'object' );
if ( ! $taxonomies ) {
return;
}
foreach ( $taxonomies as $tax ) {
/** This filter is documented in wp-admin/includes/nav-menu.php */
$tax = apply_filters( 'nav_menu_meta_box_object', $tax );
if ( $tax ) {
$id = $tax->name;
add_meta_box( "add-{$id}", $tax->labels->name, 'wp_nav_menu_item_taxonomy_meta_box', 'nav-menus', 'side', 'default', $tax );
}
}
}
```
[apply\_filters( 'nav\_menu\_meta\_box\_object', WP\_Post\_Type|false $post\_type )](../hooks/nav_menu_meta_box_object)
Filters whether a menu items meta box will be added for the current object type.
| Uses | Description |
| --- | --- |
| [add\_meta\_box()](add_meta_box) wp-admin/includes/template.php | Adds a meta box to one or more screens. |
| [get\_taxonomies()](get_taxonomies) wp-includes/taxonomy.php | Retrieves a list of registered taxonomy names or objects. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| Used By | Description |
| --- | --- |
| [wp\_nav\_menu\_setup()](wp_nav_menu_setup) wp-admin/includes/nav-menu.php | Register nav menu meta boxes and advanced menu items. |
| Version | Description |
| --- | --- |
| [3.0.0](https://developer.wordpress.org/reference/since/3.0.0/) | Introduced. |
wordpress get_term_parents_list( int $term_id, string $taxonomy, string|array $args = array() ): string|WP_Error get\_term\_parents\_list( int $term\_id, string $taxonomy, string|array $args = array() ): string|WP\_Error
===========================================================================================================
Retrieves term parents with separator.
`$term_id` int Required Term ID. `$taxonomy` string Required Taxonomy name. `$args` string|array Optional Array of optional arguments.
* `format`stringUse term names or slugs for display. Accepts `'name'` or `'slug'`.
Default `'name'`.
* `separator`stringSeparator for between the terms. Default `'/'`.
* `link`boolWhether to format as a link. Default true.
* `inclusive`boolInclude the term to get the parents for. Default true.
Default: `array()`
string|[WP\_Error](../classes/wp_error) A list of term parents on success, [WP\_Error](../classes/wp_error) or empty string on failure.
File: `wp-includes/category-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/category-template.php/)
```
function get_term_parents_list( $term_id, $taxonomy, $args = array() ) {
$list = '';
$term = get_term( $term_id, $taxonomy );
if ( is_wp_error( $term ) ) {
return $term;
}
if ( ! $term ) {
return $list;
}
$term_id = $term->term_id;
$defaults = array(
'format' => 'name',
'separator' => '/',
'link' => true,
'inclusive' => true,
);
$args = wp_parse_args( $args, $defaults );
foreach ( array( 'link', 'inclusive' ) as $bool ) {
$args[ $bool ] = wp_validate_boolean( $args[ $bool ] );
}
$parents = get_ancestors( $term_id, $taxonomy, 'taxonomy' );
if ( $args['inclusive'] ) {
array_unshift( $parents, $term_id );
}
foreach ( array_reverse( $parents ) as $term_id ) {
$parent = get_term( $term_id, $taxonomy );
$name = ( 'slug' === $args['format'] ) ? $parent->slug : $parent->name;
if ( $args['link'] ) {
$list .= '<a href="' . esc_url( get_term_link( $parent->term_id, $taxonomy ) ) . '">' . $name . '</a>' . $args['separator'];
} else {
$list .= $name . $args['separator'];
}
}
return $list;
}
```
| Uses | Description |
| --- | --- |
| [wp\_validate\_boolean()](wp_validate_boolean) wp-includes/functions.php | Filters/validates a variable as a boolean. |
| [get\_ancestors()](get_ancestors) wp-includes/taxonomy.php | Gets an array of ancestor IDs for a given object. |
| [get\_term\_link()](get_term_link) wp-includes/taxonomy.php | Generates a permalink for a taxonomy term archive. |
| [esc\_url()](esc_url) wp-includes/formatting.php | Checks and cleans a URL. |
| [wp\_parse\_args()](wp_parse_args) wp-includes/functions.php | Merges user defined arguments into defaults array. |
| [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 |
| --- | --- |
| [get\_category\_parents()](get_category_parents) wp-includes/category-template.php | Retrieves category parents with separator. |
| Version | Description |
| --- | --- |
| [4.8.0](https://developer.wordpress.org/reference/since/4.8.0/) | Introduced. |
wordpress wp_filter_wp_template_unique_post_slug( string $override_slug, string $slug, int $post_ID, string $post_status, string $post_type ): string wp\_filter\_wp\_template\_unique\_post\_slug( string $override\_slug, string $slug, int $post\_ID, string $post\_status, string $post\_type ): 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.
Generates a unique slug for templates.
`$override_slug` string Required The filtered value of the slug (starts as `null` from apply\_filter). `$slug` string Required The original/un-filtered slug (post\_name). `$post_ID` int Required Post ID. `$post_status` string Required No uniqueness checks are made if the post is still draft or pending. `$post_type` string Required Post type. string The original, desired slug.
File: `wp-includes/theme-templates.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/theme-templates.php/)
```
function wp_filter_wp_template_unique_post_slug( $override_slug, $slug, $post_ID, $post_status, $post_type ) {
if ( 'wp_template' !== $post_type && 'wp_template_part' !== $post_type ) {
return $override_slug;
}
if ( ! $override_slug ) {
$override_slug = $slug;
}
/*
* Template slugs must be unique within the same theme.
* TODO - Figure out how to update this to work for a multi-theme environment.
* Unfortunately using `get_the_terms()` for the 'wp-theme' term does not work
* in the case of new entities since is too early in the process to have been saved
* to the entity. So for now we use the currently activated theme for creation.
*/
$theme = wp_get_theme()->get_stylesheet();
$terms = get_the_terms( $post_ID, 'wp_theme' );
if ( $terms && ! is_wp_error( $terms ) ) {
$theme = $terms[0]->name;
}
$check_query_args = array(
'post_name__in' => array( $override_slug ),
'post_type' => $post_type,
'posts_per_page' => 1,
'no_found_rows' => true,
'post__not_in' => array( $post_ID ),
'tax_query' => array(
array(
'taxonomy' => 'wp_theme',
'field' => 'name',
'terms' => $theme,
),
),
);
$check_query = new WP_Query( $check_query_args );
$posts = $check_query->posts;
if ( count( $posts ) > 0 ) {
$suffix = 2;
do {
$query_args = $check_query_args;
$alt_post_name = _truncate_post_slug( $override_slug, 200 - ( strlen( $suffix ) + 1 ) ) . "-$suffix";
$query_args['post_name__in'] = array( $alt_post_name );
$query = new WP_Query( $query_args );
$suffix++;
} while ( count( $query->posts ) > 0 );
$override_slug = $alt_post_name;
}
return $override_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. |
| [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. |
| [\_truncate\_post\_slug()](_truncate_post_slug) wp-includes/post.php | Truncates a post slug. |
| [wp\_get\_theme()](wp_get_theme) wp-includes/theme.php | Gets a [WP\_Theme](../classes/wp_theme) object for a theme. |
| [is\_wp\_error()](is_wp_error) wp-includes/load.php | Checks whether the given variable is a WordPress Error. |
| Version | Description |
| --- | --- |
| [5.8.0](https://developer.wordpress.org/reference/since/5.8.0/) | Introduced. |
wordpress _deprecated_function( string $function, string $version, string $replacement = '' ) \_deprecated\_function( string $function, string $version, string $replacement = '' )
=====================================================================================
Marks a function as deprecated and inform when it has been used.
There is a hook [‘deprecated\_function\_run’](../hooks/deprecated_function_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.
This function is to be used in every function that is deprecated.
`$function` string Required The function that was called. `$version` string Required The version of WordPress that deprecated the function. `$replacement` string Optional The function that should have been called. Default: `''`
File: `wp-includes/functions.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/functions.php/)
```
function _deprecated_function( $function, $version, $replacement = '' ) {
/**
* Fires when a deprecated function is called.
*
* @since 2.5.0
*
* @param string $function The function that was called.
* @param string $replacement The function that should have been called.
* @param string $version The version of WordPress that deprecated the function.
*/
do_action( 'deprecated_function_run', $function, $replacement, $version );
/**
* Filters whether to trigger an error for deprecated functions.
*
* @since 2.5.0
*
* @param bool $trigger Whether to trigger the error for deprecated functions. Default true.
*/
if ( WP_DEBUG && apply_filters( 'deprecated_function_trigger_error', true ) ) {
if ( function_exists( '__' ) ) {
if ( $replacement ) {
trigger_error(
sprintf(
/* translators: 1: PHP function name, 2: Version number, 3: Alternative function name. */
__( 'Function %1$s is <strong>deprecated</strong> since version %2$s! Use %3$s instead.' ),
$function,
$version,
$replacement
),
E_USER_DEPRECATED
);
} else {
trigger_error(
sprintf(
/* translators: 1: PHP function name, 2: Version number. */
__( 'Function %1$s is <strong>deprecated</strong> since version %2$s with no alternative available.' ),
$function,
$version
),
E_USER_DEPRECATED
);
}
} else {
if ( $replacement ) {
trigger_error(
sprintf(
'Function %1$s is <strong>deprecated</strong> since version %2$s! Use %3$s instead.',
$function,
$version,
$replacement
),
E_USER_DEPRECATED
);
} else {
trigger_error(
sprintf(
'Function %1$s is <strong>deprecated</strong> since version %2$s with no alternative available.',
$function,
$version
),
E_USER_DEPRECATED
);
}
}
}
}
```
[do\_action( 'deprecated\_function\_run', string $function, string $replacement, string $version )](../hooks/deprecated_function_run)
Fires when a deprecated function is called.
[apply\_filters( 'deprecated\_function\_trigger\_error', bool $trigger )](../hooks/deprecated_function_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 |
| --- | --- |
| [wp\_typography\_get\_css\_variable\_inline\_style()](wp_typography_get_css_variable_inline_style) wp-includes/deprecated.php | Generates an inline style for a typography feature e.g. text decoration, text transform, and font style. |
| [wp\_skip\_spacing\_serialization()](wp_skip_spacing_serialization) wp-includes/deprecated.php | Checks whether serialization of the current block’s spacing properties should occur. |
| [wp\_render\_duotone\_filter\_preset()](wp_render_duotone_filter_preset) wp-includes/deprecated.php | Renders the duotone filter SVG and returns the CSS filter property to reference the rendered SVG. |
| [wp\_skip\_border\_serialization()](wp_skip_border_serialization) wp-includes/deprecated.php | Checks whether serialization of the current block’s border properties should occur. |
| [wp\_skip\_dimensions\_serialization()](wp_skip_dimensions_serialization) wp-includes/deprecated.php | Checks whether serialization of the current block’s dimensions properties should occur. |
| [WP\_Theme\_JSON::should\_override\_preset()](../classes/wp_theme_json/should_override_preset) wp-includes/class-wp-theme-json.php | Determines whether a presets should be overridden or not. |
| [\_wp\_multiple\_block\_styles()](_wp_multiple_block_styles) wp-includes/deprecated.php | Allows multiple block styles. |
| [WP\_Theme\_JSON\_Resolver::get\_fields\_to\_translate()](../classes/wp_theme_json_resolver/get_fields_to_translate) wp-includes/class-wp-theme-json-resolver.php | Returns a data structure used in theme.json translation. |
| [wp\_add\_iframed\_editor\_assets\_html()](wp_add_iframed_editor_assets_html) wp-includes/deprecated.php | Inject the block editor assets that need to be loaded into the editor’s iframe as an inline script. |
| [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\_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\_Privacy\_Data\_Export\_Requests\_Table::\_\_construct()](../classes/wp_privacy_data_export_requests_table/__construct) wp-admin/includes/deprecated.php | |
| [WP\_Privacy\_Data\_Removal\_Requests\_Table::\_\_construct()](../classes/wp_privacy_data_removal_requests_table/__construct) wp-admin/includes/deprecated.php | |
| [\_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. |
| [wp\_sensitive\_page\_meta()](wp_sensitive_page_meta) wp-includes/deprecated.php | Display a `noindex,noarchive` meta tag and referrer `strict-origin-when-cross-origin` meta tag. |
| [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\_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\_get\_user\_request\_data()](wp_get_user_request_data) wp-includes/deprecated.php | Return the user request object for the specified request ID. |
| [\_wp\_privacy\_requests\_screen\_options()](_wp_privacy_requests_screen_options) wp-admin/includes/deprecated.php | Was used to add options for the privacy requests screens before they were separate files. |
| [readonly()](readonly) wp-includes/php-compat/readonly.php | Outputs the HTML readonly attribute. |
| [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\_Customize\_New\_Menu\_Section::\_\_construct()](../classes/wp_customize_new_menu_section/__construct) wp-includes/customize/class-wp-customize-new-menu-section.php | Constructor. |
| [WP\_Customize\_New\_Menu\_Control::\_\_construct()](../classes/wp_customize_new_menu_control/__construct) wp-includes/customize/class-wp-customize-new-menu-control.php | Constructor. |
| [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::maybe\_log\_events\_response()](../classes/wp_community_events/maybe_log_events_response) wp-admin/includes/class-wp-community-events.php | Logs responses to Events API requests. |
| [\_get\_path\_to\_translation()](_get_path_to_translation) wp-includes/deprecated.php | Gets the path to a translation file for loading a textdomain just in time. |
| [\_get\_path\_to\_translation\_from\_lang\_dir()](_get_path_to_translation_from_lang_dir) wp-includes/deprecated.php | Gets the path to a translation file in the languages directory for the current locale. |
| [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. |
| [\_filter\_query\_attachment\_filenames()](_filter_query_attachment_filenames) wp-includes/deprecated.php | Filter the SQL clauses of an attachment query to include filenames. |
| [\_wp\_register\_meta\_args\_whitelist()](_wp_register_meta_args_whitelist) wp-includes/deprecated.php | Filters out `register_meta()` args based on an allowed list. |
| [WP\_Query::lazyload\_term\_meta()](../classes/wp_query/lazyload_term_meta) wp-includes/class-wp-query.php | Lazyload term meta for posts in the loop. |
| [WP\_Query::lazyload\_comment\_meta()](../classes/wp_query/lazyload_comment_meta) wp-includes/class-wp-query.php | Lazyload comment meta for comments in the loop. |
| [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. |
| [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\_Setting::\_sort\_menus\_by\_orderby()](../classes/wp_customize_nav_menu_setting/_sort_menus_by_orderby) wp-includes/customize/class-wp-customize-nav-menu-setting.php | Sort menu objects by the class-supplied orderby property. |
| [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. |
| [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\_User\_Search::\_\_construct()](../classes/wp_user_search/__construct) wp-admin/includes/deprecated.php | PHP5 Constructor – Sets up the object properties. |
| [the\_meta()](the_meta) wp-includes/post-template.php | Displays a list of post custom fields. |
| [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\_press\_this\_save\_post()](wp_ajax_press_this_save_post) wp-includes/deprecated.php | Ajax handler for saving a post from Press This. |
| [WP\_Http::parse\_url()](../classes/wp_http/parse_url) wp-includes/class-wp-http.php | Used as a wrapper for PHP’s parse\_url() function that handles edgecases in < PHP 5.4.7. |
| [WP\_Customize\_Manager::customize\_preview\_override\_404\_status()](../classes/wp_customize_manager/customize_preview_override_404_status) wp-includes/class-wp-customize-manager.php | Prevents sending a 404 status when returning the response for the customize preview, since it causes the jQuery Ajax to fail. Send 200 instead. |
| [post\_form\_autocomplete\_off()](post_form_autocomplete_off) wp-admin/includes/deprecated.php | Disables autocomplete on the ‘post’ form (Add/Edit Post screens) for WebKit browsers, as they disregard the autocomplete setting on the editor textarea. That can break the editor when the user navigates to it with the browser’s Back button. See #28037 |
| [logIO()](logio) xmlrpc.php | [logIO()](logio) – Writes logging info to a file. |
| [\_relocate\_children()](_relocate_children) wp-admin/includes/deprecated.php | This was once used to move child posts to a new parent. |
| [get\_post\_to\_edit()](get_post_to_edit) wp-admin/includes/deprecated.php | Gets an existing post and format it for editing. |
| [get\_default\_page\_to\_edit()](get_default_page_to_edit) wp-admin/includes/deprecated.php | Gets the default page information to use. |
| [wp\_create\_thumbnail()](wp_create_thumbnail) wp-admin/includes/deprecated.php | This was once used to create a thumbnail from an Image given a maximum side size. |
| [wp\_nav\_menu\_locations\_meta\_box()](wp_nav_menu_locations_meta_box) wp-admin/includes/deprecated.php | This was once used to display a meta box for the nav menu theme locations. |
| [wp\_update\_core()](wp_update_core) wp-admin/includes/deprecated.php | This was once used to kick-off the Core Updater. |
| [wp\_update\_plugin()](wp_update_plugin) wp-admin/includes/deprecated.php | This was once used to kick-off the Plugin Updater. |
| [wp\_update\_theme()](wp_update_theme) wp-admin/includes/deprecated.php | This was once used to kick-off the Theme Updater. |
| [the\_attachment\_links()](the_attachment_links) wp-admin/includes/deprecated.php | This was once used to display attachment links. Now it is deprecated and stubbed. |
| [screen\_icon()](screen_icon) wp-admin/includes/deprecated.php | Displays a screen icon. |
| [get\_screen\_icon()](get_screen_icon) wp-admin/includes/deprecated.php | Retrieves the screen icon (no longer used in 3.8+). |
| [wp\_print\_editor\_js()](wp_print_editor_js) wp-admin/includes/deprecated.php | Prints TinyMCE editor JS. |
| [wp\_quicktags()](wp_quicktags) wp-admin/includes/deprecated.php | Handles quicktags. |
| [screen\_layout()](screen_layout) wp-admin/includes/deprecated.php | Returns the screen layout options. |
| [screen\_options()](screen_options) wp-admin/includes/deprecated.php | Returns the screen’s per-page options. |
| [favorite\_actions()](favorite_actions) wp-admin/includes/deprecated.php | Favorite actions were deprecated in version 3.2. Use the admin bar instead. |
| [media\_upload\_image()](media_upload_image) wp-admin/includes/deprecated.php | Handles uploading an image. |
| [media\_upload\_audio()](media_upload_audio) wp-admin/includes/deprecated.php | Handles uploading an audio file. |
| [media\_upload\_video()](media_upload_video) wp-admin/includes/deprecated.php | Handles uploading a video file. |
| [media\_upload\_file()](media_upload_file) wp-admin/includes/deprecated.php | Handles uploading a generic file. |
| [type\_url\_form\_image()](type_url_form_image) wp-admin/includes/deprecated.php | Handles retrieving the insert-from-URL form for an image. |
| [type\_url\_form\_audio()](type_url_form_audio) wp-admin/includes/deprecated.php | Handles retrieving the insert-from-URL form for an audio file. |
| [type\_url\_form\_video()](type_url_form_video) wp-admin/includes/deprecated.php | Handles retrieving the insert-from-URL form for a video file. |
| [type\_url\_form\_file()](type_url_form_file) wp-admin/includes/deprecated.php | Handles retrieving the insert-from-URL form for a generic file. |
| [add\_contextual\_help()](add_contextual_help) wp-admin/includes/deprecated.php | Add contextual help text for a page. |
| [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. |
| [current\_theme\_info()](current_theme_info) wp-admin/includes/deprecated.php | Retrieves information on the current active theme. |
| [\_insert\_into\_post\_button()](_insert_into_post_button) wp-admin/includes/deprecated.php | This was once used to display an ‘Insert into Post’ button. |
| [\_media\_button()](_media_button) wp-admin/includes/deprecated.php | This was once used to display a media button. |
| [dropdown\_categories()](dropdown_categories) wp-admin/includes/deprecated.php | Legacy function used to generate the categories checklist control. |
| [dropdown\_link\_categories()](dropdown_link_categories) wp-admin/includes/deprecated.php | Legacy function used to generate a link categories checklist control. |
| [get\_real\_file\_to\_edit()](get_real_file_to_edit) wp-admin/includes/deprecated.php | Get the real filesystem path to a file to edit within the admin. |
| [wp\_dropdown\_cats()](wp_dropdown_cats) wp-admin/includes/deprecated.php | Legacy function used for generating a categories drop-down control. |
| [add\_option\_update\_handler()](add_option_update_handler) wp-admin/includes/deprecated.php | Register a setting and its sanitization callback |
| [remove\_option\_update\_handler()](remove_option_update_handler) wp-admin/includes/deprecated.php | Unregister a setting |
| [codepress\_get\_lang()](codepress_get_lang) wp-admin/includes/deprecated.php | Determines the language to use for CodePress syntax highlighting. |
| [codepress\_footer\_js()](codepress_footer_js) wp-admin/includes/deprecated.php | Adds JavaScript required to make CodePress work on the theme/plugin file editors. |
| [use\_codepress()](use_codepress) wp-admin/includes/deprecated.php | Determine whether to use CodePress. |
| [get\_author\_user\_ids()](get_author_user_ids) wp-admin/includes/deprecated.php | Get all user IDs. |
| [get\_editable\_authors()](get_editable_authors) wp-admin/includes/deprecated.php | Gets author users who can edit posts. |
| [get\_editable\_user\_ids()](get_editable_user_ids) wp-admin/includes/deprecated.php | Gets the IDs of any users who can edit posts. |
| [get\_nonauthor\_user\_ids()](get_nonauthor_user_ids) wp-admin/includes/deprecated.php | Gets all users who are not authors. |
| [get\_others\_unpublished\_posts()](get_others_unpublished_posts) wp-admin/includes/deprecated.php | Retrieves editable posts from other users. |
| [get\_others\_drafts()](get_others_drafts) wp-admin/includes/deprecated.php | Retrieve drafts from other users. |
| [get\_others\_pending()](get_others_pending) wp-admin/includes/deprecated.php | Retrieve pending review posts from other users. |
| [wp\_dashboard\_quick\_press\_output()](wp_dashboard_quick_press_output) wp-admin/includes/deprecated.php | Output the QuickPress dashboard widget. |
| [wp\_tiny\_mce()](wp_tiny_mce) wp-admin/includes/deprecated.php | Outputs the TinyMCE editor. |
| [wp\_preload\_dialogs()](wp_preload_dialogs) wp-admin/includes/deprecated.php | Preloads TinyMCE dialogs. |
| [install\_themes\_feature\_list()](install_themes_feature_list) wp-admin/includes/theme-install.php | Retrieves the list of WordPress theme features (aka theme tags). |
| [display\_theme()](display_theme) wp-admin/includes/theme-install.php | Prints a theme on the Install Themes pages. |
| [tinymce\_include()](tinymce_include) wp-admin/includes/deprecated.php | |
| [documentation\_link()](documentation_link) wp-admin/includes/deprecated.php | Unused Admin function. |
| [wp\_shrink\_dimensions()](wp_shrink_dimensions) wp-admin/includes/deprecated.php | Calculates the new dimensions for a downsampled image. |
| [get\_udims()](get_udims) wp-admin/includes/deprecated.php | Calculated the new dimensions for a downsampled image. |
| [sync\_category\_tag\_slugs()](sync_category_tag_slugs) wp-admin/includes/ms-deprecated.php | Synchronizes category and post tag slugs when global terms are enabled. |
| [update\_user\_status()](update_user_status) wp-includes/ms-deprecated.php | Update the status of a user in the database. |
| [WP\_Filesystem\_Base::find\_base\_dir()](../classes/wp_filesystem_base/find_base_dir) wp-admin/includes/class-wp-filesystem-base.php | Locates a folder on the remote filesystem. |
| [WP\_Filesystem\_Base::get\_base\_dir()](../classes/wp_filesystem_base/get_base_dir) wp-admin/includes/class-wp-filesystem-base.php | Locates a folder on the remote filesystem. |
| [wp\_dashboard\_plugins\_output()](wp_dashboard_plugins_output) wp-admin/includes/deprecated.php | Display plugins text for the WordPress news widget. |
| [install\_global\_terms()](install_global_terms) wp-admin/includes/ms-deprecated.php | Install global terms. |
| [add\_option\_whitelist()](add_option_whitelist) wp-includes/deprecated.php | Adds an array of options to the list of allowed options. |
| [remove\_option\_whitelist()](remove_option_whitelist) wp-includes/deprecated.php | Removes a list of options from the allowed options list. |
| [add\_object\_page()](add_object_page) wp-admin/includes/deprecated.php | Add a top-level menu page in the ‘objects’ section. |
| [add\_utility\_page()](add_utility_page) wp-admin/includes/deprecated.php | Add a top-level menu page in the ‘utility’ section. |
| [image\_attachment\_fields\_to\_save()](image_attachment_fields_to_save) wp-admin/includes/deprecated.php | Was used to filter input from [media\_upload\_form\_handler()](media_upload_form_handler) and to assign a default post\_title from the file name if none supplied. |
| [wpmu\_menu()](wpmu_menu) wp-admin/includes/ms-deprecated.php | Outputs the WPMU menu. |
| [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. |
| [mu\_options()](mu_options) wp-admin/includes/ms-deprecated.php | WPMU options. |
| [activate\_sitewide\_plugin()](activate_sitewide_plugin) wp-admin/includes/ms-deprecated.php | Deprecated functionality for activating a network-only plugin. |
| [deactivate\_sitewide\_plugin()](deactivate_sitewide_plugin) wp-admin/includes/ms-deprecated.php | Deprecated functionality for deactivating a network-only plugin. |
| [is\_wpmu\_sitewide\_plugin()](is_wpmu_sitewide_plugin) wp-admin/includes/ms-deprecated.php | Deprecated functionality for determining if the current plugin is network-only. |
| [get\_site\_allowed\_themes()](get_site_allowed_themes) wp-admin/includes/ms-deprecated.php | Deprecated functionality for getting themes network-enabled themes. |
| [wpmu\_get\_blog\_allowedthemes()](wpmu_get_blog_allowedthemes) wp-admin/includes/ms-deprecated.php | Deprecated functionality for getting themes allowed on a specific site. |
| [WP\_User::for\_blog()](../classes/wp_user/for_blog) wp-includes/class-wp-user.php | Sets the site to operate on. Defaults to the current site. |
| [WP\_User::\_init\_caps()](../classes/wp_user/_init_caps) wp-includes/class-wp-user.php | Sets up capability object properties. |
| [WP\_Roles::\_init()](../classes/wp_roles/_init) wp-includes/class-wp-roles.php | Sets up the object properties. |
| [WP\_Roles::reinit()](../classes/wp_roles/reinit) wp-includes/class-wp-roles.php | Reinitializes the object. |
| [WP\_Customize\_Manager::\_cmp\_priority()](../classes/wp_customize_manager/_cmp_priority) wp-includes/class-wp-customize-manager.php | Helper function to compare two objects by priority, ensuring sort stability via instance\_number. |
| [WP\_Customize\_Manager::customize\_preview\_base()](../classes/wp_customize_manager/customize_preview_base) wp-includes/class-wp-customize-manager.php | Prints base element for preview frame. |
| [WP\_Customize\_Manager::customize\_preview\_html5()](../classes/wp_customize_manager/customize_preview_html5) wp-includes/class-wp-customize-manager.php | Prints a workaround to handle HTML5 tags in IE < 9. |
| [WP\_Customize\_Manager::customize\_preview\_signature()](../classes/wp_customize_manager/customize_preview_signature) wp-includes/class-wp-customize-manager.php | Prints a signature so we can ensure the Customizer was properly executed. |
| [WP\_Customize\_Manager::remove\_preview\_signature()](../classes/wp_customize_manager/remove_preview_signature) wp-includes/class-wp-customize-manager.php | Removes the signature in case we experience a case where the Customizer was not properly executed. |
| [WP\_Customize\_Manager::wp\_die\_handler()](../classes/wp_customize_manager/wp_die_handler) wp-includes/class-wp-customize-manager.php | Returns the Ajax [wp\_die()](wp_die) handler if it’s a customized request. |
| [WP\_Customize\_Manager::wp\_redirect\_status()](../classes/wp_customize_manager/wp_redirect_status) wp-includes/class-wp-customize-manager.php | Prevents Ajax requests from following redirects when previewing a theme by issuing a 200 response instead of a 30x. |
| [WP\_Object\_Cache::reset()](../classes/wp_object_cache/reset) wp-includes/class-wp-object-cache.php | Resets cache keys. |
| [wp\_cache\_reset()](wp_cache_reset) wp-includes/cache.php | Resets internal cache keys and structures. |
| [\_usort\_terms\_by\_ID()](_usort_terms_by_id) wp-includes/deprecated.php | Sort categories by ID. |
| [\_usort\_terms\_by\_name()](_usort_terms_by_name) wp-includes/deprecated.php | Sort categories by name. |
| [preview\_theme()](preview_theme) wp-includes/deprecated.php | Start preview theme output buffer. |
| [\_preview\_theme\_template\_filter()](_preview_theme_template_filter) wp-includes/deprecated.php | Private function to modify the current template when previewing a theme |
| [\_preview\_theme\_stylesheet\_filter()](_preview_theme_stylesheet_filter) wp-includes/deprecated.php | Private function to modify the current stylesheet when previewing a theme |
| [preview\_theme\_ob\_filter()](preview_theme_ob_filter) wp-includes/deprecated.php | Callback function for ob\_start() to capture all links in the theme. |
| [preview\_theme\_ob\_filter\_callback()](preview_theme_ob_filter_callback) wp-includes/deprecated.php | Manipulates preview theme links in order to control and maintain location. |
| [like\_escape()](like_escape) wp-includes/deprecated.php | Formerly used to escape strings before searching the DB. It was poorly documented and never worked as described. |
| [wp\_htmledit\_pre()](wp_htmledit_pre) wp-includes/deprecated.php | Formats text for the HTML editor. |
| [wp\_richedit\_pre()](wp_richedit_pre) wp-includes/deprecated.php | Formats text for the rich text editor. |
| [popuplinks()](popuplinks) wp-includes/deprecated.php | Adds element attributes to open links in new tabs. |
| [get\_currentuserinfo()](get_currentuserinfo) wp-includes/pluggable-deprecated.php | Populate global variables with information about the currently logged in user. |
| [noindex()](noindex) wp-includes/deprecated.php | Displays a `noindex` meta tag if required by the blog configuration. |
| [wp\_no\_robots()](wp_no_robots) wp-includes/deprecated.php | Display a `noindex` meta tag. |
| [gd\_edit\_image\_support()](gd_edit_image_support) wp-includes/deprecated.php | Check if the installed version of GD supports particular image type |
| [wp\_convert\_bytes\_to\_hr()](wp_convert_bytes_to_hr) wp-includes/deprecated.php | Converts an integer byte value to a shorthand byte value. |
| [\_search\_terms\_tidy()](_search_terms_tidy) wp-includes/deprecated.php | Formerly used internally to tidy up the search terms. |
| [rich\_edit\_exists()](rich_edit_exists) wp-includes/deprecated.php | Determine if TinyMCE is available. |
| [format\_to\_post()](format_to_post) wp-includes/deprecated.php | Formerly used to escape strings before inserting into the DB. |
| [clean\_pre()](clean_pre) wp-includes/deprecated.php | Accepts matches array from preg\_replace\_callback in [wpautop()](wpautop) or a string. |
| [add\_custom\_image\_header()](add_custom_image_header) wp-includes/deprecated.php | Add callbacks for image header display. |
| [remove\_custom\_image\_header()](remove_custom_image_header) wp-includes/deprecated.php | Remove image header support. |
| [add\_custom\_background()](add_custom_background) wp-includes/deprecated.php | Add callbacks for background image display. |
| [remove\_custom\_background()](remove_custom_background) wp-includes/deprecated.php | Remove custom background support. |
| [get\_theme\_data()](get_theme_data) wp-includes/deprecated.php | Retrieve theme data from parsed theme file. |
| [update\_page\_cache()](update_page_cache) wp-includes/deprecated.php | Alias of [update\_post\_cache()](update_post_cache) . |
| [clean\_page\_cache()](clean_page_cache) wp-includes/deprecated.php | Will clean the page in the cache. |
| [wp\_explain\_nonce()](wp_explain_nonce) wp-includes/deprecated.php | Retrieve nonce action “Are you sure” message. |
| [sticky\_class()](sticky_class) wp-includes/deprecated.php | Display “sticky” CSS class, if a post is sticky. |
| [\_get\_post\_ancestors()](_get_post_ancestors) wp-includes/deprecated.php | Retrieve post ancestors. |
| [wp\_load\_image()](wp_load_image) wp-includes/deprecated.php | Load an image from a string, if PHP supports it. |
| [image\_resize()](image_resize) wp-includes/deprecated.php | Scale down an image to fit a particular size and save a new copy of the image. |
| [wp\_get\_single\_post()](wp_get_single_post) wp-includes/deprecated.php | Retrieve a single post, based on post ID. |
| [user\_pass\_ok()](user_pass_ok) wp-includes/deprecated.php | Check that the user login name and password is correct. |
| [get\_user\_metavalues()](get_user_metavalues) wp-includes/deprecated.php | Perform the query to get the $metavalues array(s) needed by \_fill\_user and \_fill\_many\_users |
| [sanitize\_user\_object()](sanitize_user_object) wp-includes/deprecated.php | Sanitize every user field. |
| [get\_boundary\_post\_rel\_link()](get_boundary_post_rel_link) wp-includes/deprecated.php | Get boundary post relational link. |
| [start\_post\_rel\_link()](start_post_rel_link) wp-includes/deprecated.php | Display relational link for the first post. |
| [get\_index\_rel\_link()](get_index_rel_link) wp-includes/deprecated.php | Get site index relational link. |
| [index\_rel\_link()](index_rel_link) wp-includes/deprecated.php | Display relational link for the site index. |
| [get\_parent\_post\_rel\_link()](get_parent_post_rel_link) wp-includes/deprecated.php | Get parent post relational link. |
| [parent\_post\_rel\_link()](parent_post_rel_link) wp-includes/deprecated.php | Display relational link for parent item |
| [wp\_admin\_bar\_dashboard\_view\_site\_menu()](wp_admin_bar_dashboard_view_site_menu) wp-includes/deprecated.php | Add the “Dashboard”/”Visit Site” menu. |
| [is\_blog\_user()](is_blog_user) wp-includes/deprecated.php | Checks if the current user belong to a given site. |
| [debug\_fopen()](debug_fopen) wp-includes/deprecated.php | Open the file handle for debugging. |
| [debug\_fwrite()](debug_fwrite) wp-includes/deprecated.php | Write contents to the file used for debugging. |
| [debug\_fclose()](debug_fclose) wp-includes/deprecated.php | Close the debugging file handle. |
| [get\_themes()](get_themes) wp-includes/deprecated.php | Retrieve list of themes with theme data in theme directory. |
| [get\_theme()](get_theme) wp-includes/deprecated.php | Retrieve theme data. |
| [get\_current\_theme()](get_current_theme) wp-includes/deprecated.php | Retrieve current theme name. |
| [register\_widget\_control()](register_widget_control) wp-includes/deprecated.php | Registers widget control callback for customizing options. |
| [unregister\_widget\_control()](unregister_widget_control) wp-includes/deprecated.php | Alias of [wp\_unregister\_widget\_control()](wp_unregister_widget_control) . |
| [delete\_usermeta()](delete_usermeta) wp-includes/deprecated.php | Remove user meta data. |
| [get\_usermeta()](get_usermeta) wp-includes/deprecated.php | Retrieve user metadata. |
| [update\_usermeta()](update_usermeta) wp-includes/deprecated.php | Update metadata of user. |
| [get\_users\_of\_blog()](get_users_of_blog) wp-includes/deprecated.php | Get users for the site. |
| [automatic\_feed\_links()](automatic_feed_links) wp-includes/deprecated.php | Enable/disable automatic general feed link outputting. |
| [get\_profile()](get_profile) wp-includes/deprecated.php | Retrieve user data based on field. |
| [get\_usernumposts()](get_usernumposts) wp-includes/deprecated.php | Retrieves the number of posts a user has written. |
| [funky\_javascript\_fix()](funky_javascript_fix) wp-includes/deprecated.php | Fixes JavaScript bugs in browsers. |
| [is\_taxonomy()](is_taxonomy) wp-includes/deprecated.php | Checks that the taxonomy name exists. |
| [is\_term()](is_term) wp-includes/deprecated.php | Check if Term exists. |
| [is\_plugin\_page()](is_plugin_page) wp-includes/deprecated.php | Determines whether the current admin page is generated by a plugin. |
| [update\_category\_cache()](update_category_cache) wp-includes/deprecated.php | Update the categories cache. |
| [wp\_timezone\_supported()](wp_timezone_supported) wp-includes/deprecated.php | Check for PHP timezone support |
| [the\_editor()](the_editor) wp-includes/deprecated.php | Displays an editor: TinyMCE, HTML, or both. |
| [\_\_ngettext()](__ngettext) wp-includes/deprecated.php | Retrieve the plural or single form based on the amount. |
| [\_\_ngettext\_noop()](__ngettext_noop) wp-includes/deprecated.php | Register plural strings in POT file, but don’t translate them. |
| [get\_alloptions()](get_alloptions) wp-includes/deprecated.php | Retrieve all autoload options, or all options if no autoloaded ones exist. |
| [get\_the\_attachment\_link()](get_the_attachment_link) wp-includes/deprecated.php | Retrieve HTML content of attachment image with link. |
| [get\_attachment\_icon\_src()](get_attachment_icon_src) wp-includes/deprecated.php | Retrieve icon URL and Path. |
| [get\_attachment\_icon()](get_attachment_icon) wp-includes/deprecated.php | Retrieve HTML content of icon attachment image element. |
| [get\_attachment\_innerHTML()](get_attachment_innerhtml) wp-includes/deprecated.php | Retrieve HTML content of image element. |
| [get\_link()](get_link) wp-includes/deprecated.php | Retrieves bookmark data based on ID. |
| [clean\_url()](clean_url) wp-includes/deprecated.php | Checks and cleans a URL. |
| [js\_escape()](js_escape) wp-includes/deprecated.php | Escape single quotes, specialchar double quotes, and fix line endings. |
| [wp\_specialchars()](wp_specialchars) wp-includes/deprecated.php | Legacy escaping for HTML blocks. |
| [attribute\_escape()](attribute_escape) wp-includes/deprecated.php | Escaping for HTML attributes. |
| [register\_sidebar\_widget()](register_sidebar_widget) wp-includes/deprecated.php | Register widget for sidebar with backward compatibility. |
| [unregister\_sidebar\_widget()](unregister_sidebar_widget) wp-includes/deprecated.php | Serves as an alias of [wp\_unregister\_sidebar\_widget()](wp_unregister_sidebar_widget) . |
| [get\_the\_author\_icq()](get_the_author_icq) wp-includes/deprecated.php | Retrieve the ICQ number of the author of the current post. |
| [the\_author\_icq()](the_author_icq) wp-includes/deprecated.php | Display the ICQ number of the author of the current post. |
| [get\_the\_author\_yim()](get_the_author_yim) wp-includes/deprecated.php | Retrieve the Yahoo! IM name of the author of the current post. |
| [the\_author\_yim()](the_author_yim) wp-includes/deprecated.php | Display the Yahoo! IM name of the author of the current post. |
| [get\_the\_author\_msn()](get_the_author_msn) wp-includes/deprecated.php | Retrieve the MSN address of the author of the current post. |
| [the\_author\_msn()](the_author_msn) wp-includes/deprecated.php | Display the MSN address of the author of the current post. |
| [get\_the\_author\_aim()](get_the_author_aim) wp-includes/deprecated.php | Retrieve the AIM address of the author of the current post. |
| [the\_author\_aim()](the_author_aim) wp-includes/deprecated.php | Display the AIM address of the author of the current post. |
| [get\_author\_name()](get_author_name) wp-includes/deprecated.php | Retrieve the specified author’s preferred display name. |
| [get\_the\_author\_url()](get_the_author_url) wp-includes/deprecated.php | Retrieve the URL to the home page of the author of the current post. |
| [the\_author\_url()](the_author_url) wp-includes/deprecated.php | Display the URL to the home page of the author of the current post. |
| [get\_the\_author\_ID()](get_the_author_id) wp-includes/deprecated.php | Retrieve the ID of the author of the current post. |
| [the\_author\_ID()](the_author_id) wp-includes/deprecated.php | Display the ID of the author of the current post. |
| [the\_content\_rss()](the_content_rss) wp-includes/deprecated.php | Display the post content for the feed. |
| [make\_url\_footnote()](make_url_footnote) wp-includes/deprecated.php | Strip HTML and put links at the bottom of stripped content. |
| [\_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. |
| [get\_author\_rss\_link()](get_author_rss_link) wp-includes/deprecated.php | Print/Return link to author RSS feed. |
| [comments\_rss()](comments_rss) wp-includes/deprecated.php | Return link to the post RSS feed. |
| [create\_user()](create_user) wp-includes/deprecated.php | An alias of [wp\_create\_user()](wp_create_user) . |
| [gzip\_compression()](gzip_compression) wp-includes/deprecated.php | Unused function. |
| [get\_commentdata()](get_commentdata) wp-includes/deprecated.php | Retrieve an array of comment data about comment $comment\_ID. |
| [get\_catname()](get_catname) wp-includes/deprecated.php | Retrieve the category name by the category ID. |
| [get\_category\_children()](get_category_children) wp-includes/deprecated.php | Retrieve category children list separated before and after the term IDs. |
| [get\_the\_author\_description()](get_the_author_description) wp-includes/deprecated.php | Retrieve the description of the author of the current post. |
| [the\_author\_description()](the_author_description) wp-includes/deprecated.php | Display the description of the author of the current post. |
| [get\_the\_author\_login()](get_the_author_login) wp-includes/deprecated.php | Retrieve the login name of the author of the current post. |
| [the\_author\_login()](the_author_login) wp-includes/deprecated.php | Display the login name of the author of the current post. |
| [get\_the\_author\_firstname()](get_the_author_firstname) wp-includes/deprecated.php | Retrieve the first name of the author of the current post. |
| [the\_author\_firstname()](the_author_firstname) wp-includes/deprecated.php | Display the first name of the author of the current post. |
| [get\_the\_author\_lastname()](get_the_author_lastname) wp-includes/deprecated.php | Retrieve the last name of the author of the current post. |
| [the\_author\_lastname()](the_author_lastname) wp-includes/deprecated.php | Display the last name of the author of the current post. |
| [get\_the\_author\_nickname()](get_the_author_nickname) wp-includes/deprecated.php | Retrieve the nickname of the author of the current post. |
| [the\_author\_nickname()](the_author_nickname) wp-includes/deprecated.php | Display the nickname of the author of the current post. |
| [get\_the\_author\_email()](get_the_author_email) wp-includes/deprecated.php | Retrieve the email of the author of the current post. |
| [the\_author\_email()](the_author_email) wp-includes/deprecated.php | Display the email of the author of the current post. |
| [dropdown\_cats()](dropdown_cats) wp-includes/deprecated.php | Deprecated method for generating a drop-down of categories. |
| [list\_authors()](list_authors) wp-includes/deprecated.php | Lists authors. |
| [wp\_get\_post\_cats()](wp_get_post_cats) wp-includes/deprecated.php | Retrieves a list of post categories. |
| [wp\_set\_post\_cats()](wp_set_post_cats) wp-includes/deprecated.php | Sets the categories that the post ID belongs to. |
| [get\_archives()](get_archives) wp-includes/deprecated.php | Retrieves a list of archives. |
| [get\_author\_link()](get_author_link) wp-includes/deprecated.php | Returns or Prints link to the author’s posts. |
| [link\_pages()](link_pages) wp-includes/deprecated.php | Print list of pages based on arguments. |
| [get\_settings()](get_settings) wp-includes/deprecated.php | Get value based on option. |
| [permalink\_link()](permalink_link) wp-includes/deprecated.php | Print the permalink of the current post in the loop. |
| [permalink\_single\_rss()](permalink_single_rss) wp-includes/deprecated.php | Print the permalink to the RSS feed. |
| [wp\_get\_links()](wp_get_links) wp-includes/deprecated.php | Gets the links associated with category. |
| [get\_links()](get_links) wp-includes/deprecated.php | Gets the links associated with category by ID. |
| [get\_links\_list()](get_links_list) wp-includes/deprecated.php | Output entire list of links by category. |
| [links\_popup\_script()](links_popup_script) wp-includes/deprecated.php | Show the link to the links popup and the number of links. |
| [get\_linkrating()](get_linkrating) wp-includes/deprecated.php | Legacy function that retrieved the value of a link’s link\_rating field. |
| [get\_linkcatname()](get_linkcatname) wp-includes/deprecated.php | Gets the name of category by ID. |
| [comments\_rss\_link()](comments_rss_link) wp-includes/deprecated.php | Print RSS comment feed link. |
| [get\_category\_rss\_link()](get_category_rss_link) wp-includes/deprecated.php | Print/Return link to category RSS2 feed. |
| [user\_can\_create\_post()](user_can_create_post) wp-includes/deprecated.php | Whether user can create a post. |
| [user\_can\_create\_draft()](user_can_create_draft) wp-includes/deprecated.php | Whether user can create a post. |
| [user\_can\_edit\_post()](user_can_edit_post) wp-includes/deprecated.php | Whether user can edit a post. |
| [user\_can\_delete\_post()](user_can_delete_post) wp-includes/deprecated.php | Whether user can delete a post. |
| [user\_can\_set\_post\_date()](user_can_set_post_date) wp-includes/deprecated.php | Whether user can set new posts’ dates. |
| [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. |
| [user\_can\_delete\_post\_comments()](user_can_delete_post_comments) wp-includes/deprecated.php | Whether user can delete a post. |
| [user\_can\_edit\_user()](user_can_edit_user) wp-includes/deprecated.php | Can user can edit other user. |
| [get\_linksbyname()](get_linksbyname) wp-includes/deprecated.php | Gets the links associated with category $cat\_name. |
| [wp\_get\_linksbyname()](wp_get_linksbyname) wp-includes/deprecated.php | Gets the links associated with the named category. |
| [get\_linkobjectsbyname()](get_linkobjectsbyname) wp-includes/deprecated.php | Gets an array of link objects associated with category $cat\_name. |
| [get\_linksbyname\_withrating()](get_linksbyname_withrating) wp-includes/deprecated.php | Gets the links associated with category ‘cat\_name’ and display rating stars/chars. |
| [get\_links\_withrating()](get_links_withrating) wp-includes/deprecated.php | Gets the links associated with category n and display rating stars/chars. |
| [get\_autotoggle()](get_autotoggle) wp-includes/deprecated.php | Gets the auto\_toggle setting. |
| [list\_cats()](list_cats) wp-includes/deprecated.php | Lists categories. |
| [wp\_list\_cats()](wp_list_cats) wp-includes/deprecated.php | Lists categories. |
| [get\_linkobjects()](get_linkobjects) wp-includes/deprecated.php | Gets an array of link objects associated with category n. |
| [get\_postdata()](get_postdata) wp-includes/deprecated.php | Retrieves all post data for a given post. |
| [start\_wp()](start_wp) wp-includes/deprecated.php | Sets up the WordPress Loop. |
| [the\_category\_ID()](the_category_id) wp-includes/deprecated.php | Returns or prints a category ID. |
| [the\_category\_head()](the_category_head) wp-includes/deprecated.php | Prints a category with optional text before and after. |
| [previous\_post()](previous_post) wp-includes/deprecated.php | Prints a link to the previous post. |
| [next\_post()](next_post) wp-includes/deprecated.php | Prints link to the next post. |
| [wp\_kses\_js\_entities()](wp_kses_js_entities) wp-includes/deprecated.php | Removes the HTML JavaScript entities found in early versions of Netscape 4. |
| [WP\_Query::is\_comments\_popup()](../classes/wp_query/is_comments_popup) wp-includes/class-wp-query.php | Whether the current URL is within the comments popup window. |
| [is\_comments\_popup()](is_comments_popup) wp-includes/deprecated.php | Determines whether the current URL is within the comments popup window. |
| [get\_all\_category\_ids()](get_all_category_ids) wp-includes/deprecated.php | Retrieves all category IDs. |
| [wp\_unregister\_GLOBALS()](wp_unregister_globals) wp-includes/deprecated.php | Turn register globals off. |
| [force\_ssl\_login()](force_ssl_login) wp-includes/deprecated.php | Whether SSL login should be forced. |
| [global\_terms\_enabled()](global_terms_enabled) wp-includes/deprecated.php | Determines whether global terms are enabled. |
| [url\_is\_accessable\_via\_ssl()](url_is_accessable_via_ssl) wp-includes/deprecated.php | Determines if the URL can be accessed over SSL. |
| [wp\_get\_http()](wp_get_http) wp-includes/deprecated.php | Perform a HTTP HEAD or GET request. |
| [WP\_Widget\_Recent\_Comments::flush\_widget\_cache()](../classes/wp_widget_recent_comments/flush_widget_cache) wp-includes/widgets/class-wp-widget-recent-comments.php | Flushes the Recent Comments widget cache. |
| [get\_shortcut\_link()](get_shortcut_link) wp-includes/deprecated.php | Retrieves the Press This bookmarklet link. |
| [post\_permalink()](post_permalink) wp-includes/deprecated.php | Retrieve permalink from post ID. |
| [WP\_Admin\_Bar::recursive\_render()](../classes/wp_admin_bar/recursive_render) wp-includes/class-wp-admin-bar.php | Renders toolbar items recursively. |
| [WP\_Customize\_Setting::\_update\_theme\_mod()](../classes/wp_customize_setting/_update_theme_mod) wp-includes/class-wp-customize-setting.php | Deprecated method. |
| [WP\_Customize\_Setting::\_update\_option()](../classes/wp_customize_setting/_update_option) wp-includes/class-wp-customize-setting.php | Deprecated method. |
| [wp\_atom\_server::\_\_call()](../classes/wp_atom_server/__call) wp-includes/pluggable-deprecated.php | |
| [wp\_atom\_server::\_\_callStatic()](../classes/wp_atom_server/__callstatic) wp-includes/pluggable-deprecated.php | |
| [set\_current\_user()](set_current_user) wp-includes/pluggable-deprecated.php | Changes the current user by ID or name. |
| [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. |
| [wp\_clearcookie()](wp_clearcookie) wp-includes/pluggable-deprecated.php | Clears the authentication cookie, logging the user out. This function is deprecated. |
| [wp\_get\_cookie\_login()](wp_get_cookie_login) wp-includes/pluggable-deprecated.php | Gets the user cookie login. This function is deprecated. |
| [wp\_login()](wp_login) wp-includes/pluggable-deprecated.php | Checks a users login information and logs them in if it checks out. This function is deprecated. |
| [get\_comments\_popup\_template()](get_comments_popup_template) wp-includes/deprecated.php | Retrieve path of comment popup template in current or parent template. |
| [get\_paged\_template()](get_paged_template) wp-includes/deprecated.php | Retrieve path of paged template in current or parent template. |
| [wp\_embed\_handler\_googlevideo()](wp_embed_handler_googlevideo) wp-includes/deprecated.php | The Google Video embed handler callback. |
| [wp\_get\_attachment\_thumb\_file()](wp_get_attachment_thumb_file) wp-includes/deprecated.php | Retrieves thumbnail for an attachment. |
| [wp\_get\_sites()](wp_get_sites) wp-includes/ms-deprecated.php | Return an array of sites for a network or networks. |
| [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. |
| [global\_terms()](global_terms) wp-includes/ms-deprecated.php | Maintains a canonical list of terms by syncing terms created for each blog with the global terms table. |
| [insert\_blog()](insert_blog) wp-includes/ms-deprecated.php | Store basic site info in the blogs table. |
| [install\_blog()](install_blog) wp-includes/ms-deprecated.php | Install an empty blog. |
| [install\_blog\_defaults()](install_blog_defaults) wp-includes/ms-deprecated.php | Set blog defaults. |
| [create\_empty\_blog()](create_empty_blog) wp-includes/ms-deprecated.php | Create an empty blog. |
| [get\_admin\_users\_for\_domain()](get_admin_users_for_domain) wp-includes/ms-deprecated.php | Get the admin for a domain/path combination. |
| [get\_current\_site\_name()](get_current_site_name) wp-includes/ms-load.php | This deprecated function formerly set the site\_name property of the $current\_site object. |
| [wpmu\_current\_site()](wpmu_current_site) wp-includes/ms-load.php | This deprecated function managed much of the site and network loading in multisite. |
| [wp\_get\_network()](wp_get_network) wp-includes/ms-load.php | Retrieves an object containing information about the requested network. |
| [generate\_random\_password()](generate_random_password) wp-includes/ms-deprecated.php | Generates a random password. |
| [is\_site\_admin()](is_site_admin) wp-includes/ms-deprecated.php | Determine if user is a site admin. |
| [graceful\_fail()](graceful_fail) wp-includes/ms-deprecated.php | Deprecated functionality to gracefully fail. |
| [get\_user\_details()](get_user_details) wp-includes/ms-deprecated.php | Deprecated functionality to retrieve user information. |
| [clear\_global\_post\_cache()](clear_global_post_cache) wp-includes/ms-deprecated.php | Deprecated functionality to clear the global post cache. |
| [is\_main\_blog()](is_main_blog) wp-includes/ms-deprecated.php | Deprecated functionality to determin if the current site is the main site. |
| [validate\_email()](validate_email) wp-includes/ms-deprecated.php | Deprecated functionality to validate an email address. |
| [get\_blog\_list()](get_blog_list) wp-includes/ms-deprecated.php | Deprecated functionality to retrieve a list of all sites. |
| [get\_most\_active\_blogs()](get_most_active_blogs) wp-includes/ms-deprecated.php | Deprecated functionality to retrieve a list of the most active sites. |
| [wpmu\_admin\_do\_redirect()](wpmu_admin_do_redirect) wp-includes/ms-deprecated.php | Redirect a user based on $\_GET or $\_POST arguments. |
| [wpmu\_admin\_redirect\_add\_updated\_param()](wpmu_admin_redirect_add_updated_param) wp-includes/ms-deprecated.php | Adds an ‘updated=true’ argument to a URL. |
| [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. |
| [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\_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. |
| [WP\_Scripts::print\_scripts\_l10n()](../classes/wp_scripts/print_scripts_l10n) wp-includes/class-wp-scripts.php | Prints extra scripts of a registered script. |
| [\_sort\_nav\_menu\_items()](_sort_nav_menu_items) wp-includes/deprecated.php | Sort menu items by the desired key. |
| [WP\_Customize\_Image\_Control::add\_tab()](../classes/wp_customize_image_control/add_tab) wp-includes/customize/class-wp-customize-image-control.php | |
| [WP\_Customize\_Image\_Control::remove\_tab()](../classes/wp_customize_image_control/remove_tab) wp-includes/customize/class-wp-customize-image-control.php | |
| [WP\_Customize\_Image\_Control::print\_tab\_image()](../classes/wp_customize_image_control/print_tab_image) wp-includes/customize/class-wp-customize-image-control.php | |
| [wpdb::supports\_collation()](../classes/wpdb/supports_collation) wp-includes/class-wpdb.php | Determines whether the database supports collation. |
| [wpdb::\_weak\_escape()](../classes/wpdb/_weak_escape) wp-includes/class-wpdb.php | Do not use, deprecated. |
| [wpdb::escape()](../classes/wpdb/escape) wp-includes/class-wpdb.php | Do not use, deprecated. |
| [comments\_popup\_script()](comments_popup_script) wp-includes/deprecated.php | Display the JS popup script to show a comment. |
| [WP\_Customize\_Widgets::setup\_widget\_addition\_previews()](../classes/wp_customize_widgets/setup_widget_addition_previews) wp-includes/class-wp-customize-widgets.php | {@internal Missing Summary} |
| [WP\_Customize\_Widgets::prepreview\_added\_sidebars\_widgets()](../classes/wp_customize_widgets/prepreview_added_sidebars_widgets) wp-includes/class-wp-customize-widgets.php | {@internal Missing Summary} |
| [WP\_Customize\_Widgets::prepreview\_added\_widget\_instance()](../classes/wp_customize_widgets/prepreview_added_widget_instance) wp-includes/class-wp-customize-widgets.php | {@internal Missing Summary} |
| [WP\_Customize\_Widgets::remove\_prepreview\_filters()](../classes/wp_customize_widgets/remove_prepreview_filters) wp-includes/class-wp-customize-widgets.php | {@internal Missing Summary} |
| [wp\_blacklist\_check()](wp_blacklist_check) wp-includes/deprecated.php | Does comment contain disallowed characters or words. |
| [\_WP\_Editors::wp\_fullscreen\_html()](../classes/_wp_editors/wp_fullscreen_html) wp-includes/class-wp-editor.php | Outputs the HTML for distraction-free writing mode. |
| 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). |
| [2.5.0](https://developer.wordpress.org/reference/since/2.5.0/) | Introduced. |
| programming_docs |
wordpress funky_javascript_fix( string $text ): string funky\_javascript\_fix( string $text ): string
==============================================
This function has been deprecated.
Fixes JavaScript bugs in browsers.
Converts unicode characters to HTML numbered entities.
`$text` string Required Text to be made safe. string Fixed text.
File: `wp-includes/deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/deprecated.php/)
```
function funky_javascript_fix($text) {
_deprecated_function( __FUNCTION__, '3.0.0' );
// Fixes for browsers' JavaScript bugs.
global $is_macIE, $is_winIE;
if ( $is_winIE || $is_macIE )
$text = preg_replace_callback("/\%u([0-9A-F]{4,4})/",
"funky_javascript_callback",
$text);
return $text;
}
```
| 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.0.0](https://developer.wordpress.org/reference/since/3.0.0/) | This function has been deprecated. |
| [1.5.0](https://developer.wordpress.org/reference/since/1.5.0/) | Introduced. |
wordpress wpmu_activate_signup( string $key ): array|WP_Error wpmu\_activate\_signup( string $key ): array|WP\_Error
======================================================
Activates a signup.
Hook to [‘wpmu\_activate\_user’](../hooks/wpmu_activate_user) or [‘wpmu\_activate\_blog’](../hooks/wpmu_activate_blog) for events that should happen only when users or sites are self-created (since those actions are not called when users and sites are created by a Super Admin).
`$key` string Required The activation key provided to the user. array|[WP\_Error](../classes/wp_error) An array containing information about the activated user and/or blog
File: `wp-includes/ms-functions.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/ms-functions.php/)
```
function wpmu_activate_signup( $key ) {
global $wpdb;
$signup = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->signups WHERE activation_key = %s", $key ) );
if ( empty( $signup ) ) {
return new WP_Error( 'invalid_key', __( 'Invalid activation key.' ) );
}
if ( $signup->active ) {
if ( empty( $signup->domain ) ) {
return new WP_Error( 'already_active', __( 'The user is already active.' ), $signup );
} else {
return new WP_Error( 'already_active', __( 'The site is already active.' ), $signup );
}
}
$meta = maybe_unserialize( $signup->meta );
$password = wp_generate_password( 12, false );
$user_id = username_exists( $signup->user_login );
if ( ! $user_id ) {
$user_id = wpmu_create_user( $signup->user_login, $password, $signup->user_email );
} else {
$user_already_exists = true;
}
if ( ! $user_id ) {
return new WP_Error( 'create_user', __( 'Could not create user' ), $signup );
}
$now = current_time( 'mysql', true );
if ( empty( $signup->domain ) ) {
$wpdb->update(
$wpdb->signups,
array(
'active' => 1,
'activated' => $now,
),
array( 'activation_key' => $key )
);
if ( isset( $user_already_exists ) ) {
return new WP_Error( 'user_already_exists', __( 'That username is already activated.' ), $signup );
}
/**
* Fires immediately after a new user is activated.
*
* @since MU (3.0.0)
*
* @param int $user_id User ID.
* @param string $password User password.
* @param array $meta Signup meta data.
*/
do_action( 'wpmu_activate_user', $user_id, $password, $meta );
return array(
'user_id' => $user_id,
'password' => $password,
'meta' => $meta,
);
}
$blog_id = wpmu_create_blog( $signup->domain, $signup->path, $signup->title, $user_id, $meta, get_current_network_id() );
// TODO: What to do if we create a user but cannot create a blog?
if ( is_wp_error( $blog_id ) ) {
/*
* If blog is taken, that means a previous attempt to activate this blog
* failed in between creating the blog and setting the activation flag.
* Let's just set the active flag and instruct the user to reset their password.
*/
if ( 'blog_taken' === $blog_id->get_error_code() ) {
$blog_id->add_data( $signup );
$wpdb->update(
$wpdb->signups,
array(
'active' => 1,
'activated' => $now,
),
array( 'activation_key' => $key )
);
}
return $blog_id;
}
$wpdb->update(
$wpdb->signups,
array(
'active' => 1,
'activated' => $now,
),
array( 'activation_key' => $key )
);
/**
* Fires immediately after a site is activated.
*
* @since MU (3.0.0)
*
* @param int $blog_id Blog ID.
* @param int $user_id User ID.
* @param string $password User password.
* @param string $signup_title Site title.
* @param array $meta Signup meta data. By default, contains the requested privacy setting and lang_id.
*/
do_action( 'wpmu_activate_blog', $blog_id, $user_id, $password, $signup->title, $meta );
return array(
'blog_id' => $blog_id,
'user_id' => $user_id,
'password' => $password,
'title' => $signup->title,
'meta' => $meta,
);
}
```
[do\_action( 'wpmu\_activate\_blog', int $blog\_id, int $user\_id, string $password, string $signup\_title, array $meta )](../hooks/wpmu_activate_blog)
Fires immediately after a site is activated.
[do\_action( 'wpmu\_activate\_user', int $user\_id, string $password, array $meta )](../hooks/wpmu_activate_user)
Fires immediately after a new user is activated.
| Uses | Description |
| --- | --- |
| [get\_current\_network\_id()](get_current_network_id) wp-includes/load.php | Retrieves the current network ID. |
| [wp\_generate\_password()](wp_generate_password) wp-includes/pluggable.php | Generates a random password drawn from the defined set of characters. |
| [maybe\_unserialize()](maybe_unserialize) wp-includes/functions.php | Unserializes data only if it was serialized. |
| [current\_time()](current_time) wp-includes/functions.php | Retrieves the current time based on specified type. |
| [username\_exists()](username_exists) wp-includes/user.php | Determines whether the given username exists. |
| [wpmu\_create\_user()](wpmu_create_user) wp-includes/ms-functions.php | Creates a user. |
| [wpmu\_create\_blog()](wpmu_create_blog) wp-includes/ms-functions.php | Creates a site. |
| [wpdb::get\_row()](../classes/wpdb/get_row) wp-includes/class-wpdb.php | Retrieves one row from the database. |
| [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. |
| [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 |
| --- | --- |
| [MU (3.0.0)](https://developer.wordpress.org/reference/since/mu.3.0.0/) | Introduced. |
wordpress get_network_option( int $network_id, string $option, mixed $default = false ): mixed get\_network\_option( int $network\_id, string $option, mixed $default = false ): mixed
=======================================================================================
Retrieves a network’s option value based on the option name.
* [get\_option()](get_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 retrieve. Expected to not be SQL-escaped. `$default` mixed Optional Value to return if the option doesn't exist. Default: `false`
mixed Value set for the option.
File: `wp-includes/option.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/option.php/)
```
function get_network_option( $network_id, $option, $default = false ) {
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();
}
/**
* Filters the value of an existing network option before it is retrieved.
*
* The dynamic portion of the hook name, `$option`, refers to the option name.
*
* Returning a value other than false from the filter will short-circuit retrieval
* and return that value instead.
*
* @since 2.9.0 As 'pre_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.
* @since 4.9.0 The `$default` parameter was added.
*
* @param mixed $pre_option The value to return instead of the option value. This differs
* from `$default`, which is used as the fallback value in the event
* the option doesn't exist elsewhere in get_network_option().
* Default false (to skip past the short-circuit).
* @param string $option Option name.
* @param int $network_id ID of the network.
* @param mixed $default The fallback value to return if the option does not exist.
* Default false.
*/
$pre = apply_filters( "pre_site_option_{$option}", false, $option, $network_id, $default );
if ( false !== $pre ) {
return $pre;
}
// Prevent non-existent options from triggering multiple queries.
$notoptions_key = "$network_id:notoptions";
$notoptions = wp_cache_get( $notoptions_key, 'site-options' );
if ( is_array( $notoptions ) && isset( $notoptions[ $option ] ) ) {
/**
* Filters the value of a specific default network option.
*
* The dynamic portion of the hook name, `$option`, refers to the option name.
*
* @since 3.4.0
* @since 4.4.0 The `$option` parameter was added.
* @since 4.7.0 The `$network_id` parameter was added.
*
* @param mixed $default The value to return if the site option does not exist
* in the database.
* @param string $option Option name.
* @param int $network_id ID of the network.
*/
return apply_filters( "default_site_option_{$option}", $default, $option, $network_id );
}
if ( ! is_multisite() ) {
/** This filter is documented in wp-includes/option.php */
$default = apply_filters( 'default_site_option_' . $option, $default, $option, $network_id );
$value = get_option( $option, $default );
} else {
$cache_key = "$network_id:$option";
$value = wp_cache_get( $cache_key, 'site-options' );
if ( ! isset( $value ) || false === $value ) {
$row = $wpdb->get_row( $wpdb->prepare( "SELECT meta_value FROM $wpdb->sitemeta WHERE meta_key = %s AND site_id = %d", $option, $network_id ) );
// Has to be get_row() instead of get_var() because of funkiness with 0, false, null values.
if ( is_object( $row ) ) {
$value = $row->meta_value;
$value = maybe_unserialize( $value );
wp_cache_set( $cache_key, $value, 'site-options' );
} else {
if ( ! is_array( $notoptions ) ) {
$notoptions = array();
}
$notoptions[ $option ] = true;
wp_cache_set( $notoptions_key, $notoptions, 'site-options' );
/** This filter is documented in wp-includes/option.php */
$value = apply_filters( 'default_site_option_' . $option, $default, $option, $network_id );
}
}
}
if ( ! is_array( $notoptions ) ) {
$notoptions = array();
wp_cache_set( $notoptions_key, $notoptions, 'site-options' );
}
/**
* Filters the value of an existing network option.
*
* The dynamic portion of the hook name, `$option`, refers to the option name.
*
* @since 2.9.0 As '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.
*/
return apply_filters( "site_option_{$option}", $value, $option, $network_id );
}
```
[apply\_filters( "default\_site\_option\_{$option}", mixed $default, string $option, int $network\_id )](../hooks/default_site_option_option)
Filters the value of a specific default network option.
[apply\_filters( "pre\_site\_option\_{$option}", mixed $pre\_option, string $option, int $network\_id, mixed $default )](../hooks/pre_site_option_option)
Filters the value of an existing network option before it is retrieved.
[apply\_filters( "site\_option\_{$option}", mixed $value, string $option, int $network\_id )](../hooks/site_option_option)
Filters the value of an existing network option.
| Uses | Description |
| --- | --- |
| [get\_current\_network\_id()](get_current_network_id) wp-includes/load.php | Retrieves the current network ID. |
| [wp\_cache\_set()](wp_cache_set) wp-includes/cache.php | Saves the data to the cache. |
| [maybe\_unserialize()](maybe_unserialize) wp-includes/functions.php | Unserializes data only if it was serialized. |
| [wpdb::get\_row()](../classes/wpdb/get_row) wp-includes/class-wpdb.php | Retrieves one row from the database. |
| [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. |
| [get\_option()](get_option) wp-includes/option.php | Retrieves an option value based on an option name. |
| [wpdb::prepare()](../classes/wpdb/prepare) wp-includes/class-wpdb.php | Prepares a SQL query for safe execution. |
| Used By | Description |
| --- | --- |
| [WP\_Application\_Passwords::is\_in\_use()](../classes/wp_application_passwords/is_in_use) wp-includes/class-wp-application-passwords.php | Checks if application passwords are being used by 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. |
| [wp\_initialize\_site()](wp_initialize_site) wp-includes/ms-site.php | Runs the initialization routine for a given site. |
| [wp\_insert\_site()](wp_insert_site) wp-includes/ms-site.php | Inserts a new site into the database. |
| [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. |
| [WP\_Network::\_set\_site\_name()](../classes/wp_network/_set_site_name) wp-includes/class-wp-network.php | Sets the site name assigned to the network if one has not been populated. |
| [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\_site\_option()](get_site_option) wp-includes/option.php | Retrieve an option value for the current network based on name of option. |
| [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 |
| --- | --- |
| [4.4.0](https://developer.wordpress.org/reference/since/4.4.0/) | Introduced. |
wordpress get_comment_excerpt( int|WP_Comment $comment_ID ): string get\_comment\_excerpt( int|WP\_Comment $comment\_ID ): string
=============================================================
Retrieves the excerpt of the given comment.
Returns a maximum of 20 words with an ellipsis appended if necessary.
`$comment_ID` int|[WP\_Comment](../classes/wp_comment) Required [WP\_Comment](../classes/wp_comment) or ID of the comment for which to get the excerpt.
Default current comment. string The possibly truncated comment excerpt.
File: `wp-includes/comment-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/comment-template.php/)
```
function get_comment_excerpt( $comment_ID = 0 ) {
$comment = get_comment( $comment_ID );
if ( ! post_password_required( $comment->comment_post_ID ) ) {
$comment_text = strip_tags( str_replace( array( "\n", "\r" ), ' ', $comment->comment_content ) );
} else {
$comment_text = __( 'Password protected' );
}
/* translators: Maximum number of words used in a comment excerpt. */
$comment_excerpt_length = (int) _x( '20', 'comment_excerpt_length' );
/**
* Filters the maximum number of words used in the comment excerpt.
*
* @since 4.4.0
*
* @param int $comment_excerpt_length The amount of words you want to display in the comment excerpt.
*/
$comment_excerpt_length = apply_filters( 'comment_excerpt_length', $comment_excerpt_length );
$excerpt = wp_trim_words( $comment_text, $comment_excerpt_length, '…' );
/**
* Filters the retrieved comment excerpt.
*
* @since 1.5.0
* @since 4.1.0 The `$comment_ID` and `$comment` parameters were added.
*
* @param string $excerpt The comment excerpt text.
* @param string $comment_ID The comment ID as a numeric string.
* @param WP_Comment $comment The comment object.
*/
return apply_filters( 'get_comment_excerpt', $excerpt, $comment->comment_ID, $comment );
}
```
[apply\_filters( 'comment\_excerpt\_length', int $comment\_excerpt\_length )](../hooks/comment_excerpt_length)
Filters the maximum number of words used in the comment excerpt.
[apply\_filters( 'get\_comment\_excerpt', string $excerpt, string $comment\_ID, WP\_Comment $comment )](../hooks/get_comment_excerpt)
Filters the retrieved comment excerpt.
| Uses | Description |
| --- | --- |
| [wp\_trim\_words()](wp_trim_words) wp-includes/formatting.php | Trims text to a certain number of words. |
| [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. |
| [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. |
| [\_x()](_x) wp-includes/l10n.php | Retrieves translated string with gettext context. |
| [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\_excerpt()](comment_excerpt) wp-includes/comment-template.php | Displays the excerpt 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 _wptexturize_pushpop_element( string $text, string[] $stack, string[] $disabled_elements ) \_wptexturize\_pushpop\_element( string $text, string[] $stack, string[] $disabled\_elements )
==============================================================================================
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.
Searches for disabled element tags. Pushes element to stack on tag open and pops on tag close.
Assumes first char of `$text` is tag opening and last char is tag closing.
Assumes second char of `$text` is optionally `/` to indicate closing as in `</html>`.
`$text` string Required Text to check. Must be a tag like `<html>` or `[shortcode]`. `$stack` string[] Required Array of open tag elements. `$disabled_elements` string[] Required Array of tag names to match against. Spaces are not allowed in tag names. File: `wp-includes/formatting.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/formatting.php/)
```
function _wptexturize_pushpop_element( $text, &$stack, $disabled_elements ) {
// Is it an opening tag or closing tag?
if ( isset( $text[1] ) && '/' !== $text[1] ) {
$opening_tag = true;
$name_offset = 1;
} elseif ( 0 === count( $stack ) ) {
// Stack is empty. Just stop.
return;
} else {
$opening_tag = false;
$name_offset = 2;
}
// Parse out the tag name.
$space = strpos( $text, ' ' );
if ( false === $space ) {
$space = -1;
} else {
$space -= $name_offset;
}
$tag = substr( $text, $name_offset, $space );
// Handle disabled tags.
if ( in_array( $tag, $disabled_elements, true ) ) {
if ( $opening_tag ) {
/*
* This disables texturize until we find a closing tag of our type
* (e.g. <pre>) even if there was invalid nesting before that.
*
* Example: in the case <pre>sadsadasd</code>"baba"</pre>
* "baba" won't be texturized.
*/
array_push( $stack, $tag );
} elseif ( end( $stack ) == $tag ) {
array_pop( $stack );
}
}
}
```
| Used By | Description |
| --- | --- |
| [wptexturize()](wptexturize) wp-includes/formatting.php | Replaces common plain text characters with formatted entities. |
| Version | Description |
| --- | --- |
| [2.9.0](https://developer.wordpress.org/reference/since/2.9.0/) | Introduced. |
| programming_docs |
wordpress get_post_gallery( int|WP_Post $post, bool $html = true ): string|array get\_post\_gallery( int|WP\_Post $post, bool $html = true ): string|array
=========================================================================
Checks a specified post’s content for gallery and, if present, return the first
`$post` int|[WP\_Post](../classes/wp_post) Optional Post ID or [WP\_Post](../classes/wp_post) object. Default is global $post. `$html` bool Optional Whether to return HTML or data. Default is true. Default: `true`
string|array Gallery data and srcs parsed from the expanded shortcode.
File: `wp-includes/media.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/media.php/)
```
function get_post_gallery( $post = 0, $html = true ) {
$galleries = get_post_galleries( $post, $html );
$gallery = reset( $galleries );
/**
* Filters the first-found post gallery.
*
* @since 3.6.0
*
* @param array $gallery The first-found post gallery.
* @param int|WP_Post $post Post ID or object.
* @param array $galleries Associative array of all found post galleries.
*/
return apply_filters( 'get_post_gallery', $gallery, $post, $galleries );
}
```
[apply\_filters( 'get\_post\_gallery', array $gallery, int|WP\_Post $post, array $galleries )](../hooks/get_post_gallery)
Filters the first-found post gallery.
| Uses | Description |
| --- | --- |
| [get\_post\_galleries()](get_post_galleries) wp-includes/media.php | Retrieves galleries from the passed post’s content. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| Used By | Description |
| --- | --- |
| [get\_post\_gallery\_images()](get_post_gallery_images) wp-includes/media.php | Checks a post’s content for galleries and return the image srcs for the first found gallery. |
| Version | Description |
| --- | --- |
| [3.6.0](https://developer.wordpress.org/reference/since/3.6.0/) | Introduced. |
wordpress get_the_archive_description(): string get\_the\_archive\_description(): string
========================================
Retrieves the description for an author, post type, or term archive.
* [term\_description()](term_description)
string Archive description.
File: `wp-includes/general-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/general-template.php/)
```
function get_the_archive_description() {
if ( is_author() ) {
$description = get_the_author_meta( 'description' );
} elseif ( is_post_type_archive() ) {
$description = get_the_post_type_description();
} else {
$description = term_description();
}
/**
* Filters the archive description.
*
* @since 4.1.0
*
* @param string $description Archive description to be displayed.
*/
return apply_filters( 'get_the_archive_description', $description );
}
```
[apply\_filters( 'get\_the\_archive\_description', string $description )](../hooks/get_the_archive_description)
Filters the archive description.
| Uses | Description |
| --- | --- |
| [get\_the\_post\_type\_description()](get_the_post_type_description) wp-includes/general-template.php | Retrieves the description for a post type archive. |
| [term\_description()](term_description) wp-includes/category-template.php | Retrieves term description. |
| [is\_author()](is_author) wp-includes/query.php | Determines whether the query is for an existing author 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. |
| [get\_the\_author\_meta()](get_the_author_meta) wp-includes/author-template.php | Retrieves the requested data of the author of the current post. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| Used By | Description |
| --- | --- |
| [the\_archive\_description()](the_archive_description) wp-includes/general-template.php | Displays category, tag, term, or author description. |
| Version | Description |
| --- | --- |
| [4.9.0](https://developer.wordpress.org/reference/since/4.9.0/) | Added support for post type archives. |
| [4.7.0](https://developer.wordpress.org/reference/since/4.7.0/) | Added support for author archives. |
| [4.1.0](https://developer.wordpress.org/reference/since/4.1.0/) | Introduced. |
wordpress wp_delete_file_from_directory( string $file, string $directory ): bool wp\_delete\_file\_from\_directory( string $file, string $directory ): bool
==========================================================================
Deletes a file if its path is within the given directory.
`$file` string Required Absolute path to the file to delete. `$directory` string Required Absolute path to a directory. bool True 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_delete_file_from_directory( $file, $directory ) {
if ( wp_is_stream( $file ) ) {
$real_file = $file;
$real_directory = $directory;
} else {
$real_file = realpath( wp_normalize_path( $file ) );
$real_directory = realpath( wp_normalize_path( $directory ) );
}
if ( false !== $real_file ) {
$real_file = wp_normalize_path( $real_file );
}
if ( false !== $real_directory ) {
$real_directory = wp_normalize_path( $real_directory );
}
if ( false === $real_file || false === $real_directory || strpos( $real_file, trailingslashit( $real_directory ) ) !== 0 ) {
return false;
}
wp_delete_file( $file );
return true;
}
```
| Uses | Description |
| --- | --- |
| [wp\_delete\_file()](wp_delete_file) wp-includes/functions.php | Deletes a file. |
| [wp\_is\_stream()](wp_is_stream) wp-includes/functions.php | Tests if a given path is a stream URL |
| [wp\_normalize\_path()](wp_normalize_path) wp-includes/functions.php | Normalizes a filesystem path. |
| [trailingslashit()](trailingslashit) wp-includes/formatting.php | Appends a trailing slash. |
| Used By | Description |
| --- | --- |
| [wp\_delete\_attachment\_files()](wp_delete_attachment_files) wp-includes/post.php | Deletes all files that belong to the given attachment. |
| Version | Description |
| --- | --- |
| [4.9.7](https://developer.wordpress.org/reference/since/4.9.7/) | Introduced. |
wordpress wp_get_registered_image_subsizes(): array[] wp\_get\_registered\_image\_subsizes(): array[]
===============================================
Returns a normalized list of all currently registered image sub-sizes.
array[] Associative array of arrays of image sub-size information, keyed by image size name.
File: `wp-includes/media.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/media.php/)
```
function wp_get_registered_image_subsizes() {
$additional_sizes = wp_get_additional_image_sizes();
$all_sizes = array();
foreach ( get_intermediate_image_sizes() as $size_name ) {
$size_data = array(
'width' => 0,
'height' => 0,
'crop' => false,
);
if ( isset( $additional_sizes[ $size_name ]['width'] ) ) {
// For sizes added by plugins and themes.
$size_data['width'] = (int) $additional_sizes[ $size_name ]['width'];
} else {
// For default sizes set in options.
$size_data['width'] = (int) get_option( "{$size_name}_size_w" );
}
if ( isset( $additional_sizes[ $size_name ]['height'] ) ) {
$size_data['height'] = (int) $additional_sizes[ $size_name ]['height'];
} else {
$size_data['height'] = (int) get_option( "{$size_name}_size_h" );
}
if ( empty( $size_data['width'] ) && empty( $size_data['height'] ) ) {
// This size isn't set.
continue;
}
if ( isset( $additional_sizes[ $size_name ]['crop'] ) ) {
$size_data['crop'] = $additional_sizes[ $size_name ]['crop'];
} else {
$size_data['crop'] = get_option( "{$size_name}_crop" );
}
if ( ! is_array( $size_data['crop'] ) || empty( $size_data['crop'] ) ) {
$size_data['crop'] = (bool) $size_data['crop'];
}
$all_sizes[ $size_name ] = $size_data;
}
return $all_sizes;
}
```
| Uses | Description |
| --- | --- |
| [wp\_get\_additional\_image\_sizes()](wp_get_additional_image_sizes) wp-includes/media.php | Retrieves additional image sizes. |
| [get\_intermediate\_image\_sizes()](get_intermediate_image_sizes) wp-includes/media.php | Gets the available intermediate image size names. |
| [get\_option()](get_option) wp-includes/option.php | Retrieves an option value based on an option name. |
| Used By | Description |
| --- | --- |
| [get\_default\_block\_editor\_settings()](get_default_block_editor_settings) wp-includes/block-editor.php | Returns the default block editor settings. |
| [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\_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\_generate\_attachment\_metadata()](wp_generate_attachment_metadata) wp-admin/includes/image.php | Generates attachment meta data and create image sub-sizes for images. |
| Version | Description |
| --- | --- |
| [5.3.0](https://developer.wordpress.org/reference/since/5.3.0/) | Introduced. |
wordpress wp_hash( string $data, string $scheme = 'auth' ): string wp\_hash( string $data, string $scheme = 'auth' ): string
=========================================================
Gets hash of given string.
`$data` string Required Plain text to hash. `$scheme` string Optional Authentication scheme (auth, secure\_auth, logged\_in, nonce). Default: `'auth'`
string Hash of $data.
##### Usage:
```
wp_hash( $data, $scheme );
```
##### Notes:
* This function can be replaced via [plugins](https://wordpress.org/support/article/glossary/). If plugins do not redefine these functions, then this will be used instead.
* Uses: [wp\_salt()](wp_salt) Get WordPress salt.
File: `wp-includes/pluggable.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/pluggable.php/)
```
function wp_hash( $data, $scheme = 'auth' ) {
$salt = wp_salt( $scheme );
return hash_hmac( 'md5', $data, $salt );
}
```
| Uses | Description |
| --- | --- |
| [wp\_salt()](wp_salt) wp-includes/pluggable.php | Returns a salt to add to hashes. |
| Used By | Description |
| --- | --- |
| [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::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\_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\_get\_unapproved\_comment\_author\_email()](wp_get_unapproved_comment_author_email) wp-includes/comment.php | Gets unapproved comment author’s email. |
| [WP\_Customize\_Nav\_Menus::hash\_nav\_menu\_args()](../classes/wp_customize_nav_menus/hash_nav_menu_args) wp-includes/class-wp-customize-nav-menus.php | Hashes (hmac) the nav menu arguments to ensure they are not tampered with when submitted in the Ajax request. |
| [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. |
| [wp\_validate\_auth\_cookie()](wp_validate_auth_cookie) wp-includes/pluggable.php | Validates authentication cookie. |
| [wp\_generate\_auth\_cookie()](wp_generate_auth_cookie) wp-includes/pluggable.php | Generates authentication cookie contents. |
| [WP\_Customize\_Widgets::get\_instance\_hash\_key()](../classes/wp_customize_widgets/get_instance_hash_key) wp-includes/class-wp-customize-widgets.php | Retrieves MAC for a serialized widget instance string. |
| Version | Description |
| --- | --- |
| [2.0.3](https://developer.wordpress.org/reference/since/2.0.3/) | Introduced. |
wordpress wlwmanifest_link() wlwmanifest\_link()
===================
Displays the link to the Windows Live Writer manifest file.
File: `wp-includes/general-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/general-template.php/)
```
function wlwmanifest_link() {
printf(
'<link rel="wlwmanifest" type="application/wlwmanifest+xml" href="%s" />' . "\n",
includes_url( 'wlwmanifest.xml' )
);
}
```
| Uses | Description |
| --- | --- |
| [includes\_url()](includes_url) wp-includes/link-template.php | Retrieves the URL to the includes directory. |
| Version | Description |
| --- | --- |
| [2.3.1](https://developer.wordpress.org/reference/since/2.3.1/) | Introduced. |
wordpress wxr_tag_description( WP_Term $tag ) wxr\_tag\_description( WP\_Term $tag )
======================================
Outputs a tag\_description XML tag from a given tag object.
`$tag` [WP\_Term](../classes/wp_term) Required Tag Object. File: `wp-admin/includes/export.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/export.php/)
```
function wxr_tag_description( $tag ) {
if ( empty( $tag->description ) ) {
return;
}
echo '<wp:tag_description>' . wxr_cdata( $tag->description ) . "</wp:tag_description>\n";
}
```
| Uses | Description |
| --- | --- |
| [wxr\_cdata()](wxr_cdata) wp-admin/includes/export.php | Wraps given string in XML CDATA tag. |
| Used By | Description |
| --- | --- |
| [export\_wp()](export_wp) wp-admin/includes/export.php | Generates the WXR export file for download. |
| Version | Description |
| --- | --- |
| [2.3.0](https://developer.wordpress.org/reference/since/2.3.0/) | Introduced. |
wordpress install_blog( int $blog_id, string $blog_title = '' ) install\_blog( int $blog\_id, string $blog\_title = '' )
========================================================
This function has been deprecated.
Install an empty blog.
Creates the new blog tables and options. If calling this function directly, be sure to use [switch\_to\_blog()](switch_to_blog) first, so that $[wpdb](../classes/wpdb) points to the new blog.
`$blog_id` int Required The value returned by [wp\_insert\_site()](wp_insert_site) . `$blog_title` string Optional The title of the new site. Default: `''`
File: `wp-includes/ms-deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/ms-deprecated.php/)
```
function install_blog( $blog_id, $blog_title = '' ) {
global $wpdb, $wp_roles;
_deprecated_function( __FUNCTION__, '5.1.0' );
// Cast for security.
$blog_id = (int) $blog_id;
require_once ABSPATH . 'wp-admin/includes/upgrade.php';
$suppress = $wpdb->suppress_errors();
if ( $wpdb->get_results( "DESCRIBE {$wpdb->posts}" ) ) {
die( '<h1>' . __( 'Already Installed' ) . '</h1><p>' . __( 'You appear to have already installed WordPress. To reinstall please clear your old database tables first.' ) . '</p></body></html>' );
}
$wpdb->suppress_errors( $suppress );
$url = get_blogaddress_by_id( $blog_id );
// Set everything up.
make_db_current_silent( 'blog' );
populate_options();
populate_roles();
// populate_roles() clears previous role definitions so we start over.
$wp_roles = new WP_Roles();
$siteurl = $home = untrailingslashit( $url );
if ( ! is_subdomain_install() ) {
if ( 'https' === parse_url( get_site_option( 'siteurl' ), PHP_URL_SCHEME ) ) {
$siteurl = set_url_scheme( $siteurl, 'https' );
}
if ( 'https' === parse_url( get_home_url( get_network()->site_id ), PHP_URL_SCHEME ) ) {
$home = set_url_scheme( $home, 'https' );
}
}
update_option( 'siteurl', $siteurl );
update_option( 'home', $home );
if ( get_site_option( 'ms_files_rewriting' ) ) {
update_option( 'upload_path', UPLOADBLOGSDIR . "/$blog_id/files" );
} else {
update_option( 'upload_path', get_blog_option( get_network()->site_id, 'upload_path' ) );
}
update_option( 'blogname', wp_unslash( $blog_title ) );
update_option( 'admin_email', '' );
// Remove all permissions.
$table_prefix = $wpdb->get_blog_prefix();
delete_metadata( 'user', 0, $table_prefix . 'user_level', null, true ); // Delete all.
delete_metadata( 'user', 0, $table_prefix . 'capabilities', null, true ); // Delete all.
}
```
| 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. |
| [wpdb::get\_blog\_prefix()](../classes/wpdb/get_blog_prefix) wp-includes/class-wpdb.php | Gets blog prefix. |
| [wpdb::suppress\_errors()](../classes/wpdb/suppress_errors) wp-includes/class-wpdb.php | Enables or disables suppressing of database errors. |
| [get\_blogaddress\_by\_id()](get_blogaddress_by_id) wp-includes/ms-blogs.php | Get a full blog URL, given a blog ID. |
| [get\_blog\_option()](get_blog_option) wp-includes/ms-blogs.php | Retrieve option value for a given blog id based on name of option. |
| [is\_subdomain\_install()](is_subdomain_install) wp-includes/ms-load.php | Whether a subdomain configuration is enabled. |
| [populate\_roles()](populate_roles) wp-admin/includes/schema.php | Execute WordPress role creation for the various WordPress versions. |
| [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\_Roles::\_\_construct()](../classes/wp_roles/__construct) wp-includes/class-wp-roles.php | Constructor. |
| [untrailingslashit()](untrailingslashit) wp-includes/formatting.php | Removes trailing forward slashes and backslashes if they exist. |
| [make\_db\_current\_silent()](make_db_current_silent) wp-admin/includes/upgrade.php | Updates the database tables to a new schema, but without displaying results. |
| [populate\_options()](populate_options) wp-admin/includes/schema.php | Create WordPress options and set the default values. |
| [delete\_metadata()](delete_metadata) wp-includes/meta.php | Deletes metadata for the specified 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. |
| [update\_option()](update_option) wp-includes/option.php | Updates the value of an option that was already added. |
| [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. |
| [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 |
| --- | --- |
| [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/) | This function has been deprecated. |
| [MU (3.0.0)](https://developer.wordpress.org/reference/since/mu.3.0.0/) | Introduced. |
| programming_docs |
wordpress wp_login_form( array $args = array() ): void|string wp\_login\_form( array $args = array() ): void|string
=====================================================
Provides a simple login form for use anywhere within WordPress.
The login form HTML is echoed by default. Pass a false value for `$echo` to return it instead.
`$args` array Optional Array of options to control the form output.
* `echo`boolWhether to display the login form or return the form HTML code.
Default true (echo).
* `redirect`stringURL to redirect to. Must be absolute, as in "<a href="https://example.com/mypage/">https://example.com/mypage/</a>".
Default is to redirect back to the request URI.
* `form_id`stringID attribute value for the form. Default `'loginform'`.
* `label_username`stringLabel for the username or email address field. Default 'Username or Email Address'.
* `label_password`stringLabel for the password field. Default `'Password'`.
* `label_remember`stringLabel for the remember field. Default 'Remember Me'.
* `label_log_in`stringLabel for the submit button. Default 'Log In'.
* `id_username`stringID attribute value for the username field. Default `'user_login'`.
* `id_password`stringID attribute value for the password field. Default `'user_pass'`.
* `id_remember`stringID attribute value for the remember field. Default `'rememberme'`.
* `id_submit`stringID attribute value for the submit button. Default `'wp-submit'`.
* `remember`boolWhether to display the "rememberme" checkbox in the form.
* `value_username`stringDefault value for the username field.
* `value_remember`boolWhether the "Remember Me" checkbox should be checked by default.
Default false (unchecked).
Default: `array()`
void|string Void if `'echo'` argument is true, login form HTML 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_login_form( $args = array() ) {
$defaults = array(
'echo' => true,
// Default 'redirect' value takes the user back to the request URI.
'redirect' => ( is_ssl() ? 'https://' : 'http://' ) . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'],
'form_id' => 'loginform',
'label_username' => __( 'Username or Email Address' ),
'label_password' => __( 'Password' ),
'label_remember' => __( 'Remember Me' ),
'label_log_in' => __( 'Log In' ),
'id_username' => 'user_login',
'id_password' => 'user_pass',
'id_remember' => 'rememberme',
'id_submit' => 'wp-submit',
'remember' => true,
'value_username' => '',
// Set 'value_remember' to true to default the "Remember me" checkbox to checked.
'value_remember' => false,
);
/**
* Filters the default login form output arguments.
*
* @since 3.0.0
*
* @see wp_login_form()
*
* @param array $defaults An array of default login form arguments.
*/
$args = wp_parse_args( $args, apply_filters( 'login_form_defaults', $defaults ) );
/**
* Filters content to display at the top of the login form.
*
* The filter evaluates just following the opening form tag element.
*
* @since 3.0.0
*
* @param string $content Content to display. Default empty.
* @param array $args Array of login form arguments.
*/
$login_form_top = apply_filters( 'login_form_top', '', $args );
/**
* Filters content to display in the middle of the login form.
*
* The filter evaluates just following the location where the 'login-password'
* field is displayed.
*
* @since 3.0.0
*
* @param string $content Content to display. Default empty.
* @param array $args Array of login form arguments.
*/
$login_form_middle = apply_filters( 'login_form_middle', '', $args );
/**
* Filters content to display at the bottom of the login form.
*
* The filter evaluates just preceding the closing form tag element.
*
* @since 3.0.0
*
* @param string $content Content to display. Default empty.
* @param array $args Array of login form arguments.
*/
$login_form_bottom = apply_filters( 'login_form_bottom', '', $args );
$form =
sprintf(
'<form name="%1$s" id="%1$s" action="%2$s" method="post">',
esc_attr( $args['form_id'] ),
esc_url( site_url( 'wp-login.php', 'login_post' ) )
) .
$login_form_top .
sprintf(
'<p class="login-username">
<label for="%1$s">%2$s</label>
<input type="text" name="log" id="%1$s" autocomplete="username" class="input" value="%3$s" size="20" />
</p>',
esc_attr( $args['id_username'] ),
esc_html( $args['label_username'] ),
esc_attr( $args['value_username'] )
) .
sprintf(
'<p class="login-password">
<label for="%1$s">%2$s</label>
<input type="password" name="pwd" id="%1$s" autocomplete="current-password" class="input" value="" size="20" />
</p>',
esc_attr( $args['id_password'] ),
esc_html( $args['label_password'] )
) .
$login_form_middle .
( $args['remember'] ?
sprintf(
'<p class="login-remember"><label><input name="rememberme" type="checkbox" id="%1$s" value="forever"%2$s /> %3$s</label></p>',
esc_attr( $args['id_remember'] ),
( $args['value_remember'] ? ' checked="checked"' : '' ),
esc_html( $args['label_remember'] )
) : ''
) .
sprintf(
'<p class="login-submit">
<input type="submit" name="wp-submit" id="%1$s" class="button button-primary" value="%2$s" />
<input type="hidden" name="redirect_to" value="%3$s" />
</p>',
esc_attr( $args['id_submit'] ),
esc_attr( $args['label_log_in'] ),
esc_url( $args['redirect'] )
) .
$login_form_bottom .
'</form>';
if ( $args['echo'] ) {
echo $form;
} else {
return $form;
}
}
```
[apply\_filters( 'login\_form\_bottom', string $content, array $args )](../hooks/login_form_bottom)
Filters content to display at the bottom of the login form.
[apply\_filters( 'login\_form\_defaults', array $defaults )](../hooks/login_form_defaults)
Filters the default login form output arguments.
[apply\_filters( 'login\_form\_middle', string $content, array $args )](../hooks/login_form_middle)
Filters content to display in the middle of the login form.
[apply\_filters( 'login\_form\_top', string $content, array $args )](../hooks/login_form_top)
Filters content to display at the top of the login form.
| 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. |
| [is\_ssl()](is_ssl) wp-includes/load.php | Determines if SSL is used. |
| [\_\_()](__) 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. |
| [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. |
| [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 wp_is_large_network( string $using = 'sites', int|null $network_id = null ): bool wp\_is\_large\_network( string $using = 'sites', int|null $network\_id = null ): bool
=====================================================================================
Determines whether or not we have a large network.
The default criteria for a large network is either more than 10,000 users or more than 10,000 sites.
Plugins can alter this criteria using the [‘wp\_is\_large\_network’](../hooks/wp_is_large_network) filter.
`$using` string Optional 'sites or `'users'`. Default is `'sites'`. Default: `'sites'`
`$network_id` int|null Optional ID of the network. Default is the current network. Default: `null`
bool True if the network meets the criteria for large. False otherwise.
File: `wp-includes/ms-functions.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/ms-functions.php/)
```
function wp_is_large_network( $using = 'sites', $network_id = null ) {
$network_id = (int) $network_id;
if ( ! $network_id ) {
$network_id = get_current_network_id();
}
if ( 'users' === $using ) {
$count = get_user_count( $network_id );
$is_large_network = wp_is_large_user_count( $network_id );
/**
* Filters whether the network is considered large.
*
* @since 3.3.0
* @since 4.8.0 The `$network_id` parameter has been added.
*
* @param bool $is_large_network Whether the network has more than 10000 users or sites.
* @param string $component The component to count. Accepts 'users', or 'sites'.
* @param int $count The count of items for the component.
* @param int $network_id The ID of the network being checked.
*/
return apply_filters( 'wp_is_large_network', $is_large_network, 'users', $count, $network_id );
}
$count = get_blog_count( $network_id );
/** This filter is documented in wp-includes/ms-functions.php */
return apply_filters( 'wp_is_large_network', $count > 10000, 'sites', $count, $network_id );
}
```
[apply\_filters( 'wp\_is\_large\_network', bool $is\_large\_network, string $component, int $count, int $network\_id )](../hooks/wp_is_large_network)
Filters whether the network is considered large.
| Uses | Description |
| --- | --- |
| [wp\_is\_large\_user\_count()](wp_is_large_user_count) wp-includes/user.php | Determines whether the site has a large number of users. |
| [get\_current\_network\_id()](get_current_network_id) wp-includes/load.php | Retrieves the current network ID. |
| [get\_user\_count()](get_user_count) wp-includes/user.php | Returns the number of active users in your installation. |
| [get\_blog\_count()](get_blog_count) wp-includes/ms-functions.php | Gets the number of active sites on the installation. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| Used By | Description |
| --- | --- |
| [WP\_MS\_Users\_List\_Table::prepare\_items()](../classes/wp_ms_users_list_table/prepare_items) wp-admin/includes/class-wp-ms-users-list-table.php | |
| [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. |
| [wp\_ajax\_autocomplete\_user()](wp_ajax_autocomplete_user) wp-admin/includes/ajax-actions.php | Ajax handler for user autocomplete. |
| [WP\_User\_Query::prepare\_query()](../classes/wp_user_query/prepare_query) wp-includes/class-wp-user-query.php | Prepares the query variables. |
| [wp\_get\_sites()](wp_get_sites) wp-includes/ms-deprecated.php | Return an array of sites for a network or networks. |
| [wp\_maybe\_update\_network\_site\_counts()](wp_maybe_update_network_site_counts) wp-includes/ms-functions.php | Updates the count of sites for the current network. |
| [wp\_maybe\_update\_network\_user\_counts()](wp_maybe_update_network_user_counts) wp-includes/ms-functions.php | Updates the network-wide users count. |
| Version | Description |
| --- | --- |
| [4.8.0](https://developer.wordpress.org/reference/since/4.8.0/) | The `$network_id` parameter has been added. |
| [3.3.0](https://developer.wordpress.org/reference/since/3.3.0/) | Introduced. |
wordpress image_downsize( int $id, string|int[] $size = 'medium' ): array|false image\_downsize( int $id, string|int[] $size = 'medium' ): array|false
======================================================================
Scales an image to fit a particular size (such as ‘thumb’ or ‘medium’).
The URL might be the original image, or it might be a resized version. This function won’t create a new resized copy, it will just return an already resized one if it exists.
A plugin may use the [‘image\_downsize’](../hooks/image_downsize) filter to hook into and offer image resizing services for images. The hook must return an array with the same elements that are normally returned from the function.
`$id` int Required Attachment ID for image. `$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 `'medium'`. Default: `'medium'`
array|false Array of image data, or boolean false if no image is available.
* stringImage source URL.
* `1`intImage width in pixels.
* `2`intImage height in pixels.
* `3`boolWhether the image is a resized image.
File: `wp-includes/media.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/media.php/)
```
function image_downsize( $id, $size = 'medium' ) {
$is_image = wp_attachment_is_image( $id );
/**
* Filters whether to preempt the output of image_downsize().
*
* Returning a truthy value from the filter will effectively short-circuit
* down-sizing the image, returning that value instead.
*
* @since 2.5.0
*
* @param bool|array $downsize Whether to short-circuit the image downsize.
* @param int $id Attachment ID for image.
* @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).
*/
$out = apply_filters( 'image_downsize', false, $id, $size );
if ( $out ) {
return $out;
}
$img_url = wp_get_attachment_url( $id );
$meta = wp_get_attachment_metadata( $id );
$width = 0;
$height = 0;
$is_intermediate = false;
$img_url_basename = wp_basename( $img_url );
// If the file isn't an image, attempt to replace its URL with a rendered image from its meta.
// Otherwise, a non-image type could be returned.
if ( ! $is_image ) {
if ( ! empty( $meta['sizes']['full'] ) ) {
$img_url = str_replace( $img_url_basename, $meta['sizes']['full']['file'], $img_url );
$img_url_basename = $meta['sizes']['full']['file'];
$width = $meta['sizes']['full']['width'];
$height = $meta['sizes']['full']['height'];
} else {
return false;
}
}
// Try for a new style intermediate size.
$intermediate = image_get_intermediate_size( $id, $size );
if ( $intermediate ) {
$img_url = str_replace( $img_url_basename, $intermediate['file'], $img_url );
$width = $intermediate['width'];
$height = $intermediate['height'];
$is_intermediate = true;
} elseif ( 'thumbnail' === $size && ! empty( $meta['thumb'] ) && is_string( $meta['thumb'] ) ) {
// Fall back to the old thumbnail.
$imagefile = get_attached_file( $id );
$thumbfile = str_replace( wp_basename( $imagefile ), wp_basename( $meta['thumb'] ), $imagefile );
if ( file_exists( $thumbfile ) ) {
$info = wp_getimagesize( $thumbfile );
if ( $info ) {
$img_url = str_replace( $img_url_basename, wp_basename( $thumbfile ), $img_url );
$width = $info[0];
$height = $info[1];
$is_intermediate = true;
}
}
}
if ( ! $width && ! $height && isset( $meta['width'], $meta['height'] ) ) {
// Any other type: use the real image.
$width = $meta['width'];
$height = $meta['height'];
}
if ( $img_url ) {
// We have the actual image size, but might need to further constrain it if content_width is narrower.
list( $width, $height ) = image_constrain_size_for_editor( $width, $height, $size );
return array( $img_url, $width, $height, $is_intermediate );
}
return false;
}
```
[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) .
| Uses | Description |
| --- | --- |
| [wp\_getimagesize()](wp_getimagesize) wp-includes/media.php | Allows PHP’s getimagesize() to be debuggable when necessary. |
| [image\_get\_intermediate\_size()](image_get_intermediate_size) wp-includes/media.php | Retrieves the image’s intermediate size (resized) path, width, and height. |
| [image\_constrain\_size\_for\_editor()](image_constrain_size_for_editor) wp-includes/media.php | Scales down the default size of an image. |
| [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. |
| [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(). |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| Used By | Description |
| --- | --- |
| [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. |
| [get\_image\_tag()](get_image_tag) wp-includes/media.php | Gets an img tag for an image attachment, scaling it down if requested. |
| [wp\_get\_attachment\_image\_src()](wp_get_attachment_image_src) wp-includes/media.php | Retrieves an image to represent an attachment. |
| [wp\_xmlrpc\_server::\_prepare\_media\_item()](../classes/wp_xmlrpc_server/_prepare_media_item) wp-includes/class-wp-xmlrpc-server.php | Prepares media item data for return in an XML-RPC object. |
| Version | Description |
| --- | --- |
| [2.5.0](https://developer.wordpress.org/reference/since/2.5.0/) | Introduced. |
wordpress wp_generator() wp\_generator()
===============
Displays the XHTML generator that is generated on the wp\_head hook.
See [‘wp\_head’](../hooks/wp_head).
File: `wp-includes/general-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/general-template.php/)
```
function wp_generator() {
/**
* Filters the output of the XHTML generator tag.
*
* @since 2.5.0
*
* @param string $generator_type The XHTML generator.
*/
the_generator( apply_filters( 'wp_generator_type', 'xhtml' ) );
}
```
[apply\_filters( 'wp\_generator\_type', string $generator\_type )](../hooks/wp_generator_type)
Filters the output of the XHTML generator tag.
| Uses | Description |
| --- | --- |
| [the\_generator()](the_generator) wp-includes/general-template.php | Displays the generator XML or Comment for RSS, ATOM, etc. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| Version | Description |
| --- | --- |
| [2.5.0](https://developer.wordpress.org/reference/since/2.5.0/) | Introduced. |
wordpress post_form_autocomplete_off() post\_form\_autocomplete\_off()
===============================
This function has been deprecated.
Disables autocomplete on the ‘post’ form (Add/Edit Post screens) for WebKit browsers, as they disregard the autocomplete setting on the editor textarea. That can break the editor when the user navigates to it with the browser’s Back button. See #28037
Replaced with [wp\_page\_reload\_on\_back\_button\_js()](wp_page_reload_on_back_button_js) that also fixes this problem.
File: `wp-admin/includes/deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/deprecated.php/)
```
function post_form_autocomplete_off() {
global $is_safari, $is_chrome;
_deprecated_function( __FUNCTION__, '4.6.0' );
if ( $is_safari || $is_chrome ) {
echo ' autocomplete="off"';
}
}
```
| 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.6.0](https://developer.wordpress.org/reference/since/4.6.0/) | This function has been deprecated. |
| [4.0.0](https://developer.wordpress.org/reference/since/4.0.0/) | Introduced. |
| programming_docs |
wordpress remove_meta_box( string $id, string|array|WP_Screen $screen, string $context ) remove\_meta\_box( string $id, string|array|WP\_Screen $screen, string $context )
=================================================================================
Removes a meta box from one or more screens.
`$id` string Required Meta box ID (used in the `'id'` attribute for the meta box). `$screen` string|array|[WP\_Screen](../classes/wp_screen) Required The screen or screens on which the meta box is shown (such as a post type, `'link'`, or `'comment'`). Accepts a single screen ID, [WP\_Screen](../classes/wp_screen) object, or array of screen IDs. `$context` string Required The context within the screen where the box is set to display.
Contexts vary from screen to screen. Post edit screen contexts include `'normal'`, `'side'`, and `'advanced'`. Comments screen contexts include `'normal'` and `'side'`. Menus meta boxes (accordion sections) all use the `'side'` context. Because you can’t remove a meta box until it’s been added, it’s important to make sure your call to [remove\_meta\_box()](remove_meta_box) happens in the right sequence. Just adding a call to [remove\_meta\_box()](remove_meta_box) bare in your *functions.php* will probably not do the trick.
The [add\_meta\_boxes](https://codex.wordpress.org/Plugin_API/Action_Reference/add_meta_boxes "Plugin API/Action Reference/add meta boxes") action hook is probably a good candidate since most of your meta boxes are generated on the edit post form page. This hook is called in the `[wp-admin/edit-form-advanced.php](https://core.trac.wordpress.org/browser/tags/5.3/src/wp-admin/edit-form-advanced.php#L0)` file *after* all the meta boxes have been successfully added to the page. This affects all meta boxes (conceivably, other than those that are custom generated by a theme or plugin) that appear on post edit pages (including custom post types edit pages) of the administration back-end.
File: `wp-admin/includes/template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/template.php/)
```
function remove_meta_box( $id, $screen, $context ) {
global $wp_meta_boxes;
if ( empty( $screen ) ) {
$screen = get_current_screen();
} elseif ( is_string( $screen ) ) {
$screen = convert_to_screen( $screen );
} elseif ( is_array( $screen ) ) {
foreach ( $screen as $single_screen ) {
remove_meta_box( $id, $single_screen, $context );
}
}
if ( ! isset( $screen->id ) ) {
return;
}
$page = $screen->id;
if ( ! isset( $wp_meta_boxes ) ) {
$wp_meta_boxes = array();
}
if ( ! isset( $wp_meta_boxes[ $page ] ) ) {
$wp_meta_boxes[ $page ] = array();
}
if ( ! isset( $wp_meta_boxes[ $page ][ $context ] ) ) {
$wp_meta_boxes[ $page ][ $context ] = array();
}
foreach ( array( 'high', 'core', 'default', 'low' ) as $priority ) {
$wp_meta_boxes[ $page ][ $context ][ $priority ][ $id ] = false;
}
}
```
| 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. |
| [remove\_meta\_box()](remove_meta_box) wp-admin/includes/template.php | Removes a meta box from one or more screens. |
| Used By | Description |
| --- | --- |
| [remove\_meta\_box()](remove_meta_box) wp-admin/includes/template.php | Removes a meta box from one or more screens. |
| Version | Description |
| --- | --- |
| [4.4.0](https://developer.wordpress.org/reference/since/4.4.0/) | The `$screen` parameter now accepts an array of screen IDs. |
| [2.6.0](https://developer.wordpress.org/reference/since/2.6.0/) | Introduced. |
wordpress adjacent_posts_rel_link( string $title = '%title', bool $in_same_term = false, int[]|string $excluded_terms = '', string $taxonomy = 'category' ) adjacent\_posts\_rel\_link( string $title = '%title', bool $in\_same\_term = false, int[]|string $excluded\_terms = '', string $taxonomy = 'category' )
=======================================================================================================================================================
Displays the relational links for the posts adjacent to the current post.
`$title` string Optional Link title 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'`
File: `wp-includes/link-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/link-template.php/)
```
function adjacent_posts_rel_link( $title = '%title', $in_same_term = false, $excluded_terms = '', $taxonomy = 'category' ) {
echo get_adjacent_post_rel_link( $title, $in_same_term, $excluded_terms, true, $taxonomy );
echo get_adjacent_post_rel_link( $title, $in_same_term, $excluded_terms, false, $taxonomy );
}
```
| Uses | Description |
| --- | --- |
| [get\_adjacent\_post\_rel\_link()](get_adjacent_post_rel_link) wp-includes/link-template.php | Retrieves the adjacent post relational link. |
| Used By | Description |
| --- | --- |
| [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. |
| Version | Description |
| --- | --- |
| [2.8.0](https://developer.wordpress.org/reference/since/2.8.0/) | Introduced. |
wordpress setup_userdata( int $for_user_id ) setup\_userdata( int $for\_user\_id )
=====================================
Sets up global user vars.
Used by [wp\_set\_current\_user()](wp_set_current_user) for back compat. Might be deprecated in the future.
`$for_user_id` int Optional User ID to set up global data. Default 0. File: `wp-includes/user.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/user.php/)
```
function setup_userdata( $for_user_id = 0 ) {
global $user_login, $userdata, $user_level, $user_ID, $user_email, $user_url, $user_identity;
if ( ! $for_user_id ) {
$for_user_id = get_current_user_id();
}
$user = get_userdata( $for_user_id );
if ( ! $user ) {
$user_ID = 0;
$user_level = 0;
$userdata = null;
$user_login = '';
$user_email = '';
$user_url = '';
$user_identity = '';
return;
}
$user_ID = (int) $user->ID;
$user_level = (int) $user->user_level;
$userdata = $user;
$user_login = $user->user_login;
$user_email = $user->user_email;
$user_url = $user->user_url;
$user_identity = $user->display_name;
}
```
| Uses | Description |
| --- | --- |
| [get\_userdata()](get_userdata) wp-includes/pluggable.php | Retrieves user info by user ID. |
| [get\_current\_user\_id()](get_current_user_id) wp-includes/user.php | Gets the current user’s ID. |
| Used By | Description |
| --- | --- |
| [wp\_set\_current\_user()](wp_set_current_user) wp-includes/pluggable.php | Changes the current user by ID or name. |
| Version | Description |
| --- | --- |
| [2.0.4](https://developer.wordpress.org/reference/since/2.0.4/) | Introduced. |
wordpress wp_admin_bar_edit_menu( WP_Admin_Bar $wp_admin_bar ) wp\_admin\_bar\_edit\_menu( WP\_Admin\_Bar $wp\_admin\_bar )
============================================================
Provides an edit link for posts and terms.
`$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_menu( $wp_admin_bar ) {
global $tag, $wp_the_query, $user_id, $post_id;
if ( is_admin() ) {
$current_screen = get_current_screen();
$post = get_post();
$post_type_object = null;
if ( 'post' === $current_screen->base ) {
$post_type_object = get_post_type_object( $post->post_type );
} elseif ( 'edit' === $current_screen->base ) {
$post_type_object = get_post_type_object( $current_screen->post_type );
} elseif ( 'edit-comments' === $current_screen->base && $post_id ) {
$post = get_post( $post_id );
if ( $post ) {
$post_type_object = get_post_type_object( $post->post_type );
}
}
if ( ( 'post' === $current_screen->base || 'edit-comments' === $current_screen->base )
&& 'add' !== $current_screen->action
&& ( $post_type_object )
&& current_user_can( 'read_post', $post->ID )
&& ( $post_type_object->public )
&& ( $post_type_object->show_in_admin_bar ) ) {
if ( 'draft' === $post->post_status ) {
$preview_link = get_preview_post_link( $post );
$wp_admin_bar->add_node(
array(
'id' => 'preview',
'title' => $post_type_object->labels->view_item,
'href' => esc_url( $preview_link ),
'meta' => array( 'target' => 'wp-preview-' . $post->ID ),
)
);
} else {
$wp_admin_bar->add_node(
array(
'id' => 'view',
'title' => $post_type_object->labels->view_item,
'href' => get_permalink( $post->ID ),
)
);
}
} elseif ( 'edit' === $current_screen->base
&& ( $post_type_object )
&& ( $post_type_object->public )
&& ( $post_type_object->show_in_admin_bar )
&& ( get_post_type_archive_link( $post_type_object->name ) )
&& ! ( 'post' === $post_type_object->name && 'posts' === get_option( 'show_on_front' ) ) ) {
$wp_admin_bar->add_node(
array(
'id' => 'archive',
'title' => $post_type_object->labels->view_items,
'href' => get_post_type_archive_link( $current_screen->post_type ),
)
);
} elseif ( 'term' === $current_screen->base && isset( $tag ) && is_object( $tag ) && ! is_wp_error( $tag ) ) {
$tax = get_taxonomy( $tag->taxonomy );
if ( is_term_publicly_viewable( $tag ) ) {
$wp_admin_bar->add_node(
array(
'id' => 'view',
'title' => $tax->labels->view_item,
'href' => get_term_link( $tag ),
)
);
}
} elseif ( 'user-edit' === $current_screen->base && isset( $user_id ) ) {
$user_object = get_userdata( $user_id );
$view_link = get_author_posts_url( $user_object->ID );
if ( $user_object->exists() && $view_link ) {
$wp_admin_bar->add_node(
array(
'id' => 'view',
'title' => __( 'View User' ),
'href' => $view_link,
)
);
}
}
} else {
$current_object = $wp_the_query->get_queried_object();
if ( empty( $current_object ) ) {
return;
}
if ( ! empty( $current_object->post_type ) ) {
$post_type_object = get_post_type_object( $current_object->post_type );
$edit_post_link = get_edit_post_link( $current_object->ID );
if ( $post_type_object
&& $edit_post_link
&& current_user_can( 'edit_post', $current_object->ID )
&& $post_type_object->show_in_admin_bar ) {
$wp_admin_bar->add_node(
array(
'id' => 'edit',
'title' => $post_type_object->labels->edit_item,
'href' => $edit_post_link,
)
);
}
} elseif ( ! empty( $current_object->taxonomy ) ) {
$tax = get_taxonomy( $current_object->taxonomy );
$edit_term_link = get_edit_term_link( $current_object->term_id, $current_object->taxonomy );
if ( $tax && $edit_term_link && current_user_can( 'edit_term', $current_object->term_id ) ) {
$wp_admin_bar->add_node(
array(
'id' => 'edit',
'title' => $tax->labels->edit_item,
'href' => $edit_term_link,
)
);
}
} elseif ( is_a( $current_object, 'WP_User' ) && current_user_can( 'edit_user', $current_object->ID ) ) {
$edit_user_link = get_edit_user_link( $current_object->ID );
if ( $edit_user_link ) {
$wp_admin_bar->add_node(
array(
'id' => 'edit',
'title' => __( 'Edit User' ),
'href' => $edit_user_link,
)
);
}
}
}
}
```
| Uses | Description |
| --- | --- |
| [is\_term\_publicly\_viewable()](is_term_publicly_viewable) wp-includes/taxonomy.php | Determines whether a term is publicly viewable. |
| [get\_preview\_post\_link()](get_preview_post_link) wp-includes/link-template.php | Retrieves the URL used for the post preview. |
| [get\_author\_posts\_url()](get_author_posts_url) wp-includes/author-template.php | Retrieves the URL to the author page for the user with the ID provided. |
| [WP\_Admin\_Bar::add\_node()](../classes/wp_admin_bar/add_node) wp-includes/class-wp-admin-bar.php | Adds a node to the menu. |
| [get\_edit\_term\_link()](get_edit_term_link) wp-includes/link-template.php | Retrieves the URL for editing a given term. |
| [get\_edit\_post\_link()](get_edit_post_link) wp-includes/link-template.php | Retrieves the edit post link for post. |
| [get\_post\_type\_archive\_link()](get_post_type_archive_link) wp-includes/link-template.php | Retrieves the permalink for a post type archive. |
| [get\_edit\_user\_link()](get_edit_user_link) wp-includes/link-template.php | Retrieves the edit user link. |
| [get\_term\_link()](get_term_link) wp-includes/taxonomy.php | Generates a permalink for a taxonomy term archive. |
| [get\_current\_screen()](get_current_screen) wp-admin/includes/screen.php | Get the current screen object |
| [get\_taxonomy()](get_taxonomy) wp-includes/taxonomy.php | Retrieves the taxonomy object of $taxonomy. |
| [is\_admin()](is_admin) wp-includes/load.php | Determines whether the current request is for an administrative interface page. |
| [get\_userdata()](get_userdata) wp-includes/pluggable.php | Retrieves user info by user ID. |
| [esc\_url()](esc_url) wp-includes/formatting.php | Checks and cleans a URL. |
| [\_\_()](__) 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. |
| [current\_user\_can()](current_user_can) wp-includes/capabilities.php | Returns whether the current user has the specified capability. |
| [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. |
| [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. |
| Version | Description |
| --- | --- |
| [5.5.0](https://developer.wordpress.org/reference/since/5.5.0/) | Added a "View Post" link on Comments screen for a single post. |
| [3.1.0](https://developer.wordpress.org/reference/since/3.1.0/) | Introduced. |
wordpress wp_get_auto_update_message(): string wp\_get\_auto\_update\_message(): string
========================================
Determines the appropriate auto-update message to be displayed.
string The update message to be shown.
File: `wp-admin/includes/update.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/update.php/)
```
function wp_get_auto_update_message() {
$next_update_time = wp_next_scheduled( 'wp_version_check' );
// Check if the event exists.
if ( false === $next_update_time ) {
$message = __( 'Automatic update not scheduled. There may be a problem with WP-Cron.' );
} else {
$time_to_next_update = human_time_diff( (int) $next_update_time );
// See if cron is overdue.
$overdue = ( time() - $next_update_time ) > 0;
if ( $overdue ) {
$message = sprintf(
/* translators: %s: Duration that WP-Cron has been overdue. */
__( 'Automatic update overdue by %s. There may be a problem with WP-Cron.' ),
$time_to_next_update
);
} else {
$message = sprintf(
/* translators: %s: Time until the next update. */
__( 'Automatic update scheduled in %s.' ),
$time_to_next_update
);
}
}
return $message;
}
```
| Uses | Description |
| --- | --- |
| [wp\_next\_scheduled()](wp_next_scheduled) wp-includes/cron.php | Retrieve the next timestamp for an event. |
| [human\_time\_diff()](human_time_diff) wp-includes/formatting.php | Determines the difference between two timestamps. |
| [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. |
| Used By | Description |
| --- | --- |
| [core\_auto\_updates\_settings()](core_auto_updates_settings) wp-admin/update-core.php | Display WordPress auto-updates settings. |
| [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\_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. |
| [WP\_Plugins\_List\_Table::single\_row()](../classes/wp_plugins_list_table/single_row) wp-admin/includes/class-wp-plugins-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. |
| Version | Description |
| --- | --- |
| [5.5.0](https://developer.wordpress.org/reference/since/5.5.0/) | Introduced. |
wordpress heartbeat_autosave( array $response, array $data ): array heartbeat\_autosave( array $response, array $data ): array
==========================================================
Performs autosave with heartbeat.
`$response` array Required The Heartbeat response. `$data` array Required The $\_POST data sent. 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 heartbeat_autosave( $response, $data ) {
if ( ! empty( $data['wp_autosave'] ) ) {
$saved = wp_autosave( $data['wp_autosave'] );
if ( is_wp_error( $saved ) ) {
$response['wp_autosave'] = array(
'success' => false,
'message' => $saved->get_error_message(),
);
} elseif ( empty( $saved ) ) {
$response['wp_autosave'] = array(
'success' => false,
'message' => __( 'Error while saving.' ),
);
} else {
/* translators: Draft saved date format, see https://www.php.net/manual/datetime.format.php */
$draft_saved_date_format = __( 'g:i:s a' );
$response['wp_autosave'] = array(
'success' => true,
/* translators: %s: Date and time. */
'message' => sprintf( __( 'Draft saved at %s.' ), date_i18n( $draft_saved_date_format ) ),
);
}
}
return $response;
}
```
| Uses | Description |
| --- | --- |
| [wp\_autosave()](wp_autosave) wp-admin/includes/post.php | Saves a post submitted with XHR. |
| [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. |
| [\_\_()](__) 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.9.0](https://developer.wordpress.org/reference/since/3.9.0/) | Introduced. |
wordpress is_blog_user( int $blog_id ): bool is\_blog\_user( int $blog\_id ): bool
=====================================
This function has been deprecated. Use [is\_user\_member\_of\_blog()](is_user_member_of_blog) instead.
Checks if the current user belong to a given site.
* [is\_user\_member\_of\_blog()](is_user_member_of_blog)
`$blog_id` int Required Site ID bool True if the current users belong to $blog\_id, false if not.
File: `wp-includes/deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/deprecated.php/)
```
function is_blog_user( $blog_id = 0 ) {
_deprecated_function( __FUNCTION__, '3.3.0', 'is_user_member_of_blog()' );
return is_user_member_of_blog( get_current_user_id(), $blog_id );
}
```
| Uses | Description |
| --- | --- |
| [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. |
| [\_deprecated\_function()](_deprecated_function) wp-includes/functions.php | Marks a function as deprecated and inform when it has been used. |
| [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/) | Use [is\_user\_member\_of\_blog()](is_user_member_of_blog) |
| [MU (3.0.0)](https://developer.wordpress.org/reference/since/mu.3.0.0/) | Introduced. |
| programming_docs |
wordpress get_custom_header_markup(): string get\_custom\_header\_markup(): string
=====================================
Retrieves the markup for a custom header.
The container div will always be returned in the Customizer preview.
string The markup for a custom header on success.
File: `wp-includes/theme.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/theme.php/)
```
function get_custom_header_markup() {
if ( ! has_custom_header() && ! is_customize_preview() ) {
return '';
}
return sprintf(
'<div id="wp-custom-header" class="wp-custom-header">%s</div>',
get_header_image_tag()
);
}
```
| Uses | Description |
| --- | --- |
| [has\_custom\_header()](has_custom_header) wp-includes/theme.php | Checks whether a custom header is set or not. |
| [get\_header\_image\_tag()](get_header_image_tag) wp-includes/theme.php | Creates image tag markup for a custom header image. |
| [is\_customize\_preview()](is_customize_preview) wp-includes/theme.php | Whether the site is being previewed in the Customizer. |
| Used By | Description |
| --- | --- |
| [the\_custom\_header\_markup()](the_custom_header_markup) wp-includes/theme.php | Prints the markup for a custom header. |
| Version | Description |
| --- | --- |
| [4.7.0](https://developer.wordpress.org/reference/since/4.7.0/) | Introduced. |
wordpress do_enclose( string|null $content, int|WP_Post $post ): void|false do\_enclose( string|null $content, int|WP\_Post $post ): void|false
===================================================================
Checks content for video and audio links to add as enclosures.
Will not add enclosures that have already been added and will remove enclosures that are no longer in the post. This is called as pingbacks and trackbacks.
`$content` string|null Required Post content. If `null`, the `post_content` field from `$post` is used. `$post` int|[WP\_Post](../classes/wp_post) Required Post ID or post object. void|false Void on success, false if the post is not found.
File: `wp-includes/functions.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/functions.php/)
```
function do_enclose( $content, $post ) {
global $wpdb;
// @todo Tidy this code and make the debug code optional.
include_once ABSPATH . WPINC . '/class-IXR.php';
$post = get_post( $post );
if ( ! $post ) {
return false;
}
if ( null === $content ) {
$content = $post->post_content;
}
$post_links = array();
$pung = get_enclosed( $post->ID );
$post_links_temp = wp_extract_urls( $content );
foreach ( $pung as $link_test ) {
// Link is no longer in post.
if ( ! in_array( $link_test, $post_links_temp, true ) ) {
$mids = $wpdb->get_col( $wpdb->prepare( "SELECT meta_id FROM $wpdb->postmeta WHERE post_id = %d AND meta_key = 'enclosure' AND meta_value LIKE %s", $post->ID, $wpdb->esc_like( $link_test ) . '%' ) );
foreach ( $mids as $mid ) {
delete_metadata_by_mid( 'post', $mid );
}
}
}
foreach ( (array) $post_links_temp as $link_test ) {
// If we haven't pung it already.
if ( ! in_array( $link_test, $pung, true ) ) {
$test = parse_url( $link_test );
if ( false === $test ) {
continue;
}
if ( isset( $test['query'] ) ) {
$post_links[] = $link_test;
} elseif ( isset( $test['path'] ) && ( '/' !== $test['path'] ) && ( '' !== $test['path'] ) ) {
$post_links[] = $link_test;
}
}
}
/**
* Filters the list of enclosure links before querying the database.
*
* Allows for the addition and/or removal of potential enclosures to save
* to postmeta before checking the database for existing enclosures.
*
* @since 4.4.0
*
* @param string[] $post_links An array of enclosure links.
* @param int $post_ID Post ID.
*/
$post_links = apply_filters( 'enclosure_links', $post_links, $post->ID );
foreach ( (array) $post_links as $url ) {
$url = strip_fragment_from_url( $url );
if ( '' !== $url && ! $wpdb->get_var( $wpdb->prepare( "SELECT post_id FROM $wpdb->postmeta WHERE post_id = %d AND meta_key = 'enclosure' AND meta_value LIKE %s", $post->ID, $wpdb->esc_like( $url ) . '%' ) ) ) {
$headers = wp_get_http_headers( $url );
if ( $headers ) {
$len = isset( $headers['content-length'] ) ? (int) $headers['content-length'] : 0;
$type = isset( $headers['content-type'] ) ? $headers['content-type'] : '';
$allowed_types = array( 'video', 'audio' );
// Check to see if we can figure out the mime type from the extension.
$url_parts = parse_url( $url );
if ( false !== $url_parts && ! empty( $url_parts['path'] ) ) {
$extension = pathinfo( $url_parts['path'], PATHINFO_EXTENSION );
if ( ! empty( $extension ) ) {
foreach ( wp_get_mime_types() as $exts => $mime ) {
if ( preg_match( '!^(' . $exts . ')$!i', $extension ) ) {
$type = $mime;
break;
}
}
}
}
if ( in_array( substr( $type, 0, strpos( $type, '/' ) ), $allowed_types, true ) ) {
add_post_meta( $post->ID, 'enclosure', "$url\n$len\n$mime\n" );
}
}
}
}
}
```
[apply\_filters( 'enclosure\_links', string[] $post\_links, int $post\_ID )](../hooks/enclosure_links)
Filters the list of enclosure links before querying the database.
| Uses | Description |
| --- | --- |
| [strip\_fragment\_from\_url()](strip_fragment_from_url) wp-includes/canonical.php | Strips the #fragment from a URL, if one is present. |
| [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\_get\_mime\_types()](wp_get_mime_types) wp-includes/functions.php | Retrieves the list of mime types and file extensions. |
| [wp\_extract\_urls()](wp_extract_urls) wp-includes/functions.php | Uses RegEx to extract URLs from arbitrary content. |
| [wp\_get\_http\_headers()](wp_get_http_headers) wp-includes/functions.php | Retrieves HTTP Headers from URL. |
| [get\_enclosed()](get_enclosed) wp-includes/post.php | Retrieves enclosures already enclosed for a post. |
| [add\_post\_meta()](add_post_meta) wp-includes/post.php | Adds a meta field to the given post. |
| [wpdb::get\_col()](../classes/wpdb/get_col) wp-includes/class-wpdb.php | Retrieves one column from the database. |
| [delete\_metadata\_by\_mid()](delete_metadata_by_mid) wp-includes/meta.php | Deletes metadata by meta ID. |
| [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. |
| [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 |
| --- | --- |
| [do\_all\_enclosures()](do_all_enclosures) wp-includes/comment.php | Performs all enclosures. |
| Version | Description |
| --- | --- |
| [5.6.0](https://developer.wordpress.org/reference/since/5.6.0/) | The `$content` parameter is no longer optional, but passing `null` to skip it is still supported. |
| [5.3.0](https://developer.wordpress.org/reference/since/5.3.0/) | The `$content` parameter was made optional, and the `$post` parameter was updated to accept a post ID or a [WP\_Post](../classes/wp_post) object. |
| [1.5.0](https://developer.wordpress.org/reference/since/1.5.0/) | Introduced. |
wordpress add_theme_support( string $feature, mixed $args ): void|false add\_theme\_support( string $feature, mixed $args ): void|false
===============================================================
Registers theme support for a given feature.
Must be called in the theme’s functions.php file to work.
If attached to a hook, it must be [‘after\_setup\_theme’](../hooks/after_setup_theme).
The [‘init’](../hooks/init) hook may be too late for some features.
Example usage:
```
add_theme_support( 'title-tag' );
add_theme_support( 'custom-logo', array(
'height' => 480,
'width' => 720,
) );
```
`$feature` string Required 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 pass along with certain features. void|false Void on success, false on failure.
This feature enables [Post Formats](https://codex.wordpress.org/Post_Formats) support for a theme. When using [child themes](https://codex.wordpress.org/Child_Themes "Child Themes"), be aware that `add_theme_support( 'post-formats' )` will **override** the formats as defined by the parent theme, not add to it. To enable the specific formats (see supported formats at [Post Formats](https://codex.wordpress.org/Post_Formats)), use:
```
add_theme_support( 'post-formats', array( 'aside', 'gallery' ) );
```
To check if there is a ‘quote’ post format assigned to the post, use [has\_post\_format()](has_post_format) :
```
// In your theme single.php, page.php or custom post type
if ( has_post_format( 'quote' ) ) {
echo 'This is a quote.';
}
```
This feature enables [Post Thumbnails](https://codex.wordpress.org/Post_Thumbnails) support for a theme. Note that you can optionally pass a second argument, `$args`, with an array of the [Post Types](https://codex.wordpress.org/Post_Types) for which you want to enable this feature.
```
add_theme_support( 'post-thumbnails' );
add_theme_support( 'post-thumbnails', array( 'post' ) ); // Posts only
add_theme_support( 'post-thumbnails', array( 'page' ) ); // Pages only
add_theme_support( 'post-thumbnails', array( 'post', 'movie' ) ); // Posts and Movies
```
This feature must be called before the [‘init’](../hooks/init) hook is fired. That means it needs to be placed directly into functions.php or within a function attached to the [‘after\_setup\_theme’](../hooks/after_setup_theme) hook. For custom post types, you can also add post thumbnails using the [register\_post\_type()](register_post_type) function as well. To display thumbnails in themes index.php or single.php or custom templates, use:
```
the_post_thumbnail();
```
To check if there is a post thumbnail assigned to the post before displaying it, use:
```
if ( has_post_thumbnail() ) {
the_post_thumbnail();
}
```
This feature enables [Custom\_Backgrounds](https://codex.wordpress.org/Custom_Backgrounds "Custom Backgrounds") support for a theme.
```
add_theme_support( 'custom-background' );
```
Note that you can add default arguments using:
```
$defaults = array(
'default-image' => '',
'default-preset' => 'default', // 'default', 'fill', 'fit', 'repeat', 'custom'
'default-position-x' => 'left', // 'left', 'center', 'right'
'default-position-y' => 'top', // 'top', 'center', 'bottom'
'default-size' => 'auto', // 'auto', 'contain', 'cover'
'default-repeat' => 'repeat', // 'repeat-x', 'repeat-y', 'repeat', 'no-repeat'
'default-attachment' => 'scroll', // 'scroll', 'fixed'
'default-color' => '',
'wp-head-callback' => '_custom_background_cb',
'admin-head-callback' => '',
'admin-preview-callback' => '',
);
add_theme_support( 'custom-background', $defaults );
```
This feature enables [Custom\_Headers](https://codex.wordpress.org/Custom_Headers) support for a theme.
```
add_theme_support( 'custom-header' );
```
Note that you can add default arguments using:
```
$defaults = array(
'default-image' => '',
'random-default' => false,
'width' => 0,
'height' => 0,
'flex-height' => false,
'flex-width' => false,
'default-text-color' => '',
'header-text' => true,
'uploads' => true,
'wp-head-callback' => '',
'admin-head-callback' => '',
'admin-preview-callback' => '',
'video' => false,
'video-active-callback' => 'is_front_page',
);
add_theme_support( 'custom-header', $defaults );
```
This feature, first introduced in [Version\_4.5](https://codex.wordpress.org/Version_4.5 "Version 4.5"), enables [Theme\_Logo](https://codex.wordpress.org/Theme_Logo) support for a theme.
```
add_theme_support( 'custom-logo' );
```
Note that you can add default arguments using:
```
add_theme_support( 'custom-logo', array(
'height' => 100,
'width' => 400,
'flex-height' => true,
'flex-width' => true,
'header-text' => array( 'site-title', 'site-description' ),
'unlink-homepage-logo' => true,
) );
```
This feature enables [Automatic Feed Links](https://codex.wordpress.org/Automatic_Feed_Links) for post and comment in the head. This should be used in place of the deprecated [automatic\_feed\_links()](automatic_feed_links) function.
```
add_theme_support( 'automatic-feed-links' );
```
This feature allows the use of [HTML5 markup](https://codex.wordpress.org/Theme_Markup) for the search forms, comment forms, comment lists, gallery, and caption.
```
add_theme_support( 'html5', array( 'comment-list', 'comment-form', 'search-form', 'gallery', 'caption', 'style', 'script' ) );
```
This feature enables plugins and themes to manage the [document title tag](https://codex.wordpress.org/Title_Tag). This should be used in place of [wp\_title()](wp_title) function.
```
add_theme_support( 'title-tag' );
```
This feature enables Selective Refresh for Widgets being managed within the Customizer. This feature became available in WordPress 4.5. For more on why and how Selective Refresh works read [Implementing Selective Refresh Support for Widgets](https://make.wordpress.org/core/2016/03/22/implementing-selective-refresh-support-for-widgets/).
```
add_theme_support( 'customize-selective-refresh-widgets' );
```
To show the “Featured Image” meta box in Multisite installation, make sure you update the allowed upload file types, in Network Admin, [Network Admin Settings SubPanel#Upload\_Settings](https://codex.wordpress.org/Network_Admin_Settings_SubPanel#Upload_Settings), Media upload buttons options. Default is `jpg jpeg png gif mp3 mov avi wmv midi mid pdf`. The following parameters are read only, and should only be used in the context of [current\_theme\_supports()](current_theme_supports) : * `sidebars`: Use [register\_sidebar()](register_sidebar) or [register\_sidebars()](register_sidebars) instead.
* `menus`: Use [register\_nav\_menu()](register_nav_menu) or [register\_nav\_menus()](register_nav_menus) instead.
* `editor-style`: Use [add\_editor\_style()](add_editor_style) instead.
File: `wp-includes/theme.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/theme.php/)
```
function add_theme_support( $feature, ...$args ) {
global $_wp_theme_features;
if ( ! $args ) {
$args = true;
}
switch ( $feature ) {
case 'post-thumbnails':
// All post types are already supported.
if ( true === get_theme_support( 'post-thumbnails' ) ) {
return;
}
/*
* Merge post types with any that already declared their support
* for post thumbnails.
*/
if ( isset( $args[0] ) && is_array( $args[0] ) && isset( $_wp_theme_features['post-thumbnails'] ) ) {
$args[0] = array_unique( array_merge( $_wp_theme_features['post-thumbnails'][0], $args[0] ) );
}
break;
case 'post-formats':
if ( isset( $args[0] ) && is_array( $args[0] ) ) {
$post_formats = get_post_format_slugs();
unset( $post_formats['standard'] );
$args[0] = array_intersect( $args[0], array_keys( $post_formats ) );
} else {
_doing_it_wrong(
"add_theme_support( 'post-formats' )",
__( 'You need to pass an array of post formats.' ),
'5.6.0'
);
return false;
}
break;
case 'html5':
// You can't just pass 'html5', you need to pass an array of types.
if ( empty( $args[0] ) || ! is_array( $args[0] ) ) {
_doing_it_wrong(
"add_theme_support( 'html5' )",
__( 'You need to pass an array of types.' ),
'3.6.1'
);
if ( ! empty( $args[0] ) && ! is_array( $args[0] ) ) {
return false;
}
// Build an array of types for back-compat.
$args = array( 0 => array( 'comment-list', 'comment-form', 'search-form' ) );
}
// Calling 'html5' again merges, rather than overwrites.
if ( isset( $_wp_theme_features['html5'] ) ) {
$args[0] = array_merge( $_wp_theme_features['html5'][0], $args[0] );
}
break;
case 'custom-logo':
if ( true === $args ) {
$args = array( 0 => array() );
}
$defaults = array(
'width' => null,
'height' => null,
'flex-width' => false,
'flex-height' => false,
'header-text' => '',
'unlink-homepage-logo' => false,
);
$args[0] = wp_parse_args( array_intersect_key( $args[0], $defaults ), $defaults );
// Allow full flexibility if no size is specified.
if ( is_null( $args[0]['width'] ) && is_null( $args[0]['height'] ) ) {
$args[0]['flex-width'] = true;
$args[0]['flex-height'] = true;
}
break;
case 'custom-header-uploads':
return add_theme_support( 'custom-header', array( 'uploads' => true ) );
case 'custom-header':
if ( true === $args ) {
$args = array( 0 => array() );
}
$defaults = array(
'default-image' => '',
'random-default' => false,
'width' => 0,
'height' => 0,
'flex-height' => false,
'flex-width' => false,
'default-text-color' => '',
'header-text' => true,
'uploads' => true,
'wp-head-callback' => '',
'admin-head-callback' => '',
'admin-preview-callback' => '',
'video' => false,
'video-active-callback' => 'is_front_page',
);
$jit = isset( $args[0]['__jit'] );
unset( $args[0]['__jit'] );
// Merge in data from previous add_theme_support() calls.
// The first value registered wins. (A child theme is set up first.)
if ( isset( $_wp_theme_features['custom-header'] ) ) {
$args[0] = wp_parse_args( $_wp_theme_features['custom-header'][0], $args[0] );
}
// Load in the defaults at the end, as we need to insure first one wins.
// This will cause all constants to be defined, as each arg will then be set to the default.
if ( $jit ) {
$args[0] = wp_parse_args( $args[0], $defaults );
}
/*
* If a constant was defined, use that value. Otherwise, define the constant to ensure
* the constant is always accurate (and is not defined later, overriding our value).
* As stated above, the first value wins.
* Once we get to wp_loaded (just-in-time), define any constants we haven't already.
* Constants are lame. Don't reference them. This is just for backward compatibility.
*/
if ( defined( 'NO_HEADER_TEXT' ) ) {
$args[0]['header-text'] = ! NO_HEADER_TEXT;
} elseif ( isset( $args[0]['header-text'] ) ) {
define( 'NO_HEADER_TEXT', empty( $args[0]['header-text'] ) );
}
if ( defined( 'HEADER_IMAGE_WIDTH' ) ) {
$args[0]['width'] = (int) HEADER_IMAGE_WIDTH;
} elseif ( isset( $args[0]['width'] ) ) {
define( 'HEADER_IMAGE_WIDTH', (int) $args[0]['width'] );
}
if ( defined( 'HEADER_IMAGE_HEIGHT' ) ) {
$args[0]['height'] = (int) HEADER_IMAGE_HEIGHT;
} elseif ( isset( $args[0]['height'] ) ) {
define( 'HEADER_IMAGE_HEIGHT', (int) $args[0]['height'] );
}
if ( defined( 'HEADER_TEXTCOLOR' ) ) {
$args[0]['default-text-color'] = HEADER_TEXTCOLOR;
} elseif ( isset( $args[0]['default-text-color'] ) ) {
define( 'HEADER_TEXTCOLOR', $args[0]['default-text-color'] );
}
if ( defined( 'HEADER_IMAGE' ) ) {
$args[0]['default-image'] = HEADER_IMAGE;
} elseif ( isset( $args[0]['default-image'] ) ) {
define( 'HEADER_IMAGE', $args[0]['default-image'] );
}
if ( $jit && ! empty( $args[0]['default-image'] ) ) {
$args[0]['random-default'] = false;
}
// If headers are supported, and we still don't have a defined width or height,
// we have implicit flex sizes.
if ( $jit ) {
if ( empty( $args[0]['width'] ) && empty( $args[0]['flex-width'] ) ) {
$args[0]['flex-width'] = true;
}
if ( empty( $args[0]['height'] ) && empty( $args[0]['flex-height'] ) ) {
$args[0]['flex-height'] = true;
}
}
break;
case 'custom-background':
if ( true === $args ) {
$args = array( 0 => array() );
}
$defaults = array(
'default-image' => '',
'default-preset' => 'default',
'default-position-x' => 'left',
'default-position-y' => 'top',
'default-size' => 'auto',
'default-repeat' => 'repeat',
'default-attachment' => 'scroll',
'default-color' => '',
'wp-head-callback' => '_custom_background_cb',
'admin-head-callback' => '',
'admin-preview-callback' => '',
);
$jit = isset( $args[0]['__jit'] );
unset( $args[0]['__jit'] );
// Merge in data from previous add_theme_support() calls. The first value registered wins.
if ( isset( $_wp_theme_features['custom-background'] ) ) {
$args[0] = wp_parse_args( $_wp_theme_features['custom-background'][0], $args[0] );
}
if ( $jit ) {
$args[0] = wp_parse_args( $args[0], $defaults );
}
if ( defined( 'BACKGROUND_COLOR' ) ) {
$args[0]['default-color'] = BACKGROUND_COLOR;
} elseif ( isset( $args[0]['default-color'] ) || $jit ) {
define( 'BACKGROUND_COLOR', $args[0]['default-color'] );
}
if ( defined( 'BACKGROUND_IMAGE' ) ) {
$args[0]['default-image'] = BACKGROUND_IMAGE;
} elseif ( isset( $args[0]['default-image'] ) || $jit ) {
define( 'BACKGROUND_IMAGE', $args[0]['default-image'] );
}
break;
// Ensure that 'title-tag' is accessible in the admin.
case 'title-tag':
// Can be called in functions.php but must happen before wp_loaded, i.e. not in header.php.
if ( did_action( 'wp_loaded' ) ) {
_doing_it_wrong(
"add_theme_support( 'title-tag' )",
sprintf(
/* translators: 1: title-tag, 2: wp_loaded */
__( 'Theme support for %1$s should be registered before the %2$s hook.' ),
'<code>title-tag</code>',
'<code>wp_loaded</code>'
),
'4.1.0'
);
return false;
}
}
$_wp_theme_features[ $feature ] = $args;
}
```
| Uses | Description |
| --- | --- |
| [get\_theme\_support()](get_theme_support) wp-includes/theme.php | Gets the theme support arguments passed when registering that support. |
| [add\_theme\_support()](add_theme_support) wp-includes/theme.php | Registers theme support for a given feature. |
| [did\_action()](did_action) wp-includes/plugin.php | Retrieves the number of times an action has been fired during the current request. |
| [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. |
| [\_doing\_it\_wrong()](_doing_it_wrong) wp-includes/functions.php | Marks something as being incorrectly called. |
| [wp\_parse\_args()](wp_parse_args) wp-includes/functions.php | Merges user defined arguments into defaults array. |
| Used By | Description |
| --- | --- |
| [\_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. |
| [wp\_enable\_block\_templates()](wp_enable_block_templates) wp-includes/theme-templates.php | Enables the block templates (editor mode) for themes with theme.json by default. |
| [wp\_setup\_widgets\_block\_editor()](wp_setup_widgets_block_editor) wp-includes/widgets.php | Enables the widgets block editor. This is hooked into ‘after\_setup\_theme’ so that the block editor is enabled by default but can be disabled by themes. |
| [add\_editor\_style()](add_editor_style) wp-includes/theme.php | Adds callback for custom TinyMCE editor stylesheets. |
| [add\_theme\_support()](add_theme_support) wp-includes/theme.php | Registers theme support for a given feature. |
| [\_custom\_header\_background\_just\_in\_time()](_custom_header_background_just_in_time) wp-includes/theme.php | Registers the internal custom header and background routines. |
| [\_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. |
| [add\_custom\_image\_header()](add_custom_image_header) wp-includes/deprecated.php | Add callbacks for image header display. |
| [add\_custom\_background()](add_custom_background) wp-includes/deprecated.php | Add callbacks for background image display. |
| [automatic\_feed\_links()](automatic_feed_links) wp-includes/deprecated.php | Enable/disable automatic general feed link outputting. |
| [register\_nav\_menus()](register_nav_menus) wp-includes/nav-menu.php | Registers navigation menu locations for a theme. |
| [register\_sidebar()](register_sidebar) wp-includes/widgets.php | Builds the definition for a single sidebar and returns the ID. |
| Version | Description |
| --- | --- |
| [6.0.0](https://developer.wordpress.org/reference/since/6.0.0/) | The `html5` feature warns if no array is passed as the second parameter. |
| [5.8.0](https://developer.wordpress.org/reference/since/5.8.0/) | The `widgets-block-editor` feature enables the Widgets block editor. |
| [5.6.0](https://developer.wordpress.org/reference/since/5.6.0/) | The `post-formats` feature warns if no array is passed as the second parameter. |
| [5.5.0](https://developer.wordpress.org/reference/since/5.5.0/) | The `custom-logo` feature now also accepts `'unlink-homepage-logo'`. |
| [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. |
| [5.0.0](https://developer.wordpress.org/reference/since/5.0.0/) | The `responsive-embeds`, `align-wide`, `dark-editor-style`, `disable-custom-colors`, `disable-custom-font-sizes`, `editor-color-palette`, `editor-font-sizes`, `editor-styles`, and `wp-block-styles` features were added. |
| [4.7.0](https://developer.wordpress.org/reference/since/4.7.0/) | The `starter-content` feature was added. |
| [4.5.0](https://developer.wordpress.org/reference/since/4.5.0/) | The `customize-selective-refresh-widgets` feature was added. |
| [4.1.0](https://developer.wordpress.org/reference/since/4.1.0/) | The `title-tag` feature was added. |
| [3.9.0](https://developer.wordpress.org/reference/since/3.9.0/) | The `html5` feature now also accepts `'gallery'` and `'caption'`. |
| [3.6.1](https://developer.wordpress.org/reference/since/3.6.1/) | The `html5` feature requires an array of types to be passed. Defaults to `'comment-list'`, `'comment-form'`, `'search-form'` for backward compatibility. |
| [3.6.0](https://developer.wordpress.org/reference/since/3.6.0/) | The `html5` feature was added. |
| [3.4.0](https://developer.wordpress.org/reference/since/3.4.0/) | The `custom-header-uploads` feature was deprecated. |
| [2.9.0](https://developer.wordpress.org/reference/since/2.9.0/) | Introduced. |
| programming_docs |
wordpress wp_get_attachment_metadata( int $attachment_id, bool $unfiltered = false ): array|false wp\_get\_attachment\_metadata( int $attachment\_id, bool $unfiltered = false ): array|false
===========================================================================================
Retrieves attachment metadata for attachment ID.
`$attachment_id` int Required Attachment post ID. Defaults to global $post. `$unfiltered` bool Optional If true, filters are not run. Default: `false`
array|false Attachment metadata. False on failure.
* `width`intThe width of the attachment.
* `height`intThe height of the attachment.
* `file`stringThe file path relative to `wp-content/uploads`.
* `sizes`arrayKeys are size slugs, each value is an array containing `'file'`, `'width'`, `'height'`, and `'mime-type'`.
* `image_meta`arrayImage metadata.
* `filesize`intFile size of the attachment.
File: `wp-includes/post.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/post.php/)
```
function wp_get_attachment_metadata( $attachment_id = 0, $unfiltered = false ) {
$attachment_id = (int) $attachment_id;
if ( ! $attachment_id ) {
$post = get_post();
if ( ! $post ) {
return false;
}
$attachment_id = $post->ID;
}
$data = get_post_meta( $attachment_id, '_wp_attachment_metadata', true );
if ( ! $data ) {
return false;
}
if ( $unfiltered ) {
return $data;
}
/**
* Filters the attachment meta data.
*
* @since 2.1.0
*
* @param array $data Array of meta data for the given attachment.
* @param int $attachment_id Attachment post ID.
*/
return apply_filters( 'wp_get_attachment_metadata', $data, $attachment_id );
}
```
[apply\_filters( 'wp\_get\_attachment\_metadata', array $data, int $attachment\_id )](../hooks/wp_get_attachment_metadata)
Filters the attachment meta data.
| 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\_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\_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\_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. |
| [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\_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\_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\_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::prepare\_item\_for\_response()](../classes/wp_rest_attachments_controller/prepare_item_for_response) wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php | Prepares a single attachment output for response. |
| [wp\_get\_attachment\_image\_srcset()](wp_get_attachment_image_srcset) wp-includes/media.php | Retrieves the value for an image attachment’s ‘srcset’ attribute. |
| [wp\_get\_attachment\_image\_sizes()](wp_get_attachment_image_sizes) wp-includes/media.php | Retrieves the value for an image attachment’s ‘sizes’ attribute. |
| [wp\_calculate\_image\_sizes()](wp_calculate_image_sizes) wp-includes/media.php | Creates a ‘sizes’ attribute value for 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']`. |
| [wp\_image\_editor()](wp_image_editor) wp-admin/includes/image-edit.php | Loads the WP image-editing interface. |
| [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\_media\_item()](get_media_item) wp-admin/includes/media.php | Retrieves HTML form for modifying the image attachment. |
| [edit\_post()](edit_post) wp-admin/includes/post.php | Updates an existing post with values provided in `$_POST`. |
| [wp\_ajax\_save\_attachment()](wp_ajax_save_attachment) wp-admin/includes/ajax-actions.php | Ajax handler for updating attachment attributes. |
| [attachment\_id3\_data\_meta\_box()](attachment_id3_data_meta_box) wp-admin/includes/meta-boxes.php | Displays fields for ID3 data. |
| [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. |
| [get\_uploaded\_header\_images()](get_uploaded_header_images) wp-includes/theme.php | Gets the header images uploaded for the active theme. |
| [prepend\_attachment()](prepend_attachment) wp-includes/post-template.php | Wraps attachment in paragraph tag before content. |
| [wp\_maybe\_generate\_attachment\_metadata()](wp_maybe_generate_attachment_metadata) wp-includes/media.php | Maybe attempts to generate attachment metadata, if missing. |
| [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. |
| [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. |
| [image\_get\_intermediate\_size()](image_get_intermediate_size) wp-includes/media.php | Retrieves the image’s intermediate size (resized) path, width, and height. |
| [wp\_get\_attachment\_image()](wp_get_attachment_image) wp-includes/media.php | Gets an HTML img element representing an image attachment. |
| [image\_downsize()](image_downsize) wp-includes/media.php | Scales an image to fit a particular size (such as ‘thumb’ or ‘medium’). |
| [wp\_delete\_attachment()](wp_delete_attachment) wp-includes/post.php | Trashes or deletes an attachment. |
| [wp\_get\_attachment\_thumb\_file()](wp_get_attachment_thumb_file) wp-includes/deprecated.php | Retrieves thumbnail for an attachment. |
| [wp\_xmlrpc\_server::\_prepare\_media\_item()](../classes/wp_xmlrpc_server/_prepare_media_item) wp-includes/class-wp-xmlrpc-server.php | Prepares media item data for return in an XML-RPC object. |
| Version | Description |
| --- | --- |
| [6.0.0](https://developer.wordpress.org/reference/since/6.0.0/) | The `$filesize` value was added to the returned array. |
| [2.1.0](https://developer.wordpress.org/reference/since/2.1.0/) | Introduced. |
wordpress wp_get_split_terms( int $old_term_id ): array wp\_get\_split\_terms( int $old\_term\_id ): array
==================================================
Gets data about terms that previously shared a single term\_id, but have since been split.
`$old_term_id` int Required Term ID. This is the old, pre-split term ID. array Array of new term IDs, keyed by taxonomy.
File: `wp-includes/taxonomy.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/taxonomy.php/)
```
function wp_get_split_terms( $old_term_id ) {
$split_terms = get_option( '_split_terms', array() );
$terms = array();
if ( isset( $split_terms[ $old_term_id ] ) ) {
$terms = $split_terms[ $old_term_id ];
}
return $terms;
}
```
| Uses | Description |
| --- | --- |
| [get\_option()](get_option) wp-includes/option.php | Retrieves an option value based on an option name. |
| Used By | Description |
| --- | --- |
| [wp\_get\_split\_term()](wp_get_split_term) wp-includes/taxonomy.php | Gets the new term ID corresponding to a previously split term. |
| Version | Description |
| --- | --- |
| [4.2.0](https://developer.wordpress.org/reference/since/4.2.0/) | Introduced. |
wordpress wp_dashboard_rss_control( string $widget_id, array $form_inputs = array() ) wp\_dashboard\_rss\_control( string $widget\_id, array $form\_inputs = array() )
================================================================================
The RSS dashboard widget control.
Sets up $args to be used as input to [wp\_widget\_rss\_form()](wp_widget_rss_form) . Handles POST data from RSS-type widgets.
`$widget_id` string Required `$form_inputs` array Optional Default: `array()`
File: `wp-admin/includes/dashboard.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/dashboard.php/)
```
function wp_dashboard_rss_control( $widget_id, $form_inputs = array() ) {
$widget_options = get_option( 'dashboard_widget_options' );
if ( ! $widget_options ) {
$widget_options = array();
}
if ( ! isset( $widget_options[ $widget_id ] ) ) {
$widget_options[ $widget_id ] = array();
}
$number = 1; // Hack to use wp_widget_rss_form().
$widget_options[ $widget_id ]['number'] = $number;
if ( 'POST' === $_SERVER['REQUEST_METHOD'] && isset( $_POST['widget-rss'][ $number ] ) ) {
$_POST['widget-rss'][ $number ] = wp_unslash( $_POST['widget-rss'][ $number ] );
$widget_options[ $widget_id ] = wp_widget_rss_process( $_POST['widget-rss'][ $number ] );
$widget_options[ $widget_id ]['number'] = $number;
// Title is optional. If black, fill it if possible.
if ( ! $widget_options[ $widget_id ]['title'] && isset( $_POST['widget-rss'][ $number ]['title'] ) ) {
$rss = fetch_feed( $widget_options[ $widget_id ]['url'] );
if ( is_wp_error( $rss ) ) {
$widget_options[ $widget_id ]['title'] = htmlentities( __( 'Unknown Feed' ) );
} else {
$widget_options[ $widget_id ]['title'] = htmlentities( strip_tags( $rss->get_title() ) );
$rss->__destruct();
unset( $rss );
}
}
update_option( 'dashboard_widget_options', $widget_options );
$locale = get_user_locale();
$cache_key = 'dash_v2_' . md5( $widget_id . '_' . $locale );
delete_transient( $cache_key );
}
wp_widget_rss_form( $widget_options[ $widget_id ], $form_inputs );
}
```
| Uses | Description |
| --- | --- |
| [get\_user\_locale()](get_user_locale) wp-includes/l10n.php | Retrieves the locale of a user. |
| [wp\_widget\_rss\_process()](wp_widget_rss_process) wp-includes/widgets.php | Process RSS feed widget data and optionally retrieve feed items. |
| [wp\_widget\_rss\_form()](wp_widget_rss_form) wp-includes/widgets.php | Display RSS widget options form. |
| [fetch\_feed()](fetch_feed) wp-includes/feed.php | Builds SimplePie object based on RSS or Atom feed from URL. |
| [delete\_transient()](delete_transient) wp-includes/option.php | Deletes a transient. |
| [\_\_()](__) 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. |
| [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. |
| [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_video_shortcode( array $attr, string $content = '' ): string|void wp\_video\_shortcode( array $attr, string $content = '' ): string|void
======================================================================
Builds the Video shortcode output.
This implements the functionality of the Video Shortcode for displaying WordPress mp4s in a post.
`$attr` array Required Attributes of the shortcode.
* `src`stringURL to the source of the video file. Default empty.
* `height`intHeight of the video embed in pixels. Default 360.
* `width`intWidth of the video embed in pixels. Default $content\_width or 640.
* `poster`stringThe `'poster'` attribute for the `<video>` element. Default empty.
* `loop`stringThe `'loop'` attribute for the `<video>` element. Default empty.
* `autoplay`stringThe `'autoplay'` attribute for the `<video>` element. Default empty.
* `muted`stringThe `'muted'` attribute for the `<video>` element. Default false.
* `preload`stringThe `'preload'` attribute for the `<video>` element.
Default `'metadata'`.
* `class`stringThe `'class'` attribute for the `<video>` element.
Default `'wp-video-shortcode'`.
`$content` string Optional Shortcode content. Default: `''`
string|void HTML content to display video.
File: `wp-includes/media.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/media.php/)
```
function wp_video_shortcode( $attr, $content = '' ) {
global $content_width;
$post_id = get_post() ? get_the_ID() : 0;
static $instance = 0;
$instance++;
/**
* Filters the default video shortcode output.
*
* If the filtered output isn't empty, it will be used instead of generating
* the default video template.
*
* @since 3.6.0
*
* @see wp_video_shortcode()
*
* @param string $html Empty variable to be replaced with shortcode markup.
* @param array $attr Attributes of the shortcode. @see wp_video_shortcode()
* @param string $content Video shortcode content.
* @param int $instance Unique numeric ID of this video shortcode instance.
*/
$override = apply_filters( 'wp_video_shortcode_override', '', $attr, $content, $instance );
if ( '' !== $override ) {
return $override;
}
$video = null;
$default_types = wp_get_video_extensions();
$defaults_atts = array(
'src' => '',
'poster' => '',
'loop' => '',
'autoplay' => '',
'muted' => 'false',
'preload' => 'metadata',
'width' => 640,
'height' => 360,
'class' => 'wp-video-shortcode',
);
foreach ( $default_types as $type ) {
$defaults_atts[ $type ] = '';
}
$atts = shortcode_atts( $defaults_atts, $attr, 'video' );
if ( is_admin() ) {
// Shrink the video so it isn't huge in the admin.
if ( $atts['width'] > $defaults_atts['width'] ) {
$atts['height'] = round( ( $atts['height'] * $defaults_atts['width'] ) / $atts['width'] );
$atts['width'] = $defaults_atts['width'];
}
} else {
// If the video is bigger than the theme.
if ( ! empty( $content_width ) && $atts['width'] > $content_width ) {
$atts['height'] = round( ( $atts['height'] * $content_width ) / $atts['width'] );
$atts['width'] = $content_width;
}
}
$is_vimeo = false;
$is_youtube = false;
$yt_pattern = '#^https?://(?:www\.)?(?:youtube\.com/watch|youtu\.be/)#';
$vimeo_pattern = '#^https?://(.+\.)?vimeo\.com/.*#';
$primary = false;
if ( ! empty( $atts['src'] ) ) {
$is_vimeo = ( preg_match( $vimeo_pattern, $atts['src'] ) );
$is_youtube = ( preg_match( $yt_pattern, $atts['src'] ) );
if ( ! $is_youtube && ! $is_vimeo ) {
$type = wp_check_filetype( $atts['src'], wp_get_mime_types() );
if ( ! in_array( strtolower( $type['ext'] ), $default_types, true ) ) {
return sprintf( '<a class="wp-embedded-video" href="%s">%s</a>', esc_url( $atts['src'] ), esc_html( $atts['src'] ) );
}
}
if ( $is_vimeo ) {
wp_enqueue_script( 'mediaelement-vimeo' );
}
$primary = true;
array_unshift( $default_types, 'src' );
} else {
foreach ( $default_types as $ext ) {
if ( ! empty( $atts[ $ext ] ) ) {
$type = wp_check_filetype( $atts[ $ext ], wp_get_mime_types() );
if ( strtolower( $type['ext'] ) === $ext ) {
$primary = true;
}
}
}
}
if ( ! $primary ) {
$videos = get_attached_media( 'video', $post_id );
if ( empty( $videos ) ) {
return;
}
$video = reset( $videos );
$atts['src'] = wp_get_attachment_url( $video->ID );
if ( empty( $atts['src'] ) ) {
return;
}
array_unshift( $default_types, 'src' );
}
/**
* Filters the media library used for the video shortcode.
*
* @since 3.6.0
*
* @param string $library Media library used for the video shortcode.
*/
$library = apply_filters( 'wp_video_shortcode_library', 'mediaelement' );
if ( 'mediaelement' === $library && did_action( 'init' ) ) {
wp_enqueue_style( 'wp-mediaelement' );
wp_enqueue_script( 'wp-mediaelement' );
wp_enqueue_script( 'mediaelement-vimeo' );
}
// MediaElement.js has issues with some URL formats for Vimeo and YouTube,
// so update the URL to prevent the ME.js player from breaking.
if ( 'mediaelement' === $library ) {
if ( $is_youtube ) {
// Remove `feature` query arg and force SSL - see #40866.
$atts['src'] = remove_query_arg( 'feature', $atts['src'] );
$atts['src'] = set_url_scheme( $atts['src'], 'https' );
} elseif ( $is_vimeo ) {
// Remove all query arguments and force SSL - see #40866.
$parsed_vimeo_url = wp_parse_url( $atts['src'] );
$vimeo_src = 'https://' . $parsed_vimeo_url['host'] . $parsed_vimeo_url['path'];
// Add loop param for mejs bug - see #40977, not needed after #39686.
$loop = $atts['loop'] ? '1' : '0';
$atts['src'] = add_query_arg( 'loop', $loop, $vimeo_src );
}
}
/**
* Filters the class attribute for the video shortcode output container.
*
* @since 3.6.0
* @since 4.9.0 The `$atts` parameter was added.
*
* @param string $class CSS class or list of space-separated classes.
* @param array $atts Array of video shortcode attributes.
*/
$atts['class'] = apply_filters( 'wp_video_shortcode_class', $atts['class'], $atts );
$html_atts = array(
'class' => $atts['class'],
'id' => sprintf( 'video-%d-%d', $post_id, $instance ),
'width' => absint( $atts['width'] ),
'height' => absint( $atts['height'] ),
'poster' => esc_url( $atts['poster'] ),
'loop' => wp_validate_boolean( $atts['loop'] ),
'autoplay' => wp_validate_boolean( $atts['autoplay'] ),
'muted' => wp_validate_boolean( $atts['muted'] ),
'preload' => $atts['preload'],
);
// These ones should just be omitted altogether if they are blank.
foreach ( array( 'poster', 'loop', 'autoplay', 'preload', 'muted' ) as $a ) {
if ( empty( $html_atts[ $a ] ) ) {
unset( $html_atts[ $a ] );
}
}
$attr_strings = array();
foreach ( $html_atts as $k => $v ) {
$attr_strings[] = $k . '="' . esc_attr( $v ) . '"';
}
$html = '';
if ( 'mediaelement' === $library && 1 === $instance ) {
$html .= "<!--[if lt IE 9]><script>document.createElement('video');</script><![endif]-->\n";
}
$html .= sprintf( '<video %s controls="controls">', implode( ' ', $attr_strings ) );
$fileurl = '';
$source = '<source type="%s" src="%s" />';
foreach ( $default_types as $fallback ) {
if ( ! empty( $atts[ $fallback ] ) ) {
if ( empty( $fileurl ) ) {
$fileurl = $atts[ $fallback ];
}
if ( 'src' === $fallback && $is_youtube ) {
$type = array( 'type' => 'video/youtube' );
} elseif ( 'src' === $fallback && $is_vimeo ) {
$type = array( 'type' => 'video/vimeo' );
} else {
$type = wp_check_filetype( $atts[ $fallback ], wp_get_mime_types() );
}
$url = add_query_arg( '_', $instance, $atts[ $fallback ] );
$html .= sprintf( $source, $type['type'], esc_url( $url ) );
}
}
if ( ! empty( $content ) ) {
if ( false !== strpos( $content, "\n" ) ) {
$content = str_replace( array( "\r\n", "\n", "\t" ), '', $content );
}
$html .= trim( $content );
}
if ( 'mediaelement' === $library ) {
$html .= wp_mediaelement_fallback( $fileurl );
}
$html .= '</video>';
$width_rule = '';
if ( ! empty( $atts['width'] ) ) {
$width_rule = sprintf( 'width: %dpx;', $atts['width'] );
}
$output = sprintf( '<div style="%s" class="wp-video">%s</div>', $width_rule, $html );
/**
* Filters the output of the video shortcode.
*
* @since 3.6.0
*
* @param string $output Video shortcode HTML output.
* @param array $atts Array of video shortcode attributes.
* @param string $video Video file.
* @param int $post_id Post ID.
* @param string $library Media library used for the video shortcode.
*/
return apply_filters( 'wp_video_shortcode', $output, $atts, $video, $post_id, $library );
}
```
[apply\_filters( 'wp\_video\_shortcode', string $output, array $atts, string $video, int $post\_id, string $library )](../hooks/wp_video_shortcode)
Filters the output of the video shortcode.
[apply\_filters( 'wp\_video\_shortcode\_class', string $class, array $atts )](../hooks/wp_video_shortcode_class)
Filters the class attribute for the video shortcode output container.
[apply\_filters( 'wp\_video\_shortcode\_library', string $library )](../hooks/wp_video_shortcode_library)
Filters the media library used for the video shortcode.
[apply\_filters( 'wp\_video\_shortcode\_override', string $html, array $attr, string $content, int $instance )](../hooks/wp_video_shortcode_override)
Filters the default video shortcode output.
| 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. |
| [did\_action()](did_action) wp-includes/plugin.php | Retrieves the number of times an action has been fired during the current request. |
| [wp\_get\_attachment\_url()](wp_get_attachment_url) wp-includes/post.php | Retrieves the URL for an attachment. |
| [wp\_mediaelement\_fallback()](wp_mediaelement_fallback) wp-includes/media.php | Provides a No-JS Flash fallback as a last resort for audio / video. |
| [wp\_get\_video\_extensions()](wp_get_video_extensions) wp-includes/media.php | Returns a filtered list of supported video formats. |
| [get\_attached\_media()](get_attached_media) wp-includes/media.php | Retrieves media attached to the passed post. |
| [wp\_enqueue\_script()](wp_enqueue_script) wp-includes/functions.wp-scripts.php | Enqueue a script. |
| [get\_the\_ID()](get_the_id) wp-includes/post-template.php | Retrieves the ID of the current item in the WordPress Loop. |
| [wp\_check\_filetype()](wp_check_filetype) wp-includes/functions.php | Retrieves the file type from the file name. |
| [wp\_get\_mime\_types()](wp_get_mime_types) wp-includes/functions.php | Retrieves the list of mime types and file extensions. |
| [remove\_query\_arg()](remove_query_arg) wp-includes/functions.php | Removes an item or items from a query string. |
| [wp\_validate\_boolean()](wp_validate_boolean) wp-includes/functions.php | Filters/validates a variable as a boolean. |
| [set\_url\_scheme()](set_url_scheme) wp-includes/link-template.php | Sets the scheme for a URL. |
| [wp\_enqueue\_style()](wp_enqueue_style) wp-includes/functions.wp-styles.php | Enqueue a CSS stylesheet. |
| [shortcode\_atts()](shortcode_atts) wp-includes/shortcodes.php | Combines user attributes with known attributes and fill in defaults when needed. |
| [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. |
| [absint()](absint) wp-includes/functions.php | Converts a value to non-negative integer. |
| [is\_admin()](is_admin) wp-includes/load.php | Determines whether the current request is for an administrative interface page. |
| [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. |
| [get\_post()](get_post) wp-includes/post.php | Retrieves post data given a post ID or post object. |
| Used By | Description |
| --- | --- |
| [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. |
| [edit\_form\_image\_editor()](edit_form_image_editor) wp-admin/includes/media.php | Displays the image and editor in the post editor |
| [prepend\_attachment()](prepend_attachment) wp-includes/post-template.php | Wraps attachment in paragraph tag before content. |
| Version | Description |
| --- | --- |
| [3.6.0](https://developer.wordpress.org/reference/since/3.6.0/) | Introduced. |
| programming_docs |
wordpress wpmu_checkAvailableSpace() wpmu\_checkAvailableSpace()
===========================
This function has been deprecated. Use [is\_upload\_space\_available()](is_upload_space_available) instead.
Determines if the available space defined by the admin has been exceeded by the user.
* [is\_upload\_space\_available()](is_upload_space_available)
File: `wp-admin/includes/ms-deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/ms-deprecated.php/)
```
function wpmu_checkAvailableSpace() {
_deprecated_function( __FUNCTION__, '3.0.0', 'is_upload_space_available()' );
if ( ! is_upload_space_available() ) {
wp_die( sprintf(
/* translators: %s: Allowed space allocation. */
__( 'Sorry, you have used your space allocation of %s. Please delete some files to upload more files.' ),
size_format( get_space_allowed() * MB_IN_BYTES )
) );
}
}
```
| Uses | Description |
| --- | --- |
| [size\_format()](size_format) wp-includes/functions.php | Converts a number of bytes to the largest unit the bytes will fit into. |
| [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. |
| [get\_space\_allowed()](get_space_allowed) wp-includes/ms-functions.php | Returns the upload quota for the current blog. |
| [\_\_()](__) 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. |
| [wp\_die()](wp_die) wp-includes/functions.php | Kills WordPress execution and displays HTML page with an error message. |
| Version | Description |
| --- | --- |
| [3.0.0](https://developer.wordpress.org/reference/since/3.0.0/) | Introduced. |
wordpress get_header_video_url(): string|false get\_header\_video\_url(): string|false
=======================================
Retrieves header video URL for custom header.
Uses a local video if present, or falls back to an external video.
string|false Header video URL or false if there is no video.
File: `wp-includes/theme.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/theme.php/)
```
function get_header_video_url() {
$id = absint( get_theme_mod( 'header_video' ) );
if ( $id ) {
// Get the file URL from the attachment ID.
$url = wp_get_attachment_url( $id );
} else {
$url = get_theme_mod( 'external_header_video' );
}
/**
* Filters the header video URL.
*
* @since 4.7.3
*
* @param string $url Header video URL, if available.
*/
$url = apply_filters( 'get_header_video_url', $url );
if ( ! $id && ! $url ) {
return false;
}
return sanitize_url( set_url_scheme( $url ) );
}
```
[apply\_filters( 'get\_header\_video\_url', string $url )](../hooks/get_header_video_url)
Filters the header video URL.
| Uses | Description |
| --- | --- |
| [get\_theme\_mod()](get_theme_mod) wp-includes/theme.php | Retrieves theme modification value for the active theme. |
| [sanitize\_url()](sanitize_url) wp-includes/formatting.php | Sanitizes a URL for database or redirect usage. |
| [set\_url\_scheme()](set_url_scheme) wp-includes/link-template.php | Sets the scheme for a URL. |
| [wp\_get\_attachment\_url()](wp_get_attachment_url) wp-includes/post.php | Retrieves the URL for an attachment. |
| [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 |
| --- | --- |
| [has\_header\_video()](has_header_video) wp-includes/theme.php | Checks whether a header video is set or not. |
| [the\_header\_video\_url()](the_header_video_url) wp-includes/theme.php | Displays header video URL. |
| [get\_header\_video\_settings()](get_header_video_settings) wp-includes/theme.php | Retrieves header video settings. |
| Version | Description |
| --- | --- |
| [4.7.0](https://developer.wordpress.org/reference/since/4.7.0/) | Introduced. |
wordpress wp_safe_remote_post( string $url, array $args = array() ): array|WP_Error wp\_safe\_remote\_post( string $url, array $args = array() ): array|WP\_Error
=============================================================================
Retrieve the raw response from a safe HTTP request using the POST method.
This function is ideal when the HTTP request is being made to an arbitrary URL. The URL is validated to avoid redirection and request forgery attacks.
* [wp\_remote\_request()](wp_remote_request) : For more information on the response array format.
* [WP\_Http::request()](../classes/wp_http/request): For default arguments information.
`$url` string Required URL to retrieve. `$args` array Optional Request arguments. Default: `array()`
array|[WP\_Error](../classes/wp_error) The response or [WP\_Error](../classes/wp_error) on failure.
File: `wp-includes/http.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/http.php/)
```
function wp_safe_remote_post( $url, $args = array() ) {
$args['reject_unsafe_urls'] = true;
$http = _wp_http_get_object();
return $http->post( $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 |
| --- | --- |
| [trackback()](trackback) wp-includes/comment.php | Sends a Trackback. |
| Version | Description |
| --- | --- |
| [3.6.0](https://developer.wordpress.org/reference/since/3.6.0/) | Introduced. |
wordpress network_edit_site_nav( array $args = array() ) network\_edit\_site\_nav( array $args = array() )
=================================================
Outputs the HTML for a network’s “Edit Site” tabular interface.
`$args` array Optional Array or string of Query parameters.
* `blog_id`intThe site ID. Default is the current site.
* `links`arrayThe tabs to include with (`label|url|cap`) keys.
* `selected`stringThe ID of the selected link.
Default: `array()`
File: `wp-admin/includes/ms.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/ms.php/)
```
function network_edit_site_nav( $args = array() ) {
/**
* Filters the links that appear on site-editing network pages.
*
* Default links: 'site-info', 'site-users', 'site-themes', and 'site-settings'.
*
* @since 4.6.0
*
* @param array $links {
* An array of link data representing individual network admin pages.
*
* @type array $link_slug {
* An array of information about the individual link to a page.
*
* $type string $label Label to use for the link.
* $type string $url URL, relative to `network_admin_url()` to use for the link.
* $type string $cap Capability required to see the link.
* }
* }
*/
$links = apply_filters(
'network_edit_site_nav_links',
array(
'site-info' => array(
'label' => __( 'Info' ),
'url' => 'site-info.php',
'cap' => 'manage_sites',
),
'site-users' => array(
'label' => __( 'Users' ),
'url' => 'site-users.php',
'cap' => 'manage_sites',
),
'site-themes' => array(
'label' => __( 'Themes' ),
'url' => 'site-themes.php',
'cap' => 'manage_sites',
),
'site-settings' => array(
'label' => __( 'Settings' ),
'url' => 'site-settings.php',
'cap' => 'manage_sites',
),
)
);
// Parse arguments.
$parsed_args = wp_parse_args(
$args,
array(
'blog_id' => isset( $_GET['blog_id'] ) ? (int) $_GET['blog_id'] : 0,
'links' => $links,
'selected' => 'site-info',
)
);
// Setup the links array.
$screen_links = array();
// Loop through tabs.
foreach ( $parsed_args['links'] as $link_id => $link ) {
// Skip link if user can't access.
if ( ! current_user_can( $link['cap'], $parsed_args['blog_id'] ) ) {
continue;
}
// Link classes.
$classes = array( 'nav-tab' );
// Aria-current attribute.
$aria_current = '';
// Selected is set by the parent OR assumed by the $pagenow global.
if ( $parsed_args['selected'] === $link_id || $link['url'] === $GLOBALS['pagenow'] ) {
$classes[] = 'nav-tab-active';
$aria_current = ' aria-current="page"';
}
// Escape each class.
$esc_classes = implode( ' ', $classes );
// Get the URL for this link.
$url = add_query_arg( array( 'id' => $parsed_args['blog_id'] ), network_admin_url( $link['url'] ) );
// Add link to nav links.
$screen_links[ $link_id ] = '<a href="' . esc_url( $url ) . '" id="' . esc_attr( $link_id ) . '" class="' . $esc_classes . '"' . $aria_current . '>' . esc_html( $link['label'] ) . '</a>';
}
// All done!
echo '<nav class="nav-tab-wrapper wp-clearfix" aria-label="' . esc_attr__( 'Secondary menu' ) . '">';
echo implode( '', $screen_links );
echo '</nav>';
}
```
[apply\_filters( 'network\_edit\_site\_nav\_links', array $links )](../hooks/network_edit_site_nav_links)
Filters the links that appear on site-editing network pages.
| Uses | Description |
| --- | --- |
| [network\_admin\_url()](network_admin_url) wp-includes/link-template.php | Retrieves the URL to the admin area for the network. |
| [esc\_attr\_\_()](esc_attr__) wp-includes/l10n.php | Retrieves the translation of $text and escapes it for safe use in an 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. |
| [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. |
| [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. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| Version | Description |
| --- | --- |
| [4.6.0](https://developer.wordpress.org/reference/since/4.6.0/) | Introduced. |
wordpress wp_safe_redirect( string $location, int $status = 302, string $x_redirect_by = 'WordPress' ): bool wp\_safe\_redirect( string $location, int $status = 302, string $x\_redirect\_by = 'WordPress' ): bool
======================================================================================================
Performs a safe (local) redirect, using [wp\_redirect()](wp_redirect) .
Checks whether the $location is using an allowed host, if it has an absolute path. A plugin can therefore set or remove allowed host(s) to or from the list.
If the host is not allowed, then the redirect defaults to wp-admin on the siteurl instead. This prevents malicious redirects which redirect to another host, but only used in a few places.
Note: [wp\_safe\_redirect()](wp_safe_redirect) does not exit automatically, and should almost always be followed by a call to `exit;`:
```
wp_safe_redirect( $url );
exit;
```
Exiting can also be selectively manipulated by using [wp\_safe\_redirect()](wp_safe_redirect) as a conditional
in conjunction with the [‘wp\_redirect’](../hooks/wp_redirect) and [‘wp\_redirect\_location’](../hooks/wp_redirect_location) filters:
```
if ( wp_safe_redirect( $url ) ) {
exit;
}
```
`$location` string Required The path or URL to redirect to. `$status` int Optional HTTP response status code to use. Default `'302'` (Moved Temporarily). Default: `302`
`$x_redirect_by` string Optional The application doing the redirect. Default `'WordPress'`. Default: `'WordPress'`
bool False if the redirect was cancelled, true otherwise.
File: `wp-includes/pluggable.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/pluggable.php/)
```
function wp_safe_redirect( $location, $status = 302, $x_redirect_by = 'WordPress' ) {
// Need to look at the URL the way it will end up in wp_redirect().
$location = wp_sanitize_redirect( $location );
/**
* Filters the redirect fallback URL for when the provided redirect is not safe (local).
*
* @since 4.3.0
*
* @param string $fallback_url The fallback URL to use by default.
* @param int $status The HTTP response status code to use.
*/
$location = wp_validate_redirect( $location, apply_filters( 'wp_safe_redirect_fallback', admin_url(), $status ) );
return wp_redirect( $location, $status, $x_redirect_by );
}
```
[apply\_filters( 'wp\_safe\_redirect\_fallback', string $fallback\_url, int $status )](../hooks/wp_safe_redirect_fallback)
Filters the redirect fallback URL for when the provided redirect is not safe (local).
| Uses | Description |
| --- | --- |
| [wp\_sanitize\_redirect()](wp_sanitize_redirect) wp-includes/pluggable.php | Sanitizes a URL for use in a redirect. |
| [wp\_validate\_redirect()](wp_validate_redirect) wp-includes/pluggable.php | Validates a URL for use in a redirect. |
| [wp\_redirect()](wp_redirect) wp-includes/pluggable.php | Redirects to another page. |
| [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\_Sitemaps::redirect\_sitemapxml()](../classes/wp_sitemaps/redirect_sitemapxml) wp-includes/sitemaps/class-wp-sitemaps.php | Redirects a URL to the wp-sitemap.xml |
| [WP\_Recovery\_Mode::redirect\_protected()](../classes/wp_recovery_mode/redirect_protected) wp-includes/class-wp-recovery-mode.php | Redirects the current request to allow recovering multiple errors in one go. |
| [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. |
| [set\_screen\_options()](set_screen_options) wp-admin/includes/misc.php | Saves option for number of rows when listing posts, pages, comments, etc. |
| [Custom\_Background::take\_action()](../classes/custom_background/take_action) wp-admin/includes/class-custom-background.php | Executes custom background modification. |
| Version | Description |
| --- | --- |
| [5.1.0](https://developer.wordpress.org/reference/since/5.1.0/) | The return value from [wp\_redirect()](wp_redirect) is now passed on, and the `$x_redirect_by` parameter was added. |
| [2.3.0](https://developer.wordpress.org/reference/since/2.3.0/) | Introduced. |
wordpress get_next_posts_link( string $label = null, int $max_page ): string|void get\_next\_posts\_link( string $label = null, int $max\_page ): string|void
===========================================================================
Retrieves the next posts page link.
`$label` string Optional Content for link text. Default: `null`
`$max_page` int Optional Max pages. Default 0. string|void HTML-formatted next posts page link.
Gets a link to the previous set of posts within the current query.
Because post queries are usually sorted in reverse chronological order, [get\_next\_posts\_link()](get_next_posts_link) usually points to older entries (toward the end of the set) and [get\_previous\_posts\_link()](get_previous_posts_link) usually points to newer entries (toward the beginning of the set).
File: `wp-includes/link-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/link-template.php/)
```
function get_next_posts_link( $label = null, $max_page = 0 ) {
global $paged, $wp_query;
if ( ! $max_page ) {
$max_page = $wp_query->max_num_pages;
}
if ( ! $paged ) {
$paged = 1;
}
$nextpage = (int) $paged + 1;
if ( null === $label ) {
$label = __( 'Next Page »' );
}
if ( ! is_single() && ( $nextpage <= $max_page ) ) {
/**
* Filters the anchor tag attributes for the next posts page link.
*
* @since 2.7.0
*
* @param string $attributes Attributes for the anchor tag.
*/
$attr = apply_filters( 'next_posts_link_attributes', '' );
return '<a href="' . next_posts( $max_page, false ) . "\" $attr>" . preg_replace( '/&([^#])(?![a-z]{1,8};)/i', '&$1', $label ) . '</a>';
}
}
```
[apply\_filters( 'next\_posts\_link\_attributes', string $attributes )](../hooks/next_posts_link_attributes)
Filters the anchor tag attributes for the next posts page link.
| Uses | Description |
| --- | --- |
| [next\_posts()](next_posts) wp-includes/link-template.php | Displays or retrieves the next posts page link. |
| [is\_single()](is_single) wp-includes/query.php | Determines whether the query is for an existing single post. |
| [\_\_()](__) 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 |
| --- | --- |
| [get\_the\_posts\_navigation()](get_the_posts_navigation) wp-includes/link-template.php | Returns the navigation to next/previous set of posts, when applicable. |
| [next\_posts\_link()](next_posts_link) wp-includes/link-template.php | Displays the next 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. |
| Version | Description |
| --- | --- |
| [2.7.0](https://developer.wordpress.org/reference/since/2.7.0/) | Introduced. |
wordpress wp_clear_scheduled_hook( string $hook, array $args = array(), bool $wp_error = false ): int|false|WP_Error wp\_clear\_scheduled\_hook( string $hook, array $args = array(), bool $wp\_error = false ): int|false|WP\_Error
===============================================================================================================
Unschedules all events attached to the hook with the specified arguments.
Warning: This function may return Boolean FALSE, but may also return a non-Boolean value which evaluates to FALSE. For information about casting to booleans see the [PHP documentation](https://www.php.net/manual/en/language.types.boolean.php). Use the `===` operator for testing the return value of this function.
`$hook` string Required Action hook, the execution of which will be unscheduled. `$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`
int|false|[WP\_Error](../classes/wp_error) On success an integer indicating number of events unscheduled (0 indicates no events were registered with the hook and arguments combination), false or [WP\_Error](../classes/wp_error) if unscheduling one or more events fail.
If you created a scheduled job using a hook and arguments, you cannot delete it by supplying only the hook. Similarly, if you created a set of scheduled jobs that share a hook but have different arguments, you cannot delete them using only the hook name, you have to delete them all individually using the hook name and arguments.
File: `wp-includes/cron.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/cron.php/)
```
function wp_clear_scheduled_hook( $hook, $args = array(), $wp_error = false ) {
// Backward compatibility.
// Previously, this function took the arguments as discrete vars rather than an array like the rest of the API.
if ( ! is_array( $args ) ) {
_deprecated_argument( __FUNCTION__, '3.0.0', __( 'This argument has changed to an array to match the behavior of the other cron functions.' ) );
$args = array_slice( func_get_args(), 1 ); // phpcs:ignore PHPCompatibility.FunctionUse.ArgumentFunctionsReportCurrentValue.NeedsInspection
$wp_error = false;
}
/**
* Filter to preflight or hijack clearing a scheduled hook.
*
* 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 the number of events successfully
* unscheduled (zero if no events were registered with the hook) or false
* or a WP_Error if unscheduling one or more events fails.
*
* @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|int|false|WP_Error $pre Value to return instead. Default null to continue unscheduling 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_clear_scheduled_hook', null, $hook, $args, $wp_error );
if ( null !== $pre ) {
if ( $wp_error && false === $pre ) {
return new WP_Error(
'pre_clear_scheduled_hook_false',
__( 'A plugin prevented the hook from being cleared.' )
);
}
if ( ! $wp_error && is_wp_error( $pre ) ) {
return false;
}
return $pre;
}
/*
* This logic duplicates wp_next_scheduled().
* It's required due to a scenario where wp_unschedule_event() fails due to update_option() failing,
* and, wp_next_scheduled() returns the same schedule in an infinite loop.
*/
$crons = _get_cron_array();
if ( empty( $crons ) ) {
return 0;
}
$results = array();
$key = md5( serialize( $args ) );
foreach ( $crons as $timestamp => $cron ) {
if ( isset( $cron[ $hook ][ $key ] ) ) {
$results[] = wp_unschedule_event( $timestamp, $hook, $args, true );
}
}
$errors = array_filter( $results, 'is_wp_error' );
$error = new WP_Error();
if ( $errors ) {
if ( $wp_error ) {
array_walk( $errors, array( $error, 'merge_from' ) );
return $error;
}
return false;
}
return count( $results );
}
```
[apply\_filters( 'pre\_clear\_scheduled\_hook', null|int|false|WP\_Error $pre, string $hook, array $args, bool $wp\_error )](../hooks/pre_clear_scheduled_hook)
Filter to preflight or hijack clearing a scheduled hook.
| Uses | Description |
| --- | --- |
| [\_get\_cron\_array()](_get_cron_array) wp-includes/cron.php | Retrieve cron info array option. |
| [wp\_unschedule\_event()](wp_unschedule_event) wp-includes/cron.php | Unschedule a previously scheduled event. |
| [\_\_()](__) 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. |
| [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 |
| --- | --- |
| [\_transition\_post\_status()](_transition_post_status) wp-includes/post.php | Hook for managing future post transitions to published. |
| [\_future\_post\_hook()](_future_post_hook) wp-includes/post.php | Hook used to schedule publication for a post marked for the future. |
| [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. |
| [wp\_delete\_post()](wp_delete_post) wp-includes/post.php | Trashes or deletes a post or page. |
| 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 indicate success or failure, ['pre\_clear\_scheduled\_hook'](../hooks/pre_clear_scheduled_hook) filter added to short-circuit the function. |
| [2.1.0](https://developer.wordpress.org/reference/since/2.1.0/) | Introduced. |
| programming_docs |
wordpress build_query_vars_from_query_block( WP_Block $block, int $page ): array build\_query\_vars\_from\_query\_block( WP\_Block $block, int $page ): array
============================================================================
Helper function that constructs a [WP\_Query](../classes/wp_query) args array from a `Query` block properties.
It’s used in Query Loop, Query Pagination Numbers and Query Pagination Next blocks.
`$block` [WP\_Block](../classes/wp_block) Required Block instance. `$page` int Required Current query's page. array Returns the constructed [WP\_Query](../classes/wp_query) arguments.
File: `wp-includes/blocks.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/blocks.php/)
```
function build_query_vars_from_query_block( $block, $page ) {
$query = array(
'post_type' => 'post',
'order' => 'DESC',
'orderby' => 'date',
'post__not_in' => array(),
);
if ( isset( $block->context['query'] ) ) {
if ( ! empty( $block->context['query']['postType'] ) ) {
$post_type_param = $block->context['query']['postType'];
if ( is_post_type_viewable( $post_type_param ) ) {
$query['post_type'] = $post_type_param;
}
}
if ( isset( $block->context['query']['sticky'] ) && ! empty( $block->context['query']['sticky'] ) ) {
$sticky = get_option( 'sticky_posts' );
if ( 'only' === $block->context['query']['sticky'] ) {
$query['post__in'] = $sticky;
} else {
$query['post__not_in'] = array_merge( $query['post__not_in'], $sticky );
}
}
if ( ! empty( $block->context['query']['exclude'] ) ) {
$excluded_post_ids = array_map( 'intval', $block->context['query']['exclude'] );
$excluded_post_ids = array_filter( $excluded_post_ids );
$query['post__not_in'] = array_merge( $query['post__not_in'], $excluded_post_ids );
}
if (
isset( $block->context['query']['perPage'] ) &&
is_numeric( $block->context['query']['perPage'] )
) {
$per_page = absint( $block->context['query']['perPage'] );
$offset = 0;
if (
isset( $block->context['query']['offset'] ) &&
is_numeric( $block->context['query']['offset'] )
) {
$offset = absint( $block->context['query']['offset'] );
}
$query['offset'] = ( $per_page * ( $page - 1 ) ) + $offset;
$query['posts_per_page'] = $per_page;
}
// Migrate `categoryIds` and `tagIds` to `tax_query` for backwards compatibility.
if ( ! empty( $block->context['query']['categoryIds'] ) || ! empty( $block->context['query']['tagIds'] ) ) {
$tax_query = array();
if ( ! empty( $block->context['query']['categoryIds'] ) ) {
$tax_query[] = array(
'taxonomy' => 'category',
'terms' => array_filter( array_map( 'intval', $block->context['query']['categoryIds'] ) ),
'include_children' => false,
);
}
if ( ! empty( $block->context['query']['tagIds'] ) ) {
$tax_query[] = array(
'taxonomy' => 'post_tag',
'terms' => array_filter( array_map( 'intval', $block->context['query']['tagIds'] ) ),
'include_children' => false,
);
}
$query['tax_query'] = $tax_query;
}
if ( ! empty( $block->context['query']['taxQuery'] ) ) {
$query['tax_query'] = array();
foreach ( $block->context['query']['taxQuery'] as $taxonomy => $terms ) {
if ( is_taxonomy_viewable( $taxonomy ) && ! empty( $terms ) ) {
$query['tax_query'][] = array(
'taxonomy' => $taxonomy,
'terms' => array_filter( array_map( 'intval', $terms ) ),
'include_children' => false,
);
}
}
}
if (
isset( $block->context['query']['order'] ) &&
in_array( strtoupper( $block->context['query']['order'] ), array( 'ASC', 'DESC' ), true )
) {
$query['order'] = strtoupper( $block->context['query']['order'] );
}
if ( isset( $block->context['query']['orderBy'] ) ) {
$query['orderby'] = $block->context['query']['orderBy'];
}
if (
isset( $block->context['query']['author'] ) &&
(int) $block->context['query']['author'] > 0
) {
$query['author'] = (int) $block->context['query']['author'];
}
if ( ! empty( $block->context['query']['search'] ) ) {
$query['s'] = $block->context['query']['search'];
}
if ( ! empty( $block->context['query']['parents'] ) && is_post_type_hierarchical( $query['post_type'] ) ) {
$query['post_parent__in'] = array_filter( array_map( 'intval', $block->context['query']['parents'] ) );
}
}
/**
* Filters the arguments which will be passed to `WP_Query` for the Query Loop Block.
*
* Anything to this filter should be compatible with the `WP_Query` API to form
* the query context which will be passed down to the Query Loop Block's children.
* This can help, for example, to include additional settings or meta queries not
* directly supported by the core Query Loop Block, and extend its capabilities.
*
* Please note that this will only influence the query that will be rendered on the
* front-end. The editor preview is not affected by this filter. Also, worth noting
* that the editor preview uses the REST API, so, ideally, one should aim to provide
* attributes which are also compatible with the REST API, in order to be able to
* implement identical queries on both sides.
*
* @since 6.1.0
*
* @param array $query Array containing parameters for `WP_Query` as parsed by the block context.
* @param WP_Block $block Block instance.
* @param int $page Current query's page.
*/
return apply_filters( 'query_loop_block_query_vars', $query, $block, $page );
}
```
[apply\_filters( 'query\_loop\_block\_query\_vars', array $query, WP\_Block $block, int $page )](../hooks/query_loop_block_query_vars)
Filters the arguments which will be passed to `WP_Query` for the Query Loop Block.
| Uses | Description |
| --- | --- |
| [is\_taxonomy\_viewable()](is_taxonomy_viewable) wp-includes/taxonomy.php | Determines whether a taxonomy is considered “viewable”. |
| [is\_post\_type\_viewable()](is_post_type_viewable) wp-includes/post.php | Determines whether a post type is considered “viewable”. |
| [is\_post\_type\_hierarchical()](is_post_type_hierarchical) wp-includes/post.php | Determines whether the post type is hierarchical. |
| [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. |
| Version | Description |
| --- | --- |
| [6.1.0](https://developer.wordpress.org/reference/since/6.1.0/) | Added `query_loop_block_query_vars` filter and `parents` support in query. |
| [5.8.0](https://developer.wordpress.org/reference/since/5.8.0/) | Introduced. |
wordpress _reset_front_page_settings_for_post( int $post_id ) \_reset\_front\_page\_settings\_for\_post( int $post\_id )
==========================================================
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.
Resets the page\_on\_front, show\_on\_front, and page\_for\_post settings when a linked page is deleted or trashed.
Also ensures the post is no longer sticky.
`$post_id` int Required Post ID. File: `wp-includes/post.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/post.php/)
```
function _reset_front_page_settings_for_post( $post_id ) {
$post = get_post( $post_id );
if ( 'page' === $post->post_type ) {
/*
* If the page is defined in option page_on_front or post_for_posts,
* adjust the corresponding options.
*/
if ( get_option( 'page_on_front' ) == $post->ID ) {
update_option( 'show_on_front', 'posts' );
update_option( 'page_on_front', 0 );
}
if ( get_option( 'page_for_posts' ) == $post->ID ) {
update_option( 'page_for_posts', 0 );
}
}
unstick_post( $post->ID );
}
```
| Uses | Description |
| --- | --- |
| [unstick\_post()](unstick_post) wp-includes/post.php | Un-sticks a post. |
| [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. |
| [get\_post()](get_post) wp-includes/post.php | Retrieves post data given a post ID or post object. |
| Version | Description |
| --- | --- |
| [3.7.0](https://developer.wordpress.org/reference/since/3.7.0/) | Introduced. |
wordpress get_archive_template(): string get\_archive\_template(): string
================================
Retrieves path of archive template in current or parent template.
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 ‘archive’.
* [get\_query\_template()](get_query_template)
string Full path to archive template file.
File: `wp-includes/template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/template.php/)
```
function get_archive_template() {
$post_types = array_filter( (array) get_query_var( 'post_type' ) );
$templates = array();
if ( count( $post_types ) == 1 ) {
$post_type = reset( $post_types );
$templates[] = "archive-{$post_type}.php";
}
$templates[] = 'archive.php';
return get_query_template( 'archive', $templates );
}
```
| 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. |
| [get\_query\_template()](get_query_template) wp-includes/template.php | Retrieves path to a template. |
| Used By | Description |
| --- | --- |
| [get\_post\_type\_archive\_template()](get_post_type_archive_template) wp-includes/template.php | Retrieves path of post type archive template in current or parent template. |
| Version | Description |
| --- | --- |
| [1.5.0](https://developer.wordpress.org/reference/since/1.5.0/) | Introduced. |
wordpress get_pung( int|WP_Post $post ): string[]|false get\_pung( int|WP\_Post $post ): string[]|false
===============================================
Retrieves URLs already pinged for a post.
`$post` int|[WP\_Post](../classes/wp_post) Required Post ID or object. string[]|false Array of URLs already pinged for the given post, false if the post is not found.
File: `wp-includes/post.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/post.php/)
```
function get_pung( $post ) {
$post = get_post( $post );
if ( ! $post ) {
return false;
}
$pung = trim( $post->pinged );
$pung = preg_split( '/\s/', $pung );
/**
* Filters the list of already-pinged URLs for the given post.
*
* @since 2.0.0
*
* @param string[] $pung Array of URLs already pinged for the given post.
*/
return apply_filters( 'get_pung', $pung );
}
```
[apply\_filters( 'get\_pung', string[] $pung )](../hooks/get_pung)
Filters the list of already-pinged URLs for the given post.
| 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 |
| --- | --- |
| [do\_trackbacks()](do_trackbacks) wp-includes/comment.php | Performs trackbacks. |
| [pingback()](pingback) wp-includes/comment.php | Pings back the links found in a post. |
| Version | Description |
| --- | --- |
| [4.7.0](https://developer.wordpress.org/reference/since/4.7.0/) | `$post` can be a [WP\_Post](../classes/wp_post) object. |
| [1.5.0](https://developer.wordpress.org/reference/since/1.5.0/) | Introduced. |
wordpress wp_print_media_templates() wp\_print\_media\_templates()
=============================
Prints the templates used in the media manager.
File: `wp-includes/media-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/media-template.php/)
```
function wp_print_media_templates() {
$class = 'media-modal wp-core-ui';
$alt_text_description = sprintf(
/* 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)' )
)
);
?>
<?php // Template for the media frame: used both in the media grid and in the media modal. ?>
<script type="text/html" id="tmpl-media-frame">
<div class="media-frame-title" id="media-frame-title"></div>
<h2 class="media-frame-menu-heading"><?php _ex( 'Actions', 'media modal menu actions' ); ?></h2>
<button type="button" class="button button-link media-frame-menu-toggle" aria-expanded="false">
<?php _ex( 'Menu', 'media modal menu' ); ?>
<span class="dashicons dashicons-arrow-down" aria-hidden="true"></span>
</button>
<div class="media-frame-menu"></div>
<div class="media-frame-tab-panel">
<div class="media-frame-router"></div>
<div class="media-frame-content"></div>
</div>
<h2 class="media-frame-actions-heading screen-reader-text">
<?php
/* translators: Accessibility text. */
_e( 'Selected media actions' );
?>
</h2>
<div class="media-frame-toolbar"></div>
<div class="media-frame-uploader"></div>
</script>
<?php // Template for the media modal. ?>
<script type="text/html" id="tmpl-media-modal">
<div tabindex="0" class="<?php echo $class; ?>" role="dialog" aria-labelledby="media-frame-title">
<# if ( data.hasCloseButton ) { #>
<button type="button" class="media-modal-close"><span class="media-modal-icon"><span class="screen-reader-text"><?php _e( 'Close dialog' ); ?></span></span></button>
<# } #>
<div class="media-modal-content" role="document"></div>
</div>
<div class="media-modal-backdrop"></div>
</script>
<?php // Template for the window uploader, used for example in the media grid. ?>
<script type="text/html" id="tmpl-uploader-window">
<div class="uploader-window-content">
<div class="uploader-editor-title"><?php _e( 'Drop files to upload' ); ?></div>
</div>
</script>
<?php // Template for the editor uploader. ?>
<script type="text/html" id="tmpl-uploader-editor">
<div class="uploader-editor-content">
<div class="uploader-editor-title"><?php _e( 'Drop files to upload' ); ?></div>
</div>
</script>
<?php // Template for the inline uploader, used for example in the Media Library admin page - Add New. ?>
<script type="text/html" id="tmpl-uploader-inline">
<# var messageClass = data.message ? 'has-upload-message' : 'no-upload-message'; #>
<# if ( data.canClose ) { #>
<button class="close dashicons dashicons-no"><span class="screen-reader-text"><?php _e( 'Close uploader' ); ?></span></button>
<# } #>
<div class="uploader-inline-content {{ messageClass }}">
<# if ( data.message ) { #>
<h2 class="upload-message">{{ data.message }}</h2>
<# } #>
<?php if ( ! _device_can_upload() ) : ?>
<div class="upload-ui">
<h2 class="upload-instructions"><?php _e( 'Your browser cannot upload files' ); ?></h2>
<p>
<?php
printf(
/* translators: %s: https://apps.wordpress.org/ */
__( 'The web browser on your device cannot be used to upload files. You may be able to use the <a href="%s">native app for your device</a> instead.' ),
'https://apps.wordpress.org/'
);
?>
</p>
</div>
<?php elseif ( is_multisite() && ! is_upload_space_available() ) : ?>
<div class="upload-ui">
<h2 class="upload-instructions"><?php _e( 'Upload Limit Exceeded' ); ?></h2>
<?php
/** This action is documented in wp-admin/includes/media.php */
do_action( 'upload_ui_over_quota' );
?>
</div>
<?php else : ?>
<div class="upload-ui">
<h2 class="upload-instructions drop-instructions"><?php _e( 'Drop files to upload' ); ?></h2>
<p class="upload-instructions drop-instructions"><?php _ex( 'or', 'Uploader: Drop files here - or - Select Files' ); ?></p>
<button type="button" class="browser button button-hero" aria-labelledby="post-upload-info"><?php _e( 'Select Files' ); ?></button>
</div>
<div class="upload-inline-status"></div>
<div class="post-upload-ui" id="post-upload-info">
<?php
/** This action is documented in wp-admin/includes/media.php */
do_action( 'pre-upload-ui' ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
/** This action is documented in wp-admin/includes/media.php */
do_action( 'pre-plupload-upload-ui' ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
if ( 10 === remove_action( 'post-plupload-upload-ui', 'media_upload_flash_bypass' ) ) {
/** This action is documented in wp-admin/includes/media.php */
do_action( 'post-plupload-upload-ui' ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
add_action( 'post-plupload-upload-ui', 'media_upload_flash_bypass' );
} else {
/** This action is documented in wp-admin/includes/media.php */
do_action( 'post-plupload-upload-ui' ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
}
$max_upload_size = wp_max_upload_size();
if ( ! $max_upload_size ) {
$max_upload_size = 0;
}
?>
<p class="max-upload-size">
<?php
printf(
/* translators: %s: Maximum allowed file size. */
__( 'Maximum upload file size: %s.' ),
esc_html( size_format( $max_upload_size ) )
);
?>
</p>
<# if ( data.suggestedWidth && data.suggestedHeight ) { #>
<p class="suggested-dimensions">
<?php
/* translators: 1: Suggested width number, 2: Suggested height number. */
printf( __( 'Suggested image dimensions: %1$s by %2$s pixels.' ), '{{data.suggestedWidth}}', '{{data.suggestedHeight}}' );
?>
</p>
<# } #>
<?php
/** This action is documented in wp-admin/includes/media.php */
do_action( 'post-upload-ui' ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
?>
</div>
<?php endif; ?>
</div>
</script>
<?php // Template for the view switchers, used for example in the Media Grid. ?>
<script type="text/html" id="tmpl-media-library-view-switcher">
<a href="<?php echo esc_url( add_query_arg( 'mode', 'list', admin_url( 'upload.php' ) ) ); ?>" class="view-list">
<span class="screen-reader-text"><?php _e( 'List view' ); ?></span>
</a>
<a href="<?php echo esc_url( add_query_arg( 'mode', 'grid', admin_url( 'upload.php' ) ) ); ?>" class="view-grid current" aria-current="page">
<span class="screen-reader-text"><?php _e( 'Grid view' ); ?></span>
</a>
</script>
<?php // Template for the uploading status UI. ?>
<script type="text/html" id="tmpl-uploader-status">
<h2><?php _e( 'Uploading' ); ?></h2>
<div class="media-progress-bar"><div></div></div>
<div class="upload-details">
<span class="upload-count">
<span class="upload-index"></span> / <span class="upload-total"></span>
</span>
<span class="upload-detail-separator">–</span>
<span class="upload-filename"></span>
</div>
<div class="upload-errors"></div>
<button type="button" class="button upload-dismiss-errors"><?php _e( 'Dismiss errors' ); ?></button>
</script>
<?php // Template for the uploading status errors. ?>
<script type="text/html" id="tmpl-uploader-status-error">
<span class="upload-error-filename">{{{ data.filename }}}</span>
<span class="upload-error-message">{{ data.message }}</span>
</script>
<?php // Template for the Attachment Details layout in the media browser. ?>
<script type="text/html" id="tmpl-edit-attachment-frame">
<div class="edit-media-header">
<button class="left dashicons"<# if ( ! data.hasPrevious ) { #> disabled<# } #>><span class="screen-reader-text"><?php _e( 'Edit previous media item' ); ?></span></button>
<button class="right dashicons"<# if ( ! data.hasNext ) { #> disabled<# } #>><span class="screen-reader-text"><?php _e( 'Edit next media item' ); ?></span></button>
<button type="button" class="media-modal-close"><span class="media-modal-icon"><span class="screen-reader-text"><?php _e( 'Close dialog' ); ?></span></span></button>
</div>
<div class="media-frame-title"></div>
<div class="media-frame-content"></div>
</script>
<?php // Template for the Attachment Details two columns layout. ?>
<script type="text/html" id="tmpl-attachment-details-two-column">
<div class="attachment-media-view {{ data.orientation }}">
<h2 class="screen-reader-text"><?php _e( 'Attachment Preview' ); ?></h2>
<div class="thumbnail thumbnail-{{ data.type }}">
<# if ( data.uploading ) { #>
<div class="media-progress-bar"><div></div></div>
<# } else if ( data.sizes && data.sizes.large ) { #>
<img class="details-image" src="{{ data.sizes.large.url }}" draggable="false" alt="" />
<# } else if ( data.sizes && data.sizes.full ) { #>
<img class="details-image" src="{{ data.sizes.full.url }}" draggable="false" alt="" />
<# } else if ( -1 === jQuery.inArray( data.type, [ 'audio', 'video' ] ) ) { #>
<img class="details-image icon" src="{{ data.icon }}" draggable="false" alt="" />
<# } #>
<# if ( 'audio' === data.type ) { #>
<div class="wp-media-wrapper wp-audio">
<audio style="visibility: hidden" controls class="wp-audio-shortcode" width="100%" preload="none">
<source type="{{ data.mime }}" src="{{ data.url }}" />
</audio>
</div>
<# } else if ( 'video' === data.type ) {
var w_rule = '';
if ( data.width ) {
w_rule = 'width: ' + data.width + 'px;';
} else if ( wp.media.view.settings.contentWidth ) {
w_rule = 'width: ' + wp.media.view.settings.contentWidth + 'px;';
}
#>
<div style="{{ w_rule }}" class="wp-media-wrapper wp-video">
<video controls="controls" class="wp-video-shortcode" preload="metadata"
<# if ( data.width ) { #>width="{{ data.width }}"<# } #>
<# if ( data.height ) { #>height="{{ data.height }}"<# } #>
<# if ( data.image && data.image.src !== data.icon ) { #>poster="{{ data.image.src }}"<# } #>>
<source type="{{ data.mime }}" src="{{ data.url }}" />
</video>
</div>
<# } #>
<div class="attachment-actions">
<# if ( 'image' === data.type && ! data.uploading && data.sizes && data.can.save ) { #>
<button type="button" class="button edit-attachment"><?php _e( 'Edit Image' ); ?></button>
<# } else if ( 'pdf' === data.subtype && data.sizes ) { #>
<p><?php _e( 'Document Preview' ); ?></p>
<# } #>
</div>
</div>
</div>
<div class="attachment-info">
<span class="settings-save-status" role="status">
<span class="spinner"></span>
<span class="saved"><?php esc_html_e( 'Saved.' ); ?></span>
</span>
<div class="details">
<h2 class="screen-reader-text"><?php _e( 'Details' ); ?></h2>
<div class="uploaded"><strong><?php _e( 'Uploaded on:' ); ?></strong> {{ data.dateFormatted }}</div>
<div class="uploaded-by">
<strong><?php _e( 'Uploaded by:' ); ?></strong>
<# if ( data.authorLink ) { #>
<a href="{{ data.authorLink }}">{{ data.authorName }}</a>
<# } else { #>
{{ data.authorName }}
<# } #>
</div>
<# if ( data.uploadedToTitle ) { #>
<div class="uploaded-to">
<strong><?php _e( 'Uploaded to:' ); ?></strong>
<# if ( data.uploadedToLink ) { #>
<a href="{{ data.uploadedToLink }}">{{ data.uploadedToTitle }}</a>
<# } else { #>
{{ data.uploadedToTitle }}
<# } #>
</div>
<# } #>
<div class="filename"><strong><?php _e( 'File name:' ); ?></strong> {{ data.filename }}</div>
<div class="file-type"><strong><?php _e( 'File type:' ); ?></strong> {{ data.mime }}</div>
<div class="file-size"><strong><?php _e( 'File size:' ); ?></strong> {{ data.filesizeHumanReadable }}</div>
<# if ( 'image' === data.type && ! data.uploading ) { #>
<# if ( data.width && data.height ) { #>
<div class="dimensions"><strong><?php _e( 'Dimensions:' ); ?></strong>
<?php
/* translators: 1: A number of pixels wide, 2: A number of pixels tall. */
printf( __( '%1$s by %2$s pixels' ), '{{ data.width }}', '{{ data.height }}' );
?>
</div>
<# } #>
<# if ( data.originalImageURL && data.originalImageName ) { #>
<div class="word-wrap-break-word">
<?php _e( 'Original image:' ); ?>
<a href="{{ data.originalImageURL }}">{{data.originalImageName}}</a>
</div>
<# } #>
<# } #>
<# if ( data.fileLength && data.fileLengthHumanReadable ) { #>
<div class="file-length"><strong><?php _e( 'Length:' ); ?></strong>
<span aria-hidden="true">{{ data.fileLength }}</span>
<span class="screen-reader-text">{{ data.fileLengthHumanReadable }}</span>
</div>
<# } #>
<# if ( 'audio' === data.type && data.meta.bitrate ) { #>
<div class="bitrate">
<strong><?php _e( 'Bitrate:' ); ?></strong> {{ Math.round( data.meta.bitrate / 1000 ) }}kb/s
<# if ( data.meta.bitrate_mode ) { #>
{{ ' ' + data.meta.bitrate_mode.toUpperCase() }}
<# } #>
</div>
<# } #>
<# if ( data.mediaStates ) { #>
<div class="media-states"><strong><?php _e( 'Used as:' ); ?></strong> {{ data.mediaStates }}</div>
<# } #>
<div class="compat-meta">
<# if ( data.compat && data.compat.meta ) { #>
{{{ data.compat.meta }}}
<# } #>
</div>
</div>
<div class="settings">
<# var maybeReadOnly = data.can.save || data.allowLocalEdits ? '' : 'readonly'; #>
<# if ( 'image' === data.type ) { #>
<span class="setting alt-text has-description" data-setting="alt">
<label for="attachment-details-two-column-alt-text" class="name"><?php _e( 'Alternative Text' ); ?></label>
<textarea id="attachment-details-two-column-alt-text" aria-describedby="alt-text-description" {{ maybeReadOnly }}>{{ data.alt }}</textarea>
</span>
<p class="description" id="alt-text-description"><?php echo $alt_text_description; ?></p>
<# } #>
<?php if ( post_type_supports( 'attachment', 'title' ) ) : ?>
<span class="setting" data-setting="title">
<label for="attachment-details-two-column-title" class="name"><?php _e( 'Title' ); ?></label>
<input type="text" id="attachment-details-two-column-title" value="{{ data.title }}" {{ maybeReadOnly }} />
</span>
<?php endif; ?>
<# if ( 'audio' === data.type ) { #>
<?php
foreach ( array(
'artist' => __( 'Artist' ),
'album' => __( 'Album' ),
) as $key => $label ) :
?>
<span class="setting" data-setting="<?php echo esc_attr( $key ); ?>">
<label for="attachment-details-two-column-<?php echo esc_attr( $key ); ?>" class="name"><?php echo $label; ?></label>
<input type="text" id="attachment-details-two-column-<?php echo esc_attr( $key ); ?>" value="{{ data.<?php echo $key; ?> || data.meta.<?php echo $key; ?> || '' }}" />
</span>
<?php endforeach; ?>
<# } #>
<span class="setting" data-setting="caption">
<label for="attachment-details-two-column-caption" class="name"><?php _e( 'Caption' ); ?></label>
<textarea id="attachment-details-two-column-caption" {{ maybeReadOnly }}>{{ data.caption }}</textarea>
</span>
<span class="setting" data-setting="description">
<label for="attachment-details-two-column-description" class="name"><?php _e( 'Description' ); ?></label>
<textarea id="attachment-details-two-column-description" {{ maybeReadOnly }}>{{ data.description }}</textarea>
</span>
<span class="setting" data-setting="url">
<label for="attachment-details-two-column-copy-link" class="name"><?php _e( 'File URL:' ); ?></label>
<input type="text" class="attachment-details-copy-link" id="attachment-details-two-column-copy-link" value="{{ data.url }}" readonly />
<span class="copy-to-clipboard-container">
<button type="button" class="button button-small copy-attachment-url" data-clipboard-target="#attachment-details-two-column-copy-link"><?php _e( 'Copy URL to clipboard' ); ?></button>
<span class="success hidden" aria-hidden="true"><?php _e( 'Copied!' ); ?></span>
</span>
</span>
<div class="attachment-compat"></div>
</div>
<div class="actions">
<# if ( data.link ) { #>
<a class="view-attachment" href="{{ data.link }}"><?php _e( 'View attachment page' ); ?></a>
<# } #>
<# if ( data.can.save ) { #>
<# if ( data.link ) { #>
<span class="links-separator">|</span>
<# } #>
<a href="{{ data.editLink }}"><?php _e( 'Edit more details' ); ?></a>
<# } #>
<# if ( ! data.uploading && data.can.remove ) { #>
<# if ( data.link || data.can.save ) { #>
<span class="links-separator">|</span>
<# } #>
<?php if ( MEDIA_TRASH ) : ?>
<# if ( 'trash' === data.status ) { #>
<button type="button" class="button-link untrash-attachment"><?php _e( 'Restore from Trash' ); ?></button>
<# } else { #>
<button type="button" class="button-link trash-attachment"><?php _e( 'Move to Trash' ); ?></button>
<# } #>
<?php else : ?>
<button type="button" class="button-link delete-attachment"><?php _e( 'Delete permanently' ); ?></button>
<?php endif; ?>
<# } #>
</div>
</div>
</script>
<?php // Template for the Attachment "thumbnails" in the Media Grid. ?>
<script type="text/html" id="tmpl-attachment">
<div class="attachment-preview js--select-attachment type-{{ data.type }} subtype-{{ data.subtype }} {{ data.orientation }}">
<div class="thumbnail">
<# if ( data.uploading ) { #>
<div class="media-progress-bar"><div style="width: {{ data.percent }}%"></div></div>
<# } else if ( 'image' === data.type && data.size && data.size.url ) { #>
<div class="centered">
<img src="{{ data.size.url }}" draggable="false" alt="" />
</div>
<# } else { #>
<div class="centered">
<# if ( data.image && data.image.src && data.image.src !== data.icon ) { #>
<img src="{{ data.image.src }}" class="thumbnail" draggable="false" alt="" />
<# } else if ( data.sizes && data.sizes.medium ) { #>
<img src="{{ data.sizes.medium.url }}" class="thumbnail" draggable="false" alt="" />
<# } else { #>
<img src="{{ data.icon }}" class="icon" draggable="false" alt="" />
<# } #>
</div>
<div class="filename">
<div>{{ data.filename }}</div>
</div>
<# } #>
</div>
<# if ( data.buttons.close ) { #>
<button type="button" class="button-link attachment-close media-modal-icon"><span class="screen-reader-text"><?php _e( 'Remove' ); ?></span></button>
<# } #>
</div>
<# if ( data.buttons.check ) { #>
<button type="button" class="check" tabindex="-1"><span class="media-modal-icon"></span><span class="screen-reader-text"><?php _e( 'Deselect' ); ?></span></button>
<# } #>
<#
var maybeReadOnly = data.can.save || data.allowLocalEdits ? '' : 'readonly';
if ( data.describe ) {
if ( 'image' === data.type ) { #>
<input type="text" value="{{ data.caption }}" class="describe" data-setting="caption"
aria-label="<?php esc_attr_e( 'Caption' ); ?>"
placeholder="<?php esc_attr_e( 'Caption…' ); ?>" {{ maybeReadOnly }} />
<# } else { #>
<input type="text" value="{{ data.title }}" class="describe" data-setting="title"
<# if ( 'video' === data.type ) { #>
aria-label="<?php esc_attr_e( 'Video title' ); ?>"
placeholder="<?php esc_attr_e( 'Video title…' ); ?>"
<# } else if ( 'audio' === data.type ) { #>
aria-label="<?php esc_attr_e( 'Audio title' ); ?>"
placeholder="<?php esc_attr_e( 'Audio title…' ); ?>"
<# } else { #>
aria-label="<?php esc_attr_e( 'Media title' ); ?>"
placeholder="<?php esc_attr_e( 'Media title…' ); ?>"
<# } #> {{ maybeReadOnly }} />
<# }
} #>
</script>
<?php // Template for the Attachment details, used for example in the sidebar. ?>
<script type="text/html" id="tmpl-attachment-details">
<h2>
<?php _e( 'Attachment Details' ); ?>
<span class="settings-save-status" role="status">
<span class="spinner"></span>
<span class="saved"><?php esc_html_e( 'Saved.' ); ?></span>
</span>
</h2>
<div class="attachment-info">
<# if ( 'audio' === data.type ) { #>
<div class="wp-media-wrapper wp-audio">
<audio style="visibility: hidden" controls class="wp-audio-shortcode" width="100%" preload="none">
<source type="{{ data.mime }}" src="{{ data.url }}" />
</audio>
</div>
<# } else if ( 'video' === data.type ) {
var w_rule = '';
if ( data.width ) {
w_rule = 'width: ' + data.width + 'px;';
} else if ( wp.media.view.settings.contentWidth ) {
w_rule = 'width: ' + wp.media.view.settings.contentWidth + 'px;';
}
#>
<div style="{{ w_rule }}" class="wp-media-wrapper wp-video">
<video controls="controls" class="wp-video-shortcode" preload="metadata"
<# if ( data.width ) { #>width="{{ data.width }}"<# } #>
<# if ( data.height ) { #>height="{{ data.height }}"<# } #>
<# if ( data.image && data.image.src !== data.icon ) { #>poster="{{ data.image.src }}"<# } #>>
<source type="{{ data.mime }}" src="{{ data.url }}" />
</video>
</div>
<# } else { #>
<div class="thumbnail thumbnail-{{ data.type }}">
<# if ( data.uploading ) { #>
<div class="media-progress-bar"><div></div></div>
<# } else if ( 'image' === data.type && data.size && data.size.url ) { #>
<img src="{{ data.size.url }}" draggable="false" alt="" />
<# } else { #>
<img src="{{ data.icon }}" class="icon" draggable="false" alt="" />
<# } #>
</div>
<# } #>
<div class="details">
<div class="filename">{{ data.filename }}</div>
<div class="uploaded">{{ data.dateFormatted }}</div>
<div class="file-size">{{ data.filesizeHumanReadable }}</div>
<# if ( 'image' === data.type && ! data.uploading ) { #>
<# if ( data.width && data.height ) { #>
<div class="dimensions">
<?php
/* translators: 1: A number of pixels wide, 2: A number of pixels tall. */
printf( __( '%1$s by %2$s pixels' ), '{{ data.width }}', '{{ data.height }}' );
?>
</div>
<# } #>
<# if ( data.originalImageURL && data.originalImageName ) { #>
<div class="word-wrap-break-word">
<?php _e( 'Original image:' ); ?>
<a href="{{ data.originalImageURL }}">{{data.originalImageName}}</a>
</div>
<# } #>
<# if ( data.can.save && data.sizes ) { #>
<a class="edit-attachment" href="{{ data.editLink }}&image-editor" target="_blank"><?php _e( 'Edit Image' ); ?></a>
<# } #>
<# } #>
<# if ( data.fileLength && data.fileLengthHumanReadable ) { #>
<div class="file-length"><?php _e( 'Length:' ); ?>
<span aria-hidden="true">{{ data.fileLength }}</span>
<span class="screen-reader-text">{{ data.fileLengthHumanReadable }}</span>
</div>
<# } #>
<# if ( data.mediaStates ) { #>
<div class="media-states"><strong><?php _e( 'Used as:' ); ?></strong> {{ data.mediaStates }}</div>
<# } #>
<# if ( ! data.uploading && data.can.remove ) { #>
<?php if ( MEDIA_TRASH ) : ?>
<# if ( 'trash' === data.status ) { #>
<button type="button" class="button-link untrash-attachment"><?php _e( 'Restore from Trash' ); ?></button>
<# } else { #>
<button type="button" class="button-link trash-attachment"><?php _e( 'Move to Trash' ); ?></button>
<# } #>
<?php else : ?>
<button type="button" class="button-link delete-attachment"><?php _e( 'Delete permanently' ); ?></button>
<?php endif; ?>
<# } #>
<div class="compat-meta">
<# if ( data.compat && data.compat.meta ) { #>
{{{ data.compat.meta }}}
<# } #>
</div>
</div>
</div>
<# var maybeReadOnly = data.can.save || data.allowLocalEdits ? '' : 'readonly'; #>
<# if ( 'image' === data.type ) { #>
<span class="setting alt-text has-description" data-setting="alt">
<label for="attachment-details-alt-text" class="name"><?php _e( 'Alt Text' ); ?></label>
<textarea id="attachment-details-alt-text" aria-describedby="alt-text-description" {{ maybeReadOnly }}>{{ data.alt }}</textarea>
</span>
<p class="description" id="alt-text-description"><?php echo $alt_text_description; ?></p>
<# } #>
<?php if ( post_type_supports( 'attachment', 'title' ) ) : ?>
<span class="setting" data-setting="title">
<label for="attachment-details-title" class="name"><?php _e( 'Title' ); ?></label>
<input type="text" id="attachment-details-title" value="{{ data.title }}" {{ maybeReadOnly }} />
</span>
<?php endif; ?>
<# if ( 'audio' === data.type ) { #>
<?php
foreach ( array(
'artist' => __( 'Artist' ),
'album' => __( 'Album' ),
) as $key => $label ) :
?>
<span class="setting" data-setting="<?php echo esc_attr( $key ); ?>">
<label for="attachment-details-<?php echo esc_attr( $key ); ?>" class="name"><?php echo $label; ?></label>
<input type="text" id="attachment-details-<?php echo esc_attr( $key ); ?>" value="{{ data.<?php echo $key; ?> || data.meta.<?php echo $key; ?> || '' }}" />
</span>
<?php endforeach; ?>
<# } #>
<span class="setting" data-setting="caption">
<label for="attachment-details-caption" class="name"><?php _e( 'Caption' ); ?></label>
<textarea id="attachment-details-caption" {{ maybeReadOnly }}>{{ data.caption }}</textarea>
</span>
<span class="setting" data-setting="description">
<label for="attachment-details-description" class="name"><?php _e( 'Description' ); ?></label>
<textarea id="attachment-details-description" {{ maybeReadOnly }}>{{ data.description }}</textarea>
</span>
<span class="setting" data-setting="url">
<label for="attachment-details-copy-link" class="name"><?php _e( 'File URL:' ); ?></label>
<input type="text" class="attachment-details-copy-link" id="attachment-details-copy-link" value="{{ data.url }}" readonly />
<div class="copy-to-clipboard-container">
<button type="button" class="button button-small copy-attachment-url" data-clipboard-target="#attachment-details-copy-link"><?php _e( 'Copy URL to clipboard' ); ?></button>
<span class="success hidden" aria-hidden="true"><?php _e( 'Copied!' ); ?></span>
</div>
</span>
</script>
<?php // Template for the Selection status bar. ?>
<script type="text/html" id="tmpl-media-selection">
<div class="selection-info">
<span class="count"></span>
<# if ( data.editable ) { #>
<button type="button" class="button-link edit-selection"><?php _e( 'Edit Selection' ); ?></button>
<# } #>
<# if ( data.clearable ) { #>
<button type="button" class="button-link clear-selection"><?php _e( 'Clear' ); ?></button>
<# } #>
</div>
<div class="selection-view"></div>
</script>
<?php // Template for the Attachment display settings, used for example in the sidebar. ?>
<script type="text/html" id="tmpl-attachment-display-settings">
<h2><?php _e( 'Attachment Display Settings' ); ?></h2>
<# if ( 'image' === data.type ) { #>
<span class="setting align">
<label for="attachment-display-settings-alignment" class="name"><?php _e( 'Alignment' ); ?></label>
<select id="attachment-display-settings-alignment" class="alignment"
data-setting="align"
<# if ( data.userSettings ) { #>
data-user-setting="align"
<# } #>>
<option value="left">
<?php esc_html_e( 'Left' ); ?>
</option>
<option value="center">
<?php esc_html_e( 'Center' ); ?>
</option>
<option value="right">
<?php esc_html_e( 'Right' ); ?>
</option>
<option value="none" selected>
<?php esc_html_e( 'None' ); ?>
</option>
</select>
</span>
<# } #>
<span class="setting">
<label for="attachment-display-settings-link-to" class="name">
<# if ( data.model.canEmbed ) { #>
<?php _e( 'Embed or Link' ); ?>
<# } else { #>
<?php _e( 'Link To' ); ?>
<# } #>
</label>
<select id="attachment-display-settings-link-to" class="link-to"
data-setting="link"
<# if ( data.userSettings && ! data.model.canEmbed ) { #>
data-user-setting="urlbutton"
<# } #>>
<# if ( data.model.canEmbed ) { #>
<option value="embed" selected>
<?php esc_html_e( 'Embed Media Player' ); ?>
</option>
<option value="file">
<# } else { #>
<option value="none" selected>
<?php esc_html_e( 'None' ); ?>
</option>
<option value="file">
<# } #>
<# if ( data.model.canEmbed ) { #>
<?php esc_html_e( 'Link to Media File' ); ?>
<# } else { #>
<?php esc_html_e( 'Media File' ); ?>
<# } #>
</option>
<option value="post">
<# if ( data.model.canEmbed ) { #>
<?php esc_html_e( 'Link to Attachment Page' ); ?>
<# } else { #>
<?php esc_html_e( 'Attachment Page' ); ?>
<# } #>
</option>
<# if ( 'image' === data.type ) { #>
<option value="custom">
<?php esc_html_e( 'Custom URL' ); ?>
</option>
<# } #>
</select>
</span>
<span class="setting">
<label for="attachment-display-settings-link-to-custom" class="name"><?php _e( 'URL' ); ?></label>
<input type="text" id="attachment-display-settings-link-to-custom" class="link-to-custom" data-setting="linkUrl" />
</span>
<# if ( 'undefined' !== typeof data.sizes ) { #>
<span class="setting">
<label for="attachment-display-settings-size" class="name"><?php _e( 'Size' ); ?></label>
<select id="attachment-display-settings-size" class="size" name="size"
data-setting="size"
<# if ( data.userSettings ) { #>
data-user-setting="imgsize"
<# } #>>
<?php
/** This filter is documented in wp-admin/includes/media.php */
$sizes = apply_filters(
'image_size_names_choose',
array(
'thumbnail' => __( 'Thumbnail' ),
'medium' => __( 'Medium' ),
'large' => __( 'Large' ),
'full' => __( 'Full Size' ),
)
);
foreach ( $sizes as $value => $name ) :
?>
<#
var size = data.sizes['<?php echo esc_js( $value ); ?>'];
if ( size ) { #>
<option value="<?php echo esc_attr( $value ); ?>" <?php selected( $value, 'full' ); ?>>
<?php echo esc_html( $name ); ?> – {{ size.width }} × {{ size.height }}
</option>
<# } #>
<?php endforeach; ?>
</select>
</span>
<# } #>
</script>
<?php // Template for the Gallery settings, used for example in the sidebar. ?>
<script type="text/html" id="tmpl-gallery-settings">
<h2><?php _e( 'Gallery Settings' ); ?></h2>
<span class="setting">
<label for="gallery-settings-link-to" class="name"><?php _e( 'Link To' ); ?></label>
<select id="gallery-settings-link-to" class="link-to"
data-setting="link"
<# if ( data.userSettings ) { #>
data-user-setting="urlbutton"
<# } #>>
<option value="post" <# if ( ! wp.media.galleryDefaults.link || 'post' === wp.media.galleryDefaults.link ) {
#>selected="selected"<# }
#>>
<?php esc_html_e( 'Attachment Page' ); ?>
</option>
<option value="file" <# if ( 'file' === wp.media.galleryDefaults.link ) { #>selected="selected"<# } #>>
<?php esc_html_e( 'Media File' ); ?>
</option>
<option value="none" <# if ( 'none' === wp.media.galleryDefaults.link ) { #>selected="selected"<# } #>>
<?php esc_html_e( 'None' ); ?>
</option>
</select>
</span>
<span class="setting">
<label for="gallery-settings-columns" class="name select-label-inline"><?php _e( 'Columns' ); ?></label>
<select id="gallery-settings-columns" class="columns" name="columns"
data-setting="columns">
<?php for ( $i = 1; $i <= 9; $i++ ) : ?>
<option value="<?php echo esc_attr( $i ); ?>" <#
if ( <?php echo $i; ?> == wp.media.galleryDefaults.columns ) { #>selected="selected"<# }
#>>
<?php echo esc_html( $i ); ?>
</option>
<?php endfor; ?>
</select>
</span>
<span class="setting">
<input type="checkbox" id="gallery-settings-random-order" data-setting="_orderbyRandom" />
<label for="gallery-settings-random-order" class="checkbox-label-inline"><?php _e( 'Random Order' ); ?></label>
</span>
<span class="setting size">
<label for="gallery-settings-size" class="name"><?php _e( 'Size' ); ?></label>
<select id="gallery-settings-size" class="size" name="size"
data-setting="size"
<# if ( data.userSettings ) { #>
data-user-setting="imgsize"
<# } #>
>
<?php
/** This filter is documented in wp-admin/includes/media.php */
$size_names = apply_filters(
'image_size_names_choose',
array(
'thumbnail' => __( 'Thumbnail' ),
'medium' => __( 'Medium' ),
'large' => __( 'Large' ),
'full' => __( 'Full Size' ),
)
);
foreach ( $size_names as $size => $label ) :
?>
<option value="<?php echo esc_attr( $size ); ?>">
<?php echo esc_html( $label ); ?>
</option>
<?php endforeach; ?>
</select>
</span>
</script>
<?php // Template for the Playlists settings, used for example in the sidebar. ?>
<script type="text/html" id="tmpl-playlist-settings">
<h2><?php _e( 'Playlist Settings' ); ?></h2>
<# var emptyModel = _.isEmpty( data.model ),
isVideo = 'video' === data.controller.get('library').props.get('type'); #>
<span class="setting">
<input type="checkbox" id="playlist-settings-show-list" data-setting="tracklist" <# if ( emptyModel ) { #>
checked="checked"
<# } #> />
<label for="playlist-settings-show-list" class="checkbox-label-inline">
<# if ( isVideo ) { #>
<?php _e( 'Show Video List' ); ?>
<# } else { #>
<?php _e( 'Show Tracklist' ); ?>
<# } #>
</label>
</span>
<# if ( ! isVideo ) { #>
<span class="setting">
<input type="checkbox" id="playlist-settings-show-artist" data-setting="artists" <# if ( emptyModel ) { #>
checked="checked"
<# } #> />
<label for="playlist-settings-show-artist" class="checkbox-label-inline">
<?php _e( 'Show Artist Name in Tracklist' ); ?>
</label>
</span>
<# } #>
<span class="setting">
<input type="checkbox" id="playlist-settings-show-images" data-setting="images" <# if ( emptyModel ) { #>
checked="checked"
<# } #> />
<label for="playlist-settings-show-images" class="checkbox-label-inline">
<?php _e( 'Show Images' ); ?>
</label>
</span>
</script>
<?php // Template for the "Insert from URL" layout. ?>
<script type="text/html" id="tmpl-embed-link-settings">
<span class="setting link-text">
<label for="embed-link-settings-link-text" class="name"><?php _e( 'Link Text' ); ?></label>
<input type="text" id="embed-link-settings-link-text" class="alignment" data-setting="linkText" />
</span>
<div class="embed-container" style="display: none;">
<div class="embed-preview"></div>
</div>
</script>
<?php // Template for the "Insert from URL" image preview and details. ?>
<script type="text/html" id="tmpl-embed-image-settings">
<div class="wp-clearfix">
<div class="thumbnail">
<img src="{{ data.model.url }}" draggable="false" alt="" />
</div>
</div>
<span class="setting alt-text has-description">
<label for="embed-image-settings-alt-text" class="name"><?php _e( 'Alternative Text' ); ?></label>
<textarea id="embed-image-settings-alt-text" data-setting="alt" aria-describedby="alt-text-description"></textarea>
</span>
<p class="description" id="alt-text-description"><?php echo $alt_text_description; ?></p>
<?php
/** This filter is documented in wp-admin/includes/media.php */
if ( ! apply_filters( 'disable_captions', '' ) ) :
?>
<span class="setting caption">
<label for="embed-image-settings-caption" class="name"><?php _e( 'Caption' ); ?></label>
<textarea id="embed-image-settings-caption" data-setting="caption"></textarea>
</span>
<?php endif; ?>
<fieldset class="setting-group">
<legend class="name"><?php _e( 'Align' ); ?></legend>
<span class="setting align">
<span class="button-group button-large" data-setting="align">
<button class="button" value="left">
<?php esc_html_e( 'Left' ); ?>
</button>
<button class="button" value="center">
<?php esc_html_e( 'Center' ); ?>
</button>
<button class="button" value="right">
<?php esc_html_e( 'Right' ); ?>
</button>
<button class="button active" value="none">
<?php esc_html_e( 'None' ); ?>
</button>
</span>
</span>
</fieldset>
<fieldset class="setting-group">
<legend class="name"><?php _e( 'Link To' ); ?></legend>
<span class="setting link-to">
<span class="button-group button-large" data-setting="link">
<button class="button" value="file">
<?php esc_html_e( 'Image URL' ); ?>
</button>
<button class="button" value="custom">
<?php esc_html_e( 'Custom URL' ); ?>
</button>
<button class="button active" value="none">
<?php esc_html_e( 'None' ); ?>
</button>
</span>
</span>
<span class="setting">
<label for="embed-image-settings-link-to-custom" class="name"><?php _e( 'URL' ); ?></label>
<input type="text" id="embed-image-settings-link-to-custom" class="link-to-custom" data-setting="linkUrl" />
</span>
</fieldset>
</script>
<?php // Template for the Image details, used for example in the editor. ?>
<script type="text/html" id="tmpl-image-details">
<div class="media-embed">
<div class="embed-media-settings">
<div class="column-settings">
<span class="setting alt-text has-description">
<label for="image-details-alt-text" class="name"><?php _e( 'Alternative Text' ); ?></label>
<textarea id="image-details-alt-text" data-setting="alt" aria-describedby="alt-text-description">{{ data.model.alt }}</textarea>
</span>
<p class="description" id="alt-text-description"><?php echo $alt_text_description; ?></p>
<?php
/** This filter is documented in wp-admin/includes/media.php */
if ( ! apply_filters( 'disable_captions', '' ) ) :
?>
<span class="setting caption">
<label for="image-details-caption" class="name"><?php _e( 'Caption' ); ?></label>
<textarea id="image-details-caption" data-setting="caption">{{ data.model.caption }}</textarea>
</span>
<?php endif; ?>
<h2><?php _e( 'Display Settings' ); ?></h2>
<fieldset class="setting-group">
<legend class="legend-inline"><?php _e( 'Align' ); ?></legend>
<span class="setting align">
<span class="button-group button-large" data-setting="align">
<button class="button" value="left">
<?php esc_html_e( 'Left' ); ?>
</button>
<button class="button" value="center">
<?php esc_html_e( 'Center' ); ?>
</button>
<button class="button" value="right">
<?php esc_html_e( 'Right' ); ?>
</button>
<button class="button active" value="none">
<?php esc_html_e( 'None' ); ?>
</button>
</span>
</span>
</fieldset>
<# if ( data.attachment ) { #>
<# if ( 'undefined' !== typeof data.attachment.sizes ) { #>
<span class="setting size">
<label for="image-details-size" class="name"><?php _e( 'Size' ); ?></label>
<select id="image-details-size" class="size" name="size"
data-setting="size"
<# if ( data.userSettings ) { #>
data-user-setting="imgsize"
<# } #>>
<?php
/** This filter is documented in wp-admin/includes/media.php */
$sizes = apply_filters(
'image_size_names_choose',
array(
'thumbnail' => __( 'Thumbnail' ),
'medium' => __( 'Medium' ),
'large' => __( 'Large' ),
'full' => __( 'Full Size' ),
)
);
foreach ( $sizes as $value => $name ) :
?>
<#
var size = data.sizes['<?php echo esc_js( $value ); ?>'];
if ( size ) { #>
<option value="<?php echo esc_attr( $value ); ?>">
<?php echo esc_html( $name ); ?> – {{ size.width }} × {{ size.height }}
</option>
<# } #>
<?php endforeach; ?>
<option value="<?php echo esc_attr( 'custom' ); ?>">
<?php _e( 'Custom Size' ); ?>
</option>
</select>
</span>
<# } #>
<div class="custom-size wp-clearfix<# if ( data.model.size !== 'custom' ) { #> hidden<# } #>">
<span class="custom-size-setting">
<label for="image-details-size-width"><?php _e( 'Width' ); ?></label>
<input type="number" id="image-details-size-width" aria-describedby="image-size-desc" data-setting="customWidth" step="1" value="{{ data.model.customWidth }}" />
</span>
<span class="sep" aria-hidden="true">×</span>
<span class="custom-size-setting">
<label for="image-details-size-height"><?php _e( 'Height' ); ?></label>
<input type="number" id="image-details-size-height" aria-describedby="image-size-desc" data-setting="customHeight" step="1" value="{{ data.model.customHeight }}" />
</span>
<p id="image-size-desc" class="description"><?php _e( 'Image size in pixels' ); ?></p>
</div>
<# } #>
<span class="setting link-to">
<label for="image-details-link-to" class="name"><?php _e( 'Link To' ); ?></label>
<select id="image-details-link-to" data-setting="link">
<# if ( data.attachment ) { #>
<option value="file">
<?php esc_html_e( 'Media File' ); ?>
</option>
<option value="post">
<?php esc_html_e( 'Attachment Page' ); ?>
</option>
<# } else { #>
<option value="file">
<?php esc_html_e( 'Image URL' ); ?>
</option>
<# } #>
<option value="custom">
<?php esc_html_e( 'Custom URL' ); ?>
</option>
<option value="none">
<?php esc_html_e( 'None' ); ?>
</option>
</select>
</span>
<span class="setting">
<label for="image-details-link-to-custom" class="name"><?php _e( 'URL' ); ?></label>
<input type="text" id="image-details-link-to-custom" class="link-to-custom" data-setting="linkUrl" />
</span>
<div class="advanced-section">
<h2><button type="button" class="button-link advanced-toggle"><?php _e( 'Advanced Options' ); ?></button></h2>
<div class="advanced-settings hidden">
<div class="advanced-image">
<span class="setting title-text">
<label for="image-details-title-attribute" class="name"><?php _e( 'Image Title Attribute' ); ?></label>
<input type="text" id="image-details-title-attribute" data-setting="title" value="{{ data.model.title }}" />
</span>
<span class="setting extra-classes">
<label for="image-details-css-class" class="name"><?php _e( 'Image CSS Class' ); ?></label>
<input type="text" id="image-details-css-class" data-setting="extraClasses" value="{{ data.model.extraClasses }}" />
</span>
</div>
<div class="advanced-link">
<span class="setting link-target">
<input type="checkbox" id="image-details-link-target" data-setting="linkTargetBlank" value="_blank" <# if ( data.model.linkTargetBlank ) { #>checked="checked"<# } #>>
<label for="image-details-link-target" class="checkbox-label"><?php _e( 'Open link in a new tab' ); ?></label>
</span>
<span class="setting link-rel">
<label for="image-details-link-rel" class="name"><?php _e( 'Link Rel' ); ?></label>
<input type="text" id="image-details-link-rel" data-setting="linkRel" value="{{ data.model.linkRel }}" />
</span>
<span class="setting link-class-name">
<label for="image-details-link-css-class" class="name"><?php _e( 'Link CSS Class' ); ?></label>
<input type="text" id="image-details-link-css-class" data-setting="linkClassName" value="{{ data.model.linkClassName }}" />
</span>
</div>
</div>
</div>
</div>
<div class="column-image">
<div class="image">
<img src="{{ data.model.url }}" draggable="false" alt="" />
<# if ( data.attachment && window.imageEdit ) { #>
<div class="actions">
<input type="button" class="edit-attachment button" value="<?php esc_attr_e( 'Edit Original' ); ?>" />
<input type="button" class="replace-attachment button" value="<?php esc_attr_e( 'Replace' ); ?>" />
</div>
<# } #>
</div>
</div>
</div>
</div>
</script>
<?php // Template for the Image Editor layout. ?>
<script type="text/html" id="tmpl-image-editor">
<div id="media-head-{{ data.id }}"></div>
<div id="image-editor-{{ data.id }}"></div>
</script>
<?php // Template for an embedded Audio details. ?>
<script type="text/html" id="tmpl-audio-details">
<# var ext, html5types = {
mp3: wp.media.view.settings.embedMimes.mp3,
ogg: wp.media.view.settings.embedMimes.ogg
}; #>
<?php $audio_types = wp_get_audio_extensions(); ?>
<div class="media-embed media-embed-details">
<div class="embed-media-settings embed-audio-settings">
<?php wp_underscore_audio_template(); ?>
<# if ( ! _.isEmpty( data.model.src ) ) {
ext = data.model.src.split('.').pop();
if ( html5types[ ext ] ) {
delete html5types[ ext ];
}
#>
<span class="setting">
<label for="audio-details-source" class="name"><?php _e( 'URL' ); ?></label>
<input type="text" id="audio-details-source" readonly data-setting="src" value="{{ data.model.src }}" />
<button type="button" class="button-link remove-setting"><?php _e( 'Remove audio source' ); ?></button>
</span>
<# } #>
<?php
foreach ( $audio_types as $type ) :
?>
<# if ( ! _.isEmpty( data.model.<?php echo $type; ?> ) ) {
if ( ! _.isUndefined( html5types.<?php echo $type; ?> ) ) {
delete html5types.<?php echo $type; ?>;
}
#>
<span class="setting">
<label for="audio-details-<?php echo $type . '-source'; ?>" class="name"><?php echo strtoupper( $type ); ?></label>
<input type="text" id="audio-details-<?php echo $type . '-source'; ?>" readonly data-setting="<?php echo $type; ?>" value="{{ data.model.<?php echo $type; ?> }}" />
<button type="button" class="button-link remove-setting"><?php _e( 'Remove audio source' ); ?></button>
</span>
<# } #>
<?php endforeach; ?>
<# if ( ! _.isEmpty( html5types ) ) { #>
<fieldset class="setting-group">
<legend class="name"><?php _e( 'Add alternate sources for maximum HTML5 playback' ); ?></legend>
<span class="setting">
<span class="button-large">
<# _.each( html5types, function (mime, type) { #>
<button class="button add-media-source" data-mime="{{ mime }}">{{ type }}</button>
<# } ) #>
</span>
</span>
</fieldset>
<# } #>
<fieldset class="setting-group">
<legend class="name"><?php _e( 'Preload' ); ?></legend>
<span class="setting preload">
<span class="button-group button-large" data-setting="preload">
<button class="button" value="auto"><?php _ex( 'Auto', 'auto preload' ); ?></button>
<button class="button" value="metadata"><?php _e( 'Metadata' ); ?></button>
<button class="button active" value="none"><?php _e( 'None' ); ?></button>
</span>
</span>
</fieldset>
<span class="setting-group">
<span class="setting checkbox-setting autoplay">
<input type="checkbox" id="audio-details-autoplay" data-setting="autoplay" />
<label for="audio-details-autoplay" class="checkbox-label"><?php _e( 'Autoplay' ); ?></label>
</span>
<span class="setting checkbox-setting">
<input type="checkbox" id="audio-details-loop" data-setting="loop" />
<label for="audio-details-loop" class="checkbox-label"><?php _e( 'Loop' ); ?></label>
</span>
</span>
</div>
</div>
</script>
<?php // Template for an embedded Video details. ?>
<script type="text/html" id="tmpl-video-details">
<# var ext, html5types = {
mp4: wp.media.view.settings.embedMimes.mp4,
ogv: wp.media.view.settings.embedMimes.ogv,
webm: wp.media.view.settings.embedMimes.webm
}; #>
<?php $video_types = wp_get_video_extensions(); ?>
<div class="media-embed media-embed-details">
<div class="embed-media-settings embed-video-settings">
<div class="wp-video-holder">
<#
var w = ! data.model.width || data.model.width > 640 ? 640 : data.model.width,
h = ! data.model.height ? 360 : data.model.height;
if ( data.model.width && w !== data.model.width ) {
h = Math.ceil( ( h * w ) / data.model.width );
}
#>
<?php wp_underscore_video_template(); ?>
<# if ( ! _.isEmpty( data.model.src ) ) {
ext = data.model.src.split('.').pop();
if ( html5types[ ext ] ) {
delete html5types[ ext ];
}
#>
<span class="setting">
<label for="video-details-source" class="name"><?php _e( 'URL' ); ?></label>
<input type="text" id="video-details-source" readonly data-setting="src" value="{{ data.model.src }}" />
<button type="button" class="button-link remove-setting"><?php _e( 'Remove video source' ); ?></button>
</span>
<# } #>
<?php
foreach ( $video_types as $type ) :
?>
<# if ( ! _.isEmpty( data.model.<?php echo $type; ?> ) ) {
if ( ! _.isUndefined( html5types.<?php echo $type; ?> ) ) {
delete html5types.<?php echo $type; ?>;
}
#>
<span class="setting">
<label for="video-details-<?php echo $type . '-source'; ?>" class="name"><?php echo strtoupper( $type ); ?></label>
<input type="text" id="video-details-<?php echo $type . '-source'; ?>" readonly data-setting="<?php echo $type; ?>" value="{{ data.model.<?php echo $type; ?> }}" />
<button type="button" class="button-link remove-setting"><?php _e( 'Remove video source' ); ?></button>
</span>
<# } #>
<?php endforeach; ?>
</div>
<# if ( ! _.isEmpty( html5types ) ) { #>
<fieldset class="setting-group">
<legend class="name"><?php _e( 'Add alternate sources for maximum HTML5 playback' ); ?></legend>
<span class="setting">
<span class="button-large">
<# _.each( html5types, function (mime, type) { #>
<button class="button add-media-source" data-mime="{{ mime }}">{{ type }}</button>
<# } ) #>
</span>
</span>
</fieldset>
<# } #>
<# if ( ! _.isEmpty( data.model.poster ) ) { #>
<span class="setting">
<label for="video-details-poster-image" class="name"><?php _e( 'Poster Image' ); ?></label>
<input type="text" id="video-details-poster-image" readonly data-setting="poster" value="{{ data.model.poster }}" />
<button type="button" class="button-link remove-setting"><?php _e( 'Remove poster image' ); ?></button>
</span>
<# } #>
<fieldset class="setting-group">
<legend class="name"><?php _e( 'Preload' ); ?></legend>
<span class="setting preload">
<span class="button-group button-large" data-setting="preload">
<button class="button" value="auto"><?php _ex( 'Auto', 'auto preload' ); ?></button>
<button class="button" value="metadata"><?php _e( 'Metadata' ); ?></button>
<button class="button active" value="none"><?php _e( 'None' ); ?></button>
</span>
</span>
</fieldset>
<span class="setting-group">
<span class="setting checkbox-setting autoplay">
<input type="checkbox" id="video-details-autoplay" data-setting="autoplay" />
<label for="video-details-autoplay" class="checkbox-label"><?php _e( 'Autoplay' ); ?></label>
</span>
<span class="setting checkbox-setting">
<input type="checkbox" id="video-details-loop" data-setting="loop" />
<label for="video-details-loop" class="checkbox-label"><?php _e( 'Loop' ); ?></label>
</span>
</span>
<span class="setting" data-setting="content">
<#
var content = '';
if ( ! _.isEmpty( data.model.content ) ) {
var tracks = jQuery( data.model.content ).filter( 'track' );
_.each( tracks.toArray(), function( track, index ) {
content += track.outerHTML; #>
<label for="video-details-track-{{ index }}" class="name"><?php _e( 'Tracks (subtitles, captions, descriptions, chapters, or metadata)' ); ?></label>
<input class="content-track" type="text" id="video-details-track-{{ index }}" aria-describedby="video-details-track-desc-{{ index }}" value="{{ track.outerHTML }}" />
<span class="description" id="video-details-track-desc-{{ index }}">
<?php
printf(
/* translators: 1: "srclang" HTML attribute, 2: "label" HTML attribute, 3: "kind" HTML attribute. */
__( 'The %1$s, %2$s, and %3$s values can be edited to set the video track language and kind.' ),
'srclang',
'label',
'kind'
);
?>
</span>
<button type="button" class="button-link remove-setting remove-track"><?php _ex( 'Remove video track', 'media' ); ?></button><br />
<# } ); #>
<# } else { #>
<span class="name"><?php _e( 'Tracks (subtitles, captions, descriptions, chapters, or metadata)' ); ?></span><br />
<em><?php _e( 'There are no associated subtitles.' ); ?></em>
<# } #>
<textarea class="hidden content-setting">{{ content }}</textarea>
</span>
</div>
</div>
</script>
<?php // Template for a Gallery within the editor. ?>
<script type="text/html" id="tmpl-editor-gallery">
<# if ( data.attachments.length ) { #>
<div class="gallery gallery-columns-{{ data.columns }}">
<# _.each( data.attachments, function( attachment, index ) { #>
<dl class="gallery-item">
<dt class="gallery-icon">
<# if ( attachment.thumbnail ) { #>
<img src="{{ attachment.thumbnail.url }}" width="{{ attachment.thumbnail.width }}" height="{{ attachment.thumbnail.height }}" alt="{{ attachment.alt }}" />
<# } else { #>
<img src="{{ attachment.url }}" alt="{{ attachment.alt }}" />
<# } #>
</dt>
<# if ( attachment.caption ) { #>
<dd class="wp-caption-text gallery-caption">
{{{ data.verifyHTML( attachment.caption ) }}}
</dd>
<# } #>
</dl>
<# if ( index % data.columns === data.columns - 1 ) { #>
<br style="clear: both;" />
<# } #>
<# } ); #>
</div>
<# } else { #>
<div class="wpview-error">
<div class="dashicons dashicons-format-gallery"></div><p><?php _e( 'No items found.' ); ?></p>
</div>
<# } #>
</script>
<?php // Template for the Crop area layout, used for example in the Customizer. ?>
<script type="text/html" id="tmpl-crop-content">
<img class="crop-image" src="{{ data.url }}" alt="<?php esc_attr_e( 'Image crop area preview. Requires mouse interaction.' ); ?>" />
<div class="upload-errors"></div>
</script>
<?php // Template for the Site Icon preview, used for example in the Customizer. ?>
<script type="text/html" id="tmpl-site-icon-preview">
<h2><?php _e( 'Preview' ); ?></h2>
<strong aria-hidden="true"><?php _e( 'As a browser icon' ); ?></strong>
<div class="favicon-preview">
<img src="<?php echo esc_url( admin_url( 'images/' . ( is_rtl() ? 'browser-rtl.png' : 'browser.png' ) ) ); ?>" class="browser-preview" width="182" height="" alt="" />
<div class="favicon">
<img id="preview-favicon" src="{{ data.url }}" alt="<?php esc_attr_e( 'Preview as a browser icon' ); ?>" />
</div>
<span class="browser-title" aria-hidden="true"><# print( '<?php echo esc_js( get_bloginfo( 'name' ) ); ?>' ) #></span>
</div>
<strong aria-hidden="true"><?php _e( 'As an app icon' ); ?></strong>
<div class="app-icon-preview">
<img id="preview-app-icon" src="{{ data.url }}" alt="<?php esc_attr_e( 'Preview as an app icon' ); ?>" />
</div>
</script>
<?php
/**
* Fires when the custom Backbone media templates are printed.
*
* @since 3.5.0
*/
do_action( 'print_media_templates' );
}
```
[apply\_filters( 'disable\_captions', bool $bool )](../hooks/disable_captions)
Filters whether to disable captions.
[apply\_filters( 'image\_size\_names\_choose', string[] $size\_names )](../hooks/image_size_names_choose)
Filters the names and labels of the default image sizes.
[do\_action( 'post-plupload-upload-ui' )](../hooks/post-plupload-upload-ui)
Fires after the upload interface loads.
[do\_action( 'post-upload-ui' )](../hooks/post-upload-ui)
Fires on the post upload UI screen.
[do\_action( 'pre-plupload-upload-ui' )](../hooks/pre-plupload-upload-ui)
Fires before the upload interface loads.
[do\_action( 'pre-upload-ui' )](../hooks/pre-upload-ui)
Fires just before the legacy (pre-3.5.0) upload interface is loaded.
[do\_action( 'print\_media\_templates' )](../hooks/print_media_templates)
Fires when the custom Backbone media templates are printed.
[do\_action( 'upload\_ui\_over\_quota' )](../hooks/upload_ui_over_quota)
Fires when an upload will exceed the defined upload space quota for a network site.
| Uses | Description |
| --- | --- |
| [wp\_underscore\_video\_template()](wp_underscore_video_template) wp-includes/media-template.php | Outputs the markup for a video tag to be used in an Underscore template when data.model is passed. |
| [\_device\_can\_upload()](_device_can_upload) wp-includes/functions.php | Tests if the current device has the capability to upload files. |
| [wp\_underscore\_audio\_template()](wp_underscore_audio_template) wp-includes/media-template.php | Outputs the markup for a audio tag to be used in an Underscore template when data.model is passed. |
| [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. |
| [post\_type\_supports()](post_type_supports) wp-includes/post.php | Checks a post type’s support for a given feature. |
| [wp\_get\_audio\_extensions()](wp_get_audio_extensions) wp-includes/media.php | Returns a filtered list of supported audio formats. |
| [wp\_get\_video\_extensions()](wp_get_video_extensions) wp-includes/media.php | Returns a filtered list of supported video formats. |
| [wp\_max\_upload\_size()](wp_max_upload_size) wp-includes/media.php | Determines the maximum upload size allowed in php.ini. |
| [remove\_action()](remove_action) wp-includes/plugin.php | Removes a callback function from an action hook. |
| [is\_rtl()](is_rtl) wp-includes/l10n.php | Determines whether the current locale is right-to-left (RTL). |
| [\_ex()](_ex) wp-includes/l10n.php | Displays translated string with gettext context. |
| [size\_format()](size_format) wp-includes/functions.php | Converts a number of bytes to the largest unit the bytes will fit into. |
| [selected()](selected) wp-includes/general-template.php | Outputs the HTML selected attribute. |
| [esc\_js()](esc_js) wp-includes/formatting.php | Escapes single quotes, `"`, , `&`, and fixes line endings. |
| [esc\_attr\_e()](esc_attr_e) wp-includes/l10n.php | Displays translated text that has been escaped for safe use in an attribute. |
| [esc\_html\_e()](esc_html_e) wp-includes/l10n.php | Displays translated text that has been escaped for safe use in HTML output. |
| [is\_multisite()](is_multisite) wp-includes/load.php | If Multisite is enabled. |
| [add\_query\_arg()](add_query_arg) wp-includes/functions.php | Retrieves a modified URL query string. |
| [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. |
| [do\_action()](do_action) wp-includes/plugin.php | Calls the callback functions that have been added to an action 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. |
| [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. |
| [\_e()](_e) wp-includes/l10n.php | Displays translated text. |
| [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. |
| Version | Description |
| --- | --- |
| [3.5.0](https://developer.wordpress.org/reference/since/3.5.0/) | Introduced. |
| programming_docs |
wordpress comments_popup_script() comments\_popup\_script()
=========================
This function has been deprecated.
Display the JS popup script to show a comment.
File: `wp-includes/deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/deprecated.php/)
```
function comments_popup_script() {
_deprecated_function( __FUNCTION__, '4.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 |
| --- | --- |
| [4.5.0](https://developer.wordpress.org/reference/since/4.5.0/) | This function has been deprecated. |
| [0.71](https://developer.wordpress.org/reference/since/0.71/) | Introduced. |
wordpress comment_guid( int|WP_Comment $comment_id = null ) comment\_guid( int|WP\_Comment $comment\_id = null )
====================================================
Displays the feed GUID for the current comment.
`$comment_id` int|[WP\_Comment](../classes/wp_comment) Optional comment object or ID. Defaults to global comment object. Default: `null`
File: `wp-includes/feed.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/feed.php/)
```
function comment_guid( $comment_id = null ) {
echo esc_url( get_comment_guid( $comment_id ) );
}
```
| Uses | Description |
| --- | --- |
| [get\_comment\_guid()](get_comment_guid) wp-includes/feed.php | Retrieves the feed GUID for the current comment. |
| [esc\_url()](esc_url) wp-includes/formatting.php | Checks and cleans a URL. |
| Version | Description |
| --- | --- |
| [2.5.0](https://developer.wordpress.org/reference/since/2.5.0/) | Introduced. |
wordpress get_page_of_comment( int $comment_ID, array $args = array() ): int|null get\_page\_of\_comment( int $comment\_ID, array $args = array() ): int|null
===========================================================================
Calculates what page number a comment will appear on for comment paging.
`$comment_ID` int Required Comment ID. `$args` array Optional Array of optional arguments.
* `type`stringLimit paginated comments to those matching a given type.
Accepts `'comment'`, `'trackback'`, `'pingback'`, `'pings'` (trackbacks and pingbacks), or `'all'`. Default `'all'`.
* `per_page`intPer-page count to use when calculating pagination.
Defaults to the value of the `'comments_per_page'` option.
* `max_depth`int|stringIf greater than 1, comment page will be determined for the top-level parent `$comment_ID`.
Defaults to the value of the `'thread_comments_depth'` option.
Default: `array()`
int|null Comment page number or null on error.
File: `wp-includes/comment.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/comment.php/)
```
function get_page_of_comment( $comment_ID, $args = array() ) {
global $wpdb;
$page = null;
$comment = get_comment( $comment_ID );
if ( ! $comment ) {
return;
}
$defaults = array(
'type' => 'all',
'page' => '',
'per_page' => '',
'max_depth' => '',
);
$args = wp_parse_args( $args, $defaults );
$original_args = $args;
// Order of precedence: 1. `$args['per_page']`, 2. 'comments_per_page' query_var, 3. 'comments_per_page' option.
if ( get_option( 'page_comments' ) ) {
if ( '' === $args['per_page'] ) {
$args['per_page'] = get_query_var( 'comments_per_page' );
}
if ( '' === $args['per_page'] ) {
$args['per_page'] = get_option( 'comments_per_page' );
}
}
if ( empty( $args['per_page'] ) ) {
$args['per_page'] = 0;
$args['page'] = 0;
}
if ( $args['per_page'] < 1 ) {
$page = 1;
}
if ( null === $page ) {
if ( '' === $args['max_depth'] ) {
if ( get_option( 'thread_comments' ) ) {
$args['max_depth'] = get_option( 'thread_comments_depth' );
} else {
$args['max_depth'] = -1;
}
}
// Find this comment's top-level parent if threading is enabled.
if ( $args['max_depth'] > 1 && 0 != $comment->comment_parent ) {
return get_page_of_comment( $comment->comment_parent, $args );
}
$comment_args = array(
'type' => $args['type'],
'post_id' => $comment->comment_post_ID,
'fields' => 'ids',
'count' => true,
'status' => 'approve',
'parent' => 0,
'date_query' => array(
array(
'column' => "$wpdb->comments.comment_date_gmt",
'before' => $comment->comment_date_gmt,
),
),
);
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 );
}
}
/**
* Filters the arguments used to query comments in get_page_of_comment().
*
* @since 5.5.0
*
* @see WP_Comment_Query::__construct()
*
* @param array $comment_args {
* Array of WP_Comment_Query arguments.
*
* @type string $type Limit paginated comments to those matching a given type.
* Accepts 'comment', 'trackback', 'pingback', 'pings'
* (trackbacks and pingbacks), or 'all'. Default 'all'.
* @type int $post_id ID of the post.
* @type string $fields Comment fields to return.
* @type bool $count Whether to return a comment count (true) or array
* of comment objects (false).
* @type string $status Comment status.
* @type int $parent Parent ID of comment to retrieve children of.
* @type array $date_query Date query clauses to limit comments by. See WP_Date_Query.
* @type array $include_unapproved Array of IDs or email addresses whose unapproved comments
* will be included in paginated comments.
* }
*/
$comment_args = apply_filters( 'get_page_of_comment_query_args', $comment_args );
$comment_query = new WP_Comment_Query();
$older_comment_count = $comment_query->query( $comment_args );
// No older comments? Then it's page #1.
if ( 0 == $older_comment_count ) {
$page = 1;
// Divide comments older than this one by comments per page to get this comment's page number.
} else {
$page = ceil( ( $older_comment_count + 1 ) / $args['per_page'] );
}
}
/**
* Filters the calculated page on which a comment appears.
*
* @since 4.4.0
* @since 4.7.0 Introduced the `$comment_ID` parameter.
*
* @param int $page Comment page.
* @param array $args {
* Arguments used to calculate pagination. These include arguments auto-detected by the function,
* based on query vars, system settings, etc. For pristine arguments passed to the function,
* see `$original_args`.
*
* @type string $type Type of comments to count.
* @type int $page Calculated current page.
* @type int $per_page Calculated number of comments per page.
* @type int $max_depth Maximum comment threading depth allowed.
* }
* @param array $original_args {
* Array of arguments passed to the function. Some or all of these may not be set.
*
* @type string $type Type of comments to count.
* @type int $page Current comment page.
* @type int $per_page Number of comments per page.
* @type int $max_depth Maximum comment threading depth allowed.
* }
* @param int $comment_ID ID of the comment.
*/
return apply_filters( 'get_page_of_comment', (int) $page, $args, $original_args, $comment_ID );
}
```
[apply\_filters( 'get\_page\_of\_comment', int $page, array $args, array $original\_args, int $comment\_ID )](../hooks/get_page_of_comment)
Filters the calculated page on which a comment appears.
[apply\_filters( 'get\_page\_of\_comment\_query\_args', array $comment\_args )](../hooks/get_page_of_comment_query_args)
Filters the arguments used to query comments in [get\_page\_of\_comment()](get_page_of_comment) .
| 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\_Comment\_Query::\_\_construct()](../classes/wp_comment_query/__construct) wp-includes/class-wp-comment-query.php | Constructor. |
| [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\_page\_of\_comment()](get_page_of_comment) wp-includes/comment.php | Calculates what page number a comment will appear on for comment paging. |
| [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. |
| [get\_comment()](get_comment) wp-includes/comment.php | Retrieves comment data given a comment ID or comment object. |
| Used By | Description |
| --- | --- |
| [get\_comment\_link()](get_comment_link) wp-includes/comment-template.php | Retrieves the link to a given comment. |
| [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 |
| --- | --- |
| [2.7.0](https://developer.wordpress.org/reference/since/2.7.0/) | Introduced. |
wordpress timer_stop( int|bool $display, int $precision = 3 ): string timer\_stop( int|bool $display, int $precision = 3 ): string
============================================================
Retrieve or display the time from the page start to when function is called.
`$display` int|bool Required Whether to echo or return the results. Accepts `0|false` for return, `1|true` for echo. Default `0|false`. `$precision` int Optional The number of digits from the right of the decimal to display.
Default: `3`
string The "second.microsecond" finished time calculation. The number is formatted for human consumption, both localized and rounded.
File: `wp-includes/load.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/load.php/)
```
function timer_stop( $display = 0, $precision = 3 ) {
global $timestart, $timeend;
$timeend = microtime( true );
$timetotal = $timeend - $timestart;
$r = ( function_exists( 'number_format_i18n' ) ) ? number_format_i18n( $timetotal, $precision ) : number_format( $timetotal, $precision );
if ( $display ) {
echo $r;
}
return $r;
}
```
| Uses | Description |
| --- | --- |
| [number\_format\_i18n()](number_format_i18n) wp-includes/functions.php | Converts float number to format based on the locale. |
| Version | Description |
| --- | --- |
| [0.71](https://developer.wordpress.org/reference/since/0.71/) | Introduced. |
wordpress delete_user_setting( string $names ): bool|null delete\_user\_setting( string $names ): bool|null
=================================================
Deletes user interface settings.
Deleting settings would reset them to the defaults.
This function has to be used before any output has started as it calls `setcookie()`.
`$names` string Required The name or array of names of the setting to be deleted. bool|null True if deleted successfully, false otherwise.
Null if the current user is not a member of the site.
File: `wp-includes/option.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/option.php/)
```
function delete_user_setting( $names ) {
if ( headers_sent() ) {
return false;
}
$all_user_settings = get_all_user_settings();
$names = (array) $names;
$deleted = false;
foreach ( $names as $name ) {
if ( isset( $all_user_settings[ $name ] ) ) {
unset( $all_user_settings[ $name ] );
$deleted = true;
}
}
if ( $deleted ) {
return wp_set_all_user_settings( $all_user_settings );
}
return false;
}
```
| Uses | Description |
| --- | --- |
| [get\_all\_user\_settings()](get_all_user_settings) wp-includes/option.php | Retrieves all user interface settings. |
| [wp\_set\_all\_user\_settings()](wp_set_all_user_settings) wp-includes/option.php | Private. Sets all user interface settings. |
| Used By | Description |
| --- | --- |
| [default\_password\_nag\_handler()](default_password_nag_handler) wp-admin/includes/user.php | |
| [default\_password\_nag\_edit\_user()](default_password_nag_edit_user) wp-admin/includes/user.php | |
| Version | Description |
| --- | --- |
| [2.7.0](https://developer.wordpress.org/reference/since/2.7.0/) | Introduced. |
wordpress wp_ajax_untrash_post( string $action ) wp\_ajax\_untrash\_post( string $action )
=========================================
Ajax handler to restore a post from the Trash.
`$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_untrash_post( $action ) {
if ( empty( $action ) ) {
$action = 'untrash-post';
}
wp_ajax_trash_post( $action );
}
```
| Uses | Description |
| --- | --- |
| [wp\_ajax\_trash\_post()](wp_ajax_trash_post) wp-admin/includes/ajax-actions.php | Ajax handler for sending a post to the Trash. |
| Version | Description |
| --- | --- |
| [3.1.0](https://developer.wordpress.org/reference/since/3.1.0/) | Introduced. |
wordpress get_the_permalink( int|WP_Post $post, bool $leavename = false ): string|false get\_the\_permalink( int|WP\_Post $post, bool $leavename = false ): string|false
================================================================================
Retrieves the full permalink for the current post or post ID.
This function is an alias for [get\_permalink()](get_permalink) .
* [get\_permalink()](get_permalink)
`$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 or page name. Default: `false`
string|false The permalink URL. False if the post does not exist.
File: `wp-includes/link-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/link-template.php/)
```
function get_the_permalink( $post = 0, $leavename = false ) {
return get_permalink( $post, $leavename );
}
```
| Uses | Description |
| --- | --- |
| [get\_permalink()](get_permalink) wp-includes/link-template.php | Retrieves the full permalink for the current post or post ID. |
| Used By | Description |
| --- | --- |
| [\_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 |
| --- | --- |
| [3.9.0](https://developer.wordpress.org/reference/since/3.9.0/) | Introduced. |
wordpress _prime_site_caches( array $ids, bool $update_meta_cache = true ) \_prime\_site\_caches( array $ids, bool $update\_meta\_cache = true )
=====================================================================
Adds any sites from the given IDs to the cache that do not already exist in cache.
* [update\_site\_cache()](update_site_cache)
`$ids` array Required ID list. `$update_meta_cache` bool Optional Whether to update the meta cache. Default: `true`
File: `wp-includes/ms-site.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/ms-site.php/)
```
function _prime_site_caches( $ids, $update_meta_cache = true ) {
global $wpdb;
$non_cached_ids = _get_non_cached_ids( $ids, 'sites' );
if ( ! empty( $non_cached_ids ) ) {
$fresh_sites = $wpdb->get_results( sprintf( "SELECT * FROM $wpdb->blogs WHERE blog_id IN (%s)", implode( ',', array_map( 'intval', $non_cached_ids ) ) ) ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared
update_site_cache( $fresh_sites, $update_meta_cache );
}
}
```
| Uses | Description |
| --- | --- |
| [update\_site\_cache()](update_site_cache) wp-includes/ms-site.php | Updates sites in cache. |
| [\_get\_non\_cached\_ids()](_get_non_cached_ids) wp-includes/functions.php | Retrieves IDs that are not already present in the cache. |
| [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\_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. |
| Version | Description |
| --- | --- |
| [6.1.0](https://developer.wordpress.org/reference/since/6.1.0/) | This function is no longer marked as "private". |
| [5.1.0](https://developer.wordpress.org/reference/since/5.1.0/) | Introduced the `$update_meta_cache` parameter. |
| [4.6.0](https://developer.wordpress.org/reference/since/4.6.0/) | Introduced. |
wordpress wp_kses_attr( string $element, string $attr, array[]|string $allowed_html, string[] $allowed_protocols ): string wp\_kses\_attr( string $element, string $attr, array[]|string $allowed\_html, string[] $allowed\_protocols ): string
====================================================================================================================
Removes all attributes, if none are allowed for this element.
If some are allowed it calls `wp_kses_hair()` to split them further, and then it builds up new HTML code from the data that `wp_kses_hair()` returns. It also removes `<` and `>` characters, if there are any left. One more thing it does is to check if the tag has a closing XHTML slash, and if it does, it puts one in the returned code as well.
An array of allowed values can be defined for attributes. If the attribute value doesn’t fall into the list, the attribute will be removed from the tag.
Attributes can be marked as required. If a required attribute is not present, KSES will remove all attributes from the tag. As KSES doesn’t match opening and closing tags, it’s not possible to safely remove the tag itself, the safest fallback is to strip all attributes from the tag, instead.
`$element` string Required HTML element/tag. `$attr` string Required HTML attributes from HTML element to closing HTML element tag. `$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 Sanitized HTML element.
File: `wp-includes/kses.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/kses.php/)
```
function wp_kses_attr( $element, $attr, $allowed_html, $allowed_protocols ) {
if ( ! is_array( $allowed_html ) ) {
$allowed_html = wp_kses_allowed_html( $allowed_html );
}
// Is there a closing XHTML slash at the end of the attributes?
$xhtml_slash = '';
if ( preg_match( '%\s*/\s*$%', $attr ) ) {
$xhtml_slash = ' /';
}
// Are any attributes allowed at all for this element?
$element_low = strtolower( $element );
if ( empty( $allowed_html[ $element_low ] ) || true === $allowed_html[ $element_low ] ) {
return "<$element$xhtml_slash>";
}
// Split it.
$attrarr = wp_kses_hair( $attr, $allowed_protocols );
// Check if there are attributes that are required.
$required_attrs = array_filter(
$allowed_html[ $element_low ],
function( $required_attr_limits ) {
return isset( $required_attr_limits['required'] ) && true === $required_attr_limits['required'];
}
);
/*
* If a required attribute check fails, we can return nothing for a self-closing tag,
* but for a non-self-closing tag the best option is to return the element with attributes,
* as KSES doesn't handle matching the relevant closing tag.
*/
$stripped_tag = '';
if ( empty( $xhtml_slash ) ) {
$stripped_tag = "<$element>";
}
// Go through $attrarr, and save the allowed attributes for this element in $attr2.
$attr2 = '';
foreach ( $attrarr as $arreach ) {
// Check if this attribute is required.
$required = isset( $required_attrs[ strtolower( $arreach['name'] ) ] );
if ( wp_kses_attr_check( $arreach['name'], $arreach['value'], $arreach['whole'], $arreach['vless'], $element, $allowed_html ) ) {
$attr2 .= ' ' . $arreach['whole'];
// If this was a required attribute, we can mark it as found.
if ( $required ) {
unset( $required_attrs[ strtolower( $arreach['name'] ) ] );
}
} elseif ( $required ) {
// This attribute was required, but didn't pass the check. The entire tag is not allowed.
return $stripped_tag;
}
}
// If some required attributes weren't set, the entire tag is not allowed.
if ( ! empty( $required_attrs ) ) {
return $stripped_tag;
}
// Remove any "<" or ">" characters.
$attr2 = preg_replace( '/[<>]/', '', $attr2 );
return "<$element$attr2$xhtml_slash>";
}
```
| Uses | Description |
| --- | --- |
| [wp\_kses\_attr\_check()](wp_kses_attr_check) wp-includes/kses.php | Determines whether an attribute is allowed. |
| [wp\_kses\_hair()](wp_kses_hair) wp-includes/kses.php | Builds an attribute list from string containing attributes. |
| [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. |
| Version | Description |
| --- | --- |
| [5.9.0](https://developer.wordpress.org/reference/since/5.9.0/) | Added support for an array of allowed values for attributes. Added support for required attributes. |
| [1.0.0](https://developer.wordpress.org/reference/since/1.0.0/) | Introduced. |
| programming_docs |
wordpress get_blog_option( int $id, string $option, mixed $default = false ): mixed get\_blog\_option( int $id, string $option, mixed $default = false ): mixed
===========================================================================
Retrieve option value for a given blog id based on name of option.
If the option does not exist or does not have a value, then the return value will be false. This is useful to check whether you need to install an option and is commonly used during installation of plugin options and to test whether upgrading is required.
If the option was serialized then it will be unserialized when it is returned.
`$id` int Required A blog ID. Can be null to refer to the current blog. `$option` string Required Name of option to retrieve. Expected to not be SQL-escaped. `$default` mixed Optional Default value to return if the option does not exist. Default: `false`
mixed Value set for the option.
There is a filter called ‘`blog_option_$option`‘ with the `$option` being replaced with the option name. The filter takes two parameters: `$value` and `$blog_id`. It returns `$value`. The ‘`option_$option`‘ filter in `get_option()` is not called.
File: `wp-includes/ms-blogs.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/ms-blogs.php/)
```
function get_blog_option( $id, $option, $default = false ) {
$id = (int) $id;
if ( empty( $id ) ) {
$id = get_current_blog_id();
}
if ( get_current_blog_id() == $id ) {
return get_option( $option, $default );
}
switch_to_blog( $id );
$value = get_option( $option, $default );
restore_current_blog();
/**
* Filters a blog option value.
*
* The dynamic portion of the hook name, `$option`, refers to the blog option name.
*
* @since 3.5.0
*
* @param string $value The option value.
* @param int $id Blog ID.
*/
return apply_filters( "blog_option_{$option}", $value, $id );
}
```
[apply\_filters( "blog\_option\_{$option}", string $value, int $id )](../hooks/blog_option_option)
Filters a blog option value.
| 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. |
| [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 |
| --- | --- |
| [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. |
| [WP\_Roles::get\_roles\_data()](../classes/wp_roles/get_roles_data) wp-includes/class-wp-roles.php | Gets the available roles data. |
| [get\_rest\_url()](get_rest_url) wp-includes/rest-api.php | Retrieves the URL to a REST endpoint on a site. |
| [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. |
| [install\_blog()](install_blog) wp-includes/ms-deprecated.php | Install an empty blog. |
| Version | Description |
| --- | --- |
| [MU (3.0.0)](https://developer.wordpress.org/reference/since/mu.3.0.0/) | Introduced. |
wordpress wp_kses( string $string, array[]|string $allowed_html, string[] $allowed_protocols = array() ): string wp\_kses( string $string, array[]|string $allowed\_html, string[] $allowed\_protocols = array() ): string
=========================================================================================================
Filters text content and strips out disallowed HTML.
This function makes sure that only the allowed HTML element names, attribute names, attribute values, and HTML entities will occur in the given text string.
This function expects unslashed data.
* [wp\_kses\_post()](wp_kses_post) : for specifically filtering post content and fields.
* [wp\_allowed\_protocols()](wp_allowed_protocols) : for the default allowed protocols in link URLs.
`$string` string Required Text 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[] Optional Array of allowed URL protocols.
Defaults to the result of [wp\_allowed\_protocols()](wp_allowed_protocols) . Default: `array()`
string Filtered content containing only the allowed HTML.
KSES is a recursive acronym which stands for “KSES Strips Evil Scripts”.
For parameter `$allowed_protocols`, the default allowed protocols are **http**, **https**, **ftp**, **mailto**, **news**, **irc**, **gopher**, **nntp**, **feed**, and **telnet**. This covers all common link protocols, except for **javascript**, which should not be allowed for untrusted users.
File: `wp-includes/kses.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/kses.php/)
```
function wp_kses( $string, $allowed_html, $allowed_protocols = array() ) {
if ( empty( $allowed_protocols ) ) {
$allowed_protocols = wp_allowed_protocols();
}
$string = wp_kses_no_null( $string, array( 'slash_zero' => 'keep' ) );
$string = wp_kses_normalize_entities( $string );
$string = wp_kses_hook( $string, $allowed_html, $allowed_protocols );
return wp_kses_split( $string, $allowed_html, $allowed_protocols );
}
```
| 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\_normalize\_entities()](wp_kses_normalize_entities) wp-includes/kses.php | Converts and fixes HTML entities. |
| [wp\_kses\_hook()](wp_kses_hook) wp-includes/kses.php | You add any KSES hooks here. |
| [wp\_kses\_split()](wp_kses_split) wp-includes/kses.php | Searches for HTML tags, no matter how malformed. |
| [wp\_allowed\_protocols()](wp_allowed_protocols) wp-includes/functions.php | Retrieves a list of protocols to allow in HTML attributes. |
| 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. |
| [Walker\_Comment::filter\_comment\_text()](../classes/walker_comment/filter_comment_text) wp-includes/class-walker-comment.php | Filters the comment text. |
| [filter\_block\_kses\_value()](filter_block_kses_value) wp-includes/blocks.php | Filters and sanitizes a parsed block attribute value to remove non-allowable HTML. |
| [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\_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\_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\_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\_filter\_oembed\_result()](wp_filter_oembed_result) wp-includes/embed.php | Filters the given oEmbed HTML. |
| [Automatic\_Upgrader\_Skin::feedback()](../classes/automatic_upgrader_skin/feedback) wp-admin/includes/class-automatic-upgrader-skin.php | Stores a message about the upgrade. |
| [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. |
| [install\_plugin\_information()](install_plugin_information) wp-admin/includes/plugin-install.php | Displays plugin information in dialog box form. |
| [\_get\_plugin\_data\_markup\_translate()](_get_plugin_data_markup_translate) wp-admin/includes/plugin.php | Sanitizes plugin data, optionally adds markup, optionally translates. |
| [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\_ajax\_query\_themes()](wp_ajax_query_themes) wp-admin/includes/ajax-actions.php | Ajax handler for getting themes from [themes\_api()](themes_api) . |
| [wp\_kses\_data()](wp_kses_data) wp-includes/kses.php | Sanitize content with allowed HTML KSES rules. |
| [wp\_filter\_post\_kses()](wp_filter_post_kses) wp-includes/kses.php | Sanitizes content for allowed HTML tags for post content. |
| [wp\_kses\_post()](wp_kses_post) wp-includes/kses.php | Sanitizes content for allowed HTML tags for post content. |
| [wp\_filter\_nohtml\_kses()](wp_filter_nohtml_kses) wp-includes/kses.php | Strips all HTML from a text string. |
| [wp\_filter\_kses()](wp_filter_kses) wp-includes/kses.php | Sanitize content with allowed HTML KSES rules. |
| [WP\_Theme::sanitize\_header()](../classes/wp_theme/sanitize_header) wp-includes/class-wp-theme.php | Sanitizes a theme header. |
| [img\_caption\_shortcode()](img_caption_shortcode) wp-includes/media.php | Builds the Caption shortcode output. |
| [wp\_sidebar\_description()](wp_sidebar_description) wp-includes/widgets.php | Retrieve description for a sidebar. |
| Version | Description |
| --- | --- |
| [1.0.0](https://developer.wordpress.org/reference/since/1.0.0/) | Introduced. |
wordpress username_exists( string $username ): int|false username\_exists( string $username ): int|false
===============================================
Determines whether the given username exists.
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.
`$username` string Required The username to check for existence. int|false The user ID on success, false on failure.
File: `wp-includes/user.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/user.php/)
```
function username_exists( $username ) {
$user = get_user_by( 'login', $username );
if ( $user ) {
$user_id = $user->ID;
} else {
$user_id = false;
}
/**
* Filters whether the given username exists.
*
* @since 4.9.0
*
* @param int|false $user_id The user ID associated with the username,
* or false if the username does not exist.
* @param string $username The username to check for existence.
*/
return apply_filters( 'username_exists', $user_id, $username );
}
```
[apply\_filters( 'username\_exists', int|false $user\_id, string $username )](../hooks/username_exists)
Filters whether the given username exists.
| Uses | Description |
| --- | --- |
| [get\_user\_by()](get_user_by) wp-includes/pluggable.php | Retrieves user info by a given field. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| Used By | Description |
| --- | --- |
| [wp\_install()](wp_install) wp-admin/includes/upgrade.php | Installs the site. |
| [edit\_user()](edit_user) wp-admin/includes/user.php | Edit user settings based on contents of $\_POST |
| [WP\_Importer::set\_user()](../classes/wp_importer/set_user) wp-admin/includes/class-wp-importer.php | |
| [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. |
| [wpmu\_activate\_signup()](wpmu_activate_signup) wp-includes/ms-functions.php | Activates a signup. |
| [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. |
| Version | Description |
| --- | --- |
| [2.0.0](https://developer.wordpress.org/reference/since/2.0.0/) | Introduced. |
wordpress _load_image_to_edit_path( int $attachment_id, string|int[] $size = 'full' ): string|false \_load\_image\_to\_edit\_path( int $attachment\_id, string|int[] $size = 'full' ): string|false
===============================================================================================
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 path or URL of an attachment’s attached file.
If the attached file is not present on the local filesystem (usually due to replication plugins), then the URL of the file is returned if `allow_url_fopen` is supported.
`$attachment_id` int Required 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 `'full'`. Default: `'full'`
string|false File path or URL on success, false on failure.
File: `wp-admin/includes/image.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/image.php/)
```
function _load_image_to_edit_path( $attachment_id, $size = 'full' ) {
$filepath = get_attached_file( $attachment_id );
if ( $filepath && file_exists( $filepath ) ) {
if ( 'full' !== $size ) {
$data = image_get_intermediate_size( $attachment_id, $size );
if ( $data ) {
$filepath = path_join( dirname( $filepath ), $data['file'] );
/**
* Filters the path to an attachment's file when editing the image.
*
* The filter is evaluated for all image sizes except 'full'.
*
* @since 3.1.0
*
* @param string $path Path to the current image.
* @param int $attachment_id Attachment ID.
* @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).
*/
$filepath = apply_filters( 'load_image_to_edit_filesystempath', $filepath, $attachment_id, $size );
}
}
} elseif ( function_exists( 'fopen' ) && ini_get( 'allow_url_fopen' ) ) {
/**
* Filters the path to an attachment's URL when editing the image.
*
* The filter is only evaluated if the file isn't stored locally and `allow_url_fopen` is enabled on the server.
*
* @since 3.1.0
*
* @param string|false $image_url Current image URL.
* @param int $attachment_id Attachment ID.
* @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).
*/
$filepath = apply_filters( 'load_image_to_edit_attachmenturl', wp_get_attachment_url( $attachment_id ), $attachment_id, $size );
}
/**
* Filters the returned path or URL of the current image.
*
* @since 2.9.0
*
* @param string|false $filepath File path or URL to current image, or false.
* @param int $attachment_id Attachment ID.
* @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).
*/
return apply_filters( 'load_image_to_edit_path', $filepath, $attachment_id, $size );
}
```
[apply\_filters( 'load\_image\_to\_edit\_attachmenturl', string|false $image\_url, int $attachment\_id, string|int[] $size )](../hooks/load_image_to_edit_attachmenturl)
Filters the path to an attachment’s URL when editing the image.
[apply\_filters( 'load\_image\_to\_edit\_filesystempath', string $path, int $attachment\_id, string|int[] $size )](../hooks/load_image_to_edit_filesystempath)
Filters the path to an attachment’s file when editing the image.
[apply\_filters( 'load\_image\_to\_edit\_path', string|false $filepath, int $attachment\_id, string|int[] $size )](../hooks/load_image_to_edit_path)
Filters the returned path or URL of the current image.
| Uses | Description |
| --- | --- |
| [path\_join()](path_join) wp-includes/functions.php | Joins two filesystem paths together. |
| [image\_get\_intermediate\_size()](image_get_intermediate_size) wp-includes/media.php | Retrieves the image’s intermediate size (resized) path, width, and height. |
| [wp\_get\_attachment\_url()](wp_get_attachment_url) wp-includes/post.php | Retrieves the URL for an attachment. |
| [get\_attached\_file()](get_attached_file) wp-includes/post.php | Retrieves attached file path based on 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 |
| --- | --- |
| [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. |
| [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']`. |
| [wp\_save\_image()](wp_save_image) wp-admin/includes/image-edit.php | Saves image to post, along with enqueued changes in `$_REQUEST['history']`. |
| [\_copy\_image\_file()](_copy_image_file) wp-admin/includes/image.php | Copies an existing image file. |
| [load\_image\_to\_edit()](load_image_to_edit) wp-admin/includes/image.php | Loads an image resource for editing. |
| [wp\_crop\_image()](wp_crop_image) wp-admin/includes/image.php | Crops an image to a given size. |
| Version | Description |
| --- | --- |
| [3.4.0](https://developer.wordpress.org/reference/since/3.4.0/) | Introduced. |
wordpress wp_validate_user_request_key( string $request_id, string $key ): true|WP_Error wp\_validate\_user\_request\_key( string $request\_id, string $key ): true|WP\_Error
====================================================================================
Validates a user request by comparing the key with the request’s key.
`$request_id` string Required ID of the request being confirmed. `$key` string Required Provided key to validate. true|[WP\_Error](../classes/wp_error) True 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_validate_user_request_key( $request_id, $key ) {
global $wp_hasher;
$request_id = absint( $request_id );
$request = wp_get_user_request( $request_id );
$saved_key = $request->confirm_key;
$key_request_time = $request->modified_timestamp;
if ( ! $request || ! $saved_key || ! $key_request_time ) {
return new WP_Error( 'invalid_request', __( 'Invalid personal data request.' ) );
}
if ( ! in_array( $request->status, array( 'request-pending', 'request-failed' ), true ) ) {
return new WP_Error( 'expired_request', __( 'This personal data request has expired.' ) );
}
if ( empty( $key ) ) {
return new WP_Error( 'missing_key', __( 'The confirmation key is missing from this personal data request.' ) );
}
if ( empty( $wp_hasher ) ) {
require_once ABSPATH . WPINC . '/class-phpass.php';
$wp_hasher = new PasswordHash( 8, true );
}
/**
* Filters the expiration time of confirm keys.
*
* @since 4.9.6
*
* @param int $expiration The expiration time in seconds.
*/
$expiration_duration = (int) apply_filters( 'user_request_key_expiration', DAY_IN_SECONDS );
$expiration_time = $key_request_time + $expiration_duration;
if ( ! $wp_hasher->CheckPassword( $key, $saved_key ) ) {
return new WP_Error( 'invalid_key', __( 'The confirmation key is invalid for this personal data request.' ) );
}
if ( ! $expiration_time || time() > $expiration_time ) {
return new WP_Error( 'expired_key', __( 'The confirmation key has expired for this personal data request.' ) );
}
return true;
}
```
[apply\_filters( 'user\_request\_key\_expiration', int $expiration )](../hooks/user_request_key_expiration)
Filters the expiration time of confirm keys.
| 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-includes/l10n.php | Retrieves the translation of $text. |
| [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. |
| [WP\_Error::\_\_construct()](../classes/wp_error/__construct) wp-includes/class-wp-error.php | Initializes the error. |
| Version | Description |
| --- | --- |
| [4.9.6](https://developer.wordpress.org/reference/since/4.9.6/) | Introduced. |
| programming_docs |
wordpress resume_theme( string $theme, string $redirect = '' ): bool|WP_Error resume\_theme( string $theme, string $redirect = '' ): bool|WP\_Error
=====================================================================
Tries to resume a single theme.
If a redirect was provided and a functions.php file was found, we first ensure that functions.php file does not throw fatal errors anymore.
The way it works is by setting the redirection to the error before trying to include the file. If the theme fails, then the redirection will not be overwritten with the success message and the theme will not be resumed.
`$theme` string Required Single theme to resume. `$redirect` string Optional URL to redirect to. Default: `''`
bool|[WP\_Error](../classes/wp_error) True on success, false if `$theme` was not paused, `WP_Error` on failure.
File: `wp-admin/includes/theme.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/theme.php/)
```
function resume_theme( $theme, $redirect = '' ) {
list( $extension ) = explode( '/', $theme );
/*
* We'll override this later if the theme could be resumed without
* creating a fatal error.
*/
if ( ! empty( $redirect ) ) {
$functions_path = '';
if ( strpos( STYLESHEETPATH, $extension ) ) {
$functions_path = STYLESHEETPATH . '/functions.php';
} elseif ( strpos( TEMPLATEPATH, $extension ) ) {
$functions_path = TEMPLATEPATH . '/functions.php';
}
if ( ! empty( $functions_path ) ) {
wp_redirect(
add_query_arg(
'_error_nonce',
wp_create_nonce( 'theme-resume-error_' . $theme ),
$redirect
)
);
// Load the theme's functions.php to test whether it throws a fatal error.
ob_start();
if ( ! defined( 'WP_SANDBOX_SCRAPING' ) ) {
define( 'WP_SANDBOX_SCRAPING', true );
}
include $functions_path;
ob_clean();
}
}
$result = wp_paused_themes()->delete( $extension );
if ( ! $result ) {
return new WP_Error(
'could_not_resume_theme',
__( 'Could not resume the theme.' )
);
}
return true;
}
```
| Uses | Description |
| --- | --- |
| [wp\_paused\_themes()](wp_paused_themes) wp-includes/error-protection.php | Get the instance for storing paused extensions. |
| [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\_redirect()](wp_redirect) wp-includes/pluggable.php | Redirects to another page. |
| [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. |
| [add\_query\_arg()](add_query_arg) wp-includes/functions.php | Retrieves a modified URL query string. |
| [WP\_Error::\_\_construct()](../classes/wp_error/__construct) wp-includes/class-wp-error.php | Initializes the error. |
| Version | Description |
| --- | --- |
| [5.2.0](https://developer.wordpress.org/reference/since/5.2.0/) | Introduced. |
wordpress page_template_dropdown( string $default_template = '', string $post_type = 'page' ) page\_template\_dropdown( string $default\_template = '', string $post\_type = 'page' )
=======================================================================================
Prints out option HTML elements for the page templates drop-down.
`$default_template` string Optional The template file name. Default: `''`
`$post_type` string Optional Post type to get templates for. Default `'post'`. Default: `'page'`
File: `wp-admin/includes/template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/template.php/)
```
function page_template_dropdown( $default_template = '', $post_type = 'page' ) {
$templates = get_page_templates( null, $post_type );
ksort( $templates );
foreach ( array_keys( $templates ) as $template ) {
$selected = selected( $default_template, $templates[ $template ], false );
echo "\n\t<option value='" . esc_attr( $templates[ $template ] ) . "' $selected>" . esc_html( $template ) . '</option>';
}
}
```
| Uses | Description |
| --- | --- |
| [get\_page\_templates()](get_page_templates) wp-admin/includes/theme.php | Gets the page templates available in this theme. |
| [selected()](selected) wp-includes/general-template.php | Outputs the HTML selected attribute. |
| [esc\_attr()](esc_attr) wp-includes/formatting.php | Escaping for HTML attributes. |
| [esc\_html()](esc_html) wp-includes/formatting.php | Escaping for HTML blocks. |
| 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 |
| Version | Description |
| --- | --- |
| [4.7.0](https://developer.wordpress.org/reference/since/4.7.0/) | Added the `$post_type` parameter. |
| [1.5.0](https://developer.wordpress.org/reference/since/1.5.0/) | Introduced. |
wordpress maybe_convert_table_to_utf8mb4( string $table ): bool maybe\_convert\_table\_to\_utf8mb4( string $table ): bool
=========================================================
If a table only contains utf8 or utf8mb4 columns, convert it to utf8mb4.
`$table` string Required The table to convert. bool True if the table was converted, false if it wasn't.
File: `wp-admin/includes/upgrade.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/upgrade.php/)
```
function maybe_convert_table_to_utf8mb4( $table ) {
global $wpdb;
$results = $wpdb->get_results( "SHOW FULL COLUMNS FROM `$table`" );
if ( ! $results ) {
return false;
}
foreach ( $results as $column ) {
if ( $column->Collation ) {
list( $charset ) = explode( '_', $column->Collation );
$charset = strtolower( $charset );
if ( 'utf8' !== $charset && 'utf8mb4' !== $charset ) {
// Don't upgrade tables that have non-utf8 columns.
return false;
}
}
}
$table_details = $wpdb->get_row( "SHOW TABLE STATUS LIKE '$table'" );
if ( ! $table_details ) {
return false;
}
list( $table_charset ) = explode( '_', $table_details->Collation );
$table_charset = strtolower( $table_charset );
if ( 'utf8mb4' === $table_charset ) {
return true;
}
return $wpdb->query( "ALTER TABLE $table CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci" );
}
```
| Uses | Description |
| --- | --- |
| [wpdb::query()](../classes/wpdb/query) wp-includes/class-wpdb.php | Performs a database query, using current database connection. |
| [wpdb::get\_row()](../classes/wpdb/get_row) wp-includes/class-wpdb.php | Retrieves one row from the database. |
| [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 |
| --- | --- |
| [pre\_schema\_upgrade()](pre_schema_upgrade) wp-admin/includes/upgrade.php | Runs before the schema is upgraded. |
| [upgrade\_network()](upgrade_network) wp-admin/includes/upgrade.php | Executes network-level upgrade routines. |
| Version | Description |
| --- | --- |
| [4.2.0](https://developer.wordpress.org/reference/since/4.2.0/) | Introduced. |
wordpress get_previous_posts_page_link(): string|void get\_previous\_posts\_page\_link(): string|void
===============================================
Retrieves the previous posts page link.
Will only return string, if not on a single page or post.
Backported to 2.0.10 from 2.1.3.
string|void The link for the previous posts page.
File: `wp-includes/link-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/link-template.php/)
```
function get_previous_posts_page_link() {
global $paged;
if ( ! is_single() ) {
$nextpage = (int) $paged - 1;
if ( $nextpage < 1 ) {
$nextpage = 1;
}
return get_pagenum_link( $nextpage );
}
}
```
| Uses | Description |
| --- | --- |
| [is\_single()](is_single) wp-includes/query.php | Determines whether the query is for an existing single post. |
| [get\_pagenum\_link()](get_pagenum_link) wp-includes/link-template.php | Retrieves the link for a page number. |
| Used By | Description |
| --- | --- |
| [previous\_posts()](previous_posts) wp-includes/link-template.php | Displays or retrieves the previous posts page link. |
| Version | Description |
| --- | --- |
| [2.0.10](https://developer.wordpress.org/reference/since/2.0.10/) | Introduced. |
wordpress do_shortcode_tag( array $m ): string|false do\_shortcode\_tag( array $m ): string|false
============================================
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 [get\_shortcode\_regex()](get_shortcode_regex) instead.
Regular Expression callable for [do\_shortcode()](do_shortcode) for calling shortcode hook.
* [get\_shortcode\_regex()](get_shortcode_regex) : for details of the match array contents.
`$m` array Required Regular expression match array. string|false Shortcode output on success, false on failure.
File: `wp-includes/shortcodes.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/shortcodes.php/)
```
function do_shortcode_tag( $m ) {
global $shortcode_tags;
// Allow [[foo]] syntax for escaping a tag.
if ( '[' === $m[1] && ']' === $m[6] ) {
return substr( $m[0], 1, -1 );
}
$tag = $m[2];
$attr = shortcode_parse_atts( $m[3] );
if ( ! is_callable( $shortcode_tags[ $tag ] ) ) {
_doing_it_wrong(
__FUNCTION__,
/* translators: %s: Shortcode tag. */
sprintf( __( 'Attempting to parse a shortcode without a valid callback: %s' ), $tag ),
'4.3.0'
);
return $m[0];
}
/**
* Filters whether to call a shortcode callback.
*
* Returning a non-false value from filter will short-circuit the
* shortcode generation process, returning that value instead.
*
* @since 4.7.0
*
* @param false|string $return Short-circuit return value. Either false or the value to replace the shortcode with.
* @param string $tag Shortcode name.
* @param array|string $attr Shortcode attributes array or empty string.
* @param array $m Regular expression match array.
*/
$return = apply_filters( 'pre_do_shortcode_tag', false, $tag, $attr, $m );
if ( false !== $return ) {
return $return;
}
$content = isset( $m[5] ) ? $m[5] : null;
$output = $m[1] . call_user_func( $shortcode_tags[ $tag ], $attr, $content, $tag ) . $m[6];
/**
* Filters the output created by a shortcode callback.
*
* @since 4.7.0
*
* @param string $output Shortcode output.
* @param string $tag Shortcode name.
* @param array|string $attr Shortcode attributes array or empty string.
* @param array $m Regular expression match array.
*/
return apply_filters( 'do_shortcode_tag', $output, $tag, $attr, $m );
}
```
[apply\_filters( 'do\_shortcode\_tag', string $output, string $tag, array|string $attr, array $m )](../hooks/do_shortcode_tag)
Filters the output created by a shortcode callback.
[apply\_filters( 'pre\_do\_shortcode\_tag', false|string $return, string $tag, array|string $attr, array $m )](../hooks/pre_do_shortcode_tag)
Filters whether to call a shortcode callback.
| Uses | Description |
| --- | --- |
| [shortcode\_parse\_atts()](shortcode_parse_atts) wp-includes/shortcodes.php | Retrieves all attributes from the shortcodes tag. |
| [\_\_()](__) 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. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| Used By | Description |
| --- | --- |
| [get\_post\_galleries()](get_post_galleries) wp-includes/media.php | Retrieves galleries from the passed post’s content. |
| Version | Description |
| --- | --- |
| [2.5.0](https://developer.wordpress.org/reference/since/2.5.0/) | Introduced. |
wordpress _jsonp_wp_die_handler( string $message, string $title = '', string|array $args = array() ) \_jsonp\_wp\_die\_handler( string $message, string $title = '', string|array $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.
Kills WordPress execution and displays JSONP response with an error message.
This is the handler for [wp\_die()](wp_die) when processing JSONP requests.
`$message` string Required Error message. `$title` string Optional Error title. Default: `''`
`$args` string|array Optional Arguments to control behavior. Default: `array()`
File: `wp-includes/functions.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/functions.php/)
```
function _jsonp_wp_die_handler( $message, $title = '', $args = array() ) {
list( $message, $title, $parsed_args ) = _wp_die_process_input( $message, $title, $args );
$data = array(
'code' => $parsed_args['code'],
'message' => $message,
'data' => array(
'status' => $parsed_args['response'],
),
'additional_errors' => $parsed_args['additional_errors'],
);
if ( ! headers_sent() ) {
header( "Content-Type: application/javascript; charset={$parsed_args['charset']}" );
header( 'X-Content-Type-Options: nosniff' );
header( 'X-Robots-Tag: noindex' );
if ( null !== $parsed_args['response'] ) {
status_header( $parsed_args['response'] );
}
nocache_headers();
}
$result = wp_json_encode( $data );
$jsonp_callback = $_GET['_jsonp'];
echo '/**/' . $jsonp_callback . '(' . $result . ')';
if ( $parsed_args['exit'] ) {
die();
}
}
```
| Uses | Description |
| --- | --- |
| [\_wp\_die\_process\_input()](_wp_die_process_input) wp-includes/functions.php | Processes arguments passed to [wp\_die()](wp_die) consistently for its handlers. |
| [status\_header()](status_header) wp-includes/functions.php | Sets HTTP status header. |
| [nocache\_headers()](nocache_headers) wp-includes/functions.php | Sets the headers to prevent caching for the different browsers. |
| [wp\_json\_encode()](wp_json_encode) wp-includes/functions.php | Encodes a variable into JSON, with some sanity checks. |
| Version | Description |
| --- | --- |
| [5.2.0](https://developer.wordpress.org/reference/since/5.2.0/) | Introduced. |
wordpress wp_required_field_indicator(): string wp\_required\_field\_indicator(): string
========================================
Assigns a visual indicator for required form fields.
string Indicator 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_indicator() {
/* translators: Character to identify required form fields. */
$glyph = __( '*' );
$indicator = '<span class="required">' . esc_html( $glyph ) . '</span>';
/**
* Filters the markup for a visual indicator of required form fields.
*
* @since 6.1.0
*
* @param string $indicator Markup for the indicator element.
*/
return apply_filters( 'wp_required_field_indicator', $indicator );
}
```
[apply\_filters( 'wp\_required\_field\_indicator', string $indicator )](../hooks/wp_required_field_indicator)
Filters the markup for a visual indicator of required form fields.
| Uses | Description |
| --- | --- |
| [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. |
| [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. |
| Used By | Description |
| --- | --- |
| [wp\_required\_field\_message()](wp_required_field_message) wp-includes/general-template.php | Creates a message to explain required form fields. |
| [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 wp_dropdown_categories( array|string $args = '' ): string wp\_dropdown\_categories( array|string $args = '' ): string
===========================================================
Displays or retrieves the HTML dropdown list of categories.
The ‘hierarchical’ argument, which is disabled by default, will override the depth argument, unless it is true. When the argument is false, it will display all of the categories. When it is enabled it will use the value in the ‘depth’ argument.
`$args` array|string Optional Array or string of arguments to generate a categories drop-down element. See [WP\_Term\_Query::\_\_construct()](../classes/wp_term_query/__construct) for information on additional accepted arguments.
* `show_option_all`stringText to display for showing all categories.
* `show_option_none`stringText to display for showing no categories.
* `option_none_value`stringValue to use when no category is selected.
* `orderby`stringWhich column to use for ordering categories. See [get\_terms()](get_terms) for a list of accepted values. Default `'id'` (term\_id).
* `pad_counts`boolSee [get\_terms()](get_terms) for an argument description. Default false.
* `show_count`bool|intWhether to include post counts. Accepts 0, 1, or their bool equivalents.
Default 0.
* `echo`bool|intWhether to echo or return the generated markup. Accepts 0, 1, or their bool equivalents. Default 1.
* `hierarchical`bool|intWhether to traverse the taxonomy hierarchy. Accepts 0, 1, or their bool equivalents. Default 0.
* `depth`intMaximum depth. Default 0.
* `tab_index`intTab index for the select element. Default 0 (no tabindex).
* `name`stringValue for the `'name'` attribute of the select element. Default `'cat'`.
* `id`stringValue for the `'id'` attribute of the select element. Defaults to the value of `$name`.
* `class`stringValue for the `'class'` attribute of the select element. Default `'postform'`.
* `selected`int|stringValue of the option that should be selected. Default 0.
* `value_field`stringTerm field that should be used to populate the `'value'` attribute of the option elements. Accepts any valid term field: `'term_id'`, `'name'`, `'slug'`, `'term_group'`, `'term_taxonomy_id'`, `'taxonomy'`, `'description'`, `'parent'`, `'count'`. Default `'term_id'`.
* `taxonomy`string|arrayName of the taxonomy or taxonomies to retrieve. Default `'category'`.
* `hide_if_empty`boolTrue to skip generating markup if no categories are found.
Default false (create select element even if no categories are found).
* `required`boolWhether the `<select>` element should have the HTML5 `'required'` attribute.
Default false.
* `walker`[Walker](../classes/walker)
[Walker](../classes/walker) object to use to build the output. Default empty which results in a [Walker\_CategoryDropdown](../classes/walker_categorydropdown) instance being used.
* `aria_describedby`stringThe `'id'` of an element that contains descriptive text for the select.
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: `''`
string HTML dropdown list of categories.
If you want to allow users to select multiple values, use [wp\_category\_checklist()](wp_category_checklist) .
The [wp\_dropdown\_cats](../hooks/wp_dropdown_cats "Plugin API/Filter Reference/wp dropdown cats (page does not exist)") filter is applied to the output string before it is echoed/returned.
File: `wp-includes/category-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/category-template.php/)
```
function wp_dropdown_categories( $args = '' ) {
$defaults = array(
'show_option_all' => '',
'show_option_none' => '',
'orderby' => 'id',
'order' => 'ASC',
'show_count' => 0,
'hide_empty' => 1,
'child_of' => 0,
'exclude' => '',
'echo' => 1,
'selected' => 0,
'hierarchical' => 0,
'name' => 'cat',
'id' => '',
'class' => 'postform',
'depth' => 0,
'tab_index' => 0,
'taxonomy' => 'category',
'hide_if_empty' => false,
'option_none_value' => -1,
'value_field' => 'term_id',
'required' => false,
'aria_describedby' => '',
);
$defaults['selected'] = ( is_category() ) ? get_query_var( 'cat' ) : 0;
// Back compat.
if ( isset( $args['type'] ) && 'link' === $args['type'] ) {
_deprecated_argument(
__FUNCTION__,
'3.0.0',
sprintf(
/* translators: 1: "type => link", 2: "taxonomy => link_category" */
__( '%1$s is deprecated. Use %2$s instead.' ),
'<code>type => link</code>',
'<code>taxonomy => link_category</code>'
)
);
$args['taxonomy'] = 'link_category';
}
// Parse incoming $args into an array and merge it with $defaults.
$parsed_args = wp_parse_args( $args, $defaults );
$option_none_value = $parsed_args['option_none_value'];
if ( ! isset( $parsed_args['pad_counts'] ) && $parsed_args['show_count'] && $parsed_args['hierarchical'] ) {
$parsed_args['pad_counts'] = true;
}
$tab_index = $parsed_args['tab_index'];
$tab_index_attribute = '';
if ( (int) $tab_index > 0 ) {
$tab_index_attribute = " tabindex=\"$tab_index\"";
}
// Avoid clashes with the 'name' param of get_terms().
$get_terms_args = $parsed_args;
unset( $get_terms_args['name'] );
$categories = get_terms( $get_terms_args );
$name = esc_attr( $parsed_args['name'] );
$class = esc_attr( $parsed_args['class'] );
$id = $parsed_args['id'] ? esc_attr( $parsed_args['id'] ) : $name;
$required = $parsed_args['required'] ? 'required' : '';
$aria_describedby_attribute = $parsed_args['aria_describedby'] ? ' aria-describedby="' . esc_attr( $parsed_args['aria_describedby'] ) . '"' : '';
if ( ! $parsed_args['hide_if_empty'] || ! empty( $categories ) ) {
$output = "<select $required name='$name' id='$id' class='$class'$tab_index_attribute$aria_describedby_attribute>\n";
} else {
$output = '';
}
if ( empty( $categories ) && ! $parsed_args['hide_if_empty'] && ! empty( $parsed_args['show_option_none'] ) ) {
/**
* Filters a taxonomy drop-down display element.
*
* A variety of taxonomy drop-down display elements can be modified
* just prior to display via this filter. Filterable arguments include
* 'show_option_none', 'show_option_all', and various forms of the
* term name.
*
* @since 1.2.0
*
* @see wp_dropdown_categories()
*
* @param string $element Category name.
* @param WP_Term|null $category The category object, or null if there's no corresponding category.
*/
$show_option_none = apply_filters( 'list_cats', $parsed_args['show_option_none'], null );
$output .= "\t<option value='" . esc_attr( $option_none_value ) . "' selected='selected'>$show_option_none</option>\n";
}
if ( ! empty( $categories ) ) {
if ( $parsed_args['show_option_all'] ) {
/** This filter is documented in wp-includes/category-template.php */
$show_option_all = apply_filters( 'list_cats', $parsed_args['show_option_all'], null );
$selected = ( '0' === (string) $parsed_args['selected'] ) ? " selected='selected'" : '';
$output .= "\t<option value='0'$selected>$show_option_all</option>\n";
}
if ( $parsed_args['show_option_none'] ) {
/** This filter is documented in wp-includes/category-template.php */
$show_option_none = apply_filters( 'list_cats', $parsed_args['show_option_none'], null );
$selected = selected( $option_none_value, $parsed_args['selected'], false );
$output .= "\t<option value='" . esc_attr( $option_none_value ) . "'$selected>$show_option_none</option>\n";
}
if ( $parsed_args['hierarchical'] ) {
$depth = $parsed_args['depth']; // Walk the full depth.
} else {
$depth = -1; // Flat.
}
$output .= walk_category_dropdown_tree( $categories, $depth, $parsed_args );
}
if ( ! $parsed_args['hide_if_empty'] || ! empty( $categories ) ) {
$output .= "</select>\n";
}
/**
* Filters the taxonomy drop-down output.
*
* @since 2.1.0
*
* @param string $output HTML output.
* @param array $parsed_args Arguments used to build the drop-down.
*/
$output = apply_filters( 'wp_dropdown_cats', $output, $parsed_args );
if ( $parsed_args['echo'] ) {
echo $output;
}
return $output;
}
```
[apply\_filters( 'list\_cats', string $element, WP\_Term|null $category )](../hooks/list_cats)
Filters a taxonomy drop-down display element.
[apply\_filters( 'wp\_dropdown\_cats', string $output, array $parsed\_args )](../hooks/wp_dropdown_cats)
Filters the taxonomy drop-down output.
| Uses | Description |
| --- | --- |
| [walk\_category\_dropdown\_tree()](walk_category_dropdown_tree) wp-includes/category-template.php | Retrieves HTML dropdown (select) content for category list. |
| [selected()](selected) wp-includes/general-template.php | Outputs the HTML selected attribute. |
| [is\_category()](is_category) wp-includes/query.php | Determines whether the query is for an existing category 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\_terms()](get_terms) wp-includes/taxonomy.php | Retrieves the terms in a given taxonomy or list of taxonomies. |
| [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. |
| [esc\_attr()](esc_attr) wp-includes/formatting.php | Escaping for HTML attributes. |
| [\_deprecated\_argument()](_deprecated_argument) wp-includes/functions.php | Marks a function argument 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. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| Used By | Description |
| --- | --- |
| [WP\_Posts\_List\_Table::categories\_dropdown()](../classes/wp_posts_list_table/categories_dropdown) wp-admin/includes/class-wp-posts-list-table.php | Displays a categories drop-down for filtering on the Posts list table. |
| [WP\_Links\_List\_Table::extra\_tablenav()](../classes/wp_links_list_table/extra_tablenav) wp-admin/includes/class-wp-links-list-table.php | |
| [\_wp\_ajax\_add\_hierarchical\_term()](_wp_ajax_add_hierarchical_term) wp-admin/includes/ajax-actions.php | Ajax handler for adding a hierarchical term. |
| [post\_categories\_meta\_box()](post_categories_meta_box) wp-admin/includes/meta-boxes.php | Displays post categories form fields. |
| [dropdown\_cats()](dropdown_cats) wp-includes/deprecated.php | Deprecated method for generating a drop-down of categories. |
| [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. |
| Version | Description |
| --- | --- |
| [6.1.0](https://developer.wordpress.org/reference/since/6.1.0/) | Introduced the `aria_describedby` argument. |
| [4.6.0](https://developer.wordpress.org/reference/since/4.6.0/) | Introduced the `required` argument. |
| [4.2.0](https://developer.wordpress.org/reference/since/4.2.0/) | Introduced the `value_field` argument. |
| [2.1.0](https://developer.wordpress.org/reference/since/2.1.0/) | Introduced. |
| programming_docs |
wordpress wp_schedule_event( int $timestamp, string $recurrence, string $hook, array $args = array(), bool $wp_error = false ): bool|WP_Error wp\_schedule\_event( int $timestamp, string $recurrence, string $hook, array $args = array(), bool $wp\_error = false ): bool|WP\_Error
=======================================================================================================================================
Schedules a recurring event.
Schedules a hook which will be triggered by WordPress at the specified interval.
The action will trigger when someone visits your WordPress site if the scheduled time has passed.
Valid values for the recurrence are ‘hourly’, ‘daily’, and ‘twicedaily’. These can be extended using the [‘cron\_schedules’](../hooks/cron_schedules) filter in [wp\_get\_schedules()](wp_get_schedules) .
Use [wp\_next\_scheduled()](wp_next_scheduled) to prevent duplicate events.
Use [wp\_schedule\_single\_event()](wp_schedule_single_event) to schedule a non-recurring event.
`$timestamp` int Required Unix timestamp (UTC) for when to next run the event. `$recurrence` string Required How often the event should subsequently recur.
See [wp\_get\_schedules()](wp_get_schedules) for accepted values. `$hook` string Required Action hook to execute when the event is run. `$args` array Optional Array containing arguments to pass to the hook's callback function. Each value in the array is passed to the callback as an individual parameter.
The array keys are ignored. 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 scheduled. False or [WP\_Error](../classes/wp_error) on failure.
File: `wp-includes/cron.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/cron.php/)
```
function wp_schedule_event( $timestamp, $recurrence, $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;
}
$schedules = wp_get_schedules();
if ( ! isset( $schedules[ $recurrence ] ) ) {
if ( $wp_error ) {
return new WP_Error(
'invalid_schedule',
__( 'Event schedule does not exist.' )
);
}
return false;
}
$event = (object) array(
'hook' => $hook,
'timestamp' => $timestamp,
'schedule' => $recurrence,
'args' => $args,
'interval' => $schedules[ $recurrence ]['interval'],
);
/** This filter is documented in wp-includes/cron.php */
$pre = apply_filters( 'pre_schedule_event', null, $event, $wp_error );
if ( null !== $pre ) {
if ( $wp_error && false === $pre ) {
return new WP_Error(
'pre_schedule_event_false',
__( 'A plugin prevented the event from being scheduled.' )
);
}
if ( ! $wp_error && is_wp_error( $pre ) ) {
return false;
}
return $pre;
}
/** This filter is documented in wp-includes/cron.php */
$event = apply_filters( 'schedule_event', $event );
// A plugin disallowed this event.
if ( ! $event ) {
if ( $wp_error ) {
return new WP_Error(
'schedule_event_false',
__( 'A plugin disallowed this event.' )
);
}
return false;
}
$key = md5( serialize( $event->args ) );
$crons = _get_cron_array();
$crons[ $event->timestamp ][ $event->hook ][ $key ] = array(
'schedule' => $event->schedule,
'args' => $event->args,
'interval' => $event->interval,
);
uksort( $crons, 'strnatcasecmp' );
return _set_cron_array( $crons, $wp_error );
}
```
[apply\_filters( 'pre\_schedule\_event', null|bool|WP\_Error $pre, stdClass $event, bool $wp\_error )](../hooks/pre_schedule_event)
Filter to preflight or hijack scheduling an event.
[apply\_filters( 'schedule\_event', stdClass|false $event )](../hooks/schedule_event)
Modify an event before it is scheduled.
| Uses | Description |
| --- | --- |
| [wp\_get\_schedules()](wp_get_schedules) wp-includes/cron.php | Retrieve supported event recurrence schedules. |
| [\_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\_schedule\_update\_user\_counts()](wp_schedule_update_user_counts) wp-includes/user.php | Schedules a recurring recalculation of the total count of users. |
| [wp\_schedule\_https\_detection()](wp_schedule_https_detection) wp-includes/https-detection.php | Schedules the Cron hook for detecting HTTPS support. |
| [WP\_Site\_Health::maybe\_create\_scheduled\_event()](../classes/wp_site_health/maybe_create_scheduled_event) wp-admin/includes/class-wp-site-health.php | Creates a weekly cron event, if one does not already exist. |
| [WP\_Recovery\_Mode::initialize()](../classes/wp_recovery_mode/initialize) wp-includes/class-wp-recovery-mode.php | Initialize recovery mode for the current request. |
| [wp\_schedule\_delete\_old\_privacy\_export\_files()](wp_schedule_delete_old_privacy_export_files) wp-includes/functions.php | Schedules a `WP_Cron` job to delete expired export files. |
| [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\_reschedule\_event()](wp_reschedule_event) wp-includes/cron.php | Reschedules a recurring event. |
| [wp\_schedule\_update\_checks()](wp_schedule_update_checks) wp-includes/update.php | Schedules core, theme, and plugin update checks. |
| [wp\_schedule\_update\_network\_counts()](wp_schedule_update_network_counts) wp-includes/ms-functions.php | Schedules update of the network-wide counts for the current network. |
| 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\_schedule\_event'](../hooks/pre_schedule_event) filter added to short-circuit the function. |
| [2.1.0](https://developer.wordpress.org/reference/since/2.1.0/) | Introduced. |
wordpress the_post_thumbnail_caption( int|WP_Post $post = null ) the\_post\_thumbnail\_caption( int|WP\_Post $post = null )
==========================================================
Displays 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`
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_caption( $post = null ) {
/**
* Filters the displayed post thumbnail caption.
*
* @since 4.6.0
*
* @param string $caption Caption for the given attachment.
*/
echo apply_filters( 'the_post_thumbnail_caption', get_the_post_thumbnail_caption( $post ) );
}
```
[apply\_filters( 'the\_post\_thumbnail\_caption', string $caption )](../hooks/the_post_thumbnail_caption)
Filters the displayed post thumbnail caption.
| Uses | Description |
| --- | --- |
| [get\_the\_post\_thumbnail\_caption()](get_the_post_thumbnail_caption) wp-includes/post-thumbnail-template.php | Returns the post thumbnail caption. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| Version | Description |
| --- | --- |
| [4.6.0](https://developer.wordpress.org/reference/since/4.6.0/) | Introduced. |
wordpress wp_is_numeric_array( mixed $data ): bool wp\_is\_numeric\_array( mixed $data ): bool
===========================================
Determines if the variable is a numeric-indexed array.
`$data` mixed Required Variable to check. bool Whether the variable is a list.
File: `wp-includes/functions.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/functions.php/)
```
function wp_is_numeric_array( $data ) {
if ( ! is_array( $data ) ) {
return false;
}
$keys = array_keys( $data );
$string_keys = array_filter( $keys, 'is_string' );
return count( $string_keys ) === 0;
}
```
| Used By | Description |
| --- | --- |
| [get\_metadata\_default()](get_metadata_default) wp-includes/meta.php | Retrieves default metadata value for the specified meta key and object. |
| [rest\_is\_array()](rest_is_array) wp-includes/rest-api.php | Determines if a given value is array-like. |
| [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. |
| [WP\_REST\_Server::response\_to\_data()](../classes/wp_rest_server/response_to_data) wp-includes/rest-api/class-wp-rest-server.php | Converts a response to data to send. |
| [wp\_count\_terms()](wp_count_terms) wp-includes/taxonomy.php | Counts how many terms are in taxonomy. |
| Version | Description |
| --- | --- |
| [4.4.0](https://developer.wordpress.org/reference/since/4.4.0/) | Introduced. |
wordpress post_author_meta_box( WP_Post $post ) post\_author\_meta\_box( WP\_Post $post )
=========================================
Displays form field with list of authors.
`$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 post_author_meta_box( $post ) {
global $user_ID;
$post_type_object = get_post_type_object( $post->post_type );
?>
<label class="screen-reader-text" for="post_author_override"><?php _e( 'Author' ); ?></label>
<?php
wp_dropdown_users(
array(
'capability' => array( $post_type_object->cap->edit_posts ),
'name' => 'post_author_override',
'selected' => empty( $post->ID ) ? $user_ID : $post->post_author,
'include_selected' => true,
'show' => 'display_name_with_login',
)
);
}
```
| Uses | Description |
| --- | --- |
| [wp\_dropdown\_users()](wp_dropdown_users) wp-includes/user.php | Creates dropdown HTML content of users. |
| [\_e()](_e) wp-includes/l10n.php | Displays translated text. |
| [get\_post\_type\_object()](get_post_type_object) wp-includes/post.php | Retrieves a post type object by name. |
| Version | Description |
| --- | --- |
| [2.6.0](https://developer.wordpress.org/reference/since/2.6.0/) | Introduced. |
wordpress post_type_archive_title( string $prefix = '', bool $display = true ): string|void post\_type\_archive\_title( string $prefix = '', bool $display = true ): string|void
====================================================================================
Displays or retrieves title for a post type archive.
This is optimized for archive.php and archive-{$post\_type}.php template files for displaying the title of the post type.
`$prefix` string Optional What to display before the title. Default: `''`
`$display` bool Optional Whether to display or retrieve title. Default: `true`
string|void Title when retrieving, null when displaying or failure.
File: `wp-includes/general-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/general-template.php/)
```
function post_type_archive_title( $prefix = '', $display = true ) {
if ( ! is_post_type_archive() ) {
return;
}
$post_type = get_query_var( 'post_type' );
if ( is_array( $post_type ) ) {
$post_type = reset( $post_type );
}
$post_type_obj = get_post_type_object( $post_type );
/**
* Filters the post type archive title.
*
* @since 3.1.0
*
* @param string $post_type_name Post type 'name' label.
* @param string $post_type Post type.
*/
$title = apply_filters( 'post_type_archive_title', $post_type_obj->labels->name, $post_type );
if ( $display ) {
echo $prefix . $title;
} else {
return $prefix . $title;
}
}
```
[apply\_filters( 'post\_type\_archive\_title', string $post\_type\_name, string $post\_type )](../hooks/post_type_archive_title)
Filters the post type archive title.
| Uses | Description |
| --- | --- |
| [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\_query\_var()](get_query_var) wp-includes/query.php | Retrieves the value of a query variable in the [WP\_Query](../classes/wp_query) class. |
| [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 |
| --- | --- |
| [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. |
| [wp\_title()](wp_title) wp-includes/general-template.php | Displays or retrieves page title for all areas of blog. |
| Version | Description |
| --- | --- |
| [3.1.0](https://developer.wordpress.org/reference/since/3.1.0/) | Introduced. |
wordpress post_password_required( int|WP_Post|null $post = null ): bool post\_password\_required( int|WP\_Post|null $post = null ): bool
================================================================
Determines whether the post requires password and whether a correct password has been provided.
`$post` int|[WP\_Post](../classes/wp_post)|null Optional An optional post. Global $post used if not provided. Default: `null`
bool false if a password is not required or the correct password cookie is present, true otherwise.
File: `wp-includes/post-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/post-template.php/)
```
function post_password_required( $post = null ) {
$post = get_post( $post );
if ( empty( $post->post_password ) ) {
/** This filter is documented in wp-includes/post-template.php */
return apply_filters( 'post_password_required', false, $post );
}
if ( ! isset( $_COOKIE[ 'wp-postpass_' . COOKIEHASH ] ) ) {
/** This filter is documented in wp-includes/post-template.php */
return apply_filters( 'post_password_required', true, $post );
}
require_once ABSPATH . WPINC . '/class-phpass.php';
$hasher = new PasswordHash( 8, true );
$hash = wp_unslash( $_COOKIE[ 'wp-postpass_' . COOKIEHASH ] );
if ( 0 !== strpos( $hash, '$P$B' ) ) {
$required = true;
} else {
$required = ! $hasher->CheckPassword( $post->post_password, $hash );
}
/**
* Filters whether a post requires the user to supply a password.
*
* @since 4.7.0
*
* @param bool $required Whether the user needs to supply a password. True if password has not been
* provided or is incorrect, false if password has been supplied or is not required.
* @param WP_Post $post Post object.
*/
return apply_filters( 'post_password_required', $required, $post );
}
```
[apply\_filters( 'post\_password\_required', bool $required, WP\_Post $post )](../hooks/post_password_required)
Filters whether a post requires the user to supply a password.
| Uses | Description |
| --- | --- |
| [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\_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. |
| [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\_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\_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\_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. |
| [rss\_enclosure()](rss_enclosure) wp-includes/feed.php | Displays the rss enclosure for the current post. |
| [atom\_enclosure()](atom_enclosure) wp-includes/feed.php | Displays the atom enclosure for the current post. |
| [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\_post\_class()](get_post_class) wp-includes/post-template.php | Retrieves an array of the class names for the post container element. |
| [wp\_xmlrpc\_server::wp\_newComment()](../classes/wp_xmlrpc_server/wp_newcomment) wp-includes/class-wp-xmlrpc-server.php | Create new comment. |
| [comments\_popup\_link()](comments_popup_link) wp-includes/comment-template.php | Displays the link to the comments for the current post ID. |
| [get\_comment\_excerpt()](get_comment_excerpt) wp-includes/comment-template.php | Retrieves the excerpt of the given comment. |
| Version | Description |
| --- | --- |
| [2.7.0](https://developer.wordpress.org/reference/since/2.7.0/) | Introduced. |
wordpress _set_preview( WP_Post $post ): WP_Post|false \_set\_preview( WP\_Post $post ): WP\_Post|false
================================================
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.
Sets up the post object for preview based on the post autosave.
`$post` [WP\_Post](../classes/wp_post) Required [WP\_Post](../classes/wp_post)|false
File: `wp-includes/revision.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/revision.php/)
```
function _set_preview( $post ) {
if ( ! is_object( $post ) ) {
return $post;
}
$preview = wp_get_post_autosave( $post->ID );
if ( is_object( $preview ) ) {
$preview = sanitize_post( $preview );
$post->post_content = $preview->post_content;
$post->post_title = $preview->post_title;
$post->post_excerpt = $preview->post_excerpt;
}
add_filter( 'get_the_terms', '_wp_preview_terms_filter', 10, 3 );
add_filter( 'get_post_metadata', '_wp_preview_post_thumbnail_filter', 10, 3 );
return $post;
}
```
| Uses | Description |
| --- | --- |
| [wp\_get\_post\_autosave()](wp_get_post_autosave) wp-includes/revision.php | Retrieves the autosaved data of the specified post. |
| [sanitize\_post()](sanitize_post) wp-includes/post.php | Sanitizes every post field. |
| [add\_filter()](add_filter) wp-includes/plugin.php | Adds a callback function to a filter hook. |
| Version | Description |
| --- | --- |
| [2.7.0](https://developer.wordpress.org/reference/since/2.7.0/) | Introduced. |
| programming_docs |
wordpress block_footer_area() block\_footer\_area()
=====================
Prints the footer block template part.
File: `wp-includes/block-template-utils.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/block-template-utils.php/)
```
function block_footer_area() {
block_template_part( 'footer' );
}
```
| Uses | Description |
| --- | --- |
| [block\_template\_part()](block_template_part) wp-includes/block-template-utils.php | Prints a block template part. |
| Version | Description |
| --- | --- |
| [5.9.0](https://developer.wordpress.org/reference/since/5.9.0/) | Introduced. |
wordpress wpmu_admin_redirect_add_updated_param( string $url = '' ): string wpmu\_admin\_redirect\_add\_updated\_param( string $url = '' ): string
======================================================================
This function has been deprecated. Use [add\_query\_arg()](add_query_arg) instead.
Adds an ‘updated=true’ argument to a URL.
* [add\_query\_arg()](add_query_arg)
`$url` string Optional Redirect URL. Default: `''`
string
File: `wp-includes/ms-deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/ms-deprecated.php/)
```
function wpmu_admin_redirect_add_updated_param( $url = '' ) {
_deprecated_function( __FUNCTION__, '3.3.0', 'add_query_arg()' );
if ( strpos( $url, 'updated=true' ) === false ) {
if ( strpos( $url, '?' ) === false )
return $url . '?updated=true';
else
return $url . '&updated=true';
}
return $url;
}
```
| 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 |
| --- | --- |
| [wpmu\_admin\_do\_redirect()](wpmu_admin_do_redirect) wp-includes/ms-deprecated.php | Redirect a user based on $\_GET or $\_POST arguments. |
| Version | Description |
| --- | --- |
| [3.3.0](https://developer.wordpress.org/reference/since/3.3.0/) | Use [add\_query\_arg()](add_query_arg) |
| [MU (3.0.0)](https://developer.wordpress.org/reference/since/mu.3.0.0/) | Introduced. |
wordpress rest_handle_doing_it_wrong( string $function, string $message, string|null $version ) rest\_handle\_doing\_it\_wrong( string $function, string $message, string|null $version )
=========================================================================================
Handles \_doing\_it\_wrong errors.
`$function` string Required The function that was called. `$message` string Required A message explaining what has been done incorrectly. `$version` string|null Required The version of WordPress where the message was added. File: `wp-includes/rest-api.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/rest-api.php/)
```
function rest_handle_doing_it_wrong( $function, $message, $version ) {
if ( ! WP_DEBUG || headers_sent() ) {
return;
}
if ( $version ) {
/* translators: Developer debugging message. 1: PHP function name, 2: WordPress version number, 3: Explanatory message. */
$string = __( '%1$s (since %2$s; %3$s)' );
$string = sprintf( $string, $function, $version, $message );
} else {
/* translators: Developer debugging message. 1: PHP function name, 2: Explanatory message. */
$string = __( '%1$s (%2$s)' );
$string = sprintf( $string, $function, $message );
}
header( sprintf( 'X-WP-DoingItWrong: %s', $string ) );
}
```
| Uses | Description |
| --- | --- |
| [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. |
| Version | Description |
| --- | --- |
| [5.5.0](https://developer.wordpress.org/reference/since/5.5.0/) | Introduced. |
wordpress get_default_block_categories(): array[] get\_default\_block\_categories(): array[]
==========================================
Returns the list of default categories for block types.
array[] Array of categories for block types.
File: `wp-includes/block-editor.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/block-editor.php/)
```
function get_default_block_categories() {
return array(
array(
'slug' => 'text',
'title' => _x( 'Text', 'block category' ),
'icon' => null,
),
array(
'slug' => 'media',
'title' => _x( 'Media', 'block category' ),
'icon' => null,
),
array(
'slug' => 'design',
'title' => _x( 'Design', 'block category' ),
'icon' => null,
),
array(
'slug' => 'widgets',
'title' => _x( 'Widgets', 'block category' ),
'icon' => null,
),
array(
'slug' => 'theme',
'title' => _x( 'Theme', 'block category' ),
'icon' => null,
),
array(
'slug' => 'embed',
'title' => _x( 'Embeds', 'block category' ),
'icon' => null,
),
array(
'slug' => 'reusable',
'title' => _x( 'Reusable Blocks', 'block category' ),
'icon' => null,
),
);
}
```
| Uses | Description |
| --- | --- |
| [\_x()](_x) wp-includes/l10n.php | Retrieves translated string with gettext context. |
| Used By | Description |
| --- | --- |
| [get\_default\_block\_editor\_settings()](get_default_block_editor_settings) wp-includes/block-editor.php | Returns the default block editor settings. |
| [get\_block\_categories()](get_block_categories) wp-includes/block-editor.php | Returns all the categories for block types that will be shown in the block editor. |
| Version | Description |
| --- | --- |
| [5.8.0](https://developer.wordpress.org/reference/since/5.8.0/) | Introduced. |
wordpress get_search_comments_feed_link( string $search_query = '', string $feed = '' ): string get\_search\_comments\_feed\_link( string $search\_query = '', string $feed = '' ): string
==========================================================================================
Retrieves the permalink for the search results comments feed.
`$search_query` string Optional Search query. Default: `''`
`$feed` string Optional Feed type. Possible values include `'rss2'`, `'atom'`.
Default is the value of [get\_default\_feed()](get_default_feed) . Default: `''`
string The comments feed search results permalink.
File: `wp-includes/link-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/link-template.php/)
```
function get_search_comments_feed_link( $search_query = '', $feed = '' ) {
global $wp_rewrite;
if ( empty( $feed ) ) {
$feed = get_default_feed();
}
$link = get_search_feed_link( $search_query, $feed );
$permastruct = $wp_rewrite->get_search_permastruct();
if ( empty( $permastruct ) ) {
$link = add_query_arg( 'feed', 'comments-' . $feed, $link );
} else {
$link = add_query_arg( 'withcomments', 1, $link );
}
/** This filter is documented in wp-includes/link-template.php */
return apply_filters( 'search_feed_link', $link, $feed, 'comments' );
}
```
[apply\_filters( 'search\_feed\_link', string $link, string $feed, string $type )](../hooks/search_feed_link)
Filters the search feed link.
| Uses | Description |
| --- | --- |
| [get\_search\_feed\_link()](get_search_feed_link) wp-includes/link-template.php | Retrieves the permalink for the search results feed. |
| [get\_default\_feed()](get_default_feed) wp-includes/feed.php | Retrieves the default feed. |
| [WP\_Rewrite::get\_search\_permastruct()](../classes/wp_rewrite/get_search_permastruct) wp-includes/class-wp-rewrite.php | Retrieves the search permalink structure. |
| [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. |
| Version | Description |
| --- | --- |
| [2.5.0](https://developer.wordpress.org/reference/since/2.5.0/) | Introduced. |
wordpress print_embed_styles() print\_embed\_styles()
======================
Prints the CSS in the embed iframe header.
File: `wp-includes/embed.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/embed.php/)
```
function print_embed_styles() {
$type_attr = current_theme_supports( 'html5', 'style' ) ? '' : ' type="text/css"';
$suffix = SCRIPT_DEBUG ? '' : '.min';
?>
<style<?php echo $type_attr; ?>>
<?php echo file_get_contents( ABSPATH . WPINC . "/css/wp-embed-template$suffix.css" ); ?>
</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.4.0](https://developer.wordpress.org/reference/since/4.4.0/) | Introduced. |
wordpress comment_author_IP( int|WP_Comment $comment_ID ) comment\_author\_IP( int|WP\_Comment $comment\_ID )
===================================================
Displays the IP address 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 print the author's IP address.
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_IP( $comment_ID = 0 ) { // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.FunctionNameInvalid
echo esc_html( get_comment_author_IP( $comment_ID ) );
}
```
| Uses | Description |
| --- | --- |
| [get\_comment\_author\_IP()](get_comment_author_ip) wp-includes/comment-template.php | Retrieves the IP address of the author of the current comment. |
| [esc\_html()](esc_html) wp-includes/formatting.php | Escaping for HTML blocks. |
| 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 wp_strict_cross_origin_referrer() wp\_strict\_cross\_origin\_referrer()
=====================================
Displays a referrer `strict-origin-when-cross-origin` meta tag.
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_strict_cross_origin_referrer' );
```
File: `wp-includes/general-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/general-template.php/)
```
function wp_strict_cross_origin_referrer() {
?>
<meta name='referrer' content='strict-origin-when-cross-origin' />
<?php
}
```
| Used By | Description |
| --- | --- |
| [wp\_sensitive\_page\_meta()](wp_sensitive_page_meta) wp-includes/deprecated.php | Display a `noindex,noarchive` meta tag and referrer `strict-origin-when-cross-origin` meta tag. |
| Version | Description |
| --- | --- |
| [5.7.0](https://developer.wordpress.org/reference/since/5.7.0/) | Introduced. |
wordpress calendar_week_mod( int $num ): float calendar\_week\_mod( int $num ): float
======================================
Gets number of days since the start of the week.
`$num` int Required Number of day. float Days since the start of the week.
File: `wp-includes/general-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/general-template.php/)
```
function calendar_week_mod( $num ) {
$base = 7;
return ( $num - $base * floor( $num / $base ) );
}
```
| Used By | Description |
| --- | --- |
| [get\_calendar()](get_calendar) wp-includes/general-template.php | Displays calendar with days that have posts as links. |
| Version | Description |
| --- | --- |
| [1.5.0](https://developer.wordpress.org/reference/since/1.5.0/) | Introduced. |
wordpress get_object_subtype( string $object_type, int $object_id ): string get\_object\_subtype( string $object\_type, int $object\_id ): string
=====================================================================
Returns the object subtype for a given object ID of a specific type.
`$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. `$object_id` int Required ID of the object to retrieve its subtype. string The object subtype or an empty string if unspecified subtype.
File: `wp-includes/meta.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/meta.php/)
```
function get_object_subtype( $object_type, $object_id ) {
$object_id = (int) $object_id;
$object_subtype = '';
switch ( $object_type ) {
case 'post':
$post_type = get_post_type( $object_id );
if ( ! empty( $post_type ) ) {
$object_subtype = $post_type;
}
break;
case 'term':
$term = get_term( $object_id );
if ( ! $term instanceof WP_Term ) {
break;
}
$object_subtype = $term->taxonomy;
break;
case 'comment':
$comment = get_comment( $object_id );
if ( ! $comment ) {
break;
}
$object_subtype = 'comment';
break;
case 'user':
$user = get_user_by( 'id', $object_id );
if ( ! $user ) {
break;
}
$object_subtype = 'user';
break;
}
/**
* Filters the object subtype identifier for a non-standard object type.
*
* The dynamic portion of the hook name, `$object_type`, refers to the meta object type
* (post, comment, term, user, or any other type with an associated meta table).
*
* Possible hook names include:
*
* - `get_object_subtype_post`
* - `get_object_subtype_comment`
* - `get_object_subtype_term`
* - `get_object_subtype_user`
*
* @since 4.9.8
*
* @param string $object_subtype Empty string to override.
* @param int $object_id ID of the object to get the subtype for.
*/
return apply_filters( "get_object_subtype_{$object_type}", $object_subtype, $object_id );
}
```
[apply\_filters( "get\_object\_subtype\_{$object\_type}", string $object\_subtype, int $object\_id )](../hooks/get_object_subtype_object_type)
Filters the object subtype identifier for a non-standard object type.
| Uses | Description |
| --- | --- |
| [get\_user\_by()](get_user_by) wp-includes/pluggable.php | Retrieves user info by a given field. |
| [get\_post\_type()](get_post_type) wp-includes/post.php | Retrieves the post type of the current post or of a given 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. |
| [get\_comment()](get_comment) wp-includes/comment.php | Retrieves comment data given a comment ID or comment object. |
| Used By | Description |
| --- | --- |
| [filter\_default\_metadata()](filter_default_metadata) wp-includes/meta.php | Filters into default\_{$object\_type}\_metadata and adds in default value. |
| [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. |
| [get\_registered\_metadata()](get_registered_metadata) wp-includes/meta.php | Retrieves registered metadata for a specified 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. |
| [update\_metadata\_by\_mid()](update_metadata_by_mid) wp-includes/meta.php | Updates 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 |
| --- | --- |
| [4.9.8](https://developer.wordpress.org/reference/since/4.9.8/) | Introduced. |
wordpress wp_image_add_srcset_and_sizes( string $image, array $image_meta, int $attachment_id ): string wp\_image\_add\_srcset\_and\_sizes( string $image, array $image\_meta, int $attachment\_id ): string
====================================================================================================
Adds ‘srcset’ and ‘sizes’ attributes to an existing ‘img’ element.
* [wp\_calculate\_image\_srcset()](wp_calculate_image_srcset)
* [wp\_calculate\_image\_sizes()](wp_calculate_image_sizes)
`$image` string Required An HTML `'img'` element to be filtered. `$image_meta` array Required The image meta data as returned by '[wp\_get\_attachment\_metadata()](wp_get_attachment_metadata) '. `$attachment_id` int Required Image attachment ID. string Converted `'img'` element with `'srcset'` and `'sizes'` attributes added.
File: `wp-includes/media.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/media.php/)
```
function wp_image_add_srcset_and_sizes( $image, $image_meta, $attachment_id ) {
// Ensure the image meta exists.
if ( empty( $image_meta['sizes'] ) ) {
return $image;
}
$image_src = preg_match( '/src="([^"]+)"/', $image, $match_src ) ? $match_src[1] : '';
list( $image_src ) = explode( '?', $image_src );
// Return early if we couldn't get the image source.
if ( ! $image_src ) {
return $image;
}
// Bail early if an image has been inserted and later edited.
if ( preg_match( '/-e[0-9]{13}/', $image_meta['file'], $img_edit_hash ) &&
strpos( wp_basename( $image_src ), $img_edit_hash[0] ) === false ) {
return $image;
}
$width = preg_match( '/ width="([0-9]+)"/', $image, $match_width ) ? (int) $match_width[1] : 0;
$height = preg_match( '/ height="([0-9]+)"/', $image, $match_height ) ? (int) $match_height[1] : 0;
if ( $width && $height ) {
$size_array = array( $width, $height );
} else {
$size_array = wp_image_src_get_dimensions( $image_src, $image_meta, $attachment_id );
if ( ! $size_array ) {
return $image;
}
}
$srcset = wp_calculate_image_srcset( $size_array, $image_src, $image_meta, $attachment_id );
if ( $srcset ) {
// Check if there is already a 'sizes' attribute.
$sizes = strpos( $image, ' sizes=' );
if ( ! $sizes ) {
$sizes = wp_calculate_image_sizes( $size_array, $image_src, $image_meta, $attachment_id );
}
}
if ( $srcset && $sizes ) {
// Format the 'srcset' and 'sizes' string and escape attributes.
$attr = sprintf( ' srcset="%s"', esc_attr( $srcset ) );
if ( is_string( $sizes ) ) {
$attr .= sprintf( ' sizes="%s"', esc_attr( $sizes ) );
}
// Add the srcset and sizes attributes to the image markup.
return preg_replace( '/<img ([^>]+?)[\/ ]*>/', '<img $1' . $attr . ' />', $image );
}
return $image;
}
```
| Uses | Description |
| --- | --- |
| [wp\_image\_src\_get\_dimensions()](wp_image_src_get_dimensions) wp-includes/media.php | Determines an image’s width and height dimensions based on the 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\_calculate\_image\_sizes()](wp_calculate_image_sizes) wp-includes/media.php | Creates a ‘sizes’ attribute value for an image. |
| [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. |
| Used By | Description |
| --- | --- |
| [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. |
| Version | Description |
| --- | --- |
| [4.4.0](https://developer.wordpress.org/reference/since/4.4.0/) | Introduced. |
| programming_docs |
wordpress wp_skip_dimensions_serialization( WP_Block_type $block_type ): bool wp\_skip\_dimensions\_serialization( WP\_Block\_type $block\_type ): bool
=========================================================================
This function has been deprecated. Use [wp\_should\_skip\_block\_supports\_serialization()](wp_should_skip_block_supports_serialization) 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 [wp\_should\_skip\_block\_supports\_serialization()](wp_should_skip_block_supports_serialization) instead.
Checks whether serialization of the current block’s dimensions properties should occur.
* [wp\_should\_skip\_block\_supports\_serialization()](wp_should_skip_block_supports_serialization)
`$block_type` [WP\_Block\_type](../classes/wp_block_type) Required Block type. bool Whether to serialize spacing support styles & classes.
File: `wp-includes/deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/deprecated.php/)
```
function wp_skip_dimensions_serialization( $block_type ) {
_deprecated_function( __FUNCTION__, '6.0.0', 'wp_should_skip_block_supports_serialization()' );
$dimensions_support = _wp_array_get( $block_type->supports, array( '__experimentalDimensions' ), false );
return is_array( $dimensions_support ) &&
array_key_exists( '__experimentalSkipSerialization', $dimensions_support ) &&
$dimensions_support['__experimentalSkipSerialization'];
}
```
| Uses | Description |
| --- | --- |
| [\_wp\_array\_get()](_wp_array_get) wp-includes/functions.php | Accesses an array in depth based on a path of keys. |
| [\_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/) | Use wp\_should\_skip\_block\_supports\_serialization() introduced in 6.0.0. |
| [5.9.0](https://developer.wordpress.org/reference/since/5.9.0/) | Introduced. |
wordpress wp_get_session_token(): string wp\_get\_session\_token(): string
=================================
Retrieves the current session token from the logged\_in cookie.
string Token.
File: `wp-includes/user.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/user.php/)
```
function wp_get_session_token() {
$cookie = wp_parse_auth_cookie( '', 'logged_in' );
return ! empty( $cookie['token'] ) ? $cookie['token'] : '';
}
```
| Uses | Description |
| --- | --- |
| [wp\_parse\_auth\_cookie()](wp_parse_auth_cookie) wp-includes/pluggable.php | Parses a cookie into its components. |
| Used By | Description |
| --- | --- |
| [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\_destroy\_current\_session()](wp_destroy_current_session) wp-includes/user.php | Removes the current session token from the database. |
| [wp\_destroy\_other\_sessions()](wp_destroy_other_sessions) wp-includes/user.php | Removes all but the current session token for the current user for the database. |
| [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. |
| Version | Description |
| --- | --- |
| [4.0.0](https://developer.wordpress.org/reference/since/4.0.0/) | Introduced. |
wordpress wp_admin_bar_recovery_mode_menu( WP_Admin_Bar $wp_admin_bar ) wp\_admin\_bar\_recovery\_mode\_menu( WP\_Admin\_Bar $wp\_admin\_bar )
======================================================================
Adds a link to exit recovery mode when Recovery Mode is active.
`$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_recovery_mode_menu( $wp_admin_bar ) {
if ( ! wp_is_recovery_mode() ) {
return;
}
$url = wp_login_url();
$url = add_query_arg( 'action', WP_Recovery_Mode::EXIT_ACTION, $url );
$url = wp_nonce_url( $url, WP_Recovery_Mode::EXIT_ACTION );
$wp_admin_bar->add_node(
array(
'parent' => 'top-secondary',
'id' => 'recovery-mode',
'title' => __( 'Exit Recovery Mode' ),
'href' => $url,
)
);
}
```
| Uses | Description |
| --- | --- |
| [wp\_is\_recovery\_mode()](wp_is_recovery_mode) wp-includes/load.php | Is WordPress in Recovery Mode. |
| [wp\_login\_url()](wp_login_url) wp-includes/general-template.php | Retrieves the login URL. |
| [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-includes/l10n.php | Retrieves the translation of $text. |
| [wp\_nonce\_url()](wp_nonce_url) wp-includes/functions.php | Retrieves URL with nonce added to URL query. |
| [add\_query\_arg()](add_query_arg) wp-includes/functions.php | Retrieves a modified URL query string. |
| Version | Description |
| --- | --- |
| [5.2.0](https://developer.wordpress.org/reference/since/5.2.0/) | Introduced. |
wordpress get_post_gallery_images( int|WP_Post $post ): string[] get\_post\_gallery\_images( int|WP\_Post $post ): string[]
==========================================================
Checks a post’s content for galleries and return the image srcs for the first found gallery.
* [get\_post\_gallery()](get_post_gallery)
`$post` int|[WP\_Post](../classes/wp_post) Optional Post ID or [WP\_Post](../classes/wp_post) object. Default is global `$post`. string[] A list of a gallery's image srcs in order.
File: `wp-includes/media.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/media.php/)
```
function get_post_gallery_images( $post = 0 ) {
$gallery = get_post_gallery( $post, false );
return empty( $gallery['src'] ) ? array() : $gallery['src'];
}
```
| Uses | Description |
| --- | --- |
| [get\_post\_gallery()](get_post_gallery) wp-includes/media.php | Checks a specified post’s content for gallery and, if present, return the first |
| Version | Description |
| --- | --- |
| [3.6.0](https://developer.wordpress.org/reference/since/3.6.0/) | Introduced. |
wordpress wp_check_php_mysql_versions() wp\_check\_php\_mysql\_versions()
=================================
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.
Check for the required PHP version, and the MySQL extension or a database drop-in.
Dies if requirements are not met.
File: `wp-includes/load.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/load.php/)
```
function wp_check_php_mysql_versions() {
global $required_php_version, $wp_version;
$php_version = PHP_VERSION;
if ( version_compare( $required_php_version, $php_version, '>' ) ) {
$protocol = wp_get_server_protocol();
header( sprintf( '%s 500 Internal Server Error', $protocol ), true, 500 );
header( 'Content-Type: text/html; charset=utf-8' );
printf( 'Your server is running PHP version %1$s but WordPress %2$s requires at least %3$s.', $php_version, $wp_version, $required_php_version );
exit( 1 );
}
if ( ! extension_loaded( 'mysql' ) && ! extension_loaded( 'mysqli' ) && ! extension_loaded( 'mysqlnd' )
// This runs before default constants are defined, so we can't assume WP_CONTENT_DIR is set yet.
&& ( defined( 'WP_CONTENT_DIR' ) && ! file_exists( WP_CONTENT_DIR . '/db.php' )
|| ! file_exists( ABSPATH . 'wp-content/db.php' ) )
) {
require_once ABSPATH . WPINC . '/functions.php';
wp_load_translations_early();
$args = array(
'exit' => false,
'code' => 'mysql_not_found',
);
wp_die(
__( 'Your PHP installation appears to be missing the MySQL extension which is required by WordPress.' ),
__( 'Requirements Not Met' ),
$args
);
exit( 1 );
}
}
```
| Uses | Description |
| --- | --- |
| [wp\_get\_server\_protocol()](wp_get_server_protocol) wp-includes/load.php | Return the HTTP protocol sent by the server. |
| [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. |
| Version | Description |
| --- | --- |
| [3.0.0](https://developer.wordpress.org/reference/since/3.0.0/) | Introduced. |
wordpress post_format_meta_box( WP_Post $post, array $box ) post\_format\_meta\_box( WP\_Post $post, array $box )
=====================================================
Displays post format form elements.
`$post` [WP\_Post](../classes/wp_post) Required Current post object. `$box` array Required Post formats meta box arguments.
* `id`stringMeta box `'id'` attribute.
* `title`stringMeta box title.
* `callback`callableMeta box display callback.
* `args`arrayExtra meta box arguments.
File: `wp-admin/includes/meta-boxes.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/meta-boxes.php/)
```
function post_format_meta_box( $post, $box ) {
if ( current_theme_supports( 'post-formats' ) && post_type_supports( $post->post_type, 'post-formats' ) ) :
$post_formats = get_theme_support( 'post-formats' );
if ( is_array( $post_formats[0] ) ) :
$post_format = get_post_format( $post->ID );
if ( ! $post_format ) {
$post_format = '0';
}
// Add in the current one if it isn't there yet, in case the active theme doesn't support it.
if ( $post_format && ! in_array( $post_format, $post_formats[0], true ) ) {
$post_formats[0][] = $post_format;
}
?>
<div id="post-formats-select">
<fieldset>
<legend class="screen-reader-text"><?php _e( 'Post Formats' ); ?></legend>
<input type="radio" name="post_format" class="post-format" id="post-format-0" value="0" <?php checked( $post_format, '0' ); ?> /> <label for="post-format-0" class="post-format-icon post-format-standard"><?php echo get_post_format_string( 'standard' ); ?></label>
<?php foreach ( $post_formats[0] as $format ) : ?>
<br /><input type="radio" name="post_format" class="post-format" id="post-format-<?php echo esc_attr( $format ); ?>" value="<?php echo esc_attr( $format ); ?>" <?php checked( $post_format, $format ); ?> /> <label for="post-format-<?php echo esc_attr( $format ); ?>" class="post-format-icon post-format-<?php echo esc_attr( $format ); ?>"><?php echo esc_html( get_post_format_string( $format ) ); ?></label>
<?php endforeach; ?>
</fieldset>
</div>
<?php
endif;
endif;
}
```
| Uses | Description |
| --- | --- |
| [get\_theme\_support()](get_theme_support) wp-includes/theme.php | Gets the theme support arguments passed when registering that support. |
| [checked()](checked) wp-includes/general-template.php | Outputs the HTML checked attribute. |
| [post\_type\_supports()](post_type_supports) wp-includes/post.php | Checks a post type’s support for a given feature. |
| [get\_post\_format()](get_post_format) wp-includes/post-formats.php | Retrieve the format slug for a post |
| [get\_post\_format\_string()](get_post_format_string) wp-includes/post-formats.php | Returns a pretty, translated version of a post format slug |
| [current\_theme\_supports()](current_theme_supports) wp-includes/theme.php | Checks a theme’s support for a given feature. |
| [\_e()](_e) wp-includes/l10n.php | Displays translated text. |
| [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 |
| --- | --- |
| [3.1.0](https://developer.wordpress.org/reference/since/3.1.0/) | Introduced. |
wordpress remove_all_filters( string $hook_name, int|false $priority = false ): true remove\_all\_filters( string $hook\_name, int|false $priority = false ): true
=============================================================================
Removes all of the callback functions from a filter hook.
`$hook_name` string Required The filter to remove callbacks from. `$priority` int|false Optional The priority number to remove them from.
Default: `false`
true Always returns true.
File: `wp-includes/plugin.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/plugin.php/)
```
function remove_all_filters( $hook_name, $priority = false ) {
global $wp_filter;
if ( isset( $wp_filter[ $hook_name ] ) ) {
$wp_filter[ $hook_name ]->remove_all_filters( $priority );
if ( ! $wp_filter[ $hook_name ]->has_filters() ) {
unset( $wp_filter[ $hook_name ] );
}
}
return true;
}
```
| Used By | Description |
| --- | --- |
| [Language\_Pack\_Upgrader::bulk\_upgrade()](../classes/language_pack_upgrader/bulk_upgrade) wp-admin/includes/class-language-pack-upgrader.php | Bulk upgrade language packs. |
| [WP\_Query::get\_posts()](../classes/wp_query/get_posts) wp-includes/class-wp-query.php | Retrieves an array of posts based on query variables. |
| [remove\_all\_actions()](remove_all_actions) wp-includes/plugin.php | Removes all of the callback functions from an action hook. |
| Version | Description |
| --- | --- |
| [2.7.0](https://developer.wordpress.org/reference/since/2.7.0/) | Introduced. |
wordpress _add_block_template_info( array $template_item ): array \_add\_block\_template\_info( array $template\_item ): 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.
Attempts to add custom template information to the template item.
`$template_item` array Required Template to add information to (requires `'slug'` field). array Template item.
File: `wp-includes/block-template-utils.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/block-template-utils.php/)
```
function _add_block_template_info( $template_item ) {
if ( ! WP_Theme_JSON_Resolver::theme_has_support() ) {
return $template_item;
}
$theme_data = WP_Theme_JSON_Resolver::get_theme_data()->get_custom_templates();
if ( isset( $theme_data[ $template_item['slug'] ] ) ) {
$template_item['title'] = $theme_data[ $template_item['slug'] ]['title'];
$template_item['postTypes'] = $theme_data[ $template_item['slug'] ]['postTypes'];
}
return $template_item;
}
```
| 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. |
| Used By | Description |
| --- | --- |
| [\_get\_block\_template\_file()](_get_block_template_file) wp-includes/block-template-utils.php | Retrieves the template file from the theme for a given slug. |
| [\_get\_block\_templates\_files()](_get_block_templates_files) wp-includes/block-template-utils.php | Retrieves the template files from the theme. |
| Version | Description |
| --- | --- |
| [5.9.0](https://developer.wordpress.org/reference/since/5.9.0/) | Introduced. |
wordpress populate_roles_230() populate\_roles\_230()
======================
Create and modify WordPress roles for WordPress 2.3.
File: `wp-admin/includes/schema.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/schema.php/)
```
function populate_roles_230() {
$role = get_role( 'administrator' );
if ( ! empty( $role ) ) {
$role->add_cap( 'unfiltered_upload' );
}
}
```
| 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.3.0](https://developer.wordpress.org/reference/since/2.3.0/) | Introduced. |
wordpress add_filter( string $hook_name, callable $callback, int $priority = 10, int $accepted_args = 1 ): true add\_filter( string $hook\_name, callable $callback, int $priority = 10, int $accepted\_args = 1 ): true
========================================================================================================
Adds a callback function to a filter hook.
WordPress offers filter hooks to allow plugins to modify various types of internal data at runtime.
A plugin can modify data by binding a callback to a filter hook. When the filter is later applied, each bound callback is run in order of priority, and given the opportunity to modify a value by returning a new value.
The following example shows how a callback function is bound to a filter hook.
Note that `$example` is passed to the callback, (maybe) modified, then returned:
```
function example_callback( $example ) {
// Maybe modify $example in some way.
return $example;
}
add_filter( 'example_filter', 'example_callback' );
```
Bound callbacks can accept from none to the total number of arguments passed as parameters
in the corresponding [apply\_filters()](apply_filters) call.
In other words, if an [apply\_filters()](apply_filters) call passes four total arguments, callbacks bound to
it can accept none (the same as 1) of the arguments or up to four. The important part is that
the `$accepted_args` value must reflect the number of arguments the bound callback *actually*
opted to accept. If no arguments were accepted by the callback that is considered to be the
same as accepting 1 argument. For example:
```
// Filter call.
$value = apply_filters( 'hook', $value, $arg2, $arg3 );
// Accepting zero/one arguments.
function example_callback() {
...
return 'some value';
}
add_filter( 'hook', 'example_callback' ); // Where $priority is default 10, $accepted_args is default 1.
// Accepting two arguments (three possible).
function example_callback( $value, $arg2 ) {
...
return $maybe_modified_value;
}
add_filter( 'hook', 'example_callback', 10, 2 ); // Where $priority is 10, $accepted_args is 2.
```
\_Note:\_ The function will return true whether or not the callback is valid.
It is up to you to take care. This is done for optimization purposes, so everything is as quick as possible.
`$hook_name` string Required The name of the filter to add the callback to. `$callback` callable Required The callback to be run when the filter is applied. `$priority` int Optional Used to specify the order in which the functions associated with a particular filter are executed.
Lower numbers correspond with earlier execution, and functions with the same priority are executed in the order in which they were added to the filter. Default: `10`
`$accepted_args` int Optional The number of arguments the function accepts. Default: `1`
true Always returns true.
* Hooked functions can take extra arguments that are set when the matching [do\_action()](do_action) or [apply\_filters()](apply_filters) call is run. For example, the [comment\_id\_not\_found](../hooks/comment_id_not_found-3 "Plugin API/Action Reference/comment id not found (page does not exist)") action will pass the comment ID to each callback.
* Although you can pass the number of $accepted\_args, you can only manipulate the $value. The other arguments are only to provide context, and their values cannot be changed by the filter function.
* You can also pass a class method as a callback.
Static class method:
```
add_filter( 'media_upload_newtab', array( 'My_Class', 'media_upload_callback' ) );
```
Instance method:
```
add_filter( 'media_upload_newtab', array( $this, 'media_upload_callback' ) );
```
* You can also pass an an anonymous function as a callback. For example:
```
add_filter( 'the_title', function( $title ) { return '<strong>' . $title . '</strong>'; } );
```
File: `wp-includes/plugin.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/plugin.php/)
```
function add_filter( $hook_name, $callback, $priority = 10, $accepted_args = 1 ) {
global $wp_filter;
if ( ! isset( $wp_filter[ $hook_name ] ) ) {
$wp_filter[ $hook_name ] = new WP_Hook();
}
$wp_filter[ $hook_name ]->add_filter( $hook_name, $callback, $priority, $accepted_args );
return true;
}
```
| 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. |
| [\_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\_enqueue\_block\_style()](wp_enqueue_block_style) wp-includes/script-loader.php | Enqueues a stylesheet for a specific block. |
| [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\_enqueue\_global\_styles()](wp_enqueue_global_styles) wp-includes/script-loader.php | Enqueues the global styles defined via theme.json. |
| [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::init()](../classes/wp_sitemaps/init) wp-includes/sitemaps/class-wp-sitemaps.php | Initiates all sitemap functionality. |
| [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. |
| [enqueue\_block\_styles\_assets()](enqueue_block_styles_assets) wp-includes/script-loader.php | Function responsible for enqueuing the styles required for block styles functionality on the editor and on the frontend. |
| [WP\_Site\_Health::\_\_construct()](../classes/wp_site_health/__construct) wp-admin/includes/class-wp-site-health.php | [WP\_Site\_Health](../classes/wp_site_health) constructor. |
| [wp\_init\_targeted\_link\_rel\_filters()](wp_init_targeted_link_rel_filters) wp-includes/formatting.php | Adds all filters modifying the rel attribute of targeted links. |
| [wp\_get\_active\_and\_valid\_themes()](wp_get_active_and_valid_themes) wp-includes/load.php | Retrieves an array of active and valid themes. |
| [update\_sitemeta\_cache()](update_sitemeta_cache) wp-includes/ms-site.php | Updates metadata cache for list of site IDs. |
| [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. |
| [wpdb::placeholder\_escape()](../classes/wpdb/placeholder_escape) wp-includes/class-wpdb.php | Generates and returns a placeholder escape string for use in queries returned by ::prepare(). |
| [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::\_register\_one()](../classes/wp_widget_media/_register_one) wp-includes/widgets/class-wp-widget-media.php | Add hooks while registering all widget instances of this widget class. |
| [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\_Attachments\_Controller::prepare\_items\_query()](../classes/wp_rest_attachments_controller/prepare_items_query) wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php | Determines the allowed query\_vars for a get\_items() response and prepares for [WP\_Query](../classes/wp_query). |
| [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\_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::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\_Locale\_Switcher::init()](../classes/wp_locale_switcher/init) wp-includes/class-wp-locale-switcher.php | Initializes the locale switcher. |
| [WP\_Taxonomy::add\_hooks()](../classes/wp_taxonomy/add_hooks) wp-includes/class-wp-taxonomy.php | Registers 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. |
| [WP\_Customize\_Custom\_CSS\_Setting::preview()](../classes/wp_customize_custom_css_setting/preview) wp-includes/customize/class-wp-customize-custom-css-setting.php | Add filter to preview post value. |
| [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\_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::selective\_refresh\_init()](../classes/wp_customize_widgets/selective_refresh_init) wp-includes/class-wp-customize-widgets.php | Adds hooks for selective refresh. |
| [rest\_api\_default\_filters()](rest_api_default_filters) wp-includes/rest-api.php | Registers the default REST API filters. |
| [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\_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\_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\_Setting::preview()](../classes/wp_customize_nav_menu_setting/preview) wp-includes/customize/class-wp-customize-nav-menu-setting.php | Handle previewing the setting. |
| [WP\_Customize\_Nav\_Menu\_Item\_Setting::update()](../classes/wp_customize_nav_menu_item_setting/update) wp-includes/customize/class-wp-customize-nav-menu-item-setting.php | Creates/updates the nav\_menu\_item post for this setting. |
| [WP\_Customize\_Nav\_Menu\_Item\_Setting::preview()](../classes/wp_customize_nav_menu_item_setting/preview) wp-includes/customize/class-wp-customize-nav-menu-item-setting.php | Handle previewing the setting. |
| [WP\_Customize\_Nav\_Menus\_Panel::render\_screen\_options()](../classes/wp_customize_nav_menus_panel/render_screen_options) wp-includes/customize/class-wp-customize-nav-menus-panel.php | Render screen options for Menus. |
| [WP\_Customize\_Nav\_Menus::customize\_preview\_init()](../classes/wp_customize_nav_menus/customize_preview_init) wp-includes/class-wp-customize-nav-menus.php | Adds hooks for the Customizer preview. |
| [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::\_\_construct()](../classes/wp_customize_nav_menus/__construct) wp-includes/class-wp-customize-nav-menus.php | Constructor. |
| [WP\_Site\_Icon::get\_post\_metadata()](../classes/wp_site_icon/get_post_metadata) wp-admin/includes/class-wp-site-icon.php | Adds custom image sizes when meta data for an image is requested, that happens to be used as Site Icon. |
| [WP\_Site\_Icon::\_\_construct()](../classes/wp_site_icon/__construct) wp-admin/includes/class-wp-site-icon.php | Registers actions and filters. |
| [wp\_ajax\_crop\_image()](wp_ajax_crop_image) wp-admin/includes/ajax-actions.php | Ajax handler for cropping an image. |
| [wp\_edit\_attachments\_query\_vars()](wp_edit_attachments_query_vars) wp-admin/includes/post.php | Returns the query variables for the current attachments request. |
| [\_WP\_List\_Table\_Compat::\_\_construct()](../classes/_wp_list_table_compat/__construct) wp-admin/includes/class-wp-list-table-compat.php | Constructor. |
| [login\_header()](login_header) wp-login.php | Output the login page header. |
| [WP\_Automatic\_Updater::update()](../classes/wp_automatic_updater/update) wp-admin/includes/class-wp-automatic-updater.php | Updates an item, if appropriate. |
| [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. |
| [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. |
| [export\_wp()](export_wp) wp-admin/includes/export.php | Generates the WXR export file for download. |
| [wp\_update\_core()](wp_update_core) wp-admin/includes/deprecated.php | This was once used to kick-off the Core Updater. |
| [wp\_update\_plugin()](wp_update_plugin) wp-admin/includes/deprecated.php | This was once used to kick-off the Plugin Updater. |
| [wp\_update\_theme()](wp_update_theme) wp-admin/includes/deprecated.php | This was once used to kick-off the Theme Updater. |
| [WP\_List\_Table::\_\_construct()](../classes/wp_list_table/__construct) wp-admin/includes/class-wp-list-table.php | Constructor. |
| [wp\_dashboard\_setup()](wp_dashboard_setup) wp-admin/includes/dashboard.php | Registers dashboard widgets. |
| [register\_setting()](register_setting) wp-includes/option.php | Registers a setting and its data. |
| [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\_ajax\_query\_attachments()](wp_ajax_query_attachments) wp-admin/includes/ajax-actions.php | Ajax handler for querying attachments. |
| [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\_Media\_List\_Table::display\_rows()](../classes/wp_media_list_table/display_rows) wp-admin/includes/class-wp-media-list-table.php | |
| [WP\_Importer::get\_page()](../classes/wp_importer/get_page) wp-admin/includes/class-wp-importer.php | GET URL |
| [WP\_Comments\_List\_Table::\_\_construct()](../classes/wp_comments_list_table/__construct) wp-admin/includes/class-wp-comments-list-table.php | Constructor. |
| [wp\_nav\_menu\_setup()](wp_nav_menu_setup) wp-admin/includes/nav-menu.php | Register nav menu meta boxes and advanced menu items. |
| [wp\_list\_widget\_controls()](wp_list_widget_controls) wp-admin/includes/widgets.php | Show the widgets and their settings for a sidebar. |
| [WP\_Posts\_List\_Table::display\_rows()](../classes/wp_posts_list_table/display_rows) wp-admin/includes/class-wp-posts-list-table.php | |
| [do\_core\_upgrade()](do_core_upgrade) wp-admin/update-core.php | Upgrade WordPress core display. |
| [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::start\_previewing\_theme()](../classes/wp_customize_manager/start_previewing_theme) wp-includes/class-wp-customize-manager.php | If the theme to be previewed isn’t the active theme, add filter callbacks to swap it out at runtime. |
| [WP\_Customize\_Manager::\_\_construct()](../classes/wp_customize_manager/__construct) wp-includes/class-wp-customize-manager.php | Constructor. |
| [kses\_init\_filters()](kses_init_filters) wp-includes/kses.php | Adds all KSES input form content filters. |
| [\_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\_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. |
| [WP\_Embed::\_\_construct()](../classes/wp_embed/__construct) wp-includes/class-wp-embed.php | Constructor |
| [WP\_oEmbed::\_\_construct()](../classes/wp_oembed/__construct) wp-includes/class-wp-oembed.php | Constructor. |
| [add\_action()](add_action) wp-includes/plugin.php | Adds a callback function to an action hook. |
| [WP\_Customize\_Setting::\_\_construct()](../classes/wp_customize_setting/__construct) wp-includes/class-wp-customize-setting.php | Constructor. |
| [WP\_Customize\_Setting::preview()](../classes/wp_customize_setting/preview) wp-includes/class-wp-customize-setting.php | Add filters to supply the setting’s value when accessed. |
| [wp\_signon()](wp_signon) wp-includes/user.php | Authenticates and logs a user in with ‘remember’ capability. |
| [\_set\_preview()](_set_preview) wp-includes/revision.php | Sets up the post object for preview based on the post autosave. |
| [\_show\_post\_preview()](_show_post_preview) wp-includes/revision.php | Filters the latest content for preview from the post autosave. |
| [ms\_upload\_constants()](ms_upload_constants) wp-includes/ms-default-constants.php | Defines Multisite upload constants. |
| [Walker\_Comment::start\_el()](../classes/walker_comment/start_el) wp-includes/class-walker-comment.php | Starts the element output. |
| [WP\_Customize\_Widgets::start\_capturing\_option\_updates()](../classes/wp_customize_widgets/start_capturing_option_updates) wp-includes/class-wp-customize-widgets.php | Begins keeping track of changes to widget options, caching new values. |
| [WP\_Customize\_Widgets::capture\_filter\_pre\_update\_option()](../classes/wp_customize_widgets/capture_filter_pre_update_option) wp-includes/class-wp-customize-widgets.php | Pre-filters captured option values before updating. |
| [WP\_Customize\_Widgets::\_\_construct()](../classes/wp_customize_widgets/__construct) wp-includes/class-wp-customize-widgets.php | Initial loader. |
| [WP\_Customize\_Widgets::override\_sidebars\_widgets\_for\_theme\_switch()](../classes/wp_customize_widgets/override_sidebars_widgets_for_theme_switch) wp-includes/class-wp-customize-widgets.php | Override sidebars\_widgets for theme switch. |
| [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\_update\_comment()](wp_update_comment) wp-includes/comment.php | Updates an existing comment in the database. |
| [check\_comment\_flood\_db()](check_comment_flood_db) wp-includes/comment.php | Hooks WP’s native database-based comment-flood check. |
| [register\_meta()](register_meta) wp-includes/meta.php | Registers a meta key. |
| [\_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 |
| --- | --- |
| [0.71](https://developer.wordpress.org/reference/since/0.71/) | Introduced. |
| programming_docs |
wordpress get_custom_header(): object get\_custom\_header(): object
=============================
Gets the header image data.
object
File: `wp-includes/theme.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/theme.php/)
```
function get_custom_header() {
global $_wp_default_headers;
if ( is_random_header_image() ) {
$data = _get_random_header_data();
} else {
$data = get_theme_mod( 'header_image_data' );
if ( ! $data && current_theme_supports( 'custom-header', 'default-image' ) ) {
$directory_args = array( get_template_directory_uri(), get_stylesheet_directory_uri() );
$data = array();
$data['url'] = vsprintf( get_theme_support( 'custom-header', 'default-image' ), $directory_args );
$data['thumbnail_url'] = $data['url'];
if ( ! empty( $_wp_default_headers ) ) {
foreach ( (array) $_wp_default_headers as $default_header ) {
$url = vsprintf( $default_header['url'], $directory_args );
if ( $data['url'] == $url ) {
$data = $default_header;
$data['url'] = $url;
$data['thumbnail_url'] = vsprintf( $data['thumbnail_url'], $directory_args );
break;
}
}
}
}
}
$default = array(
'url' => '',
'thumbnail_url' => '',
'width' => get_theme_support( 'custom-header', 'width' ),
'height' => get_theme_support( 'custom-header', 'height' ),
'video' => get_theme_support( 'custom-header', 'video' ),
);
return (object) wp_parse_args( $data, $default );
}
```
| Uses | Description |
| --- | --- |
| [get\_theme\_support()](get_theme_support) wp-includes/theme.php | Gets the theme support arguments passed when registering that support. |
| [is\_random\_header\_image()](is_random_header_image) wp-includes/theme.php | Checks if random header image is in use. |
| [\_get\_random\_header\_data()](_get_random_header_data) wp-includes/theme.php | Gets random header image data from registered images in theme. |
| [get\_theme\_mod()](get_theme_mod) wp-includes/theme.php | Retrieves theme modification value for the active theme. |
| [get\_template\_directory\_uri()](get_template_directory_uri) wp-includes/theme.php | Retrieves template directory 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. |
| [current\_theme\_supports()](current_theme_supports) wp-includes/theme.php | Checks a theme’s support for a given feature. |
| [wp\_parse\_args()](wp_parse_args) wp-includes/functions.php | Merges user defined arguments into defaults array. |
| Used By | Description |
| --- | --- |
| [get\_header\_video\_settings()](get_header_video_settings) wp-includes/theme.php | Retrieves header video settings. |
| [get\_header\_image\_tag()](get_header_image_tag) wp-includes/theme.php | Creates image tag markup for a custom header image. |
| [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. |
| Version | Description |
| --- | --- |
| [3.4.0](https://developer.wordpress.org/reference/since/3.4.0/) | Introduced. |
wordpress get_plugin_page_hookname( string $plugin_page, string $parent_page ): string get\_plugin\_page\_hookname( string $plugin\_page, string $parent\_page ): string
=================================================================================
Gets the hook name for the administrative page of a plugin.
`$plugin_page` string Required The slug name of the plugin page. `$parent_page` string Required The slug name for the parent menu (or the file name of a standard WordPress admin page). string Hook name for the plugin page.
File: `wp-admin/includes/plugin.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/plugin.php/)
```
function get_plugin_page_hookname( $plugin_page, $parent_page ) {
global $admin_page_hooks;
$parent = get_admin_page_parent( $parent_page );
$page_type = 'admin';
if ( empty( $parent_page ) || 'admin.php' === $parent_page || isset( $admin_page_hooks[ $plugin_page ] ) ) {
if ( isset( $admin_page_hooks[ $plugin_page ] ) ) {
$page_type = 'toplevel';
} elseif ( isset( $admin_page_hooks[ $parent ] ) ) {
$page_type = $admin_page_hooks[ $parent ];
}
} elseif ( isset( $admin_page_hooks[ $parent ] ) ) {
$page_type = $admin_page_hooks[ $parent ];
}
$plugin_name = preg_replace( '!\.php!', '', $plugin_page );
return $page_type . '_page_' . $plugin_name;
}
```
| Uses | Description |
| --- | --- |
| [get\_admin\_page\_parent()](get_admin_page_parent) wp-admin/includes/plugin.php | Gets the parent file of the current admin page. |
| Used By | Description |
| --- | --- |
| [get\_plugin\_page\_hook()](get_plugin_page_hook) wp-admin/includes/plugin.php | Gets the hook attached to the administrative page of a plugin. |
| [user\_can\_access\_admin\_page()](user_can_access_admin_page) wp-admin/includes/plugin.php | Determines whether the current user can access the current admin page. |
| [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. |
| Version | Description |
| --- | --- |
| [1.5.0](https://developer.wordpress.org/reference/since/1.5.0/) | Introduced. |
wordpress wp_dashboard_recent_drafts( WP_Post[]|false $drafts = false ) wp\_dashboard\_recent\_drafts( WP\_Post[]|false $drafts = false )
=================================================================
Show recent drafts of the user on the dashboard.
`$drafts` [WP\_Post](../classes/wp_post)[]|false Optional Array of posts to display. 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_recent_drafts( $drafts = false ) {
if ( ! $drafts ) {
$query_args = array(
'post_type' => 'post',
'post_status' => 'draft',
'author' => get_current_user_id(),
'posts_per_page' => 4,
'orderby' => 'modified',
'order' => 'DESC',
);
/**
* Filters the post query arguments for the 'Recent Drafts' dashboard widget.
*
* @since 4.4.0
*
* @param array $query_args The query arguments for the 'Recent Drafts' dashboard widget.
*/
$query_args = apply_filters( 'dashboard_recent_drafts_query_args', $query_args );
$drafts = get_posts( $query_args );
if ( ! $drafts ) {
return;
}
}
echo '<div class="drafts">';
if ( count( $drafts ) > 3 ) {
printf(
'<p class="view-all"><a href="%s">%s</a></p>' . "\n",
esc_url( admin_url( 'edit.php?post_status=draft' ) ),
__( 'View all drafts' )
);
}
echo '<h2 class="hide-if-no-js">' . __( 'Your Recent Drafts' ) . "</h2>\n";
echo '<ul>';
/* translators: Maximum number of words used in a preview of a draft on the dashboard. */
$draft_length = (int) _x( '10', 'draft_length' );
$drafts = array_slice( $drafts, 0, 3 );
foreach ( $drafts as $draft ) {
$url = get_edit_post_link( $draft->ID );
$title = _draft_or_post_title( $draft->ID );
echo "<li>\n";
printf(
'<div class="draft-title"><a href="%s" aria-label="%s">%s</a><time datetime="%s">%s</time></div>',
esc_url( $url ),
/* translators: %s: Post title. */
esc_attr( sprintf( __( 'Edit “%s”' ), $title ) ),
esc_html( $title ),
get_the_time( 'c', $draft ),
get_the_time( __( 'F j, Y' ), $draft )
);
$the_content = wp_trim_words( $draft->post_content, $draft_length );
if ( $the_content ) {
echo '<p>' . $the_content . '</p>';
}
echo "</li>\n";
}
echo "</ul>\n";
echo '</div>';
}
```
[apply\_filters( 'dashboard\_recent\_drafts\_query\_args', array $query\_args )](../hooks/dashboard_recent_drafts_query_args)
Filters the post query arguments for the ‘Recent Drafts’ dashboard widget.
| Uses | Description |
| --- | --- |
| [wp\_trim\_words()](wp_trim_words) wp-includes/formatting.php | Trims text to a certain number of words. |
| [\_draft\_or\_post\_title()](_draft_or_post_title) wp-admin/includes/template.php | Gets the post title. |
| [get\_the\_time()](get_the_time) wp-includes/general-template.php | Retrieves the time at which the post was written. |
| [get\_edit\_post\_link()](get_edit_post_link) wp-includes/link-template.php | Retrieves the edit post link for post. |
| [get\_posts()](get_posts) wp-includes/post.php | Retrieves an array of the latest posts, or posts matching the given criteria. |
| [\_\_()](__) 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. |
| [esc\_attr()](esc_attr) wp-includes/formatting.php | Escaping for HTML attributes. |
| [esc\_html()](esc_html) wp-includes/formatting.php | Escaping for HTML blocks. |
| [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\_dashboard\_quick\_press()](wp_dashboard_quick_press) wp-admin/includes/dashboard.php | The Quick Draft widget display and creation of drafts. |
| Version | Description |
| --- | --- |
| [2.7.0](https://developer.wordpress.org/reference/since/2.7.0/) | Introduced. |
wordpress wp_get_all_sessions(): array wp\_get\_all\_sessions(): array
===============================
Retrieves a list of sessions for the current user.
array Array of sessions.
File: `wp-includes/user.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/user.php/)
```
function wp_get_all_sessions() {
$manager = WP_Session_Tokens::get_instance( get_current_user_id() );
return $manager->get_all();
}
```
| Uses | Description |
| --- | --- |
| [WP\_Session\_Tokens::get\_instance()](../classes/wp_session_tokens/get_instance) wp-includes/class-wp-session-tokens.php | Retrieves a session manager instance for a user. |
| [get\_current\_user\_id()](get_current_user_id) wp-includes/user.php | Gets the current user’s ID. |
| Version | Description |
| --- | --- |
| [4.0.0](https://developer.wordpress.org/reference/since/4.0.0/) | Introduced. |
wordpress wp_widget_rss_form( array|string $args, array $inputs = null ) wp\_widget\_rss\_form( array|string $args, array $inputs = null )
=================================================================
Display RSS widget options form.
The options for what fields are displayed for the RSS form are all booleans and are as follows: ‘url’, ‘title’, ‘items’, ‘show\_summary’, ‘show\_author’, ‘show\_date’.
`$args` array|string Required Values for input fields. `$inputs` array Optional Override default display options. Default: `null`
File: `wp-includes/widgets.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/widgets.php/)
```
function wp_widget_rss_form( $args, $inputs = null ) {
$default_inputs = array(
'url' => true,
'title' => true,
'items' => true,
'show_summary' => true,
'show_author' => true,
'show_date' => true,
);
$inputs = wp_parse_args( $inputs, $default_inputs );
$args['title'] = isset( $args['title'] ) ? $args['title'] : '';
$args['url'] = isset( $args['url'] ) ? $args['url'] : '';
$args['items'] = isset( $args['items'] ) ? (int) $args['items'] : 0;
if ( $args['items'] < 1 || 20 < $args['items'] ) {
$args['items'] = 10;
}
$args['show_summary'] = isset( $args['show_summary'] ) ? (int) $args['show_summary'] : (int) $inputs['show_summary'];
$args['show_author'] = isset( $args['show_author'] ) ? (int) $args['show_author'] : (int) $inputs['show_author'];
$args['show_date'] = isset( $args['show_date'] ) ? (int) $args['show_date'] : (int) $inputs['show_date'];
if ( ! empty( $args['error'] ) ) {
echo '<p class="widget-error"><strong>' . __( 'RSS Error:' ) . '</strong> ' . esc_html( $args['error'] ) . '</p>';
}
$esc_number = esc_attr( $args['number'] );
if ( $inputs['url'] ) :
?>
<p><label for="rss-url-<?php echo $esc_number; ?>"><?php _e( 'Enter the RSS feed URL here:' ); ?></label>
<input class="widefat" id="rss-url-<?php echo $esc_number; ?>" name="widget-rss[<?php echo $esc_number; ?>][url]" type="text" value="<?php echo esc_url( $args['url'] ); ?>" /></p>
<?php endif; if ( $inputs['title'] ) : ?>
<p><label for="rss-title-<?php echo $esc_number; ?>"><?php _e( 'Give the feed a title (optional):' ); ?></label>
<input class="widefat" id="rss-title-<?php echo $esc_number; ?>" name="widget-rss[<?php echo $esc_number; ?>][title]" type="text" value="<?php echo esc_attr( $args['title'] ); ?>" /></p>
<?php endif; if ( $inputs['items'] ) : ?>
<p><label for="rss-items-<?php echo $esc_number; ?>"><?php _e( 'How many items would you like to display?' ); ?></label>
<select id="rss-items-<?php echo $esc_number; ?>" name="widget-rss[<?php echo $esc_number; ?>][items]">
<?php
for ( $i = 1; $i <= 20; ++$i ) {
echo "<option value='$i' " . selected( $args['items'], $i, false ) . ">$i</option>";
}
?>
</select></p>
<?php endif; if ( $inputs['show_summary'] || $inputs['show_author'] || $inputs['show_date'] ) : ?>
<p>
<?php if ( $inputs['show_summary'] ) : ?>
<input id="rss-show-summary-<?php echo $esc_number; ?>" name="widget-rss[<?php echo $esc_number; ?>][show_summary]" type="checkbox" value="1" <?php checked( $args['show_summary'] ); ?> />
<label for="rss-show-summary-<?php echo $esc_number; ?>"><?php _e( 'Display item content?' ); ?></label><br />
<?php endif; if ( $inputs['show_author'] ) : ?>
<input id="rss-show-author-<?php echo $esc_number; ?>" name="widget-rss[<?php echo $esc_number; ?>][show_author]" type="checkbox" value="1" <?php checked( $args['show_author'] ); ?> />
<label for="rss-show-author-<?php echo $esc_number; ?>"><?php _e( 'Display item author if available?' ); ?></label><br />
<?php endif; if ( $inputs['show_date'] ) : ?>
<input id="rss-show-date-<?php echo $esc_number; ?>" name="widget-rss[<?php echo $esc_number; ?>][show_date]" type="checkbox" value="1" <?php checked( $args['show_date'] ); ?>/>
<label for="rss-show-date-<?php echo $esc_number; ?>"><?php _e( 'Display item date?' ); ?></label><br />
<?php endif; ?>
</p>
<?php
endif; // End of display options.
foreach ( array_keys( $default_inputs ) as $input ) :
if ( 'hidden' === $inputs[ $input ] ) :
$id = str_replace( '_', '-', $input );
?>
<input type="hidden" id="rss-<?php echo esc_attr( $id ); ?>-<?php echo $esc_number; ?>" name="widget-rss[<?php echo $esc_number; ?>][<?php echo esc_attr( $input ); ?>]" value="<?php echo esc_attr( $args[ $input ] ); ?>" />
<?php
endif;
endforeach;
}
```
| Uses | Description |
| --- | --- |
| [checked()](checked) wp-includes/general-template.php | Outputs the HTML checked attribute. |
| [selected()](selected) wp-includes/general-template.php | Outputs the HTML selected attribute. |
| [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. |
| [\_e()](_e) wp-includes/l10n.php | Displays translated text. |
| [esc\_html()](esc_html) wp-includes/formatting.php | Escaping for HTML blocks. |
| [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. |
| [wp\_parse\_args()](wp_parse_args) wp-includes/functions.php | Merges user defined arguments into defaults array. |
| Used By | Description |
| --- | --- |
| [wp\_dashboard\_rss\_control()](wp_dashboard_rss_control) wp-admin/includes/dashboard.php | The RSS dashboard widget control. |
| [WP\_Widget\_RSS::form()](../classes/wp_widget_rss/form) wp-includes/widgets/class-wp-widget-rss.php | Outputs the settings form for the RSS widget. |
| Version | Description |
| --- | --- |
| [2.5.0](https://developer.wordpress.org/reference/since/2.5.0/) | Introduced. |
wordpress wp_get_translation_updates(): object[] wp\_get\_translation\_updates(): object[]
=========================================
Retrieves a list of all language updates available.
object[] Array of translation objects that have available updates.
File: `wp-includes/update.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/update.php/)
```
function wp_get_translation_updates() {
$updates = array();
$transients = array(
'update_core' => 'core',
'update_plugins' => 'plugin',
'update_themes' => 'theme',
);
foreach ( $transients as $transient => $type ) {
$transient = get_site_transient( $transient );
if ( empty( $transient->translations ) ) {
continue;
}
foreach ( $transient->translations as $translation ) {
$updates[] = (object) $translation;
}
}
return $updates;
}
```
| Uses | Description |
| --- | --- |
| [get\_site\_transient()](get_site_transient) wp-includes/option.php | Retrieves the value of a site transient. |
| Used By | Description |
| --- | --- |
| [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. |
| [Language\_Pack\_Upgrader::async\_upgrade()](../classes/language_pack_upgrader/async_upgrade) wp-admin/includes/class-language-pack-upgrader.php | Asynchronously upgrades language packs after other upgrades have been made. |
| [Language\_Pack\_Upgrader::bulk\_upgrade()](../classes/language_pack_upgrader/bulk_upgrade) wp-admin/includes/class-language-pack-upgrader.php | Bulk upgrade language packs. |
| [list\_translation\_updates()](list_translation_updates) wp-admin/update-core.php | Display the update translations form. |
| [wp\_get\_update\_data()](wp_get_update_data) wp-includes/update.php | Collects counts and UI strings for available updates. |
| Version | Description |
| --- | --- |
| [3.7.0](https://developer.wordpress.org/reference/since/3.7.0/) | Introduced. |
wordpress wp_ajax_menu_get_metabox() wp\_ajax\_menu\_get\_metabox()
==============================
Ajax handler for retrieving menu meta boxes.
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_get_metabox() {
if ( ! current_user_can( 'edit_theme_options' ) ) {
wp_die( -1 );
}
require_once ABSPATH . 'wp-admin/includes/nav-menu.php';
if ( isset( $_POST['item-type'] ) && 'post_type' === $_POST['item-type'] ) {
$type = 'posttype';
$callback = 'wp_nav_menu_item_post_type_meta_box';
$items = (array) get_post_types( array( 'show_in_nav_menus' => true ), 'object' );
} elseif ( isset( $_POST['item-type'] ) && 'taxonomy' === $_POST['item-type'] ) {
$type = 'taxonomy';
$callback = 'wp_nav_menu_item_taxonomy_meta_box';
$items = (array) get_taxonomies( array( 'show_ui' => true ), 'object' );
}
if ( ! empty( $_POST['item-object'] ) && isset( $items[ $_POST['item-object'] ] ) ) {
$menus_meta_box_object = $items[ $_POST['item-object'] ];
/** This filter is documented in wp-admin/includes/nav-menu.php */
$item = apply_filters( 'nav_menu_meta_box_object', $menus_meta_box_object );
$box_args = array(
'id' => 'add-' . $item->name,
'title' => $item->labels->name,
'callback' => $callback,
'args' => $item,
);
ob_start();
$callback( null, $box_args );
$markup = ob_get_clean();
echo wp_json_encode(
array(
'replace-id' => $type . '-' . $item->name,
'markup' => $markup,
)
);
}
wp_die();
}
```
[apply\_filters( 'nav\_menu\_meta\_box\_object', WP\_Post\_Type|false $post\_type )](../hooks/nav_menu_meta_box_object)
Filters whether a menu items meta box will be added for the current object type.
| Uses | Description |
| --- | --- |
| [get\_taxonomies()](get_taxonomies) wp-includes/taxonomy.php | Retrieves a list of registered taxonomy names or objects. |
| [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\_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\_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. |
| programming_docs |
wordpress wp_initial_constants() wp\_initial\_constants()
========================
Defines initial WordPress constants.
* [wp\_debug\_mode()](wp_debug_mode)
File: `wp-includes/default-constants.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/default-constants.php/)
```
function wp_initial_constants() {
global $blog_id, $wp_version;
/**#@+
* Constants for expressing human-readable data sizes in their respective number of bytes.
*
* @since 4.4.0
* @since 6.0.0 `PB_IN_BYTES`, `EB_IN_BYTES`, `ZB_IN_BYTES`, and `YB_IN_BYTES` were added.
*/
define( 'KB_IN_BYTES', 1024 );
define( 'MB_IN_BYTES', 1024 * KB_IN_BYTES );
define( 'GB_IN_BYTES', 1024 * MB_IN_BYTES );
define( 'TB_IN_BYTES', 1024 * GB_IN_BYTES );
define( 'PB_IN_BYTES', 1024 * TB_IN_BYTES );
define( 'EB_IN_BYTES', 1024 * PB_IN_BYTES );
define( 'ZB_IN_BYTES', 1024 * EB_IN_BYTES );
define( 'YB_IN_BYTES', 1024 * ZB_IN_BYTES );
/**#@-*/
// Start of run timestamp.
if ( ! defined( 'WP_START_TIMESTAMP' ) ) {
define( 'WP_START_TIMESTAMP', microtime( true ) );
}
$current_limit = ini_get( 'memory_limit' );
$current_limit_int = wp_convert_hr_to_bytes( $current_limit );
// Define memory limits.
if ( ! defined( 'WP_MEMORY_LIMIT' ) ) {
if ( false === wp_is_ini_value_changeable( 'memory_limit' ) ) {
define( 'WP_MEMORY_LIMIT', $current_limit );
} elseif ( is_multisite() ) {
define( 'WP_MEMORY_LIMIT', '64M' );
} else {
define( 'WP_MEMORY_LIMIT', '40M' );
}
}
if ( ! defined( 'WP_MAX_MEMORY_LIMIT' ) ) {
if ( false === wp_is_ini_value_changeable( 'memory_limit' ) ) {
define( 'WP_MAX_MEMORY_LIMIT', $current_limit );
} elseif ( -1 === $current_limit_int || $current_limit_int > 268435456 /* = 256M */ ) {
define( 'WP_MAX_MEMORY_LIMIT', $current_limit );
} else {
define( 'WP_MAX_MEMORY_LIMIT', '256M' );
}
}
// Set memory limits.
$wp_limit_int = wp_convert_hr_to_bytes( WP_MEMORY_LIMIT );
if ( -1 !== $current_limit_int && ( -1 === $wp_limit_int || $wp_limit_int > $current_limit_int ) ) {
ini_set( 'memory_limit', WP_MEMORY_LIMIT );
}
if ( ! isset( $blog_id ) ) {
$blog_id = 1;
}
if ( ! defined( 'WP_CONTENT_DIR' ) ) {
define( 'WP_CONTENT_DIR', ABSPATH . 'wp-content' ); // No trailing slash, full paths only - WP_CONTENT_URL is defined further down.
}
// Add define( 'WP_DEBUG', true ); to wp-config.php to enable display of notices during development.
if ( ! defined( 'WP_DEBUG' ) ) {
if ( 'development' === wp_get_environment_type() ) {
define( 'WP_DEBUG', true );
} else {
define( 'WP_DEBUG', false );
}
}
// Add define( 'WP_DEBUG_DISPLAY', null ); to wp-config.php to use the globally configured setting
// for 'display_errors' and not force errors to be displayed. Use false to force 'display_errors' off.
if ( ! defined( 'WP_DEBUG_DISPLAY' ) ) {
define( 'WP_DEBUG_DISPLAY', true );
}
// Add define( 'WP_DEBUG_LOG', true ); to enable error logging to wp-content/debug.log.
if ( ! defined( 'WP_DEBUG_LOG' ) ) {
define( 'WP_DEBUG_LOG', false );
}
if ( ! defined( 'WP_CACHE' ) ) {
define( 'WP_CACHE', false );
}
// Add define( 'SCRIPT_DEBUG', true ); to wp-config.php to enable loading of non-minified,
// non-concatenated scripts and stylesheets.
if ( ! defined( 'SCRIPT_DEBUG' ) ) {
if ( ! empty( $wp_version ) ) {
$develop_src = false !== strpos( $wp_version, '-src' );
} else {
$develop_src = false;
}
define( 'SCRIPT_DEBUG', $develop_src );
}
/**
* Private
*/
if ( ! defined( 'MEDIA_TRASH' ) ) {
define( 'MEDIA_TRASH', false );
}
if ( ! defined( 'SHORTINIT' ) ) {
define( 'SHORTINIT', false );
}
// Constants for features added to WP that should short-circuit their plugin implementations.
define( 'WP_FEATURE_BETTER_PASSWORDS', true );
/**#@+
* Constants for expressing human-readable intervals
* in their respective number of seconds.
*
* Please note that these values are approximate and are provided for convenience.
* For example, MONTH_IN_SECONDS wrongly assumes every month has 30 days and
* YEAR_IN_SECONDS does not take leap years into account.
*
* If you need more accuracy please consider using the DateTime class (https://www.php.net/manual/en/class.datetime.php).
*
* @since 3.5.0
* @since 4.4.0 Introduced `MONTH_IN_SECONDS`.
*/
define( 'MINUTE_IN_SECONDS', 60 );
define( 'HOUR_IN_SECONDS', 60 * MINUTE_IN_SECONDS );
define( 'DAY_IN_SECONDS', 24 * HOUR_IN_SECONDS );
define( 'WEEK_IN_SECONDS', 7 * DAY_IN_SECONDS );
define( 'MONTH_IN_SECONDS', 30 * DAY_IN_SECONDS );
define( 'YEAR_IN_SECONDS', 365 * DAY_IN_SECONDS );
/**#@-*/
}
```
| Uses | Description |
| --- | --- |
| [wp\_get\_environment\_type()](wp_get_environment_type) wp-includes/load.php | Retrieves the current environment type. |
| [wp\_is\_ini\_value\_changeable()](wp_is_ini_value_changeable) wp-includes/load.php | Determines whether a PHP ini value is changeable at runtime. |
| [wp\_convert\_hr\_to\_bytes()](wp_convert_hr_to_bytes) wp-includes/load.php | Converts a shorthand byte value to an integer byte value. |
| [is\_multisite()](is_multisite) wp-includes/load.php | If Multisite is enabled. |
| Version | Description |
| --- | --- |
| [3.0.0](https://developer.wordpress.org/reference/since/3.0.0/) | Introduced. |
wordpress wp_set_unique_slug_on_create_template_part( int $post_id ) wp\_set\_unique\_slug\_on\_create\_template\_part( int $post\_id )
==================================================================
Sets a custom slug when creating auto-draft template parts.
This is only needed for auto-drafts created by the regular WP editor.
If this page is to be removed, this will not be necessary.
`$post_id` int Required Post ID. File: `wp-includes/theme-templates.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/theme-templates.php/)
```
function wp_set_unique_slug_on_create_template_part( $post_id ) {
$post = get_post( $post_id );
if ( 'auto-draft' !== $post->post_status ) {
return;
}
if ( ! $post->post_name ) {
wp_update_post(
array(
'ID' => $post_id,
'post_name' => 'custom_slug_' . uniqid(),
)
);
}
$terms = get_the_terms( $post_id, 'wp_theme' );
if ( ! is_array( $terms ) || ! count( $terms ) ) {
wp_set_post_terms( $post_id, wp_get_theme()->get_stylesheet(), 'wp_theme' );
}
}
```
| 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\_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\_set\_post\_terms()](wp_set_post_terms) wp-includes/post.php | Sets the terms for a post. |
| [wp\_update\_post()](wp_update_post) wp-includes/post.php | Updates a post with new post data. |
| [wp\_get\_theme()](wp_get_theme) wp-includes/theme.php | Gets a [WP\_Theme](../classes/wp_theme) object for a theme. |
| [get\_post()](get_post) wp-includes/post.php | Retrieves post data given a post ID or post object. |
| Version | Description |
| --- | --- |
| [5.9.0](https://developer.wordpress.org/reference/since/5.9.0/) | Introduced. |
wordpress media_upload_type_form( string $type = 'file', array $errors = null, int|WP_Error $id = null ) media\_upload\_type\_form( string $type = 'file', array $errors = null, int|WP\_Error $id = null )
==================================================================================================
Outputs the legacy media upload form for a given media type.
`$type` string Optional Default: `'file'`
`$errors` array Optional Default: `null`
`$id` int|[WP\_Error](../classes/wp_error) Optional Default: `null`
File: `wp-admin/includes/media.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/media.php/)
```
function media_upload_type_form( $type = 'file', $errors = null, $id = null ) {
media_upload_header();
$post_id = isset( $_REQUEST['post_id'] ) ? (int) $_REQUEST['post_id'] : 0;
$form_action_url = admin_url( "media-upload.php?type=$type&tab=type&post_id=$post_id" );
/**
* Filters the media upload form action URL.
*
* @since 2.6.0
*
* @param string $form_action_url The media upload form action URL.
* @param string $type The type of media. Default 'file'.
*/
$form_action_url = apply_filters( 'media_upload_form_url', $form_action_url, $type );
$form_class = 'media-upload-form type-form validate';
if ( get_user_setting( 'uploader' ) ) {
$form_class .= ' html-uploader';
}
?>
<form enctype="multipart/form-data" method="post" action="<?php echo esc_url( $form_action_url ); ?>" class="<?php echo $form_class; ?>" id="<?php echo $type; ?>-form">
<?php submit_button( '', 'hidden', 'save', false ); ?>
<input type="hidden" name="post_id" id="post_id" value="<?php echo (int) $post_id; ?>" />
<?php wp_nonce_field( 'media-form' ); ?>
<h3 class="media-title"><?php _e( 'Add media files from your computer' ); ?></h3>
<?php media_upload_form( $errors ); ?>
<script type="text/javascript">
jQuery(function($){
var preloaded = $(".media-item.preloaded");
if ( preloaded.length > 0 ) {
preloaded.each(function(){prepareMediaItem({id:this.id.replace(/[^0-9]/g, '')},'');});
}
updateMediaForm();
});
</script>
<div id="media-items">
<?php
if ( $id ) {
if ( ! is_wp_error( $id ) ) {
add_filter( 'attachment_fields_to_edit', 'media_post_single_attachment_fields_to_edit', 10, 2 );
echo get_media_items( $id, $errors );
} else {
echo '<div id="media-upload-error">' . esc_html( $id->get_error_message() ) . '</div></div>';
exit;
}
}
?>
</div>
<p class="savebutton ml-submit">
<?php submit_button( __( 'Save all changes' ), '', 'save', false ); ?>
</p>
</form>
<?php
}
```
[apply\_filters( 'media\_upload\_form\_url', string $form\_action\_url, string $type )](../hooks/media_upload_form_url)
Filters the media upload form action URL.
| Uses | Description |
| --- | --- |
| [submit\_button()](submit_button) wp-admin/includes/template.php | Echoes a submit button, with provided text and appropriate class(es). |
| [media\_upload\_header()](media_upload_header) wp-admin/includes/media.php | Outputs the legacy media upload header. |
| [media\_upload\_form()](media_upload_form) wp-admin/includes/media.php | Outputs the legacy media upload form. |
| [get\_media\_items()](get_media_items) wp-admin/includes/media.php | Retrieves HTML for media items of post gallery. |
| [wp\_nonce\_field()](wp_nonce_field) wp-includes/functions.php | Retrieves or display nonce hidden field for forms. |
| [get\_user\_setting()](get_user_setting) wp-includes/option.php | Retrieves user interface setting value based on setting name. |
| [\_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. |
| [esc\_html()](esc_html) wp-includes/formatting.php | Escaping for HTML blocks. |
| [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. |
| [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.5.0](https://developer.wordpress.org/reference/since/2.5.0/) | Introduced. |
wordpress wp_ajax_time_format() wp\_ajax\_time\_format()
========================
Ajax handler for time formatting.
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_time_format() {
wp_die( date_i18n( sanitize_option( 'time_format', wp_unslash( $_POST['date'] ) ) ) );
}
```
| Uses | Description |
| --- | --- |
| [sanitize\_option()](sanitize_option) wp-includes/formatting.php | Sanitizes various option values based on the nature of the option. |
| [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. |
| [wp\_unslash()](wp_unslash) wp-includes/formatting.php | Removes slashes from a string or recursively removes slashes from strings within an array. |
| [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_clearcookie() wp\_clearcookie()
=================
This function has been deprecated. Use [wp\_clear\_auth\_cookie()](wp_clear_auth_cookie) instead.
Clears the authentication cookie, logging the user out. This function is deprecated.
* [wp\_clear\_auth\_cookie()](wp_clear_auth_cookie)
File: `wp-includes/pluggable-deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/pluggable-deprecated.php/)
```
function wp_clearcookie() {
_deprecated_function( __FUNCTION__, '2.5.0', 'wp_clear_auth_cookie()' );
wp_clear_auth_cookie();
}
```
| Uses | Description |
| --- | --- |
| [wp\_clear\_auth\_cookie()](wp_clear_auth_cookie) wp-includes/pluggable.php | Removes all of the cookies associated with authentication. |
| [\_deprecated\_function()](_deprecated_function) wp-includes/functions.php | Marks a function as deprecated and inform when it has been used. |
| Version | Description |
| --- | --- |
| [2.5.0](https://developer.wordpress.org/reference/since/2.5.0/) | Use [wp\_clear\_auth\_cookie()](wp_clear_auth_cookie) |
| [1.5.0](https://developer.wordpress.org/reference/since/1.5.0/) | Introduced. |
wordpress rest_sanitize_object( mixed $maybe_object ): array rest\_sanitize\_object( mixed $maybe\_object ): array
=====================================================
Converts an object-like value to an object.
`$maybe_object` mixed Required The value being evaluated. array Returns the object extracted from the value.
File: `wp-includes/rest-api.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/rest-api.php/)
```
function rest_sanitize_object( $maybe_object ) {
if ( '' === $maybe_object ) {
return array();
}
if ( $maybe_object instanceof stdClass ) {
return (array) $maybe_object;
}
if ( $maybe_object instanceof JsonSerializable ) {
$maybe_object = $maybe_object->jsonSerialize();
}
if ( ! is_array( $maybe_object ) ) {
return array();
}
return $maybe_object;
}
```
| Used By | Description |
| --- | --- |
| [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\_sanitize\_value\_from\_schema()](rest_sanitize_value_from_schema) wp-includes/rest-api.php | Sanitize a value based on a schema. |
| Version | Description |
| --- | --- |
| [5.5.0](https://developer.wordpress.org/reference/since/5.5.0/) | Introduced. |
wordpress clean_pre( array|string $matches ): string clean\_pre( array|string $matches ): string
===========================================
This function has been deprecated.
Accepts matches array from preg\_replace\_callback in [wpautop()](wpautop) or a string.
Ensures that the contents of a `<pre>...</pre>` HTML block are not converted into paragraphs or line breaks.
`$matches` array|string Required The array or string string The pre block without paragraph/line break conversion.
File: `wp-includes/deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/deprecated.php/)
```
function clean_pre($matches) {
_deprecated_function( __FUNCTION__, '3.4.0' );
if ( is_array($matches) )
$text = $matches[1] . $matches[2] . "</pre>";
else
$text = $matches;
$text = str_replace(array('<br />', '<br/>', '<br>'), array('', '', ''), $text);
$text = str_replace('<p>', "\n", $text);
$text = str_replace('</p>', '', $text);
return $text;
}
```
| 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.4.0](https://developer.wordpress.org/reference/since/3.4.0/) | This function has been deprecated. |
| [1.2.0](https://developer.wordpress.org/reference/since/1.2.0/) | Introduced. |
wordpress activate_plugins( string|string[] $plugins, string $redirect = '', bool $network_wide = false, bool $silent = false ): bool|WP_Error activate\_plugins( string|string[] $plugins, string $redirect = '', bool $network\_wide = false, bool $silent = false ): bool|WP\_Error
=======================================================================================================================================
Activates multiple plugins.
When [WP\_Error](../classes/wp_error) is returned, it does not mean that one of the plugins had errors. It means that one or more of the plugin file paths were invalid.
The execution will be halted as soon as one of the plugins has an error.
`$plugins` string|string[] Required Single plugin or list of plugins to activate. `$redirect` string Optional Redirect to page after successful activation. Default: `''`
`$network_wide` bool Optional Whether to enable the plugin for all sites in the network.
Default: `false`
`$silent` bool Optional Prevent calling activation hooks. Default: `false`
bool|[WP\_Error](../classes/wp_error) True when finished or [WP\_Error](../classes/wp_error) if there were errors during a plugin activation.
File: `wp-admin/includes/plugin.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/plugin.php/)
```
function activate_plugins( $plugins, $redirect = '', $network_wide = false, $silent = false ) {
if ( ! is_array( $plugins ) ) {
$plugins = array( $plugins );
}
$errors = array();
foreach ( $plugins as $plugin ) {
if ( ! empty( $redirect ) ) {
$redirect = add_query_arg( 'plugin', $plugin, $redirect );
}
$result = activate_plugin( $plugin, $redirect, $network_wide, $silent );
if ( is_wp_error( $result ) ) {
$errors[ $plugin ] = $result;
}
}
if ( ! empty( $errors ) ) {
return new WP_Error( 'plugins_invalid', __( 'One of the plugins is invalid.' ), $errors );
}
return true;
}
```
| Uses | Description |
| --- | --- |
| [activate\_plugin()](activate_plugin) wp-admin/includes/plugin.php | Attempts activation of plugin in a “sandbox” and redirects on success. |
| [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. |
| [add\_query\_arg()](add_query_arg) wp-includes/functions.php | Retrieves a modified URL query string. |
| [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.6.0](https://developer.wordpress.org/reference/since/2.6.0/) | Introduced. |
wordpress rest_get_date_with_gmt( string $date, bool $is_utc = false ): array|null rest\_get\_date\_with\_gmt( string $date, bool $is\_utc = false ): array|null
=============================================================================
Parses a date into both its local and UTC equivalent, in MySQL datetime format.
* [rest\_parse\_date()](rest_parse_date)
`$date` string Required RFC3339 timestamp. `$is_utc` bool Optional Whether the provided date should be interpreted as UTC. Default: `false`
array|null Local and UTC datetime strings, in MySQL datetime format (Y-m-d H:i:s), null on failure.
File: `wp-includes/rest-api.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/rest-api.php/)
```
function rest_get_date_with_gmt( $date, $is_utc = false ) {
/*
* Whether or not the original date actually has a timezone string
* changes the way we need to do timezone conversion.
* Store this info before parsing the date, and use it later.
*/
$has_timezone = preg_match( '#(Z|[+-]\d{2}(:\d{2})?)$#', $date );
$date = rest_parse_date( $date );
if ( empty( $date ) ) {
return null;
}
/*
* At this point $date could either be a local date (if we were passed
* a *local* date without a timezone offset) or a UTC date (otherwise).
* Timezone conversion needs to be handled differently between these two cases.
*/
if ( ! $is_utc && ! $has_timezone ) {
$local = gmdate( 'Y-m-d H:i:s', $date );
$utc = get_gmt_from_date( $local );
} else {
$utc = gmdate( 'Y-m-d H:i:s', $date );
$local = get_date_from_gmt( $utc );
}
return array( $local, $utc );
}
```
| Uses | Description |
| --- | --- |
| [rest\_parse\_date()](rest_parse_date) wp-includes/rest-api.php | Parses an RFC3339 time into a Unix timestamp. |
| [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. |
| Used By | Description |
| --- | --- |
| [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\_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.4.0](https://developer.wordpress.org/reference/since/4.4.0/) | Introduced. |
| programming_docs |
wordpress is_success( $sc ) is\_success( $sc )
==================
File: `wp-includes/rss.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/rss.php/)
```
function is_success ($sc) {
return $sc >= 200 && $sc < 300;
}
```
| Used By | Description |
| --- | --- |
| [fetch\_rss()](fetch_rss) wp-includes/rss.php | Build Magpie object based on RSS from URL. |
wordpress maybe_unserialize( string $data ): mixed maybe\_unserialize( string $data ): mixed
=========================================
Unserializes data only if it was serialized.
`$data` string Required Data that might be unserialized. mixed Unserialized data can be any type.
Data might need to be `serialized` to allow it to be successfully stored and retrieved from a database in a form that PHP can understand.
File: `wp-includes/functions.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/functions.php/)
```
function maybe_unserialize( $data ) {
if ( is_serialized( $data ) ) { // Don't attempt to unserialize data that wasn't serialized going in.
return @unserialize( trim( $data ) );
}
return $data;
}
```
| Uses | Description |
| --- | --- |
| [is\_serialized()](is_serialized) wp-includes/functions.php | Checks value to find if it was serialized. |
| Used By | Description |
| --- | --- |
| [get\_metadata\_raw()](get_metadata_raw) wp-includes/meta.php | Retrieves raw metadata value for the specified object. |
| [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\_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. |
| [get\_network\_option()](get_network_option) wp-includes/option.php | Retrieves a network’s option value based on the option name. |
| [\_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. |
| [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. |
| [get\_option()](get_option) wp-includes/option.php | Retrieves an option value based on an option name. |
| [count\_users()](count_users) wp-includes/user.php | Counts number of users who have each of the user roles. |
| [wpmu\_activate\_signup()](wpmu_activate_signup) wp-includes/ms-functions.php | Activates a signup. |
| [get\_metadata\_by\_mid()](get_metadata_by_mid) wp-includes/meta.php | Retrieves metadata by meta ID. |
| Version | Description |
| --- | --- |
| [2.0.0](https://developer.wordpress.org/reference/since/2.0.0/) | Introduced. |
wordpress _wp_batch_update_comment_type() \_wp\_batch\_update\_comment\_type()
====================================
Updates the comment type for a batch of comments.
File: `wp-includes/comment.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/comment.php/)
```
function _wp_batch_update_comment_type() {
global $wpdb;
$lock_name = 'update_comment_type.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_update_comment_type_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() );
// Check if there's still an empty comment type.
$empty_comment_type = $wpdb->get_var(
"SELECT comment_ID FROM $wpdb->comments
WHERE comment_type = ''
LIMIT 1"
);
// No empty comment type, we're done here.
if ( ! $empty_comment_type ) {
update_option( 'finished_updating_comment_type', true );
delete_option( $lock_name );
return;
}
// Empty comment type found? We'll need to run this script again.
wp_schedule_single_event( time() + ( 2 * MINUTE_IN_SECONDS ), 'wp_update_comment_type_batch' );
/**
* Filters the comment batch size for updating the comment type.
*
* @since 5.5.0
*
* @param int $comment_batch_size The comment batch size. Default 100.
*/
$comment_batch_size = (int) apply_filters( 'wp_update_comment_type_batch_size', 100 );
// Get the IDs of the comments to update.
$comment_ids = $wpdb->get_col(
$wpdb->prepare(
"SELECT comment_ID
FROM {$wpdb->comments}
WHERE comment_type = ''
ORDER BY comment_ID DESC
LIMIT %d",
$comment_batch_size
)
);
if ( $comment_ids ) {
$comment_id_list = implode( ',', $comment_ids );
// Update the `comment_type` field value to be `comment` for the next batch of comments.
$wpdb->query(
"UPDATE {$wpdb->comments}
SET comment_type = 'comment'
WHERE comment_type = ''
AND comment_ID IN ({$comment_id_list})" // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared
);
// Make sure to clean the comment cache.
clean_comment_cache( $comment_ids );
}
delete_option( $lock_name );
}
```
[apply\_filters( 'wp\_update\_comment\_type\_batch\_size', int $comment\_batch\_size )](../hooks/wp_update_comment_type_batch_size)
Filters the comment batch size for updating the comment type.
| Uses | Description |
| --- | --- |
| [wp\_schedule\_single\_event()](wp_schedule_single_event) wp-includes/cron.php | Schedules an event to run only once. |
| [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. |
| [wpdb::get\_col()](../classes/wpdb/get_col) wp-includes/class-wpdb.php | Retrieves one column from the database. |
| [clean\_comment\_cache()](clean_comment_cache) wp-includes/comment.php | Removes a comment from the object cache. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter 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. |
| [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 |
| --- | --- |
| [5.5.0](https://developer.wordpress.org/reference/since/5.5.0/) | Introduced. |
wordpress get_avatar_data( mixed $id_or_email, array $args = null ): array get\_avatar\_data( mixed $id\_or\_email, array $args = null ): array
====================================================================
Retrieves default data about the avatar.
`$id_or_email` mixed Required The avatar to retrieve. 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. `$args` array Optional Arguments to use instead of the default arguments.
* `size`intHeight and width of the avatar image file in pixels. Default 96.
* `height`intDisplay height of the avatar in pixels. Defaults to $size.
* `width`intDisplay width of the avatar in pixels. Defaults to $size.
* `default`stringURL for the default image or a default type. Accepts `'404'` (return a 404 instead of a default image), `'retro'` (8bit), `'monsterid'` (monster), `'wavatar'` (cartoon face), `'indenticon'` (the "quilt"), `'mystery'`, `'mm'`, or `'mysteryman'` (The Oyster Man), `'blank'` (transparent GIF), or `'gravatar_default'` (the Gravatar logo). Default is the value of the `'avatar_default'` option, with a fallback of `'mystery'`.
* `force_default`boolWhether to always show the default image, never the Gravatar. Default false.
* `rating`stringWhat rating to display avatars up to. Accepts `'G'`, `'PG'`, `'R'`, `'X'`, and are judged in that order. Default is the value of the `'avatar_rating'` option.
* `scheme`stringURL scheme to use. See [set\_url\_scheme()](set_url_scheme) for accepted values.
* `processed_args`arrayWhen the function returns, the value will be the processed/sanitized $args plus a "found\_avatar" guess. Pass as a reference.
* `extra_attr`stringHTML attributes to insert in the IMG element. Is not sanitized. Default empty.
Default: `null`
array Along with the arguments passed in `$args`, this will contain a couple of extra arguments.
* `found_avatar`boolTrue if an avatar was found for this user, false or not set if none was found.
* `url`string|falseThe URL of the avatar that was found, or false.
File: `wp-includes/link-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/link-template.php/)
```
function get_avatar_data( $id_or_email, $args = null ) {
$args = wp_parse_args(
$args,
array(
'size' => 96,
'height' => null,
'width' => null,
'default' => get_option( 'avatar_default', 'mystery' ),
'force_default' => false,
'rating' => get_option( 'avatar_rating' ),
'scheme' => null,
'processed_args' => null, // If used, should be a reference.
'extra_attr' => '',
)
);
if ( is_numeric( $args['size'] ) ) {
$args['size'] = absint( $args['size'] );
if ( ! $args['size'] ) {
$args['size'] = 96;
}
} else {
$args['size'] = 96;
}
if ( is_numeric( $args['height'] ) ) {
$args['height'] = absint( $args['height'] );
if ( ! $args['height'] ) {
$args['height'] = $args['size'];
}
} else {
$args['height'] = $args['size'];
}
if ( is_numeric( $args['width'] ) ) {
$args['width'] = absint( $args['width'] );
if ( ! $args['width'] ) {
$args['width'] = $args['size'];
}
} else {
$args['width'] = $args['size'];
}
if ( empty( $args['default'] ) ) {
$args['default'] = get_option( 'avatar_default', 'mystery' );
}
switch ( $args['default'] ) {
case 'mm':
case 'mystery':
case 'mysteryman':
$args['default'] = 'mm';
break;
case 'gravatar_default':
$args['default'] = false;
break;
}
$args['force_default'] = (bool) $args['force_default'];
$args['rating'] = strtolower( $args['rating'] );
$args['found_avatar'] = false;
/**
* Filters whether to retrieve the avatar URL early.
*
* Passing a non-null value in the 'url' member of the return array will
* effectively short circuit get_avatar_data(), passing the value through
* the {@see 'get_avatar_data'} filter and returning early.
*
* @since 4.2.0
*
* @param array $args Arguments passed to get_avatar_data(), after processing.
* @param mixed $id_or_email The avatar to retrieve. Accepts a user ID, Gravatar MD5 hash,
* user email, WP_User object, WP_Post object, or WP_Comment object.
*/
$args = apply_filters( 'pre_get_avatar_data', $args, $id_or_email );
if ( isset( $args['url'] ) ) {
/** This filter is documented in wp-includes/link-template.php */
return apply_filters( 'get_avatar_data', $args, $id_or_email );
}
$email_hash = '';
$user = false;
$email = false;
if ( is_object( $id_or_email ) && isset( $id_or_email->comment_ID ) ) {
$id_or_email = get_comment( $id_or_email );
}
// Process the user identifier.
if ( is_numeric( $id_or_email ) ) {
$user = get_user_by( 'id', absint( $id_or_email ) );
} elseif ( is_string( $id_or_email ) ) {
if ( strpos( $id_or_email, '@md5.gravatar.com' ) ) {
// MD5 hash.
list( $email_hash ) = explode( '@', $id_or_email );
} else {
// Email address.
$email = $id_or_email;
}
} elseif ( $id_or_email instanceof WP_User ) {
// User object.
$user = $id_or_email;
} elseif ( $id_or_email instanceof WP_Post ) {
// Post object.
$user = get_user_by( 'id', (int) $id_or_email->post_author );
} elseif ( $id_or_email instanceof WP_Comment ) {
if ( ! is_avatar_comment_type( get_comment_type( $id_or_email ) ) ) {
$args['url'] = false;
/** This filter is documented in wp-includes/link-template.php */
return apply_filters( 'get_avatar_data', $args, $id_or_email );
}
if ( ! empty( $id_or_email->user_id ) ) {
$user = get_user_by( 'id', (int) $id_or_email->user_id );
}
if ( ( ! $user || is_wp_error( $user ) ) && ! empty( $id_or_email->comment_author_email ) ) {
$email = $id_or_email->comment_author_email;
}
}
if ( ! $email_hash ) {
if ( $user ) {
$email = $user->user_email;
}
if ( $email ) {
$email_hash = md5( strtolower( trim( $email ) ) );
}
}
if ( $email_hash ) {
$args['found_avatar'] = true;
$gravatar_server = hexdec( $email_hash[0] ) % 3;
} else {
$gravatar_server = rand( 0, 2 );
}
$url_args = array(
's' => $args['size'],
'd' => $args['default'],
'f' => $args['force_default'] ? 'y' : false,
'r' => $args['rating'],
);
if ( is_ssl() ) {
$url = 'https://secure.gravatar.com/avatar/' . $email_hash;
} else {
$url = sprintf( 'http://%d.gravatar.com/avatar/%s', $gravatar_server, $email_hash );
}
$url = add_query_arg(
rawurlencode_deep( array_filter( $url_args ) ),
set_url_scheme( $url, $args['scheme'] )
);
/**
* Filters the avatar URL.
*
* @since 4.2.0
*
* @param string $url The URL of the avatar.
* @param mixed $id_or_email The avatar to retrieve. Accepts a user ID, Gravatar MD5 hash,
* user email, WP_User object, WP_Post object, or WP_Comment object.
* @param array $args Arguments passed to get_avatar_data(), after processing.
*/
$args['url'] = apply_filters( 'get_avatar_url', $url, $id_or_email, $args );
/**
* Filters the avatar data.
*
* @since 4.2.0
*
* @param array $args Arguments passed to get_avatar_data(), after processing.
* @param mixed $id_or_email The avatar to retrieve. Accepts a user ID, Gravatar MD5 hash,
* user email, WP_User object, WP_Post object, or WP_Comment object.
*/
return apply_filters( 'get_avatar_data', $args, $id_or_email );
}
```
[apply\_filters( 'get\_avatar\_data', array $args, mixed $id\_or\_email )](../hooks/get_avatar_data)
Filters the avatar data.
[apply\_filters( 'get\_avatar\_url', string $url, mixed $id\_or\_email, array $args )](../hooks/get_avatar_url)
Filters the avatar URL.
[apply\_filters( 'pre\_get\_avatar\_data', array $args, mixed $id\_or\_email )](../hooks/pre_get_avatar_data)
Filters whether to retrieve the avatar URL early.
| Uses | Description |
| --- | --- |
| [is\_avatar\_comment\_type()](is_avatar_comment_type) wp-includes/link-template.php | Check if this comment type allows avatars to be retrieved. |
| [rawurlencode\_deep()](rawurlencode_deep) wp-includes/formatting.php | Navigates through an array, object, or scalar, and raw-encodes the values to be used in a URL. |
| [get\_user\_by()](get_user_by) wp-includes/pluggable.php | Retrieves user info by a given field. |
| [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. |
| [get\_comment\_type()](get_comment_type) wp-includes/comment-template.php | Retrieves the comment type of the current comment. |
| [wp\_parse\_args()](wp_parse_args) wp-includes/functions.php | Merges user defined arguments into defaults array. |
| [absint()](absint) wp-includes/functions.php | Converts a value to non-negative integer. |
| [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. |
| [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. |
| [is\_wp\_error()](is_wp_error) wp-includes/load.php | Checks whether the given variable is a WordPress Error. |
| Used By | Description |
| --- | --- |
| [wp\_credits\_section\_list()](wp_credits_section_list) wp-admin/includes/credits.php | Displays a list of contributors for a given group. |
| [get\_avatar\_url()](get_avatar_url) wp-includes/link-template.php | Retrieves the avatar URL. |
| [get\_avatar()](get_avatar) wp-includes/pluggable.php | Retrieves the avatar `<img>` tag for a user, email address, MD5 hash, comment, or post. |
| Version | Description |
| --- | --- |
| [4.2.0](https://developer.wordpress.org/reference/since/4.2.0/) | Introduced. |
wordpress get_post_ancestors( int|WP_Post $post ): int[] get\_post\_ancestors( int|WP\_Post $post ): int[]
=================================================
Retrieves the IDs of the ancestors of a post.
`$post` int|[WP\_Post](../classes/wp_post) Required Post ID or post object. int[] Array of ancestor IDs or empty array if there are none.
File: `wp-includes/post.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/post.php/)
```
function get_post_ancestors( $post ) {
$post = get_post( $post );
if ( ! $post || empty( $post->post_parent ) || $post->post_parent == $post->ID ) {
return array();
}
$ancestors = array();
$id = $post->post_parent;
$ancestors[] = $id;
while ( $ancestor = get_post( $id ) ) {
// Loop detection: If the ancestor has been seen before, break.
if ( empty( $ancestor->post_parent ) || ( $ancestor->post_parent == $post->ID ) || in_array( $ancestor->post_parent, $ancestors, true ) ) {
break;
}
$id = $ancestor->post_parent;
$ancestors[] = $id;
}
return $ancestors;
}
```
| Uses | Description |
| --- | --- |
| [get\_post()](get_post) wp-includes/post.php | Retrieves post data given a post ID or post object. |
| 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 | |
| [get\_ancestors()](get_ancestors) wp-includes/taxonomy.php | Gets an array of ancestor IDs for a given object. |
| [WP\_Post::\_\_get()](../classes/wp_post/__get) wp-includes/class-wp-post.php | Getter. |
| Version | Description |
| --- | --- |
| [2.5.0](https://developer.wordpress.org/reference/since/2.5.0/) | Introduced. |
wordpress win_is_writable( string $path ): bool win\_is\_writable( string $path ): bool
=======================================
Workaround for Windows bug in is\_writable() function
PHP has issues with Windows ACL’s for determine if a directory is writable or not, this works around them by checking the ability to open files rather than relying upon PHP to interprate the OS ACL.
* <https://bugs.php.net/bug.php?id=27609>
* <https://bugs.php.net/bug.php?id=30931>
`$path` string Required Windows path to check for write-ability. bool Whether the path is writable.
File: `wp-includes/functions.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/functions.php/)
```
function win_is_writable( $path ) {
if ( '/' === $path[ strlen( $path ) - 1 ] ) {
// If it looks like a directory, check a random file within the directory.
return win_is_writable( $path . uniqid( mt_rand() ) . '.tmp' );
} elseif ( is_dir( $path ) ) {
// If it's a directory (and not a file), check a random file within the directory.
return win_is_writable( $path . '/' . uniqid( mt_rand() ) . '.tmp' );
}
// Check tmp file for read/write capabilities.
$should_delete_tmp_file = ! file_exists( $path );
$f = @fopen( $path, 'a' );
if ( false === $f ) {
return false;
}
fclose( $f );
if ( $should_delete_tmp_file ) {
unlink( $path );
}
return true;
}
```
| Uses | Description |
| --- | --- |
| [win\_is\_writable()](win_is_writable) wp-includes/functions.php | Workaround for Windows bug in is\_writable() function |
| 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. |
| [wp\_is\_writable()](wp_is_writable) wp-includes/functions.php | Determines if a directory is writable. |
| [win\_is\_writable()](win_is_writable) wp-includes/functions.php | Workaround for Windows bug in is\_writable() function |
| Version | Description |
| --- | --- |
| [2.8.0](https://developer.wordpress.org/reference/since/2.8.0/) | Introduced. |
| programming_docs |
wordpress add_site_option( string $option, mixed $value ): bool add\_site\_option( string $option, mixed $value ): bool
=======================================================
Adds a new option for the current network.
Existing options will not be updated. Note that prior to 3.3 this wasn’t the case.
* [add\_network\_option()](add_network_option)
`$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.
This function essentially the same as [add\_option()](add_option) but works network wide when using WP Multisite.
The only major difference is that on multisite site-wide options will not autoload and on a single site the option will autoload. Unlike when using [add\_option()](add_option) on a single site, the feature cannot be overridden.
File: `wp-includes/option.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/option.php/)
```
function add_site_option( $option, $value ) {
return add_network_option( null, $option, $value );
}
```
| Uses | Description |
| --- | --- |
| [add\_network\_option()](add_network_option) wp-includes/option.php | Adds a new network option. |
| Used By | Description |
| --- | --- |
| [set\_site\_transient()](set_site_transient) wp-includes/option.php | Sets/updates the value of a site transient. |
| [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. |
| Version | Description |
| --- | --- |
| [4.4.0](https://developer.wordpress.org/reference/since/4.4.0/) | Modified into wrapper for [add\_network\_option()](add_network_option) |
| [2.8.0](https://developer.wordpress.org/reference/since/2.8.0/) | Introduced. |
wordpress wp_ajax_delete_post( string $action ) wp\_ajax\_delete\_post( string $action )
========================================
Ajax handler for deleting a post.
`$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_delete_post( $action ) {
if ( empty( $action ) ) {
$action = 'delete-post';
}
$id = isset( $_POST['id'] ) ? (int) $_POST['id'] : 0;
check_ajax_referer( "{$action}_$id" );
if ( ! current_user_can( 'delete_post', $id ) ) {
wp_die( -1 );
}
if ( ! get_post( $id ) ) {
wp_die( 1 );
}
if ( wp_delete_post( $id ) ) {
wp_die( 1 );
} else {
wp_die( 0 );
}
}
```
| Uses | Description |
| --- | --- |
| [wp\_delete\_post()](wp_delete_post) wp-includes/post.php | Trashes or deletes a post or page. |
| [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\_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 wp_get_pomo_file_data( string $po_file ): string[] wp\_get\_pomo\_file\_data( string $po\_file ): string[]
=======================================================
Extracts headers from a PO file.
`$po_file` string Required Path to PO file. string[] Array of PO file header values keyed by header name.
File: `wp-includes/l10n.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/l10n.php/)
```
function wp_get_pomo_file_data( $po_file ) {
$headers = get_file_data(
$po_file,
array(
'POT-Creation-Date' => '"POT-Creation-Date',
'PO-Revision-Date' => '"PO-Revision-Date',
'Project-Id-Version' => '"Project-Id-Version',
'X-Generator' => '"X-Generator',
)
);
foreach ( $headers as $header => $value ) {
// Remove possible contextual '\n' and closing double quote.
$headers[ $header ] = preg_replace( '~(\\\n)?"$~', '', $value );
}
return $headers;
}
```
| Uses | Description |
| --- | --- |
| [get\_file\_data()](get_file_data) wp-includes/functions.php | Retrieves metadata from a file. |
| Used By | Description |
| --- | --- |
| [wp\_get\_installed\_translations()](wp_get_installed_translations) wp-includes/l10n.php | Gets installed translations. |
| Version | Description |
| --- | --- |
| [3.7.0](https://developer.wordpress.org/reference/since/3.7.0/) | Introduced. |
wordpress _wp_theme_json_webfonts_handler() \_wp\_theme\_json\_webfonts\_handler()
======================================
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.
Runs the theme.json webfonts handler.
Using `WP_Theme_JSON_Resolver`, it gets the fonts defined in the `theme.json` for the current selection and style variations, validates the font-face properties, generates the ‘@font-face’ style declarations, and then enqueues the styles for both the editor and front-end.
Design Notes: This is not a public API, but rather an internal handler.
A future public Webfonts API will replace this stopgap code.
This code design is intentional.
a. It hides the inner-workings.
b. It does not expose API ins or outs for consumption.
c. It only works with a theme’s `theme.json`.
Why? a. To avoid backwards-compatibility issues when the Webfonts API is introduced in Core.
b. To make `fontFace` declarations in `theme.json` work.
File: `wp-includes/script-loader.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/script-loader.php/)
```
function _wp_theme_json_webfonts_handler() {
// Block themes are unavailable during installation.
if ( wp_installing() ) {
return;
}
// Webfonts to be processed.
$registered_webfonts = array();
/**
* Gets the webfonts from theme.json.
*
* @since 6.0.0
*
* @return array Array of defined webfonts.
*/
$fn_get_webfonts_from_theme_json = static function() {
// Get settings from theme.json.
$settings = WP_Theme_JSON_Resolver::get_merged_data()->get_settings();
// If in the editor, add webfonts defined in variations.
if ( is_admin() || ( defined( 'REST_REQUEST' ) && REST_REQUEST ) ) {
$variations = WP_Theme_JSON_Resolver::get_style_variations();
foreach ( $variations as $variation ) {
// Skip if fontFamilies are not defined in the variation.
if ( empty( $variation['settings']['typography']['fontFamilies'] ) ) {
continue;
}
// Initialize the array structure.
if ( empty( $settings['typography'] ) ) {
$settings['typography'] = array();
}
if ( empty( $settings['typography']['fontFamilies'] ) ) {
$settings['typography']['fontFamilies'] = array();
}
if ( empty( $settings['typography']['fontFamilies']['theme'] ) ) {
$settings['typography']['fontFamilies']['theme'] = array();
}
// Combine variations with settings. Remove duplicates.
$settings['typography']['fontFamilies']['theme'] = array_merge( $settings['typography']['fontFamilies']['theme'], $variation['settings']['typography']['fontFamilies']['theme'] );
$settings['typography']['fontFamilies'] = array_unique( $settings['typography']['fontFamilies'] );
}
}
// Bail out early if there are no settings for webfonts.
if ( empty( $settings['typography']['fontFamilies'] ) ) {
return array();
}
$webfonts = array();
// Look for fontFamilies.
foreach ( $settings['typography']['fontFamilies'] as $font_families ) {
foreach ( $font_families as $font_family ) {
// Skip if fontFace is not defined.
if ( empty( $font_family['fontFace'] ) ) {
continue;
}
// Skip if fontFace is not an array of webfonts.
if ( ! is_array( $font_family['fontFace'] ) ) {
continue;
}
$webfonts = array_merge( $webfonts, $font_family['fontFace'] );
}
}
return $webfonts;
};
/**
* Transforms each 'src' into an URI by replacing 'file:./'
* placeholder from theme.json.
*
* The absolute path to the webfont file(s) cannot be defined in
* theme.json. `file:./` is the placeholder which is replaced by
* the theme's URL path to the theme's root.
*
* @since 6.0.0
*
* @param array $src Webfont file(s) `src`.
* @return array Webfont's `src` in URI.
*/
$fn_transform_src_into_uri = static function( array $src ) {
foreach ( $src as $key => $url ) {
// Tweak the URL to be relative to the theme root.
if ( ! str_starts_with( $url, 'file:./' ) ) {
continue;
}
$src[ $key ] = get_theme_file_uri( str_replace( 'file:./', '', $url ) );
}
return $src;
};
/**
* Converts the font-face properties (i.e. keys) into kebab-case.
*
* @since 6.0.0
*
* @param array $font_face Font face to convert.
* @return array Font faces with each property in kebab-case format.
*/
$fn_convert_keys_to_kebab_case = static function( array $font_face ) {
foreach ( $font_face as $property => $value ) {
$kebab_case = _wp_to_kebab_case( $property );
$font_face[ $kebab_case ] = $value;
if ( $kebab_case !== $property ) {
unset( $font_face[ $property ] );
}
}
return $font_face;
};
/**
* Validates a webfont.
*
* @since 6.0.0
*
* @param array $webfont The webfont arguments.
* @return array|false The validated webfont arguments, or false if the webfont is invalid.
*/
$fn_validate_webfont = static function( $webfont ) {
$webfont = wp_parse_args(
$webfont,
array(
'font-family' => '',
'font-style' => 'normal',
'font-weight' => '400',
'font-display' => 'fallback',
'src' => array(),
)
);
// Check the font-family.
if ( empty( $webfont['font-family'] ) || ! is_string( $webfont['font-family'] ) ) {
trigger_error( __( 'Webfont font family must be a non-empty string.' ) );
return false;
}
// Check that the `src` property is defined and a valid type.
if ( empty( $webfont['src'] ) || ( ! is_string( $webfont['src'] ) && ! is_array( $webfont['src'] ) ) ) {
trigger_error( __( 'Webfont src must be a non-empty string or an array of strings.' ) );
return false;
}
// Validate the `src` property.
foreach ( (array) $webfont['src'] as $src ) {
if ( ! is_string( $src ) || '' === trim( $src ) ) {
trigger_error( __( 'Each webfont src must be a non-empty string.' ) );
return false;
}
}
// Check the font-weight.
if ( ! is_string( $webfont['font-weight'] ) && ! is_int( $webfont['font-weight'] ) ) {
trigger_error( __( 'Webfont font weight must be a properly formatted string or integer.' ) );
return false;
}
// Check the font-display.
if ( ! in_array( $webfont['font-display'], array( 'auto', 'block', 'fallback', 'swap' ), true ) ) {
$webfont['font-display'] = 'fallback';
}
$valid_props = array(
'ascend-override',
'descend-override',
'font-display',
'font-family',
'font-stretch',
'font-style',
'font-weight',
'font-variant',
'font-feature-settings',
'font-variation-settings',
'line-gap-override',
'size-adjust',
'src',
'unicode-range',
);
foreach ( $webfont as $prop => $value ) {
if ( ! in_array( $prop, $valid_props, true ) ) {
unset( $webfont[ $prop ] );
}
}
return $webfont;
};
/**
* Registers webfonts declared in theme.json.
*
* @since 6.0.0
*
* @uses $registered_webfonts To access and update the registered webfonts registry (passed by reference).
* @uses $fn_get_webfonts_from_theme_json To run the function that gets the webfonts from theme.json.
* @uses $fn_convert_keys_to_kebab_case To run the function that converts keys into kebab-case.
* @uses $fn_validate_webfont To run the function that validates each font-face (webfont) from theme.json.
*/
$fn_register_webfonts = static function() use ( &$registered_webfonts, $fn_get_webfonts_from_theme_json, $fn_convert_keys_to_kebab_case, $fn_validate_webfont, $fn_transform_src_into_uri ) {
$registered_webfonts = array();
foreach ( $fn_get_webfonts_from_theme_json() as $webfont ) {
if ( ! is_array( $webfont ) ) {
continue;
}
$webfont = $fn_convert_keys_to_kebab_case( $webfont );
$webfont = $fn_validate_webfont( $webfont );
$webfont['src'] = $fn_transform_src_into_uri( (array) $webfont['src'] );
// Skip if not valid.
if ( empty( $webfont ) ) {
continue;
}
$registered_webfonts[] = $webfont;
}
};
/**
* Orders 'src' items to optimize for browser support.
*
* @since 6.0.0
*
* @param array $webfont Webfont to process.
* @return array Ordered `src` items.
*/
$fn_order_src = static function( array $webfont ) {
$src = array();
$src_ordered = array();
foreach ( $webfont['src'] as $url ) {
// Add data URIs first.
if ( str_starts_with( trim( $url ), 'data:' ) ) {
$src_ordered[] = array(
'url' => $url,
'format' => 'data',
);
continue;
}
$format = pathinfo( $url, PATHINFO_EXTENSION );
$src[ $format ] = $url;
}
// Add woff2.
if ( ! empty( $src['woff2'] ) ) {
$src_ordered[] = array(
'url' => sanitize_url( $src['woff2'] ),
'format' => 'woff2',
);
}
// Add woff.
if ( ! empty( $src['woff'] ) ) {
$src_ordered[] = array(
'url' => sanitize_url( $src['woff'] ),
'format' => 'woff',
);
}
// Add ttf.
if ( ! empty( $src['ttf'] ) ) {
$src_ordered[] = array(
'url' => sanitize_url( $src['ttf'] ),
'format' => 'truetype',
);
}
// Add eot.
if ( ! empty( $src['eot'] ) ) {
$src_ordered[] = array(
'url' => sanitize_url( $src['eot'] ),
'format' => 'embedded-opentype',
);
}
// Add otf.
if ( ! empty( $src['otf'] ) ) {
$src_ordered[] = array(
'url' => sanitize_url( $src['otf'] ),
'format' => 'opentype',
);
}
$webfont['src'] = $src_ordered;
return $webfont;
};
/**
* Compiles the 'src' into valid CSS.
*
* @since 6.0.0
*
* @param string $font_family Font family.
* @param array $value Value to process.
* @return string The CSS.
*/
$fn_compile_src = static function( $font_family, array $value ) {
$src = "local($font_family)";
foreach ( $value as $item ) {
if (
str_starts_with( $item['url'], site_url() ) ||
str_starts_with( $item['url'], home_url() )
) {
$item['url'] = wp_make_link_relative( $item['url'] );
}
$src .= ( 'data' === $item['format'] )
? ", url({$item['url']})"
: ", url('{$item['url']}') format('{$item['format']}')";
}
return $src;
};
/**
* Compiles the font variation settings.
*
* @since 6.0.0
*
* @param array $font_variation_settings Array of font variation settings.
* @return string The CSS.
*/
$fn_compile_variations = static function( array $font_variation_settings ) {
$variations = '';
foreach ( $font_variation_settings as $key => $value ) {
$variations .= "$key $value";
}
return $variations;
};
/**
* Builds the font-family's CSS.
*
* @since 6.0.0
*
* @uses $fn_compile_src To run the function that compiles the src.
* @uses $fn_compile_variations To run the function that compiles the variations.
*
* @param array $webfont Webfont to process.
* @return string This font-family's CSS.
*/
$fn_build_font_face_css = static function( array $webfont ) use ( $fn_compile_src, $fn_compile_variations ) {
$css = '';
// Wrap font-family in quotes if it contains spaces.
if (
str_contains( $webfont['font-family'], ' ' ) &&
! str_contains( $webfont['font-family'], '"' ) &&
! str_contains( $webfont['font-family'], "'" )
) {
$webfont['font-family'] = '"' . $webfont['font-family'] . '"';
}
foreach ( $webfont as $key => $value ) {
/*
* Skip "provider", since it's for internal API use,
* and not a valid CSS property.
*/
if ( 'provider' === $key ) {
continue;
}
// Compile the "src" parameter.
if ( 'src' === $key ) {
$value = $fn_compile_src( $webfont['font-family'], $value );
}
// If font-variation-settings is an array, convert it to a string.
if ( 'font-variation-settings' === $key && is_array( $value ) ) {
$value = $fn_compile_variations( $value );
}
if ( ! empty( $value ) ) {
$css .= "$key:$value;";
}
}
return $css;
};
/**
* Gets the '@font-face' CSS styles for locally-hosted font files.
*
* @since 6.0.0
*
* @uses $registered_webfonts To access and update the registered webfonts registry (passed by reference).
* @uses $fn_order_src To run the function that orders the src.
* @uses $fn_build_font_face_css To run the function that builds the font-face CSS.
*
* @return string The `@font-face` CSS.
*/
$fn_get_css = static function() use ( &$registered_webfonts, $fn_order_src, $fn_build_font_face_css ) {
$css = '';
foreach ( $registered_webfonts as $webfont ) {
// Order the webfont's `src` items to optimize for browser support.
$webfont = $fn_order_src( $webfont );
// Build the @font-face CSS for this webfont.
$css .= '@font-face{' . $fn_build_font_face_css( $webfont ) . '}';
}
return $css;
};
/**
* Generates and enqueues webfonts styles.
*
* @since 6.0.0
*
* @uses $fn_get_css To run the function that gets the CSS.
*/
$fn_generate_and_enqueue_styles = static function() use ( $fn_get_css ) {
// Generate the styles.
$styles = $fn_get_css();
// Bail out if there are no styles to enqueue.
if ( '' === $styles ) {
return;
}
// Enqueue the stylesheet.
wp_register_style( 'wp-webfonts', '' );
wp_enqueue_style( 'wp-webfonts' );
// Add the styles to the stylesheet.
wp_add_inline_style( 'wp-webfonts', $styles );
};
/**
* Generates and enqueues editor styles.
*
* @since 6.0.0
*
* @uses $fn_get_css To run the function that gets the CSS.
*/
$fn_generate_and_enqueue_editor_styles = static function() use ( $fn_get_css ) {
// Generate the styles.
$styles = $fn_get_css();
// Bail out if there are no styles to enqueue.
if ( '' === $styles ) {
return;
}
wp_add_inline_style( 'wp-block-library', $styles );
};
add_action( 'wp_loaded', $fn_register_webfonts );
add_action( 'wp_enqueue_scripts', $fn_generate_and_enqueue_styles );
add_action( 'admin_init', $fn_generate_and_enqueue_editor_styles );
}
```
| Uses | Description |
| --- | --- |
| [WP\_Theme\_JSON\_Resolver::get\_style\_variations()](../classes/wp_theme_json_resolver/get_style_variations) wp-includes/class-wp-theme-json-resolver.php | Returns the style variations defined by the theme. |
| [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\_to\_kebab\_case()](_wp_to_kebab_case) wp-includes/functions.php | This function is trying to replicate what lodash’s kebabCase (JS library) does in the client. |
| [get\_theme\_file\_uri()](get_theme_file_uri) wp-includes/link-template.php | Retrieves the URL of a file in the theme. |
| [wp\_installing()](wp_installing) wp-includes/load.php | Check or set whether WordPress is in “installation” mode. |
| [wp\_make\_link\_relative()](wp_make_link_relative) wp-includes/formatting.php | Converts full URL paths to absolute paths. |
| [sanitize\_url()](sanitize_url) wp-includes/formatting.php | Sanitizes a URL for database or redirect usage. |
| [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\_register\_style()](wp_register_style) wp-includes/functions.wp-styles.php | Register a CSS stylesheet. |
| [wp\_enqueue\_style()](wp_enqueue_style) wp-includes/functions.wp-styles.php | Enqueue 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-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\_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. |
| [add\_action()](add_action) wp-includes/plugin.php | Adds a callback function to an action hook. |
| Version | Description |
| --- | --- |
| [6.0.0](https://developer.wordpress.org/reference/since/6.0.0/) | Introduced. |
| programming_docs |
wordpress esc_url_raw( string $url, string[] $protocols = null ): string esc\_url\_raw( string $url, string[] $protocols = null ): string
================================================================
Sanitizes a URL for database or redirect usage.
This function is an alias for [sanitize\_url()](sanitize_url) .
* [sanitize\_url()](sanitize_url)
`$url` string Required The URL to be cleaned. `$protocols` string[] Optional An array of acceptable protocols.
Defaults to return value of [wp\_allowed\_protocols()](wp_allowed_protocols) . Default: `null`
string The cleaned URL after [sanitize\_url()](sanitize_url) is run.
The [esc\_url\_raw()](esc_url_raw) function is similar to [esc\_url()](esc_url) (and actually uses it), but unlike [esc\_url()](esc_url) it does not replace entities for display. The resulting URL is safe to use in database queries, redirects and HTTP requests.
This function is not safe to use for displaying the URL, use [esc\_url()](esc_url) instead.
File: `wp-includes/formatting.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/formatting.php/)
```
function esc_url_raw( $url, $protocols = null ) {
return sanitize_url( $url, $protocols );
}
```
| Uses | Description |
| --- | --- |
| [sanitize\_url()](sanitize_url) wp-includes/formatting.php | Sanitizes a URL for database or redirect usage. |
| Used By | Description |
| --- | --- |
| [wp\_nonce\_ays()](wp_nonce_ays) wp-includes/functions.php | Displays “Are You Sure” message to confirm the action being taken. |
| [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 |
| --- | --- |
| [6.1.0](https://developer.wordpress.org/reference/since/6.1.0/) | Turned into an alias for [sanitize\_url()](sanitize_url) . |
| [2.8.0](https://developer.wordpress.org/reference/since/2.8.0/) | Introduced. |
wordpress the_archive_title( string $before = '', string $after = '' ) the\_archive\_title( string $before = '', string $after = '' )
==============================================================
Displays the archive title based on the queried object.
* [get\_the\_archive\_title()](get_the_archive_title)
`$before` string Optional Content to prepend to the title. Default: `''`
`$after` string Optional Content to append to the title. Default: `''`
File: `wp-includes/general-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/general-template.php/)
```
function the_archive_title( $before = '', $after = '' ) {
$title = get_the_archive_title();
if ( ! empty( $title ) ) {
echo $before . $title . $after;
}
}
```
| Uses | Description |
| --- | --- |
| [get\_the\_archive\_title()](get_the_archive_title) wp-includes/general-template.php | Retrieves the archive title based on the queried object. |
| Version | Description |
| --- | --- |
| [4.1.0](https://developer.wordpress.org/reference/since/4.1.0/) | Introduced. |
wordpress wp_add_global_styles_for_blocks() wp\_add\_global\_styles\_for\_blocks()
======================================
Adds global style rules to the inline style for each block.
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_add_global_styles_for_blocks() {
$tree = WP_Theme_JSON_Resolver::get_merged_data();
$block_nodes = $tree->get_styles_block_nodes();
foreach ( $block_nodes as $metadata ) {
$block_css = $tree->get_styles_for_block( $metadata );
if ( ! wp_should_load_separate_core_block_assets() ) {
wp_add_inline_style( 'global-styles', $block_css );
continue;
}
$stylesheet_handle = 'global-styles';
if ( isset( $metadata['name'] ) ) {
/*
* These block styles are added on block_render.
* This hooks inline CSS to them so that they are loaded conditionally
* based on whether or not the block is used on the page.
*/
if ( str_starts_with( $metadata['name'], 'core/' ) ) {
$block_name = str_replace( 'core/', '', $metadata['name'] );
$stylesheet_handle = 'wp-block-' . $block_name;
}
wp_add_inline_style( $stylesheet_handle, $block_css );
}
// The likes of block element styles from theme.json do not have $metadata['name'] set.
if ( ! isset( $metadata['name'] ) && ! empty( $metadata['path'] ) ) {
$result = array_values(
array_filter(
$metadata['path'],
function ( $item ) {
if ( strpos( $item, 'core/' ) !== false ) {
return true;
}
return false;
}
)
);
if ( isset( $result[0] ) ) {
if ( str_starts_with( $result[0], 'core/' ) ) {
$block_name = str_replace( 'core/', '', $result[0] );
$stylesheet_handle = 'wp-block-' . $block_name;
}
wp_add_inline_style( $stylesheet_handle, $block_css );
}
}
}
}
```
| 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\_should\_load\_separate\_core\_block\_assets()](wp_should_load_separate_core_block_assets) wp-includes/script-loader.php | Checks whether separate styles should be loaded for core blocks on-render. |
| [wp\_add\_inline\_style()](wp_add_inline_style) wp-includes/functions.wp-styles.php | Add extra CSS styles to a registered stylesheet. |
| Used By | Description |
| --- | --- |
| [wp\_enqueue\_global\_styles()](wp_enqueue_global_styles) wp-includes/script-loader.php | Enqueues the global styles defined via theme.json. |
| Version | Description |
| --- | --- |
| [6.1.0](https://developer.wordpress.org/reference/since/6.1.0/) | Introduced. |
wordpress get_option( string $option, mixed $default = false ): mixed get\_option( string $option, mixed $default = false ): mixed
============================================================
Retrieves an option value based on an option name.
If the option does not exist, and a default value is not provided, boolean false is returned. This could be used to check whether you need to initialize an option during installation of a plugin, however that can be done better by using [add\_option()](add_option) which will not overwrite existing options.
Not initializing an option and using boolean `false` as a return value is a bad practice as it triggers an additional database query.
The type of the returned value can be different from the type that was passed when saving or updating the option. If the option value was serialized, then it will be unserialized when it is returned. In this case the type will be the same. For example, storing a non-scalar value like an array will return the same array.
In most cases non-string scalar and null values will be converted and returned as string equivalents.
Exceptions:
1. When the option has not been saved in the database, the `$default` value is returned if provided. If not, boolean `false` is returned.
2. When one of the Options API filters is used: [‘pre\_option\_$option’](../hooks/pre_option_option), [‘default\_option\_$option’](../hooks/default_option_option), or [‘option\_$option’](../hooks/option_option), the returned value may not match the expected type.
3. When the option has just been saved in the database, and [get\_option()](get_option) is used right after, non-string scalar and null values are not converted to string equivalents and the original type is returned.
Examples:
When adding options like this: `add_option( 'my_option_name', 'value' )` and then retrieving them with `get_option( 'my_option_name' )`, the returned values will be:
* `false` returns `string(0) ""`
* `true` returns `string(1) "1"`
* `0` returns `string(1) "0"`
* `1` returns `string(1) "1"`
* `'0'` returns `string(1) "0"`
* `'1'` returns `string(1) "1"`
* `null` returns `string(0) ""`
When adding options with non-scalar values like `add_option( 'my_array', array( false, 'str', null ) )`, the returned value will be identical to the original as it is serialized before saving it in the database:
```
array(3) {
[0] => bool(false)
[1] => string(3) "str"
[2] => NULL
}
```
`$option` string Required Name of the option to retrieve. Expected to not be SQL-escaped. `$default` mixed Optional Default value to return if the option does not exist. Default: `false`
mixed Value of the option. A value of any type may be returned, including scalar (string, boolean, float, integer), null, array, object.
Scalar and null values will be returned as strings as long as they originate from a database stored option value. If there is no option in the database, boolean `false` is returned.
A concise list of commonly-used options is below, but a more complete one can be found at the [Option Reference](https://codex.wordpress.org/Option_Reference "Option Reference"). * `'admin_email'` – E-mail address of blog administrator.
* `'blogname'` – Weblog title; set in General Options.
* `'blogdescription'` – Tagline for your blog; set in General Options.
* `'blog_charset'` – Character encoding for your blog; set in Reading Options.
* `'date_format'` – Default date format; set in General Options.
* `'default_category'` – Default post category; set in Writing Options.
* `'home'` – The blog’s home web address; set in General Options.
* `'siteurl'` – WordPress web address; set in General Options. **Warning:** This is not the same as `get_bloginfo( 'url' )` (which will return the homepage url), but as `get_bloginfo( 'wpurl' )`.
* `'template'` – The current theme’s name; set in Presentation.
* `'start_of_week'` – Day of week calendar should start on; set in General Options.
* `'upload_path'` – Default upload location; set in Miscellaneous Options.
* `'users_can_register'` – Whether users can register; set in General Options.
* `'posts_per_page'` – Maximum number of posts to show on a page; set in Reading Options.
* `'posts_per_rss'` – Maximum number of most recent posts to show in the syndication feed; set in Reading Options.
There are many more options available, a lot of which depend on what plugins you have installed. File: `wp-includes/option.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/option.php/)
```
function get_option( $option, $default = false ) {
global $wpdb;
if ( is_scalar( $option ) ) {
$option = trim( $option );
}
if ( empty( $option ) ) {
return false;
}
/*
* Until a proper _deprecated_option() function can be introduced,
* redirect requests to deprecated keys to the new, correct ones.
*/
$deprecated_keys = array(
'blacklist_keys' => 'disallowed_keys',
'comment_whitelist' => 'comment_previously_approved',
);
if ( isset( $deprecated_keys[ $option ] ) && ! wp_installing() ) {
_deprecated_argument(
__FUNCTION__,
'5.5.0',
sprintf(
/* translators: 1: Deprecated option key, 2: New option key. */
__( 'The "%1$s" option key has been renamed to "%2$s".' ),
$option,
$deprecated_keys[ $option ]
)
);
return get_option( $deprecated_keys[ $option ], $default );
}
/**
* Filters the value of an existing option before it is retrieved.
*
* The dynamic portion of the hook name, `$option`, refers to the option name.
*
* Returning a value other than false from the filter will short-circuit retrieval
* and return that value instead.
*
* @since 1.5.0
* @since 4.4.0 The `$option` parameter was added.
* @since 4.9.0 The `$default` parameter was added.
*
* @param mixed $pre_option The value to return instead of the option value. This differs
* from `$default`, which is used as the fallback value in the event
* the option doesn't exist elsewhere in get_option().
* Default false (to skip past the short-circuit).
* @param string $option Option name.
* @param mixed $default The fallback value to return if the option does not exist.
* Default false.
*/
$pre = apply_filters( "pre_option_{$option}", false, $option, $default );
/**
* Filters the value of all existing options before it is retrieved.
*
* Returning a truthy value from the filter will effectively short-circuit retrieval
* and return the passed value instead.
*
* @since 6.1.0
*
* @param mixed $pre_option The value to return instead of the option value. This differs
* from `$default`, which is used as the fallback value in the event
* the option doesn't exist elsewhere in get_option().
* Default false (to skip past the short-circuit).
* @param string $option Name of the option.
* @param mixed $default The fallback value to return if the option does not exist.
* Default false.
*/
$pre = apply_filters( 'pre_option', $pre, $option, $default );
if ( false !== $pre ) {
return $pre;
}
if ( defined( 'WP_SETUP_CONFIG' ) ) {
return false;
}
// Distinguish between `false` as a default, and not passing one.
$passed_default = func_num_args() > 1;
if ( ! wp_installing() ) {
// Prevent non-existent options from triggering multiple queries.
$notoptions = wp_cache_get( 'notoptions', 'options' );
// Prevent non-existent `notoptions` key from triggering multiple key lookups.
if ( ! is_array( $notoptions ) ) {
$notoptions = array();
wp_cache_set( 'notoptions', $notoptions, 'options' );
}
if ( isset( $notoptions[ $option ] ) ) {
/**
* Filters the default value for an option.
*
* The dynamic portion of the hook name, `$option`, refers to the option name.
*
* @since 3.4.0
* @since 4.4.0 The `$option` parameter was added.
* @since 4.7.0 The `$passed_default` parameter was added to distinguish between a `false` value and the default parameter value.
*
* @param mixed $default The default value to return if the option does not exist
* in the database.
* @param string $option Option name.
* @param bool $passed_default Was `get_option()` passed a default value?
*/
return apply_filters( "default_option_{$option}", $default, $option, $passed_default );
}
$alloptions = wp_load_alloptions();
if ( isset( $alloptions[ $option ] ) ) {
$value = $alloptions[ $option ];
} else {
$value = wp_cache_get( $option, 'options' );
if ( false === $value ) {
$row = $wpdb->get_row( $wpdb->prepare( "SELECT option_value FROM $wpdb->options WHERE option_name = %s LIMIT 1", $option ) );
// Has to be get_row() instead of get_var() because of funkiness with 0, false, null values.
if ( is_object( $row ) ) {
$value = $row->option_value;
wp_cache_add( $option, $value, 'options' );
} else { // Option does not exist, so we must cache its non-existence.
if ( ! is_array( $notoptions ) ) {
$notoptions = array();
}
$notoptions[ $option ] = true;
wp_cache_set( 'notoptions', $notoptions, 'options' );
/** This filter is documented in wp-includes/option.php */
return apply_filters( "default_option_{$option}", $default, $option, $passed_default );
}
}
}
} else {
$suppress = $wpdb->suppress_errors();
$row = $wpdb->get_row( $wpdb->prepare( "SELECT option_value FROM $wpdb->options WHERE option_name = %s LIMIT 1", $option ) );
$wpdb->suppress_errors( $suppress );
if ( is_object( $row ) ) {
$value = $row->option_value;
} else {
/** This filter is documented in wp-includes/option.php */
return apply_filters( "default_option_{$option}", $default, $option, $passed_default );
}
}
// If home is not set, use siteurl.
if ( 'home' === $option && '' === $value ) {
return get_option( 'siteurl' );
}
if ( in_array( $option, array( 'siteurl', 'home', 'category_base', 'tag_base' ), true ) ) {
$value = untrailingslashit( $value );
}
/**
* Filters the value of an existing option.
*
* The dynamic portion of the hook name, `$option`, refers to the option name.
*
* @since 1.5.0 As 'option_' . $setting
* @since 3.0.0
* @since 4.4.0 The `$option` parameter was added.
*
* @param mixed $value Value of the option. If stored serialized, it will be
* unserialized prior to being returned.
* @param string $option Option name.
*/
return apply_filters( "option_{$option}", maybe_unserialize( $value ), $option );
}
```
[apply\_filters( "default\_option\_{$option}", mixed $default, string $option, bool $passed\_default )](../hooks/default_option_option)
Filters the default value for an option.
[apply\_filters( "option\_{$option}", mixed $value, string $option )](../hooks/option_option)
Filters the value of an existing option.
[apply\_filters( 'pre\_option', mixed $pre\_option, string $option, mixed $default )](../hooks/pre_option)
Filters the value of all existing options before it is retrieved.
[apply\_filters( "pre\_option\_{$option}", mixed $pre\_option, string $option, mixed $default )](../hooks/pre_option_option)
Filters the value of an existing option before it is retrieved.
| 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\_cache\_add()](wp_cache_add) wp-includes/cache.php | Adds data to the cache, if the cache key doesn’t already exist. |
| [untrailingslashit()](untrailingslashit) wp-includes/formatting.php | Removes trailing forward slashes and backslashes if they exist. |
| [maybe\_unserialize()](maybe_unserialize) wp-includes/functions.php | Unserializes data only if it was serialized. |
| [wp\_load\_alloptions()](wp_load_alloptions) wp-includes/option.php | Loads and caches all autoloaded options, if available or all options. |
| [wpdb::get\_row()](../classes/wpdb/get_row) wp-includes/class-wpdb.php | Retrieves one row from the database. |
| [wpdb::suppress\_errors()](../classes/wpdb/suppress_errors) wp-includes/class-wpdb.php | Enables or disables suppressing of database errors. |
| [wp\_cache\_get()](wp_cache_get) wp-includes/cache.php | Retrieves the cache contents from the cache by key and group. |
| [\_\_()](__) 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. |
| [get\_option()](get_option) wp-includes/option.php | Retrieves an option value based on an option name. |
| [wpdb::prepare()](../classes/wpdb/prepare) wp-includes/class-wpdb.php | Prepares a SQL query for safe execution. |
| Used By | Description |
| --- | --- |
| [IXR\_Server::output()](../classes/ixr_server/output) wp-includes/IXR/class-IXR-server.php | |
| [\_resolve\_home\_block\_template()](_resolve_home_block_template) wp-includes/block-template.php | Returns the correct template for the site’s home page. |
| [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\_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. |
| [WP\_REST\_Menus\_Controller::get\_menu\_auto\_add()](../classes/wp_rest_menus_controller/get_menu_auto_add) wp-includes/rest-api/endpoints/class-wp-rest-menus-controller.php | Returns the value of a menu’s auto\_add setting. |
| [WP\_REST\_Menus\_Controller::handle\_auto\_add()](../classes/wp_rest_menus_controller/handle_auto_add) wp-includes/rest-api/endpoints/class-wp-rest-menus-controller.php | Updates the menu’s auto add from a REST request. |
| [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\_default\_block\_editor\_settings()](get_default_block_editor_settings) wp-includes/block-editor.php | Returns the default block editor settings. |
| [build\_query\_vars\_from\_query\_block()](build_query_vars_from_query_block) wp-includes/blocks.php | Helper function that constructs a [WP\_Query](../classes/wp_query) args array from a `Query` block properties. |
| [deactivated\_plugins\_notice()](deactivated_plugins_notice) wp-admin/includes/plugin.php | Renders an admin notice when a plugin was deactivated during an update. |
| [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\_no\_robots()](wp_robots_no_robots) wp-includes/robots-template.php | Adds `noindex` to the robots meta tag. |
| [wp\_robots\_max\_image\_preview\_large()](wp_robots_max_image_preview_large) wp-includes/robots-template.php | Adds `max-image-preview:large` to the robots meta tag. |
| [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. |
| [wp\_is\_https\_supported()](wp_is_https_supported) wp-includes/https-detection.php | Checks whether HTTPS is supported for the server and domain. |
| [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\_update\_https\_migration\_required()](wp_update_https_migration_required) wp-includes/https-migration.php | Updates the ‘https\_migration\_required’ option if needed when the given URL has been updated from HTTP to HTTPS. |
| [get\_media\_states()](get_media_states) wp-admin/includes/template.php | Retrieves an array of media states from an attachment. |
| [\_wp\_batch\_update\_comment\_type()](_wp_batch_update_comment_type) wp-includes/comment.php | Updates the comment type for a batch of comments. |
| [wp\_check\_comment\_disallowed\_list()](wp_check_comment_disallowed_list) wp-includes/comment.php | Checks if a comment contains disallowed characters or words. |
| [WP\_Sitemaps::sitemaps\_enabled()](../classes/wp_sitemaps/sitemaps_enabled) wp-includes/sitemaps/class-wp-sitemaps.php | Determines whether sitemaps are enabled or not. |
| [WP\_Sitemaps\_Posts::get\_url\_list()](../classes/wp_sitemaps_posts/get_url_list) wp-includes/sitemaps/providers/class-wp-sitemaps-posts.php | Gets a URL list for a post type sitemap. |
| [WP\_Sitemaps\_Posts::get\_max\_num\_pages()](../classes/wp_sitemaps_posts/get_max_num_pages) wp-includes/sitemaps/providers/class-wp-sitemaps-posts.php | Gets the max number of pages available for the object type. |
| [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\_timezone\_string()](wp_timezone_string) wp-includes/functions.php | Retrieves the timezone of the site as a string. |
| [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. |
| [get\_post\_states()](get_post_states) wp-admin/includes/template.php | Retrieves an array of post states from a post. |
| [WP\_Recovery\_Mode\_Key\_Service::get\_keys()](../classes/wp_recovery_mode_key_service/get_keys) wp-includes/class-wp-recovery-mode-key-service.php | Gets the recovery key records. |
| [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\_recovery\_mode\_email\_address()](../classes/wp_recovery_mode_email_service/get_recovery_mode_email_address) wp-includes/class-wp-recovery-mode-email-service.php | Gets the email address to send the recovery mode link to. |
| [WP\_Query::is\_privacy\_policy()](../classes/wp_query/is_privacy_policy) wp-includes/class-wp-query.php | Is the query for the Privacy Policy page? |
| [WP\_Paused\_Extensions\_Storage::set()](../classes/wp_paused_extensions_storage/set) wp-includes/class-wp-paused-extensions-storage.php | Records an extension error. |
| [WP\_Paused\_Extensions\_Storage::delete()](../classes/wp_paused_extensions_storage/delete) wp-includes/class-wp-paused-extensions-storage.php | Forgets a previously recorded extension error. |
| [WP\_Paused\_Extensions\_Storage::get\_all()](../classes/wp_paused_extensions_storage/get_all) wp-includes/class-wp-paused-extensions-storage.php | Gets the paused extensions with their errors. |
| [WP\_Paused\_Extensions\_Storage::delete\_all()](../classes/wp_paused_extensions_storage/delete_all) wp-includes/class-wp-paused-extensions-storage.php | Remove all paused extensions. |
| [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. |
| [populate\_network\_meta()](populate_network_meta) wp-admin/includes/schema.php | Creates WordPress network meta and sets the default values. |
| [wp\_check\_term\_meta\_support\_prefilter()](wp_check_term_meta_support_prefilter) wp-includes/taxonomy.php | Aborts calls to term meta if it is not supported. |
| [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\_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. |
| [get\_the\_privacy\_policy\_link()](get_the_privacy_policy_link) wp-includes/link-template.php | Returns the privacy policy link with formatting, when applicable. |
| [get\_privacy\_policy\_url()](get_privacy_policy_url) wp-includes/link-template.php | Retrieves the URL to the privacy policy page. |
| [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::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::text\_change\_check()](../classes/wp_privacy_policy_content/text_change_check) wp-admin/includes/class-wp-privacy-policy-content.php | Quick check if any privacy info has changed. |
| [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\_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\_Roles::get\_roles\_data()](../classes/wp_roles/get_roles_data) wp-includes/class-wp-roles.php | Gets the available roles data. |
| [\_wp\_menus\_changed()](_wp_menus_changed) wp-includes/nav-menu.php | Handles menu config after theme change. |
| [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\_Customize\_Date\_Time\_Control::content\_template()](../classes/wp_customize_date_time_control/content_template) wp-includes/customize/class-wp-customize-date-time-control.php | Renders a JS template for the content of date time control. |
| [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\_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\_localize\_community\_events()](wp_localize_community_events) wp-includes/script-loader.php | Localizes community events data that needs to be passed to dashboard.js. |
| [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\_Customize\_Manager::update\_stashed\_theme\_mod\_settings()](../classes/wp_customize_manager/update_stashed_theme_mod_settings) wp-includes/class-wp-customize-manager.php | Updates stashed theme mod settings. |
| [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\_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\_Settings\_Controller::get\_item()](../classes/wp_rest_settings_controller/get_item) wp-includes/rest-api/endpoints/class-wp-rest-settings-controller.php | Retrieves the settings. |
| [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\_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::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::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\_Taxonomy::set\_props()](../classes/wp_taxonomy/set_props) wp-includes/class-wp-taxonomy.php | Sets taxonomy properties. |
| [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\_localize\_jquery\_ui\_datepicker()](wp_localize_jquery_ui_datepicker) wp-includes/script-loader.php | Localizes the jQuery UI datepicker. |
| [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. |
| [WP\_Post\_Type::set\_props()](../classes/wp_post_type/set_props) wp-includes/class-wp-post-type.php | Sets post type properties. |
| [WP\_Site::get\_details()](../classes/wp_site/get_details) wp-includes/class-wp-site.php | Retrieves the details for this site. |
| [wp\_get\_canonical\_url()](wp_get_canonical_url) wp-includes/link-template.php | Returns the canonical URL for a post. |
| [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. |
| [\_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. |
| [WP\_Upgrader::create\_lock()](../classes/wp_upgrader/create_lock) wp-admin/includes/class-wp-upgrader.php | Creates a lock using WordPress options. |
| [get\_rest\_url()](get_rest_url) wp-includes/rest-api.php | Retrieves the URL to a REST endpoint on a site. |
| [\_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. |
| [get\_post\_embed\_url()](get_post_embed_url) wp-includes/embed.php | Retrieves the URL to embed a specific post in an iframe. |
| [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\_Setting::get\_root\_value()](../classes/wp_customize_setting/get_root_value) wp-includes/class-wp-customize-setting.php | Get the root value for a setting, especially for multidimensional ones. |
| [wp\_term\_is\_shared()](wp_term_is_shared) wp-includes/taxonomy.php | Determines whether a term is shared between multiple taxonomies. |
| [WP\_REST\_Server::get\_index()](../classes/wp_rest_server/get_index) wp-includes/rest-api/class-wp-rest-server.php | Retrieves the site index. |
| [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\_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\_new\_comment\_notify\_postauthor()](wp_new_comment_notify_postauthor) wp-includes/comment.php | Sends a notification of a new comment to the post author. |
| [get\_network\_option()](get_network_option) wp-includes/option.php | Retrieves a network’s option value based on the option name. |
| [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\_ajax\_delete\_inactive\_widgets()](wp_ajax_delete_inactive_widgets) wp-admin/includes/ajax-actions.php | Ajax handler for removing inactive widgets. |
| [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\_Setting::value()](../classes/wp_customize_nav_menu_setting/value) wp-includes/customize/class-wp-customize-nav-menu-setting.php | Get the instance data for a given widget setting. |
| [\_wp\_batch\_split\_terms()](_wp_batch_split_terms) wp-includes/taxonomy.php | Splits a batch of shared taxonomy terms. |
| [get\_language\_attributes()](get_language_attributes) wp-includes/general-template.php | Gets the language attributes for the ‘html’ tag. |
| [get\_site\_icon\_url()](get_site_icon_url) wp-includes/general-template.php | Returns the Site Icon URL. |
| [format\_for\_editor()](format_for_editor) wp-includes/formatting.php | Formats text for the editor. |
| [get\_default\_comment\_status()](get_default_comment_status) wp-includes/comment.php | Gets the default comment status for a post type. |
| [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\_resolve\_numeric\_slug\_conflicts()](wp_resolve_numeric_slug_conflicts) wp-includes/rewrite.php | Resolves numeric slugs that collide with date permalinks. |
| [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\_Site\_Icon::delete\_attachment\_data()](../classes/wp_site_icon/delete_attachment_data) wp-admin/includes/class-wp-site-icon.php | Deletes the Site Icon when the image file is deleted. |
| [WP\_Site\_Icon::get\_post\_metadata()](../classes/wp_site_icon/get_post_metadata) wp-admin/includes/class-wp-site-icon.php | Adds custom image sizes when meta data for an image is requested, that happens to be used as Site Icon. |
| [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\_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\_get\_split\_terms()](wp_get_split_terms) wp-includes/taxonomy.php | Gets data about terms that previously shared a single term\_id, but have since been split. |
| [get\_avatar\_data()](get_avatar_data) wp-includes/link-template.php | Retrieves default data about the avatar. |
| [wp\_install\_maybe\_enable\_pretty\_permalinks()](wp_install_maybe_enable_pretty_permalinks) wp-admin/includes/upgrade.php | Maybe enable pretty permalinks on installation. |
| [retrieve\_password()](retrieve_password) wp-includes/user.php | Handles sending a password retrieval email to a user. |
| [trackback\_response()](trackback_response) wp-trackback.php | Response to a trackback. |
| [allow\_subdomain\_install()](allow_subdomain_install) wp-admin/includes/network.php | Allow subdomain installation |
| [get\_clean\_basedomain()](get_clean_basedomain) wp-admin/includes/network.php | Get base domain of network. |
| [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. |
| [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. |
| [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\_Plugins\_List\_Table::prepare\_items()](../classes/wp_plugins_list_table/prepare_items) wp-admin/includes/class-wp-plugins-list-table.php | |
| [export\_wp()](export_wp) wp-admin/includes/export.php | Generates the WXR export file for download. |
| [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. |
| [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. |
| [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\_save\_image()](wp_save_image) wp-admin/includes/image-edit.php | Saves image to post, along with enqueued changes in `$_REQUEST['history']`. |
| [wpmu\_delete\_blog()](wpmu_delete_blog) wp-admin/includes/ms.php | Delete a site. |
| [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. |
| [update\_recently\_edited()](update_recently_edited) wp-admin/includes/misc.php | Updates the “recently-edited” file for the plugin or theme file editor. |
| [wp\_dashboard\_rss\_output()](wp_dashboard_rss_output) wp-admin/includes/dashboard.php | Display generic dashboard RSS widget feed. |
| [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\_right\_now()](wp_dashboard_right_now) wp-admin/includes/dashboard.php | Dashboard widget that displays some basic stats about the site. |
| [\_wp\_dashboard\_recent\_comments\_row()](_wp_dashboard_recent_comments_row) wp-admin/includes/dashboard.php | Outputs a row for the Recent Comments widget. |
| [maybe\_disable\_link\_manager()](maybe_disable_link_manager) wp-admin/includes/upgrade.php | Disables the Link Manager on upgrade if, at the time of upgrade, no links exist in the DB. |
| [wp\_install\_defaults()](wp_install_defaults) wp-admin/includes/upgrade.php | Creates the initial content for a newly-installed site. |
| [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. |
| [is\_plugin\_active()](is_plugin_active) wp-admin/includes/plugin.php | Determines whether a plugin is active. |
| [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\_admin\_html\_begin()](_wp_admin_html_begin) wp-admin/includes/template.php | Prints out the beginning of the admin HTML header. |
| [get\_settings\_errors()](get_settings_errors) wp-admin/includes/template.php | Fetches settings errors registered by [add\_settings\_error()](add_settings_error) . |
| [iframe\_header()](iframe_header) wp-admin/includes/template.php | Generic Iframe header for use with Thickbox. |
| [WP\_Themes\_List\_Table::prepare\_items()](../classes/wp_themes_list_table/prepare_items) wp-admin/includes/class-wp-themes-list-table.php | |
| [wp\_media\_insert\_url\_form()](wp_media_insert_url_form) wp-admin/includes/media.php | Creates the form for external url. |
| [media\_upload\_max\_image\_resize()](media_upload_max_image_resize) wp-admin/includes/media.php | Displays the checkbox to scale images. |
| [get\_attachment\_fields\_to\_edit()](get_attachment_fields_to_edit) wp-admin/includes/media.php | Retrieves the attachment fields to edit form fields. |
| [media\_upload\_form()](media_upload_form) wp-admin/includes/media.php | Outputs the legacy media upload form. |
| [get\_sample\_permalink\_html()](get_sample_permalink_html) wp-admin/includes/post.php | Returns the HTML of the sample permalink slug editor. |
| [\_fix\_attachment\_links()](_fix_attachment_links) wp-admin/includes/post.php | Replaces hrefs of attachment anchors with up-to-date permalinks. |
| [wp\_edit\_posts\_query()](wp_edit_posts_query) wp-admin/includes/post.php | Runs the query to fetch the posts for listing on the edit posts page. |
| [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\_prepare\_revisions\_for\_js()](wp_prepare_revisions_for_js) wp-admin/includes/revision.php | Prepare revisions for JavaScript. |
| [page\_attributes\_meta\_box()](page_attributes_meta_box) wp-admin/includes/meta-boxes.php | Displays page attributes 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\_set\_link\_cats()](wp_set_link_cats) wp-admin/includes/bookmark.php | Update link with the specified link categories. |
| [WP\_Comments\_List\_Table::\_\_construct()](../classes/wp_comments_list_table/__construct) wp-admin/includes/class-wp-comments-list-table.php | Constructor. |
| [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\_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. |
| [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. |
| [get\_home\_path()](get_home_path) wp-admin/includes/file.php | Gets the absolute filesystem path to the root of the WordPress installation. |
| [WP\_Posts\_List\_Table::\_\_construct()](../classes/wp_posts_list_table/__construct) wp-admin/includes/class-wp-posts-list-table.php | Constructor. |
| [options\_reading\_blog\_charset()](options_reading_blog_charset) wp-admin/includes/options.php | Render the site charset setting. |
| [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\_Roles::remove\_role()](../classes/wp_roles/remove_role) wp-includes/class-wp-roles.php | Removes a role by name. |
| [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::setup\_theme()](../classes/wp_customize_manager/setup_theme) wp-includes/class-wp-customize-manager.php | Starts preview and customize theme. |
| [\_get\_cron\_array()](_get_cron_array) wp-includes/cron.php | Retrieve cron info array option. |
| [wp\_list\_categories()](wp_list_categories) wp-includes/category-template.php | Displays or retrieves the HTML list of categories. |
| [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. |
| [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. |
| [remove\_theme\_mods()](remove_theme_mods) wp-includes/theme.php | Removes theme modifications option for the active theme. |
| [get\_uploaded\_header\_images()](get_uploaded_header_images) wp-includes/theme.php | Gets the header images uploaded for the active theme. |
| [get\_theme\_root\_uri()](get_theme_root_uri) wp-includes/theme.php | Retrieves URI for themes directory. |
| [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. |
| [switch\_theme()](switch_theme) wp-includes/theme.php | Switches the theme. |
| [get\_theme\_mods()](get_theme_mods) wp-includes/theme.php | Retrieves all theme modifications. |
| [get\_template()](get_template) wp-includes/theme.php | Retrieves name of the active theme. |
| [get\_stylesheet()](get_stylesheet) wp-includes/theme.php | Retrieves name of the current stylesheet. |
| [get\_locale()](get_locale) wp-includes/l10n.php | Retrieves the current locale. |
| [esc\_textarea()](esc_textarea) wp-includes/formatting.php | Escaping for textarea values. |
| [sanitize\_option()](sanitize_option) wp-includes/formatting.php | Sanitizes various option values based on the nature of the option. |
| [wp\_htmledit\_pre()](wp_htmledit_pre) wp-includes/deprecated.php | Formats text for the HTML editor. |
| [wp\_richedit\_pre()](wp_richedit_pre) wp-includes/deprecated.php | Formats text for the rich text editor. |
| [wp\_trim\_words()](wp_trim_words) wp-includes/formatting.php | Trims text to a certain number of words. |
| [convert\_smilies()](convert_smilies) wp-includes/formatting.php | Converts text equivalent of smilies to images. |
| [balanceTags()](balancetags) wp-includes/formatting.php | Balances tags if forced to, or if the ‘use\_balanceTags’ option is set to true. |
| [get\_avatar()](get_avatar) wp-includes/pluggable.php | Retrieves the avatar `<img>` tag for a user, email address, MD5 hash, comment, or post. |
| [wp\_check\_invalid\_utf8()](wp_check_invalid_utf8) wp-includes/formatting.php | Checks for invalid UTF8 in a string. |
| [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\_set\_auth\_cookie()](wp_set_auth_cookie) wp-includes/pluggable.php | Sets the authentication cookies based on user ID. |
| [noindex()](noindex) wp-includes/deprecated.php | Displays a `noindex` meta tag if required by the blog configuration. |
| [wp\_no\_robots()](wp_no_robots) wp-includes/deprecated.php | Display a `noindex` meta tag. |
| [get\_the\_modified\_date()](get_the_modified_date) wp-includes/general-template.php | Retrieves the date on which the post was last modified. |
| [get\_the\_time()](get_the_time) wp-includes/general-template.php | Retrieves the time at which the post was written. |
| [get\_the\_modified\_time()](get_the_modified_time) wp-includes/general-template.php | Retrieves the time at which the post was last modified. |
| [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\_the\_date()](get_the_date) wp-includes/general-template.php | Retrieves the date on which the post was written. |
| [get\_bloginfo()](get_bloginfo) wp-includes/general-template.php | Retrieves information about the current site. |
| [wp\_register()](wp_register) wp-includes/general-template.php | Displays the Registration or Admin link. |
| [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. |
| [get\_current\_theme()](get_current_theme) wp-includes/deprecated.php | Retrieve current theme name. |
| [make\_url\_footnote()](make_url_footnote) wp-includes/deprecated.php | Strip HTML and put links at the bottom of stripped content. |
| [get\_settings()](get_settings) wp-includes/deprecated.php | Get value based on option. |
| [get\_links()](get_links) wp-includes/deprecated.php | Gets the links associated with category by ID. |
| [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::send\_headers()](../classes/wp/send_headers) wp-includes/class-wp.php | Sends additional HTTP headers for caching, content type, etc. |
| [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\_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. |
| [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\_set\_internal\_encoding()](wp_set_internal_encoding) wp-includes/load.php | Set internal encoding. |
| [wp\_get\_active\_and\_valid\_plugins()](wp_get_active_and_valid_plugins) wp-includes/load.php | Retrieve an array of active and valid plugin files. |
| [WP\_HTTP\_Proxy::send\_through\_proxy()](../classes/wp_http_proxy/send_through_proxy) wp-includes/class-wp-http-proxy.php | Determines whether the request should be sent through a proxy. |
| [WP\_Http::block\_request()](../classes/wp_http/block_request) wp-includes/class-wp-http.php | Determines whether an HTTP API request to the given URL should be blocked. |
| [wp\_timezone\_override\_offset()](wp_timezone_override_offset) wp-includes/functions.php | Modifies gmt\_offset for smart timezone handling. |
| [wp\_send\_json()](wp_send_json) wp-includes/functions.php | Sends a JSON response back to an Ajax request. |
| [smilies\_init()](smilies_init) wp-includes/functions.php | Converts smiley code to the icon graphic file equivalent. |
| [do\_robots()](do_robots) wp-includes/functions.php | Displays the default robots.txt file content. |
| [get\_weekstartend()](get_weekstartend) wp-includes/functions.php | Gets the week start and end from the datetime or date string from MySQL. |
| [current\_time()](current_time) wp-includes/functions.php | Retrieves the current time based on specified type. |
| [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::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\_rss\_output()](wp_widget_rss_output) wp-includes/widgets.php | Display the RSS entries in a list. |
| [wp\_widgets\_init()](wp_widgets_init) wp-includes/widgets.php | Registers all of the default WordPress widgets on startup. |
| [\_get\_term\_hierarchy()](_get_term_hierarchy) wp-includes/taxonomy.php | Retrieves children of taxonomy as term IDs. |
| [wp\_unique\_term\_slug()](wp_unique_term_slug) wp-includes/taxonomy.php | Makes term slug unique, if it isn’t already. |
| [wp\_delete\_term()](wp_delete_term) wp-includes/taxonomy.php | Removes a term from the database. |
| [wp\_cookie\_constants()](wp_cookie_constants) wp-includes/default-constants.php | Defines cookie-related WordPress constants. |
| [wp\_ssl\_constants()](wp_ssl_constants) wp-includes/default-constants.php | Defines SSL-related WordPress constants. |
| [create\_initial\_taxonomies()](create_initial_taxonomies) wp-includes/taxonomy.php | Creates the initial taxonomies. |
| [wp\_plugin\_directory\_constants()](wp_plugin_directory_constants) wp-includes/default-constants.php | Defines plugin directory WordPress constants. |
| [wp\_get\_shortlink()](wp_get_shortlink) wp-includes/link-template.php | Returns a shortlink for a post, page, attachment, or site. |
| [get\_comments\_pagenum\_link()](get_comments_pagenum_link) wp-includes/link-template.php | Retrieves the comments page number link. |
| [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\_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\_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. |
| [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\_type\_archive\_feed\_link()](get_post_type_archive_feed_link) wp-includes/link-template.php | Retrieves the permalink for a post type archive feed. |
| [get\_term\_feed\_link()](get_term_feed_link) wp-includes/link-template.php | Retrieves the feed link for a term. |
| [get\_post\_comments\_feed\_link()](get_post_comments_feed_link) wp-includes/link-template.php | Retrieves the permalink for the post comments feed. |
| [get\_author\_feed\_link()](get_author_feed_link) wp-includes/link-template.php | Retrieves the feed link for a given author. |
| [get\_permalink()](get_permalink) wp-includes/link-template.php | Retrieves the full permalink for the current post or post ID. |
| [get\_page\_link()](get_page_link) wp-includes/link-template.php | Retrieves the permalink for the current page or page ID. |
| [get\_attachment\_link()](get_attachment_link) wp-includes/link-template.php | Retrieves the permalink for an attachment. |
| [WP\_Ajax\_Response::send()](../classes/wp_ajax_response/send) wp-includes/class-wp-ajax-response.php | Display XML formatted responses. |
| [wp\_http\_validate\_url()](wp_http_validate_url) wp-includes/http.php | Validate a URL for safe use in the HTTP API. |
| [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\_admin\_bar\_edit\_menu()](wp_admin_bar_edit_menu) wp-includes/admin-bar.php | Provides an edit link for posts and terms. |
| [register\_uninstall\_hook()](register_uninstall_hook) wp-includes/plugin.php | Sets the uninstallation hook for a plugin. |
| [get\_the\_category\_rss()](get_the_category_rss) wp-includes/feed.php | Retrieves all of the post categories, formatted for use in feeds. |
| [fetch\_feed()](fetch_feed) wp-includes/feed.php | Builds SimplePie object based on RSS or Atom feed from URL. |
| [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. |
| [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. |
| [form\_option()](form_option) wp-includes/option.php | Prints option value after sanitizing for forms. |
| [wp\_update\_user()](wp_update_user) wp-includes/user.php | Updates a user in the database. |
| [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. |
| [get\_blogs\_of\_user()](get_blogs_of_user) wp-includes/user.php | Gets the sites a user belongs to. |
| [\_walk\_bookmarks()](_walk_bookmarks) wp-includes/bookmark-template.php | The formatted output of a list of bookmarks. |
| [\_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. |
| [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\_link\_page()](_wp_link_page) wp-includes/post-template.php | Helper function for [wp\_link\_pages()](wp_link_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. |
| [wp\_enqueue\_media()](wp_enqueue_media) wp-includes/media.php | Enqueues all scripts, styles, settings, and templates necessary to use all media JS APIs. |
| [image\_constrain\_size\_for\_editor()](image_constrain_size_for_editor) wp-includes/media.php | Scales down the default size of an image. |
| [\_publish\_post\_hook()](_publish_post_hook) wp-includes/post.php | Hook to schedule pings and enclosures when a post is published. |
| [wp\_publish\_post()](wp_publish_post) wp-includes/post.php | Publishes a post by transitioning the post status. |
| [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\_insert\_post()](wp_insert_post) wp-includes/post.php | Inserts or update a post. |
| [\_reset\_front\_page\_settings\_for\_post()](_reset_front_page_settings_for_post) wp-includes/post.php | Resets the page\_on\_front, show\_on\_front, and page\_for\_post settings when a linked page is deleted or trashed. |
| [is\_sticky()](is_sticky) wp-includes/post.php | Determines whether a post is sticky. |
| [stick\_post()](stick_post) wp-includes/post.php | Makes a post sticky. |
| [unstick\_post()](unstick_post) wp-includes/post.php | Un-sticks a post. |
| [WP\_Rewrite::init()](../classes/wp_rewrite/init) wp-includes/class-wp-rewrite.php | Sets up the object’s properties. |
| [WP\_Rewrite::set\_category\_base()](../classes/wp_rewrite/set_category_base) wp-includes/class-wp-rewrite.php | Sets the category base for the category permalink. |
| [WP\_Rewrite::set\_tag\_base()](../classes/wp_rewrite/set_tag_base) wp-includes/class-wp-rewrite.php | Sets the tag base for the tag permalink. |
| [WP\_Rewrite::wp\_rewrite\_rules()](../classes/wp_rewrite/wp_rewrite_rules) wp-includes/class-wp-rewrite.php | Retrieves the rewrite rules. |
| [WP\_Rewrite::generate\_rewrite\_rules()](../classes/wp_rewrite/generate_rewrite_rules) wp-includes/class-wp-rewrite.php | Generates rewrite rules from a permalink structure. |
| [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\_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. |
| [get\_space\_allowed()](get_space_allowed) wp-includes/ms-functions.php | Returns the upload quota for the current blog. |
| [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}/. |
| [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. |
| [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\_blog\_option()](get_blog_option) wp-includes/ms-blogs.php | Retrieve option value for a given blog id based on name of option. |
| [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\_auto\_add\_pages\_to\_menu()](_wp_auto_add_pages_to_menu) wp-includes/nav-menu.php | Automatically add newly published page objects to menus with that as an option. |
| [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::\_getOptions()](../classes/wp_xmlrpc_server/_getoptions) wp-includes/class-wp-xmlrpc-server.php | Retrieve blog options value from list. |
| [wp\_xmlrpc\_server::blogger\_getUsersBlogs()](../classes/wp_xmlrpc_server/blogger_getusersblogs) wp-includes/class-wp-xmlrpc-server.php | Retrieve blogs that user owns. |
| [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\_getUsersBlogs()](../classes/wp_xmlrpc_server/wp_getusersblogs) wp-includes/class-wp-xmlrpc-server.php | Retrieve the blogs of the user. |
| [ms\_cookie\_constants()](ms_cookie_constants) wp-includes/ms-default-constants.php | Defines Multisite cookie constants. |
| [WP\_Widget::get\_settings()](../classes/wp_widget/get_settings) wp-includes/class-wp-widget.php | Retrieves the settings for all instances of the widget class. |
| [is\_dynamic\_sidebar()](is_dynamic_sidebar) wp-includes/widgets.php | Determines whether the dynamic sidebar is enabled and used by the theme. |
| [wp\_get\_sidebars\_widgets()](wp_get_sidebars_widgets) wp-includes/widgets.php | Retrieve full list of sidebars and their widget instance IDs. |
| [wp\_convert\_widget\_settings()](wp_convert_widget_settings) wp-includes/widgets.php | Converts the widget settings from single to multi-widget format. |
| [get\_post\_reply\_link()](get_post_reply_link) wp-includes/comment-template.php | Retrieves HTML content for reply to post link. |
| [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. |
| [get\_trackback\_url()](get_trackback_url) wp-includes/comment-template.php | Retrieves the current post’s trackback URL. |
| [comments\_template()](comments_template) wp-includes/comment-template.php | Loads the comment template specified in $file. |
| [get\_comment\_reply\_link()](get_comment_reply_link) wp-includes/comment-template.php | Retrieves HTML content for reply to comment link. |
| [get\_comment\_link()](get_comment_link) wp-includes/comment-template.php | Retrieves the link to a given comment. |
| [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\_Customize\_Widgets::preview\_sidebars\_widgets()](../classes/wp_customize_widgets/preview_sidebars_widgets) wp-includes/class-wp-customize-widgets.php | When previewing, ensures the proper previewing widgets are used. |
| [privacy\_ping\_filter()](privacy_ping_filter) wp-includes/comment.php | Checks whether blog is public before returning sites. |
| [trackback()](trackback) wp-includes/comment.php | Sends a Trackback. |
| [weblog\_ping()](weblog_ping) wp-includes/comment.php | Sends a pingback. |
| [\_close\_comments\_for\_old\_posts()](_close_comments_for_old_posts) wp-includes/comment.php | Closes comments on old posts on the fly, without any extra DB queries. Hooked to the\_posts. |
| [\_close\_comments\_for\_old\_post()](_close_comments_for_old_post) wp-includes/comment.php | Closes comments on an old post. Hooked to comments\_open and pings\_open. |
| [generic\_ping()](generic_ping) wp-includes/comment.php | Sends pings to all of the ping site services. |
| [get\_comment\_pages\_count()](get_comment_pages_count) wp-includes/comment.php | Calculates the total number of comment pages. |
| [get\_page\_of\_comment()](get_page_of_comment) wp-includes/comment.php | Calculates what page number a comment will appear on for comment paging. |
| [check\_comment()](check_comment) wp-includes/comment.php | Checks whether a comment passes internal checks to be allowed to add. |
| Version | Description |
| --- | --- |
| [1.5.0](https://developer.wordpress.org/reference/since/1.5.0/) | Introduced. |
| programming_docs |
wordpress print_admin_styles(): array print\_admin\_styles(): array
=============================
Prints the styles queue in the HTML head on admin pages.
array
File: `wp-includes/script-loader.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/script-loader.php/)
```
function print_admin_styles() {
global $concatenate_scripts;
$wp_styles = wp_styles();
script_concat_settings();
$wp_styles->do_concat = $concatenate_scripts;
$wp_styles->do_items( false );
/**
* Filters whether to print the admin styles.
*
* @since 2.8.0
*
* @param bool $print Whether to print the admin styles. Default true.
*/
if ( apply_filters( 'print_admin_styles', true ) ) {
_print_styles();
}
$wp_styles->reset();
return $wp_styles->done;
}
```
[apply\_filters( 'print\_admin\_styles', bool $print )](../hooks/print_admin_styles)
Filters whether to print the admin styles.
| Uses | Description |
| --- | --- |
| [wp\_styles()](wp_styles) wp-includes/functions.wp-styles.php | Initialize $wp\_styles if it has not been set. |
| [WP\_Styles::reset()](../classes/wp_styles/reset) wp-includes/class-wp-styles.php | Resets class properties. |
| [script\_concat\_settings()](script_concat_settings) wp-includes/script-loader.php | Determines the concatenation and compression settings for scripts and styles. |
| [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 add_clean_index( string $table, string $index ): true add\_clean\_index( string $table, string $index ): true
=======================================================
Adds an index to a specified table.
`$table` string Required Database table name. `$index` string Required Database table index column. true True, when done with execution.
File: `wp-admin/includes/upgrade.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/upgrade.php/)
```
function add_clean_index( $table, $index ) {
global $wpdb;
drop_index( $table, $index );
$wpdb->query( "ALTER TABLE `$table` ADD INDEX ( `$index` )" );
return true;
}
```
| Uses | Description |
| --- | --- |
| [drop\_index()](drop_index) wp-admin/includes/upgrade.php | Drops a specified index from a table. |
| [wpdb::query()](../classes/wpdb/query) wp-includes/class-wpdb.php | Performs a database query, using current database connection. |
| Version | Description |
| --- | --- |
| [1.0.1](https://developer.wordpress.org/reference/since/1.0.1/) | Introduced. |
wordpress clear_global_post_cache( int $post_id ) clear\_global\_post\_cache( int $post\_id )
===========================================
This function has been deprecated. Use [clean\_post\_cache()](clean_post_cache) instead.
Deprecated functionality to clear the global post cache.
* [clean\_post\_cache()](clean_post_cache)
`$post_id` int Required Post ID. File: `wp-includes/ms-deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/ms-deprecated.php/)
```
function clear_global_post_cache( $post_id ) {
_deprecated_function( __FUNCTION__, '3.0.0', 'clean_post_cache()' );
}
```
| 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.0.0](https://developer.wordpress.org/reference/since/3.0.0/) | Use [clean\_post\_cache()](clean_post_cache) |
| [MU (3.0.0)](https://developer.wordpress.org/reference/since/mu.3.0.0/) | Introduced. |
wordpress delete_all_user_settings() delete\_all\_user\_settings()
=============================
Deletes the user settings of the current user.
File: `wp-includes/option.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/option.php/)
```
function delete_all_user_settings() {
$user_id = get_current_user_id();
if ( ! $user_id ) {
return;
}
update_user_option( $user_id, 'user-settings', '', false );
setcookie( 'wp-settings-' . $user_id, ' ', time() - YEAR_IN_SECONDS, SITECOOKIEPATH );
}
```
| Uses | Description |
| --- | --- |
| [update\_user\_option()](update_user_option) wp-includes/user.php | Updates user option with global blog capability. |
| [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. |
wordpress print_embed_sharing_button() print\_embed\_sharing\_button()
===============================
Prints the necessary markup for the embed sharing button.
File: `wp-includes/embed.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/embed.php/)
```
function print_embed_sharing_button() {
if ( is_404() ) {
return;
}
?>
<div class="wp-embed-share">
<button type="button" class="wp-embed-share-dialog-open" aria-label="<?php esc_attr_e( 'Open sharing dialog' ); ?>">
<span class="dashicons dashicons-share"></span>
</button>
</div>
<?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. |
| [is\_404()](is_404) wp-includes/query.php | Determines whether the query has resulted in a 404 (returns no results). |
| Version | Description |
| --- | --- |
| [4.4.0](https://developer.wordpress.org/reference/since/4.4.0/) | Introduced. |
wordpress wp_get_original_referer(): string|false wp\_get\_original\_referer(): string|false
==========================================
Retrieves original referer that was posted, if it exists.
string|false Original referer URL on success, false on failure.
`HTTP referer` is a server variable. ‘referer’ is deliberately miss-spelled.
File: `wp-includes/functions.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/functions.php/)
```
function wp_get_original_referer() {
if ( ! empty( $_REQUEST['_wp_original_http_referer'] ) && function_exists( 'wp_validate_redirect' ) ) {
return wp_validate_redirect( wp_unslash( $_REQUEST['_wp_original_http_referer'] ), false );
}
return false;
}
```
| Uses | Description |
| --- | --- |
| [wp\_validate\_redirect()](wp_validate_redirect) wp-includes/pluggable.php | Validates a URL for use in a redirect. |
| [wp\_unslash()](wp_unslash) wp-includes/formatting.php | Removes slashes from a string or recursively removes slashes from strings within an array. |
| Used By | Description |
| --- | --- |
| [wp\_original\_referer\_field()](wp_original_referer_field) wp-includes/functions.php | Retrieves or displays original referer hidden field for forms. |
| Version | Description |
| --- | --- |
| [2.0.4](https://developer.wordpress.org/reference/since/2.0.4/) | Introduced. |
wordpress get_paged_template(): string get\_paged\_template(): string
==============================
This function has been deprecated. The paged.php template is no longer part of the theme template hierarchy instead.
Retrieve path of paged template in current or parent template.
string Full path to paged template file.
File: `wp-includes/deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/deprecated.php/)
```
function get_paged_template() {
_deprecated_function( __FUNCTION__, '4.7.0' );
return get_query_template( 'paged' );
}
```
| Uses | Description |
| --- | --- |
| [get\_query\_template()](get_query_template) wp-includes/template.php | Retrieves path to a template. |
| [\_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/) | The paged.php template is no longer part of the theme template hierarchy. |
| [1.5.0](https://developer.wordpress.org/reference/since/1.5.0/) | Introduced. |
wordpress _upgrade_422_remove_genericons() \_upgrade\_422\_remove\_genericons()
====================================
Cleans up Genericons example files.
File: `wp-admin/includes/update-core.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/update-core.php/)
```
function _upgrade_422_remove_genericons() {
global $wp_theme_directories, $wp_filesystem;
// A list of the affected files using the filesystem absolute paths.
$affected_files = array();
// Themes.
foreach ( $wp_theme_directories as $directory ) {
$affected_theme_files = _upgrade_422_find_genericons_files_in_folder( $directory );
$affected_files = array_merge( $affected_files, $affected_theme_files );
}
// Plugins.
$affected_plugin_files = _upgrade_422_find_genericons_files_in_folder( WP_PLUGIN_DIR );
$affected_files = array_merge( $affected_files, $affected_plugin_files );
foreach ( $affected_files as $file ) {
$gen_dir = $wp_filesystem->find_folder( trailingslashit( dirname( $file ) ) );
if ( empty( $gen_dir ) ) {
continue;
}
// The path when the file is accessed via WP_Filesystem may differ in the case of FTP.
$remote_file = $gen_dir . basename( $file );
if ( ! $wp_filesystem->exists( $remote_file ) ) {
continue;
}
if ( ! $wp_filesystem->delete( $remote_file, false, 'f' ) ) {
$wp_filesystem->put_contents( $remote_file, '' );
}
}
}
```
| Uses | Description |
| --- | --- |
| [trailingslashit()](trailingslashit) wp-includes/formatting.php | Appends a trailing slash. |
| Used By | Description |
| --- | --- |
| [update\_core()](update_core) wp-admin/includes/update-core.php | Upgrades the core of WordPress. |
| Version | Description |
| --- | --- |
| [4.2.2](https://developer.wordpress.org/reference/since/4.2.2/) | Introduced. |
wordpress current_user_can( string $capability, mixed $args ): bool current\_user\_can( string $capability, mixed $args ): bool
===========================================================
Returns whether the current user has the specified capability.
This function also accepts an ID of an object to check against if the capability is a meta capability. Meta capabilities such as `edit_post` and `edit_user` are capabilities used by the `map_meta_cap()` function to map to primitive capabilities that a user or role has, such as `edit_posts` and `edit_others_posts`.
Example usage:
```
current_user_can( 'edit_posts' );
current_user_can( 'edit_post', $post->ID );
current_user_can( 'edit_post_meta', $post->ID, $meta_key );
```
While checking against particular roles in place of a capability is supported in part, this practice is discouraged as it may produce unreliable results.
Note: Will always return true if the current user is a super admin, unless specifically denied.
* [WP\_User::has\_cap()](../classes/wp_user/has_cap)
* [map\_meta\_cap()](map_meta_cap)
`$capability` string Required Capability name. `$args` mixed Optional further parameters, typically starting with an object ID. bool Whether the current user has the given capability. If `$capability` is a meta cap and `$object_id` is passed, whether the current user has the given meta capability for the given object.
File: `wp-includes/capabilities.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/capabilities.php/)
```
function current_user_can( $capability, ...$args ) {
return user_can( wp_get_current_user(), $capability, ...$args );
}
```
| Uses | Description |
| --- | --- |
| [user\_can()](user_can) wp-includes/capabilities.php | Returns whether a particular user has the specified capability. |
| [wp\_get\_current\_user()](wp_get_current_user) wp-includes/pluggable.php | Retrieves the current user object. |
| Used By | Description |
| --- | --- |
| [WP\_REST\_Terms\_Controller::check\_read\_terms\_permission\_for\_post()](../classes/wp_rest_terms_controller/check_read_terms_permission_for_post) wp-includes/rest-api/endpoints/class-wp-rest-terms-controller.php | Checks if the terms for a post can be read. |
| [wp\_refresh\_metabox\_loader\_nonces()](wp_refresh_metabox_loader_nonces) wp-admin/includes/misc.php | Refresh nonces used with meta boxes in the block editor. |
| [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\_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\_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\_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::check\_read\_permission()](../classes/wp_rest_global_styles_controller/check_read_permission) wp-includes/rest-api/endpoints/class-wp-rest-global-styles-controller.php | Checks if a global style can be read. |
| [WP\_REST\_Global\_Styles\_Controller::check\_update\_permission()](../classes/wp_rest_global_styles_controller/check_update_permission) wp-includes/rest-api/endpoints/class-wp-rest-global-styles-controller.php | Checks if a global style can be edited. |
| [WP\_REST\_Global\_Styles\_Controller::get\_available\_actions()](../classes/wp_rest_global_styles_controller/get_available_actions) wp-includes/rest-api/endpoints/class-wp-rest-global-styles-controller.php | Get the link relations available for the post and current user. |
| [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\_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\_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\_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. |
| [\_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\_admin\_bar\_edit\_site\_menu()](wp_admin_bar_edit_site_menu) wp-includes/admin-bar.php | Adds the “Edit site” link to the Toolbar. |
| [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\_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\_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\_Templates\_Controller::get\_available\_actions()](../classes/wp_rest_templates_controller/get_available_actions) wp-includes/rest-api/endpoints/class-wp-rest-templates-controller.php | Get the link relations available for the post and current user. |
| [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\_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\_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. |
| [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\_Posts\_Controller::check\_password\_required()](../classes/wp_rest_posts_controller/check_password_required) wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php | Overrides the result of the post password check for REST requested posts. |
| [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::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\_force\_plain\_post\_permalink()](wp_force_plain_post_permalink) wp-includes/link-template.php | Determine whether post should always use a plain permalink structure. |
| [wp\_ajax\_send\_password\_reset()](wp_ajax_send_password_reset) wp-admin/includes/ajax-actions.php | Ajax handler sends a password reset link. |
| [WP\_REST\_Site\_Health\_Controller::validate\_request\_permission()](../classes/wp_rest_site_health_controller/validate_request_permission) wp-includes/rest-api/endpoints/class-wp-rest-site-health-controller.php | Validates if the current user can request this REST endpoint. |
| [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\_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\_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\_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::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::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::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::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::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\_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\_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. |
| [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\_Site\_Health::check\_wp\_version\_check\_exists()](../classes/wp_site_health/check_wp_version_check_exists) wp-admin/includes/class-wp-site-health.php | Tests whether `wp_version_check` is blocked. |
| [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. |
| [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. |
| [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\_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\_REST\_Blocks\_Controller::check\_read\_permission()](../classes/wp_rest_blocks_controller/check_read_permission) wp-includes/rest-api/endpoints/class-wp-rest-blocks-controller.php | Checks if a block can be read. |
| [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\_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\_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\_get\_code\_editor\_settings()](wp_get_code_editor_settings) wp-includes/general-template.php | Generates and returns code editor settings. |
| [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\_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\_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::text\_change\_check()](../classes/wp_privacy_policy_content/text_change_check) wp-admin/includes/class-wp-privacy-policy-content.php | Quick check if any privacy info has changed. |
| [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\_xmlrpc\_server::get\_term\_custom\_fields()](../classes/wp_xmlrpc_server/get_term_custom_fields) wp-includes/class-wp-xmlrpc-server.php | Retrieve custom fields for a term. |
| [wp\_xmlrpc\_server::set\_term\_custom\_fields()](../classes/wp_xmlrpc_server/set_term_custom_fields) wp-includes/class-wp-xmlrpc-server.php | Set custom fields for a term. |
| [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\_Customize\_Manager::check\_changeset\_lock\_with\_heartbeat()](../classes/wp_customize_manager/check_changeset_lock_with_heartbeat) wp-includes/class-wp-customize-manager.php | Checks locked changeset with heartbeat API. |
| [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\_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::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\_enqueue\_code\_editor()](wp_enqueue_code_editor) wp-includes/general-template.php | Enqueues assets needed by the code editor for the given settings. |
| [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. |
| [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\_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\_load\_press\_this()](wp_load_press_this) wp-admin/press-this.php | |
| [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\_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\_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\_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::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::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::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\_items()](../classes/wp_rest_users_controller/get_items) wp-includes/rest-api/endpoints/class-wp-rest-users-controller.php | Retrieves 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::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::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\_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::check\_read\_permission()](../classes/wp_rest_post_statuses_controller/check_read_permission) wp-includes/rest-api/endpoints/class-wp-rest-post-statuses-controller.php | Checks whether a given post status should be visible. |
| [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::get\_item\_permissions\_check()](../classes/wp_rest_settings_controller/get_item_permissions_check) wp-includes/rest-api/endpoints/class-wp-rest-settings-controller.php | Checks if a given request has access to read and manage settings. |
| [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::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::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::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::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::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::check\_update\_permission()](../classes/wp_rest_posts_controller/check_update_permission) wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php | Checks if a post can be edited. |
| [WP\_REST\_Posts\_Controller::check\_create\_permission()](../classes/wp_rest_posts_controller/check_create_permission) wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php | Checks if a post can be created. |
| [WP\_REST\_Posts\_Controller::check\_delete\_permission()](../classes/wp_rest_posts_controller/check_delete_permission) wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php | Checks if a post can be deleted. |
| [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::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\_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::can\_access\_password\_content()](../classes/wp_rest_posts_controller/can_access_password_content) wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php | Checks if the user can access password-protected content. |
| [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::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\_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\_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\_Taxonomies\_Controller::get\_items()](../classes/wp_rest_taxonomies_controller/get_items) wp-includes/rest-api/endpoints/class-wp-rest-taxonomies-controller.php | Retrieves all public taxonomies. |
| [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\_items()](../classes/wp_rest_post_types_controller/get_items) wp-includes/rest-api/endpoints/class-wp-rest-post-types-controller.php | Retrieves all public post 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\_Comments\_Controller::check\_edit\_permission()](../classes/wp_rest_comments_controller/check_edit_permission) wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php | Checks if a comment can be edited or deleted. |
| [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\_REST\_Comments\_Controller::check\_read\_permission()](../classes/wp_rest_comments_controller/check_read_permission) wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php | Checks if the comment can be read. |
| [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::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::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\_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::sanitize\_nav\_menus\_created\_posts()](../classes/wp_customize_nav_menus/sanitize_nav_menus_created_posts) wp-includes/class-wp-customize-nav-menus.php | Sanitizes post IDs for posts created for nav menu items to be published. |
| [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\_Manager::validate\_setting\_values()](../classes/wp_customize_manager/validate_setting_values) wp-includes/class-wp-customize-manager.php | Validates setting values. |
| [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. |
| [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\_Customize\_Partial::check\_capabilities()](../classes/wp_customize_partial/check_capabilities) wp-includes/customize/class-wp-customize-partial.php | Checks if the user can refresh this partial. |
| [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\_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. |
| [wp\_ajax\_save\_wporg\_username()](wp_ajax_save_wporg_username) wp-admin/includes/ajax-actions.php | Ajax handler for saving the user’s WordPress.org username. |
| [wp\_ajax\_delete\_inactive\_widgets()](wp_ajax_delete_inactive_widgets) wp-admin/includes/ajax-actions.php | Ajax handler for removing inactive widgets. |
| [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\_Menus::\_\_construct()](../classes/wp_customize_nav_menus/__construct) wp-includes/class-wp-customize-nav-menus.php | Constructor. |
| [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\_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\_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\_ajax\_crop\_image()](wp_ajax_crop_image) wp-admin/includes/ajax-actions.php | Ajax handler for cropping an image. |
| [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\_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\_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\_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\_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. |
| [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. |
| [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\_update\_plugin()](wp_ajax_update_plugin) wp-admin/includes/ajax-actions.php | Ajax handler for updating a plugin. |
| [wp\_media\_attach\_action()](wp_media_attach_action) wp-admin/includes/media.php | Encapsulates the logic for Attach/Detach actions. |
| [wp\_edit\_attachments\_query\_vars()](wp_edit_attachments_query_vars) wp-admin/includes/post.php | Returns the query variables for the current attachments request. |
| [wp\_ajax\_destroy\_sessions()](wp_ajax_destroy_sessions) wp-admin/includes/ajax-actions.php | Ajax handler for destroying multiple open sessions for a user. |
| [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\_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\_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\_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\_handle\_upload()](_wp_handle_upload) wp-admin/includes/file.php | Handles PHP uploads in WordPress. |
| [WP\_MS\_Users\_List\_Table::ajax\_user\_can()](../classes/wp_ms_users_list_table/ajax_user_can) wp-admin/includes/class-wp-ms-users-list-table.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\_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::get\_bulk\_actions()](../classes/wp_plugins_list_table/get_bulk_actions) 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::\_\_construct()](../classes/wp_plugins_list_table/__construct) wp-admin/includes/class-wp-plugins-list-table.php | Constructor. |
| [WP\_Plugins\_List\_Table::ajax\_user\_can()](../classes/wp_plugins_list_table/ajax_user_can) 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\_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::ajax\_user\_can()](../classes/wp_links_list_table/ajax_user_can) wp-admin/includes/class-wp-links-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. |
| [Bulk\_Theme\_Upgrader\_Skin::bulk\_footer()](../classes/bulk_theme_upgrader_skin/bulk_footer) wp-admin/includes/class-bulk-theme-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::after()](../classes/plugin_upgrader_skin/after) wp-admin/includes/class-plugin-upgrader-skin.php | Action to perform following a single plugin update. |
| [check\_import\_new\_users()](check_import_new_users) wp-admin/includes/ms.php | Checks if the current user has permissions to import new users. |
| [site\_admin\_notice()](site_admin_notice) wp-admin/includes/ms.php | Displays an admin notice to upgrade all sites after a core upgrade. |
| [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\_MS\_Themes\_List\_Table::\_\_construct()](../classes/wp_ms_themes_list_table/__construct) wp-admin/includes/class-wp-ms-themes-list-table.php | Constructor. |
| [WP\_MS\_Themes\_List\_Table::ajax\_user\_can()](../classes/wp_ms_themes_list_table/ajax_user_can) wp-admin/includes/class-wp-ms-themes-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 | |
| [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. |
| [wp\_refresh\_post\_nonces()](wp_refresh_post_nonces) wp-admin/includes/misc.php | Checks nonce expiration on the New/Edit Post screen and refresh if needed. |
| [WP\_Theme\_Install\_List\_Table::ajax\_user\_can()](../classes/wp_theme_install_list_table/ajax_user_can) wp-admin/includes/class-wp-theme-install-list-table.php | |
| [maintenance\_nag()](maintenance_nag) wp-admin/includes/update.php | Displays maintenance nag HTML message. |
| [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\_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. |
| [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\_welcome\_panel()](wp_welcome_panel) wp-admin/includes/dashboard.php | Displays a welcome panel to introduce users to WordPress. |
| [install\_plugin\_install\_status()](install_plugin_install_status) wp-admin/includes/plugin-install.php | Determines the status we can perform on a plugin. |
| [install\_plugin\_information()](install_plugin_information) wp-admin/includes/plugin-install.php | Displays plugin information in dialog box form. |
| [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\_quota()](wp_dashboard_quota) wp-admin/includes/dashboard.php | Displays file upload quota on dashboard. |
| [wp\_add\_dashboard\_widget()](wp_add_dashboard_widget) wp-admin/includes/dashboard.php | Adds a new 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\_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. |
| [user\_can\_access\_admin\_page()](user_can_access_admin_page) wp-admin/includes/plugin.php | Determines whether the current user can access the current admin page. |
| [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. |
| [add\_users\_page()](add_users_page) wp-admin/includes/plugin.php | Adds a submenu page to the Users/Profile main menu. |
| [validate\_active\_plugins()](validate_active_plugins) wp-admin/includes/plugin.php | Validates active plugins. |
| [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::ajax\_user\_can()](../classes/wp_plugin_install_list_table/ajax_user_can) 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 | |
| [WP\_Internal\_Pointers::enqueue\_scripts()](../classes/wp_internal_pointers/enqueue_scripts) wp-admin/includes/class-wp-internal-pointers.php | Initializes the new feature pointers. |
| [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\_comment\_reply()](wp_comment_reply) wp-admin/includes/template.php | Outputs the in-line comment reply-to form in the Comments list table. |
| [meta\_form()](meta_form) wp-admin/includes/template.php | Prints the form in the Custom Fields meta box. |
| [WP\_Themes\_List\_Table::ajax\_user\_can()](../classes/wp_themes_list_table/ajax_user_can) wp-admin/includes/class-wp-themes-list-table.php | |
| [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\_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. |
| [WP\_MS\_Sites\_List\_Table::ajax\_user\_can()](../classes/wp_ms_sites_list_table/ajax_user_can) wp-admin/includes/class-wp-ms-sites-list-table.php | |
| [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\_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::ajax\_user\_can()](../classes/wp_users_list_table/ajax_user_can) wp-admin/includes/class-wp-users-list-table.php | Check the current user’s permissions. |
| [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. |
| [media\_upload\_max\_image\_resize()](media_upload_max_image_resize) wp-admin/includes/media.php | Displays the checkbox to scale images. |
| [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 | |
| [media\_upload\_form\_handler()](media_upload_form_handler) wp-admin/includes/media.php | Handles form submissions for the legacy media uploader. |
| [get\_sample\_permalink\_html()](get_sample_permalink_html) wp-admin/includes/post.php | Returns the HTML of the sample permalink slug editor. |
| [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. |
| [wp\_write\_post()](wp_write_post) wp-admin/includes/post.php | Creates a new post from the “Write Post” form using `$_POST` information. |
| [add\_meta()](add_meta) wp-admin/includes/post.php | Adds post meta data defined in the `$_POST` superglobal for a post with given ID. |
| [\_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\_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\_get\_revision\_diffs()](wp_ajax_get_revision_diffs) wp-admin/includes/ajax-actions.php | Ajax handler for getting revision diffs. |
| [wp\_ajax\_query\_themes()](wp_ajax_query_themes) wp-admin/includes/ajax-actions.php | Ajax handler for getting themes from [themes\_api()](themes_api) . |
| [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\_image\_editor()](wp_ajax_image_editor) wp-admin/includes/ajax-actions.php | Ajax handler for image editing. |
| [wp\_ajax\_set\_post\_thumbnail()](wp_ajax_set_post_thumbnail) wp-admin/includes/ajax-actions.php | Ajax handler for setting the featured image. |
| [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\_get\_attachment()](wp_ajax_get_attachment) wp-admin/includes/ajax-actions.php | Ajax handler for getting an attachment. |
| [wp\_ajax\_query\_attachments()](wp_ajax_query_attachments) wp-admin/includes/ajax-actions.php | Ajax handler for querying attachments. |
| [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\_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\_update\_welcome\_panel()](wp_ajax_update_welcome_panel) wp-admin/includes/ajax-actions.php | Ajax handler for updating whether to display the welcome panel. |
| [wp\_ajax\_menu\_get\_metabox()](wp_ajax_menu_get_metabox) wp-admin/includes/ajax-actions.php | Ajax handler for retrieving menu meta boxes. |
| [wp\_ajax\_menu\_locations\_save()](wp_ajax_menu_locations_save) wp-admin/includes/ajax-actions.php | Ajax handler for menu locations save. |
| [wp\_ajax\_menu\_quick\_search()](wp_ajax_menu_quick_search) wp-admin/includes/ajax-actions.php | Ajax handler for menu quick searching. |
| [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\_widgets\_order()](wp_ajax_widgets_order) wp-admin/includes/ajax-actions.php | Ajax handler for saving the widgets order. |
| [\_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\_delete\_comment()](wp_ajax_delete_comment) wp-admin/includes/ajax-actions.php | Ajax handler for deleting a comment. |
| [wp\_ajax\_delete\_tag()](wp_ajax_delete_tag) wp-admin/includes/ajax-actions.php | Ajax handler for deleting a tag. |
| [wp\_ajax\_delete\_link()](wp_ajax_delete_link) wp-admin/includes/ajax-actions.php | Ajax handler for deleting a link. |
| [wp\_ajax\_delete\_meta()](wp_ajax_delete_meta) wp-admin/includes/ajax-actions.php | Ajax handler for deleting meta. |
| [wp\_ajax\_delete\_post()](wp_ajax_delete_post) wp-admin/includes/ajax-actions.php | Ajax handler for deleting a post. |
| [wp\_ajax\_trash\_post()](wp_ajax_trash_post) wp-admin/includes/ajax-actions.php | Ajax handler for sending a post to the Trash. |
| [wp\_ajax\_delete\_page()](wp_ajax_delete_page) wp-admin/includes/ajax-actions.php | Ajax handler to delete a page. |
| [wp\_ajax\_dim\_comment()](wp_ajax_dim_comment) wp-admin/includes/ajax-actions.php | Ajax handler to dim a comment. |
| [wp\_ajax\_add\_link\_category()](wp_ajax_add_link_category) wp-admin/includes/ajax-actions.php | Ajax handler for adding a link category. |
| [wp\_ajax\_add\_tag()](wp_ajax_add_tag) wp-admin/includes/ajax-actions.php | Ajax handler to add a tag. |
| [wp\_ajax\_get\_tagcloud()](wp_ajax_get_tagcloud) wp-admin/includes/ajax-actions.php | Ajax handler for getting a tagcloud. |
| [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\_prepare\_revisions\_for\_js()](wp_prepare_revisions_for_js) wp-admin/includes/revision.php | Prepare revisions for JavaScript. |
| [wp\_ajax\_ajax\_tag\_search()](wp_ajax_ajax_tag_search) wp-admin/includes/ajax-actions.php | Ajax handler for tag search. |
| [wp\_ajax\_wp\_compression\_test()](wp_ajax_wp_compression_test) wp-admin/includes/ajax-actions.php | Ajax handler for compression testing. |
| [wp\_ajax\_imgedit\_preview()](wp_ajax_imgedit_preview) wp-admin/includes/ajax-actions.php | Ajax handler for image editor previews. |
| [wp\_ajax\_autocomplete\_user()](wp_ajax_autocomplete_user) wp-admin/includes/ajax-actions.php | Ajax handler for user autocomplete. |
| [post\_custom\_meta\_box()](post_custom_meta_box) wp-admin/includes/meta-boxes.php | Displays custom fields form fields. |
| [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. |
| [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\_tags\_meta\_box()](post_tags_meta_box) wp-admin/includes/meta-boxes.php | Displays post tags form fields. |
| [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\_Media\_List\_Table::ajax\_user\_can()](../classes/wp_media_list_table/ajax_user_can) 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\_row\_actions()](../classes/wp_media_list_table/_get_row_actions) wp-admin/includes/class-wp-media-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::extra\_tablenav()](../classes/wp_comments_list_table/extra_tablenav) wp-admin/includes/class-wp-comments-list-table.php | |
| [WP\_Comments\_List\_Table::single\_row()](../classes/wp_comments_list_table/single_row) wp-admin/includes/class-wp-comments-list-table.php | |
| [WP\_Comments\_List\_Table::ajax\_user\_can()](../classes/wp_comments_list_table/ajax_user_can) 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 |
| [WP\_Terms\_List\_Table::ajax\_user\_can()](../classes/wp_terms_list_table/ajax_user_can) wp-admin/includes/class-wp-terms-list-table.php | |
| [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::column\_cb()](../classes/wp_terms_list_table/column_cb) wp-admin/includes/class-wp-terms-list-table.php | |
| [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\_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::\_\_construct()](../classes/wp_posts_list_table/__construct) wp-admin/includes/class-wp-posts-list-table.php | Constructor. |
| [WP\_Posts\_List\_Table::ajax\_user\_can()](../classes/wp_posts_list_table/ajax_user_can) wp-admin/includes/class-wp-posts-list-table.php | |
| [edit\_comment()](edit_comment) wp-admin/includes/comment.php | Updates a comment with values provided in $\_POST. |
| [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::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::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. |
| [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::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::take\_action()](../classes/custom_image_header/take_action) wp-admin/includes/class-custom-image-header.php | Execute custom header modification. |
| [confirm\_delete\_users()](confirm_delete_users) wp-admin/includes/ms.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. |
| [Custom\_Background::wp\_set\_background\_image()](../classes/custom_background/wp_set_background_image) wp-admin/includes/class-custom-background.php | |
| [Custom\_Background::admin\_page()](../classes/custom_background/admin_page) wp-admin/includes/class-custom-background.php | Displays the custom background page. |
| [\_wp\_menu\_output()](_wp_menu_output) wp-admin/menu-header.php | Display menu. |
| [current\_user\_can\_for\_blog()](current_user_can_for_blog) wp-includes/capabilities.php | Returns whether the current user has the specified capability for a given site. |
| [WP\_Customize\_Manager::enqueue\_control\_scripts()](../classes/wp_customize_manager/enqueue_control_scripts) wp-includes/class-wp-customize-manager.php | Enqueues scripts for customize controls. |
| [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::setup\_theme()](../classes/wp_customize_manager/setup_theme) wp-includes/class-wp-customize-manager.php | Starts preview and customize theme. |
| [WP\_Customize\_Manager::\_\_construct()](../classes/wp_customize_manager/__construct) wp-includes/class-wp-customize-manager.php | Constructor. |
| [wp\_register()](wp_register) wp-includes/general-template.php | Displays the Registration or Admin link. |
| [kses\_init\_filters()](kses_init_filters) wp-includes/kses.php | Adds all KSES input form content filters. |
| [kses\_init()](kses_init) wp-includes/kses.php | Sets up most of the KSES filters for input form content. |
| [WP\_Query::get\_posts()](../classes/wp_query/get_posts) wp-includes/class-wp-query.php | Retrieves an array of posts based on query variables. |
| [get\_allowed\_mime\_types()](get_allowed_mime_types) wp-includes/functions.php | Retrieves the list of allowed mime types and file extensions. |
| [wp\_upload\_bits()](wp_upload_bits) wp-includes/functions.php | Creates a file in the upload folder with given content. |
| [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\_widget\_rss\_output()](wp_widget_rss_output) wp-includes/widgets.php | Display the RSS entries in a list. |
| [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. |
| [get\_edit\_user\_link()](get_edit_user_link) wp-includes/link-template.php | Retrieves the edit user link. |
| [get\_adjacent\_post()](get_adjacent_post) wp-includes/link-template.php | Retrieves the adjacent post. |
| [get\_edit\_post\_link()](get_edit_post_link) wp-includes/link-template.php | Retrieves the edit post link for post. |
| [get\_delete\_post\_link()](get_delete_post_link) wp-includes/link-template.php | Retrieves the delete posts link for post. |
| [get\_edit\_comment\_link()](get_edit_comment_link) wp-includes/link-template.php | Retrieves the edit comment link. |
| [edit\_comment\_link()](edit_comment_link) wp-includes/link-template.php | Displays the edit comment link with formatting. |
| [get\_edit\_bookmark\_link()](get_edit_bookmark_link) wp-includes/link-template.php | Displays the edit bookmark link. |
| [edit\_bookmark\_link()](edit_bookmark_link) wp-includes/link-template.php | Displays the edit bookmark link anchor content. |
| [get\_edit\_term\_link()](get_edit_term_link) wp-includes/link-template.php | Retrieves the URL for editing a given term. |
| [edit\_term\_link()](edit_term_link) wp-includes/link-template.php | Displays or retrieves the edit term link with formatting. |
| [wp\_get\_update\_data()](wp_get_update_data) wp-includes/update.php | Collects counts and UI strings for available updates. |
| [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. |
| [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\_edit\_menu()](wp_admin_bar_edit_menu) wp-includes/admin-bar.php | Provides an edit link for posts and terms. |
| [wp\_admin\_bar\_new\_content\_menu()](wp_admin_bar_new_content_menu) wp-includes/admin-bar.php | Adds “Add New” menu. |
| [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\_admin\_bar\_appearance\_menu()](wp_admin_bar_appearance_menu) wp-includes/admin-bar.php | Adds appearance submenu items to the “Site Name” menu. |
| [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. |
| [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\_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. |
| [get\_posts\_by\_author\_sql()](get_posts_by_author_sql) wp-includes/post.php | Retrieves the post SQL based on capability, author, and type. |
| [wp\_insert\_post()](wp_insert_post) wp-includes/post.php | Inserts or update a post. |
| [\_count\_posts\_cache\_key()](_count_posts_cache_key) wp-includes/post.php | Returns the cache key for [wp\_count\_posts()](wp_count_posts) based on the passed arguments. |
| [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. |
| [redirect\_canonical()](redirect_canonical) wp-includes/canonical.php | Redirects incoming links to the proper URL based on the site url. |
| [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\_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::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\_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::\_getOptions()](../classes/wp_xmlrpc_server/_getoptions) wp-includes/class-wp-xmlrpc-server.php | Retrieve blog options value from list. |
| [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\_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\_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\_getPostTypes()](../classes/wp_xmlrpc_server/wp_getposttypes) wp-includes/class-wp-xmlrpc-server.php | Retrieves a post types |
| [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::blogger\_getUsersBlogs()](../classes/wp_xmlrpc_server/blogger_getusersblogs) wp-includes/class-wp-xmlrpc-server.php | Retrieve blogs that user owns. |
| [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\_getComments()](../classes/wp_xmlrpc_server/wp_getcomments) wp-includes/class-wp-xmlrpc-server.php | Retrieve comments. |
| [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\_getTaxonomies()](../classes/wp_xmlrpc_server/wp_gettaxonomies) wp-includes/class-wp-xmlrpc-server.php | Retrieve all taxonomies. |
| [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\_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::wp\_getUsersBlogs()](../classes/wp_xmlrpc_server/wp_getusersblogs) wp-includes/class-wp-xmlrpc-server.php | Retrieve the blogs of the user. |
| [wp\_xmlrpc\_server::get\_custom\_fields()](../classes/wp_xmlrpc_server/get_custom_fields) wp-includes/class-wp-xmlrpc-server.php | Retrieve custom fields for post. |
| [wp\_xmlrpc\_server::set\_custom\_fields()](../classes/wp_xmlrpc_server/set_custom_fields) wp-includes/class-wp-xmlrpc-server.php | Set custom fields for post. |
| [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\_Customize\_Control::check\_capabilities()](../classes/wp_customize_control/check_capabilities) wp-includes/class-wp-customize-control.php | Checks if the user can use this control. |
| [WP\_Customize\_Control::render\_content()](../classes/wp_customize_control/render_content) wp-includes/class-wp-customize-control.php | Render the control’s content. |
| [wp\_comment\_form\_unfiltered\_html\_nonce()](wp_comment_form_unfiltered_html_nonce) wp-includes/comment-template.php | Displays form token for unfiltered comments. |
| [WP\_Customize\_Widgets::sanitize\_widget\_instance()](../classes/wp_customize_widgets/sanitize_widget_instance) wp-includes/class-wp-customize-widgets.php | Sanitizes a widget instance. |
| [WP\_Customize\_Widgets::wp\_ajax\_update\_widget()](../classes/wp_customize_widgets/wp_ajax_update_widget) wp-includes/class-wp-customize-widgets.php | Updates widget settings asynchronously. |
| [WP\_Customize\_Widgets::\_\_construct()](../classes/wp_customize_widgets/__construct) wp-includes/class-wp-customize-widgets.php | Initial loader. |
| [\_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 |
| --- | --- |
| [5.8.0](https://developer.wordpress.org/reference/since/5.8.0/) | Converted to wrapper for the [user\_can()](user_can) function. |
| [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.0.0](https://developer.wordpress.org/reference/since/2.0.0/) | Introduced. |
| programming_docs |
wordpress wp_theme_update_row( string $theme_key, WP_Theme $theme ): void|false wp\_theme\_update\_row( string $theme\_key, WP\_Theme $theme ): void|false
==========================================================================
Displays update information for a theme.
`$theme_key` string Required Theme stylesheet. `$theme` [WP\_Theme](../classes/wp_theme) Required Theme object. void|false
File: `wp-admin/includes/update.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/update.php/)
```
function wp_theme_update_row( $theme_key, $theme ) {
$current = get_site_transient( 'update_themes' );
if ( ! isset( $current->response[ $theme_key ] ) ) {
return false;
}
$response = $current->response[ $theme_key ];
$details_url = add_query_arg(
array(
'TB_iframe' => 'true',
'width' => 1024,
'height' => 800,
),
$current->response[ $theme_key ]['url']
);
/** @var WP_MS_Themes_List_Table $wp_list_table */
$wp_list_table = _get_list_table( 'WP_MS_Themes_List_Table' );
$active = $theme->is_allowed( 'network' ) ? ' active' : '';
$requires_wp = isset( $response['requires'] ) ? $response['requires'] : null;
$requires_php = isset( $response['requires_php'] ) ? $response['requires_php'] : null;
$compatible_wp = is_wp_version_compatible( $requires_wp );
$compatible_php = is_php_version_compatible( $requires_php );
printf(
'<tr class="plugin-update-tr%s" id="%s" data-slug="%s">' .
'<td colspan="%s" class="plugin-update colspanchange">' .
'<div class="update-message notice inline notice-warning notice-alt"><p>',
$active,
esc_attr( $theme->get_stylesheet() . '-update' ),
esc_attr( $theme->get_stylesheet() ),
$wp_list_table->get_column_count()
);
if ( $compatible_wp && $compatible_php ) {
if ( ! current_user_can( 'update_themes' ) ) {
printf(
/* translators: 1: Theme name, 2: Details URL, 3: Additional link attributes, 4: Version number. */
__( 'There is a new version of %1$s available. <a href="%2$s" %3$s>View version %4$s details</a>.' ),
$theme['Name'],
esc_url( $details_url ),
sprintf(
'class="thickbox open-plugin-details-modal" aria-label="%s"',
/* translators: 1: Theme name, 2: Version number. */
esc_attr( sprintf( __( 'View %1$s version %2$s details' ), $theme['Name'], $response['new_version'] ) )
),
$response['new_version']
);
} elseif ( empty( $response['package'] ) ) {
printf(
/* translators: 1: Theme name, 2: Details URL, 3: Additional link attributes, 4: Version number. */
__( 'There is a new version of %1$s available. <a href="%2$s" %3$s>View version %4$s details</a>. <em>Automatic update is unavailable for this theme.</em>' ),
$theme['Name'],
esc_url( $details_url ),
sprintf(
'class="thickbox open-plugin-details-modal" aria-label="%s"',
/* translators: 1: Theme name, 2: Version number. */
esc_attr( sprintf( __( 'View %1$s version %2$s details' ), $theme['Name'], $response['new_version'] ) )
),
$response['new_version']
);
} else {
printf(
/* translators: 1: Theme name, 2: Details URL, 3: Additional link attributes, 4: Version number, 5: Update URL, 6: Additional link attributes. */
__( 'There is a new version of %1$s available. <a href="%2$s" %3$s>View version %4$s details</a> or <a href="%5$s" %6$s>update now</a>.' ),
$theme['Name'],
esc_url( $details_url ),
sprintf(
'class="thickbox open-plugin-details-modal" aria-label="%s"',
/* translators: 1: Theme name, 2: Version number. */
esc_attr( sprintf( __( 'View %1$s version %2$s details' ), $theme['Name'], $response['new_version'] ) )
),
$response['new_version'],
wp_nonce_url( self_admin_url( 'update.php?action=upgrade-theme&theme=' ) . $theme_key, 'upgrade-theme_' . $theme_key ),
sprintf(
'class="update-link" aria-label="%s"',
/* translators: %s: Theme name. */
esc_attr( sprintf( _x( 'Update %s now', 'theme' ), $theme['Name'] ) )
)
);
}
} else {
if ( ! $compatible_wp && ! $compatible_php ) {
printf(
/* translators: %s: Theme name. */
__( 'There is a new version of %s available, but it does not work with your versions of WordPress and PHP.' ),
$theme['Name']
);
if ( current_user_can( 'update_core' ) && current_user_can( 'update_php' ) ) {
printf(
/* translators: 1: URL to WordPress Updates screen, 2: URL to Update PHP page. */
' ' . __( '<a href="%1$s">Please update WordPress</a>, and then <a href="%2$s">learn more about updating PHP</a>.' ),
self_admin_url( 'update-core.php' ),
esc_url( wp_get_update_php_url() )
);
wp_update_php_annotation( '</p><p><em>', '</em>' );
} elseif ( current_user_can( 'update_core' ) ) {
printf(
/* translators: %s: URL to WordPress Updates screen. */
' ' . __( '<a href="%s">Please update WordPress</a>.' ),
self_admin_url( 'update-core.php' )
);
} elseif ( current_user_can( 'update_php' ) ) {
printf(
/* translators: %s: URL to Update PHP page. */
' ' . __( '<a href="%s">Learn more about updating PHP</a>.' ),
esc_url( wp_get_update_php_url() )
);
wp_update_php_annotation( '</p><p><em>', '</em>' );
}
} elseif ( ! $compatible_wp ) {
printf(
/* translators: %s: Theme name. */
__( 'There is a new version of %s available, but it does not work with your version of WordPress.' ),
$theme['Name']
);
if ( current_user_can( 'update_core' ) ) {
printf(
/* translators: %s: URL to WordPress Updates screen. */
' ' . __( '<a href="%s">Please update WordPress</a>.' ),
self_admin_url( 'update-core.php' )
);
}
} elseif ( ! $compatible_php ) {
printf(
/* translators: %s: Theme name. */
__( 'There is a new version of %s available, but it does not work with your version of PHP.' ),
$theme['Name']
);
if ( current_user_can( 'update_php' ) ) {
printf(
/* translators: %s: URL to Update PHP page. */
' ' . __( '<a href="%s">Learn more about updating PHP</a>.' ),
esc_url( wp_get_update_php_url() )
);
wp_update_php_annotation( '</p><p><em>', '</em>' );
}
}
}
/**
* Fires at the end of the update message container in each
* row of the themes list table.
*
* The dynamic portion of the hook name, `$theme_key`, refers to
* the theme slug as found in the WordPress.org themes repository.
*
* @since 3.1.0
*
* @param WP_Theme $theme The WP_Theme object.
* @param array $response {
* An array of metadata about the available theme update.
*
* @type string $new_version New theme version.
* @type string $url Theme URL.
* @type string $package Theme update package URL.
* }
*/
do_action( "in_theme_update_message-{$theme_key}", $theme, $response ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
echo '</p></div></td></tr>';
}
```
[do\_action( "in\_theme\_update\_message-{$theme\_key}", WP\_Theme $theme, array $response )](../hooks/in_theme_update_message-theme_key)
Fires at the end of the update message container in each row of the themes list table.
| 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\_update\_php\_url()](wp_get_update_php_url) wp-includes/functions.php | Gets the URL to learn more about updating the PHP version the site is running on. |
| [wp\_update\_php\_annotation()](wp_update_php_annotation) wp-includes/functions.php | Prints the default annotation for the web host altering the “Update PHP” page URL. |
| [WP\_List\_Table::get\_column\_count()](../classes/wp_list_table/get_column_count) wp-admin/includes/class-wp-list-table.php | Returns the number of visible columns. |
| [\_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. |
| [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\_site\_transient()](get_site_transient) wp-includes/option.php | Retrieves the value of a site transient. |
| [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. |
| [\_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. |
| [wp\_nonce\_url()](wp_nonce_url) wp-includes/functions.php | Retrieves URL with nonce added to URL query. |
| [add\_query\_arg()](add_query_arg) wp-includes/functions.php | Retrieves a modified URL query string. |
| [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 get_privacy_policy_template(): string get\_privacy\_policy\_template(): string
========================================
Retrieves path of Privacy Policy page template in current or parent template.
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 ‘privacypolicy’.
* [get\_query\_template()](get_query_template)
string Full path to privacy policy template file.
File: `wp-includes/template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/template.php/)
```
function get_privacy_policy_template() {
$templates = array( 'privacy-policy.php' );
return get_query_template( 'privacypolicy', $templates );
}
```
| Uses | Description |
| --- | --- |
| [get\_query\_template()](get_query_template) wp-includes/template.php | Retrieves path to a template. |
| Version | Description |
| --- | --- |
| [5.2.0](https://developer.wordpress.org/reference/since/5.2.0/) | Introduced. |
wordpress get_blogaddress_by_name( string $blogname ): string get\_blogaddress\_by\_name( string $blogname ): string
======================================================
Get a full blog URL, given a blog name.
`$blogname` string Required The (subdomain or directory) name string
File: `wp-includes/ms-blogs.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/ms-blogs.php/)
```
function get_blogaddress_by_name( $blogname ) {
if ( is_subdomain_install() ) {
if ( 'main' === $blogname ) {
$blogname = 'www';
}
$url = rtrim( network_home_url(), '/' );
if ( ! empty( $blogname ) ) {
$url = preg_replace( '|^([^\.]+://)|', '${1}' . $blogname . '.', $url );
}
} else {
$url = network_home_url( $blogname );
}
return esc_url( $url . '/' );
}
```
| Uses | Description |
| --- | --- |
| [is\_subdomain\_install()](is_subdomain_install) wp-includes/ms-load.php | Whether a subdomain configuration is enabled. |
| [network\_home\_url()](network_home_url) wp-includes/link-template.php | Retrieves the home URL for the current network. |
| [esc\_url()](esc_url) wp-includes/formatting.php | Checks and cleans a URL. |
| Version | Description |
| --- | --- |
| [MU (3.0.0)](https://developer.wordpress.org/reference/since/mu.3.0.0/) | Introduced. |
wordpress _config_wp_home( string $url = '' ): string \_config\_wp\_home( string $url = '' ): 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 [WP\_HOME](../classes/wp_home) instead.
Retrieves the WordPress home page URL.
If the constant named ‘WP\_HOME’ exists, then it will be used and returned by the function. This can be used to counter the redirection on your local development environment.
* [WP\_HOME](../classes/wp_home)
`$url` string Optional URL for the home location. Default: `''`
string Homepage location.
File: `wp-includes/functions.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/functions.php/)
```
function _config_wp_home( $url = '' ) {
if ( defined( 'WP_HOME' ) ) {
return untrailingslashit( WP_HOME );
}
return $url;
}
```
| Uses | Description |
| --- | --- |
| [untrailingslashit()](untrailingslashit) wp-includes/formatting.php | Removes trailing forward slashes and backslashes if they exist. |
| Version | Description |
| --- | --- |
| [2.2.0](https://developer.wordpress.org/reference/since/2.2.0/) | Introduced. |
wordpress wp_filter_kses( string $data ): string wp\_filter\_kses( string $data ): string
========================================
Sanitize content with allowed HTML KSES rules.
This function expects slashed data.
`$data` string Required Content to filter, expected to be escaped with slashes. string Filtered content.
`wp_filter_kses` should generally be preferred over `wp_kses_data` because `wp_magic_quotes` escapes `$_GET`, `$_POST`, `$_COOKIE`, `$_SERVER`, and `$_REQUEST` fairly early in the hook system, shortly after ‘plugins\_loaded’ but earlier then ‘init’ or ‘wp\_loaded’.
File: `wp-includes/kses.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/kses.php/)
```
function wp_filter_kses( $data ) {
return addslashes( wp_kses( stripslashes( $data ), current_filter() ) );
}
```
| Uses | Description |
| --- | --- |
| [wp\_kses()](wp_kses) wp-includes/kses.php | Filters text content and strips out disallowed HTML. |
| [current\_filter()](current_filter) wp-includes/plugin.php | Retrieves the name of the current filter hook. |
| Version | Description |
| --- | --- |
| [1.0.0](https://developer.wordpress.org/reference/since/1.0.0/) | Introduced. |
wordpress wp_update_themes( array $extra_stats = array() ) wp\_update\_themes( array $extra\_stats = array() )
===================================================
Checks for available updates to themes based on the latest versions hosted on WordPress.org.
Despite its name this function does not actually perform any updates, it only checks for available updates.
A list of all themes installed is sent to WP, along with the site locale.
Checks against the WordPress server at api.wordpress.org. Will only check if WordPress isn’t installing.
`$extra_stats` array Optional Extra statistics to report to the WordPress.org API. Default: `array()`
File: `wp-includes/update.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/update.php/)
```
function wp_update_themes( $extra_stats = array() ) {
if ( wp_installing() ) {
return;
}
// Include an unmodified $wp_version.
require ABSPATH . WPINC . '/version.php';
$installed_themes = wp_get_themes();
$translations = wp_get_installed_translations( 'themes' );
$last_update = get_site_transient( 'update_themes' );
if ( ! is_object( $last_update ) ) {
$last_update = new stdClass;
}
$themes = array();
$checked = array();
$request = array();
// Put slug of active theme into request.
$request['active'] = get_option( 'stylesheet' );
foreach ( $installed_themes as $theme ) {
$checked[ $theme->get_stylesheet() ] = $theme->get( 'Version' );
$themes[ $theme->get_stylesheet() ] = array(
'Name' => $theme->get( 'Name' ),
'Title' => $theme->get( 'Name' ),
'Version' => $theme->get( 'Version' ),
'Author' => $theme->get( 'Author' ),
'Author URI' => $theme->get( 'AuthorURI' ),
'UpdateURI' => $theme->get( 'UpdateURI' ),
'Template' => $theme->get_template(),
'Stylesheet' => $theme->get_stylesheet(),
);
}
$doing_cron = wp_doing_cron();
// Check for update on a different schedule, depending on the page.
switch ( current_filter() ) {
case 'upgrader_process_complete':
$timeout = 0;
break;
case 'load-update-core.php':
$timeout = MINUTE_IN_SECONDS;
break;
case 'load-themes.php':
case 'load-update.php':
$timeout = HOUR_IN_SECONDS;
break;
default:
if ( $doing_cron ) {
$timeout = 2 * HOUR_IN_SECONDS;
} else {
$timeout = 12 * HOUR_IN_SECONDS;
}
}
$time_not_changed = isset( $last_update->last_checked ) && $timeout > ( time() - $last_update->last_checked );
if ( $time_not_changed && ! $extra_stats ) {
$theme_changed = false;
foreach ( $checked as $slug => $v ) {
if ( ! isset( $last_update->checked[ $slug ] ) || (string) $last_update->checked[ $slug ] !== (string) $v ) {
$theme_changed = true;
}
}
if ( isset( $last_update->response ) && is_array( $last_update->response ) ) {
foreach ( $last_update->response as $slug => $update_details ) {
if ( ! isset( $checked[ $slug ] ) ) {
$theme_changed = true;
break;
}
}
}
// Bail if we've checked recently and if nothing has changed.
if ( ! $theme_changed ) {
return;
}
}
// Update last_checked for current to prevent multiple blocking requests if request hangs.
$last_update->last_checked = time();
set_site_transient( 'update_themes', $last_update );
$request['themes'] = $themes;
$locales = array_values( get_available_languages() );
/**
* Filters the locales requested for theme translations.
*
* @since 3.7.0
* @since 4.5.0 The default value of the `$locales` parameter changed to include all locales.
*
* @param string[] $locales Theme locales. Default is all available locales of the site.
*/
$locales = apply_filters( 'themes_update_check_locales', $locales );
$locales = array_unique( $locales );
if ( $doing_cron ) {
$timeout = 30; // 30 seconds.
} else {
// Three seconds, plus one extra second for every 10 themes.
$timeout = 3 + (int) ( count( $themes ) / 10 );
}
$options = array(
'timeout' => $timeout,
'body' => array(
'themes' => wp_json_encode( $request ),
'translations' => wp_json_encode( $translations ),
'locale' => wp_json_encode( $locales ),
),
'user-agent' => 'WordPress/' . $wp_version . '; ' . home_url( '/' ),
);
if ( $extra_stats ) {
$options['body']['update_stats'] = wp_json_encode( $extra_stats );
}
$url = 'http://api.wordpress.org/themes/update-check/1.1/';
$http_url = $url;
$ssl = wp_http_supports( array( 'ssl' ) );
if ( $ssl ) {
$url = set_url_scheme( $url, 'https' );
}
$raw_response = wp_remote_post( $url, $options );
if ( $ssl && is_wp_error( $raw_response ) ) {
trigger_error(
sprintf(
/* translators: %s: Support forums URL. */
__( 'An unexpected error occurred. Something may be wrong with WordPress.org or this server’s configuration. If you continue to have problems, please try the <a href="%s">support forums</a>.' ),
__( 'https://wordpress.org/support/forums/' )
) . ' ' . __( '(WordPress could not establish a secure connection to WordPress.org. Please contact your server administrator.)' ),
headers_sent() || WP_DEBUG ? E_USER_WARNING : E_USER_NOTICE
);
$raw_response = wp_remote_post( $http_url, $options );
}
if ( is_wp_error( $raw_response ) || 200 !== wp_remote_retrieve_response_code( $raw_response ) ) {
return;
}
$new_update = new stdClass;
$new_update->last_checked = time();
$new_update->checked = $checked;
$response = json_decode( wp_remote_retrieve_body( $raw_response ), true );
if ( is_array( $response ) ) {
$new_update->response = $response['themes'];
$new_update->no_update = $response['no_update'];
$new_update->translations = $response['translations'];
}
// Support updates for any themes using the `Update URI` header field.
foreach ( $themes as $theme_stylesheet => $theme_data ) {
if ( ! $theme_data['UpdateURI'] || isset( $new_update->response[ $theme_stylesheet ] ) ) {
continue;
}
$hostname = wp_parse_url( esc_url_raw( $theme_data['UpdateURI'] ), PHP_URL_HOST );
/**
* Filters the update response for a given theme hostname.
*
* The dynamic portion of the hook name, `$hostname`, refers to the hostname
* of the URI specified in the `Update URI` header field.
*
* @since 6.1.0
*
* @param array|false $update {
* The theme update data with the latest details. Default false.
*
* @type string $id Optional. ID of the theme for update purposes, should be a URI
* specified in the `Update URI` header field.
* @type string $theme Directory name of the theme.
* @type string $version The version of the theme.
* @type string $url The URL for details of the theme.
* @type string $package Optional. The update ZIP for the theme.
* @type string $tested Optional. The version of WordPress the theme is tested against.
* @type string $requires_php Optional. The version of PHP which the theme requires.
* @type bool $autoupdate Optional. Whether the theme should automatically update.
* @type array $translations {
* Optional. List of translation updates for the theme.
*
* @type string $language The language the translation update is for.
* @type string $version The version of the theme this translation is for.
* This is not the version of the language file.
* @type string $updated The update timestamp of the translation file.
* Should be a date in the `YYYY-MM-DD HH:MM:SS` format.
* @type string $package The ZIP location containing the translation update.
* @type string $autoupdate Whether the translation should be automatically installed.
* }
* }
* @param array $theme_data Theme headers.
* @param string $theme_stylesheet Theme stylesheet.
* @param string[] $locales Installed locales to look up translations for.
*/
$update = apply_filters( "update_themes_{$hostname}", false, $theme_data, $theme_stylesheet, $locales );
if ( ! $update ) {
continue;
}
$update = (object) $update;
// Is it valid? We require at least a version.
if ( ! isset( $update->version ) ) {
continue;
}
// This should remain constant.
$update->id = $theme_data['UpdateURI'];
// WordPress needs the version field specified as 'new_version'.
if ( ! isset( $update->new_version ) ) {
$update->new_version = $update->version;
}
// Handle any translation updates.
if ( ! empty( $update->translations ) ) {
foreach ( $update->translations as $translation ) {
if ( isset( $translation['language'], $translation['package'] ) ) {
$translation['type'] = 'theme';
$translation['slug'] = isset( $update->theme ) ? $update->theme : $update->id;
$new_update->translations[] = $translation;
}
}
}
unset( $new_update->no_update[ $theme_stylesheet ], $new_update->response[ $theme_stylesheet ] );
if ( version_compare( $update->new_version, $theme_data['Version'], '>' ) ) {
$new_update->response[ $theme_stylesheet ] = (array) $update;
} else {
$new_update->no_update[ $theme_stylesheet ] = (array) $update;
}
}
set_site_transient( 'update_themes', $new_update );
}
```
[apply\_filters( 'themes\_update\_check\_locales', string[] $locales )](../hooks/themes_update_check_locales)
Filters the locales requested for theme translations.
[apply\_filters( "update\_themes\_{$hostname}", array|false $update, array $theme\_data, string $theme\_stylesheet, string[] $locales )](../hooks/update_themes_hostname)
Filters the update response for a given theme hostname.
| Uses | Description |
| --- | --- |
| [wp\_doing\_cron()](wp_doing_cron) wp-includes/load.php | Determines whether the current request is a WordPress cron request. |
| [set\_site\_transient()](set_site_transient) wp-includes/option.php | Sets/updates the value of a site transient. |
| [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. |
| [wp\_get\_themes()](wp_get_themes) wp-includes/theme.php | Returns an array of [WP\_Theme](../classes/wp_theme) objects based on the arguments. |
| [wp\_get\_installed\_translations()](wp_get_installed_translations) wp-includes/l10n.php | Gets installed translations. |
| [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. |
| [get\_site\_transient()](get_site_transient) wp-includes/option.php | Retrieves the value of a site transient. |
| [esc\_url\_raw()](esc_url_raw) wp-includes/formatting.php | Sanitizes a URL for database or redirect usage. |
| [set\_url\_scheme()](set_url_scheme) wp-includes/link-template.php | Sets the scheme for a URL. |
| [wp\_installing()](wp_installing) wp-includes/load.php | Check or set whether WordPress is in “installation” mode. |
| [wp\_http\_supports()](wp_http_supports) wp-includes/http.php | Determines if there is an HTTP Transport that can process this request. |
| [wp\_remote\_post()](wp_remote_post) wp-includes/http.php | Performs an HTTP request using the POST 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. |
| [current\_filter()](current_filter) wp-includes/plugin.php | Retrieves the name of the current filter hook. |
| [get\_option()](get_option) wp-includes/option.php | Retrieves an option value based on an option name. |
| [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. |
| [\_\_()](__) 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. |
| [is\_wp\_error()](is_wp_error) wp-includes/load.php | Checks whether the given variable is a WordPress Error. |
| Used By | Description |
| --- | --- |
| [WP\_Debug\_Data::check\_for\_updates()](../classes/wp_debug_data/check_for_updates) wp-admin/includes/class-wp-debug-data.php | Calls all core functions to check for updates. |
| [wp\_ajax\_update\_theme()](wp_ajax_update_theme) wp-admin/includes/ajax-actions.php | Ajax handler for updating a theme. |
| [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. |
| [\_maybe\_update\_themes()](_maybe_update_themes) wp-includes/update.php | Checks themes versions only after a duration of time. |
| Version | Description |
| --- | --- |
| [2.7.0](https://developer.wordpress.org/reference/since/2.7.0/) | Introduced. |
| programming_docs |
wordpress is_404(): bool is\_404(): bool
===============
Determines whether the query has resulted in a 404 (returns no results).
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 a 404 error.
File: `wp-includes/query.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/query.php/)
```
function is_404() {
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_404();
}
```
| Uses | Description |
| --- | --- |
| [WP\_Query::is\_404()](../classes/wp_query/is_404) wp-includes/class-wp-query.php | Is the query a 404 (returns no results)? |
| [\_\_()](__) 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 |
| --- | --- |
| [print\_embed\_comments\_button()](print_embed_comments_button) wp-includes/embed.php | Prints the necessary markup for the embed comments button. |
| [print\_embed\_sharing\_button()](print_embed_sharing_button) wp-includes/embed.php | Prints the necessary markup for the embed sharing button. |
| [print\_embed\_sharing\_dialog()](print_embed_sharing_dialog) wp-includes/embed.php | Prints the necessary markup for the embed sharing dialog. |
| [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::handle\_404()](../classes/wp/handle_404) wp-includes/class-wp.php | Set the Headers for 404, if nothing is found for requested URL. |
| [wp\_old\_slug\_redirect()](wp_old_slug_redirect) wp-includes/query.php | Redirect old slugs to the correct permalink. |
| [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. |
| [wp\_redirect\_admin\_locations()](wp_redirect_admin_locations) wp-includes/canonical.php | Redirects a variety of shorthand URLs to the admin. |
| [maybe\_redirect\_404()](maybe_redirect_404) wp-includes/ms-functions.php | Corrects 404 redirects when NOBLOGREDIRECT is defined. |
| Version | Description |
| --- | --- |
| [1.5.0](https://developer.wordpress.org/reference/since/1.5.0/) | Introduced. |
wordpress delete_user_option( int $user_id, string $option_name, bool $global = false ): bool delete\_user\_option( int $user\_id, string $option\_name, bool $global = false ): bool
=======================================================================================
Deletes user option with global blog capability.
User options are just like user metadata except that they have support for global blog options. If the ‘global’ parameter is false, which it is by default it will prepend the WordPress table prefix to the option name.
`$user_id` int Required User ID `$option_name` string Required User option name. `$global` bool Optional Whether option name is global or blog specific.
Default false (blog specific). Default: `false`
bool True on success, false on failure.
File: `wp-includes/user.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/user.php/)
```
function delete_user_option( $user_id, $option_name, $global = false ) {
global $wpdb;
if ( ! $global ) {
$option_name = $wpdb->get_blog_prefix() . $option_name;
}
return delete_user_meta( $user_id, $option_name );
}
```
| Uses | Description |
| --- | --- |
| [delete\_user\_meta()](delete_user_meta) wp-includes/user.php | Removes metadata matching criteria from a user. |
| [wpdb::get\_blog\_prefix()](../classes/wpdb/get_blog_prefix) wp-includes/class-wpdb.php | Gets blog prefix. |
| Used By | Description |
| --- | --- |
| [wpmu\_create\_user()](wpmu_create_user) wp-includes/ms-functions.php | Creates a user. |
| Version | Description |
| --- | --- |
| [3.0.0](https://developer.wordpress.org/reference/since/3.0.0/) | Introduced. |
wordpress wp_localize_script( string $handle, string $object_name, array $l10n ): bool wp\_localize\_script( string $handle, string $object\_name, array $l10n ): bool
===============================================================================
Localize a script.
Works only if the script has already been registered.
Accepts an associative array $l10n and creates a JavaScript object:
```
"$object_name" = {
key: value,
key: value,
...
}
```
* [WP\_Scripts::localize()](../classes/wp_scripts/localize)
`$handle` string Required Script handle the data will be attached to. `$object_name` string Required Name for the JavaScript object. Passed directly, so it should be qualified JS variable.
Example: `'/[a-zA-Z0-9_]+/'`. `$l10n` array Required The data itself. The data can be either a single or multi-dimensional array. bool True if the script was successfully localized, false otherwise.
This function localizes a registered script with data for a JavaScript variable.
This lets you offer properly localized translations of any strings used in your script. This is necessary because WordPress currently only offers a localization API in PHP, not directly in JavaScript (but see ticket #20491).
Though localization is the primary use, it was often used to pass generic data from PHP to JavaScript, because it was originally the only official way to do that. [wp\_add\_inline\_script()](wp_add_inline_script) was [introduced in WordPress Version 4.5](https://make.wordpress.org/core/2016/03/08/enhanced-script-loader-in-wordpress-4-5/), and is now the best practice for that use case. `[wp\_localize\_script()](wp_localize_script) ` should only be used when you actually want to localize strings.
`$object_name` is the name of the variable which will contain the data. Note that this should be unique to both the script and to the plugin or theme. Thus, the value here should be properly prefixed with the slug or another unique value, to prevent conflicts. However, as this is a JavaScript object name, it cannot contain dashes. Use underscores or camelCasing.
`$l10n` is the data itself. The data can be either a single- or multi- (as of 3.3) dimensional array. Like [json\_encode()](http://php.net/json_encode), the data will be a JavaScript object if the array is an associate array (a map), otherwise the array will be a JavaScript array.
**IMPORTANT!** [wp\_localize\_script()](wp_localize_script) MUST be called *after* the script has been registered using [wp\_register\_script()](wp_register_script) or [wp\_enqueue\_script()](wp_enqueue_script) .
Furthermore, the actual output of the JavaScript `<script>` a tag containing your localization variable occurs *at the time that the enqueued script is printed (output/included on the page)*. This has some significant repercussions if you enqueue your script as you should using the appropriate actions ([wp\_enqueue\_scripts](../hooks/wp_enqueue_scripts "Plugin API/Action Reference/wp enqueue scripts") and [admin\_enqueue\_scripts](../hooks/admin_enqueue_scripts "Plugin API/Action Reference/admin enqueue scripts")), but wish to localize later using data that is not available at enqueue time.
In this case, consider enqueueing your script with the in\_footer argument set to true, to delay the printing of your script include until much later in the page build (ie: `wp_enqueue_script( $slug, $URL, $deps, $ver, true );` ).
The last chance to localize your script would then be on the ['wp\_print\_footer\_scripts'](wp_print_footer_scripts "Plugin API/Action Reference/wp print footer scripts") hook.
File: `wp-includes/functions.wp-scripts.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/functions-wp-scripts.php/)
```
function wp_localize_script( $handle, $object_name, $l10n ) {
global $wp_scripts;
if ( ! ( $wp_scripts instanceof WP_Scripts ) ) {
_wp_scripts_maybe_doing_it_wrong( __FUNCTION__, $handle );
return false;
}
return $wp_scripts->localize( $handle, $object_name, $l10n );
}
```
| Uses | Description |
| --- | --- |
| [WP\_Scripts::localize()](../classes/wp_scripts/localize) wp-includes/class-wp-scripts.php | Localizes a script, only if the script has already been added. |
| Used By | Description |
| --- | --- |
| [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\_localize\_community\_events()](wp_localize_community_events) wp-includes/script-loader.php | Localizes community events data that needs to be passed to dashboard.js. |
| [the\_custom\_header\_markup()](the_custom_header_markup) wp-includes/theme.php | Prints the markup for a custom header. |
| [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\_Background\_Image\_Control::enqueue()](../classes/wp_customize_background_image_control/enqueue) wp-includes/customize/class-wp-customize-background-image-control.php | Enqueue control related scripts/styles. |
| [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 | |
| [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\_Customize\_Manager::enqueue\_control\_scripts()](../classes/wp_customize_manager/enqueue_control_scripts) wp-includes/class-wp-customize-manager.php | Enqueues scripts for customize controls. |
| [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\_Customize\_Header\_Image\_Control::enqueue()](../classes/wp_customize_header_image_control/enqueue) wp-includes/customize/class-wp-customize-header-image-control.php | |
| [wp\_just\_in\_time\_script\_localization()](wp_just_in_time_script_localization) wp-includes/script-loader.php | Loads localized data on print rather than initialization. |
| Version | Description |
| --- | --- |
| [2.2.0](https://developer.wordpress.org/reference/since/2.2.0/) | Introduced. |
wordpress wp_remote_retrieve_cookies( array|WP_Error $response ): WP_Http_Cookie[] wp\_remote\_retrieve\_cookies( array|WP\_Error $response ): WP\_Http\_Cookie[]
==============================================================================
Retrieve only the cookies from the raw response.
`$response` array|[WP\_Error](../classes/wp_error) Required HTTP response. [WP\_Http\_Cookie](../classes/wp_http_cookie)[] An array of `WP_Http_Cookie` objects from the response.
Empty array if there are none, or the response is a [WP\_Error](../classes/wp_error).
File: `wp-includes/http.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/http.php/)
```
function wp_remote_retrieve_cookies( $response ) {
if ( is_wp_error( $response ) || empty( $response['cookies'] ) ) {
return array();
}
return $response['cookies'];
}
```
| 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\_remote\_retrieve\_cookie()](wp_remote_retrieve_cookie) wp-includes/http.php | Retrieve a single cookie by name from the raw response. |
| Version | Description |
| --- | --- |
| [4.4.0](https://developer.wordpress.org/reference/since/4.4.0/) | Introduced. |
wordpress get_real_file_to_edit( string $file ): string get\_real\_file\_to\_edit( string $file ): string
=================================================
This function has been deprecated.
Get the real filesystem path to a file to edit within the admin.
`$file` string Required Filesystem path relative to the wp-content directory. string Full filesystem path to edit.
File: `wp-admin/includes/deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/deprecated.php/)
```
function get_real_file_to_edit( $file ) {
_deprecated_function( __FUNCTION__, '2.9.0' );
return WP_CONTENT_DIR . $file;
}
```
| 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.9.0](https://developer.wordpress.org/reference/since/2.9.0/) | This function has been deprecated. |
| [1.5.0](https://developer.wordpress.org/reference/since/1.5.0/) | Introduced. |
wordpress wp_cache_supports( string $feature ): bool wp\_cache\_supports( string $feature ): bool
============================================
Determines whether the object cache implementation supports a particular feature.
`$feature` string Required Name of the feature to check for. Possible values include: `'add_multiple'`, `'set_multiple'`, `'get_multiple'`, `'delete_multiple'`, `'flush_runtime'`, `'flush_group'`. bool True if the feature is supported, false otherwise.
File: `wp-includes/cache-compat.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/cache-compat.php/)
```
function wp_cache_supports( $feature ) {
return false;
}
```
| Used By | Description |
| --- | --- |
| [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. |
| Version | Description |
| --- | --- |
| [6.1.0](https://developer.wordpress.org/reference/since/6.1.0/) | Introduced. |
wordpress wp_ajax_delete_meta() wp\_ajax\_delete\_meta()
========================
Ajax handler for deleting meta.
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_meta() {
$id = isset( $_POST['id'] ) ? (int) $_POST['id'] : 0;
check_ajax_referer( "delete-meta_$id" );
$meta = get_metadata_by_mid( 'post', $id );
if ( ! $meta ) {
wp_die( 1 );
}
if ( is_protected_meta( $meta->meta_key, 'post' ) || ! current_user_can( 'delete_post_meta', $meta->post_id, $meta->meta_key ) ) {
wp_die( -1 );
}
if ( delete_meta( $meta->meta_id ) ) {
wp_die( 1 );
}
wp_die( 0 );
}
```
| Uses | Description |
| --- | --- |
| [delete\_meta()](delete_meta) wp-admin/includes/post.php | Deletes post meta data by meta ID. |
| [is\_protected\_meta()](is_protected_meta) wp-includes/meta.php | Determines whether a meta key is considered protected. |
| [get\_metadata\_by\_mid()](get_metadata_by_mid) wp-includes/meta.php | Retrieves metadata by meta 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. |
| Version | Description |
| --- | --- |
| [3.1.0](https://developer.wordpress.org/reference/since/3.1.0/) | Introduced. |
wordpress update_term_meta( int $term_id, string $meta_key, mixed $meta_value, mixed $prev_value = '' ): int|bool|WP_Error update\_term\_meta( int $term\_id, string $meta\_key, mixed $meta\_value, mixed $prev\_value = '' ): int|bool|WP\_Error
=======================================================================================================================
Updates term metadata.
Use the `$prev_value` parameter to differentiate between meta fields with the same key and term ID.
If the meta field for the term does not exist, it will be added.
`$term_id` int Required Term 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|[WP\_Error](../classes/wp_error) 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.
[WP\_Error](../classes/wp_error) when term\_id is ambiguous between taxonomies.
File: `wp-includes/taxonomy.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/taxonomy.php/)
```
function update_term_meta( $term_id, $meta_key, $meta_value, $prev_value = '' ) {
if ( wp_term_is_shared( $term_id ) ) {
return new WP_Error( 'ambiguous_term_id', __( 'Term meta cannot be added to terms that are shared between taxonomies.' ), $term_id );
}
return update_metadata( 'term', $term_id, $meta_key, $meta_value, $prev_value );
}
```
| Uses | Description |
| --- | --- |
| [wp\_term\_is\_shared()](wp_term_is_shared) wp-includes/taxonomy.php | Determines whether a term is shared between multiple taxonomies. |
| [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. |
| [\_\_()](__) 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 |
| --- | --- |
| [4.4.0](https://developer.wordpress.org/reference/since/4.4.0/) | Introduced. |
wordpress edit_comment_link( string $text = null, string $before = '', string $after = '' ) edit\_comment\_link( string $text = null, string $before = '', string $after = '' )
===================================================================================
Displays the edit comment link with formatting.
`$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: `''`
File: `wp-includes/link-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/link-template.php/)
```
function edit_comment_link( $text = null, $before = '', $after = '' ) {
$comment = get_comment();
if ( ! current_user_can( 'edit_comment', $comment->comment_ID ) ) {
return;
}
if ( null === $text ) {
$text = __( 'Edit This' );
}
$link = '<a class="comment-edit-link" href="' . esc_url( get_edit_comment_link( $comment ) ) . '">' . $text . '</a>';
/**
* Filters the comment edit link anchor tag.
*
* @since 2.3.0
*
* @param string $link Anchor tag for the edit link.
* @param string $comment_id Comment ID as a numeric string.
* @param string $text Anchor text.
*/
echo $before . apply_filters( 'edit_comment_link', $link, $comment->comment_ID, $text ) . $after;
}
```
[apply\_filters( 'edit\_comment\_link', string $link, string $comment\_id, string $text )](../hooks/edit_comment_link)
Filters the comment edit link anchor tag.
| Uses | Description |
| --- | --- |
| [get\_edit\_comment\_link()](get_edit_comment_link) wp-includes/link-template.php | Retrieves the edit comment link. |
| [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. |
| [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 |
| --- | --- |
| [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. |
| [Walker\_Comment::ping()](../classes/walker_comment/ping) wp-includes/class-walker-comment.php | Outputs a pingback comment. |
| Version | Description |
| --- | --- |
| [1.0.0](https://developer.wordpress.org/reference/since/1.0.0/) | Introduced. |
| programming_docs |
wordpress wp_is_https_supported(): bool wp\_is\_https\_supported(): bool
================================
Checks whether HTTPS is supported for the server and domain.
bool True if HTTPS is supported, 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_https_supported() {
$https_detection_errors = get_option( 'https_detection_errors' );
// If option has never been set by the Cron hook before, run it on-the-fly as fallback.
if ( false === $https_detection_errors ) {
wp_update_https_detection_errors();
$https_detection_errors = get_option( 'https_detection_errors' );
}
// If there are no detection errors, HTTPS is supported.
return empty( $https_detection_errors );
}
```
| Uses | 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. |
| [get\_option()](get_option) wp-includes/option.php | Retrieves an option value based on an option name. |
| Used By | Description |
| --- | --- |
| [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 wp_get_original_image_path( int $attachment_id, bool $unfiltered = false ): string|false wp\_get\_original\_image\_path( int $attachment\_id, bool $unfiltered = false ): string|false
=============================================================================================
Retrieves the path to an uploaded image file.
Similar to `get_attached_file()` however some images may have been processed after uploading to make them suitable for web use. In this case the attached "full" size file is usually replaced with a scaled down version of the original image. This function always returns the path to the originally uploaded image file.
`$attachment_id` int Required Attachment ID. `$unfiltered` bool Optional Passed through to `get_attached_file()`. Default: `false`
string|false Path to the original image file or false 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_path( $attachment_id, $unfiltered = false ) {
if ( ! wp_attachment_is_image( $attachment_id ) ) {
return false;
}
$image_meta = wp_get_attachment_metadata( $attachment_id );
$image_file = get_attached_file( $attachment_id, $unfiltered );
if ( empty( $image_meta['original_image'] ) ) {
$original_image = $image_file;
} else {
$original_image = path_join( dirname( $image_file ), $image_meta['original_image'] );
}
/**
* Filters the path to the original image.
*
* @since 5.3.0
*
* @param string $original_image Path to original image file.
* @param int $attachment_id Attachment ID.
*/
return apply_filters( 'wp_get_original_image_path', $original_image, $attachment_id );
}
```
[apply\_filters( 'wp\_get\_original\_image\_path', string $original\_image, int $attachment\_id )](../hooks/wp_get_original_image_path)
Filters the path to the original 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\_metadata()](wp_get_attachment_metadata) wp-includes/post.php | Retrieves attachment metadata for attachment ID. |
| [get\_attached\_file()](get_attached_file) wp-includes/post.php | Retrieves attached file path based on 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 |
| --- | --- |
| [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\_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\_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. |
| [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.4.0](https://developer.wordpress.org/reference/since/5.4.0/) | Added the `$unfiltered` parameter. |
| [5.3.0](https://developer.wordpress.org/reference/since/5.3.0/) | Introduced. |
wordpress is_month(): bool is\_month(): bool
=================
Determines whether the query is for an existing month 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 month archive.
File: `wp-includes/query.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/query.php/)
```
function is_month() {
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_month();
}
```
| Uses | Description |
| --- | --- |
| [WP\_Query::is\_month()](../classes/wp_query/is_month) wp-includes/class-wp-query.php | Is the query for an existing month 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 _close_comments_for_old_post( bool $open, int $post_id ): bool \_close\_comments\_for\_old\_post( bool $open, int $post\_id ): 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.
Closes comments on an old post. Hooked to comments\_open and pings\_open.
`$open` bool Required Comments open or closed. `$post_id` int Required Post ID. bool $open
File: `wp-includes/comment.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/comment.php/)
```
function _close_comments_for_old_post( $open, $post_id ) {
if ( ! $open ) {
return $open;
}
if ( ! get_option( 'close_comments_for_old_posts' ) ) {
return $open;
}
$days_old = (int) get_option( 'close_comments_days_old' );
if ( ! $days_old ) {
return $open;
}
$post = get_post( $post_id );
/** This filter is documented in wp-includes/comment.php */
$post_types = apply_filters( 'close_comments_for_post_types', array( 'post' ) );
if ( ! in_array( $post->post_type, $post_types, true ) ) {
return $open;
}
// Undated drafts should not show up as comments closed.
if ( '0000-00-00 00:00:00' === $post->post_date_gmt ) {
return $open;
}
if ( time() - strtotime( $post->post_date_gmt ) > ( $days_old * DAY_IN_SECONDS ) ) {
return false;
}
return $open;
}
```
[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. |
| [get\_post()](get_post) wp-includes/post.php | Retrieves post data given a post ID or post object. |
| Version | Description |
| --- | --- |
| [2.7.0](https://developer.wordpress.org/reference/since/2.7.0/) | Introduced. |
wordpress wp_upgrade() wp\_upgrade()
=============
Runs WordPress Upgrade functions.
Upgrades the database if needed during a site update.
File: `wp-admin/includes/upgrade.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/upgrade.php/)
```
function wp_upgrade() {
global $wp_current_db_version, $wp_db_version, $wpdb;
$wp_current_db_version = __get_option( 'db_version' );
// We are up to date. Nothing to do.
if ( $wp_db_version == $wp_current_db_version ) {
return;
}
if ( ! is_blog_installed() ) {
return;
}
wp_check_mysql_version();
wp_cache_flush();
pre_schema_upgrade();
make_db_current_silent();
upgrade_all();
if ( is_multisite() && is_main_site() ) {
upgrade_network();
}
wp_cache_flush();
if ( is_multisite() ) {
update_site_meta( get_current_blog_id(), 'db_version', $wp_db_version );
update_site_meta( get_current_blog_id(), 'db_last_updated', microtime() );
}
/**
* Fires after a site is fully upgraded.
*
* @since 3.9.0
*
* @param int $wp_db_version The new $wp_db_version.
* @param int $wp_current_db_version The old (current) $wp_db_version.
*/
do_action( 'wp_upgrade', $wp_db_version, $wp_current_db_version );
}
```
[do\_action( 'wp\_upgrade', int $wp\_db\_version, int $wp\_current\_db\_version )](../hooks/wp_upgrade)
Fires after a site is fully upgraded.
| Uses | Description |
| --- | --- |
| [update\_site\_meta()](update_site_meta) wp-includes/ms-site.php | Updates metadata for a site. |
| [wp\_check\_mysql\_version()](wp_check_mysql_version) wp-admin/includes/upgrade.php | Checks the version of the installed MySQL binary. |
| [pre\_schema\_upgrade()](pre_schema_upgrade) wp-admin/includes/upgrade.php | Runs before the schema is upgraded. |
| [make\_db\_current\_silent()](make_db_current_silent) wp-admin/includes/upgrade.php | Updates the database tables to a new schema, but without displaying results. |
| [upgrade\_network()](upgrade_network) wp-admin/includes/upgrade.php | Executes network-level upgrade routines. |
| [wp\_cache\_flush()](wp_cache_flush) wp-includes/cache.php | Removes all cache items. |
| [is\_main\_site()](is_main_site) wp-includes/functions.php | Determines whether a site is the main site of the current network. |
| [is\_blog\_installed()](is_blog_installed) wp-includes/functions.php | Determines whether WordPress is already installed. |
| [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. |
| [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_admin_canonical_url() wp\_admin\_canonical\_url()
===========================
Removes single-use URL parameters and create canonical link based on new URL.
Removes specific query string parameters from a URL, create the canonical link, put it in the admin header, and change the current URL to match.
File: `wp-admin/includes/misc.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/misc.php/)
```
function wp_admin_canonical_url() {
$removable_query_args = wp_removable_query_args();
if ( empty( $removable_query_args ) ) {
return;
}
// Ensure we're using an absolute URL.
$current_url = set_url_scheme( 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] );
$filtered_url = remove_query_arg( $removable_query_args, $current_url );
?>
<link id="wp-admin-canonical" rel="canonical" href="<?php echo esc_url( $filtered_url ); ?>" />
<script>
if ( window.history.replaceState ) {
window.history.replaceState( null, null, document.getElementById( 'wp-admin-canonical' ).href + window.location.hash );
}
</script>
<?php
}
```
| Uses | Description |
| --- | --- |
| [wp\_removable\_query\_args()](wp_removable_query_args) wp-includes/functions.php | Returns an array of single-use query variable names that can be removed from a URL. |
| [remove\_query\_arg()](remove_query_arg) wp-includes/functions.php | Removes an item or items from a query string. |
| [set\_url\_scheme()](set_url_scheme) wp-includes/link-template.php | Sets the scheme for a URL. |
| [esc\_url()](esc_url) wp-includes/formatting.php | Checks and cleans a URL. |
| Version | Description |
| --- | --- |
| [4.2.0](https://developer.wordpress.org/reference/since/4.2.0/) | Introduced. |
wordpress edit_term_link( string $link = '', string $before = '', string $after = '', int|WP_Term|null $term = null, bool $echo = true ): string|void edit\_term\_link( string $link = '', string $before = '', string $after = '', int|WP\_Term|null $term = null, bool $echo = true ): string|void
==============================================================================================================================================
Displays or retrieves the edit term link with formatting.
`$link` string Optional Anchor text. If empty, default is 'Edit This'. Default: `''`
`$before` string Optional Display before edit link. Default: `''`
`$after` string Optional Display after edit link. Default: `''`
`$term` int|[WP\_Term](../classes/wp_term)|null Optional Term ID or object. If null, the queried object will be inspected. Default: `null`
`$echo` bool Optional Whether or not to echo the return. Default: `true`
string|void HTML content.
File: `wp-includes/link-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/link-template.php/)
```
function edit_term_link( $link = '', $before = '', $after = '', $term = null, $echo = true ) {
if ( is_null( $term ) ) {
$term = get_queried_object();
} else {
$term = get_term( $term );
}
if ( ! $term ) {
return;
}
$tax = get_taxonomy( $term->taxonomy );
if ( ! current_user_can( 'edit_term', $term->term_id ) ) {
return;
}
if ( empty( $link ) ) {
$link = __( 'Edit This' );
}
$link = '<a href="' . get_edit_term_link( $term->term_id, $term->taxonomy ) . '">' . $link . '</a>';
/**
* Filters the anchor tag for the edit link of a term.
*
* @since 3.1.0
*
* @param string $link The anchor tag for the edit link.
* @param int $term_id Term ID.
*/
$link = $before . apply_filters( 'edit_term_link', $link, $term->term_id ) . $after;
if ( $echo ) {
echo $link;
} else {
return $link;
}
}
```
[apply\_filters( 'edit\_term\_link', string $link, int $term\_id )](../hooks/edit_term_link)
Filters the anchor tag for the edit link of a term.
| Uses | Description |
| --- | --- |
| [get\_queried\_object()](get_queried_object) wp-includes/query.php | Retrieves the currently queried object. |
| [get\_edit\_term\_link()](get_edit_term_link) wp-includes/link-template.php | Retrieves the URL for editing a given term. |
| [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\_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. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| Used By | Description |
| --- | --- |
| [edit\_tag\_link()](edit_tag_link) wp-includes/link-template.php | Displays or retrieves the edit link for a tag with formatting. |
| Version | Description |
| --- | --- |
| [3.1.0](https://developer.wordpress.org/reference/since/3.1.0/) | Introduced. |
wordpress wp_get_global_settings( array $path = array(), array $context = array() ): array wp\_get\_global\_settings( array $path = array(), array $context = array() ): array
===================================================================================
Gets the settings resulting of merging core, theme, and user data.
`$path` array Optional Path to the specific setting to retrieve. Optional.
If empty, will return all settings. Default: `array()`
`$context` array Optional Metadata to know where to retrieve the $path from. Optional.
* `block_name`stringWhich block to retrieve the settings from.
If empty, it'll return the settings for the global context.
* `origin`stringWhich origin to take data from.
Valid values are `'all'` (core, theme, and user) or `'base'` (core and theme).
If empty or unknown, `'all'` is used.
Default: `array()`
array The settings to retrieve.
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_settings( $path = array(), $context = array() ) {
if ( ! empty( $context['block_name'] ) ) {
$path = array_merge( array( 'blocks', $context['block_name'] ), $path );
}
$origin = 'custom';
if ( isset( $context['origin'] ) && 'base' === $context['origin'] ) {
$origin = 'theme';
}
$settings = WP_Theme_JSON_Resolver::get_merged_data( $origin )->get_settings();
return _wp_array_get( $settings, $path, $settings );
}
```
| 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\_array\_get()](_wp_array_get) wp-includes/functions.php | Accesses an array in depth based on a path of keys. |
| 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 |
| --- | --- |
| [5.9.0](https://developer.wordpress.org/reference/since/5.9.0/) | Introduced. |
wordpress bloginfo( string $show = '' ) bloginfo( string $show = '' )
=============================
Displays information about the current site.
* [get\_bloginfo()](get_bloginfo) : For possible `$show` values
`$show` string Optional Site information to display. Default: `''`
Displays information about your site, mostly gathered from the information you supply in your [User Profile](https://codex.wordpress.org/Administration_Panels#Your_Profile "Administration Panels") and [General Settings](https://codex.wordpress.org/Administration_Panels#General_Settings "Administration Panels") WordPress [Administration Screens](https://codex.wordpress.org/Administration_Screens "Administration Screens"). It can be used anywhere within a template file. This always prints a result to the browser. If you need the values for use in PHP, use [get\_bloginfo()](get_bloginfo) .
* ‘**name**‘ – Displays the “Site Title” set in Settings > General. This data is retrieved from the “blogname” record in the [wp\_options table](https://codex.wordpress.org/Database_Description#Table:_wp_options "Database Description").
* ‘**description**‘ – Displays the “Tagline” set in Settings > General. This data is retrieved from the “blogdescription” record in the [wp\_options table](https://codex.wordpress.org/Database_Description#Table:_wp_options "Database Description").
* ‘**wpurl**‘ – Displays the “WordPress address (URL)” set in Settings > General. This data is retrieved from the “siteurl” record in the [wp\_options table](https://codex.wordpress.org/Database_Description#Table:_wp_options "Database Description"). Consider echoing [site\_url()](site_url) instead, especially for multi-site configurations using paths instead of subdomains (it will return the root site not the current sub-site).
* ‘**url**‘ – Displays the “Site address (URL)” set in Settings > General. This data is retrieved from the “home” record in the [wp\_options table](https://codex.wordpress.org/Database_Description#Table:_wp_options "Database Description"). Consider echoing [home\_url()](home_url) instead.
* ‘**admin\_email**‘ – Displays the “E-mail address” set in Settings > General. This data is retrieved from the “admin\_email” record in the [wp\_options table](https://codex.wordpress.org/Database_Description#Table:_wp_options "Database Description").
* ‘**charset**‘ – Displays the “Encoding for pages and feeds” set in Settings > Reading. This data is retrieved from the “blog\_charset” record in the [wp\_options table](https://codex.wordpress.org/Database_Description#Table:_wp_options "Database Description"). **Note:** this parameter always echoes “UTF-8”, which is the default encoding of WordPress.
* ‘**version**‘ – Displays the WordPress Version you use. This data is retrieved from the $wp\_version variable set in `wp-includes/version.php`.
* ‘**html\_type**‘ – Displays the Content-Type of WordPress HTML pages (default: “text/html”). This data is retrieved from the “html\_type” record in the [wp\_options table](https://codex.wordpress.org/Database_Description#Table:_wp_options "Database Description"). Themes and plugins can override the default value using the [pre\_option\_html\_type](../hooks/pre_option_option "Plugin API/Filter Reference") filter.
* ‘**text\_direction**‘ – Displays the Text Direction of WordPress HTML pages. Consider using [is\_rtl()](is_rtl) instead.
* ‘**language**‘ – Displays the language of WordPress.
* ‘**stylesheet\_url**‘ – Displays the primary CSS (usually *style.css*) file URL of the active theme. Consider echoing [get\_stylesheet\_uri()](get_stylesheet_uri) instead.
* ‘**stylesheet\_directory**‘ – Displays the stylesheet directory URL of the active theme. (Was a local path in earlier WordPress versions.) Consider echoing [get\_stylesheet\_directory\_uri()](get_stylesheet_directory_uri) instead.
* ‘**template\_url**‘ / ‘**template\_directory**‘ – URL of the active theme’s directory. Within child themes, both get\_bloginfo(‘template\_url’) and [get\_template()](get_template) will return the *parent* theme directory. Consider echoing [get\_template\_directory\_uri()](get_template_directory_uri) instead (for the parent template directory) or [get\_stylesheet\_directory\_uri()](get_stylesheet_directory_uri) (for the child template directory).
* ‘**pingback\_url**‘ – Displays the Pingback XML-RPC file URL (*xmlrpc.php*).
* ‘**atom\_url**‘ – Displays the Atom feed URL (*/feed/atom*).
* ‘**rdf\_url**‘ – Displays the RDF/RSS 1.0 feed URL (*/feed/rfd*).
* ‘**rss\_url**‘ – Displays the RSS 0.92 feed URL (*/feed/rss*).
* ‘**rss2\_url**‘ – Displays the RSS 2.0 feed URL (*/feed*).
* ‘**comments\_atom\_url**‘ – Displays the comments Atom feed URL (*/comments/feed*).
* ‘**comments\_rss2\_url**‘ – Displays the comments RSS 2.0 feed URL (*/comments/feed*).
* ‘**siteurl**‘ – Deprecated since version 2.2. Echo [home\_url()](home_url) , or use bloginfo(‘url’).
* ‘**home**‘ – Deprecated since version 2.2. Echo [home\_url()](home_url) , or use bloginfo(‘url’).
File: `wp-includes/general-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/general-template.php/)
```
function bloginfo( $show = '' ) {
echo get_bloginfo( $show, 'display' );
}
```
| Uses | Description |
| --- | --- |
| [get\_bloginfo()](get_bloginfo) wp-includes/general-template.php | Retrieves information about the current site. |
| Used By | Description |
| --- | --- |
| [WP\_REST\_Widget\_Types\_Controller::render\_legacy\_widget\_preview\_iframe()](../classes/wp_rest_widget_types_controller/render_legacy_widget_preview_iframe) wp-includes/rest-api/endpoints/class-wp-rest-widget-types-controller.php | Renders a page containing a preview of the requested Legacy Widget block. |
| [login\_header()](login_header) wp-login.php | Output the login page header. |
| [\_wp\_admin\_html\_begin()](_wp_admin_html_begin) wp-admin/includes/template.php | Prints out the beginning of the admin HTML header. |
| [iframe\_header()](iframe_header) wp-admin/includes/template.php | Generic Iframe header for use with Thickbox. |
| [wp\_iframe()](wp_iframe) wp-admin/includes/media.php | Outputs the iframe to display the media upload page. |
| [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. |
| Version | Description |
| --- | --- |
| [0.71](https://developer.wordpress.org/reference/since/0.71/) | Introduced. |
| programming_docs |
wordpress has_filter( string $hook_name, callable|string|array|false $callback = false ): bool|int has\_filter( string $hook\_name, callable|string|array|false $callback = false ): bool|int
==========================================================================================
Checks if any filter has been registered for a hook.
When using the `$callback` argument, this function may return a non-boolean value that evaluates to false (e.g. 0), so use the `===` operator for testing the return value.
`$hook_name` string Required The name of the filter hook. `$callback` callable|string|array|false Optional The callback to check for.
This function can be called unconditionally to speculatively check a callback that may or may not exist. Default: `false`
bool|int If `$callback` is omitted, returns boolean for whether the hook has anything registered. When checking a specific function, the priority of that hook is returned, or false if the function is not attached.
File: `wp-includes/plugin.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/plugin.php/)
```
function has_filter( $hook_name, $callback = false ) {
global $wp_filter;
if ( ! isset( $wp_filter[ $hook_name ] ) ) {
return false;
}
return $wp_filter[ $hook_name ]->has_filter( $hook_name, $callback );
}
```
| Used By | Description |
| --- | --- |
| [core\_auto\_updates\_settings()](core_auto_updates_settings) wp-admin/update-core.php | Display WordPress auto-updates settings. |
| [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::check\_wp\_version\_check\_exists()](../classes/wp_site_health/check_wp_version_check_exists) wp-admin/includes/class-wp-site-health.php | Tests whether `wp_version_check` is blocked. |
| [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. |
| [update\_sitemeta\_cache()](update_sitemeta_cache) wp-includes/ms-site.php | Updates metadata cache for list of site IDs. |
| [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. |
| [wpdb::placeholder\_escape()](../classes/wpdb/placeholder_escape) wp-includes/class-wpdb.php | Generates and returns a placeholder escape string for use in queries returned by ::prepare(). |
| [apply\_filters\_deprecated()](apply_filters_deprecated) wp-includes/plugin.php | Fires functions attached to a deprecated filter hook. |
| [WP\_Customize\_Nav\_Menu\_Item\_Setting::preview()](../classes/wp_customize_nav_menu_item_setting/preview) wp-includes/customize/class-wp-customize-nav-menu-item-setting.php | Handle previewing the setting. |
| [WP\_MS\_Sites\_List\_Table::column\_plugins()](../classes/wp_ms_sites_list_table/column_plugins) wp-admin/includes/class-wp-ms-sites-list-table.php | Handles the plugins column output. |
| [Core\_Upgrader::upgrade()](../classes/core_upgrader/upgrade) wp-admin/includes/class-core-upgrader.php | Upgrade WordPress core. |
| [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 | |
| [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::build\_query\_string()](../classes/wp/build_query_string) wp-includes/class-wp.php | Sets the query string property based off of the query variable property. |
| [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\_Embed::shortcode()](../classes/wp_embed/shortcode) wp-includes/class-wp-embed.php | The [do\_shortcode()](do_shortcode) callback function. |
| [has\_action()](has_action) wp-includes/plugin.php | Checks if any action has been registered for a hook. |
| [wp\_update\_comment()](wp_update_comment) wp-includes/comment.php | Updates an existing comment in the database. |
| [sanitize\_meta()](sanitize_meta) wp-includes/meta.php | Sanitizes meta value. |
| [register\_meta()](register_meta) wp-includes/meta.php | Registers a meta key. |
| [\_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 |
| --- | --- |
| [2.5.0](https://developer.wordpress.org/reference/since/2.5.0/) | Introduced. |
wordpress update_blog_status( int $blog_id, string $pref, string $value, null $deprecated = null ): string|false update\_blog\_status( int $blog\_id, string $pref, string $value, null $deprecated = null ): string|false
=========================================================================================================
Update a blog details field.
`$blog_id` int Required Blog ID. `$pref` string Required Field name. `$value` string Required Field value. `$deprecated` null Optional Not used. Default: `null`
string|false $value
File: `wp-includes/ms-blogs.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/ms-blogs.php/)
```
function update_blog_status( $blog_id, $pref, $value, $deprecated = null ) {
global $wpdb;
if ( null !== $deprecated ) {
_deprecated_argument( __FUNCTION__, '3.1.0' );
}
$allowed_field_names = array( 'site_id', 'domain', 'path', 'registered', 'last_updated', 'public', 'archived', 'mature', 'spam', 'deleted', 'lang_id' );
if ( ! in_array( $pref, $allowed_field_names, true ) ) {
return $value;
}
$result = wp_update_site(
$blog_id,
array(
$pref => $value,
)
);
if ( is_wp_error( $result ) ) {
return false;
}
return $value;
}
```
| Uses | Description |
| --- | --- |
| [wp\_update\_site()](wp_update_site) wp-includes/ms-site.php | Updates a site in the database. |
| [\_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 |
| --- | --- |
| [wpmu\_delete\_blog()](wpmu_delete_blog) wp-admin/includes/ms.php | Delete a site. |
| [update\_blog\_public()](update_blog_public) wp-includes/ms-functions.php | Updates this blog’s ‘public’ setting in the global blogs table. |
| [update\_archived()](update_archived) wp-includes/ms-blogs.php | Update the ‘archived’ status of a particular blog. |
| Version | Description |
| --- | --- |
| [MU (3.0.0)](https://developer.wordpress.org/reference/since/mu.3.0.0/) | MU (3.0.0) |
| [5.1.0](https://developer.wordpress.org/reference/since/5.1.0/) | Introduced. |
wordpress get_links_list( string $order = 'name' ) get\_links\_list( string $order = 'name' )
==========================================
This function has been deprecated. Use [wp\_list\_bookmarks()](wp_list_bookmarks) instead.
Output entire list of links by category.
Output a list of all links, listed by category, using the settings in $[wpdb](../classes/wpdb)->linkcategories and output it as a nested HTML unordered list.
* [wp\_list\_bookmarks()](wp_list_bookmarks)
`$order` string Optional Sort link categories by `'name'` or `'id'` Default: `'name'`
File: `wp-includes/deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/deprecated.php/)
```
function get_links_list($order = 'name') {
_deprecated_function( __FUNCTION__, '2.1.0', 'wp_list_bookmarks()' );
$order = strtolower($order);
// Handle link category sorting.
$direction = 'ASC';
if ( '_' == substr($order,0,1) ) {
$direction = 'DESC';
$order = substr($order,1);
}
if ( !isset($direction) )
$direction = '';
$cats = get_categories(array('type' => 'link', 'orderby' => $order, 'order' => $direction, 'hierarchical' => 0));
// Display each category.
if ( $cats ) {
foreach ( (array) $cats as $cat ) {
// Handle each category.
// Display the category name.
echo ' <li id="linkcat-' . $cat->term_id . '" class="linkcat"><h2>' . apply_filters('link_category', $cat->name ) . "</h2>\n\t<ul>\n";
// Call get_links() with all the appropriate params.
get_links($cat->term_id, '<li>', "</li>", "\n", true, 'name', false);
// Close the last category.
echo "\n\t</ul>\n</li>\n";
}
}
}
```
[apply\_filters( 'link\_category', string $cat\_name )](../hooks/link_category)
Filters the category name.
| Uses | Description |
| --- | --- |
| [get\_links()](get_links) wp-includes/deprecated.php | Gets the links associated with category by ID. |
| [get\_categories()](get_categories) wp-includes/category.php | Retrieves a list of category objects. |
| [\_deprecated\_function()](_deprecated_function) wp-includes/functions.php | Marks a function 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. |
| Version | Description |
| --- | --- |
| [2.1.0](https://developer.wordpress.org/reference/since/2.1.0/) | Use [wp\_list\_bookmarks()](wp_list_bookmarks) |
| [1.0.1](https://developer.wordpress.org/reference/since/1.0.1/) | Introduced. |
wordpress wp_resource_hints() wp\_resource\_hints()
=====================
Prints resource hints to browsers for pre-fetching, pre-rendering and pre-connecting to web sites.
Gives hints to browsers to prefetch specific pages or render them in the background, to perform DNS lookups or to begin the connection handshake (DNS, TCP, TLS) in the background.
These performance improving indicators work by using `<link rel"…">`.
File: `wp-includes/general-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/general-template.php/)
```
function wp_resource_hints() {
$hints = array(
'dns-prefetch' => wp_dependencies_unique_hosts(),
'preconnect' => array(),
'prefetch' => array(),
'prerender' => array(),
);
foreach ( $hints as $relation_type => $urls ) {
$unique_urls = array();
/**
* Filters domains and URLs for resource hints of relation type.
*
* @since 4.6.0
* @since 4.7.0 The `$urls` parameter accepts arrays of specific HTML attributes
* as its child elements.
*
* @param array $urls {
* Array of resources and their attributes, or URLs to print for resource hints.
*
* @type array|string ...$0 {
* Array of resource attributes, or a URL string.
*
* @type string $href URL to include in resource hints. Required.
* @type string $as How the browser should treat the resource
* (`script`, `style`, `image`, `document`, etc).
* @type string $crossorigin Indicates the CORS policy of the specified resource.
* @type float $pr Expected probability that the resource hint will be used.
* @type string $type Type of the resource (`text/html`, `text/css`, etc).
* }
* }
* @param string $relation_type The relation type the URLs are printed for,
* e.g. 'preconnect' or 'prerender'.
*/
$urls = apply_filters( 'wp_resource_hints', $urls, $relation_type );
foreach ( $urls as $key => $url ) {
$atts = array();
if ( is_array( $url ) ) {
if ( isset( $url['href'] ) ) {
$atts = $url;
$url = $url['href'];
} else {
continue;
}
}
$url = esc_url( $url, array( 'http', 'https' ) );
if ( ! $url ) {
continue;
}
if ( isset( $unique_urls[ $url ] ) ) {
continue;
}
if ( in_array( $relation_type, array( 'preconnect', 'dns-prefetch' ), true ) ) {
$parsed = wp_parse_url( $url );
if ( empty( $parsed['host'] ) ) {
continue;
}
if ( 'preconnect' === $relation_type && ! empty( $parsed['scheme'] ) ) {
$url = $parsed['scheme'] . '://' . $parsed['host'];
} else {
// Use protocol-relative URLs for dns-prefetch or if scheme is missing.
$url = '//' . $parsed['host'];
}
}
$atts['rel'] = $relation_type;
$atts['href'] = $url;
$unique_urls[ $url ] = $atts;
}
foreach ( $unique_urls as $atts ) {
$html = '';
foreach ( $atts as $attr => $value ) {
if ( ! is_scalar( $value )
|| ( ! in_array( $attr, array( 'as', 'crossorigin', 'href', 'pr', 'rel', 'type' ), true ) && ! is_numeric( $attr ) )
) {
continue;
}
$value = ( 'href' === $attr ) ? esc_url( $value ) : esc_attr( $value );
if ( ! is_string( $attr ) ) {
$html .= " $value";
} else {
$html .= " $attr='$value'";
}
}
$html = trim( $html );
echo "<link $html />\n";
}
}
}
```
[apply\_filters( 'wp\_resource\_hints', array $urls, string $relation\_type )](../hooks/wp_resource_hints)
Filters domains and URLs for resource hints of relation type.
| Uses | Description |
| --- | --- |
| [wp\_dependencies\_unique\_hosts()](wp_dependencies_unique_hosts) wp-includes/general-template.php | Retrieves a list of unique hosts of all enqueued scripts and styles. |
| [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. |
| [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 |
| --- | --- |
| [4.6.0](https://developer.wordpress.org/reference/since/4.6.0/) | Introduced. |
wordpress get_permalink( int|WP_Post $post, bool $leavename = false ): string|false get\_permalink( int|WP\_Post $post, bool $leavename = false ): string|false
===========================================================================
Retrieves the full permalink for the current post or post ID.
`$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 or page name. Default: `false`
string|false The permalink URL. False if the post does not exist.
In a Plugin or Theme, it can be used as early as the `[setup\_theme](../hooks/setup_theme)` Action. Any earlier usage, including `[plugins\_loaded](../hooks/plugins_loaded)`, generates a Fatal Error.
Note that when used outside The Loop on a posts page (index, archive, etc.) without the ID parameter, it will return the URL of the last post in The Loop, *not* the permalink for the current page.
File: `wp-includes/link-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/link-template.php/)
```
function get_permalink( $post = 0, $leavename = false ) {
$rewritecode = array(
'%year%',
'%monthnum%',
'%day%',
'%hour%',
'%minute%',
'%second%',
$leavename ? '' : '%postname%',
'%post_id%',
'%category%',
'%author%',
$leavename ? '' : '%pagename%',
);
if ( is_object( $post ) && isset( $post->filter ) && 'sample' === $post->filter ) {
$sample = true;
} else {
$post = get_post( $post );
$sample = false;
}
if ( empty( $post->ID ) ) {
return false;
}
if ( 'page' === $post->post_type ) {
return get_page_link( $post, $leavename, $sample );
} elseif ( 'attachment' === $post->post_type ) {
return get_attachment_link( $post, $leavename );
} elseif ( in_array( $post->post_type, get_post_types( array( '_builtin' => false ) ), true ) ) {
return get_post_permalink( $post, $leavename, $sample );
}
$permalink = get_option( 'permalink_structure' );
/**
* Filters the permalink structure for a post before token replacement occurs.
*
* Only applies to posts with post_type of 'post'.
*
* @since 3.0.0
*
* @param string $permalink The site's permalink structure.
* @param WP_Post $post The post in question.
* @param bool $leavename Whether to keep the post name.
*/
$permalink = apply_filters( 'pre_post_link', $permalink, $post, $leavename );
if (
$permalink &&
! wp_force_plain_post_permalink( $post )
) {
$category = '';
if ( strpos( $permalink, '%category%' ) !== false ) {
$cats = get_the_category( $post->ID );
if ( $cats ) {
$cats = wp_list_sort(
$cats,
array(
'term_id' => 'ASC',
)
);
/**
* Filters the category that gets used in the %category% permalink token.
*
* @since 3.5.0
*
* @param WP_Term $cat The category to use in the permalink.
* @param array $cats Array of all categories (WP_Term objects) associated with the post.
* @param WP_Post $post The post in question.
*/
$category_object = apply_filters( 'post_link_category', $cats[0], $cats, $post );
$category_object = get_term( $category_object, 'category' );
$category = $category_object->slug;
if ( $category_object->parent ) {
$category = get_category_parents( $category_object->parent, false, '/', true ) . $category;
}
}
// Show default category in permalinks,
// without having to assign it explicitly.
if ( empty( $category ) ) {
$default_category = get_term( get_option( 'default_category' ), 'category' );
if ( $default_category && ! is_wp_error( $default_category ) ) {
$category = $default_category->slug;
}
}
}
$author = '';
if ( strpos( $permalink, '%author%' ) !== false ) {
$authordata = get_userdata( $post->post_author );
$author = $authordata->user_nicename;
}
// This is not an API call because the permalink is based on the stored post_date value,
// which should be parsed as local time regardless of the default PHP timezone.
$date = explode( ' ', str_replace( array( '-', ':' ), ' ', $post->post_date ) );
$rewritereplace = array(
$date[0],
$date[1],
$date[2],
$date[3],
$date[4],
$date[5],
$post->post_name,
$post->ID,
$category,
$author,
$post->post_name,
);
$permalink = home_url( str_replace( $rewritecode, $rewritereplace, $permalink ) );
$permalink = user_trailingslashit( $permalink, 'single' );
} else { // If they're not using the fancy permalink option.
$permalink = home_url( '?p=' . $post->ID );
}
/**
* Filters the permalink for a post.
*
* Only applies to posts with post_type of 'post'.
*
* @since 1.5.0
*
* @param string $permalink The post's permalink.
* @param WP_Post $post The post in question.
* @param bool $leavename Whether to keep the post name.
*/
return apply_filters( 'post_link', $permalink, $post, $leavename );
}
```
[apply\_filters( 'post\_link', string $permalink, WP\_Post $post, bool $leavename )](../hooks/post_link)
Filters the permalink for a post.
[apply\_filters( 'post\_link\_category', WP\_Term $cat, array $cats, WP\_Post $post )](../hooks/post_link_category)
Filters the category that gets used in the %category% permalink token.
[apply\_filters( 'pre\_post\_link', string $permalink, WP\_Post $post, bool $leavename )](../hooks/pre_post_link)
Filters the permalink structure for a post before token replacement occurs.
| 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. |
| [wp\_list\_sort()](wp_list_sort) wp-includes/functions.php | Sorts an array of objects or arrays based on one or more orderby arguments. |
| [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\_page\_link()](get_page_link) wp-includes/link-template.php | Retrieves the permalink for the current page or page ID. |
| [get\_attachment\_link()](get_attachment_link) wp-includes/link-template.php | Retrieves the permalink for an attachment. |
| [get\_post\_permalink()](get_post_permalink) wp-includes/link-template.php | Retrieves the permalink for a post of a custom post type. |
| [user\_trailingslashit()](user_trailingslashit) wp-includes/link-template.php | Retrieves a trailing-slashed string if the site is set for adding trailing slashes. |
| [get\_userdata()](get_userdata) wp-includes/pluggable.php | Retrieves user info by user ID. |
| [get\_term()](get_term) wp-includes/taxonomy.php | Gets all term data from database by term ID. |
| [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. |
| [get\_post()](get_post) wp-includes/post.php | Retrieves post data given a post ID or post object. |
| [get\_post\_types()](get_post_types) wp-includes/post.php | Gets a list of all registered post type objects. |
| [is\_wp\_error()](is_wp_error) wp-includes/load.php | Checks whether the given variable is a WordPress Error. |
| Used By | Description |
| --- | --- |
| [WP\_Sitemaps\_Posts::get\_url\_list()](../classes/wp_sitemaps_posts/get_url_list) wp-includes/sitemaps/providers/class-wp-sitemaps-posts.php | Gets a URL list for a post type sitemap. |
| [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. |
| [get\_privacy\_policy\_url()](get_privacy_policy_url) wp-includes/link-template.php | Retrieves the URL to the privacy policy page. |
| [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\_item()](../classes/wp_rest_posts_controller/get_item) wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php | Retrieves a single 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\_get\_canonical\_url()](wp_get_canonical_url) wp-includes/link-template.php | Returns the canonical URL for a 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. |
| [wp\_oembed\_add\_discovery\_links()](wp_oembed_add_discovery_links) wp-includes/embed.php | Adds oEmbed discovery links in the head element of the website. |
| [get\_post\_embed\_url()](get_post_embed_url) wp-includes/embed.php | Retrieves the URL to embed a specific post in an iframe. |
| [get\_post\_embed\_html()](get_post_embed_html) wp-includes/embed.php | Retrieves the embed code for a specific post. |
| [get\_preview\_post\_link()](get_preview_post_link) wp-includes/link-template.php | Retrieves the URL used for the post preview. |
| [WP\_Customize\_Nav\_Menu\_Item\_Setting::value\_as\_wp\_post\_nav\_menu\_item()](../classes/wp_customize_nav_menu_item_setting/value_as_wp_post_nav_menu_item) wp-includes/customize/class-wp-customize-nav-menu-item-setting.php | Get the value emulated into a [WP\_Post](../classes/wp_post) and set up as a nav\_menu\_item. |
| [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::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\_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\_install\_maybe\_enable\_pretty\_permalinks()](wp_install_maybe_enable_pretty_permalinks) wp-admin/includes/upgrade.php | Maybe enable pretty permalinks on installation. |
| [wp\_dashboard\_recent\_posts()](wp_dashboard_recent_posts) wp-admin/includes/dashboard.php | Generates Publishing Soon and Recently Published sections. |
| [get\_media\_item()](get_media_item) wp-admin/includes/media.php | Retrieves HTML form for modifying the image attachment. |
| [get\_sample\_permalink\_html()](get_sample_permalink_html) wp-admin/includes/post.php | Returns the HTML of the sample permalink slug editor. |
| [get\_sample\_permalink()](get_sample_permalink) wp-admin/includes/post.php | Returns a sample permalink based on the post name. |
| [WP\_Media\_List\_Table::\_get\_row\_actions()](../classes/wp_media_list_table/_get_row_actions) wp-admin/includes/class-wp-media-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\_list\_categories()](wp_list_categories) wp-includes/category-template.php | Displays or retrieves the HTML list of categories. |
| [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\_get\_archives()](wp_get_archives) wp-includes/general-template.php | Displays archive links based on type and format. |
| [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. |
| [previous\_post()](previous_post) wp-includes/deprecated.php | Prints a link to the previous post. |
| [next\_post()](next_post) wp-includes/deprecated.php | Prints link to the next post. |
| [wp\_old\_slug\_redirect()](wp_old_slug_redirect) wp-includes/query.php | Redirect old slugs to the correct permalink. |
| [get\_comments\_pagenum\_link()](get_comments_pagenum_link) wp-includes/link-template.php | Retrieves the comments page number link. |
| [paginate\_comments\_links()](paginate_comments_links) wp-includes/link-template.php | Displays or retrieves pagination links for the comments on the current post. |
| [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. |
| [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\_comments\_feed\_link()](get_post_comments_feed_link) wp-includes/link-template.php | Retrieves the permalink for the post comments feed. |
| [get\_the\_permalink()](get_the_permalink) wp-includes/link-template.php | Retrieves the full permalink for the current post or post ID. |
| [get\_attachment\_link()](get_attachment_link) wp-includes/link-template.php | Retrieves the permalink for an attachment. |
| [post\_permalink()](post_permalink) wp-includes/deprecated.php | Retrieve permalink from post ID. |
| [the\_permalink()](the_permalink) wp-includes/link-template.php | Displays the permalink for the current post. |
| [wp\_admin\_bar\_edit\_menu()](wp_admin_bar_edit_menu) wp-includes/admin-bar.php | Provides an edit link for posts and terms. |
| [the\_permalink\_rss()](the_permalink_rss) wp-includes/feed.php | Displays the permalink to the post for use in feeds. |
| [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\_link\_page()](_wp_link_page) wp-includes/post-template.php | Helper function for [wp\_link\_pages()](wp_link_pages) . |
| [get\_the\_content()](get_the_content) wp-includes/post-template.php | Retrieves the post content. |
| [\_transition\_post\_status()](_transition_post_status) wp-includes/post.php | Hook for managing future post transitions to published. |
| [wp\_insert\_post()](wp_insert_post) wp-includes/post.php | Inserts or update a post. |
| [redirect\_guess\_404\_permalink()](redirect_guess_404_permalink) wp-includes/canonical.php | Attempts to guess the correct URL for a 404 request based on query vars. |
| [redirect\_canonical()](redirect_canonical) wp-includes/canonical.php | Redirects incoming links to the proper URL based on the site url. |
| [get\_blog\_permalink()](get_blog_permalink) wp-includes/ms-functions.php | Gets the permalink for a post on another blog. |
| [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::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\_page()](../classes/wp_xmlrpc_server/_prepare_page) wp-includes/class-wp-xmlrpc-server.php | Prepares page data for return in an XML-RPC object. |
| [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. |
| [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\_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. |
| [get\_comment\_reply\_link()](get_comment_reply_link) wp-includes/comment-template.php | Retrieves HTML content for reply to comment link. |
| [get\_comment\_link()](get_comment_link) wp-includes/comment-template.php | Retrieves the link to a given comment. |
| [get\_comments\_link()](get_comments_link) wp-includes/comment-template.php | Retrieves the link to the current post comments. |
| [trackback()](trackback) wp-includes/comment.php | Sends a Trackback. |
| [pingback()](pingback) wp-includes/comment.php | Pings back the links found in a post. |
| [\_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 |
| --- | --- |
| [1.0.0](https://developer.wordpress.org/reference/since/1.0.0/) | Introduced. |
| programming_docs |
wordpress _transition_post_status( string $new_status, string $old_status, WP_Post $post ) \_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. Use [wp\_clear\_scheduled\_hook()](wp_clear_scheduled_hook) instead.
Hook for managing future post transitions to published.
* [wp\_clear\_scheduled\_hook()](wp_clear_scheduled_hook)
`$new_status` string Required New post status. `$old_status` string Required Previous 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 _transition_post_status( $new_status, $old_status, $post ) {
global $wpdb;
if ( 'publish' !== $old_status && 'publish' === $new_status ) {
// Reset GUID if transitioning to publish and it is empty.
if ( '' === get_the_guid( $post->ID ) ) {
$wpdb->update( $wpdb->posts, array( 'guid' => get_permalink( $post->ID ) ), array( 'ID' => $post->ID ) );
}
/**
* Fires when a post's status is transitioned from private to published.
*
* @since 1.5.0
* @deprecated 2.3.0 Use {@see 'private_to_publish'} instead.
*
* @param int $post_id Post ID.
*/
do_action_deprecated( 'private_to_published', array( $post->ID ), '2.3.0', 'private_to_publish' );
}
// If published posts changed clear the lastpostmodified cache.
if ( 'publish' === $new_status || 'publish' === $old_status ) {
foreach ( array( 'server', 'gmt', 'blog' ) as $timezone ) {
wp_cache_delete( "lastpostmodified:$timezone", 'timeinfo' );
wp_cache_delete( "lastpostdate:$timezone", 'timeinfo' );
wp_cache_delete( "lastpostdate:$timezone:{$post->post_type}", 'timeinfo' );
}
}
if ( $new_status !== $old_status ) {
wp_cache_delete( _count_posts_cache_key( $post->post_type ), 'counts' );
wp_cache_delete( _count_posts_cache_key( $post->post_type, 'readable' ), 'counts' );
}
// Always clears the hook in case the post status bounced from future to draft.
wp_clear_scheduled_hook( 'publish_future_post', array( $post->ID ) );
}
```
[do\_action\_deprecated( 'private\_to\_published', int $post\_id )](../hooks/private_to_published)
Fires when a post’s status is transitioned from private to published.
| Uses | Description |
| --- | --- |
| [do\_action\_deprecated()](do_action_deprecated) wp-includes/plugin.php | Fires functions attached to a deprecated action hook. |
| [wp\_clear\_scheduled\_hook()](wp_clear_scheduled_hook) wp-includes/cron.php | Unschedules all events attached to the hook with the specified arguments. |
| [wp\_cache\_delete()](wp_cache_delete) wp-includes/cache.php | Removes the cache contents matching key and group. |
| [get\_the\_guid()](get_the_guid) wp-includes/post-template.php | Retrieves the Post Global Unique Identifier (guid). |
| [\_count\_posts\_cache\_key()](_count_posts_cache_key) wp-includes/post.php | Returns the cache key for [wp\_count\_posts()](wp_count_posts) based on the passed arguments. |
| [wpdb::update()](../classes/wpdb/update) wp-includes/class-wpdb.php | Updates a row in the table. |
| [get\_permalink()](get_permalink) wp-includes/link-template.php | Retrieves the full permalink for the current post or post ID. |
| Version | Description |
| --- | --- |
| [2.3.0](https://developer.wordpress.org/reference/since/2.3.0/) | Introduced. |
wordpress is_ssl(): bool is\_ssl(): bool
===============
Determines if SSL is used.
bool True if SSL, otherwise false.
Returns true if the page is using SSL (checks if HTTPS or on Port 443).
NB: this won’t work for websites behind some load balancers, especially Network Solutions hosted websites. To body up a fix, save [this gist](https://gist.github.com/webaware/4688802) into the plugins folder and enable it. For details, read [WordPress](http://snippets.webaware.com.au/snippets/wordpress-is_ssl-doesnt-work-behind-some-load-balancers/) [is\_ssl()](is_ssl) doesn’t work behind some load balancers.
Websites behind load balancers or reverse proxies that support HTTP\_X\_FORWARDED\_PROTO can be fixed by adding the following code to the wp-config.php file, above the require\_once call:
```
if (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https')
$_SERVER['HTTPS'] = 'on';
```
File: `wp-includes/load.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/load.php/)
```
function is_ssl() {
if ( isset( $_SERVER['HTTPS'] ) ) {
if ( 'on' === strtolower( $_SERVER['HTTPS'] ) ) {
return true;
}
if ( '1' == $_SERVER['HTTPS'] ) {
return true;
}
} elseif ( isset( $_SERVER['SERVER_PORT'] ) && ( '443' == $_SERVER['SERVER_PORT'] ) ) {
return true;
}
return false;
}
```
| Used By | Description |
| --- | --- |
| [wp\_is\_application\_passwords\_supported()](wp_is_application_passwords_supported) wp-includes/user.php | Checks if Application Passwords is supported. |
| [WP\_Recovery\_Mode::redirect\_protected()](../classes/wp_recovery_mode/redirect_protected) wp-includes/class-wp-recovery-mode.php | Redirects the current request to allow recovering multiple errors in one go. |
| [WP\_Recovery\_Mode\_Cookie\_Service::set\_cookie()](../classes/wp_recovery_mode_cookie_service/set_cookie) wp-includes/class-wp-recovery-mode-cookie-service.php | Sets the recovery mode cookie. |
| [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\_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. |
| [WP\_Customize\_Manager::get\_allowed\_urls()](../classes/wp_customize_manager/get_allowed_urls) wp-includes/class-wp-customize-manager.php | Gets URLs allowed to be previewed. |
| [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. |
| [get\_rest\_url()](get_rest_url) wp-includes/rest-api.php | Retrieves the URL to a REST endpoint on a site. |
| [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\_admin\_bar\_customize\_menu()](wp_admin_bar_customize_menu) wp-includes/admin-bar.php | Adds the “Customize” link to the Toolbar. |
| [get\_avatar\_data()](get_avatar_data) wp-includes/link-template.php | Retrieves default data about the avatar. |
| [wp\_ajax\_parse\_embed()](wp_ajax_parse_embed) wp-admin/includes/ajax-actions.php | Apply [embed] Ajax handlers to a string. |
| [wp\_dashboard\_browser\_nag()](wp_dashboard_browser_nag) wp-admin/includes/dashboard.php | Displays the browser update nag. |
| [wp\_parse\_auth\_cookie()](wp_parse_auth_cookie) wp-includes/pluggable.php | Parses a cookie into its components. |
| [wp\_set\_auth\_cookie()](wp_set_auth_cookie) wp-includes/pluggable.php | Sets the authentication cookies based on user ID. |
| [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\_login\_form()](wp_login_form) wp-includes/general-template.php | Provides a simple login form for use anywhere within WordPress. |
| [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\_guess\_url()](wp_guess_url) wp-includes/functions.php | Guesses the URL for the site. |
| [set\_url\_scheme()](set_url_scheme) wp-includes/link-template.php | Sets the scheme for a URL. |
| [network\_home\_url()](network_home_url) wp-includes/link-template.php | Retrieves the home URL for the current network. |
| [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\_Admin\_Bar::\_\_get()](../classes/wp_admin_bar/__get) wp-includes/class-wp-admin-bar.php | |
| [wp\_signon()](wp_signon) wp-includes/user.php | Authenticates and logs a user in with ‘remember’ capability. |
| [wp\_get\_attachment\_url()](wp_get_attachment_url) wp-includes/post.php | Retrieves the URL for an attachment. |
| [redirect\_canonical()](redirect_canonical) wp-includes/canonical.php | Redirects incoming links to the proper URL based on the site url. |
| [filter\_SSL()](filter_ssl) wp-includes/ms-functions.php | Formats a URL to use https. |
| Version | Description |
| --- | --- |
| [4.6.0](https://developer.wordpress.org/reference/since/4.6.0/) | Moved from functions.php to load.php. |
| [2.6.0](https://developer.wordpress.org/reference/since/2.6.0/) | Introduced. |
wordpress rest_get_route_for_post_type_items( string $post_type ): string rest\_get\_route\_for\_post\_type\_items( string $post\_type ): string
======================================================================
Gets the REST API route for a post type.
`$post_type` string Required The name of a registered post type. string The route path with a leading slash for the given post type, 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_type_items( $post_type ) {
$post_type = get_post_type_object( $post_type );
if ( ! $post_type ) {
return '';
}
if ( ! $post_type->show_in_rest ) {
return '';
}
$namespace = ! empty( $post_type->rest_namespace ) ? $post_type->rest_namespace : 'wp/v2';
$rest_base = ! empty( $post_type->rest_base ) ? $post_type->rest_base : $post_type->name;
$route = sprintf( '/%s/%s', $namespace, $rest_base );
/**
* Filters the REST API route for a post type.
*
* @since 5.9.0
*
* @param string $route The route path.
* @param WP_Post_Type $post_type The post type object.
*/
return apply_filters( 'rest_route_for_post_type_items', $route, $post_type );
}
```
[apply\_filters( 'rest\_route\_for\_post\_type\_items', string $route, WP\_Post\_Type $post\_type )](../hooks/rest_route_for_post_type_items)
Filters the REST API route for a post type.
| Uses | Description |
| --- | --- |
| [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 |
| --- | --- |
| [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\_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\_route\_for\_post()](rest_get_route_for_post) wp-includes/rest-api.php | Gets the REST API route for a post. |
| [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\_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::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. |
| Version | Description |
| --- | --- |
| [5.9.0](https://developer.wordpress.org/reference/since/5.9.0/) | Introduced. |
wordpress get_comment_ID(): string get\_comment\_ID(): string
==========================
Retrieves the comment ID of the current comment.
string The comment ID as a numeric string.
File: `wp-includes/comment-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/comment-template.php/)
```
function get_comment_ID() { // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.FunctionNameInvalid
$comment = get_comment();
$comment_ID = ! empty( $comment->comment_ID ) ? $comment->comment_ID : '0';
/**
* Filters the returned comment ID.
*
* @since 1.5.0
* @since 4.1.0 The `$comment` parameter was added.
*
* @param string $comment_ID The current comment ID as a numeric string.
* @param WP_Comment $comment The comment object.
*/
return apply_filters( 'get_comment_ID', $comment_ID, $comment ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.NotLowercase
}
```
[apply\_filters( 'get\_comment\_ID', string $comment\_ID, WP\_Comment $comment )](../hooks/get_comment_id)
Filters the returned comment ID.
| 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\_form\_title()](comment_form_title) wp-includes/comment-template.php | Displays text based on comment reply status. |
| [comment\_ID()](comment_id) wp-includes/comment-template.php | Displays the comment ID of the current comment. |
| Version | Description |
| --- | --- |
| [1.5.0](https://developer.wordpress.org/reference/since/1.5.0/) | Introduced. |
wordpress get_approved_comments( int $post_id, array $args = array() ): WP_Comment[]|int[]|int get\_approved\_comments( int $post\_id, array $args = array() ): WP\_Comment[]|int[]|int
========================================================================================
Retrieves the approved comments for a post.
`$post_id` int Required The ID of the post. `$args` array Optional See [WP\_Comment\_Query::\_\_construct()](../classes/wp_comment_query/__construct) for information on accepted arguments. More Arguments from WP\_Comment\_Query::\_\_construct( ... $query ) Array or query string of comment query parameters.
* `author_email`stringComment author email address.
* `author_url`stringComment author URL.
* `author__in`int[]Array of author IDs to include comments for.
* `author__not_in`int[]Array of author IDs to exclude comments for.
* `comment__in`int[]Array of comment IDs to include.
* `comment__not_in`int[]Array of comment IDs to exclude.
* `count`boolWhether to return a comment count (true) or array of comment objects (false). Default false.
* `date_query`arrayDate query clauses to limit comments by. See [WP\_Date\_Query](../classes/wp_date_query).
Default null.
* `fields`stringComment fields to return. Accepts `'ids'` for comment IDs only or empty for all fields.
* `include_unapproved`arrayArray of IDs or email addresses of users whose unapproved comments will be returned by the query regardless of `$status`.
* `karma`intKarma score to retrieve matching comments for.
* `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.
* `number`intMaximum number of comments to retrieve.
Default empty (no limit).
* `paged`intWhen used with `$number`, defines the page of results to return.
When used with `$offset`, `$offset` takes precedence. Default 1.
* `offset`intNumber of comments to offset the query. Used to build LIMIT clause. Default 0.
* `no_found_rows`boolWhether to disable the `SQL_CALC_FOUND_ROWS` query.
Default: true.
* `orderby`string|arrayComment status or array of statuses. To use `'meta_value'` or `'meta_value_num'`, `$meta_key` must also be defined.
To sort by a specific `$meta_query` clause, use that clause's array key. Accepts:
+ `'comment_agent'`
+ `'comment_approved'`
+ `'comment_author'`
+ `'comment_author_email'`
+ `'comment_author_IP'`
+ `'comment_author_url'`
+ `'comment_content'`
+ `'comment_date'`
+ `'comment_date_gmt'`
+ `'comment_ID'`
+ `'comment_karma'`
+ `'comment_parent'`
+ `'comment_post_ID'`
+ `'comment_type'`
+ `'user_id'`
+ `'comment__in'`
+ `'meta_value'`
+ `'meta_value_num'`
+ The value of `$meta_key`
+ The array keys of `$meta_query`
+ false, an empty array, or `'none'` to disable `ORDER BY` clause. Default: `'comment_date_gmt'`.
* `order`stringHow to order retrieved comments. Accepts `'ASC'`, `'DESC'`.
Default: `'DESC'`.
* `parent`intParent ID of comment to retrieve children of.
* `parent__in`int[]Array of parent IDs of comments to retrieve children for.
* `parent__not_in`int[]Array of parent IDs of comments \*not\* to retrieve children for.
* `post_author__in`int[]Array of author IDs to retrieve comments for.
* `post_author__not_in`int[]Array of author IDs \*not\* to retrieve comments for.
* `post_id`intLimit results to those affiliated with a given post ID.
Default 0.
* `post__in`int[]Array of post IDs to include affiliated comments for.
* `post__not_in`int[]Array of post IDs to exclude affiliated comments for.
* `post_author`intPost author ID to limit results by.
* `post_status`string|string[]Post status or array of post statuses to retrieve affiliated comments for. Pass `'any'` to match any value.
* `post_type`string|string[]Post type or array of post types to retrieve affiliated comments for. Pass `'any'` to match any value.
* `post_name`stringPost name to retrieve affiliated comments for.
* `post_parent`intPost parent ID to retrieve affiliated comments for.
* `search`stringSearch term(s) to retrieve matching comments for.
* `status`string|arrayComment statuses to limit results by. Accepts an array or space/comma-separated list of `'hold'` (`comment_status=0`), `'approve'` (`comment_status=1`), `'all'`, or a custom comment status. Default `'all'`.
* `type`string|string[]Include comments of a given type, or array of types.
Accepts `'comment'`, `'pings'` (includes `'pingback'` and `'trackback'`), or any custom type string.
* `type__in`string[]Include comments from a given array of comment types.
* `type__not_in`string[]Exclude comments from a given array of comment types.
* `user_id`intInclude comments for a specific user ID.
* `hierarchical`bool|stringWhether to include comment descendants in the results.
+ `'threaded'` returns a tree, with each comment's children stored in a `children` property on the `WP_Comment` object.
+ `'flat'` returns a flat array of found comments plus their children.
+ Boolean `false` leaves out descendants. The parameter is ignored (forced to `false`) when `$fields` is `'ids'` or `'counts'`. Accepts `'threaded'`, `'flat'`, or false. Default: false.
* `cache_domain`stringUnique cache key to be produced when this query is stored in an object cache. Default is `'core'`.
* `update_comment_meta_cache`boolWhether to prime the metadata cache for found comments.
Default true.
* `update_comment_post_cache`boolWhether to prime the cache for comment posts.
Default false.
Default: `array()`
[WP\_Comment](../classes/wp_comment)[]|int[]|int The approved comments, or number of comments if `$count` argument is true.
File: `wp-includes/comment.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/comment.php/)
```
function get_approved_comments( $post_id, $args = array() ) {
if ( ! $post_id ) {
return array();
}
$defaults = array(
'status' => 1,
'post_id' => $post_id,
'order' => 'ASC',
);
$parsed_args = wp_parse_args( $args, $defaults );
$query = new WP_Comment_Query;
return $query->query( $parsed_args );
}
```
| Uses | Description |
| --- | --- |
| [WP\_Comment\_Query::\_\_construct()](../classes/wp_comment_query/__construct) wp-includes/class-wp-comment-query.php | Constructor. |
| [wp\_parse\_args()](wp_parse_args) wp-includes/functions.php | Merges user defined arguments into defaults array. |
| Version | Description |
| --- | --- |
| [4.1.0](https://developer.wordpress.org/reference/since/4.1.0/) | Refactored to leverage [WP\_Comment\_Query](../classes/wp_comment_query) over a direct query. |
| [2.0.0](https://developer.wordpress.org/reference/since/2.0.0/) | Introduced. |
| programming_docs |
wordpress _wp_upgrade_revisions_of_post( WP_Post $post, array $revisions ): bool \_wp\_upgrade\_revisions\_of\_post( WP\_Post $post, array $revisions ): 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.
Upgrades the revisions author, adds the current post as a revision and sets the revisions version to 1.
`$post` [WP\_Post](../classes/wp_post) Required Post object. `$revisions` array Required Current revisions of the post. bool true if the revisions were upgraded, false if problems.
File: `wp-includes/revision.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/revision.php/)
```
function _wp_upgrade_revisions_of_post( $post, $revisions ) {
global $wpdb;
// Add post option exclusively.
$lock = "revision-upgrade-{$post->ID}";
$now = time();
$result = $wpdb->query( $wpdb->prepare( "INSERT IGNORE INTO `$wpdb->options` (`option_name`, `option_value`, `autoload`) VALUES (%s, %s, 'no') /* LOCK */", $lock, $now ) );
if ( ! $result ) {
// If we couldn't get a lock, see how old the previous lock is.
$locked = get_option( $lock );
if ( ! $locked ) {
// Can't write to the lock, and can't read the lock.
// Something broken has happened.
return false;
}
if ( $locked > $now - 3600 ) {
// Lock is not too old: some other process may be upgrading this post. Bail.
return false;
}
// Lock is too old - update it (below) and continue.
}
// If we could get a lock, re-"add" the option to fire all the correct filters.
update_option( $lock, $now );
reset( $revisions );
$add_last = true;
do {
$this_revision = current( $revisions );
$prev_revision = next( $revisions );
$this_revision_version = _wp_get_post_revision_version( $this_revision );
// Something terrible happened.
if ( false === $this_revision_version ) {
continue;
}
// 1 is the latest revision version, so we're already up to date.
// No need to add a copy of the post as latest revision.
if ( 0 < $this_revision_version ) {
$add_last = false;
continue;
}
// Always update the revision version.
$update = array(
'post_name' => preg_replace( '/^(\d+-(?:autosave|revision))[\d-]*$/', '$1-v1', $this_revision->post_name ),
);
/*
* If this revision is the oldest revision of the post, i.e. no $prev_revision,
* the correct post_author is probably $post->post_author, but that's only a good guess.
* Update the revision version only and Leave the author as-is.
*/
if ( $prev_revision ) {
$prev_revision_version = _wp_get_post_revision_version( $prev_revision );
// If the previous revision is already up to date, it no longer has the information we need :(
if ( $prev_revision_version < 1 ) {
$update['post_author'] = $prev_revision->post_author;
}
}
// Upgrade this revision.
$result = $wpdb->update( $wpdb->posts, $update, array( 'ID' => $this_revision->ID ) );
if ( $result ) {
wp_cache_delete( $this_revision->ID, 'posts' );
}
} while ( $prev_revision );
delete_option( $lock );
// Add a copy of the post as latest revision.
if ( $add_last ) {
wp_save_post_revision( $post->ID );
}
return true;
}
```
| Uses | Description |
| --- | --- |
| [wp\_cache\_delete()](wp_cache_delete) wp-includes/cache.php | Removes the cache contents matching key and group. |
| [delete\_option()](delete_option) wp-includes/option.php | Removes option by name. Prevents removal of protected WordPress options. |
| [\_wp\_get\_post\_revision\_version()](_wp_get_post_revision_version) wp-includes/revision.php | Gets the post revision version. |
| [wp\_save\_post\_revision()](wp_save_post_revision) wp-includes/revision.php | Creates a revision for the current version of a post. |
| [wpdb::query()](../classes/wpdb/query) wp-includes/class-wpdb.php | Performs a database query, using current database connection. |
| [wpdb::update()](../classes/wpdb/update) wp-includes/class-wpdb.php | Updates a row in the table. |
| [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::prepare()](../classes/wpdb/prepare) wp-includes/class-wpdb.php | Prepares a SQL query for safe execution. |
| Used By | Description |
| --- | --- |
| [edit\_post()](edit_post) wp-admin/includes/post.php | Updates an existing post with values provided in `$_POST`. |
| Version | Description |
| --- | --- |
| [3.6.0](https://developer.wordpress.org/reference/since/3.6.0/) | Introduced. |
wordpress sanitize_post_field( string $field, mixed $value, int $post_id, string $context = 'display' ): mixed sanitize\_post\_field( string $field, mixed $value, int $post\_id, string $context = 'display' ): mixed
=======================================================================================================
Sanitizes a post field based on context.
Possible context values are: ‘raw’, ‘edit’, ‘db’, ‘display’, ‘attribute’ and ‘js’. The ‘display’ context is used by default. ‘attribute’ and ‘js’ contexts are treated like ‘display’ when calling filters.
`$field` string Required The Post Object field name. `$value` mixed Required The Post Object value. `$post_id` int Required Post ID. `$context` string Optional How to sanitize the field. Possible values are `'raw'`, `'edit'`, `'db'`, `'display'`, `'attribute'` and `'js'`. Default `'display'`. Default: `'display'`
mixed Sanitized value.
Uses [apply\_filters()](apply_filters) :
* Calls 'edit\_{$field}' and '{$field\_no\_prefix}\_edit\_pre' passing $value and $post\_id if $context is 'edit' and field name prefix is 'post\_'.
* Calls 'edit\_post\_{$field}' passing $value and $post\_id if $context is 'db'.
* Calls 'pre\_{$field}' passing $value if $context is 'db' and field name prefix is 'post\_'.
* Calls '{$field}\_pre' passing $value if $context is 'db' and field name prefix is not 'post\_'.
* Calls '{$field}' passing $value, $post\_id and $context if $context is anything other than 'raw', 'edit' and 'db' and field name prefix is 'post\_'.
* Calls 'post\_$field' passing $value if $context is anything other than 'raw', 'edit' and 'db' and field name prefix is not 'post\_'.
File: `wp-includes/post.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/post.php/)
```
function sanitize_post_field( $field, $value, $post_id, $context = 'display' ) {
$int_fields = array( 'ID', 'post_parent', 'menu_order' );
if ( in_array( $field, $int_fields, true ) ) {
$value = (int) $value;
}
// Fields which contain arrays of integers.
$array_int_fields = array( 'ancestors' );
if ( in_array( $field, $array_int_fields, true ) ) {
$value = array_map( 'absint', $value );
return $value;
}
if ( 'raw' === $context ) {
return $value;
}
$prefixed = false;
if ( false !== strpos( $field, 'post_' ) ) {
$prefixed = true;
$field_no_prefix = str_replace( 'post_', '', $field );
}
if ( 'edit' === $context ) {
$format_to_edit = array( 'post_content', 'post_excerpt', 'post_title', 'post_password' );
if ( $prefixed ) {
/**
* Filters the value of a specific post field to edit.
*
* The dynamic portion of the hook name, `$field`, refers to the post
* field name.
*
* @since 2.3.0
*
* @param mixed $value Value of the post field.
* @param int $post_id Post ID.
*/
$value = apply_filters( "edit_{$field}", $value, $post_id );
/**
* Filters the value of a specific post field to edit.
*
* The dynamic portion of the hook name, `$field_no_prefix`, refers to
* the post field name.
*
* @since 2.3.0
*
* @param mixed $value Value of the post field.
* @param int $post_id Post ID.
*/
$value = apply_filters( "{$field_no_prefix}_edit_pre", $value, $post_id );
} else {
$value = apply_filters( "edit_post_{$field}", $value, $post_id );
}
if ( in_array( $field, $format_to_edit, true ) ) {
if ( 'post_content' === $field ) {
$value = format_to_edit( $value, user_can_richedit() );
} else {
$value = format_to_edit( $value );
}
} else {
$value = esc_attr( $value );
}
} elseif ( 'db' === $context ) {
if ( $prefixed ) {
/**
* Filters the value of a specific post field before saving.
*
* The dynamic portion of the hook name, `$field`, refers to the post
* field name.
*
* @since 2.3.0
*
* @param mixed $value Value of the post field.
*/
$value = apply_filters( "pre_{$field}", $value );
/**
* Filters the value of a specific field before saving.
*
* The dynamic portion of the hook name, `$field_no_prefix`, refers
* to the post field name.
*
* @since 2.3.0
*
* @param mixed $value Value of the post field.
*/
$value = apply_filters( "{$field_no_prefix}_save_pre", $value );
} else {
$value = apply_filters( "pre_post_{$field}", $value );
/**
* Filters the value of a specific post field before saving.
*
* The dynamic portion of the hook name, `$field`, refers to the post
* field name.
*
* @since 2.3.0
*
* @param mixed $value Value of the post field.
*/
$value = apply_filters( "{$field}_pre", $value );
}
} else {
// Use display filters by default.
if ( $prefixed ) {
/**
* Filters the value of a specific post field for display.
*
* The dynamic portion of the hook name, `$field`, refers to the post
* field name.
*
* @since 2.3.0
*
* @param mixed $value Value of the prefixed post field.
* @param int $post_id Post ID.
* @param string $context Context for how to sanitize the field.
* Accepts 'raw', 'edit', 'db', 'display',
* 'attribute', or 'js'. Default 'display'.
*/
$value = apply_filters( "{$field}", $value, $post_id, $context );
} else {
$value = apply_filters( "post_{$field}", $value, $post_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\_no\_prefix}\_edit\_pre", mixed $value, int $post\_id )](../hooks/field_no_prefix_edit_pre)
Filters the value of a specific post field to edit.
[apply\_filters( "{$field\_no\_prefix}\_save\_pre", mixed $value )](../hooks/field_no_prefix_save_pre)
Filters the value of a specific 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.
[apply\_filters( "{$field}\_pre", mixed $value )](../hooks/field_pre)
Filters the value of a specific post field before saving.
| Uses | Description |
| --- | --- |
| [format\_to\_edit()](format_to_edit) wp-includes/formatting.php | Acts on text which is about to be edited. |
| [esc\_js()](esc_js) wp-includes/formatting.php | Escapes single quotes, `"`, , `&`, and fixes line endings. |
| [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/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 |
| --- | --- |
| [post\_exists()](post_exists) wp-admin/includes/post.php | Determines if a post exists based on title, content, date and type. |
| [WP\_Post::\_\_get()](../classes/wp_post/__get) wp-includes/class-wp-post.php | Getter. |
| [sanitize\_post()](sanitize_post) wp-includes/post.php | Sanitizes every post field. |
| [set\_post\_type()](set_post_type) wp-includes/post.php | Updates the post type for the post ID. |
| [get\_post\_field()](get_post_field) wp-includes/post.php | Retrieves data from a post field based on Post ID. |
| Version | Description |
| --- | --- |
| [4.4.0](https://developer.wordpress.org/reference/since/4.4.0/) | Like `sanitize_post()`, `$context` defaults to `'display'`. |
| [2.3.0](https://developer.wordpress.org/reference/since/2.3.0/) | Introduced. |
wordpress get_user_locale( int|WP_User $user ): string get\_user\_locale( int|WP\_User $user ): string
===============================================
Retrieves the locale of a user.
If the user has a locale set to a non-empty string then it will be returned. Otherwise it returns the locale of [get\_locale()](get_locale) .
`$user` int|[WP\_User](../classes/wp_user) Required User's ID or a [WP\_User](../classes/wp_user) object. Defaults to current user. string The locale of the user.
File: `wp-includes/l10n.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/l10n.php/)
```
function get_user_locale( $user = 0 ) {
$user_object = false;
if ( 0 === $user && function_exists( 'wp_get_current_user' ) ) {
$user_object = wp_get_current_user();
} elseif ( $user instanceof WP_User ) {
$user_object = $user;
} elseif ( $user && is_numeric( $user ) ) {
$user_object = get_user_by( 'id', $user );
}
if ( ! $user_object ) {
return get_locale();
}
$locale = $user_object->locale;
return $locale ? $locale : get_locale();
}
```
| Uses | Description |
| --- | --- |
| [get\_locale()](get_locale) wp-includes/l10n.php | Retrieves the current locale. |
| [wp\_get\_current\_user()](wp_get_current_user) wp-includes/pluggable.php | Retrieves the current user object. |
| [get\_user\_by()](get_user_by) wp-includes/pluggable.php | Retrieves user info by a given field. |
| Used By | Description |
| --- | --- |
| [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 |
| [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\_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. |
| [determine\_locale()](determine_locale) wp-includes/l10n.php | Determines the current locale desired for the request. |
| [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\_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\_Editors::get\_mce\_locale()](../classes/_wp_editors/get_mce_locale) wp-includes/class-wp-editor.php | Returns the TinyMCE locale. |
| [WP\_Community\_Events::get\_request\_args()](../classes/wp_community_events/get_request_args) wp-admin/includes/class-wp-community-events.php | Builds an array of args to use in an HTTP request to the w.org Events API. |
| [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\_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. |
| [themes\_api()](themes_api) wp-admin/includes/theme.php | Retrieves theme installer pages from the WordPress.org Themes API. |
| [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. |
| [plugins\_api()](plugins_api) wp-admin/includes/plugin-install.php | Retrieves plugin installer pages from the WordPress.org Plugins API. |
| [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\_browser\_nag()](wp_dashboard_browser_nag) wp-admin/includes/dashboard.php | Displays the browser update nag. |
| [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 | |
| [iframe\_header()](iframe_header) wp-admin/includes/template.php | Generic Iframe header for use with Thickbox. |
| [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. |
| [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\_Theme::sort\_by\_name()](../classes/wp_theme/sort_by_name) wp-includes/class-wp-theme.php | Sorts themes by name. |
| [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\_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, |
| [\_WP\_Editors::editor\_settings()](../classes/_wp_editors/editor_settings) wp-includes/class-wp-editor.php | |
| Version | Description |
| --- | --- |
| [4.7.0](https://developer.wordpress.org/reference/since/4.7.0/) | Introduced. |
| programming_docs |
wordpress render_block( array $parsed_block ): string render\_block( array $parsed\_block ): string
=============================================
Renders a single block into a HTML string.
`$parsed_block` array Required A single parsed block object. string String of rendered HTML.
File: `wp-includes/blocks.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/blocks.php/)
```
function render_block( $parsed_block ) {
global $post;
$parent_block = null;
/**
* Allows render_block() to be short-circuited, by returning a non-null value.
*
* @since 5.1.0
* @since 5.9.0 The `$parent_block` parameter was added.
*
* @param string|null $pre_render The pre-rendered content. Default null.
* @param array $parsed_block The block being rendered.
* @param WP_Block|null $parent_block If this is a nested block, a reference to the parent block.
*/
$pre_render = apply_filters( 'pre_render_block', null, $parsed_block, $parent_block );
if ( ! is_null( $pre_render ) ) {
return $pre_render;
}
$source_block = $parsed_block;
/**
* Filters the block being rendered in render_block(), before it's processed.
*
* @since 5.1.0
* @since 5.9.0 The `$parent_block` parameter was added.
*
* @param array $parsed_block The block being rendered.
* @param array $source_block An un-modified copy of $parsed_block, as it appeared in the source content.
* @param WP_Block|null $parent_block If this is a nested block, a reference to the parent block.
*/
$parsed_block = apply_filters( 'render_block_data', $parsed_block, $source_block, $parent_block );
$context = array();
if ( $post instanceof WP_Post ) {
$context['postId'] = $post->ID;
/*
* The `postType` context is largely unnecessary server-side, since the ID
* is usually sufficient on its own. That being said, since a block's
* manifest is expected to be shared between the server and the client,
* it should be included to consistently fulfill the expectation.
*/
$context['postType'] = $post->post_type;
}
/**
* Filters the default context provided to a rendered block.
*
* @since 5.5.0
* @since 5.9.0 The `$parent_block` parameter was added.
*
* @param array $context Default context.
* @param array $parsed_block Block being rendered, filtered by `render_block_data`.
* @param WP_Block|null $parent_block If this is a nested block, a reference to the parent block.
*/
$context = apply_filters( 'render_block_context', $context, $parsed_block, $parent_block );
$block = new WP_Block( $parsed_block, $context );
return $block->render();
}
```
[apply\_filters( 'pre\_render\_block', string|null $pre\_render, array $parsed\_block, WP\_Block|null $parent\_block )](../hooks/pre_render_block)
Allows [render\_block()](render_block) to be short-circuited, by returning a non-null value.
[apply\_filters( 'render\_block\_context', array $context, array $parsed\_block, WP\_Block|null $parent\_block )](../hooks/render_block_context)
Filters the default context provided to a rendered block.
[apply\_filters( 'render\_block\_data', array $parsed\_block, array $source\_block, WP\_Block|null $parent\_block )](../hooks/render_block_data)
Filters the block being rendered in [render\_block()](render_block) , before it’s processed.
| Uses | Description |
| --- | --- |
| [WP\_Block::\_\_construct()](../classes/wp_block/__construct) wp-includes/class-wp-block.php | Constructor. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| 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. |
| [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. |
| [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. |
| Version | Description |
| --- | --- |
| [5.0.0](https://developer.wordpress.org/reference/since/5.0.0/) | Introduced. |
wordpress get_comment_pages_count( WP_Comment[] $comments = null, int $per_page = null, bool $threaded = null ): int get\_comment\_pages\_count( WP\_Comment[] $comments = null, int $per\_page = null, bool $threaded = null ): int
===============================================================================================================
Calculates the total number of comment pages.
`$comments` [WP\_Comment](../classes/wp_comment)[] Optional Array of [WP\_Comment](../classes/wp_comment) objects. Defaults to `$wp_query->comments`. Default: `null`
`$per_page` int Optional Comments per page. Default: `null`
`$threaded` bool Optional Control over flat or threaded comments. Default: `null`
int Number of comment pages.
File: `wp-includes/comment.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/comment.php/)
```
function get_comment_pages_count( $comments = null, $per_page = null, $threaded = null ) {
global $wp_query;
if ( null === $comments && null === $per_page && null === $threaded && ! empty( $wp_query->max_num_comment_pages ) ) {
return $wp_query->max_num_comment_pages;
}
if ( ( ! $comments || ! is_array( $comments ) ) && ! empty( $wp_query->comments ) ) {
$comments = $wp_query->comments;
}
if ( empty( $comments ) ) {
return 0;
}
if ( ! get_option( 'page_comments' ) ) {
return 1;
}
if ( ! isset( $per_page ) ) {
$per_page = (int) get_query_var( 'comments_per_page' );
}
if ( 0 === $per_page ) {
$per_page = (int) get_option( 'comments_per_page' );
}
if ( 0 === $per_page ) {
return 1;
}
if ( ! isset( $threaded ) ) {
$threaded = get_option( 'thread_comments' );
}
if ( $threaded ) {
$walker = new Walker_Comment;
$count = ceil( $walker->get_number_of_root_elements( $comments ) / $per_page );
} else {
$count = ceil( count( $comments ) / $per_page );
}
return $count;
}
```
| 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. |
| [Walker::get\_number\_of\_root\_elements()](../classes/walker/get_number_of_root_elements) wp-includes/class-wp-walker.php | Calculates the total number of root elements. |
| [get\_option()](get_option) wp-includes/option.php | Retrieves an option value based on an option name. |
| Used By | Description |
| --- | --- |
| [get\_the\_comments\_navigation()](get_the_comments_navigation) wp-includes/link-template.php | Retrieves navigation to next/previous set of comments, when applicable. |
| [get\_next\_comments\_link()](get_next_comments_link) wp-includes/link-template.php | Retrieves the link to the next comments page. |
| [paginate\_comments\_links()](paginate_comments_links) wp-includes/link-template.php | Displays or retrieves pagination links for the comments on the current post. |
| [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. |
| Version | Description |
| --- | --- |
| [2.7.0](https://developer.wordpress.org/reference/since/2.7.0/) | Introduced. |
wordpress wp_protect_special_option( string $option ) wp\_protect\_special\_option( string $option )
==============================================
Protects WordPress special option from being modified.
Will die if $option is in protected list. Protected options are ‘alloptions’ and ‘notoptions’ options.
`$option` string Required Option name. File: `wp-includes/option.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/option.php/)
```
function wp_protect_special_option( $option ) {
if ( 'alloptions' === $option || 'notoptions' === $option ) {
wp_die(
sprintf(
/* translators: %s: Option name. */
__( '%s is a protected WP option and may not be modified' ),
esc_html( $option )
)
);
}
}
```
| Uses | Description |
| --- | --- |
| [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. |
| [esc\_html()](esc_html) wp-includes/formatting.php | Escaping for HTML blocks. |
| [wp\_die()](wp_die) wp-includes/functions.php | Kills WordPress execution and displays HTML page with an error message. |
| 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. |
| [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. |
| Version | Description |
| --- | --- |
| [2.2.0](https://developer.wordpress.org/reference/since/2.2.0/) | Introduced. |
wordpress delete_theme( string $stylesheet, string $redirect = '' ): bool|null|WP_Error delete\_theme( string $stylesheet, string $redirect = '' ): bool|null|WP\_Error
===============================================================================
Removes a theme.
`$stylesheet` string Required Stylesheet of the theme to delete. `$redirect` string Optional Redirect to page when complete. Default: `''`
bool|null|[WP\_Error](../classes/wp_error) True on success, false if `$stylesheet` is empty, [WP\_Error](../classes/wp_error) on failure.
Null if filesystem credentials are required to proceed.
File: `wp-admin/includes/theme.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/theme.php/)
```
function delete_theme( $stylesheet, $redirect = '' ) {
global $wp_filesystem;
if ( empty( $stylesheet ) ) {
return false;
}
if ( empty( $redirect ) ) {
$redirect = wp_nonce_url( 'themes.php?action=delete&stylesheet=' . urlencode( $stylesheet ), 'delete-theme_' . $stylesheet );
}
ob_start();
$credentials = request_filesystem_credentials( $redirect );
$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( $redirect, '', 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.
$themes_dir = $wp_filesystem->wp_themes_dir();
if ( empty( $themes_dir ) ) {
return new WP_Error( 'fs_no_themes_dir', __( 'Unable to locate WordPress theme directory.' ) );
}
/**
* Fires immediately before a theme deletion attempt.
*
* @since 5.8.0
*
* @param string $stylesheet Stylesheet of the theme to delete.
*/
do_action( 'delete_theme', $stylesheet );
$themes_dir = trailingslashit( $themes_dir );
$theme_dir = trailingslashit( $themes_dir . $stylesheet );
$deleted = $wp_filesystem->delete( $theme_dir, true );
/**
* Fires immediately after a theme deletion attempt.
*
* @since 5.8.0
*
* @param string $stylesheet Stylesheet of the theme to delete.
* @param bool $deleted Whether the theme deletion was successful.
*/
do_action( 'deleted_theme', $stylesheet, $deleted );
if ( ! $deleted ) {
return new WP_Error(
'could_not_remove_theme',
/* translators: %s: Theme name. */
sprintf( __( 'Could not fully remove the theme %s.' ), $stylesheet )
);
}
$theme_translations = wp_get_installed_translations( 'themes' );
// Remove language files, silently.
if ( ! empty( $theme_translations[ $stylesheet ] ) ) {
$translations = $theme_translations[ $stylesheet ];
foreach ( $translations as $translation => $data ) {
$wp_filesystem->delete( WP_LANG_DIR . '/themes/' . $stylesheet . '-' . $translation . '.po' );
$wp_filesystem->delete( WP_LANG_DIR . '/themes/' . $stylesheet . '-' . $translation . '.mo' );
$json_translation_files = glob( WP_LANG_DIR . '/themes/' . $stylesheet . '-' . $translation . '-*.json' );
if ( $json_translation_files ) {
array_map( array( $wp_filesystem, 'delete' ), $json_translation_files );
}
}
}
// Remove the theme from allowed themes on the network.
if ( is_multisite() ) {
WP_Theme::network_disable_theme( $stylesheet );
}
// Force refresh of theme update information.
delete_site_transient( 'update_themes' );
return true;
}
```
[do\_action( 'deleted\_theme', string $stylesheet, bool $deleted )](../hooks/deleted_theme)
Fires immediately after a theme deletion attempt.
[do\_action( 'delete\_theme', string $stylesheet )](../hooks/delete_theme)
Fires immediately before a theme deletion attempt.
| Uses | Description |
| --- | --- |
| [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. |
| [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. |
| [delete\_site\_transient()](delete_site_transient) wp-includes/option.php | Deletes a site transient. |
| [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. |
| [trailingslashit()](trailingslashit) wp-includes/formatting.php | Appends a trailing slash. |
| [is\_multisite()](is_multisite) wp-includes/load.php | If Multisite is enabled. |
| [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\_ajax\_delete\_theme()](wp_ajax_delete_theme) wp-admin/includes/ajax-actions.php | Ajax handler for deleting a theme. |
| Version | Description |
| --- | --- |
| [2.8.0](https://developer.wordpress.org/reference/since/2.8.0/) | Introduced. |
wordpress author_can( int|WP_Post $post, string $capability, mixed $args ): bool author\_can( int|WP\_Post $post, string $capability, mixed $args ): bool
========================================================================
Returns whether the author of the supplied post has the specified capability.
This function also accepts an ID of an object to check against if the capability is a meta capability. Meta capabilities such as `edit_post` and `edit_user` are capabilities used by the `map_meta_cap()` function to map to primitive capabilities that a user or role has, such as `edit_posts` and `edit_others_posts`.
Example usage:
```
author_can( $post, 'edit_posts' );
author_can( $post, 'edit_post', $post->ID );
author_can( $post, 'edit_post_meta', $post->ID, $meta_key );
```
`$post` int|[WP\_Post](../classes/wp_post) Required Post ID or post object. `$capability` string Required Capability name. `$args` mixed Optional further parameters, typically starting with an object ID. bool Whether the post author has the given capability.
File: `wp-includes/capabilities.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/capabilities.php/)
```
function author_can( $post, $capability, ...$args ) {
$post = get_post( $post );
if ( ! $post ) {
return false;
}
$author = get_userdata( $post->post_author );
if ( ! $author ) {
return false;
}
return $author->has_cap( $capability, ...$args );
}
```
| Uses | Description |
| --- | --- |
| [get\_userdata()](get_userdata) wp-includes/pluggable.php | Retrieves user info by user ID. |
| [get\_post()](get_post) wp-includes/post.php | Retrieves post data given a post ID or post object. |
| 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. |
wordpress get_the_post_thumbnail( int|WP_Post $post = null, string|int[] $size = 'post-thumbnail', string|array $attr = '' ): string get\_the\_post\_thumbnail( int|WP\_Post $post = null, string|int[] $size = 'post-thumbnail', string|array $attr = '' ): string
==============================================================================================================================
Retrieves 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.
`$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 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: `''`
string The post thumbnail image tag.
If the required `add_theme_support( 'post-thumbnails' );` in the current theme’s functions.php file is attached to a hook, it must be must be called before the [`init`](../hooks/init) hook is fired. The *init* hook may be too late for some features. If attached to a hook, it must be [`after_setup_theme`](../hooks/after_setup_theme).
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( $post = null, $size = 'post-thumbnail', $attr = '' ) {
$post = get_post( $post );
if ( ! $post ) {
return '';
}
$post_thumbnail_id = get_post_thumbnail_id( $post );
/**
* Filters the post thumbnail size.
*
* @since 2.9.0
* @since 4.9.0 Added the `$post_id` parameter.
*
* @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 $post_id The post ID.
*/
$size = apply_filters( 'post_thumbnail_size', $size, $post->ID );
if ( $post_thumbnail_id ) {
/**
* Fires before fetching the post thumbnail HTML.
*
* Provides "just in time" filtering of all filters in wp_get_attachment_image().
*
* @since 2.9.0
*
* @param int $post_id The post ID.
* @param int $post_thumbnail_id The post thumbnail ID.
* @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).
*/
do_action( 'begin_fetch_post_thumbnail_html', $post->ID, $post_thumbnail_id, $size );
if ( in_the_loop() ) {
update_post_thumbnail_cache();
}
// Get the 'loading' attribute value to use as default, taking precedence over the default from
// `wp_get_attachment_image()`.
$loading = wp_get_loading_attr_default( 'the_post_thumbnail' );
// Add the default to the given attributes unless they already include a 'loading' directive.
if ( empty( $attr ) ) {
$attr = array( 'loading' => $loading );
} elseif ( is_array( $attr ) && ! array_key_exists( 'loading', $attr ) ) {
$attr['loading'] = $loading;
} elseif ( is_string( $attr ) && ! preg_match( '/(^|&)loading=/', $attr ) ) {
$attr .= '&loading=' . $loading;
}
$html = wp_get_attachment_image( $post_thumbnail_id, $size, false, $attr );
/**
* Fires after fetching the post thumbnail HTML.
*
* @since 2.9.0
*
* @param int $post_id The post ID.
* @param int $post_thumbnail_id The post thumbnail ID.
* @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).
*/
do_action( 'end_fetch_post_thumbnail_html', $post->ID, $post_thumbnail_id, $size );
} else {
$html = '';
}
/**
* Filters the post thumbnail HTML.
*
* @since 2.9.0
*
* @param string $html The post thumbnail HTML.
* @param int $post_id The post ID.
* @param int $post_thumbnail_id The post thumbnail ID, or 0 if there isn't one.
* @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 string|array $attr Query string or array of attributes.
*/
return apply_filters( 'post_thumbnail_html', $html, $post->ID, $post_thumbnail_id, $size, $attr );
}
```
[do\_action( 'begin\_fetch\_post\_thumbnail\_html', int $post\_id, int $post\_thumbnail\_id, string|int[] $size )](../hooks/begin_fetch_post_thumbnail_html)
Fires before fetching the post thumbnail HTML.
[do\_action( 'end\_fetch\_post\_thumbnail\_html', int $post\_id, int $post\_thumbnail\_id, string|int[] $size )](../hooks/end_fetch_post_thumbnail_html)
Fires after fetching the post thumbnail HTML.
[apply\_filters( 'post\_thumbnail\_html', string $html, int $post\_id, int $post\_thumbnail\_id, string|int[] $size, string|array $attr )](../hooks/post_thumbnail_html)
Filters the post thumbnail HTML.
[apply\_filters( 'post\_thumbnail\_size', string|int[] $size, int $post\_id )](../hooks/post_thumbnail_size)
Filters the post thumbnail size.
| Uses | Description |
| --- | --- |
| [wp\_get\_loading\_attr\_default()](wp_get_loading_attr_default) wp-includes/media.php | Gets the default value to use for a `loading` attribute on an element. |
| [in\_the\_loop()](in_the_loop) wp-includes/query.php | Determines whether the caller is in the Loop. |
| [get\_post\_thumbnail\_id()](get_post_thumbnail_id) wp-includes/post-thumbnail-template.php | Retrieves the post thumbnail ID. |
| [update\_post\_thumbnail\_cache()](update_post_thumbnail_cache) wp-includes/post-thumbnail-template.php | Updates cache for thumbnails in the current loop. |
| [wp\_get\_attachment\_image()](wp_get_attachment_image) wp-includes/media.php | Gets an HTML img element representing an image attachment. |
| [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\_post()](get_post) wp-includes/post.php | Retrieves post data given a post ID or post object. |
| Used By | Description |
| --- | --- |
| [the\_post\_thumbnail()](the_post_thumbnail) wp-includes/post-thumbnail-template.php | Displays the post thumbnail. |
| 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. |
| programming_docs |
wordpress wp_admin_bar_site_menu( WP_Admin_Bar $wp_admin_bar ) wp\_admin\_bar\_site\_menu( WP\_Admin\_Bar $wp\_admin\_bar )
============================================================
Adds the “Site Name” menu.
`$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_site_menu( $wp_admin_bar ) {
// Don't show for logged out users.
if ( ! is_user_logged_in() ) {
return;
}
// Show only when the user is a member of this site, or they're a super admin.
if ( ! is_user_member_of_blog() && ! current_user_can( 'manage_network' ) ) {
return;
}
$blogname = get_bloginfo( 'name' );
if ( ! $blogname ) {
$blogname = preg_replace( '#^(https?://)?(www.)?#', '', get_home_url() );
}
if ( is_network_admin() ) {
/* translators: %s: Site title. */
$blogname = sprintf( __( 'Network Admin: %s' ), esc_html( get_network()->site_name ) );
} elseif ( is_user_admin() ) {
/* translators: %s: Site title. */
$blogname = sprintf( __( 'User Dashboard: %s' ), esc_html( get_network()->site_name ) );
}
$title = wp_html_excerpt( $blogname, 40, '…' );
$wp_admin_bar->add_node(
array(
'id' => 'site-name',
'title' => $title,
'href' => ( is_admin() || ! current_user_can( 'read' ) ) ? home_url( '/' ) : admin_url(),
)
);
// Create submenu items.
if ( is_admin() ) {
// Add an option to visit the site.
$wp_admin_bar->add_node(
array(
'parent' => 'site-name',
'id' => 'view-site',
'title' => __( 'Visit Site' ),
'href' => home_url( '/' ),
)
);
if ( is_blog_admin() && is_multisite() && current_user_can( 'manage_sites' ) ) {
$wp_admin_bar->add_node(
array(
'parent' => 'site-name',
'id' => 'edit-site',
'title' => __( 'Edit Site' ),
'href' => network_admin_url( 'site-info.php?id=' . get_current_blog_id() ),
)
);
}
} elseif ( current_user_can( 'read' ) ) {
// We're on the front end, link to the Dashboard.
$wp_admin_bar->add_node(
array(
'parent' => 'site-name',
'id' => 'dashboard',
'title' => __( 'Dashboard' ),
'href' => admin_url(),
)
);
// Add the appearance submenu items.
wp_admin_bar_appearance_menu( $wp_admin_bar );
}
}
```
| Uses | Description |
| --- | --- |
| [get\_network()](get_network) wp-includes/ms-network.php | Retrieves network data given a network ID or network object. |
| [is\_user\_admin()](is_user_admin) wp-includes/load.php | Determines whether the current request is for a user admin screen. |
| [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::add\_node()](../classes/wp_admin_bar/add_node) wp-includes/class-wp-admin-bar.php | Adds a node to the menu. |
| [get\_home\_url()](get_home_url) wp-includes/link-template.php | Retrieves the URL for a given site where the front end is accessible. |
| [network\_admin\_url()](network_admin_url) wp-includes/link-template.php | Retrieves the URL to the admin area for the network. |
| [is\_blog\_admin()](is_blog_admin) wp-includes/load.php | Determines whether the current request is for a site’s administrative interface. |
| [wp\_html\_excerpt()](wp_html_excerpt) wp-includes/formatting.php | Safely extracts not more than the first $count characters from HTML string. |
| [is\_network\_admin()](is_network_admin) wp-includes/load.php | Determines whether the current request is for the network administrative interface. |
| [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\_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. |
| [current\_user\_can()](current_user_can) wp-includes/capabilities.php | Returns whether the current user has the specified capability. |
| [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. |
| [is\_user\_logged\_in()](is_user_logged_in) wp-includes/pluggable.php | Determines whether the current visitor is a logged in user. |
| [esc\_html()](esc_html) wp-includes/formatting.php | Escaping for HTML blocks. |
| [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. |
| Version | Description |
| --- | --- |
| [3.3.0](https://developer.wordpress.org/reference/since/3.3.0/) | Introduced. |
wordpress trailingslashit( string $string ): string trailingslashit( string $string ): string
=========================================
Appends a trailing slash.
Will remove trailing forward and backslashes if it exists already before adding a trailing forward slash. This prevents double slashing a string or path.
The primary use of this is for paths and thus should be used for paths. It is not restricted to paths and offers no specific path support.
`$string` string Required What to add the trailing slash to. string String with trailing slash added.
File: `wp-includes/formatting.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/formatting.php/)
```
function trailingslashit( $string ) {
return untrailingslashit( $string ) . '/';
}
```
| Uses | Description |
| --- | --- |
| [untrailingslashit()](untrailingslashit) wp-includes/formatting.php | Removes trailing forward slashes and backslashes if they exist. |
| Used By | Description |
| --- | --- |
| [WP\_Textdomain\_Registry::get\_path\_from\_lang\_dir()](../classes/wp_textdomain_registry/get_path_from_lang_dir) wp-includes/class-wp-textdomain-registry.php | Gets the path to the language directory for the current locale. |
| [WP\_Textdomain\_Registry::set()](../classes/wp_textdomain_registry/set) wp-includes/class-wp-textdomain-registry.php | Sets the language directory path for a specific domain and locale. |
| [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\_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\_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\_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. |
| [register\_block\_type\_from\_metadata()](register_block_type_from_metadata) wp-includes/blocks.php | Registers a block type from the metadata stored in the `block.json` file. |
| [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\_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. |
| [load\_script\_textdomain()](load_script_textdomain) wp-includes/l10n.php | Loads the script translated strings. |
| [wp\_privacy\_exports\_dir()](wp_privacy_exports_dir) wp-includes/functions.php | Returns the directory used to store personal data export files. |
| [wp\_privacy\_exports\_url()](wp_privacy_exports_url) wp-includes/functions.php | Returns the URL of the directory used to store personal data export files. |
| [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. |
| [\_load\_textdomain\_just\_in\_time()](_load_textdomain_just_in_time) wp-includes/l10n.php | Loads plugin and theme text domains just-in-time. |
| [wp\_get\_canonical\_url()](wp_get_canonical_url) wp-includes/link-template.php | Returns the canonical URL for a post. |
| [\_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. |
| [get\_rest\_url()](get_rest_url) wp-includes/rest-api.php | Retrieves the URL to a REST endpoint on a site. |
| [get\_post\_embed\_url()](get_post_embed_url) wp-includes/embed.php | Retrieves the URL to embed a specific post in an iframe. |
| [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. |
| [\_upgrade\_422\_remove\_genericons()](_upgrade_422_remove_genericons) wp-admin/includes/update-core.php | Cleans up Genericons example files. |
| [network\_step2()](network_step2) wp-admin/includes/network.php | Prints step 2 for Network installation process. |
| [Core\_Upgrader::upgrade()](../classes/core_upgrader/upgrade) wp-admin/includes/class-core-upgrader.php | Upgrade WordPress core. |
| [Theme\_Upgrader::delete\_old\_theme()](../classes/theme_upgrader/delete_old_theme) wp-admin/includes/class-theme-upgrader.php | Delete the old theme during an upgrade. |
| [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. |
| [Plugin\_Upgrader::delete\_old\_plugin()](../classes/plugin_upgrader/delete_old_plugin) wp-admin/includes/class-plugin-upgrader.php | Deletes the old plugin during an upgrade. |
| [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. |
| [WP\_Upgrader::install\_package()](../classes/wp_upgrader/install_package) wp-admin/includes/class-wp-upgrader.php | Install a package. |
| [WP\_Filesystem\_SSH2::cwd()](../classes/wp_filesystem_ssh2/cwd) wp-admin/includes/class-wp-filesystem-ssh2.php | Gets the current working directory. |
| [delete\_theme()](delete_theme) wp-admin/includes/theme.php | Removes a theme. |
| [WP\_Filesystem\_FTPext::is\_dir()](../classes/wp_filesystem_ftpext/is_dir) wp-admin/includes/class-wp-filesystem-ftpext.php | Checks if resource is a directory. |
| [WP\_Filesystem\_FTPext::cwd()](../classes/wp_filesystem_ftpext/cwd) wp-admin/includes/class-wp-filesystem-ftpext.php | Gets the current working directory. |
| [WP\_Filesystem\_FTPext::delete()](../classes/wp_filesystem_ftpext/delete) wp-admin/includes/class-wp-filesystem-ftpext.php | Deletes a file or directory. |
| [WP\_Filesystem\_Base::find\_folder()](../classes/wp_filesystem_base/find_folder) wp-admin/includes/class-wp-filesystem-base.php | Locates a folder on the remote filesystem. |
| [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\_Filesystem\_Direct::delete()](../classes/wp_filesystem_direct/delete) wp-admin/includes/class-wp-filesystem-direct.php | Deletes a file or directory. |
| [WP\_Filesystem\_Direct::chgrp()](../classes/wp_filesystem_direct/chgrp) wp-admin/includes/class-wp-filesystem-direct.php | Changes the file group. |
| [WP\_Filesystem\_Direct::chmod()](../classes/wp_filesystem_direct/chmod) wp-admin/includes/class-wp-filesystem-direct.php | Changes filesystem permissions. |
| [delete\_plugins()](delete_plugins) wp-admin/includes/plugin.php | Removes directory and files of a plugin for a list of plugins. |
| [update\_core()](update_core) wp-admin/includes/update-core.php | Upgrades the core of WordPress. |
| [WP\_Filesystem\_ftpsockets::cwd()](../classes/wp_filesystem_ftpsockets/cwd) wp-admin/includes/class-wp-filesystem-ftpsockets.php | Gets the current working directory. |
| [get\_filesystem\_method()](get_filesystem_method) wp-admin/includes/file.php | Determines which method to use for reading, writing, modifying, or deleting files on the filesystem. |
| [get\_home\_path()](get_home_path) wp-admin/includes/file.php | Gets the absolute filesystem path to the root of the WordPress installation. |
| [list\_files()](list_files) wp-admin/includes/file.php | Returns a listing of all files in the specified folder and all subdirectories up to 100 levels deep. |
| [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. |
| [copy\_dir()](copy_dir) wp-admin/includes/file.php | Copies a directory from one location to another via the WordPress Filesystem Abstraction. |
| [paginate\_links()](paginate_links) wp-includes/general-template.php | Retrieves paginated links for archive post pages. |
| [WP\_Theme::scandir()](../classes/wp_theme/scandir) wp-includes/class-wp-theme.php | Scans a directory for files of a certain extension. |
| [wp\_old\_slug\_redirect()](wp_old_slug_redirect) wp-includes/query.php | Redirect old slugs to the correct permalink. |
| [get\_temp\_dir()](get_temp_dir) wp-includes/functions.php | Determines a writable directory for temporary files. |
| [wp\_unique\_filename()](wp_unique_filename) wp-includes/functions.php | Gets a filename that is sanitized and unique for the given directory. |
| [get\_comments\_pagenum\_link()](get_comments_pagenum_link) wp-includes/link-template.php | Retrieves the comments page number link. |
| [paginate\_comments\_links()](paginate_comments_links) wp-includes/link-template.php | Displays or retrieves pagination links for the comments on the current post. |
| [get\_pagenum\_link()](get_pagenum_link) wp-includes/link-template.php | Retrieves the link for a page number. |
| [get\_post\_type\_archive\_feed\_link()](get_post_type_archive_feed_link) wp-includes/link-template.php | Retrieves the permalink for a post type archive feed. |
| [get\_term\_feed\_link()](get_term_feed_link) wp-includes/link-template.php | Retrieves the feed link for a term. |
| [get\_search\_feed\_link()](get_search_feed_link) wp-includes/link-template.php | Retrieves the permalink for the search results feed. |
| [get\_post\_comments\_feed\_link()](get_post_comments_feed_link) wp-includes/link-template.php | Retrieves the permalink for the post comments feed. |
| [get\_author\_feed\_link()](get_author_feed_link) wp-includes/link-template.php | Retrieves the feed link for a given author. |
| [get\_attachment\_link()](get_attachment_link) wp-includes/link-template.php | Retrieves the permalink for an attachment. |
| [user\_trailingslashit()](user_trailingslashit) wp-includes/link-template.php | Retrieves a trailing-slashed string if the site is set for adding trailing slashes. |
| [WP\_Admin\_Bar::initialize()](../classes/wp_admin_bar/initialize) wp-includes/class-wp-admin-bar.php | Initializes the admin bar. |
| [WP\_Image\_Editor::get\_output\_format()](../classes/wp_image_editor/get_output_format) wp-includes/class-wp-image-editor.php | Returns preferred mime-type and extension based on provided file’s extension and mime, or current file’s extension and mime. |
| [WP\_Image\_Editor::generate\_filename()](../classes/wp_image_editor/generate_filename) wp-includes/class-wp-image-editor.php | Builds an output filename based on current file, and adding proper suffix |
| [plugin\_dir\_path()](plugin_dir_path) wp-includes/plugin.php | Get the filesystem directory path (with trailing slash) for the plugin \_\_FILE\_\_ passed in. |
| [plugin\_dir\_url()](plugin_dir_url) wp-includes/plugin.php | Get the URL directory path (with trailing slash) for the plugin \_\_FILE\_\_ passed in. |
| [\_wp\_link\_page()](_wp_link_page) wp-includes/post-template.php | Helper function for [wp\_link\_pages()](wp_link_pages) . |
| [wp\_get\_attachment\_url()](wp_get_attachment_url) wp-includes/post.php | Retrieves the URL for an attachment. |
| [WP\_Rewrite::mod\_rewrite\_rules()](../classes/wp_rewrite/mod_rewrite_rules) wp-includes/class-wp-rewrite.php | Retrieves mod\_rewrite-formatted rewrite rules to write to .htaccess. |
| [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. |
| [redirect\_guess\_404\_permalink()](redirect_guess_404_permalink) wp-includes/canonical.php | Attempts to guess the correct URL for a 404 request based on query vars. |
| [domain\_exists()](domain_exists) wp-includes/ms-functions.php | Checks whether a site name is already taken. |
| [get\_trackback\_url()](get_trackback_url) wp-includes/comment-template.php | Retrieves the current post’s trackback URL. |
| [get\_comment\_link()](get_comment_link) wp-includes/comment-template.php | Retrieves the link to a given comment. |
| [weblog\_ping()](weblog_ping) wp-includes/comment.php | Sends a pingback. |
| [\_WP\_Editors::editor\_settings()](../classes/_wp_editors/editor_settings) wp-includes/class-wp-editor.php | |
| Version | Description |
| --- | --- |
| [1.2.0](https://developer.wordpress.org/reference/since/1.2.0/) | Introduced. |
wordpress is_embed(): bool is\_embed(): bool
=================
Is the query for an embedded post?
bool Whether the query is for an embedded post.
File: `wp-includes/query.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/query.php/)
```
function is_embed() {
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_embed();
}
```
| Uses | Description |
| --- | --- |
| [WP\_Query::is\_embed()](../classes/wp_query/is_embed) wp-includes/class-wp-query.php | Is the query for an embedded 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\_robots\_noindex\_embeds()](wp_robots_noindex_embeds) wp-includes/robots-template.php | Adds `noindex` to the robots meta tag for embeds. |
| [wp\_embed\_excerpt\_more()](wp_embed_excerpt_more) wp-includes/embed.php | Filters the string in the ‘more’ link displayed after a trimmed excerpt. |
| [wp\_old\_slug\_redirect()](wp_old_slug_redirect) wp-includes/query.php | Redirect old slugs to the correct permalink. |
| [is\_admin\_bar\_showing()](is_admin_bar_showing) wp-includes/admin-bar.php | Determines whether the admin bar should be showing. |
| Version | Description |
| --- | --- |
| [4.4.0](https://developer.wordpress.org/reference/since/4.4.0/) | Introduced. |
wordpress populate_site_meta( int $site_id, array $meta = array() ) populate\_site\_meta( int $site\_id, array $meta = array() )
============================================================
Creates WordPress site meta and sets the default values.
`$site_id` int Required Site 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_site_meta( $site_id, array $meta = array() ) {
global $wpdb;
$site_id = (int) $site_id;
if ( ! is_site_meta_supported() ) {
return;
}
if ( empty( $meta ) ) {
return;
}
/**
* Filters meta for a site on creation.
*
* @since 5.2.0
*
* @param array $meta Associative array of site meta keys and values to be inserted.
* @param int $site_id ID of site to populate.
*/
$site_meta = apply_filters( 'populate_site_meta', $meta, $site_id );
$insert = '';
foreach ( $site_meta 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)', $site_id, $meta_key, $meta_value );
}
$wpdb->query( "INSERT INTO $wpdb->blogmeta ( blog_id, meta_key, meta_value ) VALUES " . $insert ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared
wp_cache_delete( $site_id, 'blog_meta' );
wp_cache_set_sites_last_changed();
}
```
[apply\_filters( 'populate\_site\_meta', array $meta, int $site\_id )](../hooks/populate_site_meta)
Filters meta for a site on creation.
| Uses | 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. |
| [is\_site\_meta\_supported()](is_site_meta_supported) wp-includes/functions.php | Determines whether site meta is enabled. |
| [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. |
| [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\_initialize\_site()](wp_initialize_site) wp-includes/ms-site.php | Runs the initialization routine for a given site. |
| Version | Description |
| --- | --- |
| [5.1.0](https://developer.wordpress.org/reference/since/5.1.0/) | Introduced. |
| programming_docs |
wordpress wp_install_language_form( array[] $languages ) wp\_install\_language\_form( array[] $languages )
=================================================
Output the select form for the language selection on the installation screen.
`$languages` array[] Required Array of available languages (populated via the Translation API). File: `wp-admin/includes/translation-install.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/translation-install.php/)
```
function wp_install_language_form( $languages ) {
global $wp_local_package;
$installed_languages = get_available_languages();
echo "<label class='screen-reader-text' for='language'>Select a default language</label>\n";
echo "<select size='14' name='language' id='language'>\n";
echo '<option value="" lang="en" selected="selected" data-continue="Continue" data-installed="1">English (United States)</option>';
echo "\n";
if ( ! empty( $wp_local_package ) && isset( $languages[ $wp_local_package ] ) ) {
if ( isset( $languages[ $wp_local_package ] ) ) {
$language = $languages[ $wp_local_package ];
printf(
'<option value="%s" lang="%s" data-continue="%s"%s>%s</option>' . "\n",
esc_attr( $language['language'] ),
esc_attr( current( $language['iso'] ) ),
esc_attr( $language['strings']['continue'] ? $language['strings']['continue'] : 'Continue' ),
in_array( $language['language'], $installed_languages, true ) ? ' data-installed="1"' : '',
esc_html( $language['native_name'] )
);
unset( $languages[ $wp_local_package ] );
}
}
foreach ( $languages as $language ) {
printf(
'<option value="%s" lang="%s" data-continue="%s"%s>%s</option>' . "\n",
esc_attr( $language['language'] ),
esc_attr( current( $language['iso'] ) ),
esc_attr( $language['strings']['continue'] ? $language['strings']['continue'] : 'Continue' ),
in_array( $language['language'], $installed_languages, true ) ? ' data-installed="1"' : '',
esc_html( $language['native_name'] )
);
}
echo "</select>\n";
echo '<p class="step"><span class="spinner"></span><input id="language-continue" type="submit" class="button button-primary button-large" value="Continue" /></p>';
}
```
| Uses | Description |
| --- | --- |
| [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()](esc_attr) wp-includes/formatting.php | Escaping for HTML attributes. |
| [esc\_html()](esc_html) wp-includes/formatting.php | Escaping for HTML blocks. |
| Version | Description |
| --- | --- |
| [4.0.0](https://developer.wordpress.org/reference/since/4.0.0/) | Introduced. |
wordpress wp_parse_list( array|string $list ): array wp\_parse\_list( array|string $list ): array
============================================
Converts a comma- or space-separated list of scalar values to an array.
`$list` array|string Required List of values. array Array of values.
File: `wp-includes/functions.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/functions.php/)
```
function wp_parse_list( $list ) {
if ( ! is_array( $list ) ) {
return preg_split( '/[\s,]+/', $list, -1, PREG_SPLIT_NO_EMPTY );
}
// Validate all entries of the list are scalar.
$list = array_filter( $list, 'is_scalar' );
return $list;
}
```
| Used By | Description |
| --- | --- |
| [WP\_REST\_Pattern\_Directory\_Controller::get\_transient\_key()](../classes/wp_rest_pattern_directory_controller/get_transient_key) wp-includes/rest-api/endpoints/class-wp-rest-pattern-directory-controller.php | |
| [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. |
| [rest\_sanitize\_array()](rest_sanitize_array) wp-includes/rest-api.php | Converts an array-like value to an array. |
| [rest\_is\_array()](rest_is_array) wp-includes/rest-api.php | Determines if a given value is array-like. |
| [rest\_parse\_embed\_param()](rest_parse_embed_param) wp-includes/rest-api.php | Parses the “\_embed” parameter into the list of resources to embed. |
| [WP\_REST\_Controller::get\_fields\_for\_response()](../classes/wp_rest_controller/get_fields_for_response) wp-includes/rest-api/endpoints/class-wp-rest-controller.php | Gets an array of fields to be included on the response. |
| [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. |
| [wp\_parse\_slug\_list()](wp_parse_slug_list) wp-includes/functions.php | Cleans up an array, comma- or space-separated list of slugs. |
| [WP\_Comment\_Query::get\_comment\_ids()](../classes/wp_comment_query/get_comment_ids) wp-includes/class-wp-comment-query.php | Used internally to get a list of comment IDs matching the query vars. |
| [wp\_parse\_id\_list()](wp_parse_id_list) wp-includes/functions.php | Cleans up an array, comma- or space-separated list of IDs. |
| [get\_pages()](get_pages) wp-includes/post.php | Retrieves an array of pages (or hierarchical post type items). |
| Version | Description |
| --- | --- |
| [5.1.0](https://developer.wordpress.org/reference/since/5.1.0/) | Introduced. |
wordpress wp_is_theme_directory_ignored( string $path ): Bool wp\_is\_theme\_directory\_ignored( string $path ): Bool
=======================================================
Determines whether a theme directory should be ignored during export.
`$path` string Required The path of the file in the theme. Bool Whether this file is in an ignored directory.
File: `wp-includes/block-template-utils.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/block-template-utils.php/)
```
function wp_is_theme_directory_ignored( $path ) {
$directories_to_ignore = array( '.DS_Store', '.svn', '.git', '.hg', '.bzr', 'node_modules', 'vendor' );
foreach ( $directories_to_ignore as $directory ) {
if ( str_starts_with( $path, $directory ) ) {
return true;
}
}
return false;
}
```
| 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. |
| Version | Description |
| --- | --- |
| [6.0.0](https://developer.wordpress.org/reference/since/6.0.0/) | Introduced. |
wordpress wp_get_comment_fields_max_lengths(): int[] wp\_get\_comment\_fields\_max\_lengths(): int[]
===============================================
Retrieves the maximum character lengths for the comment form fields.
int[] Array of maximum lengths keyed by field name.
File: `wp-includes/comment.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/comment.php/)
```
function wp_get_comment_fields_max_lengths() {
global $wpdb;
$lengths = array(
'comment_author' => 245,
'comment_author_email' => 100,
'comment_author_url' => 200,
'comment_content' => 65525,
);
if ( $wpdb->is_mysql ) {
foreach ( $lengths as $column => $length ) {
$col_length = $wpdb->get_col_length( $wpdb->comments, $column );
$max_length = 0;
// No point if we can't get the DB column lengths.
if ( is_wp_error( $col_length ) ) {
break;
}
if ( ! is_array( $col_length ) && (int) $col_length > 0 ) {
$max_length = (int) $col_length;
} elseif ( is_array( $col_length ) && isset( $col_length['length'] ) && (int) $col_length['length'] > 0 ) {
$max_length = (int) $col_length['length'];
if ( ! empty( $col_length['type'] ) && 'byte' === $col_length['type'] ) {
$max_length = $max_length - 10;
}
}
if ( $max_length > 0 ) {
$lengths[ $column ] = $max_length;
}
}
}
/**
* Filters the lengths for the comment form fields.
*
* @since 4.5.0
*
* @param int[] $lengths Array of maximum lengths keyed by field name.
*/
return apply_filters( 'wp_get_comment_fields_max_lengths', $lengths );
}
```
[apply\_filters( 'wp\_get\_comment\_fields\_max\_lengths', int[] $lengths )](../hooks/wp_get_comment_fields_max_lengths)
Filters the lengths for the comment form fields.
| Uses | Description |
| --- | --- |
| [wpdb::get\_col\_length()](../classes/wpdb/get_col_length) wp-includes/class-wpdb.php | Retrieves the maximum string length allowed in a given column. |
| [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\_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. |
| Version | Description |
| --- | --- |
| [4.5.0](https://developer.wordpress.org/reference/since/4.5.0/) | Introduced. |
wordpress _unzip_file_pclzip( string $file, string $to, string[] $needed_dirs = array() ): true|WP_Error \_unzip\_file\_pclzip( string $file, string $to, string[] $needed\_dirs = array() ): true|WP\_Error
===================================================================================================
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 [unzip\_file()](unzip_file) instead.
Attempts to unzip an archive using the PclZip library.
This function should not be called directly, use `unzip_file()` instead.
Assumes that [WP\_Filesystem()](wp_filesystem) has already been called and set up.
* [unzip\_file()](unzip_file)
`$file` string Required Full path and filename of ZIP archive. `$to` string Required Full path on the filesystem to extract archive to. `$needed_dirs` string[] Optional A partial list of required folders needed to be created. Default: `array()`
true|[WP\_Error](../classes/wp_error) True on success, [WP\_Error](../classes/wp_error) on failure.
File: `wp-admin/includes/file.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/file.php/)
```
function _unzip_file_pclzip( $file, $to, $needed_dirs = array() ) {
global $wp_filesystem;
mbstring_binary_safe_encoding();
require_once ABSPATH . 'wp-admin/includes/class-pclzip.php';
$archive = new PclZip( $file );
$archive_files = $archive->extract( PCLZIP_OPT_EXTRACT_AS_STRING );
reset_mbstring_encoding();
// Is the archive valid?
if ( ! is_array( $archive_files ) ) {
return new WP_Error( 'incompatible_archive', __( 'Incompatible Archive.' ), $archive->errorInfo( true ) );
}
if ( 0 === count( $archive_files ) ) {
return new WP_Error( 'empty_archive_pclzip', __( 'Empty archive.' ) );
}
$uncompressed_size = 0;
// Determine any children directories needed (From within the archive).
foreach ( $archive_files as $file ) {
if ( '__MACOSX/' === substr( $file['filename'], 0, 9 ) ) { // Skip the OS X-created __MACOSX directory.
continue;
}
$uncompressed_size += $file['size'];
$needed_dirs[] = $to . untrailingslashit( $file['folder'] ? $file['filename'] : dirname( $file['filename'] ) );
}
/*
* disk_free_space() could return false. Assume that any falsey value is an error.
* A disk that has zero free bytes has bigger problems.
* Require we have enough space to unzip the file and copy its contents, with a 10% buffer.
*/
if ( wp_doing_cron() ) {
$available_space = function_exists( 'disk_free_space' ) ? @disk_free_space( WP_CONTENT_DIR ) : false;
if ( $available_space && ( $uncompressed_size * 2.1 ) > $available_space ) {
return new WP_Error(
'disk_full_unzip_file',
__( 'Could not copy files. You may have run out of disk space.' ),
compact( 'uncompressed_size', 'available_space' )
);
}
}
$needed_dirs = array_unique( $needed_dirs );
foreach ( $needed_dirs as $dir ) {
// Check the parent folders of the folders all exist within the creation array.
if ( untrailingslashit( $to ) === $dir ) { // Skip over the working directory, we know this exists (or will exist).
continue;
}
if ( strpos( $dir, $to ) === false ) { // If the directory is not within the working directory, skip it.
continue;
}
$parent_folder = dirname( $dir );
while ( ! empty( $parent_folder )
&& untrailingslashit( $to ) !== $parent_folder
&& ! in_array( $parent_folder, $needed_dirs, true )
) {
$needed_dirs[] = $parent_folder;
$parent_folder = dirname( $parent_folder );
}
}
asort( $needed_dirs );
// Create those directories if need be:
foreach ( $needed_dirs as $_dir ) {
// Only check to see if the dir exists upon creation failure. Less I/O this way.
if ( ! $wp_filesystem->mkdir( $_dir, FS_CHMOD_DIR ) && ! $wp_filesystem->is_dir( $_dir ) ) {
return new WP_Error( 'mkdir_failed_pclzip', __( 'Could not create directory.' ), $_dir );
}
}
unset( $needed_dirs );
// Extract the files from the zip.
foreach ( $archive_files as $file ) {
if ( $file['folder'] ) {
continue;
}
if ( '__MACOSX/' === substr( $file['filename'], 0, 9 ) ) { // Don't extract the OS X-created __MACOSX directory files.
continue;
}
// Don't extract invalid files:
if ( 0 !== validate_file( $file['filename'] ) ) {
continue;
}
if ( ! $wp_filesystem->put_contents( $to . $file['filename'], $file['content'], FS_CHMOD_FILE ) ) {
return new WP_Error( 'copy_failed_pclzip', __( 'Could not copy file.' ), $file['filename'] );
}
}
return true;
}
```
| Uses | Description |
| --- | --- |
| [wp\_doing\_cron()](wp_doing_cron) wp-includes/load.php | Determines whether the current request is a WordPress cron request. |
| [untrailingslashit()](untrailingslashit) wp-includes/formatting.php | Removes trailing forward slashes and backslashes if they exist. |
| [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. |
| [validate\_file()](validate_file) wp-includes/functions.php | Validates a file name and path against an allowed set of rules. |
| [\_\_()](__) 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 |
| --- | --- |
| [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. |
| Version | Description |
| --- | --- |
| [3.0.0](https://developer.wordpress.org/reference/since/3.0.0/) | Introduced. |
wordpress _wp_translate_postdata( bool $update = false, array|null $post_data = null ): array|WP_Error \_wp\_translate\_postdata( bool $update = false, array|null $post\_data = null ): array|WP\_Error
=================================================================================================
Renames `$_POST` data from form names to DB post columns.
Manipulates `$_POST` directly.
`$update` bool Optional Whether the post already exists. Default: `false`
`$post_data` array|null Optional The array of post data to process.
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_translate_postdata( $update = false, $post_data = null ) {
if ( empty( $post_data ) ) {
$post_data = &$_POST;
}
if ( $update ) {
$post_data['ID'] = (int) $post_data['post_ID'];
}
$ptype = get_post_type_object( $post_data['post_type'] );
if ( $update && ! current_user_can( 'edit_post', $post_data['ID'] ) ) {
if ( 'page' === $post_data['post_type'] ) {
return new WP_Error( 'edit_others_pages', __( 'Sorry, you are not allowed to edit pages as this user.' ) );
} else {
return new WP_Error( 'edit_others_posts', __( 'Sorry, you are not allowed to edit posts as this user.' ) );
}
} elseif ( ! $update && ! current_user_can( $ptype->cap->create_posts ) ) {
if ( 'page' === $post_data['post_type'] ) {
return new WP_Error( 'edit_others_pages', __( 'Sorry, you are not allowed to create pages as this user.' ) );
} else {
return new WP_Error( 'edit_others_posts', __( 'Sorry, you are not allowed to create posts as this user.' ) );
}
}
if ( isset( $post_data['content'] ) ) {
$post_data['post_content'] = $post_data['content'];
}
if ( isset( $post_data['excerpt'] ) ) {
$post_data['post_excerpt'] = $post_data['excerpt'];
}
if ( isset( $post_data['parent_id'] ) ) {
$post_data['post_parent'] = (int) $post_data['parent_id'];
}
if ( isset( $post_data['trackback_url'] ) ) {
$post_data['to_ping'] = $post_data['trackback_url'];
}
$post_data['user_ID'] = get_current_user_id();
if ( ! empty( $post_data['post_author_override'] ) ) {
$post_data['post_author'] = (int) $post_data['post_author_override'];
} else {
if ( ! empty( $post_data['post_author'] ) ) {
$post_data['post_author'] = (int) $post_data['post_author'];
} else {
$post_data['post_author'] = (int) $post_data['user_ID'];
}
}
if ( isset( $post_data['user_ID'] ) && ( $post_data['post_author'] != $post_data['user_ID'] )
&& ! current_user_can( $ptype->cap->edit_others_posts ) ) {
if ( $update ) {
if ( 'page' === $post_data['post_type'] ) {
return new WP_Error( 'edit_others_pages', __( 'Sorry, you are not allowed to edit pages as this user.' ) );
} else {
return new WP_Error( 'edit_others_posts', __( 'Sorry, you are not allowed to edit posts as this user.' ) );
}
} else {
if ( 'page' === $post_data['post_type'] ) {
return new WP_Error( 'edit_others_pages', __( 'Sorry, you are not allowed to create pages as this user.' ) );
} else {
return new WP_Error( 'edit_others_posts', __( 'Sorry, you are not allowed to create posts as this user.' ) );
}
}
}
if ( ! empty( $post_data['post_status'] ) ) {
$post_data['post_status'] = sanitize_key( $post_data['post_status'] );
// No longer an auto-draft.
if ( 'auto-draft' === $post_data['post_status'] ) {
$post_data['post_status'] = 'draft';
}
if ( ! get_post_status_object( $post_data['post_status'] ) ) {
unset( $post_data['post_status'] );
}
}
// What to do based on which button they pressed.
if ( isset( $post_data['saveasdraft'] ) && '' !== $post_data['saveasdraft'] ) {
$post_data['post_status'] = 'draft';
}
if ( isset( $post_data['saveasprivate'] ) && '' !== $post_data['saveasprivate'] ) {
$post_data['post_status'] = 'private';
}
if ( isset( $post_data['publish'] ) && ( '' !== $post_data['publish'] )
&& ( ! isset( $post_data['post_status'] ) || 'private' !== $post_data['post_status'] )
) {
$post_data['post_status'] = 'publish';
}
if ( isset( $post_data['advanced'] ) && '' !== $post_data['advanced'] ) {
$post_data['post_status'] = 'draft';
}
if ( isset( $post_data['pending'] ) && '' !== $post_data['pending'] ) {
$post_data['post_status'] = 'pending';
}
if ( isset( $post_data['ID'] ) ) {
$post_id = $post_data['ID'];
} else {
$post_id = false;
}
$previous_status = $post_id ? get_post_field( 'post_status', $post_id ) : false;
if ( isset( $post_data['post_status'] ) && 'private' === $post_data['post_status'] && ! current_user_can( $ptype->cap->publish_posts ) ) {
$post_data['post_status'] = $previous_status ? $previous_status : 'pending';
}
$published_statuses = array( 'publish', 'future' );
// Posts 'submitted for approval' are submitted to $_POST the same as if they were being published.
// Change status from 'publish' to 'pending' if user lacks permissions to publish or to resave published posts.
if ( isset( $post_data['post_status'] )
&& ( in_array( $post_data['post_status'], $published_statuses, true )
&& ! current_user_can( $ptype->cap->publish_posts ) )
) {
if ( ! in_array( $previous_status, $published_statuses, true ) || ! current_user_can( 'edit_post', $post_id ) ) {
$post_data['post_status'] = 'pending';
}
}
if ( ! isset( $post_data['post_status'] ) ) {
$post_data['post_status'] = 'auto-draft' === $previous_status ? 'draft' : $previous_status;
}
if ( isset( $post_data['post_password'] ) && ! current_user_can( $ptype->cap->publish_posts ) ) {
unset( $post_data['post_password'] );
}
if ( ! isset( $post_data['comment_status'] ) ) {
$post_data['comment_status'] = 'closed';
}
if ( ! isset( $post_data['ping_status'] ) ) {
$post_data['ping_status'] = 'closed';
}
foreach ( array( 'aa', 'mm', 'jj', 'hh', 'mn' ) as $timeunit ) {
if ( ! empty( $post_data[ 'hidden_' . $timeunit ] ) && $post_data[ 'hidden_' . $timeunit ] != $post_data[ $timeunit ] ) {
$post_data['edit_date'] = '1';
break;
}
}
if ( ! empty( $post_data['edit_date'] ) ) {
$aa = $post_data['aa'];
$mm = $post_data['mm'];
$jj = $post_data['jj'];
$hh = $post_data['hh'];
$mn = $post_data['mn'];
$ss = $post_data['ss'];
$aa = ( $aa <= 0 ) ? gmdate( 'Y' ) : $aa;
$mm = ( $mm <= 0 ) ? gmdate( 'n' ) : $mm;
$jj = ( $jj > 31 ) ? 31 : $jj;
$jj = ( $jj <= 0 ) ? gmdate( 'j' ) : $jj;
$hh = ( $hh > 23 ) ? $hh - 24 : $hh;
$mn = ( $mn > 59 ) ? $mn - 60 : $mn;
$ss = ( $ss > 59 ) ? $ss - 60 : $ss;
$post_data['post_date'] = sprintf( '%04d-%02d-%02d %02d:%02d:%02d', $aa, $mm, $jj, $hh, $mn, $ss );
$valid_date = wp_checkdate( $mm, $jj, $aa, $post_data['post_date'] );
if ( ! $valid_date ) {
return new WP_Error( 'invalid_date', __( 'Invalid date.' ) );
}
$post_data['post_date_gmt'] = get_gmt_from_date( $post_data['post_date'] );
}
if ( isset( $post_data['post_category'] ) ) {
$category_object = get_taxonomy( 'category' );
if ( ! current_user_can( $category_object->cap->assign_terms ) ) {
unset( $post_data['post_category'] );
}
}
return $post_data;
}
```
| Uses | Description |
| --- | --- |
| [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\_checkdate()](wp_checkdate) wp-includes/functions.php | Tests if the supplied date is valid for the Gregorian calendar. |
| [get\_post\_status\_object()](get_post_status_object) wp-includes/post.php | Retrieves a post status object by name. |
| [get\_post\_field()](get_post_field) wp-includes/post.php | Retrieves data from a post field based on Post ID. |
| [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. |
| [sanitize\_key()](sanitize_key) wp-includes/formatting.php | Sanitizes a string key. |
| [get\_taxonomy()](get_taxonomy) wp-includes/taxonomy.php | Retrieves the taxonomy object of $taxonomy. |
| [get\_current\_user\_id()](get_current_user_id) wp-includes/user.php | Gets the current user’s ID. |
| [get\_post\_type\_object()](get_post_type_object) wp-includes/post.php | Retrieves a post type object by name. |
| [WP\_Error::\_\_construct()](../classes/wp_error/__construct) wp-includes/class-wp-error.php | Initializes the 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 |
| --- | --- |
| [2.6.0](https://developer.wordpress.org/reference/since/2.6.0/) | Introduced. |
| programming_docs |
wordpress wp_admin_bar_search_menu( WP_Admin_Bar $wp_admin_bar ) wp\_admin\_bar\_search\_menu( WP\_Admin\_Bar $wp\_admin\_bar )
==============================================================
Adds search form.
`$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_search_menu( $wp_admin_bar ) {
if ( is_admin() ) {
return;
}
$form = '<form action="' . esc_url( home_url( '/' ) ) . '" method="get" id="adminbarsearch">';
$form .= '<input class="adminbar-input" name="s" id="adminbar-search" type="text" value="" maxlength="150" />';
$form .= '<label for="adminbar-search" class="screen-reader-text">' . __( 'Search' ) . '</label>';
$form .= '<input type="submit" class="adminbar-button" value="' . __( 'Search' ) . '" />';
$form .= '</form>';
$wp_admin_bar->add_node(
array(
'parent' => 'top-secondary',
'id' => 'search',
'title' => $form,
'meta' => array(
'class' => 'admin-bar-search',
'tabindex' => -1,
),
)
);
}
```
| Uses | Description |
| --- | --- |
| [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-includes/l10n.php | Retrieves the translation of $text. |
| [esc\_url()](esc_url) wp-includes/formatting.php | Checks and cleans a URL. |
| [is\_admin()](is_admin) wp-includes/load.php | Determines whether the current request is for an administrative interface page. |
| [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.3.0](https://developer.wordpress.org/reference/since/3.3.0/) | Introduced. |
wordpress rest_validate_object_value_from_schema( mixed $value, array $args, string $param ): true|WP_Error rest\_validate\_object\_value\_from\_schema( mixed $value, array $args, string $param ): true|WP\_Error
=======================================================================================================
Validates an object 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_object_value_from_schema( $value, $args, $param ) {
if ( ! rest_is_object( $value ) ) {
return new WP_Error(
'rest_invalid_type',
/* translators: 1: Parameter, 2: Type name. */
sprintf( __( '%1$s is not of type %2$s.' ), $param, 'object' ),
array( 'param' => $param )
);
}
$value = rest_sanitize_object( $value );
if ( isset( $args['required'] ) && is_array( $args['required'] ) ) { // schema version 4
foreach ( $args['required'] as $name ) {
if ( ! array_key_exists( $name, $value ) ) {
return new WP_Error(
'rest_property_required',
/* translators: 1: Property of an object, 2: Parameter. */
sprintf( __( '%1$s is a required property of %2$s.' ), $name, $param )
);
}
}
} elseif ( isset( $args['properties'] ) ) { // schema version 3
foreach ( $args['properties'] as $name => $property ) {
if ( isset( $property['required'] ) && true === $property['required'] && ! array_key_exists( $name, $value ) ) {
return new WP_Error(
'rest_property_required',
/* translators: 1: Property of an object, 2: Parameter. */
sprintf( __( '%1$s is a required property of %2$s.' ), $name, $param )
);
}
}
}
foreach ( $value as $property => $v ) {
if ( isset( $args['properties'][ $property ] ) ) {
$is_valid = rest_validate_value_from_schema( $v, $args['properties'][ $property ], $param . '[' . $property . ']' );
if ( is_wp_error( $is_valid ) ) {
return $is_valid;
}
continue;
}
$pattern_property_schema = rest_find_matching_pattern_property_schema( $property, $args );
if ( null !== $pattern_property_schema ) {
$is_valid = rest_validate_value_from_schema( $v, $pattern_property_schema, $param . '[' . $property . ']' );
if ( is_wp_error( $is_valid ) ) {
return $is_valid;
}
continue;
}
if ( isset( $args['additionalProperties'] ) ) {
if ( false === $args['additionalProperties'] ) {
return new WP_Error(
'rest_additional_properties_forbidden',
/* translators: %s: Property of an object. */
sprintf( __( '%1$s is not a valid property of Object.' ), $property )
);
}
if ( is_array( $args['additionalProperties'] ) ) {
$is_valid = rest_validate_value_from_schema( $v, $args['additionalProperties'], $param . '[' . $property . ']' );
if ( is_wp_error( $is_valid ) ) {
return $is_valid;
}
}
}
}
if ( isset( $args['minProperties'] ) && count( $value ) < $args['minProperties'] ) {
return new WP_Error(
'rest_too_few_properties',
sprintf(
/* translators: 1: Parameter, 2: Number. */
_n(
'%1$s must contain at least %2$s property.',
'%1$s must contain at least %2$s properties.',
$args['minProperties']
),
$param,
number_format_i18n( $args['minProperties'] )
)
);
}
if ( isset( $args['maxProperties'] ) && count( $value ) > $args['maxProperties'] ) {
return new WP_Error(
'rest_too_many_properties',
sprintf(
/* translators: 1: Parameter, 2: Number. */
_n(
'%1$s must contain at most %2$s property.',
'%1$s must contain at most %2$s properties.',
$args['maxProperties']
),
$param,
number_format_i18n( $args['maxProperties'] )
)
);
}
return true;
}
```
| Uses | Description |
| --- | --- |
| [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. |
| [rest\_is\_object()](rest_is_object) wp-includes/rest-api.php | Determines if a given value is object-like. |
| [rest\_sanitize\_object()](rest_sanitize_object) wp-includes/rest-api.php | Converts an object-like value to an object. |
| [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 add_object_page( string $page_title, string $menu_title, string $capability, string $menu_slug, callable $callback = '', string $icon_url = '' ): string add\_object\_page( string $page\_title, string $menu\_title, string $capability, string $menu\_slug, callable $callback = '', string $icon\_url = '' ): string
==============================================================================================================================================================
This function has been deprecated. Use [add\_menu\_page()](add_menu_page) instead.
Add a top-level menu page in the ‘objects’ section.
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.
* [add\_menu\_page()](add_menu_page)
`$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: `''`
`$icon_url` string Optional The URL to the icon to be used for this menu. Default: `''`
string The resulting page's hook\_suffix.
Technically, the *function* parameter is optional, but if it is not supplied, then WordPress will assume that including the PHP file will generate the administration screen, without calling a function. Most plugin authors choose to put the page-generating code in a function within their main plugin file. If the *function* parameter is omitted, the *menu\_slug* should be the PHP file that handles the display of the menu page content.
In the event that the *function* parameter is specified, it is possible to use any string for the *file* parameter. This allows usage of pages such as *?page=my\_super\_plugin\_page* instead of *?page=my-super-plugin/admin-options.php*.Capability checking based on *capability* should happen within the PHP file as well – the *capability* parameter defines both the visibility of the menu link and the visibility of the menu page contents.
File: `wp-admin/includes/deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/deprecated.php/)
```
function add_object_page( $page_title, $menu_title, $capability, $menu_slug, $callback = '', $icon_url = '') {
_deprecated_function( __FUNCTION__, '4.5.0', 'add_menu_page()' );
global $_wp_last_object_menu;
$_wp_last_object_menu++;
return add_menu_page($page_title, $menu_title, $capability, $menu_slug, $callback, $icon_url, $_wp_last_object_menu);
}
```
| Uses | Description |
| --- | --- |
| [add\_menu\_page()](add_menu_page) wp-admin/includes/plugin.php | Adds a top-level menu page. |
| [\_deprecated\_function()](_deprecated_function) wp-includes/functions.php | Marks a function as deprecated and inform when it has been used. |
| Version | Description |
| --- | --- |
| [4.5.0](https://developer.wordpress.org/reference/since/4.5.0/) | Use [add\_menu\_page()](add_menu_page) |
| [2.7.0](https://developer.wordpress.org/reference/since/2.7.0/) | Introduced. |
wordpress _wp_specialchars( string $string, int|string $quote_style = ENT_NOQUOTES, false|string $charset = false, bool $double_encode = false ): string \_wp\_specialchars( string $string, int|string $quote\_style = ENT\_NOQUOTES, false|string $charset = false, bool $double\_encode = 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.
Converts a number of special characters into their HTML entities.
Specifically deals with: `&`, `<`, `>`, `"`, and `'`.
`$quote_style` can be set to ENT\_COMPAT to encode `"` to `"`, or ENT\_QUOTES to do both. Default is ENT\_NOQUOTES where no quotes are encoded.
`$string` string Required The text which is to be encoded. `$quote_style` int|string 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.
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`
`$charset` false|string Optional The character encoding of the string. Default: `false`
`$double_encode` bool Optional Whether to encode existing HTML entities. Default: `false`
string The encoded text with HTML entities.
File: `wp-includes/formatting.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/formatting.php/)
```
function _wp_specialchars( $string, $quote_style = ENT_NOQUOTES, $charset = false, $double_encode = false ) {
$string = (string) $string;
if ( 0 === strlen( $string ) ) {
return '';
}
// Don't bother if there are no specialchars - saves some processing.
if ( ! preg_match( '/[&<>"\']/', $string ) ) {
return $string;
}
// Account for the previous behaviour of the function when the $quote_style is not an accepted value.
if ( empty( $quote_style ) ) {
$quote_style = ENT_NOQUOTES;
} elseif ( ENT_XML1 === $quote_style ) {
$quote_style = ENT_QUOTES | ENT_XML1;
} elseif ( ! in_array( $quote_style, array( ENT_NOQUOTES, ENT_COMPAT, ENT_QUOTES, 'single', 'double' ), true ) ) {
$quote_style = ENT_QUOTES;
}
// Store the site charset as a static to avoid multiple calls to wp_load_alloptions().
if ( ! $charset ) {
static $_charset = null;
if ( ! isset( $_charset ) ) {
$alloptions = wp_load_alloptions();
$_charset = isset( $alloptions['blog_charset'] ) ? $alloptions['blog_charset'] : '';
}
$charset = $_charset;
}
if ( in_array( $charset, array( 'utf8', 'utf-8', 'UTF8' ), true ) ) {
$charset = 'UTF-8';
}
$_quote_style = $quote_style;
if ( 'double' === $quote_style ) {
$quote_style = ENT_COMPAT;
$_quote_style = ENT_COMPAT;
} elseif ( 'single' === $quote_style ) {
$quote_style = ENT_NOQUOTES;
}
if ( ! $double_encode ) {
// Guarantee every &entity; is valid, convert &garbage; into &garbage;
// This is required for PHP < 5.4.0 because ENT_HTML401 flag is unavailable.
$string = wp_kses_normalize_entities( $string, ( $quote_style & ENT_XML1 ) ? 'xml' : 'html' );
}
$string = htmlspecialchars( $string, $quote_style, $charset, $double_encode );
// Back-compat.
if ( 'single' === $_quote_style ) {
$string = str_replace( "'", ''', $string );
}
return $string;
}
```
| Uses | Description |
| --- | --- |
| [wp\_kses\_normalize\_entities()](wp_kses_normalize_entities) wp-includes/kses.php | Converts and fixes HTML entities. |
| [wp\_load\_alloptions()](wp_load_alloptions) wp-includes/option.php | Loads and caches all autoloaded options, if available or all options. |
| Used By | Description |
| --- | --- |
| [esc\_xml()](esc_xml) wp-includes/formatting.php | Escaping for XML blocks. |
| [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. |
| [wp\_specialchars()](wp_specialchars) wp-includes/deprecated.php | Legacy escaping for HTML blocks. |
| Version | Description |
| --- | --- |
| [5.5.0](https://developer.wordpress.org/reference/since/5.5.0/) | `$quote_style` also accepts `ENT_XML1`. |
| [1.2.2](https://developer.wordpress.org/reference/since/1.2.2/) | Introduced. |
wordpress set_post_thumbnail( int|WP_Post $post, int $thumbnail_id ): int|bool set\_post\_thumbnail( int|WP\_Post $post, int $thumbnail\_id ): int|bool
========================================================================
Sets the post thumbnail (featured image) for the given post.
`$post` int|[WP\_Post](../classes/wp_post) Required Post ID or post object where thumbnail should be attached. `$thumbnail_id` int Required Thumbnail to attach. int|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 set_post_thumbnail( $post, $thumbnail_id ) {
$post = get_post( $post );
$thumbnail_id = absint( $thumbnail_id );
if ( $post && $thumbnail_id && get_post( $thumbnail_id ) ) {
if ( wp_get_attachment_image( $thumbnail_id, 'thumbnail' ) ) {
return update_post_meta( $post->ID, '_thumbnail_id', $thumbnail_id );
} else {
return delete_post_meta( $post->ID, '_thumbnail_id' );
}
}
return false;
}
```
| Uses | Description |
| --- | --- |
| [update\_post\_meta()](update_post_meta) wp-includes/post.php | Updates a post meta field based on the given post ID. |
| [wp\_get\_attachment\_image()](wp_get_attachment_image) wp-includes/media.php | Gets an HTML img element representing an image attachment. |
| [delete\_post\_meta()](delete_post_meta) wp-includes/post.php | Deletes a post meta field for the given post ID. |
| [absint()](absint) wp-includes/functions.php | Converts a value to non-negative integer. |
| [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::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\_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\_ajax\_set\_post\_thumbnail()](wp_ajax_set_post_thumbnail) wp-admin/includes/ajax-actions.php | Ajax handler for setting the featured image. |
| [wp\_insert\_post()](wp_insert_post) wp-includes/post.php | Inserts or update a post. |
| [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 is_serialized( string $data, bool $strict = true ): bool is\_serialized( string $data, bool $strict = true ): bool
=========================================================
Checks value to find if it was serialized.
If $data is not a string, then returned value will always be false.
Serialized data is always a string.
`$data` string Required Value to check to see if was serialized. `$strict` bool Optional Whether to be strict about the end of the string. Default: `true`
bool False if not serialized and true if it was.
##### Usage:
```
is_serialized( $data );
```
##### Notes:
Data might need to be *serialized* to allow it to be successfully stored and retrieved from a database in a form that PHP can understand.
File: `wp-includes/functions.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/functions.php/)
```
function is_serialized( $data, $strict = true ) {
// If it isn't a string, it isn't serialized.
if ( ! is_string( $data ) ) {
return false;
}
$data = trim( $data );
if ( 'N;' === $data ) {
return true;
}
if ( strlen( $data ) < 4 ) {
return false;
}
if ( ':' !== $data[1] ) {
return false;
}
if ( $strict ) {
$lastc = substr( $data, -1 );
if ( ';' !== $lastc && '}' !== $lastc ) {
return false;
}
} else {
$semicolon = strpos( $data, ';' );
$brace = strpos( $data, '}' );
// Either ; or } must exist.
if ( false === $semicolon && false === $brace ) {
return false;
}
// But neither must be in the first X characters.
if ( false !== $semicolon && $semicolon < 3 ) {
return false;
}
if ( false !== $brace && $brace < 4 ) {
return false;
}
}
$token = $data[0];
switch ( $token ) {
case 's':
if ( $strict ) {
if ( '"' !== substr( $data, -2, 1 ) ) {
return false;
}
} elseif ( false === strpos( $data, '"' ) ) {
return false;
}
// Or else fall through.
case 'a':
case 'O':
case 'E':
return (bool) preg_match( "/^{$token}:[0-9]+:/s", $data );
case 'b':
case 'i':
case 'd':
$end = $strict ? '$' : '';
return (bool) preg_match( "/^{$token}:[0-9.E+-]+;$end/", $data );
}
return false;
}
```
| Used By | Description |
| --- | --- |
| [wp\_targeted\_link\_rel()](wp_targeted_link_rel) wp-includes/formatting.php | Adds `rel="noopener"` to all HTML A elements that have a target. |
| [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. |
| [\_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. |
| [maybe\_serialize()](maybe_serialize) wp-includes/functions.php | Serializes data, if needed. |
| [maybe\_unserialize()](maybe_unserialize) wp-includes/functions.php | Unserializes data only if it was serialized. |
| Version | Description |
| --- | --- |
| [6.1.0](https://developer.wordpress.org/reference/since/6.1.0/) | Added Enum support. |
| [2.0.5](https://developer.wordpress.org/reference/since/2.0.5/) | Introduced. |
| programming_docs |
wordpress sanitize_bookmark( stdClass|array $bookmark, string $context = 'display' ): stdClass|array sanitize\_bookmark( stdClass|array $bookmark, string $context = 'display' ): stdClass|array
===========================================================================================
Sanitizes all bookmark fields.
`$bookmark` stdClass|array Required Bookmark row. `$context` string Optional How to filter the fields. Default `'display'`. Default: `'display'`
stdClass|array Same type as $bookmark but with fields sanitized.
File: `wp-includes/bookmark.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/bookmark.php/)
```
function sanitize_bookmark( $bookmark, $context = 'display' ) {
$fields = array(
'link_id',
'link_url',
'link_name',
'link_image',
'link_target',
'link_category',
'link_description',
'link_visible',
'link_owner',
'link_rating',
'link_updated',
'link_rel',
'link_notes',
'link_rss',
);
if ( is_object( $bookmark ) ) {
$do_object = true;
$link_id = $bookmark->link_id;
} else {
$do_object = false;
$link_id = $bookmark['link_id'];
}
foreach ( $fields as $field ) {
if ( $do_object ) {
if ( isset( $bookmark->$field ) ) {
$bookmark->$field = sanitize_bookmark_field( $field, $bookmark->$field, $link_id, $context );
}
} else {
if ( isset( $bookmark[ $field ] ) ) {
$bookmark[ $field ] = sanitize_bookmark_field( $field, $bookmark[ $field ], $link_id, $context );
}
}
}
return $bookmark;
}
```
| Uses | Description |
| --- | --- |
| [sanitize\_bookmark\_field()](sanitize_bookmark_field) wp-includes/bookmark.php | Sanitizes a bookmark field. |
| Used By | Description |
| --- | --- |
| [WP\_Links\_List\_Table::display\_rows()](../classes/wp_links_list_table/display_rows) wp-admin/includes/class-wp-links-list-table.php | |
| [wp\_insert\_link()](wp_insert_link) wp-admin/includes/bookmark.php | Inserts a link into the database, or updates an existing link. |
| [get\_bookmark()](get_bookmark) wp-includes/bookmark.php | Retrieves bookmark data. |
| Version | Description |
| --- | --- |
| [2.3.0](https://developer.wordpress.org/reference/since/2.3.0/) | Introduced. |
wordpress get_template_directory(): string get\_template\_directory(): string
==================================
Retrieves template directory path for the active theme.
string Path to active theme's template directory.
```
echo get_template_directory();
```
Returns an absolute server path (eg: /home/user/public\_html/wp-content/themes/my\_theme), not a URI.
In the case a child theme is being used, the absolute path to the parent theme directory will be returned. Use [[get\_stylesheet\_directory()](get_stylesheet_directory)](get_stylesheet_directory "Function Reference/get stylesheet directory") to get the absolute path to the child theme directory.
To retrieve the URI of the stylesheet directory use [get\_stylesheet\_directory\_uri()](get_stylesheet_directory_uri) instead.
* Uses: [[get\_theme\_root()](get_theme_root)](get_theme_root "Function Reference/get theme root") to retrieve the absolute path to the themes directory, [[get\_template()](get_template)](get_template "Function Reference/get template") to retrieve the directory name of the current theme.
* Does not output a trailing slash
File: `wp-includes/theme.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/theme.php/)
```
function get_template_directory() {
$template = get_template();
$theme_root = get_theme_root( $template );
$template_dir = "$theme_root/$template";
/**
* Filters the active theme directory path.
*
* @since 1.5.0
*
* @param string $template_dir The path of the active theme directory.
* @param string $template Directory name of the active theme.
* @param string $theme_root Absolute path to the themes directory.
*/
return apply_filters( 'template_directory', $template_dir, $template, $theme_root );
}
```
[apply\_filters( 'template\_directory', string $template\_dir, string $template, string $theme\_root )](../hooks/template_directory)
Filters the active theme directory path.
| Uses | Description |
| --- | --- |
| [get\_theme\_root()](get_theme_root) wp-includes/theme.php | Retrieves path to themes directory. |
| [get\_template()](get_template) wp-includes/theme.php | Retrieves name of 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\_block\_template\_file()](_get_block_template_file) wp-includes/block-template-utils.php | Retrieves the template file from the theme for a given slug. |
| [\_get\_block\_templates\_files()](_get_block_templates_files) wp-includes/block-template-utils.php | Retrieves the template files from the theme. |
| [WP\_Theme\_JSON\_Resolver::get\_file\_path\_from\_theme()](../classes/wp_theme_json_resolver/get_file_path_from_theme) wp-includes/class-wp-theme-json-resolver.php | Builds the path to the given file and checks that it is readable. |
| [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. |
| [resolve\_block\_template()](resolve_block_template) wp-includes/block-template.php | Returns the correct ‘wp\_template’ to render for the request template type. |
| [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\_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. |
| [get\_parent\_theme\_file\_path()](get_parent_theme_file_path) wp-includes/link-template.php | Retrieves the path of a file in the parent theme. |
| [get\_theme\_file\_path()](get_theme_file_path) wp-includes/link-template.php | Retrieves the path of a file in the theme. |
| [\_load\_textdomain\_just\_in\_time()](_load_textdomain_just_in_time) wp-includes/l10n.php | Loads plugin and theme text domains just-in-time. |
| [get\_editor\_stylesheets()](get_editor_stylesheets) wp-includes/theme.php | Retrieves any registered editor stylesheet URLs. |
| [validate\_current\_theme()](validate_current_theme) wp-includes/theme.php | Checks that the active theme has the required files. |
| [load\_theme\_textdomain()](load_theme_textdomain) wp-includes/l10n.php | Loads the theme’s translated strings. |
| [get\_attachment\_icon\_src()](get_attachment_icon_src) wp-includes/deprecated.php | Retrieve icon URL and Path. |
| [wp\_templating\_constants()](wp_templating_constants) wp-includes/default-constants.php | Defines templating-related WordPress constants. |
| Version | Description |
| --- | --- |
| [1.5.0](https://developer.wordpress.org/reference/since/1.5.0/) | Introduced. |
wordpress wp_get_list_item_separator(): string wp\_get\_list\_item\_separator(): string
========================================
Retrieves the list item separator based on the locale.
string Locale-specific list item separator.
File: `wp-includes/l10n.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/l10n.php/)
```
function wp_get_list_item_separator() {
global $wp_locale;
return $wp_locale->get_list_item_separator();
}
```
| Uses | Description |
| --- | --- |
| [WP\_Locale::get\_list\_item\_separator()](../classes/wp_locale/get_list_item_separator) wp-includes/class-wp-locale.php | Retrieves the localized list item separator. |
| Used By | Description |
| --- | --- |
| [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\_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\_Theme::markup\_header()](../classes/wp_theme/markup_header) wp-includes/class-wp-theme.php | Marks up a theme header. |
| Version | Description |
| --- | --- |
| [6.0.0](https://developer.wordpress.org/reference/since/6.0.0/) | Introduced. |
wordpress wp_strip_all_tags( string $string, bool $remove_breaks = false ): string wp\_strip\_all\_tags( string $string, bool $remove\_breaks = false ): string
============================================================================
Properly strips all HTML tags including script and style
This differs from strip\_tags() because it removes the contents of the `<script>` and `<style>` tags. E.g. `strip_tags( '<script>something</script>' )` will return ‘something’. wp\_strip\_all\_tags will return ”
`$string` string Required String containing HTML tags `$remove_breaks` bool Optional Whether to remove left over line breaks and white space chars Default: `false`
string The processed string.
[wp\_strip\_all\_tags()](wp_strip_all_tags) is added to the following filters by default (see `[wp-includes/default-filters.php](https://core.trac.wordpress.org/browser/tags/5.3/src/wp-includes/default-filters.php#L0)`):
* pre\_comment\_author\_url
* pre\_user\_url
* pre\_link\_url
* pre\_link\_image
* pre\_link\_rss
* pre\_post\_guid
It is also applied to these filters by default when on the administration side of the site:
* user\_url
* link\_url
* link\_image
* link\_rss
* comment\_url
* post\_guid
File: `wp-includes/formatting.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/formatting.php/)
```
function wp_strip_all_tags( $string, $remove_breaks = false ) {
$string = preg_replace( '@<(script|style)[^>]*?>.*?</\\1>@si', '', $string );
$string = strip_tags( $string );
if ( $remove_breaks ) {
$string = preg_replace( '/[\r\n\t ]+/', ' ', $string );
}
return trim( $string );
}
```
| Used By | Description |
| --- | --- |
| [WP\_Style\_Engine\_CSS\_Declarations::filter\_declaration()](../classes/wp_style_engine_css_declarations/filter_declaration) wp-includes/style-engine/class-wp-style-engine-css-declarations.php | Filters a CSS property + value pair. |
| [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\_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\_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\_check\_comment\_disallowed\_list()](wp_check_comment_disallowed_list) wp-includes/comment.php | Checks if a comment contains disallowed characters or words. |
| [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::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. |
| [\_sanitize\_text\_fields()](_sanitize_text_fields) wp-includes/formatting.php | Internal helper function to sanitize a string from user input or from the database. |
| [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\_List\_Table::single\_row\_columns()](../classes/wp_list_table/single_row_columns) wp-admin/includes/class-wp-list-table.php | Generates the columns for a single row of the table. |
| [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\_form\_handler()](media_upload_form_handler) wp-admin/includes/media.php | Handles form submissions for the legacy media uploader. |
| [edit\_post()](edit_post) wp-admin/includes/post.php | Updates an existing post with values provided in `$_POST`. |
| [wp\_ajax\_save\_attachment()](wp_ajax_save_attachment) wp-admin/includes/ajax-actions.php | Ajax handler for updating attachment attributes. |
| [wp\_html\_excerpt()](wp_html_excerpt) wp-includes/formatting.php | Safely extracts not more than the first $count characters from HTML string. |
| [wp\_trim\_words()](wp_trim_words) wp-includes/formatting.php | Trims text to a certain number of words. |
| [sanitize\_user()](sanitize_user) wp-includes/formatting.php | Sanitizes a username, stripping out unsafe characters. |
| [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. |
| Version | Description |
| --- | --- |
| [2.9.0](https://developer.wordpress.org/reference/since/2.9.0/) | Introduced. |
wordpress remove_theme_mods() remove\_theme\_mods()
=====================
Removes theme modifications option for the active theme.
File: `wp-includes/theme.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/theme.php/)
```
function remove_theme_mods() {
delete_option( 'theme_mods_' . get_option( 'stylesheet' ) );
// Old style.
$theme_name = get_option( 'current_theme' );
if ( false === $theme_name ) {
$theme_name = wp_get_theme()->get( 'Name' );
}
delete_option( 'mods_' . $theme_name );
}
```
| Uses | Description |
| --- | --- |
| [delete\_option()](delete_option) wp-includes/option.php | Removes option by name. Prevents removal of protected WordPress options. |
| [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. |
| [get\_option()](get_option) wp-includes/option.php | Retrieves an option value based on an option name. |
| Used By | Description |
| --- | --- |
| [remove\_theme\_mod()](remove_theme_mod) wp-includes/theme.php | Removes theme modification name from active theme list. |
| Version | Description |
| --- | --- |
| [2.1.0](https://developer.wordpress.org/reference/since/2.1.0/) | Introduced. |
wordpress _relocate_children( int $old_ID, int $new_ID ) \_relocate\_children( int $old\_ID, int $new\_ID )
==================================================
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.
This was once used to move child posts to a new parent.
`$old_ID` int Required `$new_ID` int Required File: `wp-admin/includes/deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/deprecated.php/)
```
function _relocate_children( $old_ID, $new_ID ) {
_deprecated_function( __FUNCTION__, '3.9.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.9.0](https://developer.wordpress.org/reference/since/3.9.0/) | This function has been deprecated. |
| [2.3.0](https://developer.wordpress.org/reference/since/2.3.0/) | Introduced. |
wordpress remove_image_size( string $name ): bool remove\_image\_size( string $name ): bool
=========================================
Removes a new image size.
`$name` string Required The image size to remove. bool True if the image size was successfully removed, false on failure.
* Useful when a plugin has registered an image size and you want to use the same image name in your theme but with a different size.
* Cannot be used on [reserved image size names](add_image_size#reserved-image-size-names).
File: `wp-includes/media.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/media.php/)
```
function remove_image_size( $name ) {
global $_wp_additional_image_sizes;
if ( isset( $_wp_additional_image_sizes[ $name ] ) ) {
unset( $_wp_additional_image_sizes[ $name ] );
return true;
}
return false;
}
```
| Version | Description |
| --- | --- |
| [3.9.0](https://developer.wordpress.org/reference/since/3.9.0/) | Introduced. |
wordpress wxr_cat_name( WP_Term $category ) wxr\_cat\_name( WP\_Term $category )
====================================
Outputs a cat\_name XML tag from a given category object.
`$category` [WP\_Term](../classes/wp_term) Required Category Object. File: `wp-admin/includes/export.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/export.php/)
```
function wxr_cat_name( $category ) {
if ( empty( $category->name ) ) {
return;
}
echo '<wp:cat_name>' . wxr_cdata( $category->name ) . "</wp:cat_name>\n";
}
```
| Uses | Description |
| --- | --- |
| [wxr\_cdata()](wxr_cdata) wp-admin/includes/export.php | Wraps given string in XML CDATA tag. |
| Used By | Description |
| --- | --- |
| [export\_wp()](export_wp) wp-admin/includes/export.php | Generates the WXR export file for download. |
| Version | Description |
| --- | --- |
| [2.1.0](https://developer.wordpress.org/reference/since/2.1.0/) | Introduced. |
wordpress wp_skip_paused_themes( string[] $themes ): string[] wp\_skip\_paused\_themes( string[] $themes ): string[]
======================================================
Filters a given list of themes, removing any paused themes from it.
`$themes` string[] Required Array of absolute theme directory paths. string[] Filtered array of absolute paths to themes, without any paused themes.
File: `wp-includes/load.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/load.php/)
```
function wp_skip_paused_themes( array $themes ) {
$paused_themes = wp_paused_themes()->get_all();
if ( empty( $paused_themes ) ) {
return $themes;
}
foreach ( $themes as $index => $theme ) {
$theme = basename( $theme );
if ( array_key_exists( $theme, $paused_themes ) ) {
unset( $themes[ $index ] );
// Store list of paused themes for displaying an admin notice.
$GLOBALS['_paused_themes'][ $theme ] = $paused_themes[ $theme ];
}
}
return $themes;
}
```
| Uses | Description |
| --- | --- |
| [wp\_paused\_themes()](wp_paused_themes) wp-includes/error-protection.php | Get the instance for storing paused extensions. |
| Used By | Description |
| --- | --- |
| [wp\_get\_active\_and\_valid\_themes()](wp_get_active_and_valid_themes) wp-includes/load.php | Retrieves an array of active and valid themes. |
| Version | Description |
| --- | --- |
| [5.2.0](https://developer.wordpress.org/reference/since/5.2.0/) | Introduced. |
| programming_docs |
wordpress uninstall_plugin( string $plugin ): true|void uninstall\_plugin( string $plugin ): true|void
==============================================
Uninstalls a single plugin.
Calls the uninstall hook, if it is available.
`$plugin` string Required Path to the plugin file relative to the plugins directory. true|void True if a plugin's uninstall.php file has been found and included.
Void otherwise.
File: `wp-admin/includes/plugin.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/plugin.php/)
```
function uninstall_plugin( $plugin ) {
$file = plugin_basename( $plugin );
$uninstallable_plugins = (array) get_option( 'uninstall_plugins' );
/**
* Fires in uninstall_plugin() immediately before the plugin is uninstalled.
*
* @since 4.5.0
*
* @param string $plugin Path to the plugin file relative to the plugins directory.
* @param array $uninstallable_plugins Uninstallable plugins.
*/
do_action( 'pre_uninstall_plugin', $plugin, $uninstallable_plugins );
if ( file_exists( WP_PLUGIN_DIR . '/' . dirname( $file ) . '/uninstall.php' ) ) {
if ( isset( $uninstallable_plugins[ $file ] ) ) {
unset( $uninstallable_plugins[ $file ] );
update_option( 'uninstall_plugins', $uninstallable_plugins );
}
unset( $uninstallable_plugins );
define( 'WP_UNINSTALL_PLUGIN', $file );
wp_register_plugin_realpath( WP_PLUGIN_DIR . '/' . $file );
include_once WP_PLUGIN_DIR . '/' . dirname( $file ) . '/uninstall.php';
return true;
}
if ( isset( $uninstallable_plugins[ $file ] ) ) {
$callable = $uninstallable_plugins[ $file ];
unset( $uninstallable_plugins[ $file ] );
update_option( 'uninstall_plugins', $uninstallable_plugins );
unset( $uninstallable_plugins );
wp_register_plugin_realpath( WP_PLUGIN_DIR . '/' . $file );
include_once WP_PLUGIN_DIR . '/' . $file;
add_action( "uninstall_{$file}", $callable );
/**
* Fires in uninstall_plugin() once the plugin has been uninstalled.
*
* The action concatenates the 'uninstall_' prefix with the basename of the
* plugin passed to uninstall_plugin() to create a dynamically-named action.
*
* @since 2.7.0
*/
do_action( "uninstall_{$file}" );
}
}
```
[do\_action( 'pre\_uninstall\_plugin', string $plugin, array $uninstallable\_plugins )](../hooks/pre_uninstall_plugin)
Fires in [uninstall\_plugin()](uninstall_plugin) immediately before the plugin is uninstalled.
[do\_action( "uninstall\_{$file}" )](../hooks/uninstall_file)
Fires in [uninstall\_plugin()](uninstall_plugin) once the plugin has been uninstalled.
| Uses | Description |
| --- | --- |
| [plugin\_basename()](plugin_basename) wp-includes/plugin.php | Gets the basename of a plugin. |
| [wp\_register\_plugin\_realpath()](wp_register_plugin_realpath) wp-includes/plugin.php | Register a plugin’s real path. |
| [do\_action()](do_action) wp-includes/plugin.php | Calls the callback functions that have been added to an action hook. |
| [add\_action()](add_action) wp-includes/plugin.php | Adds a callback function 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 |
| --- | --- |
| [delete\_plugins()](delete_plugins) wp-admin/includes/plugin.php | Removes directory and files of a plugin for a list of plugins. |
| Version | Description |
| --- | --- |
| [2.7.0](https://developer.wordpress.org/reference/since/2.7.0/) | Introduced. |
wordpress next_posts_link( string $label = null, int $max_page ) next\_posts\_link( string $label = null, int $max\_page )
=========================================================
Displays the next posts page link.
`$label` string Optional Content for link text. Default: `null`
`$max_page` int Optional Max pages. Default 0. This function prints a link to the next set of posts within the current query.
If you need the values for use in PHP, use [get\_next\_posts\_link()](get_next_posts_link) .
Because post queries are usually sorted in reverse chronological order, [next\_posts\_link()](next_posts_link) usually points to older entries (toward the end of the set) and [previous\_posts\_link()](previous_posts_link) usually points to newer entries (toward the beginning of the set).
Parameter $max\_pages is the limit the number of pages on which the link is displayed. The default value “0” means “no limit”.
This function will not work (fail silently) if mysql.trace\_mode is enabled in your php.ini. If you can’t edit that file, try adding ini\_set( 'mysql.trace\_mode', 0 ); to your theme’s functions.php.
See also: [previous\_posts\_link()](previous_posts_link) and [next\_post\_link()](next_post_link) .
File: `wp-includes/link-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/link-template.php/)
```
function next_posts_link( $label = null, $max_page = 0 ) {
echo get_next_posts_link( $label, $max_page );
}
```
| Uses | Description |
| --- | --- |
| [get\_next\_posts\_link()](get_next_posts_link) wp-includes/link-template.php | Retrieves the next posts page link. |
| Version | Description |
| --- | --- |
| [0.71](https://developer.wordpress.org/reference/since/0.71/) | Introduced. |
wordpress wp_admin_bar_comments_menu( WP_Admin_Bar $wp_admin_bar ) wp\_admin\_bar\_comments\_menu( WP\_Admin\_Bar $wp\_admin\_bar )
================================================================
Adds edit comments link with awaiting moderation count bubble.
`$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_comments_menu( $wp_admin_bar ) {
if ( ! current_user_can( 'edit_posts' ) ) {
return;
}
$awaiting_mod = wp_count_comments();
$awaiting_mod = $awaiting_mod->moderated;
$awaiting_text = sprintf(
/* translators: %s: Number of comments. */
_n( '%s Comment in moderation', '%s Comments in moderation', $awaiting_mod ),
number_format_i18n( $awaiting_mod )
);
$icon = '<span class="ab-icon" aria-hidden="true"></span>';
$title = '<span class="ab-label awaiting-mod pending-count count-' . $awaiting_mod . '" aria-hidden="true">' . number_format_i18n( $awaiting_mod ) . '</span>';
$title .= '<span class="screen-reader-text comments-in-moderation-text">' . $awaiting_text . '</span>';
$wp_admin_bar->add_node(
array(
'id' => 'comments',
'title' => $icon . $title,
'href' => admin_url( 'edit-comments.php' ),
)
);
}
```
| Uses | Description |
| --- | --- |
| [\_n()](_n) wp-includes/l10n.php | Translates and retrieves the singular or plural form based on the supplied number. |
| [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\_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. |
| [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. |
| Version | Description |
| --- | --- |
| [3.1.0](https://developer.wordpress.org/reference/since/3.1.0/) | Introduced. |
wordpress wp_cookie_constants() wp\_cookie\_constants()
=======================
Defines cookie-related WordPress constants.
Defines constants after multisite is loaded.
File: `wp-includes/default-constants.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/default-constants.php/)
```
function wp_cookie_constants() {
/**
* Used to guarantee unique hash cookies.
*
* @since 1.5.0
*/
if ( ! defined( 'COOKIEHASH' ) ) {
$siteurl = get_site_option( 'siteurl' );
if ( $siteurl ) {
define( 'COOKIEHASH', md5( $siteurl ) );
} else {
define( 'COOKIEHASH', '' );
}
}
/**
* @since 2.0.0
*/
if ( ! defined( 'USER_COOKIE' ) ) {
define( 'USER_COOKIE', 'wordpressuser_' . COOKIEHASH );
}
/**
* @since 2.0.0
*/
if ( ! defined( 'PASS_COOKIE' ) ) {
define( 'PASS_COOKIE', 'wordpresspass_' . COOKIEHASH );
}
/**
* @since 2.5.0
*/
if ( ! defined( 'AUTH_COOKIE' ) ) {
define( 'AUTH_COOKIE', 'wordpress_' . COOKIEHASH );
}
/**
* @since 2.6.0
*/
if ( ! defined( 'SECURE_AUTH_COOKIE' ) ) {
define( 'SECURE_AUTH_COOKIE', 'wordpress_sec_' . COOKIEHASH );
}
/**
* @since 2.6.0
*/
if ( ! defined( 'LOGGED_IN_COOKIE' ) ) {
define( 'LOGGED_IN_COOKIE', 'wordpress_logged_in_' . COOKIEHASH );
}
/**
* @since 2.3.0
*/
if ( ! defined( 'TEST_COOKIE' ) ) {
define( 'TEST_COOKIE', 'wordpress_test_cookie' );
}
/**
* @since 1.2.0
*/
if ( ! defined( 'COOKIEPATH' ) ) {
define( 'COOKIEPATH', preg_replace( '|https?://[^/]+|i', '', get_option( 'home' ) . '/' ) );
}
/**
* @since 1.5.0
*/
if ( ! defined( 'SITECOOKIEPATH' ) ) {
define( 'SITECOOKIEPATH', preg_replace( '|https?://[^/]+|i', '', get_option( 'siteurl' ) . '/' ) );
}
/**
* @since 2.6.0
*/
if ( ! defined( 'ADMIN_COOKIE_PATH' ) ) {
define( 'ADMIN_COOKIE_PATH', SITECOOKIEPATH . 'wp-admin' );
}
/**
* @since 2.6.0
*/
if ( ! defined( 'PLUGINS_COOKIE_PATH' ) ) {
define( 'PLUGINS_COOKIE_PATH', preg_replace( '|https?://[^/]+|i', '', WP_PLUGIN_URL ) );
}
/**
* @since 2.0.0
*/
if ( ! defined( 'COOKIE_DOMAIN' ) ) {
define( 'COOKIE_DOMAIN', false );
}
if ( ! defined( 'RECOVERY_MODE_COOKIE' ) ) {
/**
* @since 5.2.0
*/
define( 'RECOVERY_MODE_COOKIE', 'wordpress_rec_' . COOKIEHASH );
}
}
```
| Uses | Description |
| --- | --- |
| [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 |
| --- | --- |
| [3.0.0](https://developer.wordpress.org/reference/since/3.0.0/) | Introduced. |
wordpress get_others_pending( int $user_id ): array get\_others\_pending( int $user\_id ): array
============================================
This function has been deprecated. Use [get\_posts()](get_posts) instead.
Retrieve pending review posts from other users.
* [get\_posts()](get_posts)
`$user_id` int Required User ID. array List of posts with pending review post type from other users.
File: `wp-admin/includes/deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/deprecated.php/)
```
function get_others_pending($user_id) {
_deprecated_function( __FUNCTION__, '3.1.0' );
return get_others_unpublished_posts($user_id, 'pending');
}
```
| Uses | Description |
| --- | --- |
| [get\_others\_unpublished\_posts()](get_others_unpublished_posts) wp-admin/includes/deprecated.php | Retrieves editable posts from other users. |
| [\_deprecated\_function()](_deprecated_function) wp-includes/functions.php | Marks a function as deprecated and inform when it has been used. |
| Version | Description |
| --- | --- |
| [3.1.0](https://developer.wordpress.org/reference/since/3.1.0/) | Introduced. |
wordpress is_php_version_compatible( string $required ): bool is\_php\_version\_compatible( string $required ): bool
======================================================
Checks compatibility with the current PHP version.
`$required` string Required Minimum required PHP version. bool True if required version is compatible or empty, false if not.
File: `wp-includes/functions.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/functions.php/)
```
function is_php_version_compatible( $required ) {
return empty( $required ) || version_compare( PHP_VERSION, $required, '>=' );
}
```
| Used By | Description |
| --- | --- |
| [validate\_theme\_requirements()](validate_theme_requirements) wp-includes/theme.php | Validates the theme requirements for WordPress version and PHP version. |
| [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. |
| [validate\_plugin\_requirements()](validate_plugin_requirements) wp-admin/includes/plugin.php | Validates the plugin requirements for WordPress version and PHP version. |
| [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. |
| [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::check\_package()](../classes/theme_upgrader/check_package) wp-admin/includes/class-theme-upgrader.php | Checks that the package source contains a valid theme. |
| [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\_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 | |
| [wp\_ajax\_query\_themes()](wp_ajax_query_themes) wp-admin/includes/ajax-actions.php | Ajax handler for getting themes from [themes\_api()](themes_api) . |
| [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. |
| Version | Description |
| --- | --- |
| [5.2.0](https://developer.wordpress.org/reference/since/5.2.0/) | Introduced. |
wordpress get_post_galleries( int|WP_Post $post, bool $html = true ): array get\_post\_galleries( int|WP\_Post $post, bool $html = true ): array
====================================================================
Retrieves galleries from the passed post’s content.
`$post` int|[WP\_Post](../classes/wp_post) Required Post ID or object. `$html` bool Optional Whether to return HTML or data in the array. Default: `true`
array A list of arrays, each containing gallery data and srcs parsed from the expanded shortcode.
File: `wp-includes/media.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/media.php/)
```
function get_post_galleries( $post, $html = true ) {
$post = get_post( $post );
if ( ! $post ) {
return array();
}
if ( ! has_shortcode( $post->post_content, 'gallery' ) && ! has_block( 'gallery', $post->post_content ) ) {
return array();
}
$galleries = array();
if ( preg_match_all( '/' . get_shortcode_regex() . '/s', $post->post_content, $matches, PREG_SET_ORDER ) ) {
foreach ( $matches as $shortcode ) {
if ( 'gallery' === $shortcode[2] ) {
$srcs = array();
$shortcode_attrs = shortcode_parse_atts( $shortcode[3] );
if ( ! is_array( $shortcode_attrs ) ) {
$shortcode_attrs = array();
}
// Specify the post ID of the gallery we're viewing if the shortcode doesn't reference another post already.
if ( ! isset( $shortcode_attrs['id'] ) ) {
$shortcode[3] .= ' id="' . (int) $post->ID . '"';
}
$gallery = do_shortcode_tag( $shortcode );
if ( $html ) {
$galleries[] = $gallery;
} else {
preg_match_all( '#src=([\'"])(.+?)\1#is', $gallery, $src, PREG_SET_ORDER );
if ( ! empty( $src ) ) {
foreach ( $src as $s ) {
$srcs[] = $s[2];
}
}
$galleries[] = array_merge(
$shortcode_attrs,
array(
'src' => array_values( array_unique( $srcs ) ),
)
);
}
}
}
}
if ( has_block( 'gallery', $post->post_content ) ) {
$post_blocks = parse_blocks( $post->post_content );
while ( $block = array_shift( $post_blocks ) ) {
$has_inner_blocks = ! empty( $block['innerBlocks'] );
// Skip blocks with no blockName and no innerHTML.
if ( ! $block['blockName'] ) {
continue;
}
// Skip non-Gallery blocks.
if ( 'core/gallery' !== $block['blockName'] ) {
// Move inner blocks into the root array before skipping.
if ( $has_inner_blocks ) {
array_push( $post_blocks, ...$block['innerBlocks'] );
}
continue;
}
// New Gallery block format as HTML.
if ( $has_inner_blocks && $html ) {
$block_html = wp_list_pluck( $block['innerBlocks'], 'innerHTML' );
$galleries[] = '<figure>' . implode( ' ', $block_html ) . '</figure>';
continue;
}
$srcs = array();
// New Gallery block format as an array.
if ( $has_inner_blocks ) {
$attrs = wp_list_pluck( $block['innerBlocks'], 'attrs' );
$ids = wp_list_pluck( $attrs, 'id' );
foreach ( $ids as $id ) {
$url = wp_get_attachment_url( $id );
if ( is_string( $url ) && ! in_array( $url, $srcs, true ) ) {
$srcs[] = $url;
}
}
$galleries[] = array(
'ids' => implode( ',', $ids ),
'src' => $srcs,
);
continue;
}
// Old Gallery block format as HTML.
if ( $html ) {
$galleries[] = $block['innerHTML'];
continue;
}
// Old Gallery block format as an array.
$ids = ! empty( $block['attrs']['ids'] ) ? $block['attrs']['ids'] : array();
// If present, use the image IDs from the JSON blob as canonical.
if ( ! empty( $ids ) ) {
foreach ( $ids as $id ) {
$url = wp_get_attachment_url( $id );
if ( is_string( $url ) && ! in_array( $url, $srcs, true ) ) {
$srcs[] = $url;
}
}
$galleries[] = array(
'ids' => implode( ',', $ids ),
'src' => $srcs,
);
continue;
}
// Otherwise, extract srcs from the innerHTML.
preg_match_all( '#src=([\'"])(.+?)\1#is', $block['innerHTML'], $found_srcs, PREG_SET_ORDER );
if ( ! empty( $found_srcs[0] ) ) {
foreach ( $found_srcs as $src ) {
if ( isset( $src[2] ) && ! in_array( $src[2], $srcs, true ) ) {
$srcs[] = $src[2];
}
}
}
$galleries[] = array( 'src' => $srcs );
}
}
/**
* Filters the list of all found galleries in the given post.
*
* @since 3.6.0
*
* @param array $galleries Associative array of all found post galleries.
* @param WP_Post $post Post object.
*/
return apply_filters( 'get_post_galleries', $galleries, $post );
}
```
[apply\_filters( 'get\_post\_galleries', array $galleries, WP\_Post $post )](../hooks/get_post_galleries)
Filters the list of all found galleries in the given post.
| Uses | Description |
| --- | --- |
| [parse\_blocks()](parse_blocks) wp-includes/blocks.php | Parses blocks out of a content string. |
| [has\_block()](has_block) wp-includes/blocks.php | Determines whether a $post or a string contains a specific block type. |
| [wp\_list\_pluck()](wp_list_pluck) wp-includes/functions.php | Plucks a certain field out of each object or array in an array. |
| [has\_shortcode()](has_shortcode) wp-includes/shortcodes.php | Determines whether the passed content contains the specified shortcode. |
| [get\_shortcode\_regex()](get_shortcode_regex) wp-includes/shortcodes.php | Retrieves the shortcode regular expression for searching. |
| [shortcode\_parse\_atts()](shortcode_parse_atts) wp-includes/shortcodes.php | Retrieves all attributes from the shortcodes tag. |
| [do\_shortcode\_tag()](do_shortcode_tag) wp-includes/shortcodes.php | Regular Expression callable for [do\_shortcode()](do_shortcode) for calling shortcode hook. |
| [wp\_get\_attachment\_url()](wp_get_attachment_url) wp-includes/post.php | Retrieves the URL for an attachment. |
| [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\_post\_gallery()](get_post_gallery) wp-includes/media.php | Checks a specified post’s content for gallery and, if present, return the first |
| [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. |
| Version | Description |
| --- | --- |
| [3.6.0](https://developer.wordpress.org/reference/since/3.6.0/) | Introduced. |
| programming_docs |
wordpress send_confirmation_on_profile_email() send\_confirmation\_on\_profile\_email()
========================================
Sends a confirmation request email when a change of user email address is attempted.
File: `wp-includes/user.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/user.php/)
```
function send_confirmation_on_profile_email() {
global $errors;
$current_user = wp_get_current_user();
if ( ! is_object( $errors ) ) {
$errors = new WP_Error();
}
if ( $current_user->ID != $_POST['user_id'] ) {
return false;
}
if ( $current_user->user_email != $_POST['email'] ) {
if ( ! is_email( $_POST['email'] ) ) {
$errors->add(
'user_email',
__( '<strong>Error:</strong> The email address is not correct.' ),
array(
'form-field' => 'email',
)
);
return;
}
if ( email_exists( $_POST['email'] ) ) {
$errors->add(
'user_email',
__( '<strong>Error:</strong> The email address is already used.' ),
array(
'form-field' => 'email',
)
);
delete_user_meta( $current_user->ID, '_new_email' );
return;
}
$hash = md5( $_POST['email'] . time() . wp_rand() );
$new_user_email = array(
'hash' => $hash,
'newemail' => $_POST['email'],
);
update_user_meta( $current_user->ID, '_new_email', $new_user_email );
$sitename = wp_specialchars_decode( get_option( 'blogname' ), ENT_QUOTES );
/* translators: Do not translate USERNAME, ADMIN_URL, EMAIL, SITENAME, SITEURL: those are placeholders. */
$email_text = __(
'Howdy ###USERNAME###,
You recently requested to have the email address on your account changed.
If this is correct, please click on the following link to change it:
###ADMIN_URL###
You can safely ignore and delete this email if you do not want to
take this action.
This email has been sent to ###EMAIL###
Regards,
All at ###SITENAME###
###SITEURL###'
);
/**
* Filters the text of the email sent when a change of user email address is attempted.
*
* The following strings have a special meaning and will get replaced dynamically:
* - ###USERNAME### The current user's username.
* - ###ADMIN_URL### The link to click on to confirm the email change.
* - ###EMAIL### The new email.
* - ###SITENAME### The name of the site.
* - ###SITEURL### The URL to the site.
*
* @since MU (3.0.0)
* @since 4.9.0 This filter is no longer Multisite specific.
*
* @param string $email_text Text in the email.
* @param array $new_user_email {
* Data relating to the new user email address.
*
* @type string $hash The secure hash used in the confirmation link URL.
* @type string $newemail The proposed new email address.
* }
*/
$content = apply_filters( 'new_user_email_content', $email_text, $new_user_email );
$content = str_replace( '###USERNAME###', $current_user->user_login, $content );
$content = str_replace( '###ADMIN_URL###', esc_url( admin_url( 'profile.php?newuseremail=' . $hash ) ), $content );
$content = str_replace( '###EMAIL###', $_POST['email'], $content );
$content = str_replace( '###SITENAME###', $sitename, $content );
$content = str_replace( '###SITEURL###', home_url(), $content );
/* translators: New email address notification email subject. %s: Site title. */
wp_mail( $_POST['email'], sprintf( __( '[%s] Email Change Request' ), $sitename ), $content );
$_POST['email'] = $current_user->user_email;
}
}
```
[apply\_filters( 'new\_user\_email\_content', string $email\_text, array $new\_user\_email )](../hooks/new_user_email_content)
Filters the text of the email sent when a change of user email address is attempted.
| Uses | Description |
| --- | --- |
| [is\_email()](is_email) wp-includes/formatting.php | Verifies that an email is valid. |
| [wp\_specialchars\_decode()](wp_specialchars_decode) wp-includes/formatting.php | Converts a number of HTML entities into their special characters. |
| [wp\_rand()](wp_rand) wp-includes/pluggable.php | Generates a random non-negative number. |
| [wp\_get\_current\_user()](wp_get_current_user) wp-includes/pluggable.php | Retrieves the current user object. |
| [wp\_mail()](wp_mail) wp-includes/pluggable.php | Sends an email, similar to PHP’s mail function. |
| [email\_exists()](email_exists) wp-includes/user.php | Determines whether the given email exists. |
| [delete\_user\_meta()](delete_user_meta) wp-includes/user.php | Removes metadata matching criteria from a user. |
| [update\_user\_meta()](update_user_meta) wp-includes/user.php | Updates user meta field based on user ID. |
| [\_\_()](__) 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. |
| [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. |
| [WP\_Error::\_\_construct()](../classes/wp_error/__construct) wp-includes/class-wp-error.php | Initializes the error. |
| Version | Description |
| --- | --- |
| [4.9.0](https://developer.wordpress.org/reference/since/4.9.0/) | This function was moved from wp-admin/includes/ms.php so it's no longer Multisite specific. |
| [3.0.0](https://developer.wordpress.org/reference/since/3.0.0/) | Introduced. |
wordpress get_post_custom( int $post_id ): mixed get\_post\_custom( int $post\_id ): mixed
=========================================
Retrieves post meta fields, based on post ID.
The post meta fields are retrieved from the cache where possible, so the function is optimized to be called more than once.
`$post_id` int Optional Post ID. Default is the ID of the global `$post`. mixed An array of values.
False for an invalid `$post_id` (non-numeric, zero, or negative value).
An empty string if a valid but non-existing post ID is passed.
See also [get\_post\_custom\_keys()](get_post_custom_keys) and [get\_post\_custom\_values()](get_post_custom_values)
File: `wp-includes/post.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/post.php/)
```
function get_post_custom( $post_id = 0 ) {
$post_id = absint( $post_id );
if ( ! $post_id ) {
$post_id = get_the_ID();
}
return get_post_meta( $post_id );
}
```
| Uses | Description |
| --- | --- |
| [get\_the\_ID()](get_the_id) wp-includes/post-template.php | Retrieves the ID of the current item in the WordPress Loop. |
| [absint()](absint) wp-includes/functions.php | Converts a value to non-negative integer. |
| [get\_post\_meta()](get_post_meta) wp-includes/post.php | Retrieves a post meta field for the given post ID. |
| Used By | Description |
| --- | --- |
| [rss\_enclosure()](rss_enclosure) wp-includes/feed.php | Displays the rss enclosure for the current post. |
| [atom\_enclosure()](atom_enclosure) wp-includes/feed.php | Displays the atom enclosure for the current post. |
| [post\_custom()](post_custom) wp-includes/post-template.php | Retrieves post custom meta data field. |
| [get\_enclosed()](get_enclosed) wp-includes/post.php | Retrieves enclosures already enclosed for a post. |
| [get\_post\_custom\_keys()](get_post_custom_keys) wp-includes/post.php | Retrieves meta field names for a post. |
| [get\_post\_custom\_values()](get_post_custom_values) wp-includes/post.php | Retrieves values for a custom post field. |
| [wp\_xmlrpc\_server::mw\_getPost()](../classes/wp_xmlrpc_server/mw_getpost) wp-includes/class-wp-xmlrpc-server.php | Retrieve post. |
| Version | Description |
| --- | --- |
| [1.2.0](https://developer.wordpress.org/reference/since/1.2.0/) | Introduced. |
wordpress __return_false(): false \_\_return\_false(): false
==========================
Returns false.
Useful for returning false to filters easily.
* [\_\_return\_true()](__return_true)
false False.
File: `wp-includes/functions.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/functions.php/)
```
function __return_false() { // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.FunctionDoubleUnderscore,PHPCompatibility.FunctionNameRestrictions.ReservedFunctionNames.FunctionDoubleUnderscore
return false;
}
```
| Version | Description |
| --- | --- |
| [3.0.0](https://developer.wordpress.org/reference/since/3.0.0/) | Introduced. |
wordpress post_permalink( int|WP_Post $post ): string|false post\_permalink( int|WP\_Post $post ): string|false
===================================================
This function has been deprecated. Use [get\_permalink()](get_permalink) instead.
Retrieve permalink from post ID.
* [get\_permalink()](get_permalink)
`$post` int|[WP\_Post](../classes/wp_post) Optional Post ID or [WP\_Post](../classes/wp_post) object. Default is global $post. string|false
File: `wp-includes/deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/deprecated.php/)
```
function post_permalink( $post = 0 ) {
_deprecated_function( __FUNCTION__, '4.4.0', 'get_permalink()' );
return get_permalink( $post );
}
```
| Uses | Description |
| --- | --- |
| [\_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. |
| Version | Description |
| --- | --- |
| [4.4.0](https://developer.wordpress.org/reference/since/4.4.0/) | Use [get\_permalink()](get_permalink) |
| [1.0.0](https://developer.wordpress.org/reference/since/1.0.0/) | Introduced. |
wordpress strip_core_block_namespace( string|null $block_name = null ): string strip\_core\_block\_namespace( string|null $block\_name = null ): string
========================================================================
Returns the block name to use for serialization. This will remove the default “core/” namespace from a block name.
`$block_name` string|null Optional Original block name. Null if the block name is unknown, e.g. Classic blocks have their name set to null. Default: `null`
string Block name to use for serialization.
File: `wp-includes/blocks.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/blocks.php/)
```
function strip_core_block_namespace( $block_name = null ) {
if ( is_string( $block_name ) && 0 === strpos( $block_name, 'core/' ) ) {
return substr( $block_name, 5 );
}
return $block_name;
}
```
| Used By | Description |
| --- | --- |
| [get\_comment\_delimited\_block\_content()](get_comment_delimited_block_content) wp-includes/blocks.php | Returns the content of a block, including comment delimiters. |
| [has\_block()](has_block) wp-includes/blocks.php | Determines whether a $post or a string contains a specific block type. |
| Version | Description |
| --- | --- |
| [5.3.1](https://developer.wordpress.org/reference/since/5.3.1/) | Introduced. |
wordpress install_themes_feature_list(): array install\_themes\_feature\_list(): array
=======================================
This function has been deprecated. Use [get\_theme\_feature\_list()](get_theme_feature_list) instead.
Retrieves the list of WordPress theme features (aka theme tags).
array
File: `wp-admin/includes/theme-install.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/theme-install.php/)
```
function install_themes_feature_list() {
_deprecated_function( __FUNCTION__, '3.1.0', 'get_theme_feature_list()' );
$cache = get_transient( 'wporg_theme_feature_list' );
if ( ! $cache ) {
set_transient( 'wporg_theme_feature_list', array(), 3 * HOUR_IN_SECONDS );
}
if ( $cache ) {
return $cache;
}
$feature_list = themes_api( 'feature_list', array() );
if ( is_wp_error( $feature_list ) ) {
return array();
}
set_transient( 'wporg_theme_feature_list', $feature_list, 3 * HOUR_IN_SECONDS );
return $feature_list;
}
```
| Uses | Description |
| --- | --- |
| [themes\_api()](themes_api) wp-admin/includes/theme.php | Retrieves theme installer pages from the WordPress.org Themes API. |
| [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. |
| [\_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 |
| --- | --- |
| [3.1.0](https://developer.wordpress.org/reference/since/3.1.0/) | Use [get\_theme\_feature\_list()](get_theme_feature_list) instead. |
| [2.8.0](https://developer.wordpress.org/reference/since/2.8.0/) | Introduced. |
wordpress rest_do_request( WP_REST_Request|string $request ): WP_REST_Response rest\_do\_request( WP\_REST\_Request|string $request ): WP\_REST\_Response
==========================================================================
Do a REST request.
Used primarily to route internal requests through [WP\_REST\_Server](../classes/wp_rest_server).
`$request` [WP\_REST\_Request](../classes/wp_rest_request)|string Required Request. [WP\_REST\_Response](../classes/wp_rest_response) REST response.
File: `wp-includes/rest-api.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/rest-api.php/)
```
function rest_do_request( $request ) {
$request = rest_ensure_request( $request );
return rest_get_server()->dispatch( $request );
}
```
| Uses | Description |
| --- | --- |
| [rest\_get\_server()](rest_get_server) wp-includes/rest-api.php | Retrieves the current REST server instance. |
| [rest\_ensure\_request()](rest_ensure_request) wp-includes/rest-api.php | Ensures request arguments are a request object (for consistency). |
| Used By | Description |
| --- | --- |
| [\_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. |
| [rest\_preload\_api\_request()](rest_preload_api_request) wp-includes/rest-api.php | Append result of internal request to REST API for purpose of preloading data to be attached to a page. |
| Version | Description |
| --- | --- |
| [4.4.0](https://developer.wordpress.org/reference/since/4.4.0/) | Introduced. |
wordpress get_autotoggle( int $id ): int get\_autotoggle( int $id ): int
===============================
This function has been deprecated.
Gets the auto\_toggle setting.
`$id` int Required The category to get. If no category supplied uses 0 int Only returns 0.
File: `wp-includes/deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/deprecated.php/)
```
function get_autotoggle($id = 0) {
_deprecated_function( __FUNCTION__, '2.1.0' );
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 |
| --- | --- |
| [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 discover_pingback_server_uri( string $url, string $deprecated = '' ): string|false discover\_pingback\_server\_uri( string $url, string $deprecated = '' ): string|false
=====================================================================================
Finds a pingback server URI based on the given URL.
Checks the HTML for the rel="pingback" link and x-pingback headers. It does a check for the x-pingback headers first and returns that, if available. The check for the rel="pingback" has more overhead than just the header.
`$url` string Required URL to ping. `$deprecated` string Optional Not Used. Default: `''`
string|false String containing URI on success, false on failure.
File: `wp-includes/comment.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/comment.php/)
```
function discover_pingback_server_uri( $url, $deprecated = '' ) {
if ( ! empty( $deprecated ) ) {
_deprecated_argument( __FUNCTION__, '2.7.0' );
}
$pingback_str_dquote = 'rel="pingback"';
$pingback_str_squote = 'rel=\'pingback\'';
/** @todo Should use Filter Extension or custom preg_match instead. */
$parsed_url = parse_url( $url );
if ( ! isset( $parsed_url['host'] ) ) { // Not a URL. This should never happen.
return false;
}
// Do not search for a pingback server on our own uploads.
$uploads_dir = wp_get_upload_dir();
if ( 0 === strpos( $url, $uploads_dir['baseurl'] ) ) {
return false;
}
$response = wp_safe_remote_head(
$url,
array(
'timeout' => 2,
'httpversion' => '1.0',
)
);
if ( is_wp_error( $response ) ) {
return false;
}
if ( wp_remote_retrieve_header( $response, 'x-pingback' ) ) {
return wp_remote_retrieve_header( $response, 'x-pingback' );
}
// Not an (x)html, sgml, or xml page, no use going further.
if ( preg_match( '#(image|audio|video|model)/#is', wp_remote_retrieve_header( $response, 'content-type' ) ) ) {
return false;
}
// Now do a GET since we're going to look in the HTML headers (and we're sure it's not a binary file).
$response = wp_safe_remote_get(
$url,
array(
'timeout' => 2,
'httpversion' => '1.0',
)
);
if ( is_wp_error( $response ) ) {
return false;
}
$contents = wp_remote_retrieve_body( $response );
$pingback_link_offset_dquote = strpos( $contents, $pingback_str_dquote );
$pingback_link_offset_squote = strpos( $contents, $pingback_str_squote );
if ( $pingback_link_offset_dquote || $pingback_link_offset_squote ) {
$quote = ( $pingback_link_offset_dquote ) ? '"' : '\'';
$pingback_link_offset = ( '"' === $quote ) ? $pingback_link_offset_dquote : $pingback_link_offset_squote;
$pingback_href_pos = strpos( $contents, 'href=', $pingback_link_offset );
$pingback_href_start = $pingback_href_pos + 6;
$pingback_href_end = strpos( $contents, $quote, $pingback_href_start );
$pingback_server_url_len = $pingback_href_end - $pingback_href_start;
$pingback_server_url = substr( $contents, $pingback_href_start, $pingback_server_url_len );
// We may find rel="pingback" but an incomplete pingback URL.
if ( $pingback_server_url_len > 0 ) { // We got it!
return $pingback_server_url;
}
}
return false;
}
```
| Uses | Description |
| --- | --- |
| [wp\_get\_upload\_dir()](wp_get_upload_dir) wp-includes/functions.php | Retrieves uploads directory information. |
| [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. |
| [wp\_remote\_retrieve\_header()](wp_remote_retrieve_header) wp-includes/http.php | Retrieve a single header by name from the raw response. |
| [wp\_safe\_remote\_get()](wp_safe_remote_get) wp-includes/http.php | Retrieve the raw response from a safe HTTP request using the GET method. |
| [wp\_remote\_retrieve\_body()](wp_remote_retrieve_body) wp-includes/http.php | Retrieve only the body from the raw response. |
| [\_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 |
| --- | --- |
| [pingback()](pingback) wp-includes/comment.php | Pings back the links found in a post. |
| Version | Description |
| --- | --- |
| [1.5.0](https://developer.wordpress.org/reference/since/1.5.0/) | Introduced. |
| programming_docs |
wordpress wp_should_replace_insecure_home_url(): bool wp\_should\_replace\_insecure\_home\_url(): bool
================================================
Checks whether WordPress should replace old HTTP URLs to the site with their HTTPS counterpart.
If a WordPress site had its URL changed from HTTP to HTTPS, by default this will return `true`, causing WordPress to add frontend filters to replace insecure site URLs that may be present in older database content. The [‘wp\_should\_replace\_insecure\_home\_url’](../hooks/wp_should_replace_insecure_home_url) filter can be used to modify that behavior.
bool True if insecure URLs should replaced, false otherwise.
File: `wp-includes/https-migration.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/https-migration.php/)
```
function wp_should_replace_insecure_home_url() {
$should_replace_insecure_home_url = wp_is_using_https()
&& get_option( 'https_migration_required' )
// For automatic replacement, both 'home' and 'siteurl' need to not only use HTTPS, they also need to be using
// the same domain.
&& wp_parse_url( home_url(), PHP_URL_HOST ) === wp_parse_url( site_url(), PHP_URL_HOST );
/**
* Filters whether WordPress should replace old HTTP URLs to the site with their HTTPS counterpart.
*
* If a WordPress site had its URL changed from HTTP to HTTPS, by default this will return `true`. This filter can
* be used to disable that behavior, e.g. after having replaced URLs manually in the database.
*
* @since 5.7.0
*
* @param bool $should_replace_insecure_home_url Whether insecure HTTP URLs to the site should be replaced.
*/
return apply_filters( 'wp_should_replace_insecure_home_url', $should_replace_insecure_home_url );
}
```
[apply\_filters( 'wp\_should\_replace\_insecure\_home\_url', bool $should\_replace\_insecure\_home\_url )](../hooks/wp_should_replace_insecure_home_url)
Filters whether WordPress should replace old HTTP URLs to the site with their HTTPS counterpart.
| Uses | Description |
| --- | --- |
| [wp\_is\_using\_https()](wp_is_using_https) wp-includes/https-detection.php | Checks whether the website is using HTTPS. |
| [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. |
| [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. |
| [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\_replace\_insecure\_home\_url()](wp_replace_insecure_home_url) wp-includes/https-migration.php | Replaces insecure HTTP URLs to the site in the given content, if configured to do so. |
| Version | Description |
| --- | --- |
| [5.7.0](https://developer.wordpress.org/reference/since/5.7.0/) | Introduced. |
wordpress the_posts_navigation( array $args = array() ) the\_posts\_navigation( array $args = array() )
===============================================
Displays the navigation to next/previous set of posts, when applicable.
`$args` array Optional See [get\_the\_posts\_navigation()](get_the_posts_navigation) for available arguments.
More Arguments from get\_the\_posts\_navigation( ... $args ) Default posts navigation arguments.
* `prev_text`stringAnchor text to display in the previous posts link.
Default 'Older posts'.
* `next_text`stringAnchor text to display in the next posts link.
Default 'Newer posts'.
* `screen_reader_text`stringScreen reader text for the nav element.
Default 'Posts navigation'.
* `aria_label`stringARIA label text for the nav element. Default `'Posts'`.
* `class`stringCustom class for the nav element. Default `'posts-navigation'`.
Default: `array()`
File: `wp-includes/link-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/link-template.php/)
```
function the_posts_navigation( $args = array() ) {
echo get_the_posts_navigation( $args );
}
```
| Uses | Description |
| --- | --- |
| [get\_the\_posts\_navigation()](get_the_posts_navigation) wp-includes/link-template.php | Returns the navigation to next/previous set of posts, when applicable. |
| Version | Description |
| --- | --- |
| [4.1.0](https://developer.wordpress.org/reference/since/4.1.0/) | Introduced. |
wordpress wp_normalize_path( string $path ): string wp\_normalize\_path( string $path ): string
===========================================
Normalizes a filesystem path.
On windows systems, replaces backslashes with forward slashes and forces upper-case drive letters.
Allows for two leading slashes for Windows network shares, but ensures that all other duplicate slashes are reduced to a single.
`$path` string Required Path to normalize. string Normalized path.
File: `wp-includes/functions.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/functions.php/)
```
function wp_normalize_path( $path ) {
$wrapper = '';
if ( wp_is_stream( $path ) ) {
list( $wrapper, $path ) = explode( '://', $path, 2 );
$wrapper .= '://';
}
// Standardize all paths to use '/'.
$path = str_replace( '\\', '/', $path );
// Replace multiple slashes down to a singular, allowing for network shares having two slashes.
$path = preg_replace( '|(?<=.)/+|', '/', $path );
// Windows paths should uppercase the drive letter.
if ( ':' === substr( $path, 1, 1 ) ) {
$path = ucfirst( $path );
}
return $wrapper . $path;
}
```
| Uses | Description |
| --- | --- |
| [wp\_is\_stream()](wp_is_stream) wp-includes/functions.php | Tests if a given path is a stream URL |
| Used By | Description |
| --- | --- |
| [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. |
| [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. |
| [register\_block\_type\_from\_metadata()](register_block_type_from_metadata) wp-includes/blocks.php | Registers a block type from the metadata stored in the `block.json` file. |
| [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::get\_extension\_for\_error()](../classes/wp_recovery_mode/get_extension_for_error) wp-includes/class-wp-recovery-mode.php | Gets the extension that the error occurred in. |
| [\_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. |
| [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\_validate\_redirect()](wp_validate_redirect) wp-includes/pluggable.php | Validates a URL for use in a redirect. |
| [wp\_debug\_backtrace\_summary()](wp_debug_backtrace_summary) wp-includes/functions.php | Returns a comma-separated string or array of functions that have been called to get to the current point in code. |
| [plugins\_url()](plugins_url) wp-includes/link-template.php | Retrieves a URL within the plugins or mu-plugins directory. |
| [plugin\_basename()](plugin_basename) wp-includes/plugin.php | Gets the basename of a plugin. |
| [wp\_register\_plugin\_realpath()](wp_register_plugin_realpath) wp-includes/plugin.php | Register a plugin’s real path. |
| Version | Description |
| --- | --- |
| [4.9.7](https://developer.wordpress.org/reference/since/4.9.7/) | Allows for PHP file wrappers. |
| [4.5.0](https://developer.wordpress.org/reference/since/4.5.0/) | Allows for Windows network shares. |
| [4.4.0](https://developer.wordpress.org/reference/since/4.4.0/) | Ensures upper-case drive letters on Windows systems. |
| [3.9.0](https://developer.wordpress.org/reference/since/3.9.0/) | Introduced. |
wordpress _resolve_template_for_new_post( WP_Query $wp_query ) \_resolve\_template\_for\_new\_post( WP\_Query $wp\_query )
===========================================================
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.
Sets the current [WP\_Query](../classes/wp_query) to return auto-draft posts.
The auto-draft status indicates a new post, so allow the the [WP\_Query](../classes/wp_query) instance to return an auto-draft post for template resolution when editing a new post.
`$wp_query` [WP\_Query](../classes/wp_query) Required Current [WP\_Query](../classes/wp_query) instance, passed by reference. File: `wp-includes/block-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/block-template.php/)
```
function _resolve_template_for_new_post( $wp_query ) {
if ( ! $wp_query->is_main_query() ) {
return;
}
remove_filter( 'pre_get_posts', '_resolve_template_for_new_post' );
// Pages.
$page_id = isset( $wp_query->query['page_id'] ) ? $wp_query->query['page_id'] : null;
// Posts, including custom post types.
$p = isset( $wp_query->query['p'] ) ? $wp_query->query['p'] : null;
$post_id = $page_id ? $page_id : $p;
$post = get_post( $post_id );
if (
$post &&
'auto-draft' === $post->post_status &&
current_user_can( 'edit_post', $post->ID )
) {
$wp_query->set( 'post_status', 'auto-draft' );
}
}
```
| Uses | Description |
| --- | --- |
| [WP\_Query::set()](../classes/wp_query/set) wp-includes/class-wp-query.php | Sets the value of a query variable. |
| [WP\_Query::is\_main\_query()](../classes/wp_query/is_main_query) wp-includes/class-wp-query.php | Is the query the main query? |
| [remove\_filter()](remove_filter) wp-includes/plugin.php | Removes a callback function from a filter hook. |
| [current\_user\_can()](current_user_can) wp-includes/capabilities.php | Returns whether the current user has the specified capability. |
| [get\_post()](get_post) wp-includes/post.php | Retrieves post data given a post ID or post object. |
| Version | Description |
| --- | --- |
| [5.9.0](https://developer.wordpress.org/reference/since/5.9.0/) | Introduced. |
wordpress locate_block_template( string $template, string $type, string[] $templates ): string locate\_block\_template( string $template, string $type, string[] $templates ): string
======================================================================================
Finds a block template with equal or higher specificity than a given PHP template file.
Internally, this communicates the block content that needs to be used by the template canvas through a global variable.
`$template` string Required Path to the template. See [locate\_template()](locate_template) . More Arguments from locate\_template( ... $args ) Additional arguments passed to the template.
`$type` string Required Sanitized filename without extension. `$templates` string[] Required A list of template candidates, in descending order of priority. string The path to the Full Site Editing template canvas file, or the fallback PHP template.
File: `wp-includes/block-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/block-template.php/)
```
function locate_block_template( $template, $type, array $templates ) {
global $_wp_current_template_content;
if ( ! current_theme_supports( 'block-templates' ) ) {
return $template;
}
if ( $template ) {
/*
* locate_template() has found a PHP template at the path specified by $template.
* That means that we have a fallback candidate if we cannot find a block template
* with higher specificity.
*
* Thus, before looking for matching block themes, we shorten our list of candidate
* templates accordingly.
*/
// Locate the index of $template (without the theme directory path) in $templates.
$relative_template_path = str_replace(
array( get_stylesheet_directory() . '/', get_template_directory() . '/' ),
'',
$template
);
$index = array_search( $relative_template_path, $templates, true );
// If the template hierarchy algorithm has successfully located a PHP template file,
// we will only consider block templates with higher or equal specificity.
$templates = array_slice( $templates, 0, $index + 1 );
}
$block_template = resolve_block_template( $type, $templates, $template );
if ( $block_template ) {
if ( empty( $block_template->content ) && is_user_logged_in() ) {
$_wp_current_template_content =
sprintf(
/* translators: %s: Template title */
__( 'Empty template: %s' ),
$block_template->title
);
} elseif ( ! empty( $block_template->content ) ) {
$_wp_current_template_content = $block_template->content;
}
if ( isset( $_GET['_wp-find-template'] ) ) {
wp_send_json_success( $block_template );
}
} else {
if ( $template ) {
return $template;
}
if ( 'index' === $type ) {
if ( isset( $_GET['_wp-find-template'] ) ) {
wp_send_json_error( array( 'message' => __( 'No matching template found.' ) ) );
}
} else {
return ''; // So that the template loader keeps looking for templates.
}
}
// Add hooks for template canvas.
// Add viewport meta tag.
add_action( 'wp_head', '_block_template_viewport_meta_tag', 0 );
// Render title tag with content, regardless of whether theme has title-tag support.
remove_action( 'wp_head', '_wp_render_title_tag', 1 ); // Remove conditional title tag rendering...
add_action( 'wp_head', '_block_template_render_title_tag', 1 ); // ...and make it unconditional.
// This file will be included instead of the theme's template file.
return ABSPATH . WPINC . '/template-canvas.php';
}
```
| Uses | Description |
| --- | --- |
| [resolve\_block\_template()](resolve_block_template) wp-includes/block-template.php | Returns the correct ‘wp\_template’ to render for the request template type. |
| [get\_stylesheet\_directory()](get_stylesheet_directory) wp-includes/theme.php | Retrieves stylesheet directory path for the active theme. |
| [get\_template\_directory()](get_template_directory) wp-includes/theme.php | Retrieves template directory path for the active theme. |
| [remove\_action()](remove_action) wp-includes/plugin.php | Removes a callback function from an action hook. |
| [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. |
| [is\_user\_logged\_in()](is_user_logged_in) wp-includes/pluggable.php | Determines whether the current visitor is a logged in user. |
| [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. |
| [add\_action()](add_action) wp-includes/plugin.php | Adds a callback function to an action hook. |
| Used By | Description |
| --- | --- |
| [get\_query\_template()](get_query_template) wp-includes/template.php | Retrieves path to a template. |
| Version | Description |
| --- | --- |
| [5.8.0](https://developer.wordpress.org/reference/since/5.8.0/) | Introduced. |
wordpress wp_get_ext_types(): array[] wp\_get\_ext\_types(): array[]
==============================
Retrieves the list of common file extensions and their types.
array[] Multi-dimensional array of file extensions types keyed by the type of file.
File: `wp-includes/functions.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/functions.php/)
```
function wp_get_ext_types() {
/**
* Filters file type based on the extension name.
*
* @since 2.5.0
*
* @see wp_ext2type()
*
* @param array[] $ext2type Multi-dimensional array of file extensions types keyed by the type of file.
*/
return apply_filters(
'ext2type',
array(
'image' => array( 'jpg', 'jpeg', 'jpe', 'gif', 'png', 'bmp', 'tif', 'tiff', 'ico', 'heic', 'webp' ),
'audio' => array( 'aac', 'ac3', 'aif', 'aiff', 'flac', 'm3a', 'm4a', 'm4b', 'mka', 'mp1', 'mp2', 'mp3', 'ogg', 'oga', 'ram', 'wav', 'wma' ),
'video' => array( '3g2', '3gp', '3gpp', 'asf', 'avi', 'divx', 'dv', 'flv', 'm4v', 'mkv', 'mov', 'mp4', 'mpeg', 'mpg', 'mpv', 'ogm', 'ogv', 'qt', 'rm', 'vob', 'wmv' ),
'document' => array( 'doc', 'docx', 'docm', 'dotm', 'odt', 'pages', 'pdf', 'xps', 'oxps', 'rtf', 'wp', 'wpd', 'psd', 'xcf' ),
'spreadsheet' => array( 'numbers', 'ods', 'xls', 'xlsx', 'xlsm', 'xlsb' ),
'interactive' => array( 'swf', 'key', 'ppt', 'pptx', 'pptm', 'pps', 'ppsx', 'ppsm', 'sldx', 'sldm', 'odp' ),
'text' => array( 'asc', 'csv', 'tsv', 'txt' ),
'archive' => array( 'bz2', 'cab', 'dmg', 'gz', 'rar', 'sea', 'sit', 'sqx', 'tar', 'tgz', 'zip', '7z' ),
'code' => array( 'css', 'htm', 'html', 'php', 'js' ),
)
);
}
```
[apply\_filters( 'ext2type', array[] $ext2type )](../hooks/ext2type)
Filters file type based on the extension name.
| 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\_ext2type()](wp_ext2type) wp-includes/functions.php | Retrieves the file type based on the extension name. |
| [get\_post\_mime\_types()](get_post_mime_types) wp-includes/post.php | Gets default post mime types. |
| Version | Description |
| --- | --- |
| [4.6.0](https://developer.wordpress.org/reference/since/4.6.0/) | Introduced. |
wordpress get_the_author_login(): string get\_the\_author\_login(): string
=================================
This function has been deprecated. Use [get\_the\_author\_meta()](get_the_author_meta) instead.
Retrieve the login name of the author of the current post.
* [get\_the\_author\_meta()](get_the_author_meta)
string The author's login name (username).
File: `wp-includes/deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/deprecated.php/)
```
function get_the_author_login() {
_deprecated_function( __FUNCTION__, '2.8.0', 'get_the_author_meta(\'login\')' );
return get_the_author_meta('login');
}
```
| 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. |
| programming_docs |
wordpress posts_nav_link( string $sep = '', string $prelabel = '', string $nxtlabel = '' ) posts\_nav\_link( string $sep = '', string $prelabel = '', string $nxtlabel = '' )
==================================================================================
Displays the post pages link navigation for previous and next pages.
`$sep` string Optional Separator for posts navigation links. Default: `''`
`$prelabel` string Optional Label for previous pages. Default: `''`
`$nxtlabel` string Optional Label for next pages. Default: `''`
For displaying next and previous pages of posts see [next\_posts\_link()](next_posts_link) and [previous\_posts\_link()](previous_posts_link) .
For displaying next and previous post navigation on individual posts, see [next\_post\_link()](next_post_link) and [previous\_post\_link()](previous_post_link) .
Note: since weblog posts are traditionally listed in reverse chronological order (with most recent posts at the top), there is some ambiguity in the definition of “next page”. WordPress defines “next page” as the “next page *toward the past*“.
File: `wp-includes/link-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/link-template.php/)
```
function posts_nav_link( $sep = '', $prelabel = '', $nxtlabel = '' ) {
$args = array_filter( compact( 'sep', 'prelabel', 'nxtlabel' ) );
echo get_posts_nav_link( $args );
}
```
| Uses | Description |
| --- | --- |
| [get\_posts\_nav\_link()](get_posts_nav_link) wp-includes/link-template.php | Retrieves the post pages link navigation for previous and next pages. |
| Version | Description |
| --- | --- |
| [0.71](https://developer.wordpress.org/reference/since/0.71/) | Introduced. |
wordpress sanitize_user_object( object|array $user, string $context = 'display' ): object|array sanitize\_user\_object( object|array $user, string $context = 'display' ): object|array
=======================================================================================
This function has been deprecated.
Sanitize every user field.
If the context is ‘raw’, then the user object or array will get minimal santization of the int fields.
`$user` object|array Required The user object or array. `$context` string Optional How to sanitize user fields. Default `'display'`. Default: `'display'`
object|array The now sanitized user object or array (will be the same type as $user).
File: `wp-includes/deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/deprecated.php/)
```
function sanitize_user_object($user, $context = 'display') {
_deprecated_function( __FUNCTION__, '3.3.0' );
if ( is_object($user) ) {
if ( !isset($user->ID) )
$user->ID = 0;
if ( ! ( $user instanceof WP_User ) ) {
$vars = get_object_vars($user);
foreach ( array_keys($vars) as $field ) {
if ( is_string($user->$field) || is_numeric($user->$field) )
$user->$field = sanitize_user_field($field, $user->$field, $user->ID, $context);
}
}
$user->filter = $context;
} else {
if ( !isset($user['ID']) )
$user['ID'] = 0;
foreach ( array_keys($user) as $field )
$user[$field] = sanitize_user_field($field, $user[$field], $user['ID'], $context);
$user['filter'] = $context;
}
return $user;
}
```
| Uses | Description |
| --- | --- |
| [sanitize\_user\_field()](sanitize_user_field) wp-includes/user.php | Sanitizes user field based on context. |
| [\_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.3.0](https://developer.wordpress.org/reference/since/2.3.0/) | Introduced. |
wordpress wp_print_revision_templates() wp\_print\_revision\_templates()
================================
Print JavaScript templates required for the revisions experience.
File: `wp-admin/includes/revision.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/revision.php/)
```
function wp_print_revision_templates() {
global $post;
?><script id="tmpl-revisions-frame" type="text/html">
<div class="revisions-control-frame"></div>
<div class="revisions-diff-frame"></div>
</script>
<script id="tmpl-revisions-buttons" type="text/html">
<div class="revisions-previous">
<input class="button" type="button" value="<?php echo esc_attr_x( 'Previous', 'Button label for a previous revision' ); ?>" />
</div>
<div class="revisions-next">
<input class="button" type="button" value="<?php echo esc_attr_x( 'Next', 'Button label for a next revision' ); ?>" />
</div>
</script>
<script id="tmpl-revisions-checkbox" type="text/html">
<div class="revision-toggle-compare-mode">
<label>
<input type="checkbox" class="compare-two-revisions"
<#
if ( 'undefined' !== typeof data && data.model.attributes.compareTwoMode ) {
#> checked="checked"<#
}
#>
/>
<?php esc_html_e( 'Compare any two revisions' ); ?>
</label>
</div>
</script>
<script id="tmpl-revisions-meta" type="text/html">
<# if ( ! _.isUndefined( data.attributes ) ) { #>
<div class="diff-title">
<# if ( 'from' === data.type ) { #>
<strong><?php _ex( 'From:', 'Followed by post revision info' ); ?></strong>
<# } else if ( 'to' === data.type ) { #>
<strong><?php _ex( 'To:', 'Followed by post revision info' ); ?></strong>
<# } #>
<div class="author-card<# if ( data.attributes.autosave ) { #> autosave<# } #>">
{{{ data.attributes.author.avatar }}}
<div class="author-info">
<# if ( data.attributes.autosave ) { #>
<span class="byline">
<?php
printf(
/* translators: %s: User's display name. */
__( 'Autosave by %s' ),
'<span class="author-name">{{ data.attributes.author.name }}</span>'
);
?>
</span>
<# } else if ( data.attributes.current ) { #>
<span class="byline">
<?php
printf(
/* translators: %s: User's display name. */
__( 'Current Revision by %s' ),
'<span class="author-name">{{ data.attributes.author.name }}</span>'
);
?>
</span>
<# } else { #>
<span class="byline">
<?php
printf(
/* translators: %s: User's display name. */
__( 'Revision by %s' ),
'<span class="author-name">{{ data.attributes.author.name }}</span>'
);
?>
</span>
<# } #>
<span class="time-ago">{{ data.attributes.timeAgo }}</span>
<span class="date">({{ data.attributes.dateShort }})</span>
</div>
<# if ( 'to' === data.type && data.attributes.restoreUrl ) { #>
<input <?php if ( wp_check_post_lock( $post->ID ) ) { ?>
disabled="disabled"
<?php } else { ?>
<# if ( data.attributes.current ) { #>
disabled="disabled"
<# } #>
<?php } ?>
<# if ( data.attributes.autosave ) { #>
type="button" class="restore-revision button button-primary" value="<?php esc_attr_e( 'Restore This Autosave' ); ?>" />
<# } else { #>
type="button" class="restore-revision button button-primary" value="<?php esc_attr_e( 'Restore This Revision' ); ?>" />
<# } #>
<# } #>
</div>
<# if ( 'tooltip' === data.type ) { #>
<div class="revisions-tooltip-arrow"><span></span></div>
<# } #>
<# } #>
</script>
<script id="tmpl-revisions-diff" type="text/html">
<div class="loading-indicator"><span class="spinner"></span></div>
<div class="diff-error"><?php _e( 'Sorry, something went wrong. The requested comparison could not be loaded.' ); ?></div>
<div class="diff">
<# _.each( data.fields, function( field ) { #>
<h3>{{ field.name }}</h3>
{{{ field.diff }}}
<# }); #>
</div>
</script>
<?php
}
```
| 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. |
| [esc\_attr\_x()](esc_attr_x) wp-includes/l10n.php | Translates string with gettext context, and escapes it for safe use in an attribute. |
| [esc\_html\_e()](esc_html_e) wp-includes/l10n.php | Displays translated text that has been escaped for safe use in HTML output. |
| [\_ex()](_ex) wp-includes/l10n.php | Displays translated string with gettext context. |
| [esc\_attr\_e()](esc_attr_e) wp-includes/l10n.php | Displays translated text that has been escaped for safe use in an attribute. |
| [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. |
| [\_e()](_e) wp-includes/l10n.php | Displays translated text. |
| Version | Description |
| --- | --- |
| [4.1.0](https://developer.wordpress.org/reference/since/4.1.0/) | Introduced. |
wordpress the_guid( int|WP_Post $post ) the\_guid( int|WP\_Post $post )
===============================
Displays the Post Global Unique Identifier (guid).
The guid will appear to be a link, but should not be used as a link to the post. The reason you should not use it as a link, is because of moving the blog across domains.
URL is escaped to make it XML-safe.
`$post` int|[WP\_Post](../classes/wp_post) Optional Post ID or post object. Default is global $post. File: `wp-includes/post-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/post-template.php/)
```
function the_guid( $post = 0 ) {
$post = get_post( $post );
$post_guid = isset( $post->guid ) ? get_the_guid( $post ) : '';
$post_id = isset( $post->ID ) ? $post->ID : 0;
/**
* Filters the escaped Global Unique Identifier (guid) of the post.
*
* @since 4.2.0
*
* @see get_the_guid()
*
* @param string $post_guid Escaped Global Unique Identifier (guid) of the post.
* @param int $post_id The post ID.
*/
echo apply_filters( 'the_guid', $post_guid, $post_id );
}
```
[apply\_filters( 'the\_guid', string $post\_guid, int $post\_id )](../hooks/the_guid)
Filters the escaped Global Unique Identifier (guid) of the post.
| Uses | Description |
| --- | --- |
| [get\_the\_guid()](get_the_guid) wp-includes/post-template.php | Retrieves the Post Global Unique Identifier (guid). |
| [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 |
| --- | --- |
| [export\_wp()](export_wp) wp-admin/includes/export.php | Generates the WXR export file for download. |
| Version | Description |
| --- | --- |
| [1.5.0](https://developer.wordpress.org/reference/since/1.5.0/) | Introduced. |
wordpress _remove_theme_support( string $feature ): bool \_remove\_theme\_support( string $feature ): 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.
Do not use. Removes theme support internally without knowledge of those not used by themes directly.
`$feature` string Required The feature being removed. 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'`
bool True if support was removed, false if the feature was not registered.
File: `wp-includes/theme.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/theme.php/)
```
function _remove_theme_support( $feature ) {
global $_wp_theme_features;
switch ( $feature ) {
case 'custom-header-uploads':
if ( ! isset( $_wp_theme_features['custom-header'] ) ) {
return false;
}
add_theme_support( 'custom-header', array( 'uploads' => false ) );
return; // Do not continue - custom-header-uploads no longer exists.
}
if ( ! isset( $_wp_theme_features[ $feature ] ) ) {
return false;
}
switch ( $feature ) {
case 'custom-header':
if ( ! did_action( 'wp_loaded' ) ) {
break;
}
$support = get_theme_support( 'custom-header' );
if ( isset( $support[0]['wp-head-callback'] ) ) {
remove_action( 'wp_head', $support[0]['wp-head-callback'] );
}
if ( isset( $GLOBALS['custom_image_header'] ) ) {
remove_action( 'admin_menu', array( $GLOBALS['custom_image_header'], 'init' ) );
unset( $GLOBALS['custom_image_header'] );
}
break;
case 'custom-background':
if ( ! did_action( 'wp_loaded' ) ) {
break;
}
$support = get_theme_support( 'custom-background' );
if ( isset( $support[0]['wp-head-callback'] ) ) {
remove_action( 'wp_head', $support[0]['wp-head-callback'] );
}
remove_action( 'admin_menu', array( $GLOBALS['custom_background'], 'init' ) );
unset( $GLOBALS['custom_background'] );
break;
}
unset( $_wp_theme_features[ $feature ] );
return true;
}
```
| Uses | Description |
| --- | --- |
| [add\_theme\_support()](add_theme_support) wp-includes/theme.php | Registers theme support for a given feature. |
| [get\_theme\_support()](get_theme_support) wp-includes/theme.php | Gets the theme support arguments passed when registering that support. |
| [remove\_action()](remove_action) wp-includes/plugin.php | Removes a callback function from an action hook. |
| [did\_action()](did_action) wp-includes/plugin.php | Retrieves the number of times an action has been fired during the current request. |
| Used By | Description |
| --- | --- |
| [remove\_editor\_styles()](remove_editor_styles) wp-includes/theme.php | Removes all visual editor stylesheets. |
| [remove\_theme\_support()](remove_theme_support) wp-includes/theme.php | Allows a theme to de-register its support of a certain feature |
| [unregister\_nav\_menu()](unregister_nav_menu) wp-includes/nav-menu.php | Unregisters a navigation menu location for a theme. |
| Version | Description |
| --- | --- |
| [3.1.0](https://developer.wordpress.org/reference/since/3.1.0/) | Introduced. |
wordpress wp_timezone_supported(): bool wp\_timezone\_supported(): bool
===============================
This function has been deprecated.
Check for PHP timezone support
bool
File: `wp-includes/deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/deprecated.php/)
```
function wp_timezone_supported() {
_deprecated_function( __FUNCTION__, '3.2.0' );
return true;
}
```
| 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.2.0](https://developer.wordpress.org/reference/since/3.2.0/) | This function has been deprecated. |
| [2.9.0](https://developer.wordpress.org/reference/since/2.9.0/) | Introduced. |
wordpress wp_ajax_add_menu_item() wp\_ajax\_add\_menu\_item()
===========================
Ajax handler for adding a menu item.
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_menu_item() {
check_ajax_referer( 'add-menu_item', 'menu-settings-column-nonce' );
if ( ! current_user_can( 'edit_theme_options' ) ) {
wp_die( -1 );
}
require_once ABSPATH . 'wp-admin/includes/nav-menu.php';
// For performance reasons, we omit some object properties from the checklist.
// The following is a hacky way to restore them when adding non-custom items.
$menu_items_data = array();
foreach ( (array) $_POST['menu-item'] as $menu_item_data ) {
if (
! empty( $menu_item_data['menu-item-type'] ) &&
'custom' !== $menu_item_data['menu-item-type'] &&
! empty( $menu_item_data['menu-item-object-id'] )
) {
switch ( $menu_item_data['menu-item-type'] ) {
case 'post_type':
$_object = get_post( $menu_item_data['menu-item-object-id'] );
break;
case 'post_type_archive':
$_object = get_post_type_object( $menu_item_data['menu-item-object'] );
break;
case 'taxonomy':
$_object = get_term( $menu_item_data['menu-item-object-id'], $menu_item_data['menu-item-object'] );
break;
}
$_menu_items = array_map( 'wp_setup_nav_menu_item', array( $_object ) );
$_menu_item = reset( $_menu_items );
// Restore the missing menu item properties.
$menu_item_data['menu-item-description'] = $_menu_item->description;
}
$menu_items_data[] = $menu_item_data;
}
$item_ids = wp_save_nav_menu_items( 0, $menu_items_data );
if ( is_wp_error( $item_ids ) ) {
wp_die( 0 );
}
$menu_items = array();
foreach ( (array) $item_ids as $menu_item_id ) {
$menu_obj = get_post( $menu_item_id );
if ( ! empty( $menu_obj->ID ) ) {
$menu_obj = wp_setup_nav_menu_item( $menu_obj );
$menu_obj->title = empty( $menu_obj->title ) ? __( 'Menu Item' ) : $menu_obj->title;
$menu_obj->label = $menu_obj->title; // Don't show "(pending)" in ajax-added items.
$menu_items[] = $menu_obj;
}
}
/** This filter is documented in wp-admin/includes/nav-menu.php */
$walker_class_name = apply_filters( 'wp_edit_nav_menu_walker', 'Walker_Nav_Menu_Edit', $_POST['menu'] );
if ( ! class_exists( $walker_class_name ) ) {
wp_die( 0 );
}
if ( ! empty( $menu_items ) ) {
$args = array(
'after' => '',
'before' => '',
'link_after' => '',
'link_before' => '',
'walker' => new $walker_class_name,
);
echo walk_nav_menu_tree( $menu_items, 0, (object) $args );
}
wp_die();
}
```
[apply\_filters( 'wp\_edit\_nav\_menu\_walker', string $class, int $menu\_id )](../hooks/wp_edit_nav_menu_walker)
Filters the [Walker](../classes/walker) class used when adding nav menu items.
| Uses | Description |
| --- | --- |
| [wp\_save\_nav\_menu\_items()](wp_save_nav_menu_items) wp-admin/includes/nav-menu.php | Save posted nav menu item data. |
| [walk\_nav\_menu\_tree()](walk_nav_menu_tree) wp-includes/nav-menu-template.php | Retrieves the HTML list content for nav menu items. |
| [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. |
| [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\_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. |
| [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. |
| Version | Description |
| --- | --- |
| [3.1.0](https://developer.wordpress.org/reference/since/3.1.0/) | Introduced. |
| programming_docs |
wordpress image_resize_dimensions( int $orig_w, int $orig_h, int $dest_w, int $dest_h, bool|array $crop = false ): array|false image\_resize\_dimensions( int $orig\_w, int $orig\_h, int $dest\_w, int $dest\_h, bool|array $crop = false ): array|false
==========================================================================================================================
Retrieves calculated resize dimensions for use in [WP\_Image\_Editor](../classes/wp_image_editor).
Calculates dimensions and coordinates for a resized image that fits within a specified width and height.
Cropping behavior is dependent on the value of $crop:
1. If false (default), images will not be cropped.
2. If an array in the form of array( x\_crop\_position, y\_crop\_position ):
* x\_crop\_position accepts ‘left’ ‘center’, or ‘right’.
* y\_crop\_position accepts ‘top’, ‘center’, or ‘bottom’.
Images will be cropped to the specified dimensions within the defined crop area.
3. If true, images will be cropped to the specified dimensions using center positions.
`$orig_w` int Required Original width in pixels. `$orig_h` int Required Original height in pixels. `$dest_w` int Required New width in pixels. `$dest_h` int Required New height in pixels. `$crop` bool|array Optional Whether to crop image to specified width and height or resize.
An array can specify positioning of the crop area. Default: `false`
array|false Returned array matches parameters for `imagecopyresampled()`. False on failure.
File: `wp-includes/media.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/media.php/)
```
function image_resize_dimensions( $orig_w, $orig_h, $dest_w, $dest_h, $crop = false ) {
if ( $orig_w <= 0 || $orig_h <= 0 ) {
return false;
}
// At least one of $dest_w or $dest_h must be specific.
if ( $dest_w <= 0 && $dest_h <= 0 ) {
return false;
}
/**
* Filters whether to preempt calculating the image resize dimensions.
*
* Returning a non-null value from the filter will effectively short-circuit
* image_resize_dimensions(), returning that value instead.
*
* @since 3.4.0
*
* @param null|mixed $null Whether to preempt output of the resize dimensions.
* @param int $orig_w Original width in pixels.
* @param int $orig_h Original height in pixels.
* @param int $dest_w New width in pixels.
* @param int $dest_h New height in pixels.
* @param bool|array $crop Whether to crop image to specified width and height or resize.
* An array can specify positioning of the crop area. Default false.
*/
$output = apply_filters( 'image_resize_dimensions', null, $orig_w, $orig_h, $dest_w, $dest_h, $crop );
if ( null !== $output ) {
return $output;
}
// Stop if the destination size is larger than the original image dimensions.
if ( empty( $dest_h ) ) {
if ( $orig_w < $dest_w ) {
return false;
}
} elseif ( empty( $dest_w ) ) {
if ( $orig_h < $dest_h ) {
return false;
}
} else {
if ( $orig_w < $dest_w && $orig_h < $dest_h ) {
return false;
}
}
if ( $crop ) {
/*
* Crop the largest possible portion of the original image that we can size to $dest_w x $dest_h.
* Note that the requested crop dimensions are used as a maximum bounding box for the original image.
* If the original image's width or height is less than the requested width or height
* only the greater one will be cropped.
* For example when the original image is 600x300, and the requested crop dimensions are 400x400,
* the resulting image will be 400x300.
*/
$aspect_ratio = $orig_w / $orig_h;
$new_w = min( $dest_w, $orig_w );
$new_h = min( $dest_h, $orig_h );
if ( ! $new_w ) {
$new_w = (int) round( $new_h * $aspect_ratio );
}
if ( ! $new_h ) {
$new_h = (int) round( $new_w / $aspect_ratio );
}
$size_ratio = max( $new_w / $orig_w, $new_h / $orig_h );
$crop_w = round( $new_w / $size_ratio );
$crop_h = round( $new_h / $size_ratio );
if ( ! is_array( $crop ) || count( $crop ) !== 2 ) {
$crop = array( 'center', 'center' );
}
list( $x, $y ) = $crop;
if ( 'left' === $x ) {
$s_x = 0;
} elseif ( 'right' === $x ) {
$s_x = $orig_w - $crop_w;
} else {
$s_x = floor( ( $orig_w - $crop_w ) / 2 );
}
if ( 'top' === $y ) {
$s_y = 0;
} elseif ( 'bottom' === $y ) {
$s_y = $orig_h - $crop_h;
} else {
$s_y = floor( ( $orig_h - $crop_h ) / 2 );
}
} else {
// Resize using $dest_w x $dest_h as a maximum bounding box.
$crop_w = $orig_w;
$crop_h = $orig_h;
$s_x = 0;
$s_y = 0;
list( $new_w, $new_h ) = wp_constrain_dimensions( $orig_w, $orig_h, $dest_w, $dest_h );
}
if ( wp_fuzzy_number_match( $new_w, $orig_w ) && wp_fuzzy_number_match( $new_h, $orig_h ) ) {
// The new size has virtually the same dimensions as the original image.
/**
* Filters whether to proceed with making an image sub-size with identical dimensions
* with the original/source image. Differences of 1px may be due to rounding and are ignored.
*
* @since 5.3.0
*
* @param bool $proceed The filtered value.
* @param int $orig_w Original image width.
* @param int $orig_h Original image height.
*/
$proceed = (bool) apply_filters( 'wp_image_resize_identical_dimensions', false, $orig_w, $orig_h );
if ( ! $proceed ) {
return false;
}
}
// The return array matches the parameters to imagecopyresampled().
// int dst_x, int dst_y, int src_x, int src_y, int dst_w, int dst_h, int src_w, int src_h
return array( 0, 0, (int) $s_x, (int) $s_y, (int) $new_w, (int) $new_h, (int) $crop_w, (int) $crop_h );
}
```
[apply\_filters( 'image\_resize\_dimensions', null|mixed $null, int $orig\_w, int $orig\_h, int $dest\_w, int $dest\_h, bool|array $crop )](../hooks/image_resize_dimensions)
Filters whether to preempt calculating the image resize dimensions.
[apply\_filters( 'wp\_image\_resize\_identical\_dimensions', bool $proceed, int $orig\_w, int $orig\_h )](../hooks/wp_image_resize_identical_dimensions)
Filters whether to proceed with making an image sub-size with identical dimensions with the original/source image. Differences of 1px may be due to rounding and are ignored.
| Uses | Description |
| --- | --- |
| [wp\_fuzzy\_number\_match()](wp_fuzzy_number_match) wp-includes/functions.php | Checks if two numbers are nearly the same. |
| [wp\_constrain\_dimensions()](wp_constrain_dimensions) wp-includes/media.php | Calculates the new dimensions for a down-sampled image. |
| [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\_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\_Image\_Editor\_Imagick::resize()](../classes/wp_image_editor_imagick/resize) wp-includes/class-wp-image-editor-imagick.php | Resizes current image. |
| [WP\_Image\_Editor\_GD::\_resize()](../classes/wp_image_editor_gd/_resize) wp-includes/class-wp-image-editor-gd.php | |
| Version | Description |
| --- | --- |
| [2.5.0](https://developer.wordpress.org/reference/since/2.5.0/) | Introduced. |
wordpress wp_ajax_save_user_color_scheme() wp\_ajax\_save\_user\_color\_scheme()
=====================================
Ajax handler for auto-saving the selected color scheme for a user’s own profile.
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_save_user_color_scheme() {
global $_wp_admin_css_colors;
check_ajax_referer( 'save-color-scheme', 'nonce' );
$color_scheme = sanitize_key( $_POST['color_scheme'] );
if ( ! isset( $_wp_admin_css_colors[ $color_scheme ] ) ) {
wp_send_json_error();
}
$previous_color_scheme = get_user_meta( get_current_user_id(), 'admin_color', true );
update_user_meta( get_current_user_id(), 'admin_color', $color_scheme );
wp_send_json_success(
array(
'previousScheme' => 'admin-color-' . $previous_color_scheme,
'currentScheme' => 'admin-color-' . $color_scheme,
)
);
}
```
| Uses | Description |
| --- | --- |
| [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. |
| [sanitize\_key()](sanitize_key) wp-includes/formatting.php | Sanitizes a string key. |
| [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\_current\_user\_id()](get_current_user_id) wp-includes/user.php | Gets the current user’s ID. |
| Version | Description |
| --- | --- |
| [3.8.0](https://developer.wordpress.org/reference/since/3.8.0/) | Introduced. |
wordpress wp_dashboard_cached_rss_widget( string $widget_id, callable $callback, array $check_urls = array(), mixed $args ): bool wp\_dashboard\_cached\_rss\_widget( string $widget\_id, callable $callback, array $check\_urls = array(), mixed $args ): bool
=============================================================================================================================
Checks to see if all of the feed url in $check\_urls are cached.
If $check\_urls is empty, look for the rss feed url found in the dashboard widget options of $widget\_id. If cached, call $callback, a function that echoes out output for this widget. If not cache, echo a "Loading…" stub which is later replaced by Ajax call (see top of /wp-admin/index.php)
`$widget_id` string Required The widget ID. `$callback` callable Required The callback function used to display each feed. `$check_urls` array Optional RSS feeds. Default: `array()`
`$args` mixed Optional additional parameters to pass to the callback function. bool True on success, false on failure.
File: `wp-admin/includes/dashboard.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/dashboard.php/)
```
function wp_dashboard_cached_rss_widget( $widget_id, $callback, $check_urls = array(), ...$args ) {
$loading = '<p class="widget-loading hide-if-no-js">' . __( 'Loading…' ) . '</p><div class="hide-if-js notice notice-error inline"><p>' . __( 'This widget requires JavaScript.' ) . '</p></div>';
$doing_ajax = wp_doing_ajax();
if ( empty( $check_urls ) ) {
$widgets = get_option( 'dashboard_widget_options' );
if ( empty( $widgets[ $widget_id ]['url'] ) && ! $doing_ajax ) {
echo $loading;
return false;
}
$check_urls = array( $widgets[ $widget_id ]['url'] );
}
$locale = get_user_locale();
$cache_key = 'dash_v2_' . md5( $widget_id . '_' . $locale );
$output = get_transient( $cache_key );
if ( false !== $output ) {
echo $output;
return true;
}
if ( ! $doing_ajax ) {
echo $loading;
return false;
}
if ( $callback && is_callable( $callback ) ) {
array_unshift( $args, $widget_id, $check_urls );
ob_start();
call_user_func_array( $callback, $args );
// Default lifetime in cache of 12 hours (same as the feeds).
set_transient( $cache_key, ob_get_flush(), 12 * HOUR_IN_SECONDS );
}
return true;
}
```
| Uses | Description |
| --- | --- |
| [wp\_doing\_ajax()](wp_doing_ajax) wp-includes/load.php | Determines whether the current request is a WordPress Ajax request. |
| [get\_user\_locale()](get_user_locale) wp-includes/l10n.php | Retrieves the locale of a user. |
| [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-includes/l10n.php | Retrieves the translation of $text. |
| [get\_option()](get_option) wp-includes/option.php | Retrieves an option value based on an option name. |
| Used By | Description |
| --- | --- |
| [wp\_dashboard\_primary()](wp_dashboard_primary) wp-admin/includes/dashboard.php | ‘WordPress Events and News’ dashboard widget. |
| 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 wp_set_post_categories( int $post_ID, int[]|int $post_categories = array(), bool $append = false ): array|false|WP_Error wp\_set\_post\_categories( int $post\_ID, int[]|int $post\_categories = array(), bool $append = false ): array|false|WP\_Error
==============================================================================================================================
Sets categories for a post.
If no categories are provided, the default category is used.
`$post_ID` int Optional The Post ID. Does not default to the ID of the global $post. Default 0. `$post_categories` int[]|int Optional List of category IDs, or the ID of a single category.
Default: `array()`
`$append` bool Optional If true, don't delete existing categories, just add on.
If false, replace the categories with the new categories. Default: `false`
array|false|[WP\_Error](../classes/wp_error) Array of term taxonomy IDs of affected categories. [WP\_Error](../classes/wp_error) or false on failure.
If no categories are passed with a post ID that has a post type of **post**, the default category will be used.
**Be careful**, as wp\_set\_post\_categories will overwrite any existing categories already assigned to the post unless $append is set to true.
If an ID is passed with the categories array that is **not** associated with a valid category, it will be stripped before the object terms are updated and from the return array.
[wp\_set\_object\_terms()](wp_set_object_terms) performs the same function with more granular control for built in categories and can also be used to set any custom taxonomies.
File: `wp-includes/post.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/post.php/)
```
function wp_set_post_categories( $post_ID = 0, $post_categories = array(), $append = false ) {
$post_ID = (int) $post_ID;
$post_type = get_post_type( $post_ID );
$post_status = get_post_status( $post_ID );
// If $post_categories isn't already an array, make it one.
$post_categories = (array) $post_categories;
if ( empty( $post_categories ) ) {
/**
* Filters post types (in addition to 'post') that require a default category.
*
* @since 5.5.0
*
* @param string[] $post_types An array of post type names. Default empty array.
*/
$default_category_post_types = apply_filters( 'default_category_post_types', array() );
// Regular posts always require a default category.
$default_category_post_types = array_merge( $default_category_post_types, array( 'post' ) );
if ( in_array( $post_type, $default_category_post_types, true )
&& is_object_in_taxonomy( $post_type, 'category' )
&& 'auto-draft' !== $post_status
) {
$post_categories = array( get_option( 'default_category' ) );
$append = false;
} else {
$post_categories = array();
}
} elseif ( 1 === count( $post_categories ) && '' === reset( $post_categories ) ) {
return true;
}
return wp_set_post_terms( $post_ID, $post_categories, 'category', $append );
}
```
[apply\_filters( 'default\_category\_post\_types', string[] $post\_types )](../hooks/default_category_post_types)
Filters post types (in addition to ‘post’) that require a default category.
| Uses | Description |
| --- | --- |
| [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\_set\_post\_terms()](wp_set_post_terms) wp-includes/post.php | Sets the terms for a post. |
| [get\_post\_type()](get_post_type) wp-includes/post.php | Retrieves the post type of the current post or of a given post. |
| [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\_option()](get_option) wp-includes/option.php | Retrieves an option value based on an option name. |
| Used By | Description |
| --- | --- |
| [wp\_create\_categories()](wp_create_categories) wp-admin/includes/taxonomy.php | Creates categories for the given post. |
| [wp\_set\_post\_cats()](wp_set_post_cats) wp-includes/deprecated.php | Sets the categories that the post ID belongs to. |
| [wp\_insert\_post()](wp_insert_post) wp-includes/post.php | Inserts or update a post. |
| [wp\_xmlrpc\_server::mt\_setPostCategories()](../classes/wp_xmlrpc_server/mt_setpostcategories) wp-includes/class-wp-xmlrpc-server.php | Sets categories for a post. |
| Version | Description |
| --- | --- |
| [2.1.0](https://developer.wordpress.org/reference/since/2.1.0/) | Introduced. |
wordpress screen_options( $screen ) screen\_options( $screen )
==========================
This function has been deprecated. Use [WP\_Screen::render\_per\_page\_options()](../classes/wp_screen/render_per_page_options) instead.
Returns the screen’s per-page options.
* [WP\_Screen::render\_per\_page\_options()](../classes/wp_screen/render_per_page_options)
File: `wp-admin/includes/deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/deprecated.php/)
```
function screen_options( $screen ) {
_deprecated_function( __FUNCTION__, '3.3.0', '$current_screen->render_per_page_options()' );
$current_screen = get_current_screen();
if ( ! $current_screen )
return '';
ob_start();
$current_screen->render_per_page_options();
return ob_get_clean();
}
```
| Uses | Description |
| --- | --- |
| [get\_current\_screen()](get_current_screen) wp-admin/includes/screen.php | Get the current screen object |
| [\_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\_Screen::render\_per\_page\_options()](../classes/wp_screen/render_per_page_options) |
| [2.8.0](https://developer.wordpress.org/reference/since/2.8.0/) | Introduced. |
wordpress wp_admin_bar_my_account_menu( WP_Admin_Bar $wp_admin_bar ) wp\_admin\_bar\_my\_account\_menu( WP\_Admin\_Bar $wp\_admin\_bar )
===================================================================
Adds the “My Account” submenu items.
`$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_my_account_menu( $wp_admin_bar ) {
$user_id = get_current_user_id();
$current_user = wp_get_current_user();
if ( ! $user_id ) {
return;
}
if ( current_user_can( 'read' ) ) {
$profile_url = get_edit_profile_url( $user_id );
} elseif ( is_multisite() ) {
$profile_url = get_dashboard_url( $user_id, 'profile.php' );
} else {
$profile_url = false;
}
$wp_admin_bar->add_group(
array(
'parent' => 'my-account',
'id' => 'user-actions',
)
);
$user_info = get_avatar( $user_id, 64 );
$user_info .= "<span class='display-name'>{$current_user->display_name}</span>";
if ( $current_user->display_name !== $current_user->user_login ) {
$user_info .= "<span class='username'>{$current_user->user_login}</span>";
}
$wp_admin_bar->add_node(
array(
'parent' => 'user-actions',
'id' => 'user-info',
'title' => $user_info,
'href' => $profile_url,
'meta' => array(
'tabindex' => -1,
),
)
);
if ( false !== $profile_url ) {
$wp_admin_bar->add_node(
array(
'parent' => 'user-actions',
'id' => 'edit-profile',
'title' => __( 'Edit Profile' ),
'href' => $profile_url,
)
);
}
$wp_admin_bar->add_node(
array(
'parent' => 'user-actions',
'id' => 'logout',
'title' => __( 'Log Out' ),
'href' => wp_logout_url(),
)
);
}
```
| Uses | Description |
| --- | --- |
| [get\_avatar()](get_avatar) wp-includes/pluggable.php | Retrieves the avatar `<img>` tag for a user, email address, MD5 hash, comment, or post. |
| [wp\_get\_current\_user()](wp_get_current_user) wp-includes/pluggable.php | Retrieves the current user object. |
| [wp\_logout\_url()](wp_logout_url) wp-includes/general-template.php | Retrieves the logout URL. |
| [get\_edit\_profile\_url()](get_edit_profile_url) wp-includes/link-template.php | Retrieves the URL to the user’s profile editor. |
| [get\_dashboard\_url()](get_dashboard_url) wp-includes/link-template.php | Retrieves the URL to the user’s dashboard. |
| [WP\_Admin\_Bar::add\_group()](../classes/wp_admin_bar/add_group) wp-includes/class-wp-admin-bar.php | Adds a group to a toolbar menu node. |
| [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\_multisite()](is_multisite) wp-includes/load.php | If Multisite is enabled. |
| [get\_current\_user\_id()](get_current_user_id) wp-includes/user.php | Gets the current user’s ID. |
| Version | Description |
| --- | --- |
| [3.1.0](https://developer.wordpress.org/reference/since/3.1.0/) | Introduced. |
| programming_docs |
wordpress format_to_post( string $content ): string format\_to\_post( string $content ): string
===========================================
This function has been deprecated.
Formerly used to escape strings before inserting into the DB.
Has not performed this function for many, many years. Use [wpdb::prepare()](../classes/wpdb/prepare) instead.
`$content` string Required The text to format. string The very same text.
File: `wp-includes/deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/deprecated.php/)
```
function format_to_post( $content ) {
_deprecated_function( __FUNCTION__, '3.9.0' );
return $content;
}
```
| 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/) | This function has been deprecated. |
| [0.71](https://developer.wordpress.org/reference/since/0.71/) | Introduced. |
wordpress get_comment_author( int|WP_Comment $comment_ID ): string get\_comment\_author( int|WP\_Comment $comment\_ID ): string
============================================================
Retrieves the author of the current comment.
If the comment has an empty comment\_author field, then ‘Anonymous’ person is assumed.
`$comment_ID` int|[WP\_Comment](../classes/wp_comment) Optional [WP\_Comment](../classes/wp_comment) or the ID of the comment for which to retrieve the author.
Default current comment. string The comment author
File: `wp-includes/comment-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/comment-template.php/)
```
function get_comment_author( $comment_ID = 0 ) {
$comment = get_comment( $comment_ID );
$comment_ID = ! empty( $comment->comment_ID ) ? $comment->comment_ID : $comment_ID;
if ( empty( $comment->comment_author ) ) {
$user = ! empty( $comment->user_id ) ? get_userdata( $comment->user_id ) : false;
if ( $user ) {
$author = $user->display_name;
} else {
$author = __( 'Anonymous' );
}
} else {
$author = $comment->comment_author;
}
/**
* Filters the returned comment author name.
*
* @since 1.5.0
* @since 4.1.0 The `$comment_ID` and `$comment` parameters were added.
*
* @param string $author The comment author's username.
* @param string $comment_ID The comment ID as a numeric string.
* @param WP_Comment $comment The comment object.
*/
return apply_filters( 'get_comment_author', $author, $comment_ID, $comment );
}
```
[apply\_filters( 'get\_comment\_author', string $author, string $comment\_ID, WP\_Comment $comment )](../hooks/get_comment_author)
Filters the returned comment author name.
| Uses | Description |
| --- | --- |
| [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. |
| [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\_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\_comment()](../classes/wp_comments_list_table/column_comment) wp-admin/includes/class-wp-comments-list-table.php | |
| [get\_comment\_author\_rss()](get_comment_author_rss) wp-includes/feed.php | Retrieves the current comment author for use in the feeds. |
| [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\_form\_title()](comment_form_title) wp-includes/comment-template.php | Displays text based on comment reply status. |
| [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. |
| [comment\_author()](comment_author) wp-includes/comment-template.php | Displays the author of the current comment. |
| [get\_comment\_author\_link()](get_comment_author_link) wp-includes/comment-template.php | Retrieves the HTML link to the URL of the author 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 wpmu_signup_user( string $user, string $user_email, array $meta = array() ) wpmu\_signup\_user( string $user, string $user\_email, array $meta = array() )
==============================================================================
Records user signup information for future activation.
This function is used when user registration is open but new site registration is not.
`$user` string Required The user's requested login name. `$user_email` string Required The user's email address. `$meta` array Optional Signup meta data. Default: `array()`
File: `wp-includes/ms-functions.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/ms-functions.php/)
```
function wpmu_signup_user( $user, $user_email, $meta = array() ) {
global $wpdb;
// Format data.
$user = preg_replace( '/\s+/', '', sanitize_user( $user, true ) );
$user_email = sanitize_email( $user_email );
$key = substr( md5( time() . wp_rand() . $user_email ), 0, 16 );
/**
* Filters the metadata for a user signup.
*
* The metadata will be serialized prior to storing it in the database.
*
* @since 4.8.0
*
* @param array $meta Signup meta data. Default empty array.
* @param string $user The user's requested login name.
* @param string $user_email The user's email address.
* @param string $key The user's activation key.
*/
$meta = apply_filters( 'signup_user_meta', $meta, $user, $user_email, $key );
$wpdb->insert(
$wpdb->signups,
array(
'domain' => '',
'path' => '',
'title' => '',
'user_login' => $user,
'user_email' => $user_email,
'registered' => current_time( 'mysql', true ),
'activation_key' => $key,
'meta' => serialize( $meta ),
)
);
/**
* Fires after a user's signup information has been written to the database.
*
* @since 4.4.0
*
* @param string $user The user's requested login name.
* @param string $user_email The user's email address.
* @param string $key The user's activation key.
* @param array $meta Signup meta data. Default empty array.
*/
do_action( 'after_signup_user', $user, $user_email, $key, $meta );
}
```
[do\_action( 'after\_signup\_user', string $user, string $user\_email, string $key, array $meta )](../hooks/after_signup_user)
Fires after a user’s signup information has been written to the database.
[apply\_filters( 'signup\_user\_meta', array $meta, string $user, string $user\_email, string $key )](../hooks/signup_user_meta)
Filters the metadata for a user signup.
| Uses | Description |
| --- | --- |
| [sanitize\_email()](sanitize_email) wp-includes/formatting.php | Strips out all characters that are not allowable in an email. |
| [sanitize\_user()](sanitize_user) wp-includes/formatting.php | Sanitizes a username, stripping out unsafe characters. |
| [wp\_rand()](wp_rand) wp-includes/pluggable.php | Generates a random non-negative number. |
| [current\_time()](current_time) wp-includes/functions.php | Retrieves the current time based on specified type. |
| [wpdb::insert()](../classes/wpdb/insert) wp-includes/class-wpdb.php | Inserts a row into the table. |
| [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 |
| --- | --- |
| [validate\_user\_signup()](validate_user_signup) wp-signup.php | Validates the new user sign-up. |
| Version | Description |
| --- | --- |
| [MU (3.0.0)](https://developer.wordpress.org/reference/since/mu.3.0.0/) | Introduced. |
wordpress user_can_edit_user( int $user_id, int $other_user ): bool user\_can\_edit\_user( int $user\_id, int $other\_user ): bool
==============================================================
This function has been deprecated. Use [current\_user\_can()](current_user_can) instead.
Can user can edit other user.
* [current\_user\_can()](current_user_can)
`$user_id` int Required `$other_user` int Required bool
File: `wp-includes/deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/deprecated.php/)
```
function user_can_edit_user($user_id, $other_user) {
_deprecated_function( __FUNCTION__, '2.0.0', 'current_user_can()' );
$user = get_userdata($user_id);
$other = get_userdata($other_user);
if ( $user->user_level > $other->user_level || $user->user_level > 8 || $user->ID == $other->ID )
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. |
| 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 is_date(): bool is\_date(): bool
================
Determines whether the query is for an existing date 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 date archive.
File: `wp-includes/query.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/query.php/)
```
function is_date() {
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_date();
}
```
| Uses | Description |
| --- | --- |
| [WP\_Query::is\_date()](../classes/wp_query/is_date) wp-includes/class-wp-query.php | Is the query for an existing date 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 |
| --- | --- |
| [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 |
| --- | --- |
| [1.5.0](https://developer.wordpress.org/reference/since/1.5.0/) | Introduced. |
wordpress wp_referer_field( bool $echo = true ): string wp\_referer\_field( bool $echo = true ): string
===============================================
Retrieves or displays referer hidden field for forms.
The referer link is the current Request URI from the server super global. The input name is ‘\_wp\_http\_referer’, in case you wanted to check manually.
`$echo` bool Optional Whether to echo or return the referer field. Default: `true`
string Referer field HTML markup.
File: `wp-includes/functions.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/functions.php/)
```
function wp_referer_field( $echo = true ) {
$request_url = remove_query_arg( '_wp_http_referer' );
$referer_field = '<input type="hidden" name="_wp_http_referer" value="' . esc_url( $request_url ) . '" />';
if ( $echo ) {
echo $referer_field;
}
return $referer_field;
}
```
| Uses | Description |
| --- | --- |
| [remove\_query\_arg()](remove_query_arg) wp-includes/functions.php | Removes an item or items from a query string. |
| [esc\_url()](esc_url) wp-includes/formatting.php | Checks and cleans a URL. |
| Used By | Description |
| --- | --- |
| [WP\_Plugin\_Install\_List\_Table::display\_tablenav()](../classes/wp_plugin_install_list_table/display_tablenav) wp-admin/includes/class-wp-plugin-install-list-table.php | |
| [wp\_nonce\_field()](wp_nonce_field) wp-includes/functions.php | Retrieves or display nonce hidden field for forms. |
| Version | Description |
| --- | --- |
| [2.0.4](https://developer.wordpress.org/reference/since/2.0.4/) | Introduced. |
wordpress the_author_ID() the\_author\_ID()
=================
This function has been deprecated. Use [the\_author\_meta()](the_author_meta) instead.
Display the ID 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_ID() {
_deprecated_function( __FUNCTION__, '2.8.0', 'the_author_meta(\'ID\')' );
the_author_meta('ID');
}
```
| 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_enqueue_script( string $handle, string $src = '', string[] $deps = array(), string|bool|null $ver = false, bool $in_footer = false ) wp\_enqueue\_script( string $handle, string $src = '', string[] $deps = array(), string|bool|null $ver = false, bool $in\_footer = false )
==========================================================================================================================================
Enqueue a script.
Registers the script if $src provided (does NOT overwrite), and enqueues it.
* [WP\_Dependencies::add()](../classes/wp_dependencies/add)
* [WP\_Dependencies::add\_data()](../classes/wp_dependencies/add_data)
* [WP\_Dependencies::enqueue()](../classes/wp_dependencies/enqueue)
`$handle` string Required Name of the script. Should be unique. `$src` string Optional Full URL of the script, or path of the script relative to the WordPress root directory.
Default: `''`
`$deps` string[] Optional An array of registered script handles this script depends on. Default: `array()`
`$ver` string|bool|null Optional String specifying script version number, if it has one, which is added to the URL as a query string for cache busting purposes. If version is set to false, a version number is automatically added equal to current installed WordPress version.
If set to null, no version is added. Default: `false`
`$in_footer` bool Optional Whether to enqueue the script before `</body>` instead of in the `<head>`.
Default `'false'`. Default: `false`
```
wp_enqueue_script( $handle, $src, $deps, $ver, $in_footer );
```
Links a script file to the generated page at the right time according to the script dependencies, if the script has not been already included and if all the dependencies have been registered. You could either link a script with a handle previously registered using the [wp\_register\_script()](wp_register_script) function, or provide this function with all the parameters necessary to link a script.
This is the recommended method of linking JavaScript to a WordPress generated page.
* The function should be called using the [wp\_enqueue\_scripts](https://codex.wordpress.org/Plugin_API/Action_Reference/wp_enqueue_scripts "Plugin API/Action Reference/wp enqueue scripts") action hook if you want to call it on the front-end of the site, like in the examples above. To call it on the administration screens, use the [admin\_enqueue\_scripts](../hooks/admin_enqueue_scripts "Plugin API/Action Reference/admin enqueue scripts") action hook. For the login screen, use the [login\_enqueue\_scripts](../hooks/login_enqueue_scripts "Plugin API/Action Reference/login enqueue scripts") action hook. Calling it outside of an action hook can lead to problems, see the [ticket #11526](https://core.trac.wordpress.org/ticket/11526) for details.
* If you try to register or enqueue an already registered handle with different parameters, the new parameters will be ignored. Instead, use [wp\_deregister\_script()](wp_deregister_script) and register the script again with the new parameters.
* jQuery UI Effects is **not** included with the *jquery-ui-core* handle.
* This function relies on the use of [wp\_head()](wp_head) and [wp\_footer()](wp_footer) by the active theme. This means that it may not work with a few very old themes that do not call these functions. This is useful to keep in mind when debugging ancient themes.
* Uses: WP\_Scripts::add(), WP\_Scripts::add\_data() and WP\_Scripts::enqueue().
* Uses global: (unknown type) $wp\_scripts.
By default, WordPress installation includes many popular javascript libraries and scripts commonly used by web developers besides the scripts used by WordPress itself. Some of them are listed in the table below.
For a detailed list of names that can be used in place of the `$handle` parameter, see [wp\_register\_script()](wp_register_script) .
| **Script Name** | **Handle** | **Needed Dependency \*** | **Script version** | **License** |
| --- | --- | --- | --- | --- |
| [Image Cropper](https://www.defusion.org.uk/) | Image cropper (not used in core, see jcrop) | | | |
| [Jcrop](https://deepliquid.com/content/Jcrop.html) | jcrop | | 0.9.12 | MIT |
| [SWFObject](https://code.google.com/p/swfobject/) | swfobject | | 2.2-20120417 | MIT |
| [SWFUpload](https://swfupload.org/) | swfupload | | 2201-20110113 | MIT |
| [SWFUpload Degrade](https://swfupload.org/) | swfupload-degrade | | 2201 | MIT |
| [SWFUpload Queue](https://swfupload.org/) | swfupload-queue | | 2201 | MIT |
| [SWFUpload Handlers](https://swfupload.org/) | swfupload-handlers | | 2201-20110524 | MIT |
| [jQuery](https://jquery.com/) | jquery | json2 (for AJAX calls) | 3.6.0 | MIT + (MIT OR BSD) |
| [jQuery Form](https://plugins.jquery.com/project/form/) | jquery-form | jquery | 4.3.0 | MIT OR LGPLv3 |
| [jQuery Color](https://plugins.jquery.com/project/color/) | jquery-color | jquery | 2.2.0 | MIT+CC0 + (MIT OR GPLv2) |
| [jQuery Masonry](https://masonry.desandro.com/) | jquery-masonry | jquery | 3.1.2b | MIT |
| [Masonry (native Javascript)](https://masonry.desandro.com/) | masonry | imagesloaded | 4.2.2 | MIT |
| [jQuery UI Core](https://jqueryui.com/) | jquery-ui-core | jquery | 1.13.1 | MIT + CC0 + (MIT OR GPLv2) |
| [jQuery UI Widget](https://jqueryui.com/widget/) | Now part of `jquery-ui-core` | jquery | 1.13.1 | MIT + CC0 + (MIT OR GPLv2) |
| [jQuery UI Accordion](https://jqueryui.com/demos/accordion/) | jquery-ui-accordion | jquery | 1.13.1 | MIT + CC0 + (MIT OR GPLv2) |
| [jQuery UI Autocomplete](https://jqueryui.com/demos/autocomplete/) | jquery-ui-autocomplete | jquery | 1.13.1 | MIT + CC0 + (MIT OR GPLv2) |
| [jQuery UI Button](https://jqueryui.com/demos/button/) | jquery-ui-button | jquery | 1.13.1 | MIT + CC0 + (MIT OR GPLv2) |
| [jQuery UI Datepicker](https://jqueryui.com/demos/datepicker/) | jquery-ui-datepicker | jquery | 1.13.1 | MIT + CC0 + (MIT OR GPLv2) |
| [jQuery UI Dialog](https://jqueryui.com/demos/dialog/) | jquery-ui-dialog | jquery | 1.13.1 | MIT + CC0 + (MIT OR GPLv2) |
| [jQuery UI Draggable](https://jqueryui.com/demos/draggable/) | jquery-ui-draggable | jquery | 1.13.1 | MIT + CC0 + (MIT OR GPLv2) |
| [jQuery UI Droppable](https://jqueryui.com/demos/droppable/) | jquery-ui-droppable | jquery | 1.13.1 | MIT + CC0 + (MIT OR GPLv2) |
| [jQuery UI Menu](https://jqueryui.com/menu/) | jquery-ui-menu | jquery | 1.13.1 | MIT + CC0 + (MIT OR GPLv2) |
| [jQuery UI Mouse](https://api.jqueryui.com/mouse/) | jquery-ui-mouse | jquery | 1.13.1 | MIT + CC0 + (MIT OR GPLv2) |
| [jQuery UI Position](https://jqueryui.com/demos/position/) | Now part of `jquery-ui-core` | jquery | 1.13.1 | MIT + CC0 + (MIT OR GPLv2) |
| [jQuery UI Progressbar](https://jqueryui.com/demos/progressbar/) | jquery-ui-progressbar | jquery | 1.13.1 | MIT + CC0 + (MIT OR GPLv2) |
| [jQuery UI Selectable](https://jqueryui.com/demos/selectable/) | jquery-ui-selectable | jquery | 1.13.1 | MIT + CC0 + (MIT OR GPLv2) |
| [jQuery UI Resizable](https://jqueryui.com/demos/resizable/) | jquery-ui-resizable | jquery | 1.13.1 | MIT + CC0 + (MIT OR GPLv2) |
| [jQuery UI Selectmenu](https://jqueryui.com/selectmenu/) | jquery-ui-selectmenu | jquery | 1.13.1 | MIT + CC0 + (MIT OR GPLv2) |
| [jQuery UI Sortable](https://jqueryui.com/demos/sortable/) | jquery-ui-sortable | jquery | 1.13.1 | MIT + CC0 + (MIT OR GPLv2) |
| [jQuery UI Slider](https://jqueryui.com/demos/slider/) | jquery-ui-slider | jquery | 1.13.1 | MIT + CC0 + (MIT OR GPLv2) |
| [jQuery UI Spinner](https://jqueryui.com/demos/spinner/) | jquery-ui-spinner | jquery | 1.13.1 | MIT + CC0 + (MIT OR GPLv2) |
| [jQuery UI Tooltips](https://jqueryui.com/demos/tooltip/) | jquery-ui-tooltip | jquery | 1.13.1 | MIT + CC0 + (MIT OR GPLv2) |
| [jQuery UI Tabs](https://jqueryui.com/demos/tabs/) | jquery-ui-tabs | jquery | 1.13.1 | MIT + CC0 + (MIT OR GPLv2) |
| [jQuery UI Effects](https://jqueryui.com/effect/) | jquery-effects-core | jquery | 1.13.1 | MIT + CC0 + (MIT OR GPLv2) |
| [jQuery UI Effects – Blind](https://jqueryui.com/effect/) | jquery-effects-blind | jquery-effects-core | 1.13.1 | MIT + CC0 + (MIT OR GPLv2) |
| [jQuery UI Effects – Bounce](https://jqueryui.com/effect/) | jquery-effects-bounce | jquery-effects-core | 1.13.1 | MIT + CC0 + (MIT OR GPLv2) |
| [jQuery UI Effects – Clip](https://jqueryui.com/effect/) | jquery-effects-clip | jquery-effects-core | 1.13.1 | MIT + CC0 + (MIT OR GPLv2) |
| [jQuery UI Effects – Drop](https://jqueryui.com/effect/) | jquery-effects-drop | jquery-effects-core | 1.13.1 | MIT + CC0 + (MIT OR GPLv2) |
| [jQuery UI Effects – Explode](https://jqueryui.com/effect/) | jquery-effects-explode | jquery-effects-core | 1.13.1 | MIT + CC0 + (MIT OR GPLv2) |
| [jQuery UI Effects – Fade](https://jqueryui.com/effect/) | jquery-effects-fade | jquery-effects-core | 1.13.1 | MIT + CC0 + (MIT OR GPLv2) |
| [jQuery UI Effects – Fold](https://jqueryui.com/effect/) | jquery-effects-fold | jquery-effects-core | 1.13.1 | MIT + CC0 + (MIT OR GPLv2) |
| [jQuery UI Effects – Highlight](https://jqueryui.com/effect/) | jquery-effects-highlight | jquery-effects-core | 1.13.1 | MIT + CC0 + (MIT OR GPLv2) |
| [jQuery UI Effects – Pulsate](https://jqueryui.com/effect/) | jquery-effects-pulsate | jquery-effects-core | 1.13.1 | MIT + CC0 + (MIT OR GPLv2) |
| [jQuery UI Effects – Scale](https://jqueryui.com/effect/) | jquery-effects-scale | jquery-effects-core | 1.13.1 | MIT + CC0 + (MIT OR GPLv2) |
| [jQuery UI Effects – Shake](https://jqueryui.com/effect/) | jquery-effects-shake | jquery-effects-core | 1.13.1 | MIT + CC0 + (MIT OR GPLv2) |
| [jQuery UI Effects – Slide](https://jqueryui.com/effect/) | jquery-effects-slide | jquery-effects-core | 1.13.1 | MIT + CC0 + (MIT OR GPLv2) |
| [jQuery UI Effects – Transfer](https://jqueryui.com/effect/) | jquery-effects-transfer | jquery-effects-core | 1.13.1 | MIT + CC0 + (MIT OR GPLv2) |
| [MediaElement.js (WP 3.6+)](https://mediaelementjs.com/) | wp-mediaelement | jquery | 4.2.16 | MIT |
| [jQuery Schedule](https://trainofthoughts.org/blog/2007/02/15/jquery-plugin-scheduler/) | schedule | jquery | 20m/1.0.1 | MIT |
| [jQuery Suggest](https://web.archive.org/web/20111017233444/https://plugins.jquery.com/project/suggest) | suggest | jquery | 1.1-20110113 | Public domain |
| [ThickBox](https://codex.wordpress.org/ThickBox) | thickbox | | 3.1-20121105 | MIT OR GPLv3 |
| [jQuery HoverIntent](https://cherne.net/brian/resources/jquery.hoverIntent.html) | hoverIntent | jquery | 1.10.1 | MIT |
| [jQuery Hotkeys](https://plugins.jquery.com/project/hotkeys) | jquery-hotkeys | jquery | 0.2.0 | MIT OR GPLv2 |
| [Simple AJAX Code-Kit](https://code.google.com/p/tw-sack/) | sack | | 1.6.1 | X11 License |
| [QuickTags](https://www.alexking.org) | quicktags | | 1.3 | LGPL2.1 |
| [Iris (Colour picker)](https://github.com/automattic/Iris) | iris | jquery | 1.1.1 | GPLv2 |
| [Farbtastic (deprecated)](https://acko.net/dev/farbtastic) | farbtastic | jquery | 1.2 | GPLv3 |
| [ColorPicker (deprecated)](https://mattkruse.com) | colorpicker | jquery | v2 | Author’s own copyright |
| [Tiny MCE](https://tinymce.moxiecode.com/) | wp-tinymce | | 4.9.4 | LGPL2.1 |
| Autosave | autosave | | | |
| WordPress AJAX Response | wp-ajax-response | | | |
| List Manipulation | wp-lists | | | |
| WP Common | common | | | |
| WP Editor | editorremov | | | |
| WP Editor Functions | editor-functions | | | |
| AJAX Cat | ajaxcat | | | |
| Admin Categories | admin-categories | | | |
| Admin Tags | admin-tags | | | |
| Admin custom fields | admin-custom-fields | | | |
| Password Strength Meter | password-strength-meter | | | |
| Admin Comments | admin-comments | | | |
| Admin Users | admin-users | | | |
| Admin Forms | admin-forms | | | |
| XFN | xfn | | | |
| Upload | upload | | | |
| PostBox | postbox | | | |
| Slug | slug | | | |
| Post | post | | | |
| Page | page | | | |
| Link | link | | | |
| Comment | comment | | | |
| Threaded Comments | comment-reply | | | |
| Admin Gallery | admin-gallery | | | |
| Media Upload | media-upload | | | |
| Admin widgets | admin-widgets | | | |
| Word Count | word-count | | | |
| Theme Preview | theme-preview | | | |
| [JSON for JS](https://github.com/douglascrockford/JSON-js) | json2 | | 2015-05-03 | Public domain |
| [Plupload Core](https://www.plupload.com/) | plupload | | 2.1.9 | GPLv2 |
| [Plupload All Runtimes](https://www.plupload.com/example_all_runtimes.php) | plupload-all | | 2.1.1 | GPLv2 |
| [Plupload HTML4](https://www.plupload.com/example_all_runtimes.php) | plupload-html4 | | 2.1.1 | GPLv2 |
| [Plupload HTML5](https://www.plupload.com/example_all_runtimes.php) | plupload-html5 | | 2.1.1 | GPLv2 |
| [Plupload Flash](https://www.plupload.com/example_all_runtimes.php) | plupload-flash | | 2.1.1 | GPLv2 |
| [Plupload Silverlight](https://www.plupload.com/example_all_runtimes.php) | plupload-silverlight | | 2.1.1 | GPLv2 |
| [Underscore js](https://underscorejs.org/) | underscore | | 1.13.1 | MIT |
| [Backbone js](https://backbonejs.org/) | backbone | jquery, underscore | 1.4.0 | MIT |
| [imagesLoaded](https://imagesloaded.desandro.com/) | imagesloaded | | 4.1.4 | MIT |
| [CodeMirror](https://github.com/codemirror/CodeMirror) | wp-codemirror | | 5.29.1-alpha-ee20357 | MIT |
| [imgAreaSelect](http://odyniec.net/projects/imgareaselect/) | imgareaselect | jquery | 0.9.8 | MIT AND GPL |
| **Removed from Core** |
| --- |
| **Script Name** | **Handle** | **Removed Version** | **Replaced With** |
| [Scriptaculous Root](http://script.aculo.us) | scriptaculous-root | WP 3.5 | Google Version |
| [Scriptaculous Builder](http://script.aculo.us) | scriptaculous-builder | WP 3.5 | Google Version |
| [Scriptaculous Drag & Drop](http://script.aculo.us) | scriptaculous-dragdrop | WP 3.5 | Google Version |
| [Scriptaculous Effects](http://script.aculo.us) | scriptaculous-effects | WP 3.5 | Google Version |
| [Scriptaculous Slider](http://script.aculo.us) | scriptaculous-slider | WP 3.5 | Google Version |
| [Scriptaculous](http://script.aculo.us/) Sound | scriptaculous-sound | WP 3.5 | Google Version |
| [Scriptaculous Controls](http://script.aculo.us) | scriptaculous-controls | WP 3.5 | Google Version |
| [Scriptaculous](http://script.aculo.us) | scriptaculous | WP 3.5 | Google Version |
| [Prototype Framework](http://www.prototypejs.org/) | prototype | WP 3.5 | Google Version |
**The list is far from complete.** For a complete list of registered files inspect $GLOBALS['wp\_scripts'] in the admin UI. Registered scripts might change per requested page.
*\* The listed dependencies are not complete.*
File: `wp-includes/functions.wp-scripts.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/functions-wp-scripts.php/)
```
function wp_enqueue_script( $handle, $src = '', $deps = array(), $ver = false, $in_footer = false ) {
_wp_scripts_maybe_doing_it_wrong( __FUNCTION__, $handle );
$wp_scripts = wp_scripts();
if ( $src || $in_footer ) {
$_handle = explode( '?', $handle );
if ( $src ) {
$wp_scripts->add( $_handle[0], $src, $deps, $ver );
}
if ( $in_footer ) {
$wp_scripts->add_data( $_handle[0], 'group', 1 );
}
}
$wp_scripts->enqueue( $handle );
}
```
| Uses | Description |
| --- | --- |
| [wp\_scripts()](wp_scripts) wp-includes/functions.wp-scripts.php | Initialize $wp\_scripts if it has not been set. |
| Used By | Description |
| --- | --- |
| [wp\_maybe\_enqueue\_oembed\_host\_js()](wp_maybe_enqueue_oembed_host_js) wp-includes/embed.php | Enqueue the wp-embed script if the provided oEmbed HTML contains a post embed. |
| [wp\_enqueue\_editor\_format\_library\_assets()](wp_enqueue_editor_format_library_assets) wp-includes/script-loader.php | Enqueues the assets required for the format library within the block editor. |
| [WP\_Block::render()](../classes/wp_block/render) wp-includes/class-wp-block.php | Generates the render output for the block. |
| [wp\_enqueue\_editor\_block\_directory\_assets()](wp_enqueue_editor_block_directory_assets) wp-includes/script-loader.php | Enqueues the assets required for the block directory within the block editor. |
| [enqueue\_editor\_block\_styles\_assets()](enqueue_editor_block_styles_assets) wp-includes/script-loader.php | Function responsible for enqueuing the assets required for block styles functionality on the editor. |
| [wp\_enqueue\_registered\_block\_scripts\_and\_styles()](wp_enqueue_registered_block_scripts_and_styles) wp-includes/script-loader.php | Enqueues registered block scripts and styles, depending on current rendered context (only enqueuing editor scripts while in context of the editor). |
| [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\_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\_enqueue\_code\_editor()](wp_enqueue_code_editor) wp-includes/general-template.php | Enqueues assets needed by the code editor for the given settings. |
| [WP\_Widget\_Media\_Gallery::enqueue\_admin\_scripts()](../classes/wp_widget_media_gallery/enqueue_admin_scripts) wp-includes/widgets/class-wp-widget-media-gallery.php | Loads the required media files for the media manager and scripts for media widgets. |
| [WP\_Widget\_Custom\_HTML::enqueue\_admin\_scripts()](../classes/wp_widget_custom_html/enqueue_admin_scripts) wp-includes/widgets/class-wp-widget-custom-html.php | Loads the required scripts and styles for the widget control. |
| [WP\_Widget\_Text::enqueue\_admin\_scripts()](../classes/wp_widget_text/enqueue_admin_scripts) wp-includes/widgets/class-wp-widget-text.php | Loads the required scripts and styles for the widget control. |
| [WP\_Widget\_Media\_Audio::enqueue\_admin\_scripts()](../classes/wp_widget_media_audio/enqueue_admin_scripts) wp-includes/widgets/class-wp-widget-media-audio.php | Loads the required media files for the media manager and scripts for media widgets. |
| [WP\_Widget\_Media\_Audio::enqueue\_preview\_scripts()](../classes/wp_widget_media_audio/enqueue_preview_scripts) wp-includes/widgets/class-wp-widget-media-audio.php | Enqueue preview scripts. |
| [WP\_Widget\_Media\_Video::enqueue\_preview\_scripts()](../classes/wp_widget_media_video/enqueue_preview_scripts) wp-includes/widgets/class-wp-widget-media-video.php | Enqueue preview scripts. |
| [WP\_Widget\_Media\_Video::enqueue\_admin\_scripts()](../classes/wp_widget_media_video/enqueue_admin_scripts) wp-includes/widgets/class-wp-widget-media-video.php | Loads the required scripts and styles for the widget control. |
| [WP\_Widget\_Media::enqueue\_admin\_scripts()](../classes/wp_widget_media/enqueue_admin_scripts) wp-includes/widgets/class-wp-widget-media.php | Loads the required scripts and styles for the widget control. |
| [WP\_Widget\_Media\_Image::enqueue\_admin\_scripts()](../classes/wp_widget_media_image/enqueue_admin_scripts) wp-includes/widgets/class-wp-widget-media-image.php | Loads the required media files for the media manager and scripts for media widgets. |
| [the\_custom\_header\_markup()](the_custom_header_markup) wp-includes/theme.php | Prints the markup for a custom header. |
| [WP\_Customize\_Selective\_Refresh::enqueue\_preview\_scripts()](../classes/wp_customize_selective_refresh/enqueue_preview_scripts) wp-includes/customize/class-wp-customize-selective-refresh.php | Enqueues preview scripts. |
| [WP\_Customize\_Cropped\_Image\_Control::enqueue()](../classes/wp_customize_cropped_image_control/enqueue) wp-includes/customize/class-wp-customize-cropped-image-control.php | Enqueue control related scripts/styles. |
| [WP\_Customize\_Nav\_Menus::customize\_preview\_enqueue\_deps()](../classes/wp_customize_nav_menus/customize_preview_enqueue_deps) wp-includes/class-wp-customize-nav-menus.php | Enqueues scripts for the Customizer preview. |
| [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\_dashboard\_setup()](wp_dashboard_setup) wp-admin/includes/dashboard.php | Registers dashboard widgets. |
| [WP\_Internal\_Pointers::enqueue\_scripts()](../classes/wp_internal_pointers/enqueue_scripts) wp-admin/includes/class-wp-internal-pointers.php | Initializes the new feature pointers. |
| [do\_accordion\_sections()](do_accordion_sections) wp-admin/includes/template.php | Meta Box Accordion Template Function. |
| [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. |
| [enqueue\_comment\_hotkeys\_js()](enqueue_comment_hotkeys_js) wp-admin/includes/comment.php | Enqueues comment shortcuts jQuery script. |
| [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\_Background::admin\_load()](../classes/custom_background/admin_load) wp-admin/includes/class-custom-background.php | Sets up the enqueue for the CSS & JavaScript files. |
| [WP\_Customize\_Manager::enqueue\_control\_scripts()](../classes/wp_customize_manager/enqueue_control_scripts) wp-includes/class-wp-customize-manager.php | Enqueues scripts for customize controls. |
| [WP\_Customize\_Manager::customize\_preview\_init()](../classes/wp_customize_manager/customize_preview_init) wp-includes/class-wp-customize-manager.php | Prints JavaScript settings. |
| [add\_thickbox()](add_thickbox) wp-includes/general-template.php | Enqueues the default ThickBox js and css. |
| [wp\_auth\_check\_load()](wp_auth_check_load) wp-includes/functions.php | Loads the auth check for monitoring whether the user is still logged in. |
| [WP\_Admin\_Bar::initialize()](../classes/wp_admin_bar/initialize) wp-includes/class-wp-admin-bar.php | Initializes the admin bar. |
| [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\_video\_shortcode()](wp_video_shortcode) wp-includes/media.php | Builds the Video shortcode output. |
| [wp\_playlist\_scripts()](wp_playlist_scripts) wp-includes/media.php | Outputs and enqueues default scripts and styles for playlists. |
| [wp\_audio\_shortcode()](wp_audio_shortcode) wp-includes/media.php | Builds the Audio shortcode output. |
| [WP\_Customize\_Header\_Image\_Control::enqueue()](../classes/wp_customize_header_image_control/enqueue) wp-includes/customize/class-wp-customize-header-image-control.php | |
| [WP\_Customize\_Color\_Control::enqueue()](../classes/wp_customize_color_control/enqueue) wp-includes/customize/class-wp-customize-color-control.php | Enqueue scripts/styles for the color picker. |
| [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::customize\_preview\_enqueue()](../classes/wp_customize_widgets/customize_preview_enqueue) wp-includes/class-wp-customize-widgets.php | Enqueues scripts for the Customizer preview. |
| [\_WP\_Editors::enqueue\_scripts()](../classes/_wp_editors/enqueue_scripts) wp-includes/class-wp-editor.php | |
| Version | Description |
| --- | --- |
| [2.1.0](https://developer.wordpress.org/reference/since/2.1.0/) | Introduced. |
| programming_docs |
wordpress update_site_meta( int $site_id, string $meta_key, mixed $meta_value, mixed $prev_value = '' ): int|bool update\_site\_meta( int $site\_id, string $meta\_key, mixed $meta\_value, mixed $prev\_value = '' ): int|bool
=============================================================================================================
Updates metadata for a site.
Use the $prev\_value parameter to differentiate between meta fields with the same key and site ID.
If the meta field for the site does not exist, it will be added.
`$site_id` int Required Site 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.
File: `wp-includes/ms-site.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/ms-site.php/)
```
function update_site_meta( $site_id, $meta_key, $meta_value, $prev_value = '' ) {
return update_metadata( 'blog', $site_id, $meta_key, $meta_value, $prev_value );
}
```
| Uses | Description |
| --- | --- |
| [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\_upgrade()](wp_upgrade) wp-admin/includes/upgrade.php | Runs WordPress Upgrade functions. |
| Version | Description |
| --- | --- |
| [5.1.0](https://developer.wordpress.org/reference/since/5.1.0/) | Introduced. |
wordpress is_singular( string|string[] $post_types = '' ): bool is\_singular( string|string[] $post\_types = '' ): bool
=======================================================
Determines whether the query is for an existing single post of any post type (post, attachment, page, custom post types).
If the $post\_types parameter is specified, this function will additionally check if the query is for one of the Posts Types 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\_single()](is_single)
`$post_types` string|string[] Optional Post type or array of post types to check against. Default: `''`
bool Whether the query is for an existing single post or any of the given post types.
File: `wp-includes/query.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/query.php/)
```
function is_singular( $post_types = '' ) {
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_singular( $post_types );
}
```
| Uses | Description |
| --- | --- |
| [WP\_Query::is\_singular()](../classes/wp_query/is_singular) wp-includes/class-wp-query.php | Is the query for an existing single post of any post type (post, attachment, page, custom post types)? |
| [\_\_()](__) 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\_Widget\_Text::\_filter\_gallery\_shortcode\_attrs()](../classes/wp_widget_text/_filter_gallery_shortcode_attrs) wp-includes/widgets/class-wp-widget-text.php | Filters gallery shortcode attributes. |
| [WP\_Widget\_Custom\_HTML::\_filter\_gallery\_shortcode\_attrs()](../classes/wp_widget_custom_html/_filter_gallery_shortcode_attrs) wp-includes/widgets/class-wp-widget-custom-html.php | Filters gallery shortcode attributes. |
| [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\_oembed\_add\_discovery\_links()](wp_oembed_add_discovery_links) wp-includes/embed.php | Adds oEmbed discovery links in the head element of the website. |
| [wp\_get\_document\_title()](wp_get_document_title) wp-includes/general-template.php | Returns document title for the current page. |
| [feed\_links\_extra()](feed_links_extra) wp-includes/general-template.php | Displays the links to the extra feeds such as category feeds. |
| [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\_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. |
| [rel\_canonical()](rel_canonical) wp-includes/link-template.php | Outputs rel=canonical for singular queries. |
| [wp\_get\_shortlink()](wp_get_shortlink) wp-includes/link-template.php | Returns a shortlink for a post, page, attachment, or site. |
| [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. |
| [paginate\_comments\_links()](paginate_comments_links) wp-includes/link-template.php | Displays or retrieves pagination links for the comments on the current post. |
| [get\_posts\_nav\_link()](get_posts_nav_link) wp-includes/link-template.php | Retrieves the post pages link navigation for previous and next pages. |
| [is\_page\_template()](is_page_template) wp-includes/post-template.php | Determines whether the current post uses a page 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. |
| [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 |
| --- | --- |
| [1.5.0](https://developer.wordpress.org/reference/since/1.5.0/) | Introduced. |
wordpress wp_get_nav_menu_items( int|string|WP_Term $menu, array $args = array() ): array|false wp\_get\_nav\_menu\_items( int|string|WP\_Term $menu, array $args = array() ): array|false
==========================================================================================
Retrieves all menu items of a navigation menu.
Note: Most arguments passed to the `$args` parameter – save for ‘output\_key’ – are specifically for retrieving nav\_menu\_item posts from [get\_posts()](get_posts) and may only indirectly affect the ultimate ordering and content of the resulting nav menu items that get returned from this function.
`$menu` int|string|[WP\_Term](../classes/wp_term) Required Menu ID, slug, name, or object. `$args` array Optional Arguments to pass to [get\_posts()](get_posts) .
* `order`stringHow to order nav menu items as queried with [get\_posts()](get_posts) . Will be ignored if `'output'` is ARRAY\_A. Default `'ASC'`.
* `orderby`stringField to order menu items by as retrieved from [get\_posts()](get_posts) . Supply an orderby field via `'output_key'` to affect the output order of nav menu items.
Default `'menu_order'`.
* `post_type`stringMenu items post type. Default `'nav_menu_item'`.
* `post_status`stringMenu items post status. Default `'publish'`.
* `output`stringHow to order outputted menu items. Default ARRAY\_A.
* `output_key`stringKey to use for ordering the actual menu items that get returned. Note that that is not a [get\_posts()](get_posts) argument and will only affect output of menu items processed in this function. Default `'menu_order'`.
* `nopaging`boolWhether to retrieve all menu items (true) or paginate (false). Default true.
More Arguments from get\_posts( ... $args ) Array or string of Query parameters.
* `attachment_id`intAttachment post ID. Used for `'attachment'` post\_type.
* `author`int|stringAuthor ID, or comma-separated list of IDs.
* `author_name`stringUser `'user_nicename'`.
* `author__in`int[]An array of author IDs to query from.
* `author__not_in`int[]An array of author IDs not to query from.
* `cache_results`boolWhether to cache post information. Default true.
* `cat`int|stringCategory ID or comma-separated list of IDs (this or any children).
* `category__and`int[]An array of category IDs (AND in).
* `category__in`int[]An array of category IDs (OR in, no children).
* `category__not_in`int[]An array of category IDs (NOT in).
* `category_name`stringUse category slug (not name, this or any children).
* `comment_count`array|intFilter results by comment count. Provide an integer to match comment count exactly. Provide an array with integer `'value'` and `'compare'` operator (`'='`, `'!='`, `'>'`, `'>='`, `'<'`, `'<='` ) to compare against comment\_count in a specific way.
* `comment_status`stringComment status.
* `comments_per_page`intThe number of comments to return per page.
Default `'comments_per_page'` option.
* `date_query`arrayAn associative array of [WP\_Date\_Query](../classes/wp_date_query) arguments.
See [WP\_Date\_Query::\_\_construct()](../classes/wp_date_query/__construct).
* `day`intDay of the month. Accepts numbers 1-31.
* `exact`boolWhether to search by exact keyword. Default false.
* `fields`stringPost fields to query for. Accepts:
+ `''` Returns an array of complete post objects (`WP_Post[]`).
+ `'ids'` Returns an array of post IDs (`int[]`).
+ `'id=>parent'` Returns an associative array of parent post IDs, keyed by post ID (`int[]`). Default `''`.
* `hour`intHour of the day. Accepts numbers 0-23.
* `ignore_sticky_posts`int|boolWhether to ignore sticky posts or not. Setting this to false excludes stickies from `'post__in'`. Accepts `1|true`, `0|false`.
Default false.
* `m`intCombination YearMonth. Accepts any four-digit year and month numbers 01-12.
* `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.
* `menu_order`intThe menu order of the posts.
* `minute`intMinute of the hour. Accepts numbers 0-59.
* `monthnum`intThe two-digit month. Accepts numbers 1-12.
* `name`stringPost slug.
* `nopaging`boolShow all posts (true) or paginate (false). Default false.
* `no_found_rows`boolWhether to skip counting the total rows found. Enabling can improve performance. Default false.
* `offset`intThe number of posts to offset before retrieval.
* `order`stringDesignates ascending or descending order of posts. Default `'DESC'`.
Accepts `'ASC'`, `'DESC'`.
* `orderby`string|arraySort retrieved posts by parameter. One or more options may be passed.
To use `'meta_value'`, or `'meta_value_num'`, `'meta_key=keyname'` must be also be defined. To sort by a specific `$meta_query` clause, use that clause's array key. Accepts:
+ `'none'`
+ `'name'`
+ `'author'`
+ `'date'`
+ `'title'`
+ `'modified'`
+ `'menu_order'`
+ `'parent'`
+ `'ID'`
+ `'rand'`
+ `'relevance'`
+ `'RAND(x)'` (where `'x'` is an integer seed value)
+ `'comment_count'`
+ `'meta_value'`
+ `'meta_value_num'`
+ `'post__in'`
+ `'post_name__in'`
+ `'post_parent__in'`
+ The array keys of `$meta_query`. Default is `'date'`, except when a search is being performed, when the default is `'relevance'`.
* `p`intPost ID.
* `page`intShow the number of posts that would show up on page X of a static front page.
* `paged`intThe number of the current page.
* `page_id`intPage ID.
* `pagename`stringPage slug.
* `perm`stringShow posts if user has the appropriate capability.
* `ping_status`stringPing status.
* `post__in`int[]An array of post IDs to retrieve, sticky posts will be included.
* `post__not_in`int[]An array of post IDs not to retrieve. Note: a string of comma- separated IDs will NOT work.
* `post_mime_type`stringThe mime type of the post. Used for `'attachment'` post\_type.
* `post_name__in`string[]An array of post slugs that results must match.
* `post_parent`intPage ID to retrieve child pages for. Use 0 to only retrieve top-level pages.
* `post_parent__in`int[]An array containing parent page IDs to query child pages from.
* `post_parent__not_in`int[]An array containing parent page IDs not to query child pages from.
* `post_type`string|string[]A post type slug (string) or array of post type slugs.
Default `'any'` if using `'tax_query'`.
* `post_status`string|string[]A post status (string) or array of post statuses.
* `posts_per_page`intThe number of posts to query for. Use -1 to request all posts.
* `posts_per_archive_page`intThe number of posts to query for by archive page. Overrides `'posts_per_page'` when [is\_archive()](is_archive) , or [is\_search()](is_search) are true.
* `s`stringSearch keyword(s). Prepending a term with a hyphen will exclude posts matching that term. Eg, 'pillow -sofa' will return posts containing `'pillow'` but not `'sofa'`. The character used for exclusion can be modified using the the `'wp_query_search_exclusion_prefix'` filter.
* `second`intSecond of the minute. Accepts numbers 0-59.
* `sentence`boolWhether to search by phrase. Default false.
* `suppress_filters`boolWhether to suppress filters. Default false.
* `tag`stringTag slug. Comma-separated (either), Plus-separated (all).
* `tag__and`int[]An array of tag IDs (AND in).
* `tag__in`int[]An array of tag IDs (OR in).
* `tag__not_in`int[]An array of tag IDs (NOT in).
* `tag_id`intTag id or comma-separated list of IDs.
* `tag_slug__and`string[]An array of tag slugs (AND in).
* `tag_slug__in`string[]An array of tag slugs (OR in). unless `'ignore_sticky_posts'` is true. Note: a string of comma-separated IDs will NOT work.
* `tax_query`arrayAn associative array of [WP\_Tax\_Query](../classes/wp_tax_query) arguments.
See [WP\_Tax\_Query::\_\_construct()](../classes/wp_tax_query/__construct).
* `title`stringPost title.
* `update_post_meta_cache`boolWhether to update the post meta cache. Default true.
* `update_post_term_cache`boolWhether to update the post term cache. Default true.
* `update_menu_item_cache`boolWhether to update the menu item cache. Default false.
* `lazy_load_term_meta`boolWhether to lazy-load term meta. Setting to false will disable cache priming for term meta, so that each [get\_term\_meta()](get_term_meta) call will hit the database.
Defaults to the value of `$update_post_term_cache`.
* `w`intThe week number of the year. Accepts numbers 0-53.
* `year`intThe four-digit year. Accepts any four-digit year.
Default: `array()`
array|false Array of menu items, otherwise false.
File: `wp-includes/nav-menu.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/nav-menu.php/)
```
function wp_get_nav_menu_items( $menu, $args = array() ) {
$menu = wp_get_nav_menu_object( $menu );
if ( ! $menu ) {
return false;
}
if ( ! taxonomy_exists( 'nav_menu' ) ) {
return false;
}
$defaults = array(
'order' => 'ASC',
'orderby' => 'menu_order',
'post_type' => 'nav_menu_item',
'post_status' => 'publish',
'output' => ARRAY_A,
'output_key' => 'menu_order',
'nopaging' => true,
'update_menu_item_cache' => true,
'tax_query' => array(
array(
'taxonomy' => 'nav_menu',
'field' => 'term_taxonomy_id',
'terms' => $menu->term_taxonomy_id,
),
),
);
$args = wp_parse_args( $args, $defaults );
if ( $menu->count > 0 ) {
$items = get_posts( $args );
} else {
$items = array();
}
$items = array_map( 'wp_setup_nav_menu_item', $items );
if ( ! is_admin() ) { // Remove invalid items only on front end.
$items = array_filter( $items, '_is_valid_nav_menu_item' );
}
if ( ARRAY_A === $args['output'] ) {
$items = wp_list_sort(
$items,
array(
$args['output_key'] => 'ASC',
)
);
$i = 1;
foreach ( $items as $k => $item ) {
$items[ $k ]->{$args['output_key']} = $i++;
}
}
/**
* Filters the navigation menu items being returned.
*
* @since 3.0.0
*
* @param array $items An array of menu item post objects.
* @param object $menu The menu object.
* @param array $args An array of arguments used to retrieve menu item objects.
*/
return apply_filters( 'wp_get_nav_menu_items', $items, $menu, $args );
}
```
[apply\_filters( 'wp\_get\_nav\_menu\_items', array $items, object $menu, array $args )](../hooks/wp_get_nav_menu_items)
Filters the navigation menu items being returned.
| Uses | Description |
| --- | --- |
| [wp\_list\_sort()](wp_list_sort) wp-includes/functions.php | Sorts an array of objects or arrays based on one or more orderby arguments. |
| [taxonomy\_exists()](taxonomy_exists) wp-includes/taxonomy.php | Determines whether the taxonomy name exists. |
| [get\_posts()](get_posts) wp-includes/post.php | Retrieves an array of the latest posts, or posts matching the given criteria. |
| [wp\_get\_nav\_menu\_object()](wp_get_nav_menu_object) wp-includes/nav-menu.php | Returns a navigation menu object. |
| [is\_admin()](is_admin) wp-includes/load.php | Determines whether the current request is for an administrative interface page. |
| [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\_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\_nav\_menu\_update\_menu\_items()](wp_nav_menu_update_menu_items) wp-admin/includes/nav-menu.php | Saves nav menu items |
| [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\_nav\_menu()](wp_nav_menu) wp-includes/nav-menu-template.php | Displays a navigation menu. |
| [\_wp\_auto\_add\_pages\_to\_menu()](_wp_auto_add_pages_to_menu) wp-includes/nav-menu.php | Automatically add newly published page objects to menus with that as an option. |
| [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 |
| --- | --- |
| [3.0.0](https://developer.wordpress.org/reference/since/3.0.0/) | Introduced. |
| programming_docs |
wordpress wp_send_user_request( string $request_id ): true|WP_Error wp\_send\_user\_request( string $request\_id ): true|WP\_Error
==============================================================
Send a confirmation request email to confirm an action.
If the request is not already pending, it will be updated.
`$request_id` string Required ID of the request created via [wp\_create\_user\_request()](wp_create_user_request) . true|[WP\_Error](../classes/wp_error) True on success, `WP_Error` on failure.
File: `wp-includes/user.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/user.php/)
```
function wp_send_user_request( $request_id ) {
$request_id = absint( $request_id );
$request = wp_get_user_request( $request_id );
if ( ! $request ) {
return new WP_Error( 'invalid_request', __( 'Invalid personal data request.' ) );
}
// Localize message content for user; fallback to site default for visitors.
if ( ! empty( $request->user_id ) ) {
$locale = get_user_locale( $request->user_id );
} else {
$locale = get_locale();
}
$switched_locale = switch_to_locale( $locale );
$email_data = array(
'request' => $request,
'email' => $request->email,
'description' => wp_user_request_action_description( $request->action_name ),
'confirm_url' => add_query_arg(
array(
'action' => 'confirmaction',
'request_id' => $request_id,
'confirm_key' => wp_generate_user_request_key( $request_id ),
),
wp_login_url()
),
'sitename' => wp_specialchars_decode( get_option( 'blogname' ), ENT_QUOTES ),
'siteurl' => home_url(),
);
/* translators: Confirm privacy data request notification email subject. 1: Site title, 2: Name of the action. */
$subject = sprintf( __( '[%1$s] Confirm Action: %2$s' ), $email_data['sitename'], $email_data['description'] );
/**
* Filters the subject of the email sent when an account action is attempted.
*
* @since 4.9.6
*
* @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 $email The email address this is being sent to.
* @type string $description Description of the action being performed so the user knows what the email is for.
* @type string $confirm_url The link to click on to confirm the account action.
* @type string $sitename The site name sending the mail.
* @type string $siteurl The site URL sending the mail.
* }
*/
$subject = apply_filters( 'user_request_action_email_subject', $subject, $email_data['sitename'], $email_data );
/* translators: Do not translate DESCRIPTION, CONFIRM_URL, SITENAME, SITEURL: those are placeholders. */
$content = __(
'Howdy,
A request has been made to perform the following action on your account:
###DESCRIPTION###
To confirm this, please click on the following link:
###CONFIRM_URL###
You can safely ignore and delete this email if you do not want to
take this action.
Regards,
All at ###SITENAME###
###SITEURL###'
);
/**
* Filters the text of the email sent when an account action is attempted.
*
* The following strings have a special meaning and will get replaced dynamically:
*
* ###DESCRIPTION### Description of the action being performed so the user knows what the email is for.
* ###CONFIRM_URL### The link to click on to confirm the account action.
* ###SITENAME### The name of the site.
* ###SITEURL### The URL to the site.
*
* @since 4.9.6
*
* @param string $content Text in the email.
* @param array $email_data {
* Data relating to the account action email.
*
* @type WP_User_Request $request User request object.
* @type string $email The email address this is being sent to.
* @type string $description Description of the action being performed so the user knows what the email is for.
* @type string $confirm_url The link to click on to confirm the account action.
* @type string $sitename The site name sending the mail.
* @type string $siteurl The site URL sending the mail.
* }
*/
$content = apply_filters( 'user_request_action_email_content', $content, $email_data );
$content = str_replace( '###DESCRIPTION###', $email_data['description'], $content );
$content = str_replace( '###CONFIRM_URL###', sanitize_url( $email_data['confirm_url'] ), $content );
$content = str_replace( '###EMAIL###', $email_data['email'], $content );
$content = str_replace( '###SITENAME###', $email_data['sitename'], $content );
$content = str_replace( '###SITEURL###', sanitize_url( $email_data['siteurl'] ), $content );
$headers = '';
/**
* Filters the headers of the email sent when an account action is attempted.
*
* @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 $email The email address this is being sent to.
* @type string $description Description of the action being performed so the user knows what the email is for.
* @type string $confirm_url The link to click on to confirm the account action.
* @type string $sitename The site name sending the mail.
* @type string $siteurl The site URL sending the mail.
* }
*/
$headers = apply_filters( 'user_request_action_email_headers', $headers, $subject, $content, $request_id, $email_data );
$email_sent = wp_mail( $email_data['email'], $subject, $content, $headers );
if ( $switched_locale ) {
restore_previous_locale();
}
if ( ! $email_sent ) {
return new WP_Error( 'privacy_email_error', __( 'Unable to send personal data export confirmation email.' ) );
}
return true;
}
```
[apply\_filters( 'user\_request\_action\_email\_content', string $content, array $email\_data )](../hooks/user_request_action_email_content)
Filters the text of the email sent when an account action is attempted.
[apply\_filters( 'user\_request\_action\_email\_headers', string|array $headers, string $subject, string $content, int $request\_id, array $email\_data )](../hooks/user_request_action_email_headers)
Filters the headers of the email sent when an account action is attempted.
[apply\_filters( 'user\_request\_action\_email\_subject', string $subject, string $sitename, array $email\_data )](../hooks/user_request_action_email_subject)
Filters the subject of the email sent when an account action is attempted.
| Uses | Description |
| --- | --- |
| [wp\_get\_user\_request()](wp_get_user_request) wp-includes/user.php | Returns the user request object for the specified request ID. |
| [get\_locale()](get_locale) wp-includes/l10n.php | Retrieves the current locale. |
| [sanitize\_url()](sanitize_url) wp-includes/formatting.php | Sanitizes a URL for database or redirect usage. |
| [wp\_login\_url()](wp_login_url) wp-includes/general-template.php | Retrieves the login URL. |
| [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\_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. |
| [get\_user\_locale()](get_user_locale) wp-includes/l10n.php | Retrieves the locale of a user. |
| [switch\_to\_locale()](switch_to_locale) wp-includes/l10n.php | Switches the translations according to the given locale. |
| [restore\_previous\_locale()](restore_previous_locale) wp-includes/l10n.php | Restores the translations according to the previous locale. |
| [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-includes/l10n.php | Retrieves the translation of $text. |
| [absint()](absint) wp-includes/functions.php | Converts a value to non-negative integer. |
| [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\_option()](get_option) wp-includes/option.php | Retrieves an option value based on an option name. |
| [WP\_Error::\_\_construct()](../classes/wp_error/__construct) wp-includes/class-wp-error.php | Initializes the error. |
| Used By | Description |
| --- | --- |
| [\_wp\_privacy\_resend\_request()](_wp_privacy_resend_request) wp-admin/includes/privacy-tools.php | Resend an existing request and return the result. |
| [\_wp\_personal\_data\_handle\_actions()](_wp_personal_data_handle_actions) wp-admin/includes/privacy-tools.php | Handle list table actions. |
| Version | Description |
| --- | --- |
| [4.9.6](https://developer.wordpress.org/reference/since/4.9.6/) | Introduced. |
wordpress adjacent_posts_rel_link_wp_head() adjacent\_posts\_rel\_link\_wp\_head()
======================================
Displays relational links for the posts adjacent to the current post for single post pages.
This is meant to be attached to actions like ‘wp\_head’. Do not call this directly in plugins or theme templates.
* [adjacent\_posts\_rel\_link()](adjacent_posts_rel_link)
File: `wp-includes/link-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/link-template.php/)
```
function adjacent_posts_rel_link_wp_head() {
if ( ! is_single() || is_attachment() ) {
return;
}
adjacent_posts_rel_link();
}
```
| Uses | Description |
| --- | --- |
| [is\_single()](is_single) wp-includes/query.php | Determines whether the query is for an existing single post. |
| [is\_attachment()](is_attachment) wp-includes/query.php | Determines whether the query is for an existing attachment page. |
| [adjacent\_posts\_rel\_link()](adjacent_posts_rel_link) wp-includes/link-template.php | Displays the relational links for the posts adjacent to the current post. |
| Version | Description |
| --- | --- |
| [5.6.0](https://developer.wordpress.org/reference/since/5.6.0/) | No longer used in core. |
| [3.0.0](https://developer.wordpress.org/reference/since/3.0.0/) | Introduced. |
wordpress comment_excerpt( int|WP_Comment $comment_ID ) comment\_excerpt( int|WP\_Comment $comment\_ID )
================================================
Displays the excerpt of the current comment.
`$comment_ID` int|[WP\_Comment](../classes/wp_comment) Required [WP\_Comment](../classes/wp_comment) or ID of the comment for which to print the excerpt.
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_excerpt( $comment_ID = 0 ) {
$comment = get_comment( $comment_ID );
$comment_excerpt = get_comment_excerpt( $comment );
/**
* Filters the comment excerpt for display.
*
* @since 1.2.0
* @since 4.1.0 The `$comment_ID` parameter was added.
*
* @param string $comment_excerpt The comment excerpt text.
* @param string $comment_ID The comment ID as a numeric string.
*/
echo apply_filters( 'comment_excerpt', $comment_excerpt, $comment->comment_ID );
}
```
[apply\_filters( 'comment\_excerpt', string $comment\_excerpt, string $comment\_ID )](../hooks/comment_excerpt)
Filters the comment excerpt for display.
| Uses | Description |
| --- | --- |
| [get\_comment\_excerpt()](get_comment_excerpt) wp-includes/comment-template.php | Retrieves the excerpt of the given 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\_dashboard\_recent\_comments\_row()](_wp_dashboard_recent_comments_row) wp-admin/includes/dashboard.php | Outputs a row for the Recent Comments widget. |
| 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.2.0](https://developer.wordpress.org/reference/since/1.2.0/) | Introduced. |
wordpress wp_kses_js_entities( string $content ): string wp\_kses\_js\_entities( string $content ): string
=================================================
This function has been deprecated. Officially dropped security support for Netscape 4 instead.
Removes the HTML JavaScript entities found in early versions of Netscape 4.
Previously, this function was pulled in from the original import of kses and removed a specific vulnerability only existent in early version of Netscape 4. However, this vulnerability never affected any other browsers and can be considered safe for the modern web.
The regular expression which sanitized this vulnerability has been removed in consideration of the performance and energy demands it placed, now merely passing through its input to the return.
`$content` string Required string
File: `wp-includes/deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/deprecated.php/)
```
function wp_kses_js_entities( $content ) {
_deprecated_function( __FUNCTION__, '4.7.0' );
return preg_replace( '%&\s*\{[^}]*(\}\s*;?|$)%', '', $content );
}
```
| 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/) | Officially dropped security support for Netscape 4. |
| [1.0.0](https://developer.wordpress.org/reference/since/1.0.0/) | Introduced. |
wordpress _resolve_home_block_template(): array|null \_resolve\_home\_block\_template(): 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.
Returns the correct template for the site’s home page.
array|null A template object, or null if none could be found.
File: `wp-includes/block-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/block-template.php/)
```
function _resolve_home_block_template() {
$show_on_front = get_option( 'show_on_front' );
$front_page_id = get_option( 'page_on_front' );
if ( 'page' === $show_on_front && $front_page_id ) {
return array(
'postType' => 'page',
'postId' => $front_page_id,
);
}
$hierarchy = array( 'front-page', 'home', 'index' );
$template = resolve_block_template( 'home', $hierarchy, '' );
if ( ! $template ) {
return null;
}
return array(
'postType' => 'wp_template',
'postId' => $template->id,
);
}
```
| Uses | Description |
| --- | --- |
| [resolve\_block\_template()](resolve_block_template) wp-includes/block-template.php | Returns the correct ‘wp\_template’ to render for the request template type. |
| [get\_option()](get_option) wp-includes/option.php | Retrieves an option value based on an option name. |
| Version | Description |
| --- | --- |
| [6.0.0](https://developer.wordpress.org/reference/since/6.0.0/) | Introduced. |
wordpress check_admin_referer( int|string $action = -1, string $query_arg = '_wpnonce' ): int|false check\_admin\_referer( int|string $action = -1, string $query\_arg = '\_wpnonce' ): int|false
=============================================================================================
Ensures intent by verifying that a user was referred from another admin page with the correct security nonce.
This function ensures the user intends to perform a given action, which helps protect against clickjacking style attacks. It verifies intent, not authorisation, therefore it does not verify the user’s capabilities. This should be performed with `current_user_can()` or similar.
If the nonce value is invalid, the function will exit with an "Are You Sure?" style message.
`$action` int|string Optional The nonce action. Default: `-1`
`$query_arg` string Optional Key to check for nonce in `$_REQUEST`. Default `'_wpnonce'`. Default: `'_wpnonce'`
int|false 1 if the nonce is valid and generated between 0-12 hours ago, 2 if the nonce is valid and generated between 12-24 hours ago.
False if the nonce is invalid.
* Using the function without the `$action` argument is obsolete and, as of [Version 3.2](https://wordpress.org/support/wordpress-version/version-3-2/), if [`WP_DEBUG`](https://wordpress.org/support/article/debugging-in-wordpress/#wp_debug) is set to `true`, the function will die with an appropriate message (“*You should specify a nonce action to be verified by using the first parameter.*” is the default).
* As of [2.0.1](https://wordpress.org/support/wordpress-version/version-2-0-1/), the referer is checked *only* if the `$action` argument is not specified (or set to the default *-1*) as a backward compatibility fallback for not using a nonce. A nonce is prefered to unreliable referers and with `$action` specified the function behaves the same way as [wp\_verify\_nonce()](wp_verify_nonce) except that it dies after calling [wp\_nonce\_ays()](wp_nonce_ays) if the nonce is not valid or was not sent.
File: `wp-includes/pluggable.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/pluggable.php/)
```
function check_admin_referer( $action = -1, $query_arg = '_wpnonce' ) {
if ( -1 === $action ) {
_doing_it_wrong( __FUNCTION__, __( 'You should specify an action to be verified by using the first parameter.' ), '3.2.0' );
}
$adminurl = strtolower( admin_url() );
$referer = strtolower( wp_get_referer() );
$result = isset( $_REQUEST[ $query_arg ] ) ? wp_verify_nonce( $_REQUEST[ $query_arg ], $action ) : false;
/**
* Fires once the admin request has been validated or not.
*
* @since 1.5.1
*
* @param string $action The nonce action.
* @param false|int $result False if the nonce is invalid, 1 if the nonce is valid and generated between
* 0-12 hours ago, 2 if the nonce is valid and generated between 12-24 hours ago.
*/
do_action( 'check_admin_referer', $action, $result );
if ( ! $result && ! ( -1 === $action && strpos( $referer, $adminurl ) === 0 ) ) {
wp_nonce_ays( $action );
die();
}
return $result;
}
```
[do\_action( 'check\_admin\_referer', string $action, false|int $result )](../hooks/check_admin_referer)
Fires once the admin request has been validated or not.
| Uses | Description |
| --- | --- |
| [wp\_verify\_nonce()](wp_verify_nonce) wp-includes/pluggable.php | Verifies that a correct security nonce was used with time limit. |
| [wp\_nonce\_ays()](wp_nonce_ays) wp-includes/functions.php | Displays “Are You Sure” message to confirm the action being taken. |
| [wp\_get\_referer()](wp_get_referer) wp-includes/functions.php | Retrieves referer from ‘\_wp\_http\_referer’ or HTTP referer. |
| [\_\_()](__) 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. |
| [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 |
| --- | --- |
| [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\_Privacy\_Requests\_Table::process\_bulk\_action()](../classes/wp_privacy_requests_table/process_bulk_action) wp-admin/includes/class-wp-privacy-requests-table.php | Process bulk actions. |
| [\_wp\_personal\_data\_handle\_actions()](_wp_personal_data_handle_actions) wp-admin/includes/privacy-tools.php | Handle list table actions. |
| [set\_screen\_options()](set_screen_options) wp-admin/includes/misc.php | Saves option for number of rows when listing posts, pages, comments, etc. |
| [wp\_dashboard\_setup()](wp_dashboard_setup) wp-admin/includes/dashboard.php | Registers dashboard widgets. |
| [media\_upload\_form\_handler()](media_upload_form_handler) wp-admin/includes/media.php | Handles form submissions for the legacy media uploader. |
| [wp\_media\_upload\_handler()](wp_media_upload_handler) wp-admin/includes/media.php | Handles the process of uploading media. |
| [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::take\_action()](../classes/custom_image_header/take_action) wp-admin/includes/class-custom-image-header.php | Execute custom header modification. |
| [Custom\_Background::take\_action()](../classes/custom_background/take_action) wp-admin/includes/class-custom-background.php | Executes custom background modification. |
| [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.5.0](https://developer.wordpress.org/reference/since/2.5.0/) | The `$query_arg` parameter was added. |
| [1.2.0](https://developer.wordpress.org/reference/since/1.2.0/) | Introduced. |
| programming_docs |
wordpress rest_is_object( mixed $maybe_object ): bool rest\_is\_object( mixed $maybe\_object ): bool
==============================================
Determines if a given value is object-like.
`$maybe_object` mixed Required The value being evaluated. bool True if object like, 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_object( $maybe_object ) {
if ( '' === $maybe_object ) {
return true;
}
if ( $maybe_object instanceof stdClass ) {
return true;
}
if ( $maybe_object instanceof JsonSerializable ) {
$maybe_object = $maybe_object->jsonSerialize();
}
return is_array( $maybe_object );
}
```
| Used By | Description |
| --- | --- |
| [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. |
| [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. |
| Version | Description |
| --- | --- |
| [5.5.0](https://developer.wordpress.org/reference/since/5.5.0/) | Introduced. |
wordpress wp_trim_words( string $text, int $num_words = 55, string $more = null ): string wp\_trim\_words( string $text, int $num\_words = 55, string $more = null ): string
==================================================================================
Trims text to a certain number of words.
This function is localized. For languages that count ‘words’ by the individual character (such as East Asian languages), the $num\_words argument will apply to the number of individual characters.
`$text` string Required Text to trim. `$num_words` int Optional Number of words. Default: `55`
`$more` string Optional What to append if $text needs to be trimmed. Default `'…'`. Default: `null`
string Trimmed text.
File: `wp-includes/formatting.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/formatting.php/)
```
function wp_trim_words( $text, $num_words = 55, $more = null ) {
if ( null === $more ) {
$more = __( '…' );
}
$original_text = $text;
$text = wp_strip_all_tags( $text );
$num_words = (int) $num_words;
/*
* 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.
*/
if ( strpos( _x( 'words', 'Word count type. Do not translate!' ), 'characters' ) === 0 && preg_match( '/^utf\-?8$/i', get_option( 'blog_charset' ) ) ) {
$text = trim( preg_replace( "/[\n\r\t ]+/", ' ', $text ), ' ' );
preg_match_all( '/./u', $text, $words_array );
$words_array = array_slice( $words_array[0], 0, $num_words + 1 );
$sep = '';
} else {
$words_array = preg_split( "/[\n\r\t ]+/", $text, $num_words + 1, PREG_SPLIT_NO_EMPTY );
$sep = ' ';
}
if ( count( $words_array ) > $num_words ) {
array_pop( $words_array );
$text = implode( $sep, $words_array );
$text = $text . $more;
} else {
$text = implode( $sep, $words_array );
}
/**
* Filters the text content after words have been trimmed.
*
* @since 3.3.0
*
* @param string $text The trimmed text.
* @param int $num_words The number of words to trim the text to. Default 55.
* @param string $more An optional string to append to the end of the trimmed text, e.g. ….
* @param string $original_text The text before it was trimmed.
*/
return apply_filters( 'wp_trim_words', $text, $num_words, $more, $original_text );
}
```
[apply\_filters( 'wp\_trim\_words', string $text, int $num\_words, string $more, string $original\_text )](../hooks/wp_trim_words)
Filters the text content after words have been trimmed.
| Uses | Description |
| --- | --- |
| [wp\_strip\_all\_tags()](wp_strip_all_tags) wp-includes/formatting.php | Properly strips all HTML tags including script and style |
| [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. |
| [\_x()](_x) wp-includes/l10n.php | Retrieves translated string with gettext context. |
| [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\_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\_Customize\_Nav\_Menu\_Item\_Setting::value\_as\_wp\_post\_nav\_menu\_item()](../classes/wp_customize_nav_menu_item_setting/value_as_wp_post_nav_menu_item) wp-includes/customize/class-wp-customize-nav-menu-item-setting.php | Get the value emulated into a [WP\_Post](../classes/wp_post) and set up as a nav\_menu\_item. |
| [wp\_dashboard\_recent\_drafts()](wp_dashboard_recent_drafts) wp-admin/includes/dashboard.php | Show recent drafts of the user on the dashboard. |
| [wp\_trim\_excerpt()](wp_trim_excerpt) wp-includes/formatting.php | Generates an excerpt from the content, if needed. |
| [wp\_widget\_rss\_output()](wp_widget_rss_output) wp-includes/widgets.php | Display the RSS entries in a list. |
| [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. |
| [get\_comment\_excerpt()](get_comment_excerpt) wp-includes/comment-template.php | Retrieves the excerpt of the given comment. |
| Version | Description |
| --- | --- |
| [3.3.0](https://developer.wordpress.org/reference/since/3.3.0/) | Introduced. |
wordpress wp_remote_post( string $url, array $args = array() ): array|WP_Error wp\_remote\_post( string $url, array $args = array() ): array|WP\_Error
=======================================================================
Performs an HTTP request using the POST method and returns its response.
* [wp\_remote\_request()](wp_remote_request) : For more information on the response array format.
* [WP\_Http::request()](../classes/wp_http/request): For default arguments information.
`$url` string Required URL to retrieve. `$args` array Optional Request arguments. Default: `array()`
array|[WP\_Error](../classes/wp_error) The response or [WP\_Error](../classes/wp_error) on failure.
File: `wp-includes/http.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/http.php/)
```
function wp_remote_post( $url, $args = array() ) {
$http = _wp_http_get_object();
return $http->post( $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\_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::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. |
| [translations\_api()](translations_api) wp-admin/includes/translation-install.php | Retrieve translations from WordPress Translation API. |
| [wp\_check\_browser\_version()](wp_check_browser_version) wp-admin/includes/dashboard.php | Checks if the user needs a browser update. |
| [update\_core()](update_core) wp-admin/includes/update-core.php | Upgrades the core of WordPress. |
| [spawn\_cron()](spawn_cron) wp-includes/cron.php | Sends a request to run cron through HTTP request that doesn’t halt page loading. |
| [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\_HTTP\_IXR\_Client::query()](../classes/wp_http_ixr_client/query) wp-includes/class-wp-http-ixr-client.php | |
| Version | Description |
| --- | --- |
| [2.7.0](https://developer.wordpress.org/reference/since/2.7.0/) | Introduced. |
wordpress _wp_http_get_object(): WP_Http \_wp\_http\_get\_object(): WP\_Http
===================================
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\_Http](../classes/wp_http) Object
[WP\_Http](../classes/wp_http) HTTP Transport object.
File: `wp-includes/http.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/http.php/)
```
function _wp_http_get_object() {
static $http = null;
if ( is_null( $http ) ) {
$http = new WP_Http();
}
return $http;
}
```
| Used By | Description |
| --- | --- |
| [wp\_safe\_remote\_request()](wp_safe_remote_request) wp-includes/http.php | Retrieve the raw response from a safe HTTP request. |
| [wp\_safe\_remote\_get()](wp_safe_remote_get) wp-includes/http.php | Retrieve the raw response from a safe HTTP request using the GET method. |
| [wp\_safe\_remote\_post()](wp_safe_remote_post) wp-includes/http.php | Retrieve the raw response from a safe HTTP request using the POST method. |
| [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. |
| [wp\_remote\_request()](wp_remote_request) wp-includes/http.php | Performs an HTTP request and returns its response. |
| [wp\_remote\_get()](wp_remote_get) wp-includes/http.php | Performs an HTTP request using the GET method and returns its response. |
| [wp\_remote\_post()](wp_remote_post) wp-includes/http.php | Performs an HTTP request using the POST method and returns its response. |
| [wp\_remote\_head()](wp_remote_head) wp-includes/http.php | Performs an HTTP request using the HEAD method and returns its response. |
| [wp\_http\_supports()](wp_http_supports) wp-includes/http.php | Determines if there is an HTTP Transport that can process this request. |
| Version | Description |
| --- | --- |
| [2.7.0](https://developer.wordpress.org/reference/since/2.7.0/) | Introduced. |
wordpress wp_dashboard_primary_output( string $widget_id, array $feeds ) wp\_dashboard\_primary\_output( string $widget\_id, array $feeds )
==================================================================
Displays the WordPress events and news feeds.
`$widget_id` string Required Widget ID. `$feeds` array Required Array of RSS feeds. File: `wp-admin/includes/dashboard.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/dashboard.php/)
```
function wp_dashboard_primary_output( $widget_id, $feeds ) {
foreach ( $feeds as $type => $args ) {
$args['type'] = $type;
echo '<div class="rss-widget">';
wp_widget_rss_output( $args['url'], $args );
echo '</div>';
}
}
```
| Uses | Description |
| --- | --- |
| [wp\_widget\_rss\_output()](wp_widget_rss_output) wp-includes/widgets.php | Display the RSS entries in a list. |
| Version | Description |
| --- | --- |
| [4.8.0](https://developer.wordpress.org/reference/since/4.8.0/) | Removed popular plugins feed. |
| [3.8.0](https://developer.wordpress.org/reference/since/3.8.0/) | Introduced. |
wordpress _wp_check_existing_file_names( string $filename, array $files ): bool \_wp\_check\_existing\_file\_names( string $filename, 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 check if a file name could match an existing image sub-size file name.
`$filename` string Required The file name to check. `$files` array Required An array of existing files in the directory. 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_existing_file_names( $filename, $files ) {
$fname = pathinfo( $filename, PATHINFO_FILENAME );
$ext = pathinfo( $filename, PATHINFO_EXTENSION );
// Edge case, file names like `.ext`.
if ( empty( $fname ) ) {
return false;
}
if ( $ext ) {
$ext = ".$ext";
}
$regex = '/^' . preg_quote( $fname ) . '-(?:\d+x\d+|scaled|rotated)' . preg_quote( $ext ) . '$/i';
foreach ( $files as $file ) {
if ( preg_match( $regex, $file ) ) {
return true;
}
}
return false;
}
```
| Used By | Description |
| --- | --- |
| [\_wp\_check\_alternate\_file\_names()](_wp_check_alternate_file_names) wp-includes/functions.php | Helper function to test if each of an array of file names could conflict with existing files. |
| [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.3.1](https://developer.wordpress.org/reference/since/5.3.1/) | Introduced. |
wordpress filter_SSL( string $url ): string filter\_SSL( string $url ): string
==================================
Formats a URL to use https.
Useful as a filter.
`$url` string Required URL string URL with https as the scheme
File: `wp-includes/ms-functions.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/ms-functions.php/)
```
function filter_SSL( $url ) { // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.FunctionNameInvalid
if ( ! is_string( $url ) ) {
return get_bloginfo( 'url' ); // Return home blog URL with proper scheme.
}
if ( force_ssl_content() && is_ssl() ) {
$url = set_url_scheme( $url, 'https' );
}
return $url;
}
```
| Uses | Description |
| --- | --- |
| [set\_url\_scheme()](set_url_scheme) wp-includes/link-template.php | Sets the scheme for a URL. |
| [is\_ssl()](is_ssl) wp-includes/load.php | Determines if SSL is used. |
| [force\_ssl\_content()](force_ssl_content) wp-includes/ms-functions.php | Determines whether to force SSL on content. |
| [get\_bloginfo()](get_bloginfo) wp-includes/general-template.php | Retrieves information about the current site. |
| Version | Description |
| --- | --- |
| [2.8.5](https://developer.wordpress.org/reference/since/2.8.5/) | Introduced. |
wordpress update_object_term_cache( string|int[] $object_ids, string|string[] $object_type ): void|false update\_object\_term\_cache( string|int[] $object\_ids, string|string[] $object\_type ): void|false
===================================================================================================
Updates the cache for the given term object ID(s).
Note: Due to performance concerns, great care should be taken to only update term caches when necessary. Processing time can increase exponentially depending on both the number of passed term IDs and the number of taxonomies those terms belong to.
Caches will only be updated for terms not already cached.
`$object_ids` string|int[] Required Comma-separated list or array of term object IDs. `$object_type` string|string[] Required The taxonomy object type or array of the same. void|false Void on success or if the `$object_ids` parameter is empty, false if all of the terms in `$object_ids` are already cached.
File: `wp-includes/taxonomy.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/taxonomy.php/)
```
function update_object_term_cache( $object_ids, $object_type ) {
if ( empty( $object_ids ) ) {
return;
}
if ( ! is_array( $object_ids ) ) {
$object_ids = explode( ',', $object_ids );
}
$object_ids = array_map( 'intval', $object_ids );
$non_cached_ids = array();
$taxonomies = get_object_taxonomies( $object_type );
foreach ( $taxonomies as $taxonomy ) {
$cache_values = wp_cache_get_multiple( (array) $object_ids, "{$taxonomy}_relationships" );
foreach ( $cache_values as $id => $value ) {
if ( false === $value ) {
$non_cached_ids[] = $id;
}
}
}
if ( empty( $non_cached_ids ) ) {
return false;
}
$non_cached_ids = array_unique( $non_cached_ids );
$terms = wp_get_object_terms(
$non_cached_ids,
$taxonomies,
array(
'fields' => 'all_with_object_id',
'orderby' => 'name',
'update_term_meta_cache' => false,
)
);
$object_terms = array();
foreach ( (array) $terms as $term ) {
$object_terms[ $term->object_id ][ $term->taxonomy ][] = $term->term_id;
}
foreach ( $non_cached_ids as $id ) {
foreach ( $taxonomies as $taxonomy ) {
if ( ! isset( $object_terms[ $id ][ $taxonomy ] ) ) {
if ( ! isset( $object_terms[ $id ] ) ) {
$object_terms[ $id ] = array();
}
$object_terms[ $id ][ $taxonomy ] = array();
}
}
}
$cache_values = array();
foreach ( $object_terms as $id => $value ) {
foreach ( $value as $taxonomy => $terms ) {
$cache_values[ $taxonomy ][ $id ] = $terms;
}
}
foreach ( $cache_values as $taxonomy => $data ) {
wp_cache_add_multiple( $data, "{$taxonomy}_relationships" );
}
}
```
| Uses | Description |
| --- | --- |
| [wp\_cache\_add\_multiple()](wp_cache_add_multiple) wp-includes/cache.php | Adds multiple values to the cache in one call. |
| [wp\_cache\_get\_multiple()](wp_cache_get_multiple) wp-includes/cache.php | Retrieves multiple values from the cache in one call. |
| [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. |
| 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.3.0](https://developer.wordpress.org/reference/since/2.3.0/) | Introduced. |
wordpress update_right_now_message() update\_right\_now\_message()
=============================
Displays WordPress version and active theme in the ‘At a Glance’ dashboard widget.
File: `wp-admin/includes/update.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/update.php/)
```
function update_right_now_message() {
$theme_name = wp_get_theme();
if ( current_user_can( 'switch_themes' ) ) {
$theme_name = sprintf( '<a href="themes.php">%1$s</a>', $theme_name );
}
$msg = '';
if ( current_user_can( 'update_core' ) ) {
$cur = get_preferred_from_update_core();
if ( isset( $cur->response ) && 'upgrade' === $cur->response ) {
$msg .= sprintf(
'<a href="%s" class="button" aria-describedby="wp-version">%s</a> ',
network_admin_url( 'update-core.php' ),
/* translators: %s: WordPress version number, or 'Latest' string. */
sprintf( __( 'Update to %s' ), $cur->current ? $cur->current : __( 'Latest' ) )
);
}
}
/* translators: 1: Version number, 2: Theme name. */
$content = __( 'WordPress %1$s running %2$s theme.' );
/**
* Filters the text displayed in the 'At a Glance' dashboard widget.
*
* Prior to 3.8.0, the widget was named 'Right Now'.
*
* @since 4.4.0
*
* @param string $content Default text.
*/
$content = apply_filters( 'update_right_now_text', $content );
$msg .= sprintf( '<span id="wp-version">' . $content . '</span>', get_bloginfo( 'version', 'display' ), $theme_name );
echo "<p id='wp-version-message'>$msg</p>";
}
```
[apply\_filters( 'update\_right\_now\_text', string $content )](../hooks/update_right_now_text)
Filters the text displayed in the ‘At a Glance’ dashboard widget.
| Uses | Description |
| --- | --- |
| [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. |
| [network\_admin\_url()](network_admin_url) wp-includes/link-template.php | Retrieves the URL to the admin area for the network. |
| [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. |
| [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. |
| 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. |
| Version | Description |
| --- | --- |
| [2.5.0](https://developer.wordpress.org/reference/since/2.5.0/) | Introduced. |
| programming_docs |
wordpress register_widget_control( int|string $name, callable $control_callback, int $width = '', int $height = '', mixed $params ) register\_widget\_control( int|string $name, callable $control\_callback, int $width = '', int $height = '', mixed $params )
============================================================================================================================
This function has been deprecated. Use [wp\_register\_widget\_control()](wp_register_widget_control) instead.
Registers widget control callback for customizing options.
Allows $name to be an array that accepts either three elements to grab the first element and the third for the name or just uses the first element of the array for the name.
Passes to [wp\_register\_widget\_control()](wp_register_widget_control) after the argument list has been compiled.
* [wp\_register\_widget\_control()](wp_register_widget_control)
`$name` int|string Required Sidebar ID. `$control_callback` callable Required Widget control callback to display and process form. `$width` int Optional Widget width. Default: `''`
`$height` int Optional Widget height. Default: `''`
`$params` mixed Required Widget parameters. File: `wp-includes/deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/deprecated.php/)
```
function register_widget_control($name, $control_callback, $width = '', $height = '', ...$params) {
_deprecated_function( __FUNCTION__, '2.8.0', 'wp_register_widget_control()' );
// Compat.
if ( is_array( $name ) ) {
if ( count( $name ) === 3 ) {
$name = sprintf( $name[0], $name[2] );
} else {
$name = $name[0];
}
}
$id = sanitize_title( $name );
$options = array();
if ( ! empty( $width ) ) {
$options['width'] = $width;
}
if ( ! empty( $height ) ) {
$options['height'] = $height;
}
wp_register_widget_control( $id, $name, $control_callback, $options, ...$params );
}
```
| 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\_register\_widget\_control()](wp_register_widget_control) wp-includes/widgets.php | Registers widget control callback for customizing options. |
| [\_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\_register\_widget\_control()](wp_register_widget_control) |
| [2.2.0](https://developer.wordpress.org/reference/since/2.2.0/) | Introduced. |
wordpress display_space_usage() display\_space\_usage()
=======================
Displays the amount of disk space used by the current site. Not used in core.
File: `wp-admin/includes/ms.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/ms.php/)
```
function display_space_usage() {
$space_allowed = get_space_allowed();
$space_used = get_space_used();
$percent_used = ( $space_used / $space_allowed ) * 100;
$space = size_format( $space_allowed * MB_IN_BYTES );
?>
<strong>
<?php
/* translators: Storage space that's been used. 1: Percentage of used space, 2: Total space allowed in megabytes or gigabytes. */
printf( __( 'Used: %1$s%% of %2$s' ), number_format( $percent_used ), $space );
?>
</strong>
<?php
}
```
| Uses | Description |
| --- | --- |
| [get\_space\_allowed()](get_space_allowed) wp-includes/ms-functions.php | Returns the upload quota for the current blog. |
| [size\_format()](size_format) wp-includes/functions.php | Converts a number of bytes to the largest unit the bytes will fit into. |
| [get\_space\_used()](get_space_used) wp-includes/ms-functions.php | Returns the space used by the current site. |
| [\_\_()](__) 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 wp_embed_handler_video( array $matches, array $attr, string $url, array $rawattr ): string wp\_embed\_handler\_video( array $matches, array $attr, string $url, array $rawattr ): string
=============================================================================================
Video 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_video( $matches, $attr, $url, $rawattr ) {
$dimensions = '';
if ( ! empty( $rawattr['width'] ) && ! empty( $rawattr['height'] ) ) {
$dimensions .= sprintf( 'width="%d" ', (int) $rawattr['width'] );
$dimensions .= sprintf( 'height="%d" ', (int) $rawattr['height'] );
}
$video = sprintf( '[video %s src="%s" /]', $dimensions, esc_url( $url ) );
/**
* Filters the video embed output.
*
* @since 3.6.0
*
* @param string $video Video 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_video', $video, $attr, $url, $rawattr );
}
```
[apply\_filters( 'wp\_embed\_handler\_video', string $video, array $attr, string $url, array $rawattr )](../hooks/wp_embed_handler_video)
Filters the video 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 wp_is_post_autosave( int|WP_Post $post ): int|false wp\_is\_post\_autosave( int|WP\_Post $post ): int|false
=======================================================
Determines if the specified post is an autosave.
`$post` int|[WP\_Post](../classes/wp_post) Required Post ID or post object. int|false ID of autosave's parent on success, false if not a revision.
File: `wp-includes/revision.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/revision.php/)
```
function wp_is_post_autosave( $post ) {
$post = wp_get_post_revision( $post );
if ( ! $post ) {
return false;
}
if ( false !== strpos( $post->post_name, "{$post->post_parent}-autosave" ) ) {
return (int) $post->post_parent;
}
return false;
}
```
| Uses | Description |
| --- | --- |
| [wp\_get\_post\_revision()](wp_get_post_revision) wp-includes/revision.php | Gets a post revision. |
| Used By | Description |
| --- | --- |
| [WP\_REST\_Autosaves\_Controller::prepare\_item\_for\_response()](../classes/wp_rest_autosaves_controller/prepare_item_for_response) wp-includes/rest-api/endpoints/class-wp-rest-autosaves-controller.php | Prepares the revision for the REST response. |
| [wp\_prepare\_revisions\_for\_js()](wp_prepare_revisions_for_js) wp-admin/includes/revision.php | Prepare revisions for JavaScript. |
| [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\_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 |
| Version | Description |
| --- | --- |
| [2.6.0](https://developer.wordpress.org/reference/since/2.6.0/) | Introduced. |
wordpress wp_cache_add_non_persistent_groups( string|string[] $groups ) wp\_cache\_add\_non\_persistent\_groups( string|string[] $groups )
==================================================================
Adds a group or set of groups to the list of non-persistent groups.
`$groups` string|string[] Required A group or an array of groups to add. File: `wp-includes/cache.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/cache.php/)
```
function wp_cache_add_non_persistent_groups( $groups ) {
// Default cache doesn't persist so nothing to do here.
}
```
| Used By | Description |
| --- | --- |
| [WP\_Theme::\_\_construct()](../classes/wp_theme/__construct) wp-includes/class-wp-theme.php | Constructor for [WP\_Theme](../classes/wp_theme). |
| [wp\_start\_object\_cache()](wp_start_object_cache) wp-includes/load.php | Start the WordPress object cache. |
| [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) . |
| Version | Description |
| --- | --- |
| [2.6.0](https://developer.wordpress.org/reference/since/2.6.0/) | Introduced. |
wordpress wp_privacy_delete_old_export_files() wp\_privacy\_delete\_old\_export\_files()
=========================================
Cleans up export files older than three days old.
The export files are stored in `wp-content/uploads`, and are therefore publicly accessible. A CSPRN is appended to the filename to mitigate the risk of an unauthorized person downloading the file, but it is still possible. Deleting the file after the data subject has had a chance to delete it adds an additional layer of protection.
File: `wp-includes/functions.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/functions.php/)
```
function wp_privacy_delete_old_export_files() {
$exports_dir = wp_privacy_exports_dir();
if ( ! is_dir( $exports_dir ) ) {
return;
}
require_once ABSPATH . 'wp-admin/includes/file.php';
$export_files = list_files( $exports_dir, 100, array( 'index.php' ) );
/**
* Filters the lifetime, in seconds, of a personal data export file.
*
* By default, the lifetime is 3 days. Once the file reaches that age, it will automatically
* be deleted by a cron job.
*
* @since 4.9.6
*
* @param int $expiration The expiration age of the export, in seconds.
*/
$expiration = apply_filters( 'wp_privacy_export_expiration', 3 * DAY_IN_SECONDS );
foreach ( (array) $export_files as $export_file ) {
$file_age_in_seconds = time() - filemtime( $export_file );
if ( $expiration < $file_age_in_seconds ) {
unlink( $export_file );
}
}
}
```
[apply\_filters( 'wp\_privacy\_export\_expiration', int $expiration )](../hooks/wp_privacy_export_expiration)
Filters the lifetime, in seconds, of a personal data export file.
| Uses | Description |
| --- | --- |
| [wp\_privacy\_exports\_dir()](wp_privacy_exports_dir) wp-includes/functions.php | Returns the directory used to store personal data export files. |
| [list\_files()](list_files) wp-admin/includes/file.php | Returns a listing of all files in the specified folder and all subdirectories up to 100 levels deep. |
| [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. |
wordpress is_post_type_viewable( string|WP_Post_Type $post_type ): bool is\_post\_type\_viewable( string|WP\_Post\_Type $post\_type ): bool
===================================================================
Determines whether a post type is considered “viewable”.
For built-in post types such as posts and pages, the ‘public’ value will be evaluated.
For all others, the ‘publicly\_queryable’ value will be used.
`$post_type` string|[WP\_Post\_Type](../classes/wp_post_type) Required Post type name or object. bool Whether the post type should be considered viewable.
File: `wp-includes/post.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/post.php/)
```
function is_post_type_viewable( $post_type ) {
if ( is_scalar( $post_type ) ) {
$post_type = get_post_type_object( $post_type );
if ( ! $post_type ) {
return false;
}
}
if ( ! is_object( $post_type ) ) {
return false;
}
$is_viewable = $post_type->publicly_queryable || ( $post_type->_builtin && $post_type->public );
/**
* Filters whether a post type is considered "viewable".
*
* The returned filtered value must be a boolean type to ensure
* `is_post_type_viewable()` only returns a boolean. This strictness
* is by design to maintain backwards-compatibility and guard against
* potential type errors in PHP 8.1+. Non-boolean values (even falsey
* and truthy values) will result in the function returning false.
*
* @since 5.9.0
*
* @param bool $is_viewable Whether the post type is "viewable" (strict type).
* @param WP_Post_Type $post_type Post type object.
*/
return true === apply_filters( 'is_post_type_viewable', $is_viewable, $post_type );
}
```
[apply\_filters( 'is\_post\_type\_viewable', bool $is\_viewable, WP\_Post\_Type $post\_type )](../hooks/is_post_type_viewable)
Filters whether a post type is considered “viewable”.
| Uses | Description |
| --- | --- |
| [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 |
| --- | --- |
| [build\_query\_vars\_from\_query\_block()](build_query_vars_from_query_block) wp-includes/blocks.php | Helper function that constructs a [WP\_Query](../classes/wp_query) args array from a `Query` block properties. |
| [is\_post\_publicly\_viewable()](is_post_publicly_viewable) wp-includes/post.php | Determines whether a post is publicly viewable. |
| [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::get\_item()](../classes/wp_rest_posts_controller/get_item) wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php | Retrieves a single post. |
| [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\_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. |
| [get\_preview\_post\_link()](get_preview_post_link) wp-includes/link-template.php | Retrieves the URL used for the post preview. |
| [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. |
| [post\_submit\_meta\_box()](post_submit_meta_box) wp-admin/includes/meta-boxes.php | Displays post submit 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\_get\_archives()](wp_get_archives) wp-includes/general-template.php | Displays archive links based on type and format. |
| [WP::parse\_request()](../classes/wp/parse_request) wp-includes/class-wp.php | Parses the request to find the correct WordPress query. |
| [get\_attachment\_link()](get_attachment_link) wp-includes/link-template.php | Retrieves the permalink for an attachment. |
| Version | Description |
| --- | --- |
| [5.9.0](https://developer.wordpress.org/reference/since/5.9.0/) | Added `is_post_type_viewable` hook to filter the result. |
| [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.5.0](https://developer.wordpress.org/reference/since/4.5.0/) | Added the ability to pass a post type name in addition to object. |
| [4.4.0](https://developer.wordpress.org/reference/since/4.4.0/) | Introduced. |
wordpress wp_theme_update_rows() wp\_theme\_update\_rows()
=========================
Adds a callback to display update information for themes with updates available.
File: `wp-admin/includes/update.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/update.php/)
```
function wp_theme_update_rows() {
if ( ! current_user_can( 'update_themes' ) ) {
return;
}
$themes = get_site_transient( 'update_themes' );
if ( isset( $themes->response ) && is_array( $themes->response ) ) {
$themes = array_keys( $themes->response );
foreach ( $themes as $theme ) {
add_action( "after_theme_row_{$theme}", 'wp_theme_update_row', 10, 2 );
}
}
}
```
| Uses | Description |
| --- | --- |
| [get\_site\_transient()](get_site_transient) wp-includes/option.php | Retrieves the value of a site transient. |
| [current\_user\_can()](current_user_can) wp-includes/capabilities.php | Returns whether the current user has the specified capability. |
| [add\_action()](add_action) wp-includes/plugin.php | Adds a callback function to an action hook. |
| Version | Description |
| --- | --- |
| [3.1.0](https://developer.wordpress.org/reference/since/3.1.0/) | Introduced. |
wordpress wp_ajax_add_meta() wp\_ajax\_add\_meta()
=====================
Ajax handler for adding meta.
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_meta() {
check_ajax_referer( 'add-meta', '_ajax_nonce-add-meta' );
$c = 0;
$pid = (int) $_POST['post_id'];
$post = get_post( $pid );
if ( isset( $_POST['metakeyselect'] ) || isset( $_POST['metakeyinput'] ) ) {
if ( ! current_user_can( 'edit_post', $pid ) ) {
wp_die( -1 );
}
if ( isset( $_POST['metakeyselect'] ) && '#NONE#' === $_POST['metakeyselect'] && empty( $_POST['metakeyinput'] ) ) {
wp_die( 1 );
}
// If the post is an autodraft, save the post as a draft and then attempt to save the meta.
if ( 'auto-draft' === $post->post_status ) {
$post_data = array();
$post_data['action'] = 'draft'; // Warning fix.
$post_data['post_ID'] = $pid;
$post_data['post_type'] = $post->post_type;
$post_data['post_status'] = 'draft';
$now = time();
/* translators: 1: Post creation date, 2: Post creation time. */
$post_data['post_title'] = sprintf( __( 'Draft created on %1$s at %2$s' ), gmdate( __( 'F j, Y' ), $now ), gmdate( __( 'g:i a' ), $now ) );
$pid = edit_post( $post_data );
if ( $pid ) {
if ( is_wp_error( $pid ) ) {
$x = new WP_Ajax_Response(
array(
'what' => 'meta',
'data' => $pid,
)
);
$x->send();
}
$mid = add_meta( $pid );
if ( ! $mid ) {
wp_die( __( 'Please provide a custom field value.' ) );
}
} else {
wp_die( 0 );
}
} else {
$mid = add_meta( $pid );
if ( ! $mid ) {
wp_die( __( 'Please provide a custom field value.' ) );
}
}
$meta = get_metadata_by_mid( 'post', $mid );
$pid = (int) $meta->post_id;
$meta = get_object_vars( $meta );
$x = new WP_Ajax_Response(
array(
'what' => 'meta',
'id' => $mid,
'data' => _list_meta_row( $meta, $c ),
'position' => 1,
'supplemental' => array( 'postid' => $pid ),
)
);
} else { // Update?
$mid = (int) key( $_POST['meta'] );
$key = wp_unslash( $_POST['meta'][ $mid ]['key'] );
$value = wp_unslash( $_POST['meta'][ $mid ]['value'] );
if ( '' === trim( $key ) ) {
wp_die( __( 'Please provide a custom field name.' ) );
}
$meta = get_metadata_by_mid( 'post', $mid );
if ( ! $meta ) {
wp_die( 0 ); // If meta doesn't exist.
}
if (
is_protected_meta( $meta->meta_key, 'post' ) || is_protected_meta( $key, 'post' ) ||
! current_user_can( 'edit_post_meta', $meta->post_id, $meta->meta_key ) ||
! current_user_can( 'edit_post_meta', $meta->post_id, $key )
) {
wp_die( -1 );
}
if ( $meta->meta_value != $value || $meta->meta_key != $key ) {
$u = update_metadata_by_mid( 'post', $mid, $value, $key );
if ( ! $u ) {
wp_die( 0 ); // We know meta exists; we also know it's unchanged (or DB error, in which case there are bigger problems).
}
}
$x = new WP_Ajax_Response(
array(
'what' => 'meta',
'id' => $mid,
'old_id' => $mid,
'data' => _list_meta_row(
array(
'meta_key' => $key,
'meta_value' => $value,
'meta_id' => $mid,
),
$c
),
'position' => 0,
'supplemental' => array( 'postid' => $meta->post_id ),
)
);
}
$x->send();
}
```
| Uses | Description |
| --- | --- |
| [\_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. |
| [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\_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). |
| [is\_protected\_meta()](is_protected_meta) wp-includes/meta.php | Determines whether a meta key is considered protected. |
| [get\_metadata\_by\_mid()](get_metadata_by_mid) wp-includes/meta.php | Retrieves metadata by meta ID. |
| [update\_metadata\_by\_mid()](update_metadata_by_mid) wp-includes/meta.php | Updates metadata by meta ID. |
| [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\_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. |
| [wp\_die()](wp_die) wp-includes/functions.php | Kills WordPress execution and displays HTML page with an error message. |
| [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. |
| Version | Description |
| --- | --- |
| [3.1.0](https://developer.wordpress.org/reference/since/3.1.0/) | Introduced. |
| programming_docs |
wordpress enqueue_comment_hotkeys_js() enqueue\_comment\_hotkeys\_js()
===============================
Enqueues comment shortcuts jQuery script.
File: `wp-admin/includes/comment.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/comment.php/)
```
function enqueue_comment_hotkeys_js() {
if ( 'true' === get_user_option( 'comment_shortcuts' ) ) {
wp_enqueue_script( 'jquery-table-hotkeys' );
}
}
```
| Uses | Description |
| --- | --- |
| [wp\_enqueue\_script()](wp_enqueue_script) wp-includes/functions.wp-scripts.php | Enqueue a script. |
| [get\_user\_option()](get_user_option) wp-includes/user.php | Retrieves user option that can be either per Site or per Network. |
| Version | Description |
| --- | --- |
| [2.7.0](https://developer.wordpress.org/reference/since/2.7.0/) | Introduced. |
wordpress _wp_register_meta_args_whitelist( array $args, array $default_args ): array \_wp\_register\_meta\_args\_whitelist( array $args, array $default\_args ): array
=================================================================================
This function has been deprecated. Use [\_wp\_register\_meta\_args\_allowed\_list()](_wp_register_meta_args_allowed_list) instead. Please consider writing more inclusive code.
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/deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/deprecated.php/)
```
function _wp_register_meta_args_whitelist( $args, $default_args ) {
_deprecated_function( __FUNCTION__, '5.5.0', '_wp_register_meta_args_allowed_list()' );
return _wp_register_meta_args_allowed_list( $args, $default_args );
}
```
| Uses | Description |
| --- | --- |
| [\_wp\_register\_meta\_args\_allowed\_list()](_wp_register_meta_args_allowed_list) wp-includes/meta.php | Filters out `register_meta()` args based on an allowed list. |
| [\_deprecated\_function()](_deprecated_function) wp-includes/functions.php | Marks a function as deprecated and inform when it has been used. |
| Version | Description |
| --- | --- |
| [5.5.0](https://developer.wordpress.org/reference/since/5.5.0/) | Use [\_wp\_register\_meta\_args\_allowed\_list()](_wp_register_meta_args_allowed_list) instead. Please consider writing more inclusive code. |
| [4.6.0](https://developer.wordpress.org/reference/since/4.6.0/) | Introduced. |
wordpress wp_get_raw_referer(): string|false wp\_get\_raw\_referer(): string|false
=====================================
Retrieves unvalidated referer from ‘\_wp\_http\_referer’ or HTTP referer.
Do not use for redirects, use [wp\_get\_referer()](wp_get_referer) instead.
string|false Referer URL 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_raw_referer() {
if ( ! empty( $_REQUEST['_wp_http_referer'] ) ) {
return wp_unslash( $_REQUEST['_wp_http_referer'] );
} elseif ( ! empty( $_SERVER['HTTP_REFERER'] ) ) {
return wp_unslash( $_SERVER['HTTP_REFERER'] );
}
return false;
}
```
| Uses | Description |
| --- | --- |
| [wp\_unslash()](wp_unslash) wp-includes/formatting.php | Removes slashes from a string or recursively removes slashes from strings within an array. |
| Used By | Description |
| --- | --- |
| [wp\_get\_referer()](wp_get_referer) wp-includes/functions.php | Retrieves referer from ‘\_wp\_http\_referer’ or HTTP referer. |
| Version | Description |
| --- | --- |
| [4.5.0](https://developer.wordpress.org/reference/since/4.5.0/) | Introduced. |
wordpress wp_ajax_menu_locations_save() wp\_ajax\_menu\_locations\_save()
=================================
Ajax handler for menu locations save.
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_locations_save() {
if ( ! current_user_can( 'edit_theme_options' ) ) {
wp_die( -1 );
}
check_ajax_referer( 'add-menu_item', 'menu-settings-column-nonce' );
if ( ! isset( $_POST['menu-locations'] ) ) {
wp_die( 0 );
}
set_theme_mod( 'nav_menu_locations', array_map( 'absint', $_POST['menu-locations'] ) );
wp_die( 1 );
}
```
| Uses | Description |
| --- | --- |
| [set\_theme\_mod()](set_theme_mod) wp-includes/theme.php | Updates theme modification value for the active theme. |
| [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 wp_delete_term( int $term, string $taxonomy, array|string $args = array() ): bool|int|WP_Error wp\_delete\_term( int $term, string $taxonomy, array|string $args = array() ): bool|int|WP\_Error
=================================================================================================
Removes a term from the database.
If the term is a parent of other terms, then the children will be updated to that term’s parent.
Metadata associated with the term will be deleted.
`$term` int Required Term ID. `$taxonomy` string Required Taxonomy name. `$args` array|string Optional Array of arguments to override the default term ID.
* `default`intThe term ID to make the default term. This will only override the terms found if there is only one term found. Any other and the found terms are used.
* `force_default`boolOptional. Whether to force the supplied term as default to be assigned even if the object was not going to be term-less.
Default false.
Default: `array()`
bool|int|[WP\_Error](../classes/wp_error) True on success, false if term does not exist. Zero on attempted deletion of default Category. [WP\_Error](../classes/wp_error) if the taxonomy does not exist.
File: `wp-includes/taxonomy.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/taxonomy.php/)
```
function wp_delete_term( $term, $taxonomy, $args = array() ) {
global $wpdb;
$term = (int) $term;
$ids = term_exists( $term, $taxonomy );
if ( ! $ids ) {
return false;
}
if ( is_wp_error( $ids ) ) {
return $ids;
}
$tt_id = $ids['term_taxonomy_id'];
$defaults = array();
if ( 'category' === $taxonomy ) {
$defaults['default'] = (int) get_option( 'default_category' );
if ( $defaults['default'] === $term ) {
return 0; // Don't delete the default category.
}
}
// Don't delete the default custom taxonomy term.
$taxonomy_object = get_taxonomy( $taxonomy );
if ( ! empty( $taxonomy_object->default_term ) ) {
$defaults['default'] = (int) get_option( 'default_term_' . $taxonomy );
if ( $defaults['default'] === $term ) {
return 0;
}
}
$args = wp_parse_args( $args, $defaults );
if ( isset( $args['default'] ) ) {
$default = (int) $args['default'];
if ( ! term_exists( $default, $taxonomy ) ) {
unset( $default );
}
}
if ( isset( $args['force_default'] ) ) {
$force_default = $args['force_default'];
}
/**
* Fires when deleting a term, before any modifications are made to posts or terms.
*
* @since 4.1.0
*
* @param int $term Term ID.
* @param string $taxonomy Taxonomy name.
*/
do_action( 'pre_delete_term', $term, $taxonomy );
// Update children to point to new parent.
if ( is_taxonomy_hierarchical( $taxonomy ) ) {
$term_obj = get_term( $term, $taxonomy );
if ( is_wp_error( $term_obj ) ) {
return $term_obj;
}
$parent = $term_obj->parent;
$edit_ids = $wpdb->get_results( "SELECT term_id, term_taxonomy_id FROM $wpdb->term_taxonomy WHERE `parent` = " . (int) $term_obj->term_id );
$edit_tt_ids = wp_list_pluck( $edit_ids, 'term_taxonomy_id' );
/**
* Fires immediately before a term to delete's children are reassigned a parent.
*
* @since 2.9.0
*
* @param array $edit_tt_ids An array of term taxonomy IDs for the given term.
*/
do_action( 'edit_term_taxonomies', $edit_tt_ids );
$wpdb->update( $wpdb->term_taxonomy, compact( 'parent' ), array( 'parent' => $term_obj->term_id ) + compact( 'taxonomy' ) );
// Clean the cache for all child terms.
$edit_term_ids = wp_list_pluck( $edit_ids, 'term_id' );
clean_term_cache( $edit_term_ids, $taxonomy );
/**
* Fires immediately after a term to delete's children are reassigned a parent.
*
* @since 2.9.0
*
* @param array $edit_tt_ids An array of term taxonomy IDs for the given term.
*/
do_action( 'edited_term_taxonomies', $edit_tt_ids );
}
// Get the term before deleting it or its term relationships so we can pass to actions below.
$deleted_term = get_term( $term, $taxonomy );
$object_ids = (array) $wpdb->get_col( $wpdb->prepare( "SELECT object_id FROM $wpdb->term_relationships WHERE term_taxonomy_id = %d", $tt_id ) );
foreach ( $object_ids as $object_id ) {
if ( ! isset( $default ) ) {
wp_remove_object_terms( $object_id, $term, $taxonomy );
continue;
}
$terms = wp_get_object_terms(
$object_id,
$taxonomy,
array(
'fields' => 'ids',
'orderby' => 'none',
)
);
if ( 1 === count( $terms ) && isset( $default ) ) {
$terms = array( $default );
} else {
$terms = array_diff( $terms, array( $term ) );
if ( isset( $default ) && isset( $force_default ) && $force_default ) {
$terms = array_merge( $terms, array( $default ) );
}
}
$terms = array_map( 'intval', $terms );
wp_set_object_terms( $object_id, $terms, $taxonomy );
}
// Clean the relationship caches for all object types using this term.
$tax_object = get_taxonomy( $taxonomy );
foreach ( $tax_object->object_type as $object_type ) {
clean_object_term_cache( $object_ids, $object_type );
}
$term_meta_ids = $wpdb->get_col( $wpdb->prepare( "SELECT meta_id FROM $wpdb->termmeta WHERE term_id = %d ", $term ) );
foreach ( $term_meta_ids as $mid ) {
delete_metadata_by_mid( 'term', $mid );
}
/**
* Fires immediately before a term taxonomy ID is deleted.
*
* @since 2.9.0
*
* @param int $tt_id Term taxonomy ID.
*/
do_action( 'delete_term_taxonomy', $tt_id );
$wpdb->delete( $wpdb->term_taxonomy, array( 'term_taxonomy_id' => $tt_id ) );
/**
* Fires immediately after a term taxonomy ID is deleted.
*
* @since 2.9.0
*
* @param int $tt_id Term taxonomy ID.
*/
do_action( 'deleted_term_taxonomy', $tt_id );
// Delete the term if no taxonomies use it.
if ( ! $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM $wpdb->term_taxonomy WHERE term_id = %d", $term ) ) ) {
$wpdb->delete( $wpdb->terms, array( 'term_id' => $term ) );
}
clean_term_cache( $term, $taxonomy );
/**
* Fires after a term is deleted from the database and the cache is cleaned.
*
* The {@see 'delete_$taxonomy'} hook is also available for targeting a specific
* taxonomy.
*
* @since 2.5.0
* @since 4.5.0 Introduced the `$object_ids` argument.
*
* @param int $term Term ID.
* @param int $tt_id Term taxonomy ID.
* @param string $taxonomy Taxonomy slug.
* @param WP_Term $deleted_term Copy of the already-deleted term.
* @param array $object_ids List of term object IDs.
*/
do_action( 'delete_term', $term, $tt_id, $taxonomy, $deleted_term, $object_ids );
/**
* Fires after a term in a specific taxonomy is deleted.
*
* The dynamic portion of the hook name, `$taxonomy`, refers to the specific
* taxonomy the term belonged to.
*
* Possible hook names include:
*
* - `delete_category`
* - `delete_post_tag`
*
* @since 2.3.0
* @since 4.5.0 Introduced the `$object_ids` argument.
*
* @param int $term Term ID.
* @param int $tt_id Term taxonomy ID.
* @param WP_Term $deleted_term Copy of the already-deleted term.
* @param array $object_ids List of term object IDs.
*/
do_action( "delete_{$taxonomy}", $term, $tt_id, $deleted_term, $object_ids );
return true;
}
```
[do\_action( 'deleted\_term\_taxonomy', int $tt\_id )](../hooks/deleted_term_taxonomy)
Fires immediately after a term taxonomy ID is deleted.
[do\_action( 'delete\_term', int $term, int $tt\_id, string $taxonomy, WP\_Term $deleted\_term, array $object\_ids )](../hooks/delete_term)
Fires after a term is deleted from the database and the cache is cleaned.
[do\_action( 'delete\_term\_taxonomy', int $tt\_id )](../hooks/delete_term_taxonomy)
Fires immediately before a term taxonomy ID is deleted.
[do\_action( "delete\_{$taxonomy}", int $term, int $tt\_id, WP\_Term $deleted\_term, array $object\_ids )](../hooks/delete_taxonomy)
Fires after a term in a specific taxonomy is deleted.
[do\_action( 'edited\_term\_taxonomies', array $edit\_tt\_ids )](../hooks/edited_term_taxonomies)
Fires immediately after a term to delete’s children are reassigned a parent.
[do\_action( 'edit\_term\_taxonomies', array $edit\_tt\_ids )](../hooks/edit_term_taxonomies)
Fires immediately before a term to delete’s children are reassigned a parent.
[do\_action( 'pre\_delete\_term', int $term, string $taxonomy )](../hooks/pre_delete_term)
Fires when deleting a term, before any modifications are made to posts or terms.
| Uses | Description |
| --- | --- |
| [wpdb::get\_col()](../classes/wpdb/get_col) wp-includes/class-wpdb.php | Retrieves one column from the database. |
| [clean\_term\_cache()](clean_term_cache) wp-includes/taxonomy.php | Removes all of the term IDs from the cache. |
| [clean\_object\_term\_cache()](clean_object_term_cache) wp-includes/taxonomy.php | Removes the taxonomy relationship to terms from the cache. |
| [wp\_remove\_object\_terms()](wp_remove_object_terms) wp-includes/taxonomy.php | Removes term(s) associated with a given object. |
| [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. |
| [term\_exists()](term_exists) wp-includes/taxonomy.php | Determines whether a taxonomy term exists. |
| [delete\_metadata\_by\_mid()](delete_metadata_by_mid) wp-includes/meta.php | Deletes metadata by meta ID. |
| [is\_taxonomy\_hierarchical()](is_taxonomy_hierarchical) wp-includes/taxonomy.php | Determines whether the taxonomy object is hierarchical. |
| [wp\_list\_pluck()](wp_list_pluck) wp-includes/functions.php | Plucks a certain field out of each object or array in an array. |
| [wpdb::delete()](../classes/wpdb/delete) wp-includes/class-wpdb.php | Deletes a row in the table. |
| [wpdb::update()](../classes/wpdb/update) wp-includes/class-wpdb.php | Updates a row in the table. |
| [wp\_parse\_args()](wp_parse_args) wp-includes/functions.php | Merges user defined arguments into defaults array. |
| [wpdb::prepare()](../classes/wpdb/prepare) wp-includes/class-wpdb.php | Prepares a SQL query for safe execution. |
| [wpdb::get\_var()](../classes/wpdb/get_var) wp-includes/class-wpdb.php | Retrieves one variable from the database. |
| [get\_term()](get_term) wp-includes/taxonomy.php | Gets all term data from database by term ID. |
| [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\_option()](get_option) wp-includes/option.php | Retrieves an option value based on an option name. |
| [do\_action()](do_action) wp-includes/plugin.php | Calls the callback functions that have been added to an action hook. |
| [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. |
| Used By | Description |
| --- | --- |
| [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\_ajax\_delete\_tag()](wp_ajax_delete_tag) wp-admin/includes/ajax-actions.php | Ajax handler for deleting a tag. |
| [wp\_delete\_category()](wp_delete_category) wp-includes/taxonomy.php | Deletes one existing category. |
| [wp\_delete\_nav\_menu()](wp_delete_nav_menu) wp-includes/nav-menu.php | Deletes a navigation menu. |
| [wp\_xmlrpc\_server::wp\_deleteCategory()](../classes/wp_xmlrpc_server/wp_deletecategory) wp-includes/class-wp-xmlrpc-server.php | Remove category. |
| [wp\_xmlrpc\_server::wp\_deleteTerm()](../classes/wp_xmlrpc_server/wp_deleteterm) wp-includes/class-wp-xmlrpc-server.php | Delete a term. |
| Version | Description |
| --- | --- |
| [2.3.0](https://developer.wordpress.org/reference/since/2.3.0/) | Introduced. |
wordpress the_post_password() the\_post\_password()
=====================
Displays the post password.
The password is passed through [esc\_attr()](esc_attr) to ensure that it is safe for placing in an HTML attribute.
File: `wp-admin/includes/template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/template.php/)
```
function the_post_password() {
$post = get_post();
if ( isset( $post->post_password ) ) {
echo esc_attr( $post->post_password );
}
}
```
| Uses | Description |
| --- | --- |
| [esc\_attr()](esc_attr) wp-includes/formatting.php | Escaping for HTML attributes. |
| [get\_post()](get_post) wp-includes/post.php | Retrieves post data given a post ID or post object. |
| Version | Description |
| --- | --- |
| [2.7.0](https://developer.wordpress.org/reference/since/2.7.0/) | Introduced. |
wordpress wp_reset_postdata() wp\_reset\_postdata()
=====================
After looping through a separate query, this function restores the $post global to the current post in the main query.
Use this function to restore the context of the [template tags](https://developer.wordpress.org/themes/basics/template-tags/) from a secondary query loop back to the main query loop.
Differences between the main query loop and secondary query loops are:
* the main query loop is based on the URL request and is initialised before theme templates are processed
* secondary query loops are queries (using new [WP\_Query](../classes/wp_query)) in theme template or plugin files
A secondary query loop using `$sec_query = new WP_Query()` and `$sec_query->the_post()` affects the global `$post` variable. The global `$post` variable is used by [template tags](https://developer.wordpress.org/themes/basics/template-tags/) by default. `wp_reset_postdata()` restores the global `$post` variable to the current post in the main query (contained in the global `$wp_query` variable as opposed to the `$sec_query` variable), so that the template tags refer to the main query loop by default again.
Example
```
<?php
$args = array( 'posts_per_page' => 3 );
// the query
$sec_query = new WP_Query( $args );
?>
<?php if ( $sec_query->have_posts() ) : ?>
<!-- start of the loop. the_post() sets the global $post variable -->
<?php while ( $sec_query->have_posts() ) : $sec_query->the_post(); ?>
<!-- template tags will return values from the post in the $sec_query object
<?php the_title(); ?>
<?php the_excerpt(); ?>
<?php endwhile; ?><!-- end of the loop -->
<?php else: ?>
<?php _e( 'Sorry, no posts matched your criteria.' ); ?>
<?php endif; ?>
<!-- reset global post variable. After this point, we are back to the Main Query object -->
<?php wp_reset_postdata(); ?>
```
File: `wp-includes/query.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/query.php/)
```
function wp_reset_postdata() {
global $wp_query;
if ( isset( $wp_query ) ) {
$wp_query->reset_postdata();
}
}
```
| Uses | Description |
| --- | --- |
| [WP\_Query::reset\_postdata()](../classes/wp_query/reset_postdata) wp-includes/class-wp-query.php | After looping through a nested query, this function restores the $post global to the current post in this query. |
| Used By | Description |
| --- | --- |
| [wp\_dashboard\_recent\_posts()](wp_dashboard_recent_posts) wp-admin/includes/dashboard.php | Generates Publishing Soon and Recently Published sections. |
| [wp\_reset\_query()](wp_reset_query) wp-includes/query.php | Destroys the previous query and sets up a new query. |
| Version | Description |
| --- | --- |
| [3.0.0](https://developer.wordpress.org/reference/since/3.0.0/) | Introduced. |
| programming_docs |
wordpress get_userdata( int $user_id ): WP_User|false get\_userdata( int $user\_id ): WP\_User|false
==============================================
Retrieves user info by user ID.
`$user_id` int Required User ID [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_userdata( $user_id ) {
return get_user_by( 'id', $user_id );
}
```
| Uses | Description |
| --- | --- |
| [get\_user\_by()](get_user_by) wp-includes/pluggable.php | Retrieves user info by a given field. |
| Used By | Description |
| --- | --- |
| [wp\_list\_users()](wp_list_users) wp-includes/user.php | Lists all the users of the site, with several options available. |
| [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\_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\_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\_is\_application\_passwords\_available\_for\_user()](wp_is_application_passwords_available_for_user) wp-includes/user.php | Checks if Application Passwords is available for a specific user. |
| [WP\_Query::generate\_postdata()](../classes/wp_query/generate_postdata) wp-includes/class-wp-query.php | Generate post data. |
| [WP\_Customize\_Manager::get\_lock\_user\_data()](../classes/wp_customize_manager/get_lock_user_data) wp-includes/class-wp-customize-manager.php | Gets lock user data. |
| [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\_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\_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. |
| [get\_oembed\_response\_data()](get_oembed_response_data) wp-includes/embed.php | Retrieves the oEmbed response data for a given post. |
| [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\_ajax\_destroy\_sessions()](wp_ajax_destroy_sessions) wp-admin/includes/ajax-actions.php | Ajax handler for destroying multiple open sessions for a user. |
| [wxr\_authors\_list()](wxr_authors_list) wp-admin/includes/export.php | Outputs list of authors with posts. |
| [get\_editable\_user\_ids()](get_editable_user_ids) wp-admin/includes/deprecated.php | Gets the IDs of any users who can edit posts. |
| [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. |
| [refresh\_user\_details()](refresh_user_details) wp-admin/includes/ms.php | Cleans the user cache for a specific user. |
| [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. |
| [populate\_network()](populate_network) wp-admin/includes/schema.php | Populate network settings. |
| [default\_password\_nag\_edit\_user()](default_password_nag_edit_user) wp-admin/includes/user.php | |
| [edit\_user()](edit_user) wp-admin/includes/user.php | Edit user settings based on contents of $\_POST |
| [get\_user\_to\_edit()](get_user_to_edit) wp-admin/includes/user.php | Retrieve user data and filter it. |
| [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\_check\_post\_lock()](wp_check_post_lock) wp-admin/includes/post.php | Determines whether the post is currently being edited by another user. |
| [\_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\_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\_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. |
| [confirm\_delete\_users()](confirm_delete_users) wp-admin/includes/ms.php | |
| [author\_can()](author_can) wp-includes/capabilities.php | Returns whether the author of the supplied post has the specified capability. |
| [user\_can()](user_can) wp-includes/capabilities.php | Returns whether a particular user has the specified capability. |
| [is\_super\_admin()](is_super_admin) wp-includes/capabilities.php | Determines whether user is a site admin. |
| [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\_generate\_auth\_cookie()](wp_generate_auth_cookie) wp-includes/pluggable.php | Generates authentication cookie contents. |
| [user\_can\_create\_post()](user_can_create_post) wp-includes/deprecated.php | Whether user can create a post. |
| [user\_can\_create\_draft()](user_can_create_draft) wp-includes/deprecated.php | Whether user can create a post. |
| [user\_can\_edit\_post()](user_can_edit_post) wp-includes/deprecated.php | Whether user can edit a post. |
| [user\_can\_set\_post\_date()](user_can_set_post_date) wp-includes/deprecated.php | Whether user can set new posts’ dates. |
| [user\_can\_edit\_post\_date()](user_can_edit_post_date) wp-includes/deprecated.php | Whether user can delete a post. |
| [user\_can\_edit\_user()](user_can_edit_user) wp-includes/deprecated.php | Can user can edit other user. |
| [WP::register\_globals()](../classes/wp/register_globals) wp-includes/class-wp.php | Set up the WordPress Globals. |
| [WP\_Query::get\_queried\_object()](../classes/wp_query/get_queried_object) wp-includes/class-wp-query.php | Retrieves the currently queried object. |
| [get\_edit\_user\_link()](get_edit_user_link) wp-includes/link-template.php | Retrieves the edit user link. |
| [get\_permalink()](get_permalink) wp-includes/link-template.php | Retrieves the full permalink for the current post or post ID. |
| [wp\_admin\_bar\_edit\_menu()](wp_admin_bar_edit_menu) wp-includes/admin-bar.php | Provides an edit link for posts and terms. |
| [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. |
| [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. |
| [setup\_userdata()](setup_userdata) wp-includes/user.php | Sets up global user vars. |
| [wp\_dropdown\_users()](wp_dropdown_users) wp-includes/user.php | Creates dropdown HTML content of users. |
| [get\_user\_option()](get_user_option) wp-includes/user.php | Retrieves user option that can be either per Site or per Network. |
| [redirect\_canonical()](redirect_canonical) wp-includes/canonical.php | Redirects incoming links to the proper URL based on the site url. |
| [wpmu\_welcome\_user\_notification()](wpmu_welcome_user_notification) wp-includes/ms-functions.php | Notifies a user that their account activation has been successful. |
| [wpmu\_log\_new\_registrations()](wpmu_log_new_registrations) wp-includes/ms-functions.php | Logs the user email, IP, and registration date of a new site. |
| [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. |
| [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\_author\_posts\_url()](get_author_posts_url) wp-includes/author-template.php | Retrieves the URL to the author page for the user with the ID provided. |
| [wp\_list\_authors()](wp_list_authors) wp-includes/author-template.php | Lists all the authors of the site, with several options available. |
| [get\_the\_author\_meta()](get_the_author_meta) wp-includes/author-template.php | Retrieves the requested data of the author of the current post. |
| [get\_the\_modified\_author()](get_the_modified_author) wp-includes/author-template.php | Retrieves the author who last edited the current 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\_newPost()](../classes/wp_xmlrpc_server/mw_newpost) wp-includes/class-wp-xmlrpc-server.php | Create a new post. |
| [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\_getProfile()](../classes/wp_xmlrpc_server/wp_getprofile) wp-includes/class-wp-xmlrpc-server.php | Retrieve information about the requesting user. |
| [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. |
| [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. |
| [get\_comment\_class()](get_comment_class) wp-includes/comment-template.php | Returns the classes for the comment div as an array. |
| [get\_comment\_author()](get_comment_author) wp-includes/comment-template.php | Retrieves the author of the current comment. |
| [wp\_allow\_comment()](wp_allow_comment) wp-includes/comment.php | Validates whether this comment is allowed to be made. |
| Version | Description |
| --- | --- |
| [0.71](https://developer.wordpress.org/reference/since/0.71/) | Introduced. |
wordpress wp_remote_fopen( string $uri ): string|false wp\_remote\_fopen( string $uri ): string|false
==============================================
HTTP request for URI to retrieve content.
* [wp\_safe\_remote\_get()](wp_safe_remote_get)
`$uri` string Required URI/URL of web page to retrieve. string|false HTTP content. False on failure.
See [Plugin Handbook: HTTP API](https://developer.wordpress.org/plugins/http-api/)
File: `wp-includes/functions.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/functions.php/)
```
function wp_remote_fopen( $uri ) {
$parsed_url = parse_url( $uri );
if ( ! $parsed_url || ! is_array( $parsed_url ) ) {
return false;
}
$options = array();
$options['timeout'] = 10;
$response = wp_safe_remote_get( $uri, $options );
if ( is_wp_error( $response ) ) {
return false;
}
return wp_remote_retrieve_body( $response );
}
```
| Uses | Description |
| --- | --- |
| [wp\_safe\_remote\_get()](wp_safe_remote_get) wp-includes/http.php | Retrieve the raw response from a safe HTTP request using the GET method. |
| [wp\_remote\_retrieve\_body()](wp_remote_retrieve_body) wp-includes/http.php | Retrieve only the body from the raw response. |
| [is\_wp\_error()](is_wp_error) wp-includes/load.php | Checks whether the given variable is a WordPress Error. |
| Version | Description |
| --- | --- |
| [1.5.1](https://developer.wordpress.org/reference/since/1.5.1/) | Introduced. |
wordpress wp_ajax_update_plugin() wp\_ajax\_update\_plugin()
==========================
Ajax handler for updating a plugin.
* [Plugin\_Upgrader](../classes/plugin_upgrader)
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_update_plugin() {
check_ajax_referer( 'updates' );
if ( empty( $_POST['plugin'] ) || empty( $_POST['slug'] ) ) {
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(
'update' => 'plugin',
'slug' => sanitize_key( wp_unslash( $_POST['slug'] ) ),
'oldVersion' => '',
'newVersion' => '',
);
if ( ! current_user_can( 'update_plugins' ) || 0 !== validate_file( $plugin ) ) {
$status['errorMessage'] = __( 'Sorry, you are not allowed to update 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 ( $plugin_data['Version'] ) {
/* translators: %s: Plugin version. */
$status['oldVersion'] = sprintf( __( 'Version %s' ), $plugin_data['Version'] );
}
require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
wp_update_plugins();
$skin = new WP_Ajax_Upgrader_Skin();
$upgrader = new Plugin_Upgrader( $skin );
$result = $upgrader->bulk_upgrade( array( $plugin ) );
if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) {
$status['debug'] = $skin->get_upgrade_messages();
}
if ( is_wp_error( $skin->result ) ) {
$status['errorCode'] = $skin->result->get_error_code();
$status['errorMessage'] = $skin->result->get_error_message();
wp_send_json_error( $status );
} elseif ( $skin->get_errors()->has_errors() ) {
$status['errorMessage'] = $skin->get_error_messages();
wp_send_json_error( $status );
} elseif ( is_array( $result ) && ! empty( $result[ $plugin ] ) ) {
/*
* Plugin is already at the latest version.
*
* This may also be the return value if the `update_plugins` site transient is empty,
* e.g. when you update two plugins in quick succession before the transient repopulates.
*
* Preferably something can be done to ensure `update_plugins` isn't empty.
* For now, surface some sort of error here.
*/
if ( true === $result[ $plugin ] ) {
$status['errorMessage'] = $upgrader->strings['up_to_date'];
wp_send_json_error( $status );
}
$plugin_data = get_plugins( '/' . $result[ $plugin ]['destination_name'] );
$plugin_data = reset( $plugin_data );
if ( $plugin_data['Version'] ) {
/* translators: %s: Plugin version. */
$status['newVersion'] = sprintf( __( 'Version %s' ), $plugin_data['Version'] );
}
wp_send_json_success( $status );
} elseif ( false === $result ) {
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 );
}
// An unhandled error occurred.
$status['errorMessage'] = __( 'Plugin update failed.' );
wp_send_json_error( $status );
}
```
| Uses | Description |
| --- | --- |
| [WP\_Ajax\_Upgrader\_Skin::\_\_construct()](../classes/wp_ajax_upgrader_skin/__construct) wp-admin/includes/class-wp-ajax-upgrader-skin.php | Constructor. |
| [get\_plugin\_data()](get_plugin_data) wp-admin/includes/plugin.php | Parses the plugin contents to retrieve plugin’s metadata. |
| [get\_plugins()](get_plugins) wp-admin/includes/plugin.php | Checks the plugins directory and retrieve all plugin files with plugin data. |
| [sanitize\_text\_field()](sanitize_text_field) wp-includes/formatting.php | Sanitizes a string from user input or from the database. |
| [validate\_file()](validate_file) wp-includes/functions.php | Validates a file name and path against an allowed set of rules. |
| [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. |
| [plugin\_basename()](plugin_basename) wp-includes/plugin.php | Gets the basename of a plugin. |
| [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\_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. |
| [sanitize\_key()](sanitize_key) wp-includes/formatting.php | Sanitizes a string key. |
| [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. |
| [is\_wp\_error()](is_wp_error) wp-includes/load.php | Checks whether the given variable is a WordPress Error. |
| Version | Description |
| --- | --- |
| [4.2.0](https://developer.wordpress.org/reference/since/4.2.0/) | Introduced. |
wordpress options_reading_blog_charset() options\_reading\_blog\_charset()
=================================
Render the site charset setting.
File: `wp-admin/includes/options.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/options.php/)
```
function options_reading_blog_charset() {
echo '<input name="blog_charset" type="text" id="blog_charset" value="' . esc_attr( get_option( 'blog_charset' ) ) . '" class="regular-text" />';
echo '<p class="description">' . __( 'The <a href="https://wordpress.org/support/article/glossary/#character-set">character encoding</a> of your site (UTF-8 is recommended)' ) . '</p>';
}
```
| Uses | Description |
| --- | --- |
| [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. |
| [esc\_attr()](esc_attr) wp-includes/formatting.php | Escaping for HTML attributes. |
| [get\_option()](get_option) wp-includes/option.php | Retrieves an option value based on an option name. |
| Version | Description |
| --- | --- |
| [3.5.0](https://developer.wordpress.org/reference/since/3.5.0/) | Introduced. |
| programming_docs |
wordpress wp_ajax_press_this_add_category() wp\_ajax\_press\_this\_add\_category()
======================================
This function has been deprecated.
Ajax handler for creating new category from Press This.
File: `wp-includes/deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/deprecated.php/)
```
function wp_ajax_press_this_add_category() {
_deprecated_function( __FUNCTION__, '4.9.0' );
if ( is_plugin_active( 'press-this/press-this-plugin.php' ) ) {
include WP_PLUGIN_DIR . '/press-this/class-wp-press-this-plugin.php';
$wp_press_this = new WP_Press_This_Plugin();
$wp_press_this->add_category();
} else {
wp_send_json_error( array( 'errorMessage' => __( 'The Press This plugin is required.' ) ) );
}
}
```
| Uses | Description |
| --- | --- |
| [is\_plugin\_active()](is_plugin_active) wp-admin/includes/plugin.php | Determines whether a plugin is active. |
| [\_\_()](__) 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. |
| [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 |
| --- | --- |
| [4.9.0](https://developer.wordpress.org/reference/since/4.9.0/) | This function has been deprecated. |
| [4.2.0](https://developer.wordpress.org/reference/since/4.2.0/) | Introduced. |
wordpress filter_default_option( mixed $default, string $option, bool $passed_default ): mixed filter\_default\_option( mixed $default, string $option, bool $passed\_default ): mixed
=======================================================================================
Filters the default value for the option.
For settings which register a default setting in `register_setting()`, this function is added as a filter to `default_option_{$option}`.
`$default` mixed Required Existing default value to return. `$option` string Required Option name. `$passed_default` bool Required Was `get_option()` passed a default value? mixed Filtered default value.
File: `wp-includes/option.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/option.php/)
```
function filter_default_option( $default, $option, $passed_default ) {
if ( $passed_default ) {
return $default;
}
$registered = get_registered_settings();
if ( empty( $registered[ $option ] ) ) {
return $default;
}
return $registered[ $option ]['default'];
}
```
| Uses | Description |
| --- | --- |
| [get\_registered\_settings()](get_registered_settings) wp-includes/option.php | Retrieves an array of registered settings. |
| Version | Description |
| --- | --- |
| [4.7.0](https://developer.wordpress.org/reference/since/4.7.0/) | Introduced. |
wordpress get_links_withrating( int $category = -1, string $before = '', string $after = '<br />', string $between = " ", bool $show_images = true, string $orderby = 'id', bool $show_description = true, int $limit = -1, int $show_updated ) get\_links\_withrating( int $category = -1, string $before = '', string $after = '<br />', string $between = " ", bool $show\_images = true, string $orderby = 'id', bool $show\_description = true, int $limit = -1, int $show\_updated )
==========================================================================================================================================================================================================================================
This function has been deprecated. Use [get\_bookmarks()](get_bookmarks) instead.
Gets the links associated with category n and display rating stars/chars.
* [get\_bookmarks()](get_bookmarks)
`$category` int Optional The category to use. If no category supplied, uses all.
Default 0. Default: `-1`
`$before` string Optional The HTML to output before the link. Default: `''`
`$after` string Optional The HTML to output after the link. Default `<br />`. Default: `'<br />'`
`$between` string Optional The HTML to output between the link/image and its description.
Not used if no image or $show\_images is true. Default ' '. Default: `" "`
`$show_images` bool Optional Whether to show images (if defined). Default: `true`
`$orderby` string Optional The order to output the links. E.g. `'id'`, `'name'`, `'url'`, `'description'`, `'rating'`, or `'owner'`. Default `'id'`.
If you start the name with an underscore, the order will be reversed.
Specifying `'rand'` as the order will return links in a random order. Default: `'id'`
`$show_description` bool Optional Whether to show the description if show\_images=false/not defined.
Default: `true`
`$limit` int Optional Limit to X entries. If not specified, all entries are shown.
Default: `-1`
`$show_updated` int Optional Whether to show last updated timestamp. Default 0. File: `wp-includes/deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/deprecated.php/)
```
function get_links_withrating($category = -1, $before = '', $after = '<br />', $between = " ", $show_images = true,
$orderby = 'id', $show_description = true, $limit = -1, $show_updated = 0) {
_deprecated_function( __FUNCTION__, '2.1.0', 'get_bookmarks()' );
get_links($category, $before, $after, $between, $show_images, $orderby, $show_description, true, $limit, $show_updated);
}
```
| Uses | Description |
| --- | --- |
| [get\_links()](get_links) wp-includes/deprecated.php | Gets the links associated with category by ID. |
| [\_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\_bookmarks()](get_bookmarks) |
| [0.71](https://developer.wordpress.org/reference/since/0.71/) | Introduced. |
wordpress _sort_nav_menu_items( object $a, object $b ): int \_sort\_nav\_menu\_items( 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 menu items by the desired key.
`$a` object Required The first object to compare `$b` object Required The second object to compare int -1, 0, or 1 if $a is considered to be respectively less than, equal to, or greater than $b.
File: `wp-includes/deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/deprecated.php/)
```
function _sort_nav_menu_items( $a, $b ) {
global $_menu_item_sort_prop;
_deprecated_function( __FUNCTION__, '4.7.0', 'wp_list_sort()' );
if ( empty( $_menu_item_sort_prop ) )
return 0;
if ( ! isset( $a->$_menu_item_sort_prop ) || ! isset( $b->$_menu_item_sort_prop ) )
return 0;
$_a = (int) $a->$_menu_item_sort_prop;
$_b = (int) $b->$_menu_item_sort_prop;
if ( $a->$_menu_item_sort_prop == $b->$_menu_item_sort_prop )
return 0;
elseif ( $_a == $a->$_menu_item_sort_prop && $_b == $b->$_menu_item_sort_prop )
return $_a < $_b ? -1 : 1;
else
return strcmp( $a->$_menu_item_sort_prop, $b->$_menu_item_sort_prop );
}
```
| 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) |
| [3.0.0](https://developer.wordpress.org/reference/since/3.0.0/) | Introduced. |
wordpress wp_ajax_delete_page( string $action ) wp\_ajax\_delete\_page( string $action )
========================================
Ajax handler to delete a page.
`$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_delete_page( $action ) {
if ( empty( $action ) ) {
$action = 'delete-page';
}
$id = isset( $_POST['id'] ) ? (int) $_POST['id'] : 0;
check_ajax_referer( "{$action}_$id" );
if ( ! current_user_can( 'delete_page', $id ) ) {
wp_die( -1 );
}
if ( ! get_post( $id ) ) {
wp_die( 1 );
}
if ( wp_delete_post( $id ) ) {
wp_die( 1 );
} else {
wp_die( 0 );
}
}
```
| Uses | Description |
| --- | --- |
| [wp\_delete\_post()](wp_delete_post) wp-includes/post.php | Trashes or deletes a post or page. |
| [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\_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 add_utility_page( string $page_title, string $menu_title, string $capability, string $menu_slug, callable $callback = '', string $icon_url = '' ): string add\_utility\_page( string $page\_title, string $menu\_title, string $capability, string $menu\_slug, callable $callback = '', string $icon\_url = '' ): string
===============================================================================================================================================================
This function has been deprecated. Use [add\_menu\_page()](add_menu_page) instead.
Add a top-level menu page in the ‘utility’ section.
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.
* [add\_menu\_page()](add_menu_page)
`$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: `''`
`$icon_url` string Optional The URL to the icon to be used for this menu. Default: `''`
string The resulting page's hook\_suffix.
File: `wp-admin/includes/deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/deprecated.php/)
```
function add_utility_page( $page_title, $menu_title, $capability, $menu_slug, $callback = '', $icon_url = '') {
_deprecated_function( __FUNCTION__, '4.5.0', 'add_menu_page()' );
global $_wp_last_utility_menu;
$_wp_last_utility_menu++;
return add_menu_page($page_title, $menu_title, $capability, $menu_slug, $callback, $icon_url, $_wp_last_utility_menu);
}
```
| Uses | Description |
| --- | --- |
| [add\_menu\_page()](add_menu_page) wp-admin/includes/plugin.php | Adds a top-level menu page. |
| [\_deprecated\_function()](_deprecated_function) wp-includes/functions.php | Marks a function as deprecated and inform when it has been used. |
| Version | Description |
| --- | --- |
| [4.5.0](https://developer.wordpress.org/reference/since/4.5.0/) | Use [add\_menu\_page()](add_menu_page) |
| [2.7.0](https://developer.wordpress.org/reference/since/2.7.0/) | Introduced. |
wordpress wp_get_update_php_annotation(): string wp\_get\_update\_php\_annotation(): string
==========================================
Returns the default annotation for the web hosting altering the “Update PHP” page URL.
This function is to be used after [wp\_get\_update\_php\_url()](wp_get_update_php_url) to return a consistent annotation if the web host has altered the default "Update PHP" page URL.
string Update PHP page annotation. An empty string if no custom URLs are provided.
File: `wp-includes/functions.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/functions.php/)
```
function wp_get_update_php_annotation() {
$update_url = wp_get_update_php_url();
$default_url = wp_get_default_update_php_url();
if ( $update_url === $default_url ) {
return '';
}
$annotation = sprintf(
/* translators: %s: Default Update PHP page URL. */
__( 'This resource is provided by your web host, and is specific to your site. For more information, <a href="%s" target="_blank">see the official WordPress documentation</a>.' ),
esc_url( $default_url )
);
return $annotation;
}
```
| Uses | Description |
| --- | --- |
| [wp\_get\_update\_php\_url()](wp_get_update_php_url) wp-includes/functions.php | Gets the URL to learn more about updating the PHP version the site is running on. |
| [wp\_get\_default\_update\_php\_url()](wp_get_default_update_php_url) wp-includes/functions.php | Gets the default URL to learn more about updating the PHP version the site is running on. |
| [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. |
| [esc\_url()](esc_url) wp-includes/formatting.php | Checks and cleans a URL. |
| Used By | Description |
| --- | --- |
| [validate\_plugin\_requirements()](validate_plugin_requirements) wp-admin/includes/plugin.php | Validates the plugin requirements for WordPress version and PHP version. |
| [wp\_update\_php\_annotation()](wp_update_php_annotation) wp-includes/functions.php | Prints the default annotation for the web host altering the “Update PHP” page URL. |
| [update\_core()](update_core) wp-admin/includes/update-core.php | Upgrades the core of WordPress. |
| [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. |
| Version | Description |
| --- | --- |
| [5.2.0](https://developer.wordpress.org/reference/since/5.2.0/) | Introduced. |
wordpress _oembed_create_xml( array $data, SimpleXMLElement $node = null ): string|false \_oembed\_create\_xml( array $data, SimpleXMLElement $node = null ): string|false
=================================================================================
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.
Creates an XML string from a given array.
`$data` array Required The original oEmbed response data. `$node` SimpleXMLElement Optional XML node to append the result to recursively. Default: `null`
string|false XML string on success, false on error.
File: `wp-includes/embed.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/embed.php/)
```
function _oembed_create_xml( $data, $node = null ) {
if ( ! is_array( $data ) || empty( $data ) ) {
return false;
}
if ( null === $node ) {
$node = new SimpleXMLElement( '<oembed></oembed>' );
}
foreach ( $data as $key => $value ) {
if ( is_numeric( $key ) ) {
$key = 'oembed';
}
if ( is_array( $value ) ) {
$item = $node->addChild( $key );
_oembed_create_xml( $value, $item );
} else {
$node->addChild( $key, esc_html( $value ) );
}
}
return $node->asXML();
}
```
| Uses | Description |
| --- | --- |
| [\_oembed\_create\_xml()](_oembed_create_xml) wp-includes/embed.php | Creates an XML string from a given array. |
| [esc\_html()](esc_html) wp-includes/formatting.php | Escaping for HTML blocks. |
| Used By | Description |
| --- | --- |
| [\_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. |
| [\_oembed\_create\_xml()](_oembed_create_xml) wp-includes/embed.php | Creates an XML string from a given array. |
| Version | Description |
| --- | --- |
| [4.4.0](https://developer.wordpress.org/reference/since/4.4.0/) | Introduced. |
wordpress wpview_media_sandbox_styles(): string[] wpview\_media\_sandbox\_styles(): string[]
==========================================
Returns the URLs for CSS files used in an iframe-sandbox’d TinyMCE media view.
string[] The relevant CSS file URLs.
File: `wp-includes/media.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/media.php/)
```
function wpview_media_sandbox_styles() {
$version = 'ver=' . get_bloginfo( 'version' );
$mediaelement = includes_url( "js/mediaelement/mediaelementplayer-legacy.min.css?$version" );
$wpmediaelement = includes_url( "js/mediaelement/wp-mediaelement.css?$version" );
return array( $mediaelement, $wpmediaelement );
}
```
| Uses | Description |
| --- | --- |
| [includes\_url()](includes_url) wp-includes/link-template.php | Retrieves the URL to the includes directory. |
| [get\_bloginfo()](get_bloginfo) wp-includes/general-template.php | Retrieves information about the current site. |
| Used By | Description |
| --- | --- |
| [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 | |
| Version | Description |
| --- | --- |
| [4.0.0](https://developer.wordpress.org/reference/since/4.0.0/) | Introduced. |
wordpress get_the_posts_pagination( array $args = array() ): string get\_the\_posts\_pagination( array $args = array() ): string
============================================================
Retrieves a paginated navigation to next/previous set of posts, when applicable.
`$args` array Optional Default pagination arguments, see [paginate\_links()](paginate_links) .
* `screen_reader_text`stringScreen reader text for navigation element.
Default 'Posts navigation'.
* `aria_label`stringARIA label text for the nav element. Default `'Posts'`.
* `class`stringCustom class for the nav element. Default `'pagination'`.
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()`
string Markup for pagination links.
File: `wp-includes/link-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/link-template.php/)
```
function get_the_posts_pagination( $args = array() ) {
global $wp_query;
$navigation = '';
// Don't print empty markup if there's only one page.
if ( $wp_query->max_num_pages > 1 ) {
// Make sure the nav element has an aria-label attribute: fallback to the screen reader text.
if ( ! empty( $args['screen_reader_text'] ) && empty( $args['aria_label'] ) ) {
$args['aria_label'] = $args['screen_reader_text'];
}
$args = wp_parse_args(
$args,
array(
'mid_size' => 1,
'prev_text' => _x( 'Previous', 'previous set of posts' ),
'next_text' => _x( 'Next', 'next set of posts' ),
'screen_reader_text' => __( 'Posts navigation' ),
'aria_label' => __( 'Posts' ),
'class' => 'pagination',
)
);
/**
* Filters the arguments for posts pagination links.
*
* @since 6.1.0
*
* @param array $args {
* Optional. Default pagination arguments, see paginate_links().
*
* @type string $screen_reader_text Screen reader text for navigation element.
* Default 'Posts navigation'.
* @type string $aria_label ARIA label text for the nav element. Default 'Posts'.
* @type string $class Custom class for the nav element. Default 'pagination'.
* }
*/
$args = apply_filters( 'the_posts_pagination_args', $args );
// Make sure we get a string back. Plain is the next best thing.
if ( isset( $args['type'] ) && 'array' === $args['type'] ) {
$args['type'] = 'plain';
}
// Set up paginated links.
$links = paginate_links( $args );
if ( $links ) {
$navigation = _navigation_markup( $links, $args['class'], $args['screen_reader_text'], $args['aria_label'] );
}
}
return $navigation;
}
```
[apply\_filters( 'the\_posts\_pagination\_args', array $args )](../hooks/the_posts_pagination_args)
Filters the arguments for posts pagination links.
| Uses | Description |
| --- | --- |
| [\_navigation\_markup()](_navigation_markup) wp-includes/link-template.php | Wraps passed links in navigational markup. |
| [paginate\_links()](paginate_links) wp-includes/general-template.php | Retrieves paginated links for archive post pages. |
| [\_x()](_x) wp-includes/l10n.php | Retrieves translated string with gettext context. |
| [\_\_()](__) 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 |
| --- | --- |
| [the\_posts\_pagination()](the_posts_pagination) wp-includes/link-template.php | Displays a paginated navigation to next/previous set of posts, when applicable. |
| Version | Description |
| --- | --- |
| [5.5.0](https://developer.wordpress.org/reference/since/5.5.0/) | Added the `class` parameter. |
| [5.3.0](https://developer.wordpress.org/reference/since/5.3.0/) | Added the `aria_label` parameter. |
| [4.1.0](https://developer.wordpress.org/reference/since/4.1.0/) | Introduced. |
| programming_docs |
wordpress wp_read_image_metadata( string $file ): array|false wp\_read\_image\_metadata( string $file ): array|false
======================================================
Gets extended image metadata, exif or iptc as available.
Retrieves the EXIF metadata aperture, credit, camera, caption, copyright, iso created\_timestamp, focal\_length, shutter\_speed, and title.
The IPTC metadata that is retrieved is APP13, credit, byline, created date and time, caption, copyright, and title. Also includes FNumber, Model, DateTimeDigitized, FocalLength, ISOSpeedRatings, and ExposureTime.
`$file` string Required array|false Image metadata array on success, false on failure.
**Additional note to Return**
The elements returned in the array are:
**`["aperture"]`**
(string) Set to the EXIF FNumber field.
**`["credit"]`**
(string) Set to the first non-empty value found by looking through the following fields:
1. IPTC Credit field (2#110)
2. IPTC Creator field (2#080)
3. EXIF Artist field
4. EXIF Author field
**`["camera"]`**
(string) Set to the EXIF Model field.
**`["caption"]`**
(string) Set to a non-empty value of one of the following fields (see source code for the precise logic involved):
1. IPTC Description field (2#120)
2. EXIF UserComment field if [“title”] is unset AND EXIF:ImageDescription is less than 80 characters
3. EXIF ImageDescription field if [“title”] is set OR EXIF:ImageDescription is more than 80 characters
4. EXIF Comments field if [“title”] does not equal EXIF:Comments
**`["created_timestamp"]`**
(string) Set to the first non-empty value found by looking through the following fields:
1. EXIF field DateTimeDigitized
2. IPTC Date and Time fields (2#055 and 2#060)
**`["copyright"]`**
(string) Set to the first non-empty value found by looking through the following fields:
1. IPTC Copyright field (2#116)
2. EXIF Copyright field
**`["focal_length"]`**
(string) Set to the EXIF FocalLength field.
**`["iso"]`**
(string) Set to the EXIF ISOSpeedRatings field.
**`["shutter_speed"]`**
(string) Set to the EXIF ExposureTime field.
**`["title"]`**
(string) Set to the first non-empty value found by looking through the following fields:
1. IPTC Headline field (2#105)
2. IPTC Title field (2#005)
3. IPTC Description field (2#120) but only if less than 80 characters
4. EXIF Title field
5. EXIF ImageDescription field but only if less than 80 characters
The (2#nnn) value shown after each IPTC field (above) is the key of the array returned by PHP’s iptcparse function for that particular IPTC field.
File: `wp-admin/includes/image.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/image.php/)
```
function wp_read_image_metadata( $file ) {
if ( ! file_exists( $file ) ) {
return false;
}
list( , , $image_type ) = wp_getimagesize( $file );
/*
* EXIF contains a bunch of data we'll probably never need formatted in ways
* that are difficult to use. We'll normalize it and just extract the fields
* that are likely to be useful. Fractions and numbers are converted to
* floats, dates to unix timestamps, and everything else to strings.
*/
$meta = array(
'aperture' => 0,
'credit' => '',
'camera' => '',
'caption' => '',
'created_timestamp' => 0,
'copyright' => '',
'focal_length' => 0,
'iso' => 0,
'shutter_speed' => 0,
'title' => '',
'orientation' => 0,
'keywords' => array(),
);
$iptc = array();
$info = array();
/*
* Read IPTC first, since it might contain data not available in exif such
* as caption, description etc.
*/
if ( is_callable( 'iptcparse' ) ) {
wp_getimagesize( $file, $info );
if ( ! empty( $info['APP13'] ) ) {
// Don't silence errors when in debug mode, unless running unit tests.
if ( defined( 'WP_DEBUG' ) && WP_DEBUG
&& ! defined( 'WP_RUN_CORE_TESTS' )
) {
$iptc = iptcparse( $info['APP13'] );
} else {
// phpcs:ignore WordPress.PHP.NoSilencedErrors -- Silencing notice and warning is intentional. See https://core.trac.wordpress.org/ticket/42480
$iptc = @iptcparse( $info['APP13'] );
}
if ( ! is_array( $iptc ) ) {
$iptc = array();
}
// Headline, "A brief synopsis of the caption".
if ( ! empty( $iptc['2#105'][0] ) ) {
$meta['title'] = trim( $iptc['2#105'][0] );
/*
* Title, "Many use the Title field to store the filename of the image,
* though the field may be used in many ways".
*/
} elseif ( ! empty( $iptc['2#005'][0] ) ) {
$meta['title'] = trim( $iptc['2#005'][0] );
}
if ( ! empty( $iptc['2#120'][0] ) ) { // Description / legacy caption.
$caption = trim( $iptc['2#120'][0] );
mbstring_binary_safe_encoding();
$caption_length = strlen( $caption );
reset_mbstring_encoding();
if ( empty( $meta['title'] ) && $caption_length < 80 ) {
// Assume the title is stored in 2:120 if it's short.
$meta['title'] = $caption;
}
$meta['caption'] = $caption;
}
if ( ! empty( $iptc['2#110'][0] ) ) { // Credit.
$meta['credit'] = trim( $iptc['2#110'][0] );
} elseif ( ! empty( $iptc['2#080'][0] ) ) { // Creator / legacy byline.
$meta['credit'] = trim( $iptc['2#080'][0] );
}
if ( ! empty( $iptc['2#055'][0] ) && ! empty( $iptc['2#060'][0] ) ) { // Created date and time.
$meta['created_timestamp'] = strtotime( $iptc['2#055'][0] . ' ' . $iptc['2#060'][0] );
}
if ( ! empty( $iptc['2#116'][0] ) ) { // Copyright.
$meta['copyright'] = trim( $iptc['2#116'][0] );
}
if ( ! empty( $iptc['2#025'][0] ) ) { // Keywords array.
$meta['keywords'] = array_values( $iptc['2#025'] );
}
}
}
$exif = array();
/**
* Filters the image types to check for exif data.
*
* @since 2.5.0
*
* @param int[] $image_types Array of image types to check for exif data. Each value
* is usually one of the `IMAGETYPE_*` constants.
*/
$exif_image_types = apply_filters( 'wp_read_image_metadata_types', array( IMAGETYPE_JPEG, IMAGETYPE_TIFF_II, IMAGETYPE_TIFF_MM ) );
if ( is_callable( 'exif_read_data' ) && in_array( $image_type, $exif_image_types, true ) ) {
// Don't silence errors when in debug mode, unless running unit tests.
if ( defined( 'WP_DEBUG' ) && WP_DEBUG
&& ! defined( 'WP_RUN_CORE_TESTS' )
) {
$exif = exif_read_data( $file );
} else {
// phpcs:ignore WordPress.PHP.NoSilencedErrors -- Silencing notice and warning is intentional. See https://core.trac.wordpress.org/ticket/42480
$exif = @exif_read_data( $file );
}
if ( ! is_array( $exif ) ) {
$exif = array();
}
if ( ! empty( $exif['ImageDescription'] ) ) {
mbstring_binary_safe_encoding();
$description_length = strlen( $exif['ImageDescription'] );
reset_mbstring_encoding();
if ( empty( $meta['title'] ) && $description_length < 80 ) {
// Assume the title is stored in ImageDescription.
$meta['title'] = trim( $exif['ImageDescription'] );
}
if ( empty( $meta['caption'] ) && ! empty( $exif['COMPUTED']['UserComment'] ) ) {
$meta['caption'] = trim( $exif['COMPUTED']['UserComment'] );
}
if ( empty( $meta['caption'] ) ) {
$meta['caption'] = trim( $exif['ImageDescription'] );
}
} elseif ( empty( $meta['caption'] ) && ! empty( $exif['Comments'] ) ) {
$meta['caption'] = trim( $exif['Comments'] );
}
if ( empty( $meta['credit'] ) ) {
if ( ! empty( $exif['Artist'] ) ) {
$meta['credit'] = trim( $exif['Artist'] );
} elseif ( ! empty( $exif['Author'] ) ) {
$meta['credit'] = trim( $exif['Author'] );
}
}
if ( empty( $meta['copyright'] ) && ! empty( $exif['Copyright'] ) ) {
$meta['copyright'] = trim( $exif['Copyright'] );
}
if ( ! empty( $exif['FNumber'] ) && is_scalar( $exif['FNumber'] ) ) {
$meta['aperture'] = round( wp_exif_frac2dec( $exif['FNumber'] ), 2 );
}
if ( ! empty( $exif['Model'] ) ) {
$meta['camera'] = trim( $exif['Model'] );
}
if ( empty( $meta['created_timestamp'] ) && ! empty( $exif['DateTimeDigitized'] ) ) {
$meta['created_timestamp'] = wp_exif_date2ts( $exif['DateTimeDigitized'] );
}
if ( ! empty( $exif['FocalLength'] ) ) {
$meta['focal_length'] = (string) $exif['FocalLength'];
if ( is_scalar( $exif['FocalLength'] ) ) {
$meta['focal_length'] = (string) wp_exif_frac2dec( $exif['FocalLength'] );
}
}
if ( ! empty( $exif['ISOSpeedRatings'] ) ) {
$meta['iso'] = is_array( $exif['ISOSpeedRatings'] ) ? reset( $exif['ISOSpeedRatings'] ) : $exif['ISOSpeedRatings'];
$meta['iso'] = trim( $meta['iso'] );
}
if ( ! empty( $exif['ExposureTime'] ) ) {
$meta['shutter_speed'] = (string) $exif['ExposureTime'];
if ( is_scalar( $exif['ExposureTime'] ) ) {
$meta['shutter_speed'] = (string) wp_exif_frac2dec( $exif['ExposureTime'] );
}
}
if ( ! empty( $exif['Orientation'] ) ) {
$meta['orientation'] = $exif['Orientation'];
}
}
foreach ( array( 'title', 'caption', 'credit', 'copyright', 'camera', 'iso' ) as $key ) {
if ( $meta[ $key ] && ! seems_utf8( $meta[ $key ] ) ) {
$meta[ $key ] = utf8_encode( $meta[ $key ] );
}
}
foreach ( $meta['keywords'] as $key => $keyword ) {
if ( ! seems_utf8( $keyword ) ) {
$meta['keywords'][ $key ] = utf8_encode( $keyword );
}
}
$meta = wp_kses_post_deep( $meta );
/**
* Filters the array of meta data read from an image's exif data.
*
* @since 2.5.0
* @since 4.4.0 The `$iptc` parameter was added.
* @since 5.0.0 The `$exif` parameter was added.
*
* @param array $meta Image meta data.
* @param string $file Path to image file.
* @param int $image_type Type of image, one of the `IMAGETYPE_XXX` constants.
* @param array $iptc IPTC data.
* @param array $exif EXIF data.
*/
return apply_filters( 'wp_read_image_metadata', $meta, $file, $image_type, $iptc, $exif );
}
```
[apply\_filters( 'wp\_read\_image\_metadata', array $meta, string $file, int $image\_type, array $iptc, array $exif )](../hooks/wp_read_image_metadata)
Filters the array of meta data read from an image’s exif data.
[apply\_filters( 'wp\_read\_image\_metadata\_types', int[] $image\_types )](../hooks/wp_read_image_metadata_types)
Filters the image types to check for exif data.
| Uses | Description |
| --- | --- |
| [wp\_getimagesize()](wp_getimagesize) wp-includes/media.php | Allows PHP’s getimagesize() to be debuggable when necessary. |
| [wp\_kses\_post\_deep()](wp_kses_post_deep) wp-includes/kses.php | Navigates through an array, object, or scalar, and sanitizes content for allowed HTML tags for post content. |
| [wp\_exif\_frac2dec()](wp_exif_frac2dec) wp-admin/includes/image.php | Converts a fraction string to a decimal. |
| [wp\_exif\_date2ts()](wp_exif_date2ts) wp-admin/includes/image.php | Converts the exif date format to a unix timestamp. |
| [seems\_utf8()](seems_utf8) wp-includes/formatting.php | Checks to see if a string is utf8 encoded. |
| [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. |
| [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::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\_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. |
| [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) . |
| Version | Description |
| --- | --- |
| [2.5.0](https://developer.wordpress.org/reference/since/2.5.0/) | Introduced. |
wordpress current_time( string $type, int|bool $gmt ): int|string current\_time( string $type, int|bool $gmt ): int|string
========================================================
Retrieves the current time based on specified type.
* The ‘mysql’ type will return the time in the format for MySQL DATETIME field.
+ The ‘timestamp’ or ‘U’ types will return the current timestamp or a sum of timestamp and timezone offset, depending on `$gmt`.
+ Other strings will be interpreted as PHP date formats (e.g. ‘Y-m-d’).
If `$gmt` is a truthy value then both types will use GMT time, otherwise the output is adjusted with the GMT offset for the site.
`$type` string Required Type of time to retrieve. Accepts `'mysql'`, `'timestamp'`, `'U'`, or PHP date format string (e.g. `'Y-m-d'`). `$gmt` int|bool Optional Whether to use GMT timezone. Default false. int|string Integer if `$type` is `'timestamp'` or `'U'`, string otherwise.
File: `wp-includes/functions.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/functions.php/)
```
function current_time( $type, $gmt = 0 ) {
// Don't use non-GMT timestamp, unless you know the difference and really need to.
if ( 'timestamp' === $type || 'U' === $type ) {
return $gmt ? time() : time() + (int) ( get_option( 'gmt_offset' ) * HOUR_IN_SECONDS );
}
if ( 'mysql' === $type ) {
$type = 'Y-m-d H:i:s';
}
$timezone = $gmt ? new DateTimeZone( 'UTC' ) : wp_timezone();
$datetime = new DateTime( 'now', $timezone );
return $datetime->format( $type );
}
```
| Uses | Description |
| --- | --- |
| [wp\_timezone()](wp_timezone) wp-includes/functions.php | Retrieves the timezone of the site as a `DateTimeZone` object. |
| [get\_option()](get_option) wp-includes/option.php | Retrieves an option value based on an option name. |
| 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\_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\_create\_user\_request()](wp_create_user_request) wp-includes/user.php | Creates and logs a user request to perform a specific action. |
| [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::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\_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\_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. |
| [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. |
| [populate\_network()](populate_network) wp-admin/includes/schema.php | Populate network settings. |
| [wp\_dashboard\_recent\_posts()](wp_dashboard_recent_posts) wp-admin/includes/dashboard.php | Generates Publishing Soon and Recently Published sections. |
| [wp\_install\_defaults()](wp_install_defaults) wp-admin/includes/upgrade.php | Creates the initial content for a newly-installed site. |
| [touch\_time()](touch_time) wp-admin/includes/template.php | Prints out HTML form date elements for editing post or comment publish date. |
| [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) . |
| [post\_submit\_meta\_box()](post_submit_meta_box) wp-admin/includes/meta-boxes.php | Displays post submit form fields. |
| [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. |
| [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. |
| [get\_month\_link()](get_month_link) wp-includes/link-template.php | Retrieves the permalink for the month archives with year. |
| [get\_day\_link()](get_day_link) wp-includes/link-template.php | Retrieves the permalink for the day archives with year and month. |
| [get\_year\_link()](get_year_link) wp-includes/link-template.php | Retrieves the permalink for the year archives. |
| [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. |
| [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. |
| [wpmu\_log\_new\_registrations()](wpmu_log_new_registrations) wp-includes/ms-functions.php | Logs the user email, IP, and registration date of a new site. |
| [wpmu\_activate\_signup()](wpmu_activate_signup) wp-includes/ms-functions.php | Activates a signup. |
| [wpmu\_signup\_blog()](wpmu_signup_blog) wp-includes/ms-functions.php | Records site signup information for future activation. |
| [wpmu\_signup\_user()](wpmu_signup_user) wp-includes/ms-functions.php | Records user signup information for future activation. |
| [wpmu\_update\_blogs\_date()](wpmu_update_blogs_date) wp-includes/ms-blogs.php | Update the last\_updated field for the current site. |
| [wp\_xmlrpc\_server::blogger\_newPost()](../classes/wp_xmlrpc_server/blogger_newpost) wp-includes/class-wp-xmlrpc-server.php | Creates new post. |
| [wp\_new\_comment()](wp_new_comment) wp-includes/comment.php | Adds a new comment to the database. |
| [wp\_insert\_comment()](wp_insert_comment) wp-includes/comment.php | Inserts a comment into the database. |
| Version | Description |
| --- | --- |
| [5.3.0](https://developer.wordpress.org/reference/since/5.3.0/) | Now returns an integer if `$type` is `'U'`. Previously a string was returned. |
| [1.0.0](https://developer.wordpress.org/reference/since/1.0.0/) | Introduced. |
wordpress wp_add_object_terms( int $object_id, string|int|array $terms, array|string $taxonomy ): array|WP_Error wp\_add\_object\_terms( int $object\_id, string|int|array $terms, array|string $taxonomy ): array|WP\_Error
===========================================================================================================
Adds term(s) associated with a given object.
`$object_id` int Required The ID of the object to which the terms will be added. `$terms` string|int|array Required The slug(s) or ID(s) of the term(s) to add. `$taxonomy` array|string Required Taxonomy name. array|[WP\_Error](../classes/wp_error) Term taxonomy IDs of the affected terms.
File: `wp-includes/taxonomy.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/taxonomy.php/)
```
function wp_add_object_terms( $object_id, $terms, $taxonomy ) {
return wp_set_object_terms( $object_id, $terms, $taxonomy, true );
}
```
| Uses | Description |
| --- | --- |
| [wp\_set\_object\_terms()](wp_set_object_terms) wp-includes/taxonomy.php | Creates term and taxonomy relationships. |
| Version | Description |
| --- | --- |
| [3.6.0](https://developer.wordpress.org/reference/since/3.6.0/) | Introduced. |
| programming_docs |
wordpress wp_widget_rss_output( string|array|object $rss, array $args = array() ) wp\_widget\_rss\_output( string|array|object $rss, array $args = array() )
==========================================================================
Display the RSS entries in a list.
`$rss` string|array|object Required RSS url. `$args` array Optional Widget arguments. Default: `array()`
File: `wp-includes/widgets.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/widgets.php/)
```
function wp_widget_rss_output( $rss, $args = array() ) {
if ( is_string( $rss ) ) {
$rss = fetch_feed( $rss );
} elseif ( is_array( $rss ) && isset( $rss['url'] ) ) {
$args = $rss;
$rss = fetch_feed( $rss['url'] );
} elseif ( ! is_object( $rss ) ) {
return;
}
if ( is_wp_error( $rss ) ) {
if ( is_admin() || current_user_can( 'manage_options' ) ) {
echo '<p><strong>' . __( 'RSS Error:' ) . '</strong> ' . esc_html( $rss->get_error_message() ) . '</p>';
}
return;
}
$default_args = array(
'show_author' => 0,
'show_date' => 0,
'show_summary' => 0,
'items' => 0,
);
$args = wp_parse_args( $args, $default_args );
$items = (int) $args['items'];
if ( $items < 1 || 20 < $items ) {
$items = 10;
}
$show_summary = (int) $args['show_summary'];
$show_author = (int) $args['show_author'];
$show_date = (int) $args['show_date'];
if ( ! $rss->get_item_quantity() ) {
echo '<ul><li>' . __( 'An error has occurred, which probably means the feed is down. Try again later.' ) . '</li></ul>';
$rss->__destruct();
unset( $rss );
return;
}
echo '<ul>';
foreach ( $rss->get_items( 0, $items ) as $item ) {
$link = $item->get_link();
while ( ! empty( $link ) && stristr( $link, 'http' ) !== $link ) {
$link = substr( $link, 1 );
}
$link = esc_url( strip_tags( $link ) );
$title = esc_html( trim( strip_tags( $item->get_title() ) ) );
if ( empty( $title ) ) {
$title = __( 'Untitled' );
}
$desc = html_entity_decode( $item->get_description(), ENT_QUOTES, get_option( 'blog_charset' ) );
$desc = esc_attr( wp_trim_words( $desc, 55, ' […]' ) );
$summary = '';
if ( $show_summary ) {
$summary = $desc;
// Change existing [...] to […].
if ( '[...]' === substr( $summary, -5 ) ) {
$summary = substr( $summary, 0, -5 ) . '[…]';
}
$summary = '<div class="rssSummary">' . esc_html( $summary ) . '</div>';
}
$date = '';
if ( $show_date ) {
$date = $item->get_date( 'U' );
if ( $date ) {
$date = ' <span class="rss-date">' . date_i18n( get_option( 'date_format' ), $date ) . '</span>';
}
}
$author = '';
if ( $show_author ) {
$author = $item->get_author();
if ( is_object( $author ) ) {
$author = $author->get_name();
$author = ' <cite>' . esc_html( strip_tags( $author ) ) . '</cite>';
}
}
if ( '' === $link ) {
echo "<li>$title{$date}{$summary}{$author}</li>";
} elseif ( $show_summary ) {
echo "<li><a class='rsswidget' href='$link'>$title</a>{$date}{$summary}{$author}</li>";
} else {
echo "<li><a class='rsswidget' href='$link'>$title</a>{$date}{$author}</li>";
}
}
echo '</ul>';
$rss->__destruct();
unset( $rss );
}
```
| Uses | Description |
| --- | --- |
| [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. |
| [wp\_trim\_words()](wp_trim_words) wp-includes/formatting.php | Trims text to a certain number of words. |
| [fetch\_feed()](fetch_feed) wp-includes/feed.php | Builds SimplePie object based on RSS or Atom feed from URL. |
| [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. |
| [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. |
| [is\_admin()](is_admin) wp-includes/load.php | Determines whether the current request is for an administrative interface page. |
| [wp\_parse\_args()](wp_parse_args) wp-includes/functions.php | Merges user defined arguments into defaults array. |
| [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 |
| --- | --- |
| [wp\_dashboard\_rss\_output()](wp_dashboard_rss_output) wp-admin/includes/dashboard.php | Display generic dashboard RSS widget feed. |
| [wp\_dashboard\_primary\_output()](wp_dashboard_primary_output) wp-admin/includes/dashboard.php | Displays the WordPress events and news feeds. |
| [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. |
| Version | Description |
| --- | --- |
| [2.5.0](https://developer.wordpress.org/reference/since/2.5.0/) | Introduced. |
wordpress translations_api( string $type, array|object $args = null ): array|WP_Error translations\_api( string $type, array|object $args = null ): array|WP\_Error
=============================================================================
Retrieve translations from WordPress Translation API.
`$type` string Required Type of translations. Accepts `'plugins'`, `'themes'`, `'core'`. `$args` array|object Optional Translation API arguments. Optional. Default: `null`
array|[WP\_Error](../classes/wp_error) On success an associative array of translations, [WP\_Error](../classes/wp_error) on failure.
File: `wp-admin/includes/translation-install.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/translation-install.php/)
```
function translations_api( $type, $args = null ) {
// Include an unmodified $wp_version.
require ABSPATH . WPINC . '/version.php';
if ( ! in_array( $type, array( 'plugins', 'themes', 'core' ), true ) ) {
return new WP_Error( 'invalid_type', __( 'Invalid translation type.' ) );
}
/**
* Allows a plugin to override the WordPress.org Translation Installation API entirely.
*
* @since 4.0.0
*
* @param false|array $result The result array. Default false.
* @param string $type The type of translations being requested.
* @param object $args Translation API arguments.
*/
$res = apply_filters( 'translations_api', false, $type, $args );
if ( false === $res ) {
$url = 'http://api.wordpress.org/translations/' . $type . '/1.0/';
$http_url = $url;
$ssl = wp_http_supports( array( 'ssl' ) );
if ( $ssl ) {
$url = set_url_scheme( $url, 'https' );
}
$options = array(
'timeout' => 3,
'body' => array(
'wp_version' => $wp_version,
'locale' => get_locale(),
'version' => $args['version'], // Version of plugin, theme or core.
),
);
if ( 'core' !== $type ) {
$options['body']['slug'] = $args['slug']; // Plugin or theme slug.
}
$request = wp_remote_post( $url, $options );
if ( $ssl && is_wp_error( $request ) ) {
trigger_error(
sprintf(
/* translators: %s: Support forums URL. */
__( 'An unexpected error occurred. Something may be wrong with WordPress.org or this server’s configuration. If you continue to have problems, please try the <a href="%s">support forums</a>.' ),
__( 'https://wordpress.org/support/forums/' )
) . ' ' . __( '(WordPress could not establish a secure connection to WordPress.org. Please contact your server administrator.)' ),
headers_sent() || WP_DEBUG ? E_USER_WARNING : E_USER_NOTICE
);
$request = wp_remote_post( $http_url, $options );
}
if ( is_wp_error( $request ) ) {
$res = new WP_Error(
'translations_api_failed',
sprintf(
/* translators: %s: Support forums URL. */
__( 'An unexpected error occurred. Something may be wrong with WordPress.org or this server’s configuration. If you continue to have problems, please try the <a href="%s">support forums</a>.' ),
__( 'https://wordpress.org/support/forums/' )
),
$request->get_error_message()
);
} else {
$res = json_decode( wp_remote_retrieve_body( $request ), true );
if ( ! is_object( $res ) && ! is_array( $res ) ) {
$res = new WP_Error(
'translations_api_failed',
sprintf(
/* translators: %s: Support forums URL. */
__( 'An unexpected error occurred. Something may be wrong with WordPress.org or this server’s configuration. If you continue to have problems, please try the <a href="%s">support forums</a>.' ),
__( 'https://wordpress.org/support/forums/' )
),
wp_remote_retrieve_body( $request )
);
}
}
}
/**
* Filters the Translation Installation API response results.
*
* @since 4.0.0
*
* @param array|WP_Error $res Response as an associative array or WP_Error.
* @param string $type The type of translations being requested.
* @param object $args Translation API arguments.
*/
return apply_filters( 'translations_api_result', $res, $type, $args );
}
```
[apply\_filters( 'translations\_api', false|array $result, string $type, object $args )](../hooks/translations_api)
Allows a plugin to override the WordPress.org Translation Installation API entirely.
[apply\_filters( 'translations\_api\_result', array|WP\_Error $res, string $type, object $args )](../hooks/translations_api_result)
Filters the Translation Installation API response results.
| Uses | Description |
| --- | --- |
| [get\_locale()](get_locale) wp-includes/l10n.php | Retrieves the current locale. |
| [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\_post()](wp_remote_post) wp-includes/http.php | Performs an HTTP request using the POST method and returns its response. |
| [wp\_remote\_retrieve\_body()](wp_remote_retrieve_body) wp-includes/http.php | Retrieve only the body from the raw response. |
| [\_\_()](__) 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\_get\_available\_translations()](wp_get_available_translations) wp-admin/includes/translation-install.php | Get available translations from the WordPress.org API. |
| Version | Description |
| --- | --- |
| [4.0.0](https://developer.wordpress.org/reference/since/4.0.0/) | Introduced. |
wordpress add_allowed_options( array $new_options, string|array $options = '' ): array add\_allowed\_options( array $new\_options, string|array $options = '' ): array
===============================================================================
Adds an array of options to the list of allowed options.
`$new_options` array Required `$options` string|array Optional Default: `''`
array
File: `wp-admin/includes/plugin.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/plugin.php/)
```
function add_allowed_options( $new_options, $options = '' ) {
if ( '' === $options ) {
global $allowed_options;
} else {
$allowed_options = $options;
}
foreach ( $new_options as $page => $keys ) {
foreach ( $keys as $key ) {
if ( ! isset( $allowed_options[ $page ] ) || ! is_array( $allowed_options[ $page ] ) ) {
$allowed_options[ $page ] = array();
$allowed_options[ $page ][] = $key;
} else {
$pos = array_search( $key, $allowed_options[ $page ], true );
if ( false === $pos ) {
$allowed_options[ $page ][] = $key;
}
}
}
}
return $allowed_options;
}
```
| Used By | Description |
| --- | --- |
| [option\_update\_filter()](option_update_filter) wp-admin/includes/plugin.php | Refreshes the value of the allowed options list available via the ‘allowed\_options’ hook. |
| [add\_option\_whitelist()](add_option_whitelist) wp-includes/deprecated.php | Adds an array of options to the list of allowed options. |
| Version | Description |
| --- | --- |
| [5.5.0](https://developer.wordpress.org/reference/since/5.5.0/) | Introduced. |
wordpress find_posts_div( string $found_action = '' ) find\_posts\_div( string $found\_action = '' )
==============================================
Outputs the modal window used for attaching media to posts or pages in the media-listing screen.
`$found_action` string Optional Default: `''`
File: `wp-admin/includes/template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/template.php/)
```
function find_posts_div( $found_action = '' ) {
?>
<div id="find-posts" class="find-box" style="display: none;">
<div id="find-posts-head" class="find-box-head">
<?php _e( 'Attach to existing content' ); ?>
<button type="button" id="find-posts-close"><span class="screen-reader-text"><?php _e( 'Close media attachment panel' ); ?></span></button>
</div>
<div class="find-box-inside">
<div class="find-box-search">
<?php if ( $found_action ) { ?>
<input type="hidden" name="found_action" value="<?php echo esc_attr( $found_action ); ?>" />
<?php } ?>
<input type="hidden" name="affected" id="affected" value="" />
<?php wp_nonce_field( 'find-posts', '_ajax_nonce', false ); ?>
<label class="screen-reader-text" for="find-posts-input"><?php _e( 'Search' ); ?></label>
<input type="text" id="find-posts-input" name="ps" value="" />
<span class="spinner"></span>
<input type="button" id="find-posts-search" value="<?php esc_attr_e( 'Search' ); ?>" class="button" />
<div class="clear"></div>
</div>
<div id="find-posts-response"></div>
</div>
<div class="find-box-buttons">
<?php submit_button( __( 'Select' ), 'primary alignright', 'find-posts-submit', false ); ?>
<div class="clear"></div>
</div>
</div>
<?php
}
```
| 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. |
| [wp\_nonce\_field()](wp_nonce_field) wp-includes/functions.php | Retrieves or display nonce hidden field for forms. |
| [\_e()](_e) wp-includes/l10n.php | Displays translated text. |
| [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. |
| [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 remove_all_shortcodes() remove\_all\_shortcodes()
=========================
Clears all shortcodes.
This function clears all of the shortcode tags by replacing the shortcodes global with an empty array. This is actually an efficient method for removing all shortcodes.
File: `wp-includes/shortcodes.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/shortcodes.php/)
```
function remove_all_shortcodes() {
global $shortcode_tags;
$shortcode_tags = array();
}
```
| Used By | Description |
| --- | --- |
| [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. |
wordpress rss_enclosure() rss\_enclosure()
================
Displays the rss enclosure for the current post.
Uses the global $post to check whether the post requires a password and if the user has the password for the post. If not then it will return before displaying.
Also uses the function [get\_post\_custom()](get_post_custom) to get the post’s ‘enclosure’ metadata field and parses the value to display the enclosure(s). The enclosure(s) consist of enclosure HTML tag(s) with a URI and other attributes.
File: `wp-includes/feed.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/feed.php/)
```
function rss_enclosure() {
if ( post_password_required() ) {
return;
}
foreach ( (array) get_post_custom() as $key => $val ) {
if ( 'enclosure' === $key ) {
foreach ( (array) $val as $enc ) {
$enclosure = explode( "\n", $enc );
// Only get the first element, e.g. 'audio/mpeg' from 'audio/mpeg mpga mp2 mp3'.
$t = preg_split( '/[ \t]/', trim( $enclosure[2] ) );
$type = $t[0];
/**
* Filters the RSS enclosure HTML link tag for the current post.
*
* @since 2.2.0
*
* @param string $html_link_tag The HTML link tag with a URI and other attributes.
*/
echo apply_filters( 'rss_enclosure', '<enclosure url="' . esc_url( trim( $enclosure[0] ) ) . '" length="' . absint( trim( $enclosure[1] ) ) . '" type="' . esc_attr( $type ) . '" />' . "\n" );
}
}
}
}
```
[apply\_filters( 'rss\_enclosure', string $html\_link\_tag )](../hooks/rss_enclosure)
Filters the RSS enclosure HTML link tag for the current post.
| Uses | Description |
| --- | --- |
| [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\_post\_custom()](get_post_custom) wp-includes/post.php | Retrieves post meta fields, based on post ID. |
| [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. |
| [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. |
| Version | Description |
| --- | --- |
| [1.5.0](https://developer.wordpress.org/reference/since/1.5.0/) | Introduced. |
wordpress get_page_template_slug( int|WP_Post $post = null ): string|false get\_page\_template\_slug( int|WP\_Post $post = null ): string|false
====================================================================
Gets the specific template filename for a given post.
`$post` int|[WP\_Post](../classes/wp_post) Optional Post ID or [WP\_Post](../classes/wp_post) object. Default is global $post. Default: `null`
string|false Page template filename. Returns an empty string when the default page template is in use. Returns false if the post does not exist.
The filename of a Page’s assigned custom template is stored as the value of a [Custom Field](https://wordpress.org/support/article/custom-fields/ "Custom Fields") with a key named '\_wp\_page\_template' (in the [wp\_postmeta](https://codex.wordpress.org/Database_Description#Table:_wp_postmeta "Database Description") database table). If the template is stored in a Theme’s subdirectory (or a Parent Theme’s subdirectory of a Child Theme), the value of the wp\_postmeta is both the folder and file names, e.g.
```
my-templates/my-custom-template.php
```
The function [get\_page\_template\_slug()](get_page_template_slug) returns an empty string when the value of '\_wp\_page\_template' is either empty or 'default'.
Custom fields starting with an underscore do *not* display in the Edit screen’s Custom Fields module. To retrieve a Page’s custom template metadata, you can also use:
```
get_post_meta( $post->ID, '_wp_page_template', true )
```
File: `wp-includes/post-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/post-template.php/)
```
function get_page_template_slug( $post = null ) {
$post = get_post( $post );
if ( ! $post ) {
return false;
}
$template = get_post_meta( $post->ID, '_wp_page_template', true );
if ( ! $template || 'default' === $template ) {
return '';
}
return $template;
}
```
| Uses | Description |
| --- | --- |
| [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::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\_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\_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\_page\_template()](get_page_template) wp-includes/template.php | Retrieves path of page template in current or parent template. |
| [is\_page\_template()](is_page_template) wp-includes/post-template.php | Determines whether the current post uses a page template. |
| [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::\_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. |
| [\_WP\_Editors::editor\_settings()](../classes/_wp_editors/editor_settings) wp-includes/class-wp-editor.php | |
| Version | Description |
| --- | --- |
| [4.7.0](https://developer.wordpress.org/reference/since/4.7.0/) | Now works with any post type, not just pages. |
| [3.4.0](https://developer.wordpress.org/reference/since/3.4.0/) | Introduced. |
| programming_docs |
wordpress wp_global_styles_render_svg_filters() wp\_global\_styles\_render\_svg\_filters()
==========================================
Renders the SVG filters supplied by theme.json.
Note that this doesn’t render the per-block user-defined filters which are handled by wp\_render\_duotone\_support, but it should be rendered before the filtered content in the body to satisfy Safari’s rendering quirks.
File: `wp-includes/script-loader.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/script-loader.php/)
```
function wp_global_styles_render_svg_filters() {
/*
* When calling via the in_admin_header action, we only want to render the
* SVGs on block editor pages.
*/
if (
is_admin() &&
! get_current_screen()->is_block_editor()
) {
return;
}
$filters = wp_get_global_styles_svg_filters();
if ( ! empty( $filters ) ) {
echo $filters;
}
}
```
| Uses | 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\_Screen::is\_block\_editor()](../classes/wp_screen/is_block_editor) wp-admin/includes/class-wp-screen.php | Sets or returns whether the block editor is loading on the current screen. |
| [get\_current\_screen()](get_current_screen) wp-admin/includes/screen.php | Get the current screen object |
| [is\_admin()](is_admin) wp-includes/load.php | Determines whether the current request is for an administrative interface page. |
| Version | Description |
| --- | --- |
| [5.9.1](https://developer.wordpress.org/reference/since/5.9.1/) | Introduced. |
wordpress wxr_term_name( WP_Term $term ) wxr\_term\_name( WP\_Term $term )
=================================
Outputs a term\_name XML tag from a given term object.
`$term` [WP\_Term](../classes/wp_term) Required Term Object. File: `wp-admin/includes/export.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/export.php/)
```
function wxr_term_name( $term ) {
if ( empty( $term->name ) ) {
return;
}
echo '<wp:term_name>' . wxr_cdata( $term->name ) . "</wp:term_name>\n";
}
```
| Uses | Description |
| --- | --- |
| [wxr\_cdata()](wxr_cdata) wp-admin/includes/export.php | Wraps given string in XML CDATA tag. |
| Used By | Description |
| --- | --- |
| [export\_wp()](export_wp) wp-admin/includes/export.php | Generates the WXR export file for download. |
| [wxr\_nav\_menu\_terms()](wxr_nav_menu_terms) wp-admin/includes/export.php | Outputs all navigation menu terms. |
| Version | Description |
| --- | --- |
| [2.9.0](https://developer.wordpress.org/reference/since/2.9.0/) | Introduced. |
wordpress rest_api_init() rest\_api\_init()
=================
Registers rewrite rules for the REST API.
* [rest\_api\_register\_rewrites()](rest_api_register_rewrites)
File: `wp-includes/rest-api.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/rest-api.php/)
```
function rest_api_init() {
rest_api_register_rewrites();
global $wp;
$wp->add_query_var( 'rest_route' );
}
```
| Uses | Description |
| --- | --- |
| [rest\_api\_register\_rewrites()](rest_api_register_rewrites) wp-includes/rest-api.php | Adds REST rewrite rules. |
| [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. |
| Version | Description |
| --- | --- |
| [4.4.0](https://developer.wordpress.org/reference/since/4.4.0/) | Introduced. |
wordpress update_post_cache( WP_Post[] $posts ) update\_post\_cache( WP\_Post[] $posts )
========================================
Updates posts in cache.
`$posts` [WP\_Post](../classes/wp_post)[] Required Array of post objects (passed by reference). File: `wp-includes/post.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/post.php/)
```
function update_post_cache( &$posts ) {
if ( ! $posts ) {
return;
}
$data = array();
foreach ( $posts as $post ) {
if ( empty( $post->filter ) || 'raw' !== $post->filter ) {
$post = sanitize_post( $post, 'raw' );
}
$data[ $post->ID ] = $post;
}
wp_cache_add_multiple( $data, 'posts' );
}
```
| Uses | Description |
| --- | --- |
| [wp\_cache\_add\_multiple()](wp_cache_add_multiple) wp-includes/cache.php | Adds multiple values to the cache in one call. |
| [sanitize\_post()](sanitize_post) wp-includes/post.php | Sanitizes every post field. |
| Used By | Description |
| --- | --- |
| [get\_children()](get_children) wp-includes/post.php | Retrieves all children of the post parent ID. |
| [update\_page\_cache()](update_page_cache) wp-includes/deprecated.php | Alias of [update\_post\_cache()](update_post_cache) . |
| [update\_post\_caches()](update_post_caches) wp-includes/post.php | Updates post, term, and metadata caches for a list of post objects. |
| [get\_pages()](get_pages) wp-includes/post.php | Retrieves an array of pages (or hierarchical post type items). |
| Version | Description |
| --- | --- |
| [1.5.1](https://developer.wordpress.org/reference/since/1.5.1/) | Introduced. |
wordpress wp_enqueue_style( string $handle, string $src = '', string[] $deps = array(), string|bool|null $ver = false, string $media = 'all' ) wp\_enqueue\_style( string $handle, string $src = '', string[] $deps = array(), string|bool|null $ver = false, string $media = 'all' )
======================================================================================================================================
Enqueue a CSS stylesheet.
Registers the style if source provided (does NOT overwrite) and enqueues.
* [WP\_Dependencies::add()](../classes/wp_dependencies/add)
* [WP\_Dependencies::enqueue()](../classes/wp_dependencies/enqueue)
`$handle` string Required Name of the stylesheet. Should be unique. `$src` string Optional Full URL of the stylesheet, or path of the stylesheet relative to the WordPress root directory.
Default: `''`
`$deps` string[] Optional An array of registered stylesheet handles this stylesheet depends on. Default: `array()`
`$ver` string|bool|null Optional String specifying stylesheet version number, if it has one, which is added to the URL as a query string for cache busting purposes. If version is set to false, a version number is automatically added equal to current installed WordPress version.
If set to null, no version is added. Default: `false`
`$media` string Optional The media for which this stylesheet has been defined.
Default `'all'`. Accepts media types like `'all'`, `'print'` and `'screen'`, or media queries like '(orientation: portrait)' and '(max-width: 640px)'. Default: `'all'`
A safe way to add/enqueue a stylesheet file to the WordPress generated page.
```
wp_enqueue_style( $handle, $src, $deps, $ver, $media );
```
* If you are going to use some [jQuery UI features](wp_enqueue_script#defaults) you might have to provide your own CSS file: WordPress core does not have a full jQuery UI theme!
* Default styles that are loaded via WordPress Core can be discerned via the source code on the [default styles](wp_default_styles#source) page.
File: `wp-includes/functions.wp-styles.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/functions-wp-styles.php/)
```
function wp_enqueue_style( $handle, $src = '', $deps = array(), $ver = false, $media = 'all' ) {
_wp_scripts_maybe_doing_it_wrong( __FUNCTION__, $handle );
$wp_styles = wp_styles();
if ( $src ) {
$_handle = explode( '?', $handle );
$wp_styles->add( $_handle[0], $src, $deps, $ver, $media );
}
$wp_styles->enqueue( $handle );
}
```
| 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\_classic\_theme\_styles()](wp_enqueue_classic_theme_styles) wp-includes/script-loader.php | Loads classic theme styles on classic themes in the frontend. |
| [wp\_enqueue\_stored\_styles()](wp_enqueue_stored_styles) wp-includes/script-loader.php | Fetches, processes and compiles stored core styles, then combines and renders them to the page. |
| [\_wp\_theme\_json\_webfonts\_handler()](_wp_theme_json_webfonts_handler) wp-includes/script-loader.php | Runs the theme.json webfonts handler. |
| [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. |
| [wp\_enqueue\_block\_style()](wp_enqueue_block_style) wp-includes/script-loader.php | Enqueues a stylesheet for a specific block. |
| [wp\_enqueue\_editor\_format\_library\_assets()](wp_enqueue_editor_format_library_assets) wp-includes/script-loader.php | Enqueues the assets required for the format library within the block editor. |
| [wp\_enqueue\_global\_styles()](wp_enqueue_global_styles) wp-includes/script-loader.php | Enqueues the global styles defined via theme.json. |
| [WP\_Block::render()](../classes/wp_block/render) wp-includes/class-wp-block.php | Generates the render output for the block. |
| [wp\_enqueue\_editor\_block\_directory\_assets()](wp_enqueue_editor_block_directory_assets) wp-includes/script-loader.php | Enqueues the assets required for the block directory within the block editor. |
| [enqueue\_block\_styles\_assets()](enqueue_block_styles_assets) wp-includes/script-loader.php | Function responsible for enqueuing the styles required for block styles functionality on the editor and on the frontend. |
| [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. |
| [wp\_enqueue\_registered\_block\_scripts\_and\_styles()](wp_enqueue_registered_block_scripts_and_styles) wp-includes/script-loader.php | Enqueues registered block scripts and styles, depending on current rendered context (only enqueuing editor scripts while in context of the editor). |
| [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\_enqueue\_code\_editor()](wp_enqueue_code_editor) wp-includes/general-template.php | Enqueues assets needed by the code editor for the given settings. |
| [\_WP\_Editors::enqueue\_default\_editor()](../classes/_wp_editors/enqueue_default_editor) wp-includes/class-wp-editor.php | Enqueue all editor scripts. |
| [WP\_Widget\_Media\_Audio::enqueue\_admin\_scripts()](../classes/wp_widget_media_audio/enqueue_admin_scripts) wp-includes/widgets/class-wp-widget-media-audio.php | Loads the required media files for the media manager and scripts for media widgets. |
| [WP\_Widget\_Media\_Audio::enqueue\_preview\_scripts()](../classes/wp_widget_media_audio/enqueue_preview_scripts) wp-includes/widgets/class-wp-widget-media-audio.php | Enqueue preview scripts. |
| [WP\_Widget\_Media\_Video::enqueue\_preview\_scripts()](../classes/wp_widget_media_video/enqueue_preview_scripts) wp-includes/widgets/class-wp-widget-media-video.php | Enqueue preview scripts. |
| [enqueue\_embed\_scripts()](enqueue_embed_scripts) wp-includes/embed.php | Enqueues embed iframe default CSS and JS. |
| [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. |
| [login\_header()](login_header) wp-login.php | Output the login page header. |
| [wp\_dashboard\_setup()](wp_dashboard_setup) wp-admin/includes/dashboard.php | Registers dashboard widgets. |
| [WP\_Internal\_Pointers::enqueue\_scripts()](../classes/wp_internal_pointers/enqueue_scripts) wp-admin/includes/class-wp-internal-pointers.php | Initializes the new feature pointers. |
| [iframe\_header()](iframe_header) wp-admin/includes/template.php | Generic Iframe header for use with Thickbox. |
| [wp\_iframe()](wp_iframe) wp-admin/includes/media.php | Outputs the iframe to display the media upload page. |
| [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\_Background::admin\_load()](../classes/custom_background/admin_load) wp-admin/includes/class-custom-background.php | Sets up the enqueue for the CSS & JavaScript files. |
| [WP\_Customize\_Manager::customize\_preview\_init()](../classes/wp_customize_manager/customize_preview_init) wp-includes/class-wp-customize-manager.php | Prints JavaScript settings. |
| [add\_thickbox()](add_thickbox) wp-includes/general-template.php | Enqueues the default ThickBox js and css. |
| [wp\_admin\_css()](wp_admin_css) wp-includes/general-template.php | Enqueues or directly prints a stylesheet link to the specified CSS file. |
| [wp\_auth\_check\_load()](wp_auth_check_load) wp-includes/functions.php | Loads the auth check for monitoring whether the user is still logged in. |
| [WP\_Admin\_Bar::initialize()](../classes/wp_admin_bar/initialize) wp-includes/class-wp-admin-bar.php | Initializes the admin bar. |
| [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\_video\_shortcode()](wp_video_shortcode) wp-includes/media.php | Builds the Video shortcode output. |
| [wp\_playlist\_scripts()](wp_playlist_scripts) wp-includes/media.php | Outputs and enqueues default scripts and styles for playlists. |
| [wp\_audio\_shortcode()](wp_audio_shortcode) wp-includes/media.php | Builds the Audio shortcode output. |
| [WP\_Customize\_Color\_Control::enqueue()](../classes/wp_customize_color_control/enqueue) wp-includes/customize/class-wp-customize-color-control.php | Enqueue scripts/styles for the color picker. |
| [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\_Editors::enqueue\_scripts()](../classes/_wp_editors/enqueue_scripts) wp-includes/class-wp-editor.php | |
| Version | Description |
| --- | --- |
| [2.6.0](https://developer.wordpress.org/reference/since/2.6.0/) | Introduced. |
wordpress wp_update_nav_menu_item( int $menu_id, int $menu_item_db_id, array $menu_item_data = array(), bool $fire_after_hooks = true ): int|WP_Error wp\_update\_nav\_menu\_item( int $menu\_id, int $menu\_item\_db\_id, array $menu\_item\_data = array(), bool $fire\_after\_hooks = true ): int|WP\_Error
========================================================================================================================================================
Saves the properties of a menu item or create a new one.
The menu-item-title, menu-item-description and menu-item-attr-title are expected to be pre-slashed since they are passed directly to APIs that expect slashed data.
`$menu_id` int Required The ID of the menu. If 0, makes the menu item a draft orphan. `$menu_item_db_id` int Required The ID of the menu item. If 0, creates a new menu item. `$menu_item_data` array Optional The menu item's data. Default: `array()`
`$fire_after_hooks` bool Optional Whether to fire the after insert hooks. Default: `true`
int|[WP\_Error](../classes/wp_error) The menu item's database ID or [WP\_Error](../classes/wp_error) object on failure.
File: `wp-includes/nav-menu.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/nav-menu.php/)
```
function wp_update_nav_menu_item( $menu_id = 0, $menu_item_db_id = 0, $menu_item_data = array(), $fire_after_hooks = true ) {
$menu_id = (int) $menu_id;
$menu_item_db_id = (int) $menu_item_db_id;
// Make sure that we don't convert non-nav_menu_item objects into nav_menu_item objects.
if ( ! empty( $menu_item_db_id ) && ! is_nav_menu_item( $menu_item_db_id ) ) {
return new WP_Error( 'update_nav_menu_item_failed', __( 'The given object ID is not that of a menu item.' ) );
}
$menu = wp_get_nav_menu_object( $menu_id );
if ( ! $menu && 0 !== $menu_id ) {
return new WP_Error( 'invalid_menu_id', __( 'Invalid menu ID.' ) );
}
if ( is_wp_error( $menu ) ) {
return $menu;
}
$defaults = array(
'menu-item-db-id' => $menu_item_db_id,
'menu-item-object-id' => 0,
'menu-item-object' => '',
'menu-item-parent-id' => 0,
'menu-item-position' => 0,
'menu-item-type' => 'custom',
'menu-item-title' => '',
'menu-item-url' => '',
'menu-item-description' => '',
'menu-item-attr-title' => '',
'menu-item-target' => '',
'menu-item-classes' => '',
'menu-item-xfn' => '',
'menu-item-status' => '',
'menu-item-post-date' => '',
'menu-item-post-date-gmt' => '',
);
$args = wp_parse_args( $menu_item_data, $defaults );
if ( 0 == $menu_id ) {
$args['menu-item-position'] = 1;
} elseif ( 0 == (int) $args['menu-item-position'] ) {
$menu_items = 0 == $menu_id ? array() : (array) wp_get_nav_menu_items( $menu_id, array( 'post_status' => 'publish,draft' ) );
$last_item = array_pop( $menu_items );
$args['menu-item-position'] = ( $last_item && isset( $last_item->menu_order ) ) ? 1 + $last_item->menu_order : count( $menu_items );
}
$original_parent = 0 < $menu_item_db_id ? get_post_field( 'post_parent', $menu_item_db_id ) : 0;
if ( 'custom' === $args['menu-item-type'] ) {
// If custom menu item, trim the URL.
$args['menu-item-url'] = trim( $args['menu-item-url'] );
} else {
/*
* If non-custom menu item, then:
* - use the original object's URL.
* - blank default title to sync with the original object's title.
*/
$args['menu-item-url'] = '';
$original_title = '';
if ( 'taxonomy' === $args['menu-item-type'] ) {
$original_parent = get_term_field( 'parent', $args['menu-item-object-id'], $args['menu-item-object'], 'raw' );
$original_title = get_term_field( 'name', $args['menu-item-object-id'], $args['menu-item-object'], 'raw' );
} elseif ( 'post_type' === $args['menu-item-type'] ) {
$original_object = get_post( $args['menu-item-object-id'] );
$original_parent = (int) $original_object->post_parent;
$original_title = $original_object->post_title;
} elseif ( 'post_type_archive' === $args['menu-item-type'] ) {
$original_object = get_post_type_object( $args['menu-item-object'] );
if ( $original_object ) {
$original_title = $original_object->labels->archives;
}
}
if ( wp_unslash( $args['menu-item-title'] ) === wp_specialchars_decode( $original_title ) ) {
$args['menu-item-title'] = '';
}
// Hack to get wp to create a post object when too many properties are empty.
if ( '' === $args['menu-item-title'] && '' === $args['menu-item-description'] ) {
$args['menu-item-description'] = ' ';
}
}
// Populate the menu item object.
$post = array(
'menu_order' => $args['menu-item-position'],
'ping_status' => 0,
'post_content' => $args['menu-item-description'],
'post_excerpt' => $args['menu-item-attr-title'],
'post_parent' => $original_parent,
'post_title' => $args['menu-item-title'],
'post_type' => 'nav_menu_item',
);
$post_date = wp_resolve_post_date( $args['menu-item-post-date'], $args['menu-item-post-date-gmt'] );
if ( $post_date ) {
$post['post_date'] = $post_date;
}
$update = 0 != $menu_item_db_id;
// New menu item. Default is draft status.
if ( ! $update ) {
$post['ID'] = 0;
$post['post_status'] = 'publish' === $args['menu-item-status'] ? 'publish' : 'draft';
$menu_item_db_id = wp_insert_post( $post, true, $fire_after_hooks );
if ( ! $menu_item_db_id || is_wp_error( $menu_item_db_id ) ) {
return $menu_item_db_id;
}
/**
* Fires immediately after a new navigation menu item has been added.
*
* @since 4.4.0
*
* @see wp_update_nav_menu_item()
*
* @param int $menu_id ID of the updated menu.
* @param int $menu_item_db_id ID of the new menu item.
* @param array $args An array of arguments used to update/add the menu item.
*/
do_action( 'wp_add_nav_menu_item', $menu_id, $menu_item_db_id, $args );
}
// Associate the menu item with the menu term.
// Only set the menu term if it isn't set to avoid unnecessary wp_get_object_terms().
if ( $menu_id && ( ! $update || ! is_object_in_term( $menu_item_db_id, 'nav_menu', (int) $menu->term_id ) ) ) {
$update_terms = wp_set_object_terms( $menu_item_db_id, array( $menu->term_id ), 'nav_menu' );
if ( is_wp_error( $update_terms ) ) {
return $update_terms;
}
}
if ( 'custom' === $args['menu-item-type'] ) {
$args['menu-item-object-id'] = $menu_item_db_id;
$args['menu-item-object'] = 'custom';
}
$menu_item_db_id = (int) $menu_item_db_id;
update_post_meta( $menu_item_db_id, '_menu_item_type', sanitize_key( $args['menu-item-type'] ) );
update_post_meta( $menu_item_db_id, '_menu_item_menu_item_parent', (string) ( (int) $args['menu-item-parent-id'] ) );
update_post_meta( $menu_item_db_id, '_menu_item_object_id', (string) ( (int) $args['menu-item-object-id'] ) );
update_post_meta( $menu_item_db_id, '_menu_item_object', sanitize_key( $args['menu-item-object'] ) );
update_post_meta( $menu_item_db_id, '_menu_item_target', sanitize_key( $args['menu-item-target'] ) );
$args['menu-item-classes'] = array_map( 'sanitize_html_class', explode( ' ', $args['menu-item-classes'] ) );
$args['menu-item-xfn'] = implode( ' ', array_map( 'sanitize_html_class', explode( ' ', $args['menu-item-xfn'] ) ) );
update_post_meta( $menu_item_db_id, '_menu_item_classes', $args['menu-item-classes'] );
update_post_meta( $menu_item_db_id, '_menu_item_xfn', $args['menu-item-xfn'] );
update_post_meta( $menu_item_db_id, '_menu_item_url', sanitize_url( $args['menu-item-url'] ) );
if ( 0 == $menu_id ) {
update_post_meta( $menu_item_db_id, '_menu_item_orphaned', (string) time() );
} elseif ( get_post_meta( $menu_item_db_id, '_menu_item_orphaned' ) ) {
delete_post_meta( $menu_item_db_id, '_menu_item_orphaned' );
}
// Update existing menu item. Default is publish status.
if ( $update ) {
$post['ID'] = $menu_item_db_id;
$post['post_status'] = ( 'draft' === $args['menu-item-status'] ) ? 'draft' : 'publish';
$update_post = wp_update_post( $post, true );
if ( is_wp_error( $update_post ) ) {
return $update_post;
}
}
/**
* Fires after a navigation menu item has been updated.
*
* @since 3.0.0
*
* @see wp_update_nav_menu_item()
*
* @param int $menu_id ID of the updated menu.
* @param int $menu_item_db_id ID of the updated menu item.
* @param array $args An array of arguments used to update a menu item.
*/
do_action( 'wp_update_nav_menu_item', $menu_id, $menu_item_db_id, $args );
return $menu_item_db_id;
}
```
[do\_action( 'wp\_add\_nav\_menu\_item', int $menu\_id, int $menu\_item\_db\_id, array $args )](../hooks/wp_add_nav_menu_item)
Fires immediately after a new navigation menu item has been added.
[do\_action( 'wp\_update\_nav\_menu\_item', int $menu\_id, int $menu\_item\_db\_id, array $args )](../hooks/wp_update_nav_menu_item)
Fires after a navigation menu item has been updated.
| 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. |
| [wp\_insert\_post()](wp_insert_post) wp-includes/post.php | Inserts or update a post. |
| [wp\_get\_nav\_menu\_object()](wp_get_nav_menu_object) wp-includes/nav-menu.php | Returns a navigation menu object. |
| [wp\_get\_nav\_menu\_items()](wp_get_nav_menu_items) wp-includes/nav-menu.php | Retrieves all menu items of a navigation menu. |
| [is\_nav\_menu\_item()](is_nav_menu_item) wp-includes/nav-menu.php | Determines whether the given ID is a nav menu item. |
| [get\_post\_field()](get_post_field) wp-includes/post.php | Retrieves data from a post field based on Post ID. |
| [delete\_post\_meta()](delete_post_meta) wp-includes/post.php | Deletes a post meta field for the given post ID. |
| [update\_post\_meta()](update_post_meta) wp-includes/post.php | Updates a post meta field based on the given post ID. |
| [wp\_update\_post()](wp_update_post) wp-includes/post.php | Updates a post with new post data. |
| [get\_term\_field()](get_term_field) wp-includes/taxonomy.php | Gets sanitized term field. |
| [wp\_set\_object\_terms()](wp_set_object_terms) wp-includes/taxonomy.php | Creates term and taxonomy relationships. |
| [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. |
| [sanitize\_url()](sanitize_url) wp-includes/formatting.php | Sanitizes a URL for database or redirect usage. |
| [wp\_specialchars\_decode()](wp_specialchars_decode) wp-includes/formatting.php | Converts a number of HTML entities into their special characters. |
| [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. |
| [get\_post\_meta()](get_post_meta) wp-includes/post.php | Retrieves a post meta field for the given post ID. |
| [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. |
| [get\_post\_type\_object()](get_post_type_object) wp-includes/post.php | Retrieves a post type object by name. |
| [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. |
| [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\_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\_Customize\_Nav\_Menu\_Item\_Setting::update()](../classes/wp_customize_nav_menu_item_setting/update) wp-includes/customize/class-wp-customize-nav-menu-item-setting.php | Creates/updates the nav\_menu\_item post for this setting. |
| [wp\_nav\_menu\_update\_menu\_items()](wp_nav_menu_update_menu_items) wp-admin/includes/nav-menu.php | Saves nav menu items |
| [wp\_save\_nav\_menu\_items()](wp_save_nav_menu_items) wp-admin/includes/nav-menu.php | Save posted nav menu item data. |
| [\_wp\_auto\_add\_pages\_to\_menu()](_wp_auto_add_pages_to_menu) wp-includes/nav-menu.php | Automatically add newly published page objects to menus with that as an option. |
| Version | Description |
| --- | --- |
| [5.9.0](https://developer.wordpress.org/reference/since/5.9.0/) | Added the `$fire_after_hooks` parameter. |
| [3.0.0](https://developer.wordpress.org/reference/since/3.0.0/) | Introduced. |
| programming_docs |
wordpress wp_match_mime_types( string|string[] $wildcard_mime_types, string|string[] $real_mime_types ): array wp\_match\_mime\_types( string|string[] $wildcard\_mime\_types, string|string[] $real\_mime\_types ): array
===========================================================================================================
Checks a MIME-Type against a list.
If the `$wildcard_mime_types` parameter is a string, it must be comma separated list. If the `$real_mime_types` is a string, it is also comma separated to create the list.
`$wildcard_mime_types` string|string[] Required Mime types, e.g. `audio/mpeg`, `image` (same as `image/*`), or `flash` (same as `*flash*`). `$real_mime_types` string|string[] Required Real post mime type values. array array(wildcard=>array(real types)).
File: `wp-includes/post.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/post.php/)
```
function wp_match_mime_types( $wildcard_mime_types, $real_mime_types ) {
$matches = array();
if ( is_string( $wildcard_mime_types ) ) {
$wildcard_mime_types = array_map( 'trim', explode( ',', $wildcard_mime_types ) );
}
if ( is_string( $real_mime_types ) ) {
$real_mime_types = array_map( 'trim', explode( ',', $real_mime_types ) );
}
$patternses = array();
$wild = '[-._a-z0-9]*';
foreach ( (array) $wildcard_mime_types as $type ) {
$mimes = array_map( 'trim', explode( ',', $type ) );
foreach ( $mimes as $mime ) {
$regex = str_replace( '__wildcard__', $wild, preg_quote( str_replace( '*', '__wildcard__', $mime ) ) );
$patternses[][ $type ] = "^$regex$";
if ( false === strpos( $mime, '/' ) ) {
$patternses[][ $type ] = "^$regex/";
$patternses[][ $type ] = $regex;
}
}
}
asort( $patternses );
foreach ( $patternses as $patterns ) {
foreach ( $patterns as $type => $pattern ) {
foreach ( (array) $real_mime_types as $real ) {
if ( preg_match( "#$pattern#", $real )
&& ( empty( $matches[ $type ] ) || false === array_search( $real, $matches[ $type ], true ) )
) {
$matches[ $type ][] = $real;
}
}
}
}
return $matches;
}
```
| Used By | Description |
| --- | --- |
| [media\_upload\_library\_form()](media_upload_library_form) wp-admin/includes/media.php | Outputs the legacy media upload form for the media library. |
| [get\_media\_item()](get_media_item) wp-admin/includes/media.php | Retrieves HTML form for modifying the image attachment. |
| [wp\_ajax\_upload\_attachment()](wp_ajax_upload_attachment) wp-admin/includes/ajax-actions.php | Ajax handler for uploading attachments |
| [WP\_Media\_List\_Table::get\_views()](../classes/wp_media_list_table/get_views) wp-admin/includes/class-wp-media-list-table.php | |
| [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\_mime\_type\_icon()](wp_mime_type_icon) wp-includes/post.php | Retrieves the icon for a MIME type or attachment. |
| Version | Description |
| --- | --- |
| [2.5.0](https://developer.wordpress.org/reference/since/2.5.0/) | Introduced. |
wordpress user_can_edit_post_comments( int $user_id, int $post_id, int $blog_id = 1 ): bool user\_can\_edit\_post\_comments( 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 delete 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 returns true if $user\_id can edit $post\_id's comments
File: `wp-includes/deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/deprecated.php/)
```
function user_can_edit_post_comments($user_id, $post_id, $blog_id = 1) {
_deprecated_function( __FUNCTION__, '2.0.0', 'current_user_can()' );
// Right now if one can edit a post, one can edit comments made on it.
return user_can_edit_post($user_id, $post_id, $blog_id);
}
```
| Uses | Description |
| --- | --- |
| [user\_can\_edit\_post()](user_can_edit_post) wp-includes/deprecated.php | Whether user can edit a post. |
| [\_deprecated\_function()](_deprecated_function) wp-includes/functions.php | Marks a function as deprecated and inform when it has been used. |
| Used By | Description |
| --- | --- |
| [user\_can\_delete\_post\_comments()](user_can_delete_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_make_content_images_responsive( string $content ): string wp\_make\_content\_images\_responsive( string $content ): string
================================================================
This function has been deprecated. Use [wp\_image\_add\_srcset\_and\_sizes()](wp_image_add_srcset_and_sizes) instead.
Filters ‘img’ elements in post content to add ‘srcset’ and ‘sizes’ attributes.
* [wp\_image\_add\_srcset\_and\_sizes()](wp_image_add_srcset_and_sizes)
`$content` string Required The raw post content to be filtered. string Converted content with `'srcset'` and `'sizes'` attributes added to images.
File: `wp-includes/deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/deprecated.php/)
```
function wp_make_content_images_responsive( $content ) {
_deprecated_function( __FUNCTION__, '5.5.0', 'wp_filter_content_tags()' );
// This will also add the `loading` attribute to `img` tags, if enabled.
return wp_filter_content_tags( $content );
}
```
| Uses | Description |
| --- | --- |
| [wp\_filter\_content\_tags()](wp_filter_content_tags) wp-includes/media.php | Filters specific tags in post content and modifies their markup. |
| [\_deprecated\_function()](_deprecated_function) wp-includes/functions.php | Marks a function as deprecated and inform when it has been used. |
| Version | Description |
| --- | --- |
| [5.5.0](https://developer.wordpress.org/reference/since/5.5.0/) | This function has been deprecated. Use [wp\_image\_add\_srcset\_and\_sizes()](wp_image_add_srcset_and_sizes) instead. |
| [4.4.0](https://developer.wordpress.org/reference/since/4.4.0/) | Introduced. |
wordpress wp_ajax_wp_compression_test() wp\_ajax\_wp\_compression\_test()
=================================
Ajax handler for compression testing.
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_compression_test() {
if ( ! current_user_can( 'manage_options' ) ) {
wp_die( -1 );
}
if ( ini_get( 'zlib.output_compression' ) || 'ob_gzhandler' === ini_get( 'output_handler' ) ) {
update_site_option( 'can_compress_scripts', 0 );
wp_die( 0 );
}
if ( isset( $_GET['test'] ) ) {
header( 'Expires: Wed, 11 Jan 1984 05:00:00 GMT' );
header( 'Last-Modified: ' . gmdate( 'D, d M Y H:i:s' ) . ' GMT' );
header( 'Cache-Control: no-cache, must-revalidate, max-age=0' );
header( 'Content-Type: application/javascript; charset=UTF-8' );
$force_gzip = ( defined( 'ENFORCE_GZIP' ) && ENFORCE_GZIP );
$test_str = '"wpCompressionTest Lorem ipsum dolor sit amet consectetuer mollis sapien urna ut a. Eu nonummy condimentum fringilla tempor pretium platea vel nibh netus Maecenas. Hac molestie amet justo quis pellentesque est ultrices interdum nibh Morbi. Cras mattis pretium Phasellus ante ipsum ipsum ut sociis Suspendisse Lorem. Ante et non molestie. Porta urna Vestibulum egestas id congue nibh eu risus gravida sit. Ac augue auctor Ut et non a elit massa id sodales. Elit eu Nulla at nibh adipiscing mattis lacus mauris at tempus. Netus nibh quis suscipit nec feugiat eget sed lorem et urna. Pellentesque lacus at ut massa consectetuer ligula ut auctor semper Pellentesque. Ut metus massa nibh quam Curabitur molestie nec mauris congue. Volutpat molestie elit justo facilisis neque ac risus Ut nascetur tristique. Vitae sit lorem tellus et quis Phasellus lacus tincidunt nunc Fusce. Pharetra wisi Suspendisse mus sagittis libero lacinia Integer consequat ac Phasellus. Et urna ac cursus tortor aliquam Aliquam amet tellus volutpat Vestibulum. Justo interdum condimentum In augue congue tellus sollicitudin Quisque quis nibh."';
if ( 1 == $_GET['test'] ) {
echo $test_str;
wp_die();
} elseif ( 2 == $_GET['test'] ) {
if ( ! isset( $_SERVER['HTTP_ACCEPT_ENCODING'] ) ) {
wp_die( -1 );
}
if ( false !== stripos( $_SERVER['HTTP_ACCEPT_ENCODING'], 'deflate' ) && function_exists( 'gzdeflate' ) && ! $force_gzip ) {
header( 'Content-Encoding: deflate' );
$out = gzdeflate( $test_str, 1 );
} elseif ( false !== stripos( $_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip' ) && function_exists( 'gzencode' ) ) {
header( 'Content-Encoding: gzip' );
$out = gzencode( $test_str, 1 );
} else {
wp_die( -1 );
}
echo $out;
wp_die();
} elseif ( 'no' === $_GET['test'] ) {
check_ajax_referer( 'update_can_compress_scripts' );
update_site_option( 'can_compress_scripts', 0 );
} elseif ( 'yes' === $_GET['test'] ) {
check_ajax_referer( 'update_can_compress_scripts' );
update_site_option( 'can_compress_scripts', 1 );
}
}
wp_die( 0 );
}
```
| Uses | Description |
| --- | --- |
| [stripos()](stripos) wp-includes/class-pop3.php | |
| [update\_site\_option()](update_site_option) wp-includes/option.php | Updates the value of an option that was already added for the current network. |
| [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 documentation_link() documentation\_link()
=====================
This function has been deprecated.
Unused Admin function.
File: `wp-admin/includes/deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/deprecated.php/)
```
function documentation_link() {
_deprecated_function( __FUNCTION__, '2.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 |
| --- | --- |
| [2.5.0](https://developer.wordpress.org/reference/since/2.5.0/) | This function has been deprecated. |
| [2.0.0](https://developer.wordpress.org/reference/since/2.0.0/) | Introduced. |
wordpress register_activation_hook( string $file, callable $callback ) register\_activation\_hook( string $file, callable $callback )
==============================================================
Set the activation hook for a plugin.
When a plugin is activated, the action ‘activate\_PLUGINNAME’ hook is called. In the name of this hook, PLUGINNAME is replaced with the name of the plugin, including the optional subdirectory. For example, when the plugin is located in wp-content/plugins/sampleplugin/sample.php, then the name of this hook will become ‘activate\_sampleplugin/sample.php’.
When the plugin consists of only one file and is (as by default) located at wp-content/plugins/sample.php the name of this hook will be ‘activate\_sample.php’.
`$file` string Required The filename of the plugin including the path. `$callback` callable Required The function hooked to the `'activate_PLUGIN'` action. Related discussion with another sample of working code: <https://wordpress.org/support/topic/312342>
**Registering the hook inside the ‘plugins\_loaded’ hook will not work.** You can’t call [register\_activation\_hook()](register_activation_hook) inside a function hooked to the ['plugins\_loaded'](https://codex.wordpress.org/Plugin_API/Action_Reference/plugins_loaded "Plugin API/Action Reference/plugins loaded") or ['init'](https://codex.wordpress.org/Plugin_API/Action_Reference/init "Plugin API/Action Reference/init") hooks (or any other hook). These hooks are called *before* the plugin is loaded or activated.
When a plugin is activated, all active plugins are loaded, then the plugin is activated. The plugin’s activation hook is run and then the page is immediately redirected
If you are interested in doing something just after a plugin has been activated it is important to note that the hook process performs an instant redirect after it fires. So it is impossible to use [add\_action()](add_action) or [add\_filter()](add_filter) type calls until the redirect has occurred (e.g., only two hooks are fired after the plugin’s activation hook: ['activated\_plugin'](https://codex.wordpress.org/Plugin_API/Action_Reference/activated_plugin "Plugin API/Action Reference/activated plugin") and ['shutdown'](https://codex.wordpress.org/Plugin_API/Action_Reference/shutdown "Plugin API/Action Reference/shutdown")). A quick workaround to this quirk is to use [add\_option()](add_option) like so:
```
/* Main Plugin File */
...
function my_plugin_activate() {
add_option( 'Activated_Plugin', 'Plugin-Slug' );
/* activation code here */
}
register_activation_hook( __FILE__, 'my_plugin_activate' );
function load_plugin() {
if ( is_admin() && get_option( 'Activated_Plugin' ) == 'Plugin-Slug' ) {
delete_option( 'Activated_Plugin' );
/* do stuff once right after activation */
// example: add_action( 'init', 'my_init_function' );
}
}
add_action( 'admin_init', 'load_plugin' );
```
You can check out the full post @ <http://stackoverflow.com/questions/7738953/is-there-a-way-to-determine-if-a-wordpress-plugin-is-just-installed/13927297#13927297>.
However, it **is** possible to use [do\_action()](do_action) , like this:
```
function my_plugin_activate() {
do_action( 'my_plugin_activate' );
}
register_activation_hook( __FILE__, 'my_plugin_activate' );
```
Included plugin files and even other plugins *will* be able to hook into this action.
If you’re using global variables, you may find that the function you pass to [register\_activation\_hook()](register_activation_hook) does not have access to global variables at the point when it is called, even though you state their global scope within the function like this:
```
$myvar = 'whatever';
function myplugin_activate() {
global $myvar;
echo $myvar; // this will NOT be 'whatever'!
}
register_activation_hook( __FILE__, 'myplugin_activate' );
```
This is because on that very first include, your plugin is NOT included within the global scope. It’s included in the [activate\_plugin()](activate_plugin) function, and so its “main body” is not automatically in the global scope.
This is why you should *always* be explicit. If you want a variable to be global, then you need to declare it as such, and that means anywhere and everywhere you use it. If you use it in the main body of the plugin, then you need to declare it global there too.
When activation occurs, your plugin is included from another function and then your myplugin\_activate() is called from within that function (specifically, within the [activate\_plugin()](activate_plugin) function) at the point where your plugin is activated. The main body variables are therefore in the scope of the [activate\_plugin()](activate_plugin) function and are not global, unless you explicitly declare their global scope:
```
global $myvar;
$myvar = 'whatever';
function myplugin_activate() {
global $myvar;
echo $myvar; // this will be 'whatever'
}
register_activation_hook( __FILE__, 'myplugin_activate' );
```
More information on this is available here: <https://wordpress.org/support/topic/201309>
* A good example for a basic activation/deactivation/uninstall class by “kaiser” can be found here on WPSE: <http://wordpress.stackexchange.com/questions/25910/uninstall-a-plugin-method-typical-features-how-to/25979#25979>
File: `wp-includes/plugin.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/plugin.php/)
```
function register_activation_hook( $file, $callback ) {
$file = plugin_basename( $file );
add_action( 'activate_' . $file, $callback );
}
```
| Uses | Description |
| --- | --- |
| [plugin\_basename()](plugin_basename) wp-includes/plugin.php | Gets the basename of a plugin. |
| [add\_action()](add_action) wp-includes/plugin.php | Adds a callback function to an action hook. |
| Version | Description |
| --- | --- |
| [2.0.0](https://developer.wordpress.org/reference/since/2.0.0/) | Introduced. |
wordpress rest_stabilize_value( mixed $value ): mixed rest\_stabilize\_value( mixed $value ): mixed
=============================================
Stabilizes a value following JSON Schema semantics.
For lists, order is preserved. For objects, properties are reordered alphabetically.
`$value` mixed Required The value to stabilize. Must already be sanitized. Objects should have been converted to arrays. mixed The stabilized value.
File: `wp-includes/rest-api.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/rest-api.php/)
```
function rest_stabilize_value( $value ) {
if ( is_scalar( $value ) || is_null( $value ) ) {
return $value;
}
if ( is_object( $value ) ) {
_doing_it_wrong( __FUNCTION__, __( 'Cannot stabilize objects. Convert the object to an array first.' ), '5.5.0' );
return $value;
}
ksort( $value );
foreach ( $value as $k => $v ) {
$value[ $k ] = rest_stabilize_value( $v );
}
return $value;
}
```
| Uses | Description |
| --- | --- |
| [rest\_stabilize\_value()](rest_stabilize_value) wp-includes/rest-api.php | Stabilizes a value following JSON Schema semantics. |
| [\_\_()](__) 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\_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\_stabilize\_value()](rest_stabilize_value) wp-includes/rest-api.php | Stabilizes a value following JSON Schema semantics. |
| Version | Description |
| --- | --- |
| [5.5.0](https://developer.wordpress.org/reference/since/5.5.0/) | Introduced. |
wordpress esc_html_x( string $text, string $context, string $domain = 'default' ): string esc\_html\_x( string $text, string $context, string $domain = 'default' ): string
=================================================================================
Translates string with gettext context, and escapes it for safe use in HTML output.
If there is no translation, or the text domain isn’t loaded, the original text is escaped and returned.
`$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'`
string Translated text.
File: `wp-includes/l10n.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/l10n.php/)
```
function esc_html_x( $text, $context, $domain = 'default' ) {
return esc_html( translate_with_gettext_context( $text, $context, $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. |
| [esc\_html()](esc_html) wp-includes/formatting.php | Escaping for HTML blocks. |
| Used By | Description |
| --- | --- |
| [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. |
| Version | Description |
| --- | --- |
| [2.9.0](https://developer.wordpress.org/reference/since/2.9.0/) | Introduced. |
| programming_docs |
wordpress do_shortcodes_in_html_tags( string $content, bool $ignore_html, array $tagnames ): string do\_shortcodes\_in\_html\_tags( string $content, bool $ignore\_html, array $tagnames ): string
==============================================================================================
Searches only inside HTML elements for shortcodes and process them.
Any [ or ] characters remaining inside elements will be HTML encoded to prevent interference with shortcodes that are outside the elements.
Assumes $content processed by KSES already. Users with unfiltered\_html capability may get unexpected output if angle braces are nested in tags.
`$content` string Required Content to search for shortcodes. `$ignore_html` bool Required When true, all square braces inside elements will be encoded. `$tagnames` array Required List of shortcodes to find. 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 do_shortcodes_in_html_tags( $content, $ignore_html, $tagnames ) {
// Normalize entities in unfiltered HTML before adding placeholders.
$trans = array(
'[' => '[',
']' => ']',
);
$content = strtr( $content, $trans );
$trans = array(
'[' => '[',
']' => ']',
);
$pattern = get_shortcode_regex( $tagnames );
$textarr = wp_html_split( $content );
foreach ( $textarr as &$element ) {
if ( '' === $element || '<' !== $element[0] ) {
continue;
}
$noopen = false === strpos( $element, '[' );
$noclose = false === strpos( $element, ']' );
if ( $noopen || $noclose ) {
// This element does not contain shortcodes.
if ( $noopen xor $noclose ) {
// Need to encode stray '[' or ']' chars.
$element = strtr( $element, $trans );
}
continue;
}
if ( $ignore_html || '<!--' === substr( $element, 0, 4 ) || '<![CDATA[' === substr( $element, 0, 9 ) ) {
// Encode all '[' and ']' chars.
$element = strtr( $element, $trans );
continue;
}
$attributes = wp_kses_attr_parse( $element );
if ( false === $attributes ) {
// Some plugins are doing things like [name] <[email]>.
if ( 1 === preg_match( '%^<\s*\[\[?[^\[\]]+\]%', $element ) ) {
$element = preg_replace_callback( "/$pattern/", 'do_shortcode_tag', $element );
}
// Looks like we found some crazy unfiltered HTML. Skipping it for sanity.
$element = strtr( $element, $trans );
continue;
}
// Get element name.
$front = array_shift( $attributes );
$back = array_pop( $attributes );
$matches = array();
preg_match( '%[a-zA-Z0-9]+%', $front, $matches );
$elname = $matches[0];
// Look for shortcodes in each attribute separately.
foreach ( $attributes as &$attr ) {
$open = strpos( $attr, '[' );
$close = strpos( $attr, ']' );
if ( false === $open || false === $close ) {
continue; // Go to next attribute. Square braces will be escaped at end of loop.
}
$double = strpos( $attr, '"' );
$single = strpos( $attr, "'" );
if ( ( false === $single || $open < $single ) && ( false === $double || $open < $double ) ) {
/*
* $attr like '[shortcode]' or 'name = [shortcode]' implies unfiltered_html.
* In this specific situation we assume KSES did not run because the input
* was written by an administrator, so we should avoid changing the output
* and we do not need to run KSES here.
*/
$attr = preg_replace_callback( "/$pattern/", 'do_shortcode_tag', $attr );
} else {
// $attr like 'name = "[shortcode]"' or "name = '[shortcode]'".
// We do not know if $content was unfiltered. Assume KSES ran before shortcodes.
$count = 0;
$new_attr = preg_replace_callback( "/$pattern/", 'do_shortcode_tag', $attr, -1, $count );
if ( $count > 0 ) {
// Sanitize the shortcode output using KSES.
$new_attr = wp_kses_one_attr( $new_attr, $elname );
if ( '' !== trim( $new_attr ) ) {
// The shortcode is safe to use now.
$attr = $new_attr;
}
}
}
}
$element = $front . implode( '', $attributes ) . $back;
// Now encode any remaining '[' or ']' chars.
$element = strtr( $element, $trans );
}
$content = implode( '', $textarr );
return $content;
}
```
| Uses | Description |
| --- | --- |
| [wp\_html\_split()](wp_html_split) wp-includes/formatting.php | Separates HTML elements and comments from the text. |
| [wp\_kses\_attr\_parse()](wp_kses_attr_parse) wp-includes/kses.php | Finds all attributes of an HTML element. |
| [wp\_kses\_one\_attr()](wp_kses_one_attr) wp-includes/kses.php | Filters one HTML attribute and ensures its value is allowed. |
| [get\_shortcode\_regex()](get_shortcode_regex) wp-includes/shortcodes.php | Retrieves the shortcode regular expression for searching. |
| Used By | Description |
| --- | --- |
| [do\_shortcode()](do_shortcode) wp-includes/shortcodes.php | Searches content for shortcodes and filter shortcodes through their hooks. |
| [strip\_shortcodes()](strip_shortcodes) wp-includes/shortcodes.php | Removes all shortcode tags from the given content. |
| Version | Description |
| --- | --- |
| [4.2.3](https://developer.wordpress.org/reference/since/4.2.3/) | Introduced. |
wordpress get_locale_stylesheet_uri(): string get\_locale\_stylesheet\_uri(): string
======================================
Retrieves the localized stylesheet URI.
The stylesheet directory for the localized stylesheet files are located, by default, in the base theme directory. The name of the locale file will be the locale followed by ‘.css’. If that does not exist, then the text direction stylesheet will be checked for existence, for example ‘ltr.css’.
The theme may change the location of the stylesheet directory by either using the [‘stylesheet\_directory\_uri’](../hooks/stylesheet_directory_uri) or [‘locale\_stylesheet\_uri’](../hooks/locale_stylesheet_uri) filters.
If you want to change the location of the stylesheet files for the entire WordPress workflow, then change the former. If you just have the locale in a separate folder, then change the latter.
string URI to active theme's localized stylesheet.
File: `wp-includes/theme.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/theme.php/)
```
function get_locale_stylesheet_uri() {
global $wp_locale;
$stylesheet_dir_uri = get_stylesheet_directory_uri();
$dir = get_stylesheet_directory();
$locale = get_locale();
if ( file_exists( "$dir/$locale.css" ) ) {
$stylesheet_uri = "$stylesheet_dir_uri/$locale.css";
} elseif ( ! empty( $wp_locale->text_direction ) && file_exists( "$dir/{$wp_locale->text_direction}.css" ) ) {
$stylesheet_uri = "$stylesheet_dir_uri/{$wp_locale->text_direction}.css";
} else {
$stylesheet_uri = '';
}
/**
* Filters the localized stylesheet URI.
*
* @since 2.1.0
*
* @param string $stylesheet_uri Localized stylesheet URI.
* @param string $stylesheet_dir_uri Stylesheet directory URI.
*/
return apply_filters( 'locale_stylesheet_uri', $stylesheet_uri, $stylesheet_dir_uri );
}
```
[apply\_filters( 'locale\_stylesheet\_uri', string $stylesheet\_uri, string $stylesheet\_dir\_uri )](../hooks/locale_stylesheet_uri)
Filters the localized stylesheet URI.
| Uses | Description |
| --- | --- |
| [get\_stylesheet\_directory\_uri()](get_stylesheet_directory_uri) wp-includes/theme.php | Retrieves stylesheet directory URI for the active theme. |
| [get\_stylesheet\_directory()](get_stylesheet_directory) wp-includes/theme.php | Retrieves stylesheet directory path for the active theme. |
| [get\_locale()](get_locale) wp-includes/l10n.php | Retrieves the current locale. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| Used By | Description |
| --- | --- |
| [locale\_stylesheet()](locale_stylesheet) wp-includes/theme.php | Displays localized stylesheet link element. |
| Version | Description |
| --- | --- |
| [2.1.0](https://developer.wordpress.org/reference/since/2.1.0/) | Introduced. |
wordpress dropdown_categories( int $default_category, int $category_parent, array $popular_ids = array() ) dropdown\_categories( int $default\_category, int $category\_parent, array $popular\_ids = array() )
====================================================================================================
This function has been deprecated. Use [wp\_category\_checklist()](wp_category_checklist) instead.
Legacy function used to generate the categories checklist control.
* [wp\_category\_checklist()](wp_category_checklist)
`$default_category` int Required Unused. `$category_parent` int Required Unused. `$popular_ids` array Optional Unused. Default: `array()`
File: `wp-admin/includes/deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/deprecated.php/)
```
function dropdown_categories( $default_category = 0, $category_parent = 0, $popular_ids = array() ) {
_deprecated_function( __FUNCTION__, '2.6.0', 'wp_category_checklist()' );
global $post_ID;
wp_category_checklist( $post_ID );
}
```
| Uses | Description |
| --- | --- |
| [wp\_category\_checklist()](wp_category_checklist) wp-admin/includes/template.php | Outputs an unordered list of checkbox input elements labeled with category names. |
| [\_deprecated\_function()](_deprecated_function) wp-includes/functions.php | Marks a function as deprecated and inform when it has been used. |
| Version | Description |
| --- | --- |
| [2.6.0](https://developer.wordpress.org/reference/since/2.6.0/) | Use [wp\_category\_checklist()](wp_category_checklist) |
| [0.71](https://developer.wordpress.org/reference/since/0.71/) | Introduced. |
wordpress next_image_link( string|int[] $size = 'thumbnail', string|false $text = false ) next\_image\_link( string|int[] $size = 'thumbnail', string|false $text = false )
=================================================================================
Displays next image link that has the same post parent.
`$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`
* Whenever a series of images are linked to the attachment page, it will put a ‘next image link’ with the images when viewed in the attachment page.
* Typically uses in `attachment.php`. In the WordPress default theme Twenty Eleven and Twenty Twelve, it is used in `image.php`.
```
next_image_link( $size, $text );
```
File: `wp-includes/media.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/media.php/)
```
function next_image_link( $size = 'thumbnail', $text = false ) {
echo get_next_image_link( $size, $text );
}
```
| Uses | Description |
| --- | --- |
| [get\_next\_image\_link()](get_next_image_link) wp-includes/media.php | Gets the next image link that has the same post parent. |
| Version | Description |
| --- | --- |
| [2.5.0](https://developer.wordpress.org/reference/since/2.5.0/) | Introduced. |
wordpress get_user_to_edit( int $user_id ): WP_User|false get\_user\_to\_edit( int $user\_id ): WP\_User|false
====================================================
Retrieve user data and filter it.
`$user_id` int Required User ID. [WP\_User](../classes/wp_user)|false [WP\_User](../classes/wp_user) object on success, false on failure.
File: `wp-admin/includes/user.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/user.php/)
```
function get_user_to_edit( $user_id ) {
$user = get_userdata( $user_id );
if ( $user ) {
$user->filter = 'edit';
}
return $user;
}
```
| Uses | Description |
| --- | --- |
| [get\_userdata()](get_userdata) wp-includes/pluggable.php | Retrieves user info by user ID. |
| Version | Description |
| --- | --- |
| [2.0.5](https://developer.wordpress.org/reference/since/2.0.5/) | Introduced. |
wordpress clean_term_cache( int|int[] $ids, string $taxonomy = '', bool $clean_taxonomy = true ) clean\_term\_cache( int|int[] $ids, string $taxonomy = '', bool $clean\_taxonomy = true )
=========================================================================================
Removes all of the term IDs from the cache.
`$ids` int|int[] Required Single or array of term IDs. `$taxonomy` string Optional Taxonomy slug. Can be empty, in which case the taxonomies of the passed term IDs will be used. Default: `''`
`$clean_taxonomy` bool Optional Whether to clean taxonomy wide caches (true), or just individual term object caches (false). Default: `true`
File: `wp-includes/taxonomy.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/taxonomy.php/)
```
function clean_term_cache( $ids, $taxonomy = '', $clean_taxonomy = true ) {
global $wpdb, $_wp_suspend_cache_invalidation;
if ( ! empty( $_wp_suspend_cache_invalidation ) ) {
return;
}
if ( ! is_array( $ids ) ) {
$ids = array( $ids );
}
$taxonomies = array();
// If no taxonomy, assume tt_ids.
if ( empty( $taxonomy ) ) {
$tt_ids = array_map( 'intval', $ids );
$tt_ids = implode( ', ', $tt_ids );
$terms = $wpdb->get_results( "SELECT term_id, taxonomy FROM $wpdb->term_taxonomy WHERE term_taxonomy_id IN ($tt_ids)" );
$ids = array();
foreach ( (array) $terms as $term ) {
$taxonomies[] = $term->taxonomy;
$ids[] = $term->term_id;
}
wp_cache_delete_multiple( $ids, 'terms' );
$taxonomies = array_unique( $taxonomies );
} else {
wp_cache_delete_multiple( $ids, 'terms' );
$taxonomies = array( $taxonomy );
}
foreach ( $taxonomies as $taxonomy ) {
if ( $clean_taxonomy ) {
clean_taxonomy_cache( $taxonomy );
}
/**
* Fires once after each taxonomy's term cache has been cleaned.
*
* @since 2.5.0
* @since 4.5.0 Added the `$clean_taxonomy` parameter.
*
* @param array $ids An array of term IDs.
* @param string $taxonomy Taxonomy slug.
* @param bool $clean_taxonomy Whether or not to clean taxonomy-wide caches
*/
do_action( 'clean_term_cache', $ids, $taxonomy, $clean_taxonomy );
}
wp_cache_set( 'last_changed', microtime(), 'terms' );
}
```
[do\_action( 'clean\_term\_cache', array $ids, string $taxonomy, bool $clean\_taxonomy )](../hooks/clean_term_cache)
Fires once after each taxonomy’s term cache has been cleaned.
| Uses | Description |
| --- | --- |
| [wp\_cache\_delete\_multiple()](wp_cache_delete_multiple) wp-includes/cache.php | Deletes multiple values from the cache in one call. |
| [clean\_taxonomy\_cache()](clean_taxonomy_cache) wp-includes/taxonomy.php | Cleans the caches for a taxonomy. |
| [wp\_cache\_set()](wp_cache_set) wp-includes/cache.php | Saves the data to the cache. |
| [do\_action()](do_action) wp-includes/plugin.php | Calls the callback functions that have been added to an action 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). |
| Used By | Description |
| --- | --- |
| [clean\_category\_cache()](clean_category_cache) wp-includes/category.php | Removes the category cache data based on ID. |
| [wp\_update\_term()](wp_update_term) wp-includes/taxonomy.php | Updates term based on arguments provided. |
| [wp\_update\_term\_count\_now()](wp_update_term_count_now) wp-includes/taxonomy.php | Performs term count update immediately. |
| [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. |
| Version | Description |
| --- | --- |
| [2.3.0](https://developer.wordpress.org/reference/since/2.3.0/) | Introduced. |
wordpress get_edit_post_link( int|WP_Post $post, string $context = 'display' ): string|null get\_edit\_post\_link( int|WP\_Post $post, string $context = 'display' ): string|null
=====================================================================================
Retrieves the edit post link for post.
Can be used within the WordPress loop or outside of it. Can be used with pages, posts, attachments, and revisions.
`$post` int|[WP\_Post](../classes/wp_post) Optional Post ID or post object. Default is the global `$post`. `$context` string Optional How to output the `'&'` character. Default `'&'`. Default: `'display'`
string|null The edit post link for the given post. Null if the post type does not exist or does not allow an editing UI.
File: `wp-includes/link-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/link-template.php/)
```
function get_edit_post_link( $post = 0, $context = 'display' ) {
$post = get_post( $post );
if ( ! $post ) {
return;
}
if ( 'revision' === $post->post_type ) {
$action = '';
} elseif ( 'display' === $context ) {
$action = '&action=edit';
} else {
$action = '&action=edit';
}
$post_type_object = get_post_type_object( $post->post_type );
if ( ! $post_type_object ) {
return;
}
if ( ! current_user_can( 'edit_post', $post->ID ) ) {
return;
}
if ( $post_type_object->_edit_link ) {
$link = admin_url( sprintf( $post_type_object->_edit_link . $action, $post->ID ) );
} else {
$link = '';
}
/**
* Filters the post edit link.
*
* @since 2.3.0
*
* @param string $link The edit link.
* @param int $post_id Post ID.
* @param string $context The link context. If set to 'display' then ampersands
* are encoded.
*/
return apply_filters( 'get_edit_post_link', $link, $post->ID, $context );
}
```
[apply\_filters( 'get\_edit\_post\_link', string $link, int $post\_id, string $context )](../hooks/get_edit_post_link)
Filters the post edit link.
| Uses | Description |
| --- | --- |
| [current\_user\_can()](current_user_can) wp-includes/capabilities.php | Returns whether the current user has the specified capability. |
| [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\_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\_get\_post\_revisions\_url()](wp_get_post_revisions_url) wp-includes/revision.php | Returns the url for viewing and potentially restoring revisions of a given post. |
| [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\_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\_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::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\_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. |
| [attachment\_submitbox\_metadata()](attachment_submitbox_metadata) wp-admin/includes/media.php | Displays non-editable attachment metadata in the publish 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\_submit\_meta\_box()](post_submit_meta_box) wp-admin/includes/meta-boxes.php | Displays post submit form fields. |
| [WP\_Media\_List\_Table::\_get\_row\_actions()](../classes/wp_media_list_table/_get_row_actions) wp-admin/includes/class-wp-media-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 | |
| [redirect\_post()](redirect_post) wp-admin/includes/post.php | Redirects to previous page. |
| [edit\_post\_link()](edit_post_link) wp-includes/link-template.php | Displays the edit post link for post. |
| [wp\_admin\_bar\_edit\_menu()](wp_admin_bar_edit_menu) wp-includes/admin-bar.php | Provides an edit link for posts and terms. |
| [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\_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 |
| --- | --- |
| [2.3.0](https://developer.wordpress.org/reference/since/2.3.0/) | Introduced. |
| programming_docs |
wordpress get_most_active_blogs( int $num = 10, bool $display = true ): array get\_most\_active\_blogs( int $num = 10, bool $display = true ): array
======================================================================
This function has been deprecated.
Deprecated functionality to retrieve a list of the most active sites.
`$num` int Optional Number of activate blogs to retrieve. Default: `10`
`$display` bool Optional Whether or not to display the most active blogs list. Default: `true`
array List of "most active" sites.
File: `wp-includes/ms-deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/ms-deprecated.php/)
```
function get_most_active_blogs( $num = 10, $display = true ) {
_deprecated_function( __FUNCTION__, '3.0.0' );
$blogs = get_blog_list( 0, 'all', false ); // $blog_id -> $details
if ( is_array( $blogs ) ) {
reset( $blogs );
$most_active = array();
$blog_list = array();
foreach ( (array) $blogs as $key => $details ) {
$most_active[ $details['blog_id'] ] = $details['postcount'];
$blog_list[ $details['blog_id'] ] = $details; // array_slice() removes keys!
}
arsort( $most_active );
reset( $most_active );
$t = array();
foreach ( (array) $most_active as $key => $details ) {
$t[ $key ] = $blog_list[ $key ];
}
unset( $most_active );
$most_active = $t;
}
if ( $display ) {
if ( is_array( $most_active ) ) {
reset( $most_active );
foreach ( (array) $most_active as $key => $details ) {
$url = esc_url('http://' . $details['domain'] . $details['path']);
echo '<li>' . $details['postcount'] . " <a href='$url'>$url</a></li>";
}
}
}
return array_slice( $most_active, 0, $num );
}
```
| Uses | Description |
| --- | --- |
| [get\_blog\_list()](get_blog_list) wp-includes/ms-deprecated.php | Deprecated functionality to retrieve a list of all sites. |
| [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/) | This function has been deprecated. |
| [MU (3.0.0)](https://developer.wordpress.org/reference/since/mu.3.0.0/) | Introduced. |
wordpress iis7_delete_rewrite_rule( string $filename ): bool iis7\_delete\_rewrite\_rule( string $filename ): bool
=====================================================
Deletes WordPress rewrite rule from web.config file if it exists there.
`$filename` string Required Name of the configuration file. bool
File: `wp-admin/includes/misc.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/misc.php/)
```
function iis7_delete_rewrite_rule( $filename ) {
// If configuration file does not exist then rules also do not exist, so there is nothing to delete.
if ( ! file_exists( $filename ) ) {
return true;
}
if ( ! class_exists( 'DOMDocument', false ) ) {
return false;
}
$doc = new DOMDocument();
$doc->preserveWhiteSpace = false;
if ( $doc->load( $filename ) === false ) {
return false;
}
$xpath = new DOMXPath( $doc );
$rules = $xpath->query( '/configuration/system.webServer/rewrite/rules/rule[starts-with(@name,\'wordpress\')] | /configuration/system.webServer/rewrite/rules/rule[starts-with(@name,\'WordPress\')]' );
if ( $rules->length > 0 ) {
$child = $rules->item( 0 );
$parent = $child->parentNode;
$parent->removeChild( $child );
$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 _xmlrpc_wp_die_handler( string $message, string $title = '', string|array $args = array() ) \_xmlrpc\_wp\_die\_handler( string $message, string $title = '', string|array $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.
Kills WordPress execution and displays XML response with an error message.
This is the handler for [wp\_die()](wp_die) when processing XMLRPC requests.
`$message` string Required Error message. `$title` string Optional Error title. Default: `''`
`$args` string|array Optional Arguments to control behavior. Default: `array()`
File: `wp-includes/functions.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/functions.php/)
```
function _xmlrpc_wp_die_handler( $message, $title = '', $args = array() ) {
global $wp_xmlrpc_server;
list( $message, $title, $parsed_args ) = _wp_die_process_input( $message, $title, $args );
if ( ! headers_sent() ) {
nocache_headers();
}
if ( $wp_xmlrpc_server ) {
$error = new IXR_Error( $parsed_args['response'], $message );
$wp_xmlrpc_server->output( $error->getXml() );
}
if ( $parsed_args['exit'] ) {
die();
}
}
```
| Uses | Description |
| --- | --- |
| [nocache\_headers()](nocache_headers) wp-includes/functions.php | Sets the headers to prevent caching for the different browsers. |
| [\_wp\_die\_process\_input()](_wp_die_process_input) wp-includes/functions.php | Processes arguments passed to [wp\_die()](wp_die) consistently for its handlers. |
| [IXR\_Error::\_\_construct()](../classes/ixr_error/__construct) wp-includes/IXR/class-IXR-error.php | PHP5 constructor. |
| Version | Description |
| --- | --- |
| [3.2.0](https://developer.wordpress.org/reference/since/3.2.0/) | Introduced. |
wordpress _nc( string $single, string $plural, int $number, string $domain = 'default' ): string \_nc( string $single, string $plural, int $number, string $domain = 'default' ): string
=======================================================================================
This function has been deprecated. Use [\_nx()](_nx) instead.
Legacy version of [\_n()](_n) , which supports contexts.
Strips everything from the translation after the last bar.
* [\_nx()](_nx)
`$single` string Required The text to be used if the number is singular. `$plural` string Required The text to be used if the number is plural. `$number` int Required The number to compare against to use either the singular or plural form. `$domain` string Optional Text domain. Unique identifier for retrieving translated strings.
Default `'default'`. Default: `'default'`
string The translated singular or plural form.
File: `wp-includes/deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/deprecated.php/)
```
function _nc( $single, $plural, $number, $domain = 'default' ) {
_deprecated_function( __FUNCTION__, '2.9.0', '_nx()' );
return before_last_bar( _n( $single, $plural, $number, $domain ) );
}
```
| Uses | Description |
| --- | --- |
| [before\_last\_bar()](before_last_bar) wp-includes/l10n.php | Removes last item on a pipe-delimited string. |
| [\_n()](_n) wp-includes/l10n.php | Translates and retrieves the singular or plural form based on the supplied number. |
| [\_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 [\_nx()](_nx) |
| [2.7.0](https://developer.wordpress.org/reference/since/2.7.0/) | Introduced. |
wordpress meta_form( WP_Post $post = null ) meta\_form( WP\_Post $post = null )
===================================
Prints the form in the Custom Fields meta box.
`$post` [WP\_Post](../classes/wp_post) Optional The post being edited. Default: `null`
File: `wp-admin/includes/template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/template.php/)
```
function meta_form( $post = null ) {
global $wpdb;
$post = get_post( $post );
/**
* Filters values for the meta key dropdown in the Custom Fields meta box.
*
* Returning a non-null value will effectively short-circuit and avoid a
* potentially expensive query against postmeta.
*
* @since 4.4.0
*
* @param array|null $keys Pre-defined meta keys to be used in place of a postmeta query. Default null.
* @param WP_Post $post The current post object.
*/
$keys = apply_filters( 'postmeta_form_keys', null, $post );
if ( null === $keys ) {
/**
* Filters the number of custom fields to retrieve for the drop-down
* in the Custom Fields meta box.
*
* @since 2.1.0
*
* @param int $limit Number of custom fields to retrieve. Default 30.
*/
$limit = apply_filters( 'postmeta_form_limit', 30 );
$keys = $wpdb->get_col(
$wpdb->prepare(
"SELECT DISTINCT meta_key
FROM $wpdb->postmeta
WHERE meta_key NOT BETWEEN '_' AND '_z'
HAVING meta_key NOT LIKE %s
ORDER BY meta_key
LIMIT %d",
$wpdb->esc_like( '_' ) . '%',
$limit
)
);
}
if ( $keys ) {
natcasesort( $keys );
$meta_key_input_id = 'metakeyselect';
} else {
$meta_key_input_id = 'metakeyinput';
}
?>
<p><strong><?php _e( 'Add New Custom Field:' ); ?></strong></p>
<table id="newmeta">
<thead>
<tr>
<th class="left"><label for="<?php echo $meta_key_input_id; ?>"><?php _ex( 'Name', 'meta name' ); ?></label></th>
<th><label for="metavalue"><?php _e( 'Value' ); ?></label></th>
</tr>
</thead>
<tbody>
<tr>
<td id="newmetaleft" class="left">
<?php if ( $keys ) { ?>
<select id="metakeyselect" name="metakeyselect">
<option value="#NONE#"><?php _e( '— Select —' ); ?></option>
<?php
foreach ( $keys as $key ) {
if ( is_protected_meta( $key, 'post' ) || ! current_user_can( 'add_post_meta', $post->ID, $key ) ) {
continue;
}
echo "\n<option value='" . esc_attr( $key ) . "'>" . esc_html( $key ) . '</option>';
}
?>
</select>
<input class="hide-if-js" type="text" id="metakeyinput" name="metakeyinput" value="" />
<a href="#postcustomstuff" class="hide-if-no-js" onclick="jQuery('#metakeyinput, #metakeyselect, #enternew, #cancelnew').toggle();return false;">
<span id="enternew"><?php _e( 'Enter new' ); ?></span>
<span id="cancelnew" class="hidden"><?php _e( 'Cancel' ); ?></span></a>
<?php } else { ?>
<input type="text" id="metakeyinput" name="metakeyinput" value="" />
<?php } ?>
</td>
<td><textarea id="metavalue" name="metavalue" rows="2" cols="25"></textarea></td>
</tr>
<tr><td colspan="2">
<div class="submit">
<?php
submit_button(
__( 'Add Custom Field' ),
'',
'addmeta',
false,
array(
'id' => 'newmeta-submit',
'data-wp-lists' => 'add:the-list:newmeta',
)
);
?>
</div>
<?php wp_nonce_field( 'add-meta', '_ajax_nonce-add-meta', false ); ?>
</td></tr>
</tbody>
</table>
<?php
}
```
[apply\_filters( 'postmeta\_form\_keys', array|null $keys, WP\_Post $post )](../hooks/postmeta_form_keys)
Filters values for the meta key dropdown in the Custom Fields meta box.
[apply\_filters( 'postmeta\_form\_limit', int $limit )](../hooks/postmeta_form_limit)
Filters the number of custom fields to retrieve for the drop-down in the Custom Fields meta box.
| 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. |
| [submit\_button()](submit_button) wp-admin/includes/template.php | Echoes a submit button, with provided text and appropriate class(es). |
| [\_ex()](_ex) wp-includes/l10n.php | Displays translated string with gettext context. |
| [wp\_nonce\_field()](wp_nonce_field) wp-includes/functions.php | Retrieves or display nonce hidden field for forms. |
| [wpdb::get\_col()](../classes/wpdb/get_col) wp-includes/class-wpdb.php | Retrieves one column from the database. |
| [is\_protected\_meta()](is_protected_meta) wp-includes/meta.php | Determines whether a meta key is considered protected. |
| [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\_attr()](esc_attr) wp-includes/formatting.php | Escaping for HTML attributes. |
| [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\_post()](get_post) wp-includes/post.php | Retrieves post data given a post ID or post object. |
| [wpdb::prepare()](../classes/wpdb/prepare) wp-includes/class-wpdb.php | Prepares a SQL query for safe execution. |
| Used By | Description |
| --- | --- |
| [post\_custom\_meta\_box()](post_custom_meta_box) wp-admin/includes/meta-boxes.php | Displays custom fields form fields. |
| Version | Description |
| --- | --- |
| [1.2.0](https://developer.wordpress.org/reference/since/1.2.0/) | Introduced. |
wordpress wp_get_comment_status( int|WP_Comment $comment_id ): string|false wp\_get\_comment\_status( int|WP\_Comment $comment\_id ): string|false
======================================================================
Retrieves the status of a comment by comment ID.
`$comment_id` int|[WP\_Comment](../classes/wp_comment) Required Comment ID or [WP\_Comment](../classes/wp_comment) object string|false Status might be `'trash'`, `'approved'`, `'unapproved'`, `'spam'`. False on failure.
File: `wp-includes/comment.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/comment.php/)
```
function wp_get_comment_status( $comment_id ) {
$comment = get_comment( $comment_id );
if ( ! $comment ) {
return false;
}
$approved = $comment->comment_approved;
if ( null == $approved ) {
return false;
} elseif ( '1' == $approved ) {
return 'approved';
} elseif ( '0' == $approved ) {
return 'unapproved';
} elseif ( 'spam' === $approved ) {
return 'spam';
} elseif ( 'trash' === $approved ) {
return 'trash';
} else {
return false;
}
}
```
| Uses | Description |
| --- | --- |
| [get\_comment()](get_comment) wp-includes/comment.php | Retrieves comment data given a comment ID or comment object. |
| Used By | Description |
| --- | --- |
| [WP\_REST\_Comments\_Controller::handle\_status\_param()](../classes/wp_rest_comments_controller/handle_status_param) wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php | Sets the comment\_status of a given comment object when creating or updating a comment. |
| [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\_dashboard\_recent\_comments\_row()](_wp_dashboard_recent_comments_row) wp-admin/includes/dashboard.php | Outputs a row for the Recent Comments widget. |
| [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. |
| [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::single\_row()](../classes/wp_comments_list_table/single_row) wp-admin/includes/class-wp-comments-list-table.php | |
| [wp\_new\_comment()](wp_new_comment) wp-includes/comment.php | Adds a new comment to the database. |
| [wp\_delete\_comment()](wp_delete_comment) wp-includes/comment.php | Trashes or deletes a comment. |
| Version | Description |
| --- | --- |
| [1.0.0](https://developer.wordpress.org/reference/since/1.0.0/) | Introduced. |
wordpress wp_update_https_migration_required( mixed $old_url, mixed $new_url ) wp\_update\_https\_migration\_required( mixed $old\_url, mixed $new\_url )
==========================================================================
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 ‘https\_migration\_required’ option if needed when the given URL has been updated from HTTP to HTTPS.
If this is a fresh site, a migration will not be required, so the option will be set as `false`.
This is hooked into the [‘update\_option\_home’](../hooks/update_option_home) action.
`$old_url` mixed Required Previous value of the URL option. `$new_url` mixed Required New value of the URL option. File: `wp-includes/https-migration.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/https-migration.php/)
```
function wp_update_https_migration_required( $old_url, $new_url ) {
// Do nothing if WordPress is being installed.
if ( wp_installing() ) {
return;
}
// Delete/reset the option if the new URL is not the HTTPS version of the old URL.
if ( untrailingslashit( (string) $old_url ) !== str_replace( 'https://', 'http://', untrailingslashit( (string) $new_url ) ) ) {
delete_option( 'https_migration_required' );
return;
}
// If this is a fresh site, there is no content to migrate, so do not require migration.
$https_migration_required = get_option( 'fresh_site' ) ? false : true;
update_option( 'https_migration_required', $https_migration_required );
}
```
| Uses | Description |
| --- | --- |
| [wp\_installing()](wp_installing) wp-includes/load.php | Check or set whether WordPress is in “installation” mode. |
| [untrailingslashit()](untrailingslashit) wp-includes/formatting.php | Removes trailing forward slashes and backslashes if they exist. |
| [delete\_option()](delete_option) wp-includes/option.php | Removes option by name. Prevents removal of protected WordPress options. |
| [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. |
| Version | Description |
| --- | --- |
| [5.7.0](https://developer.wordpress.org/reference/since/5.7.0/) | Introduced. |
wordpress is_admin_bar_showing(): bool is\_admin\_bar\_showing(): bool
===============================
Determines whether the admin bar should be showing.
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 admin bar should be showing.
File: `wp-includes/admin-bar.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/admin-bar.php/)
```
function is_admin_bar_showing() {
global $show_admin_bar, $pagenow;
// For all these types of requests, we never want an admin bar.
if ( defined( 'XMLRPC_REQUEST' ) || defined( 'DOING_AJAX' ) || defined( 'IFRAME_REQUEST' ) || wp_is_json_request() ) {
return false;
}
if ( is_embed() ) {
return false;
}
// Integrated into the admin.
if ( is_admin() ) {
return true;
}
if ( ! isset( $show_admin_bar ) ) {
if ( ! is_user_logged_in() || 'wp-login.php' === $pagenow ) {
$show_admin_bar = false;
} else {
$show_admin_bar = _get_admin_bar_pref();
}
}
/**
* Filters whether to show the admin bar.
*
* Returning false to this hook is the recommended way to hide the admin bar.
* The user's display preference is used for logged in users.
*
* @since 3.1.0
*
* @param bool $show_admin_bar Whether the admin bar should be shown. Default false.
*/
$show_admin_bar = apply_filters( 'show_admin_bar', $show_admin_bar );
return $show_admin_bar;
}
```
[apply\_filters( 'show\_admin\_bar', bool $show\_admin\_bar )](../hooks/show_admin_bar)
Filters whether to show the admin bar.
| Uses | Description |
| --- | --- |
| [wp\_is\_json\_request()](wp_is_json_request) wp-includes/load.php | Checks whether current request is a JSON request, or is expecting a JSON response. |
| [is\_embed()](is_embed) wp-includes/query.php | Is the query for an embedded post? |
| [\_get\_admin\_bar\_pref()](_get_admin_bar_pref) wp-includes/admin-bar.php | Retrieves the admin bar display preference of a user. |
| [is\_user\_logged\_in()](is_user_logged_in) wp-includes/pluggable.php | Determines whether the current visitor is a logged in user. |
| [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\_admin\_html\_begin()](_wp_admin_html_begin) wp-admin/includes/template.php | Prints out the beginning of the admin HTML header. |
| [\_wp\_admin\_bar\_init()](_wp_admin_bar_init) wp-includes/admin-bar.php | Instantiates the admin bar object and set it up as a global for access elsewhere. |
| [wp\_admin\_bar\_render()](wp_admin_bar_render) wp-includes/admin-bar.php | Renders the admin bar to the page based on the $wp\_admin\_bar->menu member var. |
| [get\_body\_class()](get_body_class) wp-includes/post-template.php | Retrieves an array of the class names for the body element. |
| Version | Description |
| --- | --- |
| [3.1.0](https://developer.wordpress.org/reference/since/3.1.0/) | Introduced. |
| programming_docs |
wordpress ms_is_switched(): bool ms\_is\_switched(): bool
========================
Determines if [switch\_to\_blog()](switch_to_blog) is in effect
bool True if switched, false otherwise.
File: `wp-includes/ms-blogs.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/ms-blogs.php/)
```
function ms_is_switched() {
return ! empty( $GLOBALS['_wp_switched_stack'] );
}
```
| Used By | Description |
| --- | --- |
| [\_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. |
| [update\_home\_siteurl()](update_home_siteurl) wp-admin/includes/misc.php | Flushes rewrite rules if siteurl, home or page\_on\_front changed. |
| Version | Description |
| --- | --- |
| [3.5.0](https://developer.wordpress.org/reference/since/3.5.0/) | Introduced. |
wordpress rest_validate_value_from_schema( mixed $value, array $args, string $param = '' ): true|WP_Error rest\_validate\_value\_from\_schema( mixed $value, array $args, string $param = '' ): true|WP\_Error
====================================================================================================
Validate a value based on a schema.
`$value` mixed Required The value to validate. `$args` array Required Schema array to use for validation. `$param` string Optional The parameter name, used in error messages. Default: `''`
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_value_from_schema( $value, $args, $param = '' ) {
if ( isset( $args['anyOf'] ) ) {
$matching_schema = rest_find_any_matching_schema( $value, $args, $param );
if ( is_wp_error( $matching_schema ) ) {
return $matching_schema;
}
if ( ! isset( $args['type'] ) && isset( $matching_schema['type'] ) ) {
$args['type'] = $matching_schema['type'];
}
}
if ( isset( $args['oneOf'] ) ) {
$matching_schema = rest_find_one_matching_schema( $value, $args, $param );
if ( is_wp_error( $matching_schema ) ) {
return $matching_schema;
}
if ( ! isset( $args['type'] ) && isset( $matching_schema['type'] ) ) {
$args['type'] = $matching_schema['type'];
}
}
$allowed_types = array( 'array', 'object', 'string', 'number', 'integer', 'boolean', 'null' );
if ( ! isset( $args['type'] ) ) {
/* translators: %s: Parameter. */
_doing_it_wrong( __FUNCTION__, sprintf( __( 'The "type" schema keyword for %s is required.' ), $param ), '5.5.0' );
}
if ( is_array( $args['type'] ) ) {
$best_type = rest_handle_multi_type_schema( $value, $args, $param );
if ( ! $best_type ) {
return new WP_Error(
'rest_invalid_type',
/* translators: 1: Parameter, 2: List of types. */
sprintf( __( '%1$s is not of type %2$s.' ), $param, implode( ',', $args['type'] ) ),
array( 'param' => $param )
);
}
$args['type'] = $best_type;
}
if ( ! in_array( $args['type'], $allowed_types, true ) ) {
_doing_it_wrong(
__FUNCTION__,
/* translators: 1: Parameter, 2: The list of allowed types. */
wp_sprintf( __( 'The "type" schema keyword for %1$s can only be one of the built-in types: %2$l.' ), $param, $allowed_types ),
'5.5.0'
);
}
switch ( $args['type'] ) {
case 'null':
$is_valid = rest_validate_null_value_from_schema( $value, $param );
break;
case 'boolean':
$is_valid = rest_validate_boolean_value_from_schema( $value, $param );
break;
case 'object':
$is_valid = rest_validate_object_value_from_schema( $value, $args, $param );
break;
case 'array':
$is_valid = rest_validate_array_value_from_schema( $value, $args, $param );
break;
case 'number':
$is_valid = rest_validate_number_value_from_schema( $value, $args, $param );
break;
case 'string':
$is_valid = rest_validate_string_value_from_schema( $value, $args, $param );
break;
case 'integer':
$is_valid = rest_validate_integer_value_from_schema( $value, $args, $param );
break;
default:
$is_valid = true;
break;
}
if ( is_wp_error( $is_valid ) ) {
return $is_valid;
}
if ( ! empty( $args['enum'] ) ) {
$enum_contains_value = rest_validate_enum( $value, $args, $param );
if ( is_wp_error( $enum_contains_value ) ) {
return $enum_contains_value;
}
}
// The "format" keyword should only be applied to strings. However, for backward compatibility,
// we allow the "format" keyword if the type keyword was not specified, or was set to an invalid value.
if ( isset( $args['format'] )
&& ( ! isset( $args['type'] ) || 'string' === $args['type'] || ! in_array( $args['type'], $allowed_types, true ) )
) {
switch ( $args['format'] ) {
case 'hex-color':
if ( ! rest_parse_hex_color( $value ) ) {
return new WP_Error( 'rest_invalid_hex_color', __( 'Invalid hex color.' ) );
}
break;
case 'date-time':
if ( ! rest_parse_date( $value ) ) {
return new WP_Error( 'rest_invalid_date', __( 'Invalid date.' ) );
}
break;
case 'email':
if ( ! is_email( $value ) ) {
return new WP_Error( 'rest_invalid_email', __( 'Invalid email address.' ) );
}
break;
case 'ip':
if ( ! rest_is_ip_address( $value ) ) {
/* translators: %s: IP address. */
return new WP_Error( 'rest_invalid_ip', sprintf( __( '%s is not a valid IP address.' ), $param ) );
}
break;
case 'uuid':
if ( ! wp_is_uuid( $value ) ) {
/* translators: %s: The name of a JSON field expecting a valid UUID. */
return new WP_Error( 'rest_invalid_uuid', sprintf( __( '%s is not a valid UUID.' ), $param ) );
}
break;
}
}
return true;
}
```
| Uses | 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\_null\_value\_from\_schema()](rest_validate_null_value_from_schema) wp-includes/rest-api.php | Validates a null value based on a schema. |
| [is\_email()](is_email) wp-includes/formatting.php | Verifies that an email is valid. |
| [wp\_sprintf()](wp_sprintf) wp-includes/formatting.php | WordPress implementation of PHP sprintf() with filters. |
| [rest\_parse\_date()](rest_parse_date) wp-includes/rest-api.php | Parses an RFC3339 time into a Unix timestamp. |
| [rest\_is\_ip\_address()](rest_is_ip_address) wp-includes/rest-api.php | Determines if an IP address is valid. |
| [wp\_is\_uuid()](wp_is_uuid) wp-includes/functions.php | Validates that a UUID is valid. |
| [rest\_parse\_hex\_color()](rest_parse_hex_color) wp-includes/rest-api.php | Parses a 3 or 6 digit hex color (with #). |
| [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\_find\_one\_matching\_schema()](rest_find_one_matching_schema) wp-includes/rest-api.php | Finds the matching schema among the “oneOf” schemas. |
| [rest\_find\_any\_matching\_schema()](rest_find_any_matching_schema) wp-includes/rest-api.php | Finds the matching schema among the “anyOf” schemas. |
| [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\_string\_value\_from\_schema()](rest_validate_string_value_from_schema) wp-includes/rest-api.php | Validates a string 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\_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\_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\_boolean\_value\_from\_schema()](rest_validate_boolean_value_from_schema) wp-includes/rest-api.php | Validates a boolean value based on a schema. |
| [\_\_()](__) 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. |
| [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\_Sidebars\_Controller::prepare\_item\_for\_response()](../classes/wp_rest_sidebars_controller/prepare_item_for_response) wp-includes/rest-api/endpoints/class-wp-rest-sidebars-controller.php | Prepares a single sidebar output for response. |
| [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. |
| [WP\_REST\_Posts\_Controller::check\_status()](../classes/wp_rest_posts_controller/check_status) wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php | Checks whether the status is valid for the given post. |
| [rest\_find\_any\_matching\_schema()](rest_find_any_matching_schema) wp-includes/rest-api.php | Finds the matching schema among the “anyOf” schemas. |
| [rest\_find\_one\_matching\_schema()](rest_find_one_matching_schema) wp-includes/rest-api.php | Finds the matching schema among the “oneOf” schemas. |
| [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\_Block\_Type::prepare\_attributes\_for\_render()](../classes/wp_block_type/prepare_attributes_for_render) wp-includes/class-wp-block-type.php | Validates attributes against the current block schema, populating defaulted and missing values. |
| [WP\_Widget\_Media::update()](../classes/wp_widget_media/update) wp-includes/widgets/class-wp-widget-media.php | Sanitizes the widget form values as they are saved. |
| [rest\_validate\_request\_arg()](rest_validate_request_arg) wp-includes/rest-api.php | Validate a request argument based on details registered to the route. |
| [WP\_REST\_Meta\_Fields::prepare\_value()](../classes/wp_rest_meta_fields/prepare_value) wp-includes/rest-api/fields/class-wp-rest-meta-fields.php | Prepares a meta value for output. |
| [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\_Settings\_Controller::prepare\_value()](../classes/wp_rest_settings_controller/prepare_value) wp-includes/rest-api/endpoints/class-wp-rest-settings-controller.php | Prepares a value for output based off a schema array. |
| [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. |
| [register\_meta()](register_meta) wp-includes/meta.php | Registers a meta key. |
| Version | Description |
| --- | --- |
| [5.6.0](https://developer.wordpress.org/reference/since/5.6.0/) | Support the "minProperties" and "maxProperties" keywords for objects. Support the "multipleOf" keyword for numbers and integers. Support the "patternProperties" keyword for objects. Support the "anyOf" and "oneOf" keywords. |
| [5.5.0](https://developer.wordpress.org/reference/since/5.5.0/) | Add the "uuid" and "hex-color" formats. Support the "minLength", "maxLength" and "pattern" keywords for strings. Support the "minItems", "maxItems" and "uniqueItems" keywords for arrays. Validate required properties. |
| [5.4.0](https://developer.wordpress.org/reference/since/5.4.0/) | Convert an empty string to an empty object. |
| [5.3.0](https://developer.wordpress.org/reference/since/5.3.0/) | Support multiple types. |
| [5.2.0](https://developer.wordpress.org/reference/since/5.2.0/) | Support validating "additionalProperties" against a schema. |
| [4.9.0](https://developer.wordpress.org/reference/since/4.9.0/) | Support the "object" type. |
| [4.7.0](https://developer.wordpress.org/reference/since/4.7.0/) | Introduced. |
wordpress wp_enqueue_block_style( string $block_name, array $args ) wp\_enqueue\_block\_style( string $block\_name, array $args )
=============================================================
Enqueues a stylesheet for a specific block.
If the theme has opted-in to separate-styles loading, then the stylesheet will be enqueued on-render, otherwise when the block inits.
`$block_name` string Required The block-name, including namespace. `$args` array Required An array of arguments [handle,src,deps,ver,media]. File: `wp-includes/script-loader.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/script-loader.php/)
```
function wp_enqueue_block_style( $block_name, $args ) {
$args = wp_parse_args(
$args,
array(
'handle' => '',
'src' => '',
'deps' => array(),
'ver' => false,
'media' => 'all',
)
);
/**
* Callback function to register and enqueue styles.
*
* @param string $content When the callback is used for the render_block filter,
* the content needs to be returned so the function parameter
* is to ensure the content exists.
* @return string Block content.
*/
$callback = static function( $content ) use ( $args ) {
// Register the stylesheet.
if ( ! empty( $args['src'] ) ) {
wp_register_style( $args['handle'], $args['src'], $args['deps'], $args['ver'], $args['media'] );
}
// Add `path` data if provided.
if ( isset( $args['path'] ) ) {
wp_style_add_data( $args['handle'], 'path', $args['path'] );
// Get the RTL file path.
$rtl_file_path = str_replace( '.css', '-rtl.css', $args['path'] );
// Add RTL stylesheet.
if ( file_exists( $rtl_file_path ) ) {
wp_style_add_data( $args['handle'], 'rtl', 'replace' );
if ( is_rtl() ) {
wp_style_add_data( $args['handle'], 'path', $rtl_file_path );
}
}
}
// Enqueue the stylesheet.
wp_enqueue_style( $args['handle'] );
return $content;
};
$hook = did_action( 'wp_enqueue_scripts' ) ? 'wp_footer' : 'wp_enqueue_scripts';
if ( wp_should_load_separate_core_block_assets() ) {
/**
* Callback function to register and enqueue styles.
*
* @param string $content The block content.
* @param array $block The full block, including name and attributes.
* @return string Block content.
*/
$callback_separate = static function( $content, $block ) use ( $block_name, $callback ) {
if ( ! empty( $block['blockName'] ) && $block_name === $block['blockName'] ) {
return $callback( $content );
}
return $content;
};
/*
* The filter's callback here is an anonymous function because
* using a named function in this case is not possible.
*
* The function cannot be unhooked, however, users are still able
* to dequeue the stylesheets registered/enqueued by the callback
* which is why in this case, using an anonymous function
* was deemed acceptable.
*/
add_filter( 'render_block', $callback_separate, 10, 2 );
return;
}
/*
* The filter's callback here is an anonymous function because
* using a named function in this case is not possible.
*
* The function cannot be unhooked, however, users are still able
* to dequeue the stylesheets registered/enqueued by the callback
* which is why in this case, using an anonymous function
* was deemed acceptable.
*/
add_filter( $hook, $callback );
// Enqueue assets in the editor.
add_action( 'enqueue_block_assets', $callback );
}
```
| Uses | Description |
| --- | --- |
| [wp\_should\_load\_separate\_core\_block\_assets()](wp_should_load_separate_core_block_assets) wp-includes/script-loader.php | Checks whether separate styles should be loaded for core blocks on-render. |
| [is\_rtl()](is_rtl) wp-includes/l10n.php | Determines whether the current locale is right-to-left (RTL). |
| [wp\_register\_style()](wp_register_style) wp-includes/functions.wp-styles.php | Register a CSS stylesheet. |
| [wp\_style\_add\_data()](wp_style_add_data) wp-includes/functions.wp-styles.php | Add metadata to a CSS stylesheet. |
| [wp\_enqueue\_style()](wp_enqueue_style) wp-includes/functions.wp-styles.php | Enqueue a CSS stylesheet. |
| [did\_action()](did_action) wp-includes/plugin.php | Retrieves the number of times an action has been fired during the current request. |
| [wp\_parse\_args()](wp_parse_args) wp-includes/functions.php | Merges user defined arguments into defaults array. |
| [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. |
| Version | Description |
| --- | --- |
| [5.9.0](https://developer.wordpress.org/reference/since/5.9.0/) | Introduced. |
wordpress get_header_image(): string|false get\_header\_image(): string|false
==================================
Retrieves header image for custom header.
string|false
File: `wp-includes/theme.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/theme.php/)
```
function get_header_image() {
$url = get_theme_mod( 'header_image', get_theme_support( 'custom-header', 'default-image' ) );
if ( 'remove-header' === $url ) {
return false;
}
if ( is_random_header_image() ) {
$url = get_random_header_image();
}
/**
* Filters the header image URL.
*
* @since 6.1.0
*
* @param string $url Header image URL.
*/
$url = apply_filters( 'get_header_image', $url );
if ( ! is_string( $url ) ) {
return false;
}
$url = trim( $url );
return sanitize_url( set_url_scheme( $url ) );
}
```
[apply\_filters( 'get\_header\_image', string $url )](../hooks/get_header_image)
Filters the header image URL.
| Uses | Description |
| --- | --- |
| [get\_theme\_support()](get_theme_support) wp-includes/theme.php | Gets the theme support arguments passed when registering that support. |
| [is\_random\_header\_image()](is_random_header_image) wp-includes/theme.php | Checks if random header image is in use. |
| [get\_random\_header\_image()](get_random_header_image) wp-includes/theme.php | Gets random header image URL from registered images in theme. |
| [get\_theme\_mod()](get_theme_mod) wp-includes/theme.php | Retrieves theme modification value for the active theme. |
| [sanitize\_url()](sanitize_url) wp-includes/formatting.php | Sanitizes a URL for database or redirect usage. |
| [set\_url\_scheme()](set_url_scheme) wp-includes/link-template.php | Sets the scheme for 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 |
| --- | --- |
| [get\_media\_states()](get_media_states) wp-admin/includes/template.php | Retrieves an array of media states from an attachment. |
| [get\_header\_video\_settings()](get_header_video_settings) wp-includes/theme.php | Retrieves header video settings. |
| [get\_header\_image\_tag()](get_header_image_tag) wp-includes/theme.php | Creates image tag markup for a custom header image. |
| [has\_header\_image()](has_header_image) wp-includes/theme.php | Checks whether a header image is set or not. |
| [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. |
| [\_delete\_attachment\_theme\_mod()](_delete_attachment_theme_mod) wp-includes/theme.php | Checks an attachment being deleted to see if it’s a header or background image. |
| [header\_image()](header_image) wp-includes/theme.php | Displays header image URL. |
| Version | Description |
| --- | --- |
| [2.1.0](https://developer.wordpress.org/reference/since/2.1.0/) | Introduced. |
| programming_docs |
wordpress wp_ajax_health_check_site_status_result() wp\_ajax\_health\_check\_site\_status\_result()
===============================================
Ajax handler for site health check to update the result status.
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_health_check_site_status_result() {
check_ajax_referer( 'health-check-site-status-result' );
if ( ! current_user_can( 'view_site_health_checks' ) ) {
wp_send_json_error();
}
set_transient( 'health-check-site-status-result', wp_json_encode( $_POST['counts'] ) );
wp_send_json_success();
}
```
| Uses | Description |
| --- | --- |
| [set\_transient()](set_transient) wp-includes/option.php | Sets/updates the value of a transient. |
| [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. |
| [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. |
| Version | Description |
| --- | --- |
| [5.2.0](https://developer.wordpress.org/reference/since/5.2.0/) | Introduced. |
wordpress wp_start_object_cache() wp\_start\_object\_cache()
==========================
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.
Start the WordPress object cache.
If an object-cache.php file exists in the wp-content directory, it uses that drop-in as an external object cache.
File: `wp-includes/load.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/load.php/)
```
function wp_start_object_cache() {
global $wp_filter;
static $first_init = true;
// Only perform the following checks once.
/**
* Filters whether to enable loading of the object-cache.php drop-in.
*
* This filter runs before it can be used by plugins. It is designed for non-web
* runtimes. If false is returned, object-cache.php will never be loaded.
*
* @since 5.8.0
*
* @param bool $enable_object_cache Whether to enable loading object-cache.php (if present).
* Default true.
*/
if ( $first_init && apply_filters( 'enable_loading_object_cache_dropin', true ) ) {
if ( ! function_exists( 'wp_cache_init' ) ) {
/*
* This is the normal situation. First-run of this function. No
* caching backend has been loaded.
*
* We try to load a custom caching backend, and then, if it
* results in a wp_cache_init() function existing, we note
* that an external object cache is being used.
*/
if ( file_exists( WP_CONTENT_DIR . '/object-cache.php' ) ) {
require_once WP_CONTENT_DIR . '/object-cache.php';
if ( function_exists( 'wp_cache_init' ) ) {
wp_using_ext_object_cache( true );
}
// Re-initialize any hooks added manually by object-cache.php.
if ( $wp_filter ) {
$wp_filter = WP_Hook::build_preinitialized_hooks( $wp_filter );
}
}
} elseif ( ! wp_using_ext_object_cache() && file_exists( WP_CONTENT_DIR . '/object-cache.php' ) ) {
/*
* Sometimes advanced-cache.php can load object-cache.php before
* this function is run. This breaks the function_exists() check
* above and can result in wp_using_ext_object_cache() returning
* false when actually an external cache is in use.
*/
wp_using_ext_object_cache( true );
}
}
if ( ! wp_using_ext_object_cache() ) {
require_once ABSPATH . WPINC . '/cache.php';
}
require_once ABSPATH . WPINC . '/cache-compat.php';
/*
* If cache supports reset, reset instead of init if already
* initialized. Reset signals to the cache that global IDs
* have changed and it may need to update keys and cleanup caches.
*/
if ( ! $first_init && function_exists( 'wp_cache_switch_to_blog' ) ) {
wp_cache_switch_to_blog( get_current_blog_id() );
} elseif ( function_exists( 'wp_cache_init' ) ) {
wp_cache_init();
}
if ( function_exists( 'wp_cache_add_global_groups' ) ) {
wp_cache_add_global_groups(
array(
'blog-details',
'blog-id-cache',
'blog-lookup',
'blog_meta',
'global-posts',
'networks',
'sites',
'site-details',
'site-options',
'site-transient',
'rss',
'users',
'useremail',
'userlogins',
'usermeta',
'user_meta',
'userslugs',
)
);
wp_cache_add_non_persistent_groups( array( 'counts', 'plugins' ) );
}
$first_init = false;
}
```
[apply\_filters( 'enable\_loading\_object\_cache\_dropin', bool $enable\_object\_cache )](../hooks/enable_loading_object_cache_dropin)
Filters whether to enable loading of the object-cache.php drop-in.
| Uses | Description |
| --- | --- |
| [WP\_Hook::build\_preinitialized\_hooks()](../classes/wp_hook/build_preinitialized_hooks) wp-includes/class-wp-hook.php | Normalizes filters set up before WordPress has initialized to [WP\_Hook](../classes/wp_hook) objects. |
| [wp\_cache\_switch\_to\_blog()](wp_cache_switch_to_blog) wp-includes/cache.php | Switches the internal blog ID. |
| [wp\_cache\_init()](wp_cache_init) wp-includes/cache.php | Sets up Object Cache Global and assigns it. |
| [wp\_cache\_add\_global\_groups()](wp_cache_add_global_groups) wp-includes/cache.php | Adds a group or set of groups to the list of global groups. |
| [wp\_cache\_add\_non\_persistent\_groups()](wp_cache_add_non_persistent_groups) wp-includes/cache.php | Adds a group or set of groups to the list of non-persistent groups. |
| [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. |
| [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. |
| Version | Description |
| --- | --- |
| [3.0.0](https://developer.wordpress.org/reference/since/3.0.0/) | Introduced. |
wordpress get_post_statuses(): string[] get\_post\_statuses(): string[]
===============================
Retrieves all of the WordPress supported post statuses.
Posts have a limited set of valid status values, this provides the post\_status values and descriptions.
string[] Array of post status labels keyed by their status.
##### Usage:
```
$post_statuses = get_post_statuses();
```
output:
`Array
(
[draft] => Draft
[pending] => Pending Review
[private] => Private
[publish] => Published
)`
##### Note:
To get an array of all post statuses, including those created with `register_post_type()`, see <get_post_stati>.
File: `wp-includes/post.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/post.php/)
```
function get_post_statuses() {
$status = array(
'draft' => __( 'Draft' ),
'pending' => __( 'Pending Review' ),
'private' => __( 'Private' ),
'publish' => __( 'Published' ),
);
return $status;
}
```
| Uses | Description |
| --- | --- |
| [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. |
| Used By | Description |
| --- | --- |
| [wp\_xmlrpc\_server::wp\_getPostStatusList()](../classes/wp_xmlrpc_server/wp_getpoststatuslist) wp-includes/class-wp-xmlrpc-server.php | Retrieve post statuses. |
| Version | Description |
| --- | --- |
| [2.5.0](https://developer.wordpress.org/reference/since/2.5.0/) | Introduced. |
wordpress _wp_privacy_account_request_confirmed_message( int $request_id ): string \_wp\_privacy\_account\_request\_confirmed\_message( int $request\_id ): 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 request confirmation message HTML.
`$request_id` int Required The request ID being confirmed. string The confirmation message.
File: `wp-includes/user.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/user.php/)
```
function _wp_privacy_account_request_confirmed_message( $request_id ) {
$request = wp_get_user_request( $request_id );
$message = '<p class="success">' . __( 'Action has been confirmed.' ) . '</p>';
$message .= '<p>' . __( 'The site administrator has been notified and will fulfill your request as soon as possible.' ) . '</p>';
if ( $request && in_array( $request->action_name, _wp_privacy_action_request_types(), true ) ) {
if ( 'export_personal_data' === $request->action_name ) {
$message = '<p class="success">' . __( 'Thanks for confirming your export request.' ) . '</p>';
$message .= '<p>' . __( 'The site administrator has been notified. You will receive a link to download your export via email when they fulfill your request.' ) . '</p>';
} elseif ( 'remove_personal_data' === $request->action_name ) {
$message = '<p class="success">' . __( 'Thanks for confirming your erasure request.' ) . '</p>';
$message .= '<p>' . __( 'The site administrator has been notified. You will receive an email confirmation when they erase your data.' ) . '</p>';
}
}
/**
* Filters the message displayed to a user when they confirm a data request.
*
* @since 4.9.6
*
* @param string $message The message to the user.
* @param int $request_id The ID of the request being confirmed.
*/
$message = apply_filters( 'user_request_action_confirmed_message', $message, $request_id );
return $message;
}
```
[apply\_filters( 'user\_request\_action\_confirmed\_message', string $message, int $request\_id )](../hooks/user_request_action_confirmed_message)
Filters the message displayed to a user when they confirm a data request.
| 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\_privacy\_action\_request\_types()](_wp_privacy_action_request_types) wp-includes/user.php | Gets all personal data request types. |
| [\_\_()](__) 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. |
| Version | Description |
| --- | --- |
| [4.9.6](https://developer.wordpress.org/reference/since/4.9.6/) | Introduced. |
wordpress fetch_feed( string|string[] $url ): SimplePie|WP_Error fetch\_feed( string|string[] $url ): SimplePie|WP\_Error
========================================================
Builds SimplePie object based on RSS or Atom feed from URL.
`$url` string|string[] Required URL of feed to retrieve. If an array of URLs, the feeds are merged using SimplePie's multifeed feature.
See also <http://simplepie.org/wiki/faq/typical_multifeed_gotchas> SimplePie|[WP\_Error](../classes/wp_error) SimplePie object on success or [WP\_Error](../classes/wp_error) object on failure.
`fetch_feed` caches results for 12 hours by default. You can modify this by modifying the time interval via the filter [wp\_feed\_cache\_transient\_lifetime](https://codex.wordpress.org/Plugin_API/Filter_Reference/wp_feed_cache_transient_lifetime "Plugin API/Filter Reference/wp feed cache transient lifetime").
File: `wp-includes/feed.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/feed.php/)
```
function fetch_feed( $url ) {
if ( ! class_exists( 'SimplePie', false ) ) {
require_once ABSPATH . WPINC . '/class-simplepie.php';
}
require_once ABSPATH . WPINC . '/class-wp-feed-cache-transient.php';
require_once ABSPATH . WPINC . '/class-wp-simplepie-file.php';
require_once ABSPATH . WPINC . '/class-wp-simplepie-sanitize-kses.php';
$feed = new SimplePie();
$feed->set_sanitize_class( 'WP_SimplePie_Sanitize_KSES' );
// We must manually overwrite $feed->sanitize because SimplePie's constructor
// sets it before we have a chance to set the sanitization class.
$feed->sanitize = new WP_SimplePie_Sanitize_KSES();
// Register the cache handler using the recommended method for SimplePie 1.3 or later.
if ( method_exists( 'SimplePie_Cache', 'register' ) ) {
SimplePie_Cache::register( 'wp_transient', 'WP_Feed_Cache_Transient' );
$feed->set_cache_location( 'wp_transient' );
} else {
// Back-compat for SimplePie 1.2.x.
require_once ABSPATH . WPINC . '/class-wp-feed-cache.php';
$feed->set_cache_class( 'WP_Feed_Cache' );
}
$feed->set_file_class( 'WP_SimplePie_File' );
$feed->set_feed_url( $url );
/** This filter is documented in wp-includes/class-wp-feed-cache-transient.php */
$feed->set_cache_duration( apply_filters( 'wp_feed_cache_transient_lifetime', 12 * HOUR_IN_SECONDS, $url ) );
/**
* Fires just before processing the SimplePie feed object.
*
* @since 3.0.0
*
* @param SimplePie $feed SimplePie feed object (passed by reference).
* @param string|string[] $url URL of feed or array of URLs of feeds to retrieve.
*/
do_action_ref_array( 'wp_feed_options', array( &$feed, $url ) );
$feed->init();
$feed->set_output_encoding( get_option( 'blog_charset' ) );
if ( $feed->error() ) {
return new WP_Error( 'simplepie-error', $feed->error() );
}
return $feed;
}
```
[apply\_filters( 'wp\_feed\_cache\_transient\_lifetime', int $lifetime, string $filename )](../hooks/wp_feed_cache_transient_lifetime)
Filters the transient lifetime of the feed cache.
[do\_action\_ref\_array( 'wp\_feed\_options', SimplePie $feed, string|string[] $url )](../hooks/wp_feed_options)
Fires just before processing the SimplePie feed object.
| Uses | Description |
| --- | --- |
| [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. |
| [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\_Error::\_\_construct()](../classes/wp_error/__construct) wp-includes/class-wp-error.php | Initializes the error. |
| Used By | Description |
| --- | --- |
| [wp\_dashboard\_rss\_control()](wp_dashboard_rss_control) wp-admin/includes/dashboard.php | The RSS dashboard widget control. |
| [wp\_dashboard\_plugins\_output()](wp_dashboard_plugins_output) wp-admin/includes/deprecated.php | Display plugins text for the WordPress news widget. |
| [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\_rss\_output()](wp_widget_rss_output) wp-includes/widgets.php | Display the RSS entries in a list. |
| [wp\_widget\_rss\_process()](wp_widget_rss_process) wp-includes/widgets.php | Process RSS feed widget data and optionally retrieve feed items. |
| Version | Description |
| --- | --- |
| [2.8.0](https://developer.wordpress.org/reference/since/2.8.0/) | Introduced. |
wordpress doing_filter( string|null $hook_name = null ): bool doing\_filter( string|null $hook\_name = null ): bool
=====================================================
Returns whether or not a filter hook is currently being processed.
The function [current\_filter()](current_filter) only returns the most recent filter being executed.
[did\_filter()](did_filter) returns the number of times a filter has been applied during the current request.
This function allows detection for any filter currently being executed (regardless of whether it’s the most recent filter to fire, in the case of hooks called from hook callbacks) to be verified.
* [current\_filter()](current_filter)
* [did\_filter()](did_filter)
`$hook_name` string|null Optional Filter hook to check. Defaults to null, which checks if any filter is currently being run. Default: `null`
bool Whether the filter is currently in the stack.
File: `wp-includes/plugin.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/plugin.php/)
```
function doing_filter( $hook_name = null ) {
global $wp_current_filter;
if ( null === $hook_name ) {
return ! empty( $wp_current_filter );
}
return in_array( $hook_name, $wp_current_filter, true );
}
```
| Used By | Description |
| --- | --- |
| [do\_blocks()](do_blocks) wp-includes/blocks.php | Parses dynamic blocks out of `post_content` and re-renders them. |
| [doing\_action()](doing_action) wp-includes/plugin.php | Returns whether or not an action hook is currently being processed. |
| Version | Description |
| --- | --- |
| [3.9.0](https://developer.wordpress.org/reference/since/3.9.0/) | Introduced. |
wordpress get_bloginfo_rss( string $show = '' ): string get\_bloginfo\_rss( string $show = '' ): string
===============================================
Retrieves RSS container for the bloginfo function.
You can retrieve anything that you can using the [get\_bloginfo()](get_bloginfo) function.
Everything will be stripped of tags and characters converted, when the values are retrieved for use in the feeds.
* [get\_bloginfo()](get_bloginfo) : For the list of possible values to display.
`$show` string Optional See [get\_bloginfo()](get_bloginfo) for possible values. More Arguments from get\_bloginfo( ... $show ) Site info to retrieve. Default empty (site name). Default: `''`
string
File: `wp-includes/feed.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/feed.php/)
```
function get_bloginfo_rss( $show = '' ) {
$info = strip_tags( get_bloginfo( $show ) );
/**
* Filters the bloginfo for use in RSS feeds.
*
* @since 2.2.0
*
* @see convert_chars()
* @see get_bloginfo()
*
* @param string $info Converted string value of the blog information.
* @param string $show The type of blog information to retrieve.
*/
return apply_filters( 'get_bloginfo_rss', convert_chars( $info ), $show );
}
```
[apply\_filters( 'get\_bloginfo\_rss', string $info, string $show )](../hooks/get_bloginfo_rss)
Filters the bloginfo for use in RSS feeds.
| Uses | Description |
| --- | --- |
| [convert\_chars()](convert_chars) wp-includes/formatting.php | Converts lone & characters into `&` (a.k.a. `&`) |
| [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. |
| Used By | Description |
| --- | --- |
| [rss2\_site\_icon()](rss2_site_icon) wp-includes/feed.php | Displays Site Icon in RSS2. |
| [wxr\_site\_url()](wxr_site_url) wp-admin/includes/export.php | Returns the URL of the site. |
| [get\_the\_generator()](get_the_generator) wp-includes/general-template.php | Creates the generator XML or Comment for RSS, ATOM, etc. |
| [get\_the\_category\_rss()](get_the_category_rss) wp-includes/feed.php | Retrieves all of the post categories, formatted for use in feeds. |
| [bloginfo\_rss()](bloginfo_rss) wp-includes/feed.php | Displays RSS container for the bloginfo function. |
| Version | Description |
| --- | --- |
| [1.5.1](https://developer.wordpress.org/reference/since/1.5.1/) | Introduced. |
| programming_docs |
wordpress wp_cache_replace( int|string $key, mixed $data, string $group = '', int $expire ): bool wp\_cache\_replace( int|string $key, mixed $data, string $group = '', int $expire ): bool
=========================================================================================
Replaces the contents of the cache with new data.
* [WP\_Object\_Cache::replace()](../classes/wp_object_cache/replace)
`$key` int|string Required The key for the cache data that should be replaced. `$data` mixed Required The new data to store in the cache. `$group` string Optional The group for the cache data that should be replaced.
Default: `''`
`$expire` int Optional When to expire the cache contents, in seconds.
Default 0 (no expiration). bool True if contents were replaced, false if original value does not exist.
File: `wp-includes/cache.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/cache.php/)
```
function wp_cache_replace( $key, $data, $group = '', $expire = 0 ) {
global $wp_object_cache;
return $wp_object_cache->replace( $key, $data, $group, (int) $expire );
}
```
| Uses | Description |
| --- | --- |
| [WP\_Object\_Cache::replace()](../classes/wp_object_cache/replace) wp-includes/class-wp-object-cache.php | Replaces the contents in the cache, if contents already exist. |
| Version | Description |
| --- | --- |
| [2.0.0](https://developer.wordpress.org/reference/since/2.0.0/) | Introduced. |
wordpress upload_size_limit_filter( int $size ): int upload\_size\_limit\_filter( int $size ): int
=============================================
Filters the maximum upload file size allowed, in bytes.
`$size` int Required Upload size limit in bytes. int Upload size limit in bytes.
File: `wp-includes/ms-functions.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/ms-functions.php/)
```
function upload_size_limit_filter( $size ) {
$fileupload_maxk = (int) get_site_option( 'fileupload_maxk', 1500 );
$max_fileupload_in_bytes = KB_IN_BYTES * $fileupload_maxk;
if ( get_site_option( 'upload_space_check_disabled' ) ) {
return min( $size, $max_fileupload_in_bytes );
}
return min( $size, $max_fileupload_in_bytes, get_upload_space_available() );
}
```
| Uses | Description |
| --- | --- |
| [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. |
| [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 retrieve_widgets( string|bool $theme_changed = false ): array retrieve\_widgets( string|bool $theme\_changed = false ): array
===============================================================
Validates and remaps any “orphaned” widgets to wp\_inactive\_widgets sidebar, and saves the widget settings. This has to run at least on each theme change.
For example, let’s say theme A has a "footer" sidebar, and theme B doesn’t have one.
After switching from theme A to theme B, all the widgets previously assigned to the footer would be inaccessible. This function detects this scenario, and moves all the widgets previously assigned to the footer under wp\_inactive\_widgets.
Despite the word "retrieve" in the name, this function actually updates the database and the global `$sidebars_widgets`. For that reason it should not be run on front end, unless the `$theme_changed` value is ‘customize’ (to bypass the database write).
`$theme_changed` string|bool Optional Whether the theme was changed as a boolean. A value of `'customize'` defers updates for the Customizer. Default: `false`
array Updated sidebars widgets.
File: `wp-includes/widgets.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/widgets.php/)
```
function retrieve_widgets( $theme_changed = false ) {
global $wp_registered_sidebars, $sidebars_widgets, $wp_registered_widgets;
$registered_sidebars_keys = array_keys( $wp_registered_sidebars );
$registered_widgets_ids = array_keys( $wp_registered_widgets );
if ( ! is_array( get_theme_mod( 'sidebars_widgets' ) ) ) {
if ( empty( $sidebars_widgets ) ) {
return array();
}
unset( $sidebars_widgets['array_version'] );
$sidebars_widgets_keys = array_keys( $sidebars_widgets );
sort( $sidebars_widgets_keys );
sort( $registered_sidebars_keys );
if ( $sidebars_widgets_keys === $registered_sidebars_keys ) {
$sidebars_widgets = _wp_remove_unregistered_widgets( $sidebars_widgets, $registered_widgets_ids );
return $sidebars_widgets;
}
}
// Discard invalid, theme-specific widgets from sidebars.
$sidebars_widgets = _wp_remove_unregistered_widgets( $sidebars_widgets, $registered_widgets_ids );
$sidebars_widgets = wp_map_sidebars_widgets( $sidebars_widgets );
// Find hidden/lost multi-widget instances.
$shown_widgets = array_merge( ...array_values( $sidebars_widgets ) );
$lost_widgets = array_diff( $registered_widgets_ids, $shown_widgets );
foreach ( $lost_widgets as $key => $widget_id ) {
$number = preg_replace( '/.+?-([0-9]+)$/', '$1', $widget_id );
// Only keep active and default widgets.
if ( is_numeric( $number ) && (int) $number < 2 ) {
unset( $lost_widgets[ $key ] );
}
}
$sidebars_widgets['wp_inactive_widgets'] = array_merge( $lost_widgets, (array) $sidebars_widgets['wp_inactive_widgets'] );
if ( 'customize' !== $theme_changed ) {
// Update the widgets settings in the database.
wp_set_sidebars_widgets( $sidebars_widgets );
}
return $sidebars_widgets;
}
```
| Uses | Description |
| --- | --- |
| [\_wp\_remove\_unregistered\_widgets()](_wp_remove_unregistered_widgets) wp-includes/widgets.php | Compares a list of sidebars with their widgets against an allowed list. |
| [wp\_map\_sidebars\_widgets()](wp_map_sidebars_widgets) wp-includes/widgets.php | Compares a list of sidebars with their widgets against an allowed list. |
| [get\_theme\_mod()](get_theme_mod) wp-includes/theme.php | Retrieves theme modification value for the active theme. |
| [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::retrieve\_widgets()](../classes/wp_rest_widgets_controller/retrieve_widgets) wp-includes/rest-api/endpoints/class-wp-rest-widgets-controller.php | Looks for “lost” widgets once per request. |
| [WP\_REST\_Sidebars\_Controller::retrieve\_widgets()](../classes/wp_rest_sidebars_controller/retrieve_widgets) wp-includes/rest-api/endpoints/class-wp-rest-sidebars-controller.php | Looks for “lost” widgets once per request. |
| [\_wp\_sidebars\_changed()](_wp_sidebars_changed) wp-includes/widgets.php | Handle sidebars config after theme change |
| [WP\_Customize\_Widgets::override\_sidebars\_widgets\_for\_theme\_switch()](../classes/wp_customize_widgets/override_sidebars_widgets_for_theme_switch) wp-includes/class-wp-customize-widgets.php | Override sidebars\_widgets for theme switch. |
| Version | Description |
| --- | --- |
| [2.8.0](https://developer.wordpress.org/reference/since/2.8.0/) | Introduced. |
wordpress print_late_styles(): array|void print\_late\_styles(): array|void
=================================
Prints the styles that were queued too late for the HTML head.
array|void
File: `wp-includes/script-loader.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/script-loader.php/)
```
function print_late_styles() {
global $wp_styles, $concatenate_scripts;
if ( ! ( $wp_styles instanceof WP_Styles ) ) {
return;
}
script_concat_settings();
$wp_styles->do_concat = $concatenate_scripts;
$wp_styles->do_footer_items();
/**
* Filters whether to print the styles queued too late for the HTML head.
*
* @since 3.3.0
*
* @param bool $print Whether to print the 'late' styles. Default true.
*/
if ( apply_filters( 'print_late_styles', true ) ) {
_print_styles();
}
$wp_styles->reset();
return $wp_styles->done;
}
```
[apply\_filters( 'print\_late\_styles', bool $print )](../hooks/print_late_styles)
Filters whether to print the styles queued too late for the HTML head.
| Uses | Description |
| --- | --- |
| [WP\_Styles::do\_footer\_items()](../classes/wp_styles/do_footer_items) wp-includes/class-wp-styles.php | Processes items and dependencies for the footer group. |
| [WP\_Styles::reset()](../classes/wp_styles/reset) wp-includes/class-wp-styles.php | Resets class properties. |
| [script\_concat\_settings()](script_concat_settings) wp-includes/script-loader.php | Determines the concatenation and compression settings for scripts and styles. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| Used By | Description |
| --- | --- |
| [\_wp\_footer\_scripts()](_wp_footer_scripts) wp-includes/script-loader.php | Private, for use in \*\_footer\_scripts hooks |
| Version | Description |
| --- | --- |
| [3.3.0](https://developer.wordpress.org/reference/since/3.3.0/) | Introduced. |
wordpress locale_stylesheet() locale\_stylesheet()
====================
Displays localized stylesheet link element.
File: `wp-includes/theme.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/theme.php/)
```
function locale_stylesheet() {
$stylesheet = get_locale_stylesheet_uri();
if ( empty( $stylesheet ) ) {
return;
}
$type_attr = current_theme_supports( 'html5', 'style' ) ? '' : ' type="text/css"';
printf(
'<link rel="stylesheet" href="%s"%s media="screen" />',
$stylesheet,
$type_attr
);
}
```
| Uses | Description |
| --- | --- |
| [get\_locale\_stylesheet\_uri()](get_locale_stylesheet_uri) wp-includes/theme.php | Retrieves the localized stylesheet URI. |
| [current\_theme\_supports()](current_theme_supports) wp-includes/theme.php | Checks a theme’s support for a given feature. |
| Version | Description |
| --- | --- |
| [2.1.0](https://developer.wordpress.org/reference/since/2.1.0/) | Introduced. |
wordpress wp_omit_loading_attr_threshold( bool $force = false ): int wp\_omit\_loading\_attr\_threshold( bool $force = false ): int
==============================================================
Gets the threshold for how many of the first content media elements to not lazy-load.
This function runs the [‘wp\_omit\_loading\_attr\_threshold’](../hooks/wp_omit_loading_attr_threshold) filter, which uses a default threshold value of 1.
The filter is only run once per page load, unless the `$force` parameter is used.
`$force` bool Optional If set to true, the filter will be (re-)applied even if it already has been before.
Default: `false`
int The number of content media elements to not lazy-load.
File: `wp-includes/media.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/media.php/)
```
function wp_omit_loading_attr_threshold( $force = false ) {
static $omit_threshold;
// This function may be called multiple times. Run the filter only once per page load.
if ( ! isset( $omit_threshold ) || $force ) {
/**
* Filters the threshold for how many of the first content media elements to not lazy-load.
*
* For these first content media elements, the `loading` attribute will be omitted. By default, this is the case
* for only the very first content media element.
*
* @since 5.9.0
*
* @param int $omit_threshold The number of media elements where the `loading` attribute will not be added. Default 1.
*/
$omit_threshold = apply_filters( 'wp_omit_loading_attr_threshold', 1 );
}
return $omit_threshold;
}
```
[apply\_filters( 'wp\_omit\_loading\_attr\_threshold', int $omit\_threshold )](../hooks/wp_omit_loading_attr_threshold)
Filters the threshold for how many of the first content media elements to not lazy-load.
| 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\_get\_loading\_attr\_default()](wp_get_loading_attr_default) wp-includes/media.php | Gets the default value to use for a `loading` attribute on an element. |
| Version | Description |
| --- | --- |
| [5.9.0](https://developer.wordpress.org/reference/since/5.9.0/) | Introduced. |
wordpress get_admin_users_for_domain( string $domain = '', string $path = '' ): array|false get\_admin\_users\_for\_domain( string $domain = '', string $path = '' ): array|false
=====================================================================================
This function has been deprecated.
Get the admin for a domain/path combination.
`$domain` string Optional Network domain. Default: `''`
`$path` string Optional Network path. Default: `''`
array|false The network admins.
File: `wp-includes/ms-deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/ms-deprecated.php/)
```
function get_admin_users_for_domain( $domain = '', $path = '' ) {
_deprecated_function( __FUNCTION__, '4.4.0' );
global $wpdb;
if ( ! $domain ) {
$network_id = get_current_network_id();
} else {
$_networks = get_networks( array(
'fields' => 'ids',
'number' => 1,
'domain' => $domain,
'path' => $path,
) );
$network_id = ! empty( $_networks ) ? array_shift( $_networks ) : 0;
}
if ( $network_id )
return $wpdb->get_results( $wpdb->prepare( "SELECT u.ID, u.user_login, u.user_pass FROM $wpdb->users AS u, $wpdb->sitemeta AS sm WHERE sm.meta_key = 'admin_user_id' AND u.ID = sm.meta_value AND sm.site_id = %d", $network_id ), ARRAY_A );
return false;
}
```
| Uses | Description |
| --- | --- |
| [get\_current\_network\_id()](get_current_network_id) wp-includes/load.php | Retrieves the current network ID. |
| [get\_networks()](get_networks) wp-includes/ms-network.php | Retrieves a list of networks. |
| [\_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). |
| [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/) | This function has been deprecated. |
| [MU (3.0.0)](https://developer.wordpress.org/reference/since/mu.3.0.0/) | Introduced. |
wordpress wp_user_request_action_description( string $action_name ): string wp\_user\_request\_action\_description( string $action\_name ): string
======================================================================
Gets action description from the name and return a string.
`$action_name` string Required Action name of the request. string Human readable action name.
File: `wp-includes/user.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/user.php/)
```
function wp_user_request_action_description( $action_name ) {
switch ( $action_name ) {
case 'export_personal_data':
$description = __( 'Export Personal Data' );
break;
case 'remove_personal_data':
$description = __( 'Erase Personal Data' );
break;
default:
/* translators: %s: Action name. */
$description = sprintf( __( 'Confirm the "%s" action' ), $action_name );
break;
}
/**
* Filters the user action description.
*
* @since 4.9.6
*
* @param string $description The default description.
* @param string $action_name The name of the request.
*/
return apply_filters( 'user_request_action_description', $description, $action_name );
}
```
[apply\_filters( 'user\_request\_action\_description', string $description, string $action\_name )](../hooks/user_request_action_description)
Filters the user action description.
| 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\_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\_send\_user\_request()](wp_send_user_request) wp-includes/user.php | Send a confirmation request email to confirm an action. |
| Version | Description |
| --- | --- |
| [4.9.6](https://developer.wordpress.org/reference/since/4.9.6/) | Introduced. |
wordpress get_metadata_raw( string $meta_type, int $object_id, string $meta_key = '', bool $single = false ): mixed get\_metadata\_raw( string $meta\_type, int $object\_id, string $meta\_key = '', bool $single = false ): mixed
==============================================================================================================
Retrieves raw metadata value 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 Optional Metadata key. If not specified, retrieve all metadata for the specified object. Default: `''`
`$single` bool Optional If true, return only the first value of the specified `$meta_key`.
This parameter has no effect if `$meta_key` is not specified. Default: `false`
mixed An array of values if `$single` is false.
The value of the meta field if `$single` is true.
False for an invalid `$object_id` (non-numeric, zero, or negative value), or if `$meta_type` is not specified.
Null if the value does not exist.
File: `wp-includes/meta.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/meta.php/)
```
function get_metadata_raw( $meta_type, $object_id, $meta_key = '', $single = false ) {
if ( ! $meta_type || ! is_numeric( $object_id ) ) {
return false;
}
$object_id = absint( $object_id );
if ( ! $object_id ) {
return false;
}
/**
* Short-circuits the return value of a meta field.
*
* 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 filter names include:
*
* - `get_post_metadata`
* - `get_comment_metadata`
* - `get_term_metadata`
* - `get_user_metadata`
*
* @since 3.1.0
* @since 5.5.0 Added the `$meta_type` parameter.
*
* @param mixed $value The value to return, either a single metadata value or an array
* of values depending on the value of `$single`. Default null.
* @param int $object_id ID of the object metadata is for.
* @param string $meta_key Metadata key.
* @param bool $single Whether to return only the first value of the specified `$meta_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.
*/
$check = apply_filters( "get_{$meta_type}_metadata", null, $object_id, $meta_key, $single, $meta_type );
if ( null !== $check ) {
if ( $single && is_array( $check ) ) {
return $check[0];
} else {
return $check;
}
}
$meta_cache = wp_cache_get( $object_id, $meta_type . '_meta' );
if ( ! $meta_cache ) {
$meta_cache = update_meta_cache( $meta_type, array( $object_id ) );
if ( isset( $meta_cache[ $object_id ] ) ) {
$meta_cache = $meta_cache[ $object_id ];
} else {
$meta_cache = null;
}
}
if ( ! $meta_key ) {
return $meta_cache;
}
if ( isset( $meta_cache[ $meta_key ] ) ) {
if ( $single ) {
return maybe_unserialize( $meta_cache[ $meta_key ][0] );
} else {
return array_map( 'maybe_unserialize', $meta_cache[ $meta_key ] );
}
}
return null;
}
```
[apply\_filters( "get\_{$meta\_type}\_metadata", mixed $value, int $object\_id, string $meta\_key, bool $single, string $meta\_type )](../hooks/get_meta_type_metadata)
Short-circuits the return value of a meta field.
| Uses | Description |
| --- | --- |
| [maybe\_unserialize()](maybe_unserialize) wp-includes/functions.php | Unserializes data only if it was serialized. |
| [update\_meta\_cache()](update_meta_cache) wp-includes/meta.php | Updates the metadata cache for the specified objects. |
| [wp\_cache\_get()](wp_cache_get) wp-includes/cache.php | Retrieves the cache contents from the cache by key and group. |
| [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 |
| --- | --- |
| [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. |
| [get\_metadata()](get_metadata) wp-includes/meta.php | Retrieves the value of a metadata field for the specified object type and ID. |
| [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 |
| --- | --- |
| [5.5.0](https://developer.wordpress.org/reference/since/5.5.0/) | Introduced. |
| programming_docs |
wordpress link_xfn_meta_box( object $link ) link\_xfn\_meta\_box( object $link )
====================================
Displays XFN 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_xfn_meta_box( $link ) {
?>
<table class="links-table">
<tr>
<th scope="row"><label for="link_rel"><?php /* translators: xfn: https://gmpg.org/xfn/ */ _e( 'rel:' ); ?></label></th>
<td><input type="text" name="link_rel" id="link_rel" value="<?php echo ( isset( $link->link_rel ) ? esc_attr( $link->link_rel ) : '' ); ?>" /></td>
</tr>
<tr>
<th scope="row"><?php /* translators: xfn: https://gmpg.org/xfn/ */ _e( 'identity' ); ?></th>
<td><fieldset><legend class="screen-reader-text"><span><?php /* translators: xfn: https://gmpg.org/xfn/ */ _e( 'identity' ); ?></span></legend>
<label for="me">
<input type="checkbox" name="identity" value="me" id="me" <?php xfn_check( 'identity', 'me' ); ?> />
<?php _e( 'another web address of mine' ); ?></label>
</fieldset></td>
</tr>
<tr>
<th scope="row"><?php /* translators: xfn: https://gmpg.org/xfn/ */ _e( 'friendship' ); ?></th>
<td><fieldset><legend class="screen-reader-text"><span><?php /* translators: xfn: https://gmpg.org/xfn/ */ _e( 'friendship' ); ?></span></legend>
<label for="contact">
<input class="valinp" type="radio" name="friendship" value="contact" id="contact" <?php xfn_check( 'friendship', 'contact' ); ?> /> <?php /* translators: xfn: https://gmpg.org/xfn/ */ _e( 'contact' ); ?>
</label>
<label for="acquaintance">
<input class="valinp" type="radio" name="friendship" value="acquaintance" id="acquaintance" <?php xfn_check( 'friendship', 'acquaintance' ); ?> /> <?php /* translators: xfn: https://gmpg.org/xfn/ */ _e( 'acquaintance' ); ?>
</label>
<label for="friend">
<input class="valinp" type="radio" name="friendship" value="friend" id="friend" <?php xfn_check( 'friendship', 'friend' ); ?> /> <?php /* translators: xfn: https://gmpg.org/xfn/ */ _e( 'friend' ); ?>
</label>
<label for="friendship">
<input name="friendship" type="radio" class="valinp" value="" id="friendship" <?php xfn_check( 'friendship' ); ?> /> <?php /* translators: xfn: https://gmpg.org/xfn/ */ _e( 'none' ); ?>
</label>
</fieldset></td>
</tr>
<tr>
<th scope="row"> <?php /* translators: xfn: https://gmpg.org/xfn/ */ _e( 'physical' ); ?> </th>
<td><fieldset><legend class="screen-reader-text"><span><?php /* translators: xfn: https://gmpg.org/xfn/ */ _e( 'physical' ); ?></span></legend>
<label for="met">
<input class="valinp" type="checkbox" name="physical" value="met" id="met" <?php xfn_check( 'physical', 'met' ); ?> /> <?php /* translators: xfn: https://gmpg.org/xfn/ */ _e( 'met' ); ?>
</label>
</fieldset></td>
</tr>
<tr>
<th scope="row"> <?php /* translators: xfn: https://gmpg.org/xfn/ */ _e( 'professional' ); ?> </th>
<td><fieldset><legend class="screen-reader-text"><span><?php /* translators: xfn: https://gmpg.org/xfn/ */ _e( 'professional' ); ?></span></legend>
<label for="co-worker">
<input class="valinp" type="checkbox" name="professional" value="co-worker" id="co-worker" <?php xfn_check( 'professional', 'co-worker' ); ?> /> <?php /* translators: xfn: https://gmpg.org/xfn/ */ _e( 'co-worker' ); ?>
</label>
<label for="colleague">
<input class="valinp" type="checkbox" name="professional" value="colleague" id="colleague" <?php xfn_check( 'professional', 'colleague' ); ?> /> <?php /* translators: xfn: https://gmpg.org/xfn/ */ _e( 'colleague' ); ?>
</label>
</fieldset></td>
</tr>
<tr>
<th scope="row"><?php /* translators: xfn: https://gmpg.org/xfn/ */ _e( 'geographical' ); ?></th>
<td><fieldset><legend class="screen-reader-text"><span> <?php /* translators: xfn: https://gmpg.org/xfn/ */ _e( 'geographical' ); ?> </span></legend>
<label for="co-resident">
<input class="valinp" type="radio" name="geographical" value="co-resident" id="co-resident" <?php xfn_check( 'geographical', 'co-resident' ); ?> /> <?php /* translators: xfn: https://gmpg.org/xfn/ */ _e( 'co-resident' ); ?>
</label>
<label for="neighbor">
<input class="valinp" type="radio" name="geographical" value="neighbor" id="neighbor" <?php xfn_check( 'geographical', 'neighbor' ); ?> /> <?php /* translators: xfn: https://gmpg.org/xfn/ */ _e( 'neighbor' ); ?>
</label>
<label for="geographical">
<input class="valinp" type="radio" name="geographical" value="" id="geographical" <?php xfn_check( 'geographical' ); ?> /> <?php /* translators: xfn: https://gmpg.org/xfn/ */ _e( 'none' ); ?>
</label>
</fieldset></td>
</tr>
<tr>
<th scope="row"><?php /* translators: xfn: https://gmpg.org/xfn/ */ _e( 'family' ); ?></th>
<td><fieldset><legend class="screen-reader-text"><span> <?php /* translators: xfn: https://gmpg.org/xfn/ */ _e( 'family' ); ?> </span></legend>
<label for="child">
<input class="valinp" type="radio" name="family" value="child" id="child" <?php xfn_check( 'family', 'child' ); ?> /> <?php /* translators: xfn: https://gmpg.org/xfn/ */ _e( 'child' ); ?>
</label>
<label for="kin">
<input class="valinp" type="radio" name="family" value="kin" id="kin" <?php xfn_check( 'family', 'kin' ); ?> /> <?php /* translators: xfn: https://gmpg.org/xfn/ */ _e( 'kin' ); ?>
</label>
<label for="parent">
<input class="valinp" type="radio" name="family" value="parent" id="parent" <?php xfn_check( 'family', 'parent' ); ?> /> <?php /* translators: xfn: https://gmpg.org/xfn/ */ _e( 'parent' ); ?>
</label>
<label for="sibling">
<input class="valinp" type="radio" name="family" value="sibling" id="sibling" <?php xfn_check( 'family', 'sibling' ); ?> /> <?php /* translators: xfn: https://gmpg.org/xfn/ */ _e( 'sibling' ); ?>
</label>
<label for="spouse">
<input class="valinp" type="radio" name="family" value="spouse" id="spouse" <?php xfn_check( 'family', 'spouse' ); ?> /> <?php /* translators: xfn: https://gmpg.org/xfn/ */ _e( 'spouse' ); ?>
</label>
<label for="family">
<input class="valinp" type="radio" name="family" value="" id="family" <?php xfn_check( 'family' ); ?> /> <?php /* translators: xfn: https://gmpg.org/xfn/ */ _e( 'none' ); ?>
</label>
</fieldset></td>
</tr>
<tr>
<th scope="row"><?php /* translators: xfn: https://gmpg.org/xfn/ */ _e( 'romantic' ); ?></th>
<td><fieldset><legend class="screen-reader-text"><span> <?php /* translators: xfn: https://gmpg.org/xfn/ */ _e( 'romantic' ); ?> </span></legend>
<label for="muse">
<input class="valinp" type="checkbox" name="romantic" value="muse" id="muse" <?php xfn_check( 'romantic', 'muse' ); ?> /> <?php /* translators: xfn: https://gmpg.org/xfn/ */ _e( 'muse' ); ?>
</label>
<label for="crush">
<input class="valinp" type="checkbox" name="romantic" value="crush" id="crush" <?php xfn_check( 'romantic', 'crush' ); ?> /> <?php /* translators: xfn: https://gmpg.org/xfn/ */ _e( 'crush' ); ?>
</label>
<label for="date">
<input class="valinp" type="checkbox" name="romantic" value="date" id="date" <?php xfn_check( 'romantic', 'date' ); ?> /> <?php /* translators: xfn: https://gmpg.org/xfn/ */ _e( 'date' ); ?>
</label>
<label for="romantic">
<input class="valinp" type="checkbox" name="romantic" value="sweetheart" id="romantic" <?php xfn_check( 'romantic', 'sweetheart' ); ?> /> <?php /* translators: xfn: https://gmpg.org/xfn/ */ _e( 'sweetheart' ); ?>
</label>
</fieldset></td>
</tr>
</table>
<p><?php _e( 'If the link is to a person, you can specify your relationship with them using the above form. If you would like to learn more about the idea check out <a href="https://gmpg.org/xfn/">XFN</a>.' ); ?></p>
<?php
}
```
| Uses | Description |
| --- | --- |
| [xfn\_check()](xfn_check) wp-admin/includes/meta-boxes.php | Displays ‘checked’ checkboxes attribute for XFN microformat options. |
| [\_e()](_e) wp-includes/l10n.php | Displays translated text. |
| [esc\_attr()](esc_attr) wp-includes/formatting.php | Escaping for HTML attributes. |
| Version | Description |
| --- | --- |
| [2.6.0](https://developer.wordpress.org/reference/since/2.6.0/) | Introduced. |
wordpress _get_term_hierarchy( string $taxonomy ): array \_get\_term\_hierarchy( string $taxonomy ): 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.
Retrieves children of taxonomy as term IDs.
`$taxonomy` string Required Taxonomy name. array Empty if $taxonomy isn't hierarchical or returns children as term IDs.
File: `wp-includes/taxonomy.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/taxonomy.php/)
```
function _get_term_hierarchy( $taxonomy ) {
if ( ! is_taxonomy_hierarchical( $taxonomy ) ) {
return array();
}
$children = get_option( "{$taxonomy}_children" );
if ( is_array( $children ) ) {
return $children;
}
$children = array();
$terms = get_terms(
array(
'taxonomy' => $taxonomy,
'get' => 'all',
'orderby' => 'id',
'fields' => 'id=>parent',
'update_term_meta_cache' => false,
)
);
foreach ( $terms as $term_id => $parent ) {
if ( $parent > 0 ) {
$children[ $parent ][] = $term_id;
}
}
update_option( "{$taxonomy}_children", $children );
return $children;
}
```
| Uses | Description |
| --- | --- |
| [get\_terms()](get_terms) wp-includes/taxonomy.php | Retrieves the terms in a given taxonomy or list of taxonomies. |
| [is\_taxonomy\_hierarchical()](is_taxonomy_hierarchical) wp-includes/taxonomy.php | Determines whether the taxonomy object is hierarchical. |
| [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 |
| --- | --- |
| [clean\_taxonomy\_cache()](clean_taxonomy_cache) wp-includes/taxonomy.php | Cleans the caches for a taxonomy. |
| [WP\_Term\_Query::get\_terms()](../classes/wp_term_query/get_terms) wp-includes/class-wp-term-query.php | Retrieves the query results. |
| [\_wp\_batch\_split\_terms()](_wp_batch_split_terms) wp-includes/taxonomy.php | Splits a batch of shared taxonomy terms. |
| [WP\_Terms\_List\_Table::display\_rows\_or\_placeholder()](../classes/wp_terms_list_table/display_rows_or_placeholder) wp-admin/includes/class-wp-terms-list-table.php | |
| [\_get\_term\_children()](_get_term_children) wp-includes/taxonomy.php | Gets the subset of $terms that are descendants of $term\_id. |
| [\_pad\_term\_counts()](_pad_term_counts) wp-includes/taxonomy.php | Adds count of children to parent count. |
| [get\_term\_children()](get_term_children) wp-includes/taxonomy.php | Merges all term children into a single array of their IDs. |
| [\_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. |
| Version | Description |
| --- | --- |
| [2.3.0](https://developer.wordpress.org/reference/since/2.3.0/) | Introduced. |
wordpress wp_register_comment_personal_data_exporter( array $exporters ): array wp\_register\_comment\_personal\_data\_exporter( array $exporters ): array
==========================================================================
Registers the personal data exporter for comments.
`$exporters` array Required An array of personal data exporters. array An array of personal data exporters.
File: `wp-includes/comment.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/comment.php/)
```
function wp_register_comment_personal_data_exporter( $exporters ) {
$exporters['wordpress-comments'] = array(
'exporter_friendly_name' => __( 'WordPress Comments' ),
'callback' => 'wp_comments_personal_data_exporter',
);
return $exporters;
}
```
| Uses | Description |
| --- | --- |
| [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. |
| Version | Description |
| --- | --- |
| [4.9.6](https://developer.wordpress.org/reference/since/4.9.6/) | Introduced. |
wordpress post_custom_meta_box( WP_Post $post ) post\_custom\_meta\_box( WP\_Post $post )
=========================================
Displays custom fields form fields.
`$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 post_custom_meta_box( $post ) {
?>
<div id="postcustomstuff">
<div id="ajax-response"></div>
<?php
$metadata = has_meta( $post->ID );
foreach ( $metadata as $key => $value ) {
if ( is_protected_meta( $metadata[ $key ]['meta_key'], 'post' ) || ! current_user_can( 'edit_post_meta', $post->ID, $metadata[ $key ]['meta_key'] ) ) {
unset( $metadata[ $key ] );
}
}
list_meta( $metadata );
meta_form( $post );
?>
</div>
<p>
<?php
printf(
/* translators: %s: Documentation URL. */
__( 'Custom fields can be used to add extra metadata to a post that you can <a href="%s">use in your theme</a>.' ),
__( 'https://wordpress.org/support/article/custom-fields/' )
);
?>
</p>
<?php
}
```
| Uses | Description |
| --- | --- |
| [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. |
| [has\_meta()](has_meta) wp-admin/includes/post.php | Returns meta data for the given post ID. |
| [is\_protected\_meta()](is_protected_meta) wp-includes/meta.php | Determines whether a meta key is considered protected. |
| [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. |
| Version | Description |
| --- | --- |
| [2.6.0](https://developer.wordpress.org/reference/since/2.6.0/) | Introduced. |
wordpress wp_enqueue_scripts() wp\_enqueue\_scripts()
======================
Wrapper for do\_action( ‘wp\_enqueue\_scripts’ ).
Allows plugins to queue scripts for the front end using [wp\_enqueue\_script()](wp_enqueue_script) .
Runs first in [wp\_head()](wp_head) where all [is\_home()](is_home) , [is\_page()](is_page) , etc. functions are available.
File: `wp-includes/script-loader.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/script-loader.php/)
```
function wp_enqueue_scripts() {
/**
* Fires when scripts and styles are enqueued.
*
* @since 2.8.0
*/
do_action( 'wp_enqueue_scripts' );
}
```
[do\_action( 'wp\_enqueue\_scripts' )](../hooks/wp_enqueue_scripts)
Fires when scripts and styles are enqueued.
| Uses | Description |
| --- | --- |
| [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::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. |
| Version | Description |
| --- | --- |
| [2.8.0](https://developer.wordpress.org/reference/since/2.8.0/) | Introduced. |
wordpress get_the_author_aim(): string get\_the\_author\_aim(): string
===============================
This function has been deprecated. Use [get\_the\_author\_meta()](get_the_author_meta) instead.
Retrieve the AIM address of the author of the current post.
* [get\_the\_author\_meta()](get_the_author_meta)
string The author's AIM address.
File: `wp-includes/deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/deprecated.php/)
```
function get_the_author_aim() {
_deprecated_function( __FUNCTION__, '2.8.0', 'get_the_author_meta(\'aim\')' );
return get_the_author_meta('aim');
}
```
| 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 get_author_name( int $auth_id = false ): string get\_author\_name( int $auth\_id = false ): string
==================================================
This function has been deprecated. Use [get\_the\_author\_meta()](get_the_author_meta) instead.
Retrieve the specified author’s preferred display name.
* [get\_the\_author\_meta()](get_the_author_meta)
`$auth_id` int Optional The ID of the author. Default: `false`
string The author's display name.
File: `wp-includes/deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/deprecated.php/)
```
function get_author_name( $auth_id = false ) {
_deprecated_function( __FUNCTION__, '2.8.0', 'get_the_author_meta(\'display_name\')' );
return get_the_author_meta('display_name', $auth_id);
}
```
| 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.0.0](https://developer.wordpress.org/reference/since/1.0.0/) | Introduced. |
wordpress wxr_authors_list( int[] $post_ids = null ) wxr\_authors\_list( int[] $post\_ids = null )
=============================================
Outputs list of authors with posts.
`$post_ids` int[] Optional Array of post IDs to filter the query by. Default: `null`
File: `wp-admin/includes/export.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/export.php/)
```
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";
}
}
```
| Uses | Description |
| --- | --- |
| [wxr\_cdata()](wxr_cdata) wp-admin/includes/export.php | Wraps given string in XML CDATA tag. |
| [get\_userdata()](get_userdata) wp-includes/pluggable.php | Retrieves user info by user ID. |
| [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 |
| --- | --- |
| [export\_wp()](export_wp) wp-admin/includes/export.php | Generates the WXR export file for download. |
| Version | Description |
| --- | --- |
| [3.1.0](https://developer.wordpress.org/reference/since/3.1.0/) | Introduced. |
| programming_docs |
wordpress add_option_update_handler( string $option_group, string $option_name, callable $sanitize_callback = '' ) add\_option\_update\_handler( string $option\_group, string $option\_name, callable $sanitize\_callback = '' )
==============================================================================================================
This function has been deprecated. Use [register\_setting()](register_setting) instead.
Register a setting and its sanitization callback
* [register\_setting()](register_setting)
`$option_group` string Required A settings group name. Should correspond to an allowed option key name.
Default allowed option key names include `'general'`, `'discussion'`, `'media'`, `'reading'`, `'writing'`, and `'options'`. `$option_name` string Required The name of an option to sanitize and save. `$sanitize_callback` callable Optional A callback function that sanitizes the option's value. Default: `''`
File: `wp-admin/includes/deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/deprecated.php/)
```
function add_option_update_handler( $option_group, $option_name, $sanitize_callback = '' ) {
_deprecated_function( __FUNCTION__, '3.0.0', 'register_setting()' );
register_setting( $option_group, $option_name, $sanitize_callback );
}
```
| Uses | Description |
| --- | --- |
| [register\_setting()](register_setting) wp-includes/option.php | Registers a setting and its data. |
| [\_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 [register\_setting()](register_setting) |
| [2.7.0](https://developer.wordpress.org/reference/since/2.7.0/) | Introduced. |
wordpress get_the_post_type_description(): string get\_the\_post\_type\_description(): string
===========================================
Retrieves the description for a post type archive.
string The post type description.
File: `wp-includes/general-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/general-template.php/)
```
function get_the_post_type_description() {
$post_type = get_query_var( 'post_type' );
if ( is_array( $post_type ) ) {
$post_type = reset( $post_type );
}
$post_type_obj = get_post_type_object( $post_type );
// Check if a description is set.
if ( isset( $post_type_obj->description ) ) {
$description = $post_type_obj->description;
} else {
$description = '';
}
/**
* Filters the description for a post type archive.
*
* @since 4.9.0
*
* @param string $description The post type description.
* @param WP_Post_Type $post_type_obj The post type object.
*/
return apply_filters( 'get_the_post_type_description', $description, $post_type_obj );
}
```
[apply\_filters( 'get\_the\_post\_type\_description', string $description, WP\_Post\_Type $post\_type\_obj )](../hooks/get_the_post_type_description)
Filters the description for a post type archive.
| 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. |
| [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 |
| --- | --- |
| [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.9.0](https://developer.wordpress.org/reference/since/4.9.0/) | Introduced. |
wordpress _remove_qs_args_if_not_in_url( string $query_string, array $args_to_check, string $url ): string \_remove\_qs\_args\_if\_not\_in\_url( string $query\_string, array $args\_to\_check, string $url ): 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.
Removes arguments from a query string if they are not present in a URL DO NOT use this in plugin code.
`$query_string` string Required `$args_to_check` array Required `$url` string Required string The altered query string
File: `wp-includes/canonical.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/canonical.php/)
```
function _remove_qs_args_if_not_in_url( $query_string, array $args_to_check, $url ) {
$parsed_url = parse_url( $url );
if ( ! empty( $parsed_url['query'] ) ) {
parse_str( $parsed_url['query'], $parsed_query );
foreach ( $args_to_check as $qv ) {
if ( ! isset( $parsed_query[ $qv ] ) ) {
$query_string = remove_query_arg( $qv, $query_string );
}
}
} else {
$query_string = remove_query_arg( $args_to_check, $query_string );
}
return $query_string;
}
```
| Uses | Description |
| --- | --- |
| [remove\_query\_arg()](remove_query_arg) wp-includes/functions.php | Removes an item or items from a query string. |
| 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 |
| --- | --- |
| [3.4.0](https://developer.wordpress.org/reference/since/3.4.0/) | Introduced. |
wordpress shortcode_exists( string $tag ): bool shortcode\_exists( string $tag ): bool
======================================
Determines whether a registered shortcode exists named $tag.
`$tag` string Required Shortcode tag to check. bool Whether the given shortcode exists.
File: `wp-includes/shortcodes.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/shortcodes.php/)
```
function shortcode_exists( $tag ) {
global $shortcode_tags;
return array_key_exists( $tag, $shortcode_tags );
}
```
| Used By | Description |
| --- | --- |
| [has\_shortcode()](has_shortcode) wp-includes/shortcodes.php | Determines whether the passed content contains the specified shortcode. |
| Version | Description |
| --- | --- |
| [3.6.0](https://developer.wordpress.org/reference/since/3.6.0/) | Introduced. |
wordpress the_custom_header_markup() the\_custom\_header\_markup()
=============================
Prints the markup for a custom header.
A container div will always be printed in the Customizer preview.
File: `wp-includes/theme.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/theme.php/)
```
function the_custom_header_markup() {
$custom_header = get_custom_header_markup();
if ( empty( $custom_header ) ) {
return;
}
echo $custom_header;
if ( is_header_video_active() && ( has_header_video() || is_customize_preview() ) ) {
wp_enqueue_script( 'wp-custom-header' );
wp_localize_script( 'wp-custom-header', '_wpCustomHeaderSettings', get_header_video_settings() );
}
}
```
| Uses | Description |
| --- | --- |
| [get\_custom\_header\_markup()](get_custom_header_markup) wp-includes/theme.php | Retrieves the markup for a custom header. |
| [is\_header\_video\_active()](is_header_video_active) wp-includes/theme.php | Checks whether the custom header video is eligible to show on the current page. |
| [has\_header\_video()](has_header_video) wp-includes/theme.php | Checks whether a header video is set or not. |
| [get\_header\_video\_settings()](get_header_video_settings) wp-includes/theme.php | Retrieves header video settings. |
| [is\_customize\_preview()](is_customize_preview) wp-includes/theme.php | Whether the site is being previewed in the Customizer. |
| [wp\_enqueue\_script()](wp_enqueue_script) wp-includes/functions.wp-scripts.php | Enqueue a script. |
| [wp\_localize\_script()](wp_localize_script) wp-includes/functions.wp-scripts.php | Localize a script. |
| Version | Description |
| --- | --- |
| [4.7.0](https://developer.wordpress.org/reference/since/4.7.0/) | Introduced. |
wordpress sanitize_url( string $url, string[] $protocols = null ): string sanitize\_url( string $url, string[] $protocols = null ): string
================================================================
Sanitizes a URL for database or redirect usage.
* [esc\_url()](esc_url)
`$url` string Required The URL to be cleaned. `$protocols` string[] Optional An array of acceptable protocols.
Defaults to return value of [wp\_allowed\_protocols()](wp_allowed_protocols) . Default: `null`
string The cleaned URL after [esc\_url()](esc_url) is run with the `'db'` context.
File: `wp-includes/formatting.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/formatting.php/)
```
function sanitize_url( $url, $protocols = null ) {
return esc_url( $url, $protocols, 'db' );
}
```
| Uses | Description |
| --- | --- |
| [esc\_url()](esc_url) wp-includes/formatting.php | Checks and cleans a URL. |
| Used By | Description |
| --- | --- |
| [\_wp\_theme\_json\_webfonts\_handler()](_wp_theme_json_webfonts_handler) wp-includes/script-loader.php | Runs the theme.json webfonts handler. |
| [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\_default\_packages\_inline\_scripts()](wp_default_packages_inline_scripts) wp-includes/script-loader.php | Adds inline scripts required for the WordPress JavaScript packages. |
| [\_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\_Customize\_Manager::\_sanitize\_external\_header\_video()](../classes/wp_customize_manager/_sanitize_external_header_video) wp-includes/class-wp-customize-manager.php | Callback for sanitizing the external\_header\_video value. |
| [rest\_sanitize\_value\_from\_schema()](rest_sanitize_value_from_schema) wp-includes/rest-api.php | Sanitize 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\_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. |
| [get\_header\_video\_url()](get_header_video_url) wp-includes/theme.php | Retrieves header video URL for custom header. |
| [rest\_send\_cors\_headers()](rest_send_cors_headers) wp-includes/rest-api.php | Sends Cross-Origin Resource Sharing headers with API requests. |
| [rest\_output\_link\_header()](rest_output_link_header) wp-includes/rest-api.php | Sends a Link header for the REST API. |
| [get\_post\_embed\_url()](get_post_embed_url) wp-includes/embed.php | Retrieves the URL to embed a specific post in an iframe. |
| [WP\_Customize\_Manager::set\_return\_url()](../classes/wp_customize_manager/set_return_url) wp-includes/class-wp-customize-manager.php | Sets URL to link the user to when closing the Customizer. |
| [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::set\_preview\_url()](../classes/wp_customize_manager/set_preview_url) wp-includes/class-wp-customize-manager.php | Sets the initial URL to be previewed. |
| [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\_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. |
| [get\_editor\_stylesheets()](get_editor_stylesheets) wp-includes/theme.php | Retrieves any registered editor stylesheet URLs. |
| [login\_footer()](login_footer) wp-login.php | Outputs the footer for the login page. |
| [wp\_prepare\_themes\_for\_js()](wp_prepare_themes_for_js) wp-admin/includes/theme.php | Prepares themes for JavaScript. |
| [export\_wp()](export_wp) wp-admin/includes/export.php | Generates the WXR export file for download. |
| [edit\_user()](edit_user) wp-admin/includes/user.php | Edit user settings based on contents of $\_POST |
| [wp\_media\_upload\_handler()](wp_media_upload_handler) wp-admin/includes/media.php | Handles the process of uploading media. |
| [edit\_post()](edit_post) wp-admin/includes/post.php | Updates an existing post with values provided in `$_POST`. |
| [wp\_ajax\_send\_link\_to\_editor()](wp_ajax_send_link_to_editor) wp-admin/includes/ajax-actions.php | Ajax handler for sending a link to the editor. |
| [\_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. |
| [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\_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. |
| [\_custom\_background\_cb()](_custom_background_cb) wp-includes/theme.php | Default custom background callback. |
| [get\_header\_image()](get_header_image) wp-includes/theme.php | Retrieves header image for custom header. |
| [get\_uploaded\_header\_images()](get_uploaded_header_images) wp-includes/theme.php | Gets the header images uploaded for the active theme. |
| [get\_url\_in\_content()](get_url_in_content) wp-includes/formatting.php | Extracts and returns the first URL from passed content. |
| [sanitize\_option()](sanitize_option) wp-includes/formatting.php | Sanitizes various option values based on the nature of the option. |
| [esc\_url\_raw()](esc_url_raw) wp-includes/formatting.php | Sanitizes a URL for database or redirect usage. |
| [get\_the\_generator()](get_the_generator) wp-includes/general-template.php | Creates the generator XML or Comment for RSS, ATOM, etc. |
| [WP\_Theme::sanitize\_header()](../classes/wp_theme/sanitize_header) wp-includes/class-wp-theme.php | Sanitizes a theme header. |
| [wp\_widget\_rss\_process()](wp_widget_rss_process) wp-includes/widgets.php | Process RSS feed widget data and optionally retrieve feed items. |
| [get\_pagenum\_link()](get_pagenum_link) wp-includes/link-template.php | Retrieves the link for a page number. |
| [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. |
| [get\_blogaddress\_by\_domain()](get_blogaddress_by_domain) wp-includes/ms-deprecated.php | Get a full blog URL, given a domain and a path. |
| [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\_default\_scripts()](wp_default_scripts) wp-includes/script-loader.php | Registers all WordPress scripts. |
| Version | Description |
| --- | --- |
| [5.9.0](https://developer.wordpress.org/reference/since/5.9.0/) | Restored (un-deprecated). |
| [2.8.0](https://developer.wordpress.org/reference/since/2.8.0/) | Deprecated in favor of [esc\_url\_raw()](esc_url_raw) . |
| [2.3.1](https://developer.wordpress.org/reference/since/2.3.1/) | Introduced. |
wordpress esc_attr_x( string $text, string $context, string $domain = 'default' ): string esc\_attr\_x( string $text, string $context, string $domain = 'default' ): string
=================================================================================
Translates string with gettext context, and escapes it for safe use in an attribute.
If there is no translation, or the text domain isn’t loaded, the original text is escaped and returned.
`$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'`
string Translated text.
File: `wp-includes/l10n.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/l10n.php/)
```
function esc_attr_x( $text, $context, $domain = 'default' ) {
return esc_attr( translate_with_gettext_context( $text, $context, $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. |
| [esc\_attr()](esc_attr) wp-includes/formatting.php | Escaping for HTML attributes. |
| Used By | Description |
| --- | --- |
| [wp\_print\_revision\_templates()](wp_print_revision_templates) wp-admin/includes/revision.php | Print JavaScript templates required for the revisions experience. |
| [wp\_dropdown\_languages()](wp_dropdown_languages) wp-includes/l10n.php | Displays or returns a Language selector. |
| [post\_submit\_meta\_box()](post_submit_meta_box) wp-admin/includes/meta-boxes.php | Displays post submit form fields. |
| [get\_search\_form()](get_search_form) wp-includes/general-template.php | Displays search form. |
| [get\_the\_password\_form()](get_the_password_form) wp-includes/post-template.php | Retrieves protected post password form content. |
| Version | Description |
| --- | --- |
| [2.8.0](https://developer.wordpress.org/reference/since/2.8.0/) | Introduced. |
wordpress wp_array_slice_assoc( array $array, array $keys ): array wp\_array\_slice\_assoc( array $array, array $keys ): array
===========================================================
Extracts a slice of an array, given a list of keys.
`$array` array Required The original array. `$keys` array Required The list of keys. array The array slice.
File: `wp-includes/functions.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/functions.php/)
```
function wp_array_slice_assoc( $array, $keys ) {
$slice = array();
foreach ( $keys as $key ) {
if ( isset( $array[ $key ] ) ) {
$slice[ $key ] = $array[ $key ];
}
}
return $slice;
}
```
| Used By | Description |
| --- | --- |
| [wp\_list\_users()](wp_list_users) wp-includes/user.php | Lists all the users of the site, with several options available. |
| [wp\_get\_code\_editor\_settings()](wp_get_code_editor_settings) wp-includes/general-template.php | Generates and returns code editor settings. |
| [WP\_Widget\_Media\_Gallery::enqueue\_admin\_scripts()](../classes/wp_widget_media_gallery/enqueue_admin_scripts) wp-includes/widgets/class-wp-widget-media-gallery.php | Loads the required media files for the media manager and scripts for media widgets. |
| [WP\_Widget\_Media\_Audio::enqueue\_admin\_scripts()](../classes/wp_widget_media_audio/enqueue_admin_scripts) wp-includes/widgets/class-wp-widget-media-audio.php | Loads the required media files for the media manager and scripts for media widgets. |
| [WP\_Widget\_Media\_Video::enqueue\_admin\_scripts()](../classes/wp_widget_media_video/enqueue_admin_scripts) wp-includes/widgets/class-wp-widget-media-video.php | Loads the required scripts and styles for the widget control. |
| [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\_Image::enqueue\_admin\_scripts()](../classes/wp_widget_media_image/enqueue_admin_scripts) wp-includes/widgets/class-wp-widget-media-image.php | Loads the required media files for the media manager and scripts for media widgets. |
| [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. |
| [get\_theme\_starter\_content()](get_theme_starter_content) wp-includes/theme.php | Expands a theme’s starter content configuration using core-provided data. |
| [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\_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\_Customize\_Manager::set\_autofocus()](../classes/wp_customize_manager/set_autofocus) wp-includes/class-wp-customize-manager.php | Sets the autofocused constructs. |
| [WP\_Comment\_Query::get\_comment\_ids()](../classes/wp_comment_query/get_comment_ids) wp-includes/class-wp-comment-query.php | Used internally to get a list of comment IDs matching the query vars. |
| [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\_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\_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\_Setting::value()](../classes/wp_customize_nav_menu_setting/value) wp-includes/customize/class-wp-customize-nav-menu-setting.php | Get the instance data for a given widget 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\_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. |
| [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. |
| [\_wp\_customize\_include()](_wp_customize_include) wp-includes/theme.php | Includes and instantiates the [WP\_Customize\_Manager](../classes/wp_customize_manager) class. |
| [wp\_dropdown\_users()](wp_dropdown_users) wp-includes/user.php | Creates dropdown HTML content of users. |
| [get\_pages()](get_pages) wp-includes/post.php | Retrieves an array of pages (or hierarchical post type items). |
| [wp\_list\_authors()](wp_list_authors) wp-includes/author-template.php | Lists all the authors of the site, with several options available. |
| [wp\_update\_comment()](wp_update_comment) wp-includes/comment.php | Updates an existing comment in the database. |
| Version | Description |
| --- | --- |
| [3.1.0](https://developer.wordpress.org/reference/since/3.1.0/) | Introduced. |
| programming_docs |
wordpress wp_targeted_link_rel( string $text ): string wp\_targeted\_link\_rel( string $text ): string
===============================================
Adds `rel="noopener"` to all HTML A elements that have a target.
`$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_targeted_link_rel( $text ) {
// Don't run (more expensive) regex if no links with targets.
if ( stripos( $text, 'target' ) === false || stripos( $text, '<a ' ) === false || is_serialized( $text ) ) {
return $text;
}
$script_and_style_regex = '/<(script|style).*?<\/\\1>/si';
preg_match_all( $script_and_style_regex, $text, $matches );
$extra_parts = $matches[0];
$html_parts = preg_split( $script_and_style_regex, $text );
foreach ( $html_parts as &$part ) {
$part = preg_replace_callback( '|<a\s([^>]*target\s*=[^>]*)>|i', 'wp_targeted_link_rel_callback', $part );
}
$text = '';
for ( $i = 0; $i < count( $html_parts ); $i++ ) {
$text .= $html_parts[ $i ];
if ( isset( $extra_parts[ $i ] ) ) {
$text .= $extra_parts[ $i ];
}
}
return $text;
}
```
| Uses | Description |
| --- | --- |
| [stripos()](stripos) wp-includes/class-pop3.php | |
| [is\_serialized()](is_serialized) wp-includes/functions.php | Checks value to find if it was serialized. |
| Used By | Description |
| --- | --- |
| [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\_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\_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. |
| Version | Description |
| --- | --- |
| [5.6.0](https://developer.wordpress.org/reference/since/5.6.0/) | Removed `'noreferrer'` relationship. |
| [5.1.0](https://developer.wordpress.org/reference/since/5.1.0/) | Introduced. |
wordpress wp_get_post_revision( int|WP_Post $post, string $output = OBJECT, string $filter = 'raw' ): WP_Post|array|null wp\_get\_post\_revision( int|WP\_Post $post, string $output = OBJECT, string $filter = 'raw' ): WP\_Post|array|null
===================================================================================================================
Gets a post revision.
`$post` int|[WP\_Post](../classes/wp_post) Required Post ID or post object. `$output` string Optional The required return type. One of OBJECT, ARRAY\_A, or ARRAY\_N, which correspond to a [WP\_Post](../classes/wp_post) object, an associative array, or a numeric array, respectively. Default: `OBJECT`
`$filter` string Optional sanitization filter. See [sanitize\_post()](sanitize_post) . Default: `'raw'`
[WP\_Post](../classes/wp_post)|array|null [WP\_Post](../classes/wp_post) (or array) on success, or null on failure.
File: `wp-includes/revision.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/revision.php/)
```
function wp_get_post_revision( &$post, $output = OBJECT, $filter = 'raw' ) {
$revision = get_post( $post, OBJECT, $filter );
if ( ! $revision ) {
return $revision;
}
if ( 'revision' !== $revision->post_type ) {
return null;
}
if ( OBJECT === $output ) {
return $revision;
} elseif ( ARRAY_A === $output ) {
$_revision = get_object_vars( $revision );
return $_revision;
} elseif ( ARRAY_N === $output ) {
$_revision = array_values( get_object_vars( $revision ) );
return $_revision;
}
return $revision;
}
```
| Uses | Description |
| --- | --- |
| [get\_post()](get_post) wp-includes/post.php | Retrieves post data given a post ID or post object. |
| Used By | Description |
| --- | --- |
| [wp\_is\_post\_autosave()](wp_is_post_autosave) wp-includes/revision.php | Determines if the specified post is an autosave. |
| [wp\_restore\_post\_revision()](wp_restore_post_revision) wp-includes/revision.php | Restores a post to the specified revision. |
| [wp\_delete\_post\_revision()](wp_delete_post_revision) wp-includes/revision.php | Deletes a revision. |
| [wp\_is\_post\_revision()](wp_is_post_revision) wp-includes/revision.php | Determines if the specified post is a revision. |
| [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 get_comment_guid( int|WP_Comment $comment_id = null ): string|false get\_comment\_guid( int|WP\_Comment $comment\_id = null ): string|false
=======================================================================
Retrieves the feed GUID for the current comment.
`$comment_id` int|[WP\_Comment](../classes/wp_comment) Optional comment object or ID. Defaults to global comment object. Default: `null`
string|false GUID for comment on success, false on failure.
File: `wp-includes/feed.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/feed.php/)
```
function get_comment_guid( $comment_id = null ) {
$comment = get_comment( $comment_id );
if ( ! is_object( $comment ) ) {
return false;
}
return get_the_guid( $comment->comment_post_ID ) . '#comment-' . $comment->comment_ID;
}
```
| Uses | Description |
| --- | --- |
| [get\_the\_guid()](get_the_guid) wp-includes/post-template.php | Retrieves the Post Global Unique Identifier (guid). |
| [get\_comment()](get_comment) wp-includes/comment.php | Retrieves comment data given a comment ID or comment object. |
| Used By | Description |
| --- | --- |
| [comment\_guid()](comment_guid) wp-includes/feed.php | Displays the feed GUID for the current comment. |
| Version | Description |
| --- | --- |
| [2.5.0](https://developer.wordpress.org/reference/since/2.5.0/) | Introduced. |
wordpress sanitize_email( string $email ): string sanitize\_email( string $email ): string
========================================
Strips out all characters that are not allowable in an email.
`$email` string Required Email address to filter. string Filtered email address.
* After [sanitize\_email()](sanitize_email) has done its work, it passes the sanitized e-mail address through the [sanitize\_email](../hooks/sanitize_email) filter.
* This function uses a smaller allowable character set than the set defined by [RFC 5322](https://tools.ietf.org/html/rfc5322). Some legal email addresses may be changed.
* Allowed character regular expression: `/[^a-z0-9+_.@-]/i`.
File: `wp-includes/formatting.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/formatting.php/)
```
function sanitize_email( $email ) {
// Test for the minimum length the email can be.
if ( strlen( $email ) < 6 ) {
/**
* Filters a sanitized email address.
*
* This filter is evaluated under several contexts, including 'email_too_short',
* 'email_no_at', 'local_invalid_chars', 'domain_period_sequence', 'domain_period_limits',
* 'domain_no_periods', 'domain_no_valid_subs', or no context.
*
* @since 2.8.0
*
* @param string $sanitized_email The sanitized email address.
* @param string $email The email address, as provided to sanitize_email().
* @param string|null $message A message to pass to the user. null if email is sanitized.
*/
return apply_filters( 'sanitize_email', '', $email, 'email_too_short' );
}
// Test for an @ character after the first position.
if ( strpos( $email, '@', 1 ) === false ) {
/** This filter is documented in wp-includes/formatting.php */
return apply_filters( 'sanitize_email', '', $email, 'email_no_at' );
}
// Split out the local and domain parts.
list( $local, $domain ) = explode( '@', $email, 2 );
// LOCAL PART
// Test for invalid characters.
$local = preg_replace( '/[^a-zA-Z0-9!#$%&\'*+\/=?^_`{|}~\.-]/', '', $local );
if ( '' === $local ) {
/** This filter is documented in wp-includes/formatting.php */
return apply_filters( 'sanitize_email', '', $email, 'local_invalid_chars' );
}
// DOMAIN PART
// Test for sequences of periods.
$domain = preg_replace( '/\.{2,}/', '', $domain );
if ( '' === $domain ) {
/** This filter is documented in wp-includes/formatting.php */
return apply_filters( 'sanitize_email', '', $email, 'domain_period_sequence' );
}
// Test for leading and trailing periods and whitespace.
$domain = trim( $domain, " \t\n\r\0\x0B." );
if ( '' === $domain ) {
/** This filter is documented in wp-includes/formatting.php */
return apply_filters( 'sanitize_email', '', $email, 'domain_period_limits' );
}
// Split the domain into subs.
$subs = explode( '.', $domain );
// Assume the domain will have at least two subs.
if ( 2 > count( $subs ) ) {
/** This filter is documented in wp-includes/formatting.php */
return apply_filters( 'sanitize_email', '', $email, 'domain_no_periods' );
}
// Create an array that will contain valid subs.
$new_subs = array();
// Loop through each sub.
foreach ( $subs as $sub ) {
// Test for leading and trailing hyphens.
$sub = trim( $sub, " \t\n\r\0\x0B-" );
// Test for invalid characters.
$sub = preg_replace( '/[^a-z0-9-]+/i', '', $sub );
// If there's anything left, add it to the valid subs.
if ( '' !== $sub ) {
$new_subs[] = $sub;
}
}
// If there aren't 2 or more valid subs.
if ( 2 > count( $new_subs ) ) {
/** This filter is documented in wp-includes/formatting.php */
return apply_filters( 'sanitize_email', '', $email, 'domain_no_valid_subs' );
}
// Join valid subs into the new domain.
$domain = implode( '.', $new_subs );
// Put the email back together.
$sanitized_email = $local . '@' . $domain;
// Congratulations, your email made it!
/** This filter is documented in wp-includes/formatting.php */
return apply_filters( 'sanitize_email', $sanitized_email, $email, null );
}
```
[apply\_filters( 'sanitize\_email', string $sanitized\_email, string $email, string|null $message )](../hooks/sanitize_email)
Filters a sanitized email address.
| 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\_create\_user\_request()](wp_create_user_request) wp-includes/user.php | Creates and logs a user request to perform a specific action. |
| [sanitize\_option()](sanitize_option) wp-includes/formatting.php | Sanitizes various option values based on the nature of the option. |
| [wpmu\_validate\_user\_signup()](wpmu_validate_user_signup) wp-includes/ms-functions.php | Sanitizes and validates data required for a user sign-up. |
| [wpmu\_signup\_user()](wpmu_signup_user) wp-includes/ms-functions.php | Records user signup information for future activation. |
| Version | Description |
| --- | --- |
| [1.5.0](https://developer.wordpress.org/reference/since/1.5.0/) | Introduced. |
wordpress esc_attr( string $text ): string esc\_attr( string $text ): string
=================================
Escaping for HTML attributes.
`$text` string Required string
Encodes the <, >, &, ” and ‘ (less than, greater than, ampersand, double quote and single quote) characters. Will never double encode entities.
Always use when escaping HTML attributes (especially form values) such as alt, value, title, etc. To escape the value of a translation use [esc\_attr\_\_()](esc_attr__) instead; to escape, translate and echo, use [esc\_attr\_e()](esc_attr_e) .
File: `wp-includes/formatting.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/formatting.php/)
```
function esc_attr( $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 an HTML attribute.
*
* Text passed to esc_attr() is stripped of invalid or special characters
* before output.
*
* @since 2.0.6
*
* @param string $safe_text The text after it has been escaped.
* @param string $text The text prior to being escaped.
*/
return apply_filters( 'attribute_escape', $safe_text, $text );
}
```
[apply\_filters( 'attribute\_escape', string $safe\_text, string $text )](../hooks/attribute_escape)
Filters a string cleaned and escaped for output in an HTML attribute.
| 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\_img\_tag\_add\_decoding\_attr()](wp_img_tag_add_decoding_attr) wp-includes/media.php | Adds `decoding` attribute to an `img` HTML tag. |
| [wp\_preload\_resources()](wp_preload_resources) wp-includes/general-template.php | Prints resource preloads directives to browsers. |
| [wp\_list\_users()](wp_list_users) wp-includes/user.php | Lists all the users of the site, with several options available. |
| [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\_robots()](wp_robots) wp-includes/robots-template.php | Displays the robots meta tag as necessary. |
| [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\_iframe\_tag\_add\_loading\_attr()](wp_iframe_tag_add_loading_attr) wp-includes/media.php | Adds `loading` attribute to an `iframe` HTML tag. |
| [get\_block\_wrapper\_attributes()](get_block_wrapper_attributes) wp-includes/class-wp-block-supports.php | Generates a string of attributes by applying to the current block being rendered all of the features that the block supports. |
| [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::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. |
| [WP\_Application\_Passwords\_List\_Table::single\_row()](../classes/wp_application_passwords_list_table/single_row) wp-admin/includes/class-wp-application-passwords-list-table.php | Generates content for a single row of the table. |
| [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\_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\_img\_tag\_add\_loading\_attr()](wp_img_tag_add_loading_attr) wp-includes/media.php | Adds `loading` attribute to an `img` HTML tag. |
| [wp\_admin\_viewport\_meta()](wp_admin_viewport_meta) wp-admin/includes/misc.php | Displays the viewport meta in the admin. |
| [wp\_rel\_callback()](wp_rel_callback) wp-includes/formatting.php | Callback to add a rel attribute to HTML A element. |
| [wp\_credits\_section\_list()](wp_credits_section_list) wp-admin/includes/credits.php | Displays a list of contributors for a given group. |
| [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\_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\_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\_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\_targeted\_link\_rel\_callback()](wp_targeted_link_rel_callback) wp-includes/formatting.php | Callback to add `rel="noopener"` string to HTML A element. |
| [WP\_Scripts::print\_translations()](../classes/wp_scripts/print_translations) wp-includes/class-wp-scripts.php | Prints translations set for a specific handle. |
| [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. |
| [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\_Privacy\_Requests\_Table::single\_row()](../classes/wp_privacy_requests_table/single_row) wp-admin/includes/class-wp-privacy-requests-table.php | Generates content for a single row of the table, |
| [WP\_Privacy\_Requests\_Table::column\_cb()](../classes/wp_privacy_requests_table/column_cb) wp-admin/includes/class-wp-privacy-requests-table.php | Checkbox column. |
| [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\_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\_Custom\_HTML::form()](../classes/wp_widget_custom_html/form) wp-includes/widgets/class-wp-widget-custom-html.php | Outputs the Custom HTML widget settings form. |
| [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\_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\_load\_press\_this()](wp_load_press_this) wp-admin/press-this.php | |
| [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::form()](../classes/wp_widget_media/form) wp-includes/widgets/class-wp-widget-media.php | Outputs the settings update form. |
| [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\_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\_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\_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\_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\_resource\_hints()](wp_resource_hints) wp-includes/general-template.php | Prints resource hints to browsers for pre-fetching, pre-rendering and pre-connecting to web sites. |
| [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\_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. |
| [WP\_Scripts::print\_inline\_script()](../classes/wp_scripts/print_inline_script) wp-includes/class-wp-scripts.php | Prints inline scripts registered for a specific handle. |
| [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. |
| [get\_post\_embed\_html()](get_post_embed_html) wp-includes/embed.php | Retrieves the embed code for a specific post. |
| [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. |
| [wp\_image\_add\_srcset\_and\_sizes()](wp_image_add_srcset_and_sizes) wp-includes/media.php | Adds ‘srcset’ and ‘sizes’ attributes to an existing ‘img’ element. |
| [WP\_Posts\_List\_Table::get\_edit\_link()](../classes/wp_posts_list_table/get_edit_link) wp-admin/includes/class-wp-posts-list-table.php | Helper to create links to edit.php with params. |
| [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\_Panel::print\_template()](../classes/wp_customize_panel/print_template) wp-includes/class-wp-customize-panel.php | Render the panel’s JS templates. |
| [get\_language\_attributes()](get_language_attributes) wp-includes/general-template.php | Gets the language attributes for the ‘html’ tag. |
| [WP\_Customize\_Nav\_Menus::filter\_wp\_nav\_menu()](../classes/wp_customize_nav_menus/filter_wp_nav_menu) wp-includes/class-wp-customize-nav-menus.php | Prepares [wp\_nav\_menu()](wp_nav_menu) calls for partial refresh. |
| [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::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\_title()](../classes/wp_posts_list_table/column_title) wp-admin/includes/class-wp-posts-list-table.php | Handles the title column output. |
| [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::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\_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\_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::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\_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\_kses\_one\_attr()](wp_kses_one_attr) wp-includes/kses.php | Filters one HTML attribute and ensures its value is allowed. |
| [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\_Control::print\_template()](../classes/wp_customize_control/print_template) wp-includes/class-wp-customize-control.php | Render the control’s JS template. |
| [wp\_dropdown\_languages()](wp_dropdown_languages) wp-includes/l10n.php | Displays or returns a Language selector. |
| [WP\_Customize\_Control::input\_attrs()](../classes/wp_customize_control/input_attrs) wp-includes/class-wp-customize-control.php | Render the custom attributes for the control’s input element. |
| [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. |
| [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. |
| [show\_user\_form()](show_user_form) wp-signup.php | Displays the fields for the new user account registration form. |
| [signup\_blog()](signup_blog) wp-signup.php | Shows a form for a user or visitor to sign up for a new site. |
| [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. |
| [display\_setup\_form()](display_setup_form) wp-admin/install.php | Displays installer setup form. |
| [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. |
| [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\_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 | |
| [meta\_box\_prefs()](meta_box_prefs) wp-admin/includes/screen.php | Prints the meta box preferences for screen meta. |
| [WP\_Links\_List\_Table::display\_rows()](../classes/wp_links_list_table/display_rows) 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. |
| [Bulk\_Upgrader\_Skin::before()](../classes/bulk_upgrader_skin/before) wp-admin/includes/class-bulk-upgrader-skin.php | |
| [Bulk\_Upgrader\_Skin::after()](../classes/bulk_upgrader_skin/after) wp-admin/includes/class-bulk-upgrader-skin.php | |
| [WP\_List\_Table::single\_row\_columns()](../classes/wp_list_table/single_row_columns) wp-admin/includes/class-wp-list-table.php | Generates the columns for a single row of the table. |
| [WP\_List\_Table::view\_switcher()](../classes/wp_list_table/view_switcher) wp-admin/includes/class-wp-list-table.php | Displays a view switcher. |
| [WP\_List\_Table::get\_table\_classes()](../classes/wp_list_table/get_table_classes) wp-admin/includes/class-wp-list-table.php | Gets a list of CSS classes for the [WP\_List\_Table](../classes/wp_list_table) table tag. |
| [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 |
| [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. |
| [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. |
| [wp\_image\_editor()](wp_image_editor) wp-admin/includes/image-edit.php | Loads the WP image-editing interface. |
| [WP\_MS\_Themes\_List\_Table::single\_row()](../classes/wp_ms_themes_list_table/single_row) 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). |
| [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\_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\_search\_form()](install_search_form) wp-admin/includes/plugin-install.php | Displays a search form for searching plugins. |
| [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\_recent\_posts()](wp_dashboard_recent_posts) wp-admin/includes/dashboard.php | Generates Publishing Soon and Recently Published sections. |
| [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\_control\_callback()](_wp_dashboard_control_callback) wp-admin/includes/dashboard.php | Outputs controls for the current dashboard widget. |
| [wp\_dashboard\_recent\_drafts()](wp_dashboard_recent_drafts) wp-admin/includes/dashboard.php | Show recent drafts of the user on the dashboard. |
| [settings\_fields()](settings_fields) wp-admin/includes/plugin.php | Outputs nonce, action, and option\_page fields for a settings page. |
| [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 | |
| [get\_submit\_button()](get_submit_button) wp-admin/includes/template.php | Returns a submit button, with provided text and appropriate class. |
| [do\_settings\_sections()](do_settings_sections) wp-admin/includes/template.php | Prints out all settings sections added to a particular settings page. |
| [do\_settings\_fields()](do_settings_fields) wp-admin/includes/template.php | Prints out the settings fields for a particular settings section. |
| [settings\_errors()](settings_errors) wp-admin/includes/template.php | Displays settings errors registered by [add\_settings\_error()](add_settings_error) . |
| [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. |
| [the\_post\_password()](the_post_password) wp-admin/includes/template.php | Displays the post password. |
| [\_admin\_search\_query()](_admin_search_query) wp-admin/includes/template.php | Displays the search query. |
| [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. |
| [page\_template\_dropdown()](page_template_dropdown) wp-admin/includes/template.php | Prints out option HTML elements for the page templates drop-down. |
| [wp\_dropdown\_roles()](wp_dropdown_roles) wp-admin/includes/template.php | Prints out option HTML elements for role selectors. |
| [do\_meta\_boxes()](do_meta_boxes) wp-admin/includes/template.php | Meta-Box template function. |
| [do\_accordion\_sections()](do_accordion_sections) wp-admin/includes/template.php | Meta Box Accordion Template Function. |
| [WP\_Themes\_List\_Table::display\_rows()](../classes/wp_themes_list_table/display_rows) wp-admin/includes/class-wp-themes-list-table.php | |
| [WP\_Themes\_List\_Table::\_js\_vars()](../classes/wp_themes_list_table/_js_vars) wp-admin/includes/class-wp-themes-list-table.php | Send required variables to JavaScript land |
| [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\_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. |
| [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. |
| [get\_compat\_media\_markup()](get_compat_media_markup) wp-admin/includes/media.php | |
| [media\_upload\_form\_handler()](media_upload_form_handler) wp-admin/includes/media.php | Handles form submissions for the legacy media uploader. |
| [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\_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. |
| [the\_media\_upload\_tabs()](the_media_upload_tabs) wp-admin/includes/media.php | Outputs the legacy media upload tabs UI. |
| [get\_image\_send\_to\_editor()](get_image_send_to_editor) wp-admin/includes/media.php | Retrieves the image HTML to send to the editor. |
| [media\_buttons()](media_buttons) wp-admin/includes/media.php | Adds the media button to the editor. |
| [\_wp\_post\_thumbnail\_html()](_wp_post_thumbnail_html) wp-admin/includes/post.php | Returns HTML for the post thumbnail meta box. |
| [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. |
| [post\_trackback\_meta\_box()](post_trackback_meta_box) wp-admin/includes/meta-boxes.php | Displays trackback links form fields. |
| [post\_slug\_meta\_box()](post_slug_meta_box) wp-admin/includes/meta-boxes.php | Displays slug form fields. |
| [page\_attributes\_meta\_box()](page_attributes_meta_box) wp-admin/includes/meta-boxes.php | Displays page attributes form fields. |
| [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. |
| [attachment\_id3\_data\_meta\_box()](attachment_id3_data_meta_box) wp-admin/includes/meta-boxes.php | Displays fields for ID3 data. |
| [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\_tags\_meta\_box()](post_tags_meta_box) wp-admin/includes/meta-boxes.php | Displays post tags form fields. |
| [post\_categories\_meta\_box()](post_categories_meta_box) wp-admin/includes/meta-boxes.php | Displays post categories form fields. |
| [get\_default\_link\_to\_edit()](get_default_link_to_edit) wp-admin/includes/bookmark.php | Retrieves the default link for editing. |
| [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\_row\_actions()](../classes/wp_media_list_table/_get_row_actions) wp-admin/includes/class-wp-media-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::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. |
| [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\_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\_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\_table\_classes()](../classes/wp_posts_list_table/get_table_classes) wp-admin/includes/class-wp-posts-list-table.php | |
| [options\_reading\_blog\_charset()](options_reading_blog_charset) wp-admin/includes/options.php | Render the site charset setting. |
| [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 | |
| [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. |
| [Custom\_Background::wp\_set\_background\_image()](../classes/custom_background/wp_set_background_image) wp-admin/includes/class-custom-background.php | |
| [Custom\_Background::admin\_page()](../classes/custom_background/admin_page) wp-admin/includes/class-custom-background.php | Displays the custom background page. |
| [\_wp\_menu\_output()](_wp_menu_output) wp-admin/menu-header.php | Display menu. |
| [WP\_Styles::print\_inline\_style()](../classes/wp_styles/print_inline_style) wp-includes/class-wp-styles.php | Prints extra CSS styles of a registered stylesheet. |
| [WP\_Styles::do\_item()](../classes/wp_styles/do_item) wp-includes/class-wp-styles.php | Processes a style dependency. |
| [Walker\_CategoryDropdown::start\_el()](../classes/walker_categorydropdown/start_el) wp-includes/class-walker-category-dropdown.php | Starts the element output. |
| [Walker\_Category::start\_el()](../classes/walker_category/start_el) wp-includes/class-walker-category.php | Starts the element output. |
| [wp\_generate\_tag\_cloud()](wp_generate_tag_cloud) wp-includes/category-template.php | Generates a tag cloud (heatmap) from provided data. |
| [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. |
| [esc\_attr\_\_()](esc_attr__) wp-includes/l10n.php | Retrieves the translation of $text and escapes it for safe use in an attribute. |
| [esc\_attr\_e()](esc_attr_e) wp-includes/l10n.php | Displays translated text that has been escaped for safe use in an attribute. |
| [esc\_attr\_x()](esc_attr_x) wp-includes/l10n.php | Translates string with gettext context, and escapes it for safe use in an attribute. |
| [\_links\_add\_target()](_links_add_target) wp-includes/formatting.php | Callback to add a target attribute to all links in passed content. |
| [\_make\_url\_clickable\_cb()](_make_url_clickable_cb) wp-includes/formatting.php | Callback to convert URI match to HTML A element. |
| [\_make\_web\_ftp\_clickable\_cb()](_make_web_ftp_clickable_cb) wp-includes/formatting.php | Callback to convert URL match to HTML A element. |
| [translate\_smiley()](translate_smiley) wp-includes/formatting.php | Converts one smiley code to the icon graphic file equivalent. |
| [get\_avatar()](get_avatar) wp-includes/pluggable.php | Retrieves the avatar `<img>` tag for a user, email address, MD5 hash, comment, or post. |
| [the\_search\_query()](the_search_query) wp-includes/general-template.php | Displays the contents of the search query variable. |
| [paginate\_links()](paginate_links) wp-includes/general-template.php | Retrieves paginated links for archive post pages. |
| [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. |
| [get\_search\_query()](get_search_query) wp-includes/general-template.php | Retrieves the contents of the search WordPress query variable. |
| [get\_archives\_link()](get_archives_link) wp-includes/general-template.php | Retrieves archive link content based on predefined or custom code. |
| [get\_calendar()](get_calendar) wp-includes/general-template.php | Displays calendar with days that have posts as links. |
| [wp\_login\_form()](wp_login_form) wp-includes/general-template.php | Provides a simple login form for use anywhere within WordPress. |
| [get\_search\_form()](get_search_form) wp-includes/general-template.php | Displays search form. |
| [get\_boundary\_post\_rel\_link()](get_boundary_post_rel_link) wp-includes/deprecated.php | Get boundary post relational link. |
| [get\_index\_rel\_link()](get_index_rel_link) wp-includes/deprecated.php | Get site index relational link. |
| [get\_parent\_post\_rel\_link()](get_parent_post_rel_link) wp-includes/deprecated.php | Get parent post relational link. |
| [get\_the\_attachment\_link()](get_the_attachment_link) wp-includes/deprecated.php | Retrieve HTML content of attachment image with link. |
| [get\_attachment\_icon()](get_attachment_icon) wp-includes/deprecated.php | Retrieve HTML content of icon attachment image element. |
| [get\_attachment\_innerHTML()](get_attachment_innerhtml) wp-includes/deprecated.php | Retrieve HTML content of image element. |
| [attribute\_escape()](attribute_escape) wp-includes/deprecated.php | Escaping for HTML attributes. |
| [get\_links()](get_links) wp-includes/deprecated.php | Gets the links associated with category by ID. |
| [wp\_timezone\_choice()](wp_timezone_choice) wp-includes/functions.php | Gives a nicely-formatted list of timezone strings. |
| [wp\_nonce\_field()](wp_nonce_field) wp-includes/functions.php | Retrieves or display nonce hidden field for forms. |
| [wp\_original\_referer\_field()](wp_original_referer_field) wp-includes/functions.php | Retrieves or displays original referer hidden field for forms. |
| [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::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\_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\_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\_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\_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::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::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\_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\_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\_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\_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. |
| [get\_the\_taxonomies()](get_the_taxonomies) wp-includes/taxonomy.php | Retrieves all taxonomies associated with a post. |
| [sanitize\_term\_field()](sanitize_term_field) wp-includes/taxonomy.php | Sanitizes the field value in the term based on the context. |
| [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. |
| [WP\_Admin\_Bar::\_render\_container()](../classes/wp_admin_bar/_render_container) wp-includes/class-wp-admin-bar.php | |
| [WP\_Admin\_Bar::\_render\_group()](../classes/wp_admin_bar/_render_group) wp-includes/class-wp-admin-bar.php | |
| [WP\_Admin\_Bar::\_render\_item()](../classes/wp_admin_bar/_render_item) wp-includes/class-wp-admin-bar.php | |
| [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\_get\_update\_data()](wp_get_update_data) wp-includes/update.php | Collects counts and UI strings for available updates. |
| [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\_shortlink\_menu()](wp_admin_bar_shortlink_menu) wp-includes/admin-bar.php | Provides a shortlink. |
| [get\_the\_category\_rss()](get_the_category_rss) wp-includes/feed.php | Retrieves all of the post categories, formatted for use in feeds. |
| [rss\_enclosure()](rss_enclosure) wp-includes/feed.php | Displays the rss enclosure for the current post. |
| [atom\_enclosure()](atom_enclosure) wp-includes/feed.php | Displays the atom enclosure for the current post. |
| [form\_option()](form_option) wp-includes/option.php | Prints option value after sanitizing for forms. |
| [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. |
| [\_walk\_bookmarks()](_walk_bookmarks) wp-includes/bookmark-template.php | The formatted output of a list of bookmarks. |
| [load\_template()](load_template) wp-includes/template.php | Requires the template file with WordPress environment. |
| [Walker\_Nav\_Menu::start\_el()](../classes/walker_nav_menu/start_el) wp-includes/class-walker-nav-menu.php | Starts the element output. |
| [Walker\_Nav\_Menu::start\_lvl()](../classes/walker_nav_menu/start_lvl) wp-includes/class-walker-nav-menu.php | Starts the list before the elements are added. |
| [Walker\_PageDropdown::start\_el()](../classes/walker_pagedropdown/start_el) wp-includes/class-walker-page-dropdown.php | Starts the element output. |
| [wp\_nav\_menu()](wp_nav_menu) wp-includes/nav-menu-template.php | Displays a navigation menu. |
| [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\_link\_pages()](wp_link_pages) wp-includes/post-template.php | The formatted output of a list of pages. |
| [wp\_dropdown\_pages()](wp_dropdown_pages) wp-includes/post-template.php | Retrieves or displays a list of pages as a dropdown (select list). |
| [wp\_page\_menu()](wp_page_menu) wp-includes/post-template.php | Displays or retrieves a list of pages with an optional home link. |
| [post\_class()](post_class) wp-includes/post-template.php | Displays the classes for the post container element. |
| [body\_class()](body_class) wp-includes/post-template.php | Displays the class names for the body element. |
| [the\_title\_attribute()](the_title_attribute) wp-includes/post-template.php | Sanitizes the current title when retrieving or displaying. |
| [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. |
| [get\_image\_tag()](get_image_tag) wp-includes/media.php | Gets an img tag for an image attachment, scaling it down if requested. |
| [img\_caption\_shortcode()](img_caption_shortcode) wp-includes/media.php | Builds the Caption shortcode output. |
| [sanitize\_post\_field()](sanitize_post_field) wp-includes/post.php | Sanitizes a post field based on context. |
| [WP\_Rewrite::iis7\_url\_rewrite\_rules()](../classes/wp_rewrite/iis7_url_rewrite_rules) wp-includes/class-wp-rewrite.php | Retrieves IIS7 URL Rewrite formatted rewrite rules to write to web.config file. |
| [sanitize\_bookmark\_field()](sanitize_bookmark_field) wp-includes/bookmark.php | Sanitizes a bookmark field. |
| [WP\_Scripts::print\_extra\_script()](../classes/wp_scripts/print_extra_script) wp-includes/class-wp-scripts.php | Prints extra scripts of a registered script. |
| [WP\_Scripts::do\_item()](../classes/wp_scripts/do_item) wp-includes/class-wp-scripts.php | Processes a script dependency. |
| [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. |
| [wp\_rss()](wp_rss) wp-includes/rss.php | Display all RSS items in a HTML ordered list. |
| [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()](../classes/wp_customize_control/render) wp-includes/class-wp-customize-control.php | Renders the control wrapper and calls $this->render\_content() for the internals. |
| [WP\_Customize\_Control::get\_link()](../classes/wp_customize_control/get_link) wp-includes/class-wp-customize-control.php | Get the data link attribute for a setting. |
| [WP\_Customize\_Control::render\_content()](../classes/wp_customize_control/render_content) wp-includes/class-wp-customize-control.php | Render the control’s content. |
| [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. |
| [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. |
| [sanitize\_comment\_cookies()](sanitize_comment_cookies) wp-includes/comment.php | Sanitizes the cookies sent to the user already. |
| [\_WP\_Editors::editor()](../classes/_wp_editors/editor) wp-includes/class-wp-editor.php | Outputs the HTML for a single instance of the editor. |
| [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 wp_update_network_site_counts( int|null $network_id = null ) wp\_update\_network\_site\_counts( int|null $network\_id = null )
=================================================================
Updates the network-wide site count.
`$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_update_network_site_counts( $network_id = null ) {
$network_id = (int) $network_id;
if ( ! $network_id ) {
$network_id = get_current_network_id();
}
$count = get_sites(
array(
'network_id' => $network_id,
'spam' => 0,
'deleted' => 0,
'archived' => 0,
'count' => true,
'update_site_meta_cache' => false,
)
);
update_network_option( $network_id, 'blog_count', $count );
}
```
| 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. |
| [update\_network\_option()](update_network_option) wp-includes/option.php | Updates the value of a network option that was already added. |
| Used By | Description |
| --- | --- |
| [wp\_update\_network\_counts()](wp_update_network_counts) wp-includes/ms-functions.php | Updates the network-wide counts for the current network. |
| [wp\_maybe\_update\_network\_site\_counts()](wp_maybe_update_network_site_counts) wp-includes/ms-functions.php | Updates the count of sites for the current network. |
| 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 get_attachment_innerHTML( int $id, bool $fullsize = false, array $max_dims = false ): string|false get\_attachment\_innerHTML( int $id, bool $fullsize = false, array $max\_dims = false ): string|false
=====================================================================================================
This function has been deprecated. Use [wp\_get\_attachment\_image()](wp_get_attachment_image) instead.
Retrieve HTML content of image element.
* [wp\_get\_attachment\_image()](wp_get_attachment_image)
`$id` int Optional Post ID. `$fullsize` bool Optional Whether to have full size image. Default: `false`
`$max_dims` array Optional Dimensions of image. Default: `false`
string|false
File: `wp-includes/deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/deprecated.php/)
```
function get_attachment_innerHTML($id = 0, $fullsize = false, $max_dims = false) {
_deprecated_function( __FUNCTION__, '2.5.0', 'wp_get_attachment_image()' );
$id = (int) $id;
if ( !$post = get_post($id) )
return false;
if ( $innerHTML = get_attachment_icon($post->ID, $fullsize, $max_dims))
return $innerHTML;
$innerHTML = esc_attr($post->post_title);
return apply_filters('attachment_innerHTML', $innerHTML, $post->ID);
}
```
| Uses | Description |
| --- | --- |
| [get\_attachment\_icon()](get_attachment_icon) wp-includes/deprecated.php | Retrieve HTML content of icon attachment image element. |
| [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. |
| [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\_the\_attachment\_link()](get_the_attachment_link) wp-includes/deprecated.php | Retrieve HTML content of attachment image with link. |
| Version | Description |
| --- | --- |
| [2.5.0](https://developer.wordpress.org/reference/since/2.5.0/) | Use [wp\_get\_attachment\_image()](wp_get_attachment_image) |
| [2.0.0](https://developer.wordpress.org/reference/since/2.0.0/) | Introduced. |
wordpress wp_list_widgets() wp\_list\_widgets()
===================
Display list of the available widgets.
File: `wp-admin/includes/widgets.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/widgets.php/)
```
function wp_list_widgets() {
global $wp_registered_widgets, $wp_registered_widget_controls;
$sort = $wp_registered_widgets;
usort( $sort, '_sort_name_callback' );
$done = array();
foreach ( $sort as $widget ) {
if ( in_array( $widget['callback'], $done, true ) ) { // We already showed this multi-widget.
continue;
}
$sidebar = is_active_widget( $widget['callback'], $widget['id'], false, false );
$done[] = $widget['callback'];
if ( ! isset( $widget['params'][0] ) ) {
$widget['params'][0] = array();
}
$args = array(
'widget_id' => $widget['id'],
'widget_name' => $widget['name'],
'_display' => 'template',
);
if ( isset( $wp_registered_widget_controls[ $widget['id'] ]['id_base'] ) && isset( $widget['params'][0]['number'] ) ) {
$id_base = $wp_registered_widget_controls[ $widget['id'] ]['id_base'];
$args['_temp_id'] = "$id_base-__i__";
$args['_multi_num'] = next_widget_id_number( $id_base );
$args['_add'] = 'multi';
} else {
$args['_add'] = 'single';
if ( $sidebar ) {
$args['_hide'] = '1';
}
}
$control_args = array(
0 => $args,
1 => $widget['params'][0],
);
$sidebar_args = wp_list_widget_controls_dynamic_sidebar( $control_args );
wp_widget_control( ...$sidebar_args );
}
}
```
| Uses | Description |
| --- | --- |
| [next\_widget\_id\_number()](next_widget_id_number) wp-admin/includes/widgets.php | |
| [wp\_list\_widget\_controls\_dynamic\_sidebar()](wp_list_widget_controls_dynamic_sidebar) wp-admin/includes/widgets.php | Retrieves the widget control arguments. |
| [wp\_widget\_control()](wp_widget_control) wp-admin/includes/widgets.php | Meta widget used to display the control form for a widget. |
| [is\_active\_widget()](is_active_widget) wp-includes/widgets.php | Determines whether a given widget is displayed on the front end. |
| Version | Description |
| --- | --- |
| [2.5.0](https://developer.wordpress.org/reference/since/2.5.0/) | Introduced. |
wordpress wp_doc_link_parse( string $content ): array wp\_doc\_link\_parse( string $content ): array
==============================================
`$content` string Required array
File: `wp-admin/includes/misc.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/misc.php/)
```
function wp_doc_link_parse( $content ) {
if ( ! is_string( $content ) || empty( $content ) ) {
return array();
}
if ( ! function_exists( 'token_get_all' ) ) {
return array();
}
$tokens = token_get_all( $content );
$count = count( $tokens );
$functions = array();
$ignore_functions = array();
for ( $t = 0; $t < $count - 2; $t++ ) {
if ( ! is_array( $tokens[ $t ] ) ) {
continue;
}
if ( T_STRING === $tokens[ $t ][0] && ( '(' === $tokens[ $t + 1 ] || '(' === $tokens[ $t + 2 ] ) ) {
// If it's a function or class defined locally, there's not going to be any docs available.
if ( ( isset( $tokens[ $t - 2 ][1] ) && in_array( $tokens[ $t - 2 ][1], array( 'function', 'class' ), true ) )
|| ( isset( $tokens[ $t - 2 ][0] ) && T_OBJECT_OPERATOR === $tokens[ $t - 1 ][0] )
) {
$ignore_functions[] = $tokens[ $t ][1];
}
// Add this to our stack of unique references.
$functions[] = $tokens[ $t ][1];
}
}
$functions = array_unique( $functions );
sort( $functions );
/**
* Filters the list of functions and classes to be ignored from the documentation lookup.
*
* @since 2.8.0
*
* @param string[] $ignore_functions Array of names of functions and classes to be ignored.
*/
$ignore_functions = apply_filters( 'documentation_ignore_functions', $ignore_functions );
$ignore_functions = array_unique( $ignore_functions );
$output = array();
foreach ( $functions as $function ) {
if ( in_array( $function, $ignore_functions, true ) ) {
continue;
}
$output[] = $function;
}
return $output;
}
```
[apply\_filters( 'documentation\_ignore\_functions', string[] $ignore\_functions )](../hooks/documentation_ignore_functions)
Filters the list of functions and classes to be ignored from the documentation lookup.
| 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.8.0](https://developer.wordpress.org/reference/since/2.8.0/) | Introduced. |
wordpress wpmu_current_site(): WP_Network wpmu\_current\_site(): WP\_Network
==================================
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.
This deprecated function managed much of the site and network loading in multisite.
The current bootstrap code is now responsible for parsing the site and network load as well as setting the global $current\_site object.
[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 wpmu_current_site() {
global $current_site;
_deprecated_function( __FUNCTION__, '3.9.0' );
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/) | This function has been deprecated. |
| [3.0.0](https://developer.wordpress.org/reference/since/3.0.0/) | Introduced. |
wordpress wp_queue_comments_for_comment_meta_lazyload( WP_Comment[] $comments ) wp\_queue\_comments\_for\_comment\_meta\_lazyload( WP\_Comment[] $comments )
============================================================================
Queues comments for metadata lazy-loading.
`$comments` [WP\_Comment](../classes/wp_comment)[] Required Array of comment objects. File: `wp-includes/comment.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/comment.php/)
```
function wp_queue_comments_for_comment_meta_lazyload( $comments ) {
// Don't use `wp_list_pluck()` to avoid by-reference manipulation.
$comment_ids = array();
if ( is_array( $comments ) ) {
foreach ( $comments as $comment ) {
if ( $comment instanceof WP_Comment ) {
$comment_ids[] = $comment->comment_ID;
}
}
}
if ( $comment_ids ) {
$lazyloader = wp_metadata_lazyloader();
$lazyloader->queue_objects( 'comment', $comment_ids );
}
}
```
| Uses | Description |
| --- | --- |
| [wp\_metadata\_lazyloader()](wp_metadata_lazyloader) wp-includes/meta.php | Retrieves the queue for lazy-loading metadata. |
| 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. |
| [wp\_list\_comments()](wp_list_comments) wp-includes/comment-template.php | Displays a list of comments. |
| Version | Description |
| --- | --- |
| [4.5.0](https://developer.wordpress.org/reference/since/4.5.0/) | Introduced. |
wordpress form_option( string $option ) form\_option( string $option )
==============================
Prints option value after sanitizing for forms.
`$option` string Required Option name. File: `wp-includes/option.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/option.php/)
```
function form_option( $option ) {
echo esc_attr( get_option( $option ) );
}
```
| Uses | Description |
| --- | --- |
| [esc\_attr()](esc_attr) wp-includes/formatting.php | Escaping for HTML attributes. |
| [get\_option()](get_option) wp-includes/option.php | Retrieves an option value based on an option name. |
| Version | Description |
| --- | --- |
| [1.5.0](https://developer.wordpress.org/reference/since/1.5.0/) | Introduced. |
wordpress wp_schedule_update_checks() wp\_schedule\_update\_checks()
==============================
Schedules core, theme, and plugin update checks.
File: `wp-includes/update.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/update.php/)
```
function wp_schedule_update_checks() {
if ( ! wp_next_scheduled( 'wp_version_check' ) && ! wp_installing() ) {
wp_schedule_event( time(), 'twicedaily', 'wp_version_check' );
}
if ( ! wp_next_scheduled( 'wp_update_plugins' ) && ! wp_installing() ) {
wp_schedule_event( time(), 'twicedaily', 'wp_update_plugins' );
}
if ( ! wp_next_scheduled( 'wp_update_themes' ) && ! wp_installing() ) {
wp_schedule_event( time(), 'twicedaily', 'wp_update_themes' );
}
}
```
| 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. |
| Version | Description |
| --- | --- |
| [3.1.0](https://developer.wordpress.org/reference/since/3.1.0/) | Introduced. |
wordpress term_description( int $term, null $deprecated = null ): string term\_description( int $term, null $deprecated = null ): string
===============================================================
Retrieves term description.
`$term` int Optional Term ID. Defaults to the current term ID. `$deprecated` null Optional Deprecated. Not used. Default: `null`
string Term description, if available.
First available with WordPress [Version 2.8](https://codex.wordpress.org/Version_2.8 "Version 2.8"), this template tag returns the description of a given term. A term ID and taxonomy are as parameters. If no term ID is passed, the description of current queried term (e.g. post category or tag) will be returned.
Output is wrapped in <p> tags.
File: `wp-includes/category-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/category-template.php/)
```
function term_description( $term = 0, $deprecated = null ) {
if ( ! $term && ( is_tax() || is_tag() || is_category() ) ) {
$term = get_queried_object();
if ( $term ) {
$term = $term->term_id;
}
}
$description = get_term_field( 'description', $term );
return is_wp_error( $description ) ? '' : $description;
}
```
| Uses | Description |
| --- | --- |
| [is\_tax()](is_tax) wp-includes/query.php | Determines whether the query is for an existing custom taxonomy archive page. |
| [is\_tag()](is_tag) wp-includes/query.php | Determines whether the query is for an existing tag archive page. |
| [is\_category()](is_category) wp-includes/query.php | Determines whether the query is for an existing category archive page. |
| [get\_queried\_object()](get_queried_object) wp-includes/query.php | Retrieves the currently queried object. |
| [get\_term\_field()](get_term_field) wp-includes/taxonomy.php | Gets sanitized term field. |
| [is\_wp\_error()](is_wp_error) wp-includes/load.php | Checks whether the given variable is a WordPress Error. |
| Used By | 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. |
| [tag\_description()](tag_description) wp-includes/category-template.php | Retrieves tag description. |
| [category\_description()](category_description) wp-includes/category-template.php | Retrieves category description. |
| Version | Description |
| --- | --- |
| [4.9.2](https://developer.wordpress.org/reference/since/4.9.2/) | The `$taxonomy` parameter was deprecated. |
| [2.8.0](https://developer.wordpress.org/reference/since/2.8.0/) | Introduced. |
wordpress signup_another_blog( string $blogname = '', string $blog_title = '', WP_Error|string $errors = '' ) signup\_another\_blog( string $blogname = '', string $blog\_title = '', WP\_Error|string $errors = '' )
=======================================================================================================
Shows a form for returning users to sign up for another site.
`$blogname` string Optional The new site name Default: `''`
`$blog_title` string Optional The new site title. Default: `''`
`$errors` [WP\_Error](../classes/wp_error)|string Optional A [WP\_Error](../classes/wp_error) object containing existing errors. Defaults to empty string. Default: `''`
File: `wp-signup.php`. [View all references](https://developer.wordpress.org/reference/files/wp-signup.php/)
```
function signup_another_blog( $blogname = '', $blog_title = '', $errors = '' ) {
$current_user = wp_get_current_user();
if ( ! is_wp_error( $errors ) ) {
$errors = new WP_Error();
}
$signup_defaults = array(
'blogname' => $blogname,
'blog_title' => $blog_title,
'errors' => $errors,
);
/**
* Filters the default site sign-up variables.
*
* @since 3.0.0
*
* @param array $signup_defaults {
* An array of default site sign-up variables.
*
* @type string $blogname The site blogname.
* @type string $blog_title The site title.
* @type WP_Error $errors A WP_Error object possibly containing 'blogname' or 'blog_title' errors.
* }
*/
$filtered_results = apply_filters( 'signup_another_blog_init', $signup_defaults );
$blogname = $filtered_results['blogname'];
$blog_title = $filtered_results['blog_title'];
$errors = $filtered_results['errors'];
/* translators: %s: Network title. */
echo '<h2>' . sprintf( __( 'Get <em>another</em> %s site in seconds' ), get_network()->site_name ) . '</h2>';
if ( $errors->has_errors() ) {
echo '<p>' . __( 'There was a problem, please correct the form below and try again.' ) . '</p>';
}
?>
<p>
<?php
printf(
/* translators: %s: Current user's display name. */
__( 'Welcome back, %s. By filling out the form below, you can <strong>add another site to your account</strong>. There is no limit to the number of sites you can have, so create to your heart’s content, but write responsibly!' ),
$current_user->display_name
);
?>
</p>
<?php
$blogs = get_blogs_of_user( $current_user->ID );
if ( ! empty( $blogs ) ) {
?>
<p><?php _e( 'Sites you are already a member of:' ); ?></p>
<ul>
<?php
foreach ( $blogs as $blog ) {
$home_url = get_home_url( $blog->userblog_id );
echo '<li><a href="' . esc_url( $home_url ) . '">' . $home_url . '</a></li>';
}
?>
</ul>
<?php } ?>
<p><?php _e( 'If you are not going to use a great site domain, leave it for a new user. Now have at it!' ); ?></p>
<form id="setupform" method="post" action="wp-signup.php">
<input type="hidden" name="stage" value="gimmeanotherblog" />
<?php
/**
* Hidden sign-up form fields output when creating another site or user.
*
* @since MU (3.0.0)
*
* @param string $context A string describing the steps of the sign-up process. The value can be
* 'create-another-site', 'validate-user', or 'validate-site'.
*/
do_action( 'signup_hidden_fields', 'create-another-site' );
?>
<?php show_blog_form( $blogname, $blog_title, $errors ); ?>
<p class="submit"><input type="submit" name="submit" class="submit" value="<?php esc_attr_e( 'Create Site' ); ?>" /></p>
</form>
<?php
}
```
[apply\_filters( 'signup\_another\_blog\_init', array $signup\_defaults )](../hooks/signup_another_blog_init)
Filters the default site sign-up variables.
[do\_action( 'signup\_hidden\_fields', string $context )](../hooks/signup_hidden_fields)
Hidden sign-up form fields output when creating another site or user.
| Uses | Description |
| --- | --- |
| [get\_network()](get_network) wp-includes/ms-network.php | Retrieves network data given a network ID or network object. |
| [show\_blog\_form()](show_blog_form) wp-signup.php | Generates and displays the Sign-up and Create Site forms. |
| [esc\_attr\_e()](esc_attr_e) wp-includes/l10n.php | Displays translated text that has been escaped for safe use in an attribute. |
| [wp\_get\_current\_user()](wp_get_current_user) wp-includes/pluggable.php | Retrieves the current user object. |
| [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. |
| [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. |
| [\_e()](_e) wp-includes/l10n.php | Displays translated 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. |
| [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 |
| --- | --- |
| [validate\_another\_blog\_signup()](validate_another_blog_signup) wp-signup.php | Validates a new site sign-up for an existing user. |
| Version | Description |
| --- | --- |
| [MU (3.0.0)](https://developer.wordpress.org/reference/since/mu.3.0.0/) | Introduced. |
| programming_docs |
wordpress wp_check_for_changed_slugs( int $post_id, WP_Post $post, WP_Post $post_before ) wp\_check\_for\_changed\_slugs( int $post\_id, WP\_Post $post, WP\_Post $post\_before )
=======================================================================================
Checks for changed slugs for published post objects and save the old slug.
The function is used when a post object of any type is updated, by comparing the current and previous post objects.
If the slug was changed and not already part of the old slugs then it will be added to the post meta field (‘\_wp\_old\_slug’) for storing old slugs for that post.
The most logically usage of this function is redirecting changed post objects, so that those that linked to an changed post will be redirected to the new post.
`$post_id` int Required Post ID. `$post` [WP\_Post](../classes/wp_post) Required The post object. `$post_before` [WP\_Post](../classes/wp_post) Required The previous post object. File: `wp-includes/post.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/post.php/)
```
function wp_check_for_changed_slugs( $post_id, $post, $post_before ) {
// Don't bother if it hasn't changed.
if ( $post->post_name == $post_before->post_name ) {
return;
}
// We're only concerned with published, non-hierarchical objects.
if ( ! ( 'publish' === $post->post_status || ( 'attachment' === get_post_type( $post ) && 'inherit' === $post->post_status ) ) || is_post_type_hierarchical( $post->post_type ) ) {
return;
}
$old_slugs = (array) get_post_meta( $post_id, '_wp_old_slug' );
// If we haven't added this old slug before, add it now.
if ( ! empty( $post_before->post_name ) && ! in_array( $post_before->post_name, $old_slugs, true ) ) {
add_post_meta( $post_id, '_wp_old_slug', $post_before->post_name );
}
// If the new slug was used previously, delete it from the list.
if ( in_array( $post->post_name, $old_slugs, true ) ) {
delete_post_meta( $post_id, '_wp_old_slug', $post->post_name );
}
}
```
| Uses | Description |
| --- | --- |
| [delete\_post\_meta()](delete_post_meta) wp-includes/post.php | Deletes a post meta field for the given post ID. |
| [add\_post\_meta()](add_post_meta) wp-includes/post.php | Adds a meta field to the given post. |
| [get\_post\_type()](get_post_type) wp-includes/post.php | Retrieves the post type of the current post or of a given post. |
| [is\_post\_type\_hierarchical()](is_post_type_hierarchical) wp-includes/post.php | Determines whether the post type is hierarchical. |
| [get\_post\_meta()](get_post_meta) wp-includes/post.php | Retrieves a post meta field for the given post ID. |
| Version | Description |
| --- | --- |
| [2.1.0](https://developer.wordpress.org/reference/since/2.1.0/) | Introduced. |
wordpress _clear_modified_cache_on_transition_comment_status( string $new_status, string $old_status ) \_clear\_modified\_cache\_on\_transition\_comment\_status( string $new\_status, string $old\_status )
=====================================================================================================
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.
Clears the lastcommentmodified cached value when a comment status is changed.
Deletes the lastcommentmodified cache key when a comment enters or leaves ‘approved’ status.
`$new_status` string Required The new comment status. `$old_status` string Required The old comment status. File: `wp-includes/comment.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/comment.php/)
```
function _clear_modified_cache_on_transition_comment_status( $new_status, $old_status ) {
if ( 'approved' === $new_status || 'approved' === $old_status ) {
$data = array();
foreach ( array( 'server', 'gmt', 'blog' ) as $timezone ) {
$data[] = "lastcommentmodified:$timezone";
}
wp_cache_delete_multiple( $data, 'timeinfo' );
}
}
```
| Uses | Description |
| --- | --- |
| [wp\_cache\_delete\_multiple()](wp_cache_delete_multiple) wp-includes/cache.php | Deletes multiple values from the cache in one call. |
| Version | Description |
| --- | --- |
| [4.7.0](https://developer.wordpress.org/reference/since/4.7.0/) | Introduced. |
wordpress _n( string $single, string $plural, int $number, string $domain = 'default' ): string \_n( string $single, string $plural, int $number, string $domain = 'default' ): string
======================================================================================
Translates and retrieves the singular or plural form based on the supplied number.
Used when you want to use the appropriate form of a string based on whether a number is singular or plural.
Example:
```
printf( _n( '%s person', '%s people', $count, 'text-domain' ), number_format_i18n( $count ) );
```
`$single` string Required The text to be used if the number is singular. `$plural` string Required The text to be used if the number is plural. `$number` int Required The number to compare against to use either the singular or plural form. `$domain` string Optional Text domain. Unique identifier for retrieving translated strings.
Default `'default'`. Default: `'default'`
string The translated singular or plural form.
File: `wp-includes/l10n.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/l10n.php/)
```
function _n( $single, $plural, $number, $domain = 'default' ) {
$translations = get_translations_for_domain( $domain );
$translation = $translations->translate_plural( $single, $plural, $number );
/**
* Filters the singular or plural form of a string.
*
* @since 2.2.0
*
* @param string $translation Translated text.
* @param string $single The text to be used if the number is singular.
* @param string $plural The text to be used if the number is plural.
* @param int $number The number to compare against to use either the singular or plural form.
* @param string $domain Text domain. Unique identifier for retrieving translated strings.
*/
$translation = apply_filters( 'ngettext', $translation, $single, $plural, $number, $domain );
/**
* Filters the singular or plural form of a string for a domain.
*
* The dynamic portion of the hook name, `$domain`, refers to the text domain.
*
* @since 5.5.0
*
* @param string $translation Translated text.
* @param string $single The text to be used if the number is singular.
* @param string $plural The text to be used if the number is plural.
* @param int $number The number to compare against to use either the singular or plural form.
* @param string $domain Text domain. Unique identifier for retrieving translated strings.
*/
$translation = apply_filters( "ngettext_{$domain}", $translation, $single, $plural, $number, $domain );
return $translation;
}
```
[apply\_filters( 'ngettext', string $translation, string $single, string $plural, int $number, string $domain )](../hooks/ngettext)
Filters the singular or plural form of a string.
[apply\_filters( "ngettext\_{$domain}", string $translation, string $single, string $plural, int $number, string $domain )](../hooks/ngettext_domain)
Filters the singular or plural form of a string for a domain.
| Uses | Description |
| --- | --- |
| [get\_translations\_for\_domain()](get_translations_for_domain) wp-includes/l10n.php | Returns the Translations instance for a text domain. |
| [Translations::translate\_plural()](../classes/translations/translate_plural) wp-includes/pomo/translations.php | |
| [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\_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. |
| [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\_string\_value\_from\_schema()](rest_validate_string_value_from_schema) wp-includes/rest-api.php | Validates a string value based on a schema. |
| [wp\_dashboard\_site\_health()](wp_dashboard_site_health) wp-admin/includes/dashboard.php | Displays the Site Health Status widget. |
| [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. |
| [human\_readable\_duration()](human_readable_duration) wp-includes/functions.php | Converts a duration to human readable format. |
| [WP\_Privacy\_Requests\_Table::process\_bulk\_action()](../classes/wp_privacy_requests_table/process_bulk_action) wp-admin/includes/class-wp-privacy-requests-table.php | Process bulk actions. |
| [WP\_Widget\_Custom\_HTML::enqueue\_admin\_scripts()](../classes/wp_widget_custom_html/enqueue_admin_scripts) wp-includes/widgets/class-wp-widget-custom-html.php | Loads the required scripts and styles for the widget control. |
| [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. |
| [print\_embed\_comments\_button()](print_embed_comments_button) wp-includes/embed.php | Prints the necessary markup for the embed comments button. |
| [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. |
| [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\_MS\_Users\_List\_Table::get\_views()](../classes/wp_ms_users_list_table/get_views) 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\_Plugins\_List\_Table::get\_views()](../classes/wp_plugins_list_table/get_views) wp-admin/includes/class-wp-plugins-list-table.php | |
| [WP\_List\_Table::ajax\_response()](../classes/wp_list_table/ajax_response) wp-admin/includes/class-wp-list-table.php | Handles an incoming ajax request (called from admin-ajax.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\_MS\_Themes\_List\_Table::get\_views()](../classes/wp_ms_themes_list_table/get_views) wp-admin/includes/class-wp-ms-themes-list-table.php | |
| [install\_plugin\_information()](install_plugin_information) wp-admin/includes/plugin-install.php | Displays plugin information in dialog box form. |
| [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\_star\_rating()](wp_star_rating) wp-admin/includes/template.php | Outputs a HTML element with a star rating for a given rating. |
| [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\_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. |
| [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) . |
| [human\_time\_diff()](human_time_diff) wp-includes/formatting.php | Determines the difference between two timestamps. |
| [wp\_notify\_moderator()](wp_notify_moderator) wp-includes/pluggable.php | Notifies the moderator of the site about a new comment that is awaiting approval. |
| [\_\_ngettext()](__ngettext) wp-includes/deprecated.php | Retrieve the plural or single form based on the amount. |
| [\_nc()](_nc) wp-includes/deprecated.php | Legacy version of [\_n()](_n) , which supports contexts. |
| [wp\_get\_update\_data()](wp_get_update_data) wp-includes/update.php | Collects counts and UI strings for available updates. |
| [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\_admin\_bar\_updates\_menu()](wp_admin_bar_updates_menu) wp-includes/admin-bar.php | Provides an update link if theme/plugin/core updates are available. |
| [wpmu\_validate\_blog\_signup()](wpmu_validate_blog_signup) wp-includes/ms-functions.php | Processes new site registrations. |
| [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::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\_scripts()](wp_default_scripts) wp-includes/script-loader.php | Registers all WordPress scripts. |
| Version | Description |
| --- | --- |
| [5.5.0](https://developer.wordpress.org/reference/since/5.5.0/) | Introduced ngettext-{$domain} filter. |
| [2.8.0](https://developer.wordpress.org/reference/since/2.8.0/) | Introduced. |
wordpress plugin_dir_path( string $file ): string plugin\_dir\_path( string $file ): string
=========================================
Get the filesystem directory path (with trailing slash) for the plugin \_\_FILE\_\_ passed in.
`$file` string Required The filename of the plugin (\_\_FILE\_\_). string the filesystem path of the directory that contains the plugin.
It is a wrapper for trailingslashit( dirname( $file ) );.
The “plugin” part of the name is misleading – it can be used for any file, and will not return the directory of a plugin unless you call it within a file in the plugin’s base directory.
File: `wp-includes/plugin.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/plugin.php/)
```
function plugin_dir_path( $file ) {
return trailingslashit( dirname( $file ) );
}
```
| Uses | Description |
| --- | --- |
| [trailingslashit()](trailingslashit) wp-includes/formatting.php | Appends a trailing slash. |
| Version | Description |
| --- | --- |
| [2.8.0](https://developer.wordpress.org/reference/since/2.8.0/) | Introduced. |
wordpress get_background_image(): string get\_background\_image(): string
================================
Retrieves background image for custom background.
string
File: `wp-includes/theme.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/theme.php/)
```
function get_background_image() {
return get_theme_mod( 'background_image', get_theme_support( 'custom-background', 'default-image' ) );
}
```
| Uses | Description |
| --- | --- |
| [get\_theme\_support()](get_theme_support) wp-includes/theme.php | Gets the theme support arguments passed when registering that support. |
| [get\_theme\_mod()](get_theme_mod) wp-includes/theme.php | Retrieves theme modification value for the active theme. |
| Used By | Description |
| --- | --- |
| [get\_media\_states()](get_media_states) wp-admin/includes/template.php | Retrieves an array of media states from an attachment. |
| [Custom\_Background::admin\_page()](../classes/custom_background/admin_page) wp-admin/includes/class-custom-background.php | Displays the custom background page. |
| [background\_image()](background_image) wp-includes/theme.php | Displays background image path. |
| [\_custom\_background\_cb()](_custom_background_cb) wp-includes/theme.php | Default custom background callback. |
| [\_delete\_attachment\_theme\_mod()](_delete_attachment_theme_mod) wp-includes/theme.php | Checks an attachment being deleted to see if it’s a header or background image. |
| [get\_body\_class()](get_body_class) wp-includes/post-template.php | Retrieves an array of the class names for the body element. |
| Version | Description |
| --- | --- |
| [3.0.0](https://developer.wordpress.org/reference/since/3.0.0/) | Introduced. |
wordpress list_translation_updates() list\_translation\_updates()
============================
Display the update translations form.
File: `wp-admin/update-core.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/update-core.php/)
```
function list_translation_updates() {
$updates = wp_get_translation_updates();
if ( ! $updates ) {
if ( 'en_US' !== get_locale() ) {
echo '<h2>' . __( 'Translations' ) . '</h2>';
echo '<p>' . __( 'Your translations are all up to date.' ) . '</p>';
}
return;
}
$form_action = 'update-core.php?action=do-translation-upgrade';
?>
<h2><?php _e( 'Translations' ); ?></h2>
<form method="post" action="<?php echo esc_url( $form_action ); ?>" name="upgrade-translations" class="upgrade">
<p><?php _e( 'New translations are available.' ); ?></p>
<?php wp_nonce_field( 'upgrade-translations' ); ?>
<p><input class="button" type="submit" value="<?php esc_attr_e( 'Update Translations' ); ?>" name="upgrade" /></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. |
| [get\_locale()](get_locale) wp-includes/l10n.php | Retrieves the current locale. |
| [wp\_nonce\_field()](wp_nonce_field) wp-includes/functions.php | Retrieves or display nonce hidden field for forms. |
| [wp\_get\_translation\_updates()](wp_get_translation_updates) wp-includes/update.php | Retrieves a list of all language updates available. |
| [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. |
| [\_e()](_e) wp-includes/l10n.php | Displays translated text. |
| [esc\_url()](esc_url) wp-includes/formatting.php | Checks and cleans a URL. |
| Version | Description |
| --- | --- |
| [3.7.0](https://developer.wordpress.org/reference/since/3.7.0/) | Introduced. |
wordpress wp_privacy_generate_personal_data_export_file( int $request_id ) wp\_privacy\_generate\_personal\_data\_export\_file( int $request\_id )
=======================================================================
Generate the personal data export file.
`$request_id` int Required The export request ID. File: `wp-admin/includes/privacy-tools.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/privacy-tools.php/)
```
function wp_privacy_generate_personal_data_export_file( $request_id ) {
if ( ! class_exists( 'ZipArchive' ) ) {
wp_send_json_error( __( 'Unable to generate personal data export file. ZipArchive not available.' ) );
}
// Get the request.
$request = wp_get_user_request( $request_id );
if ( ! $request || 'export_personal_data' !== $request->action_name ) {
wp_send_json_error( __( 'Invalid request ID when generating personal data export file.' ) );
}
$email_address = $request->email;
if ( ! is_email( $email_address ) ) {
wp_send_json_error( __( 'Invalid email address when generating personal data export file.' ) );
}
// Create the exports folder if needed.
$exports_dir = wp_privacy_exports_dir();
$exports_url = wp_privacy_exports_url();
if ( ! wp_mkdir_p( $exports_dir ) ) {
wp_send_json_error( __( 'Unable to create personal data export folder.' ) );
}
// Protect export folder from browsing.
$index_pathname = $exports_dir . 'index.php';
if ( ! file_exists( $index_pathname ) ) {
$file = fopen( $index_pathname, 'w' );
if ( false === $file ) {
wp_send_json_error( __( 'Unable to protect personal data export folder from browsing.' ) );
}
fwrite( $file, "<?php\n// Silence is golden.\n" );
fclose( $file );
}
$obscura = wp_generate_password( 32, false, false );
$file_basename = 'wp-personal-data-file-' . $obscura;
$html_report_filename = wp_unique_filename( $exports_dir, $file_basename . '.html' );
$html_report_pathname = wp_normalize_path( $exports_dir . $html_report_filename );
$json_report_filename = $file_basename . '.json';
$json_report_pathname = wp_normalize_path( $exports_dir . $json_report_filename );
/*
* Gather general data needed.
*/
// Title.
$title = sprintf(
/* translators: %s: User's email address. */
__( 'Personal Data Export for %s' ),
$email_address
);
// First, build an "About" group on the fly for this report.
$about_group = array(
/* translators: Header for the About section in a personal data export. */
'group_label' => _x( 'About', 'personal data group label' ),
/* translators: Description for the About section in a personal data export. */
'group_description' => _x( 'Overview of export report.', 'personal data group description' ),
'items' => array(
'about-1' => array(
array(
'name' => _x( 'Report generated for', 'email address' ),
'value' => $email_address,
),
array(
'name' => _x( 'For site', 'website name' ),
'value' => get_bloginfo( 'name' ),
),
array(
'name' => _x( 'At URL', 'website URL' ),
'value' => get_bloginfo( 'url' ),
),
array(
'name' => _x( 'On', 'date/time' ),
'value' => current_time( 'mysql' ),
),
),
),
);
// And now, all the Groups.
$groups = get_post_meta( $request_id, '_export_data_grouped', true );
if ( is_array( $groups ) ) {
// Merge in the special "About" group.
$groups = array_merge( array( 'about' => $about_group ), $groups );
$groups_count = count( $groups );
} else {
if ( false !== $groups ) {
_doing_it_wrong(
__FUNCTION__,
/* translators: %s: Post meta key. */
sprintf( __( 'The %s post meta must be an array.' ), '<code>_export_data_grouped</code>' ),
'5.8.0'
);
}
$groups = null;
$groups_count = 0;
}
// Convert the groups to JSON format.
$groups_json = wp_json_encode( $groups );
if ( false === $groups_json ) {
$error_message = sprintf(
/* translators: %s: Error message. */
__( 'Unable to encode the personal data for export. Error: %s' ),
json_last_error_msg()
);
wp_send_json_error( $error_message );
}
/*
* Handle the JSON export.
*/
$file = fopen( $json_report_pathname, 'w' );
if ( false === $file ) {
wp_send_json_error( __( 'Unable to open personal data export file (JSON report) for writing.' ) );
}
fwrite( $file, '{' );
fwrite( $file, '"' . $title . '":' );
fwrite( $file, $groups_json );
fwrite( $file, '}' );
fclose( $file );
/*
* Handle the HTML export.
*/
$file = fopen( $html_report_pathname, 'w' );
if ( false === $file ) {
wp_send_json_error( __( 'Unable to open personal data export (HTML report) for writing.' ) );
}
fwrite( $file, "<!DOCTYPE html>\n" );
fwrite( $file, "<html>\n" );
fwrite( $file, "<head>\n" );
fwrite( $file, "<meta http-equiv='Content-Type' content='text/html; charset=UTF-8' />\n" );
fwrite( $file, "<style type='text/css'>" );
fwrite( $file, 'body { color: black; font-family: Arial, sans-serif; font-size: 11pt; margin: 15px auto; width: 860px; }' );
fwrite( $file, 'table { background: #f0f0f0; border: 1px solid #ddd; margin-bottom: 20px; width: 100%; }' );
fwrite( $file, 'th { padding: 5px; text-align: left; width: 20%; }' );
fwrite( $file, 'td { padding: 5px; }' );
fwrite( $file, 'tr:nth-child(odd) { background-color: #fafafa; }' );
fwrite( $file, '.return-to-top { text-align: right; }' );
fwrite( $file, '</style>' );
fwrite( $file, '<title>' );
fwrite( $file, esc_html( $title ) );
fwrite( $file, '</title>' );
fwrite( $file, "</head>\n" );
fwrite( $file, "<body>\n" );
fwrite( $file, '<h1 id="top">' . esc_html__( 'Personal Data Export' ) . '</h1>' );
// Create TOC.
if ( $groups_count > 1 ) {
fwrite( $file, '<div id="table_of_contents">' );
fwrite( $file, '<h2>' . esc_html__( 'Table of Contents' ) . '</h2>' );
fwrite( $file, '<ul>' );
foreach ( (array) $groups as $group_id => $group_data ) {
$group_label = esc_html( $group_data['group_label'] );
$group_id_attr = sanitize_title_with_dashes( $group_data['group_label'] . '-' . $group_id );
$group_items_count = count( (array) $group_data['items'] );
if ( $group_items_count > 1 ) {
$group_label .= sprintf( ' <span class="count">(%d)</span>', $group_items_count );
}
fwrite( $file, '<li>' );
fwrite( $file, '<a href="#' . esc_attr( $group_id_attr ) . '">' . $group_label . '</a>' );
fwrite( $file, '</li>' );
}
fwrite( $file, '</ul>' );
fwrite( $file, '</div>' );
}
// Now, iterate over every group in $groups and have the formatter render it in HTML.
foreach ( (array) $groups as $group_id => $group_data ) {
fwrite( $file, wp_privacy_generate_personal_data_export_group_html( $group_data, $group_id, $groups_count ) );
}
fwrite( $file, "</body>\n" );
fwrite( $file, "</html>\n" );
fclose( $file );
/*
* Now, generate the ZIP.
*
* If an archive has already been generated, then remove it and reuse the filename,
* to avoid breaking any URLs that may have been previously sent via email.
*/
$error = false;
// This meta value is used from version 5.5.
$archive_filename = get_post_meta( $request_id, '_export_file_name', true );
// This one stored an absolute path and is used for backward compatibility.
$archive_pathname = get_post_meta( $request_id, '_export_file_path', true );
// If a filename meta exists, use it.
if ( ! empty( $archive_filename ) ) {
$archive_pathname = $exports_dir . $archive_filename;
} elseif ( ! empty( $archive_pathname ) ) {
// If a full path meta exists, use it and create the new meta value.
$archive_filename = basename( $archive_pathname );
update_post_meta( $request_id, '_export_file_name', $archive_filename );
// Remove the back-compat meta values.
delete_post_meta( $request_id, '_export_file_url' );
delete_post_meta( $request_id, '_export_file_path' );
} else {
// If there's no filename or full path stored, create a new file.
$archive_filename = $file_basename . '.zip';
$archive_pathname = $exports_dir . $archive_filename;
update_post_meta( $request_id, '_export_file_name', $archive_filename );
}
$archive_url = $exports_url . $archive_filename;
if ( ! empty( $archive_pathname ) && file_exists( $archive_pathname ) ) {
wp_delete_file( $archive_pathname );
}
$zip = new ZipArchive;
if ( true === $zip->open( $archive_pathname, ZipArchive::CREATE ) ) {
if ( ! $zip->addFile( $json_report_pathname, 'export.json' ) ) {
$error = __( 'Unable to archive the personal data export file (JSON format).' );
}
if ( ! $zip->addFile( $html_report_pathname, 'index.html' ) ) {
$error = __( 'Unable to archive the personal data export file (HTML format).' );
}
$zip->close();
if ( ! $error ) {
/**
* Fires right after all personal data has been written to the export file.
*
* @since 4.9.6
* @since 5.4.0 Added the `$json_report_pathname` parameter.
*
* @param string $archive_pathname The full path to the export file on the filesystem.
* @param string $archive_url The URL of the archive file.
* @param string $html_report_pathname The full path to the HTML personal data report on the filesystem.
* @param int $request_id The export request ID.
* @param string $json_report_pathname The full path to the JSON personal data report on the filesystem.
*/
do_action( 'wp_privacy_personal_data_export_file_created', $archive_pathname, $archive_url, $html_report_pathname, $request_id, $json_report_pathname );
}
} else {
$error = __( 'Unable to open personal data export file (archive) for writing.' );
}
// Remove the JSON file.
unlink( $json_report_pathname );
// Remove the HTML file.
unlink( $html_report_pathname );
if ( $error ) {
wp_send_json_error( $error );
}
}
```
[do\_action( 'wp\_privacy\_personal\_data\_export\_file\_created', string $archive\_pathname, string $archive\_url, string $html\_report\_pathname, int $request\_id, string $json\_report\_pathname )](../hooks/wp_privacy_personal_data_export_file_created)
Fires right after all personal data has been written to the export file.
| Uses | Description |
| --- | --- |
| [wp\_get\_user\_request()](wp_get_user_request) wp-includes/user.php | Returns the user request object for the specified request ID. |
| [is\_email()](is_email) wp-includes/formatting.php | Verifies that an email is valid. |
| [update\_post\_meta()](update_post_meta) wp-includes/post.php | Updates a post meta field based on the given post ID. |
| [current\_time()](current_time) wp-includes/functions.php | Retrieves the current time based on specified type. |
| [wp\_normalize\_path()](wp_normalize_path) wp-includes/functions.php | Normalizes a filesystem path. |
| [wp\_unique\_filename()](wp_unique_filename) wp-includes/functions.php | Gets a filename that is sanitized and unique for the given directory. |
| [wp\_mkdir\_p()](wp_mkdir_p) wp-includes/functions.php | Recursive directory creation based on full path. |
| [wp\_generate\_password()](wp_generate_password) wp-includes/pluggable.php | Generates a random password drawn from the defined set of characters. |
| [wp\_privacy\_exports\_dir()](wp_privacy_exports_dir) wp-includes/functions.php | Returns the directory used to store personal data export files. |
| [sanitize\_title\_with\_dashes()](sanitize_title_with_dashes) wp-includes/formatting.php | Sanitizes a title, replacing whitespace and a few other characters with dashes. |
| [esc\_html\_\_()](esc_html__) wp-includes/l10n.php | Retrieves the translation of $text and escapes it for safe use in HTML output. |
| [wp\_delete\_file()](wp_delete_file) wp-includes/functions.php | Deletes a file. |
| [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\_exports\_url()](wp_privacy_exports_url) wp-includes/functions.php | Returns the URL of the directory used to store personal data export files. |
| [delete\_post\_meta()](delete_post_meta) wp-includes/post.php | Deletes a post meta field for the given post ID. |
| [esc\_attr()](esc_attr) wp-includes/formatting.php | Escaping for HTML attributes. |
| [esc\_html()](esc_html) wp-includes/formatting.php | Escaping for HTML blocks. |
| [\_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. |
| [\_doing\_it\_wrong()](_doing_it_wrong) wp-includes/functions.php | Marks something as being incorrectly called. |
| [wp\_send\_json\_error()](wp_send_json_error) wp-includes/functions.php | Sends a JSON response back to an Ajax request, indicating failure. |
| [\_\_()](__) 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. |
| [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. |
| Version | Description |
| --- | --- |
| [4.9.6](https://developer.wordpress.org/reference/since/4.9.6/) | Introduced. |
| programming_docs |
wordpress get_avatar( mixed $id_or_email, int $size = 96, string $default = '', string $alt = '', array $args = null ): string|false get\_avatar( mixed $id\_or\_email, int $size = 96, string $default = '', string $alt = '', array $args = null ): string|false
=============================================================================================================================
Retrieves the avatar `<img>` tag for a user, email address, MD5 hash, comment, or post.
`$id_or_email` mixed Required The Gravatar to retrieve. 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. `$size` int Optional Height and width of the avatar image file in pixels. Default: `96`
`$default` string Optional URL for the default image or a default type. Accepts `'404'` (return a 404 instead of a default image), `'retro'` (8bit), `'monsterid'` (monster), `'wavatar'` (cartoon face), `'indenticon'` (the "quilt"), `'mystery'`, `'mm'`, or `'mysteryman'` (The Oyster Man), `'blank'` (transparent GIF), or `'gravatar_default'` (the Gravatar logo). Default is the value of the `'avatar_default'` option, with a fallback of `'mystery'`. Default: `''`
`$alt` string Optional Alternative text to use in img tag. Default: `''`
`$args` array Optional Extra arguments to retrieve the avatar.
* `height`intDisplay height of the avatar in pixels. Defaults to $size.
* `width`intDisplay width of the avatar in pixels. Defaults to $size.
* `force_default`boolWhether to always show the default image, never the Gravatar. Default false.
* `rating`stringWhat rating to display avatars up to. Accepts `'G'`, `'PG'`, `'R'`, `'X'`, and are judged in that order. Default is the value of the `'avatar_rating'` option.
* `scheme`stringURL scheme to use. See [set\_url\_scheme()](set_url_scheme) for accepted values.
* `class`array|stringArray or string of additional classes to add to the img element.
* `force_display`boolWhether to always show the avatar - ignores the show\_avatars option.
Default false.
* `loading`stringValue for the `loading` attribute.
* `extra_attr`stringHTML attributes to insert in the IMG element. Is not sanitized. Default empty.
Default: `null`
string|false `<img>` tag for the user's avatar. False on failure.
File: `wp-includes/pluggable.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/pluggable.php/)
```
function get_avatar( $id_or_email, $size = 96, $default = '', $alt = '', $args = null ) {
$defaults = array(
// get_avatar_data() args.
'size' => 96,
'height' => null,
'width' => null,
'default' => get_option( 'avatar_default', 'mystery' ),
'force_default' => false,
'rating' => get_option( 'avatar_rating' ),
'scheme' => null,
'alt' => '',
'class' => null,
'force_display' => false,
'loading' => null,
'extra_attr' => '',
'decoding' => 'async',
);
if ( wp_lazy_loading_enabled( 'img', 'get_avatar' ) ) {
$defaults['loading'] = wp_get_loading_attr_default( 'get_avatar' );
}
if ( empty( $args ) ) {
$args = array();
}
$args['size'] = (int) $size;
$args['default'] = $default;
$args['alt'] = $alt;
$args = wp_parse_args( $args, $defaults );
if ( empty( $args['height'] ) ) {
$args['height'] = $args['size'];
}
if ( empty( $args['width'] ) ) {
$args['width'] = $args['size'];
}
if ( is_object( $id_or_email ) && isset( $id_or_email->comment_ID ) ) {
$id_or_email = get_comment( $id_or_email );
}
/**
* Allows the HTML for a user's avatar to be returned early.
*
* Returning a non-null value will effectively short-circuit get_avatar(), passing
* the value through the {@see 'get_avatar'} filter and returning early.
*
* @since 4.2.0
*
* @param string|null $avatar HTML for the user's avatar. Default null.
* @param mixed $id_or_email The avatar to retrieve. Accepts a user_id, Gravatar MD5 hash,
* user email, WP_User object, WP_Post object, or WP_Comment object.
* @param array $args Arguments passed to get_avatar_url(), after processing.
*/
$avatar = apply_filters( 'pre_get_avatar', null, $id_or_email, $args );
if ( ! is_null( $avatar ) ) {
/** This filter is documented in wp-includes/pluggable.php */
return apply_filters( 'get_avatar', $avatar, $id_or_email, $args['size'], $args['default'], $args['alt'], $args );
}
if ( ! $args['force_display'] && ! get_option( 'show_avatars' ) ) {
return false;
}
$url2x = get_avatar_url( $id_or_email, array_merge( $args, array( 'size' => $args['size'] * 2 ) ) );
$args = get_avatar_data( $id_or_email, $args );
$url = $args['url'];
if ( ! $url || is_wp_error( $url ) ) {
return false;
}
$class = array( 'avatar', 'avatar-' . (int) $args['size'], 'photo' );
if ( ! $args['found_avatar'] || $args['force_default'] ) {
$class[] = 'avatar-default';
}
if ( $args['class'] ) {
if ( is_array( $args['class'] ) ) {
$class = array_merge( $class, $args['class'] );
} else {
$class[] = $args['class'];
}
}
// Add `loading` attribute.
$extra_attr = $args['extra_attr'];
$loading = $args['loading'];
if ( in_array( $loading, array( 'lazy', 'eager' ), true ) && ! preg_match( '/\bloading\s*=/', $extra_attr ) ) {
if ( ! empty( $extra_attr ) ) {
$extra_attr .= ' ';
}
$extra_attr .= "loading='{$loading}'";
}
if ( in_array( $args['decoding'], array( 'async', 'sync', 'auto' ) ) && ! preg_match( '/\bdecoding\s*=/', $extra_attr ) ) {
if ( ! empty( $extra_attr ) ) {
$extra_attr .= ' ';
}
$extra_attr .= "decoding='{$args['decoding']}'";
}
$avatar = sprintf(
"<img alt='%s' src='%s' srcset='%s' class='%s' height='%d' width='%d' %s/>",
esc_attr( $args['alt'] ),
esc_url( $url ),
esc_url( $url2x ) . ' 2x',
esc_attr( implode( ' ', $class ) ),
(int) $args['height'],
(int) $args['width'],
$extra_attr
);
/**
* Filters the HTML for a user's avatar.
*
* @since 2.5.0
* @since 4.2.0 The `$args` parameter was added.
*
* @param string $avatar HTML for the user's avatar.
* @param mixed $id_or_email The avatar to retrieve. Accepts a user_id, Gravatar MD5 hash,
* user email, WP_User object, WP_Post object, or WP_Comment object.
* @param int $size Square avatar width and height in pixels to retrieve.
* @param string $default URL for the default image or a default type. Accepts '404', 'retro', 'monsterid',
* 'wavatar', 'indenticon', 'mystery', 'mm', 'mysteryman', 'blank', or 'gravatar_default'.
* @param string $alt Alternative text to use in the avatar image tag.
* @param array $args Arguments passed to get_avatar_data(), after processing.
*/
return apply_filters( 'get_avatar', $avatar, $id_or_email, $args['size'], $args['default'], $args['alt'], $args );
}
```
[apply\_filters( 'get\_avatar', string $avatar, mixed $id\_or\_email, int $size, string $default, string $alt, array $args )](../hooks/get_avatar)
Filters the HTML for a user’s avatar.
[apply\_filters( 'pre\_get\_avatar', string|null $avatar, mixed $id\_or\_email, array $args )](../hooks/pre_get_avatar)
Allows the HTML for a user’s avatar to be returned early.
| Uses | Description |
| --- | --- |
| [wp\_get\_loading\_attr\_default()](wp_get_loading_attr_default) wp-includes/media.php | Gets the default value to use for a `loading` attribute on an element. |
| [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. |
| [get\_avatar\_url()](get_avatar_url) wp-includes/link-template.php | Retrieves the avatar URL. |
| [get\_avatar\_data()](get_avatar_data) wp-includes/link-template.php | Retrieves default data about the avatar. |
| [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. |
| [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\_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. |
| Used By | Description |
| --- | --- |
| [WP\_Comments\_List\_Table::floated\_admin\_avatar()](../classes/wp_comments_list_table/floated_admin_avatar) wp-admin/includes/class-wp-comments-list-table.php | Adds avatars to comment author names. |
| [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\_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\_dashboard\_recent\_comments\_row()](_wp_dashboard_recent_comments_row) wp-admin/includes/dashboard.php | Outputs a row for the Recent Comments widget. |
| [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. |
| [\_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. |
| [floated\_admin\_avatar()](floated_admin_avatar) wp-admin/includes/comment.php | Adds avatars to relevant places in admin. |
| [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\_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). |
| [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. |
| Version | Description |
| --- | --- |
| [4.2.0](https://developer.wordpress.org/reference/since/4.2.0/) | Optional `$args` parameter added. |
| [2.5.0](https://developer.wordpress.org/reference/since/2.5.0/) | Introduced. |
wordpress rest_parse_date( string $date, bool $force_utc = false ): int rest\_parse\_date( string $date, bool $force\_utc = false ): int
================================================================
Parses an RFC3339 time into a Unix timestamp.
`$date` string Required RFC3339 timestamp. `$force_utc` bool Optional Whether to force UTC timezone instead of using the timestamp's timezone. Default: `false`
int Unix timestamp.
File: `wp-includes/rest-api.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/rest-api.php/)
```
function rest_parse_date( $date, $force_utc = false ) {
if ( $force_utc ) {
$date = preg_replace( '/[+-]\d+:?\d+$/', '+00:00', $date );
}
$regex = '#^\d{4}-\d{2}-\d{2}[Tt ]\d{2}:\d{2}:\d{2}(?:\.\d+)?(?:Z|[+-]\d{2}(?::\d{2})?)?$#';
if ( ! preg_match( $regex, $date, $matches ) ) {
return false;
}
return strtotime( $date );
}
```
| 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. |
| [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. |
| Version | Description |
| --- | --- |
| [4.4.0](https://developer.wordpress.org/reference/since/4.4.0/) | Introduced. |
wordpress dismissed_updates() dismissed\_updates()
====================
Display dismissed updates.
File: `wp-admin/update-core.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/update-core.php/)
```
function dismissed_updates() {
$dismissed = get_core_updates(
array(
'dismissed' => true,
'available' => false,
)
);
if ( $dismissed ) {
$show_text = esc_js( __( 'Show hidden updates' ) );
$hide_text = esc_js( __( 'Hide hidden updates' ) );
?>
<script type="text/javascript">
jQuery( function( $ ) {
$( '#show-dismissed' ).on( 'click', function() {
var isExpanded = ( 'true' === $( this ).attr( 'aria-expanded' ) );
if ( isExpanded ) {
$( this ).text( '<?php echo $show_text; ?>' ).attr( 'aria-expanded', 'false' );
} else {
$( this ).text( '<?php echo $hide_text; ?>' ).attr( 'aria-expanded', 'true' );
}
$( '#dismissed-updates' ).toggle( 'fast' );
});
});
</script>
<?php
echo '<p class="hide-if-no-js"><button type="button" class="button" id="show-dismissed" aria-expanded="false">' . __( 'Show hidden updates' ) . '</button></p>';
echo '<ul id="dismissed-updates" class="core-updates dismissed">';
foreach ( (array) $dismissed as $update ) {
echo '<li>';
list_core_update( $update );
echo '</li>';
}
echo '</ul>';
}
}
```
| 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. |
| [esc\_js()](esc_js) wp-includes/formatting.php | Escapes single quotes, `"`, , `&`, and fixes line endings. |
| [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. |
| Used By | Description |
| --- | --- |
| [core\_upgrade\_preamble()](core_upgrade_preamble) wp-admin/update-core.php | Display upgrade WordPress for downloading latest or upgrading automatically form. |
| Version | Description |
| --- | --- |
| [2.7.0](https://developer.wordpress.org/reference/since/2.7.0/) | Introduced. |
wordpress wp_ajax_parse_media_shortcode() wp\_ajax\_parse\_media\_shortcode()
===================================
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_parse_media_shortcode() {
global $post, $wp_scripts;
if ( empty( $_POST['shortcode'] ) ) {
wp_send_json_error();
}
$shortcode = wp_unslash( $_POST['shortcode'] );
if ( ! empty( $_POST['post_ID'] ) ) {
$post = get_post( (int) $_POST['post_ID'] );
}
// The embed shortcode requires a post.
if ( ! $post || ! current_user_can( 'edit_post', $post->ID ) ) {
if ( 'embed' === $shortcode ) {
wp_send_json_error();
}
} else {
setup_postdata( $post );
}
$parsed = do_shortcode( $shortcode );
if ( empty( $parsed ) ) {
wp_send_json_error(
array(
'type' => 'no-items',
'message' => __( 'No items found.' ),
)
);
}
$head = '';
$styles = wpview_media_sandbox_styles();
foreach ( $styles as $style ) {
$head .= '<link type="text/css" rel="stylesheet" href="' . $style . '">';
}
if ( ! empty( $wp_scripts ) ) {
$wp_scripts->done = array();
}
ob_start();
echo $parsed;
if ( 'playlist' === $_REQUEST['type'] ) {
wp_underscore_playlist_templates();
wp_print_scripts( 'wp-playlist' );
} else {
wp_print_scripts( array( 'mediaelement-vimeo', 'wp-mediaelement' ) );
}
wp_send_json_success(
array(
'head' => $head,
'body' => ob_get_clean(),
)
);
}
```
| Uses | Description |
| --- | --- |
| [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. |
| [setup\_postdata()](setup_postdata) wp-includes/query.php | Set up global post data. |
| [wp\_print\_scripts()](wp_print_scripts) wp-includes/functions.wp-scripts.php | Prints scripts in document head that are in the $handles queue. |
| [do\_shortcode()](do_shortcode) wp-includes/shortcodes.php | Searches content for shortcodes and filter shortcodes through their hooks. |
| [wp\_underscore\_playlist\_templates()](wp_underscore_playlist_templates) wp-includes/media.php | Outputs the templates used by playlists. |
| [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\_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. |
| [get\_post()](get_post) wp-includes/post.php | Retrieves post data given a post ID or post object. |
| Version | Description |
| --- | --- |
| [4.0.0](https://developer.wordpress.org/reference/since/4.0.0/) | Introduced. |
wordpress image_resize( string $file, int $max_w, int $max_h, bool $crop = false, string $suffix = null, string $dest_path = null, int $jpeg_quality = 90 ): mixed image\_resize( string $file, int $max\_w, int $max\_h, bool $crop = false, string $suffix = null, string $dest\_path = null, int $jpeg\_quality = 90 ): mixed
=============================================================================================================================================================
This function has been deprecated. Use [wp\_get\_image\_editor()](wp_get_image_editor) instead.
Scale down an image to fit a particular size and save a new copy of the image.
The PNG transparency will be preserved using the function, as well as the image type. If the file going in is PNG, then the resized image is going to be PNG. The only supported image types are PNG, GIF, and JPEG.
Some functionality requires API to exist, so some PHP version may lose out support. This is not the fault of WordPress (where functionality is downgraded, not actual defects), but of your PHP version.
* [wp\_get\_image\_editor()](wp_get_image_editor)
`$file` string Required Image file path. `$max_w` int Required Maximum width to resize to. `$max_h` int Required Maximum height to resize to. `$crop` bool Optional Whether to crop image or resize. Default: `false`
`$suffix` string Optional File suffix. Default: `null`
`$dest_path` string Optional New image file path. Default: `null`
`$jpeg_quality` int Optional Image quality percentage. Default: `90`
mixed [WP\_Error](../classes/wp_error) on failure. String with new destination path.
File: `wp-includes/deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/deprecated.php/)
```
function image_resize( $file, $max_w, $max_h, $crop = false, $suffix = null, $dest_path = null, $jpeg_quality = 90 ) {
_deprecated_function( __FUNCTION__, '3.5.0', 'wp_get_image_editor()' );
$editor = wp_get_image_editor( $file );
if ( is_wp_error( $editor ) )
return $editor;
$editor->set_quality( $jpeg_quality );
$resized = $editor->resize( $max_w, $max_h, $crop );
if ( is_wp_error( $resized ) )
return $resized;
$dest_file = $editor->generate_filename( $suffix, $dest_path );
$saved = $editor->save( $dest_file );
if ( is_wp_error( $saved ) )
return $saved;
return $dest_file;
}
```
| 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. |
| [\_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\_create\_thumbnail()](wp_create_thumbnail) wp-admin/includes/deprecated.php | This was once used to create a thumbnail from an Image given a maximum side size. |
| Version | Description |
| --- | --- |
| [3.5.0](https://developer.wordpress.org/reference/since/3.5.0/) | Use [wp\_get\_image\_editor()](wp_get_image_editor) |
| [2.5.0](https://developer.wordpress.org/reference/since/2.5.0/) | Introduced. |
| programming_docs |
wordpress get_the_author_yim(): string get\_the\_author\_yim(): string
===============================
This function has been deprecated. Use [get\_the\_author\_meta()](get_the_author_meta) instead.
Retrieve the Yahoo! IM name of the author of the current post.
* [get\_the\_author\_meta()](get_the_author_meta)
string The author's Yahoo! IM name.
File: `wp-includes/deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/deprecated.php/)
```
function get_the_author_yim() {
_deprecated_function( __FUNCTION__, '2.8.0', 'get_the_author_meta(\'yim\')' );
return get_the_author_meta('yim');
}
```
| 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_robots() wp\_robots()
============
Displays the robots meta tag as necessary.
Gathers robots directives to include for the current context, using the [‘wp\_robots’](../hooks/wp_robots) filter. The directives are then sanitized, and the robots meta tag is output if there is at least one relevant directive.
File: `wp-includes/robots-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/robots-template.php/)
```
function wp_robots() {
/**
* Filters the directives to be included in the 'robots' meta tag.
*
* The meta tag will only be included as necessary.
*
* @since 5.7.0
*
* @param array $robots Associative array of directives. Every key must be the name of the directive, and the
* corresponding value must either be a string to provide as value for the directive or a
* boolean `true` if it is a boolean directive, i.e. without a value.
*/
$robots = apply_filters( 'wp_robots', array() );
$robots_strings = array();
foreach ( $robots as $directive => $value ) {
if ( is_string( $value ) ) {
// If a string value, include it as value for the directive.
$robots_strings[] = "{$directive}:{$value}";
} elseif ( $value ) {
// Otherwise, include the directive if it is truthy.
$robots_strings[] = $directive;
}
}
if ( empty( $robots_strings ) ) {
return;
}
echo "<meta name='robots' content='" . esc_attr( implode( ', ', $robots_strings ) ) . "' />\n";
}
```
[apply\_filters( 'wp\_robots', array $robots )](../hooks/wp_robots)
Filters the directives to be included in the ‘robots’ meta tag.
| 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. |
| Used By | Description |
| --- | --- |
| [\_default\_wp\_die\_handler()](_default_wp_die_handler) wp-includes/functions.php | Kills WordPress execution and displays HTML page with an error message. |
| Version | Description |
| --- | --- |
| [5.7.1](https://developer.wordpress.org/reference/since/5.7.1/) | No longer prevents specific directives to occur together. |
| [5.7.0](https://developer.wordpress.org/reference/since/5.7.0/) | Introduced. |
wordpress serialize_blocks( array[] $blocks ): string serialize\_blocks( array[] $blocks ): string
============================================
Returns a joined string of the aggregate serialization of the given parsed blocks.
`$blocks` array[] Required An array of representative arrays of parsed block objects. See [serialize\_block()](serialize_block) . string String of rendered HTML.
File: `wp-includes/blocks.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/blocks.php/)
```
function serialize_blocks( $blocks ) {
return implode( '', array_map( 'serialize_block', $blocks ) );
}
```
| Version | Description |
| --- | --- |
| [5.3.1](https://developer.wordpress.org/reference/since/5.3.1/) | Introduced. |
wordpress wp_ajax_set_post_thumbnail() wp\_ajax\_set\_post\_thumbnail()
================================
Ajax handler for setting the featured image.
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_set_post_thumbnail() {
$json = ! empty( $_REQUEST['json'] ); // New-style request.
$post_ID = (int) $_POST['post_id'];
if ( ! current_user_can( 'edit_post', $post_ID ) ) {
wp_die( -1 );
}
$thumbnail_id = (int) $_POST['thumbnail_id'];
if ( $json ) {
check_ajax_referer( "update-post_$post_ID" );
} else {
check_ajax_referer( "set_post_thumbnail-$post_ID" );
}
if ( '-1' == $thumbnail_id ) {
if ( delete_post_thumbnail( $post_ID ) ) {
$return = _wp_post_thumbnail_html( null, $post_ID );
$json ? wp_send_json_success( $return ) : wp_die( $return );
} else {
wp_die( 0 );
}
}
if ( set_post_thumbnail( $post_ID, $thumbnail_id ) ) {
$return = _wp_post_thumbnail_html( $thumbnail_id, $post_ID );
$json ? wp_send_json_success( $return ) : wp_die( $return );
}
wp_die( 0 );
}
```
| Uses | Description |
| --- | --- |
| [\_wp\_post\_thumbnail\_html()](_wp_post_thumbnail_html) wp-admin/includes/post.php | Returns HTML for the post thumbnail meta box. |
| [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. |
| [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\_send\_json\_success()](wp_send_json_success) wp-includes/functions.php | Sends a JSON response back to an Ajax request, indicating success. |
| [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 _canonical_charset( string $charset ): string \_canonical\_charset( string $charset ): 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/23688](httpscore-trac-wordpress-orgticket23688) instead.
Retrieves a canonical form of the provided charset appropriate for passing to PHP functions such as htmlspecialchars() and charset HTML attributes.
* <https://core.trac.wordpress.org/ticket/23688>
`$charset` string Required A charset name. string The canonical form of the charset.
File: `wp-includes/functions.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/functions.php/)
```
function _canonical_charset( $charset ) {
if ( 'utf-8' === strtolower( $charset ) || 'utf8' === strtolower( $charset ) ) {
return 'UTF-8';
}
if ( 'iso-8859-1' === strtolower( $charset ) || 'iso8859-1' === strtolower( $charset ) ) {
return 'ISO-8859-1';
}
return $charset;
}
```
| Used By | Description |
| --- | --- |
| [\_wp\_die\_process\_input()](_wp_die_process_input) wp-includes/functions.php | Processes arguments passed to [wp\_die()](wp_die) consistently for its handlers. |
| Version | Description |
| --- | --- |
| [3.6.0](https://developer.wordpress.org/reference/since/3.6.0/) | Introduced. |
wordpress paused_plugins_notice() paused\_plugins\_notice()
=========================
Renders an admin notice in case some plugins have been paused due to errors.
File: `wp-admin/includes/plugin.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/plugin.php/)
```
function paused_plugins_notice() {
if ( 'plugins.php' === $GLOBALS['pagenow'] ) {
return;
}
if ( ! current_user_can( 'resume_plugins' ) ) {
return;
}
if ( ! isset( $GLOBALS['_paused_plugins'] ) || empty( $GLOBALS['_paused_plugins'] ) ) {
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 plugins failed to load properly.' ),
__( 'You can find more details and make changes on the Plugins screen.' ),
esc_url( admin_url( 'plugins.php?plugin_status=paused' ) ),
__( 'Go to the Plugins 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 add_settings_error( string $setting, string $code, string $message, string $type = 'error' ) add\_settings\_error( string $setting, string $code, string $message, string $type = 'error' )
==============================================================================================
Registers a settings error to be displayed to the user.
Part of the Settings API. Use this to show messages to users about settings validation problems, missing settings or anything else.
Settings errors should be added inside the $sanitize\_callback function defined in [register\_setting()](register_setting) for a given setting to give feedback about the submission.
By default messages will show immediately after the submission that generated the error.
Additional calls to [settings\_errors()](settings_errors) can be used to show errors even when the settings page is first accessed.
`$setting` string Required Slug title of the setting to which this error applies. `$code` string Required Slug-name to identify the error. Used as part of `'id'` attribute in HTML output. `$message` string Required The formatted message text to display to the user (will be shown inside styled `<div>` and `<p>` tags). `$type` string Optional Message type, controls HTML class. Possible values include `'error'`, `'success'`, `'warning'`, `'info'`. Default `'error'`. Default: `'error'`
File: `wp-admin/includes/template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/template.php/)
```
function add_settings_error( $setting, $code, $message, $type = 'error' ) {
global $wp_settings_errors;
$wp_settings_errors[] = array(
'setting' => $setting,
'code' => $code,
'message' => $message,
'type' => $type,
);
}
```
| Used By | Description |
| --- | --- |
| [WP\_Privacy\_Requests\_Table::process\_bulk\_action()](../classes/wp_privacy_requests_table/process_bulk_action) wp-admin/includes/class-wp-privacy-requests-table.php | Process bulk actions. |
| [\_wp\_personal\_data\_handle\_actions()](_wp_personal_data_handle_actions) wp-admin/includes/privacy-tools.php | Handle list table actions. |
| [sanitize\_option()](sanitize_option) wp-includes/formatting.php | Sanitizes various option values based on the nature of the option. |
| Version | Description |
| --- | --- |
| [5.3.0](https://developer.wordpress.org/reference/since/5.3.0/) | Added `warning` and `info` as possible values for `$type`. |
| [3.0.0](https://developer.wordpress.org/reference/since/3.0.0/) | Introduced. |
wordpress is_wp_error( mixed $thing ): bool is\_wp\_error( mixed $thing ): bool
===================================
Checks whether the given variable is a WordPress Error.
Returns whether `$thing` is an instance of the `WP_Error` class.
`$thing` mixed Required The variable to check. bool Whether the variable is an instance of [WP\_Error](../classes/wp_error).
File: `wp-includes/load.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/load.php/)
```
function is_wp_error( $thing ) {
$is_wp_error = ( $thing instanceof WP_Error );
if ( $is_wp_error ) {
/**
* Fires when `is_wp_error()` is called and its parameter is an instance of `WP_Error`.
*
* @since 5.6.0
*
* @param WP_Error $thing The error object passed to `is_wp_error()`.
*/
do_action( 'is_wp_error_instance', $thing );
}
return $is_wp_error;
}
```
[do\_action( 'is\_wp\_error\_instance', WP\_Error $thing )](../hooks/is_wp_error_instance)
Fires when `is_wp_error()` is called and its parameter is an instance of `WP_Error`.
| Uses | Description |
| --- | --- |
| [do\_action()](do_action) wp-includes/plugin.php | Calls the callback functions that have been added to an action hook. |
| Used By | Description |
| --- | --- |
| [WP\_Site\_Health::check\_for\_page\_caching()](../classes/wp_site_health/check_for_page_caching) wp-admin/includes/class-wp-site-health.php | Checks if site has page cache enabled or not. |
| [WP\_Site\_Health::get\_page\_cache\_detail()](../classes/wp_site_health/get_page_cache_detail) wp-admin/includes/class-wp-site-health.php | Gets page cache details. |
| [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\_get\_post\_revisions\_url()](wp_get_post_revisions_url) wp-includes/revision.php | Returns the url for viewing and potentially restoring revisions of a given post. |
| [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\_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\_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\_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\_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\_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::get\_item()](../classes/wp_rest_global_styles_controller/get_item) wp-includes/rest-api/endpoints/class-wp-rest-global-styles-controller.php | Returns the given global styles config. |
| [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::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\_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\_Menus\_Controller::get\_term()](../classes/wp_rest_menus_controller/get_term) wp-includes/rest-api/endpoints/class-wp-rest-menus-controller.php | Gets the term, if the ID is valid. |
| [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\_Edit\_Site\_Export\_Controller::export()](../classes/wp_rest_edit_site_export_controller/export) wp-includes/rest-api/endpoints/class-wp-rest-edit-site-export-controller.php | Output a ZIP file with an export of the current templates and template parts from the site editor, and close the connection. |
| [\_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. |
| [WP\_REST\_Widgets\_Controller::get\_items()](../classes/wp_rest_widgets_controller/get_items) wp-includes/rest-api/endpoints/class-wp-rest-widgets-controller.php | Retrieves a collection of widgets. |
| [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\_Sidebars\_Controller::get\_items()](../classes/wp_rest_sidebars_controller/get_items) wp-includes/rest-api/endpoints/class-wp-rest-sidebars-controller.php | Retrieves the list of sidebars (active or inactive). |
| [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\_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\_Widget\_Types\_Controller::get\_item()](../classes/wp_rest_widget_types_controller/get_item) wp-includes/rest-api/endpoints/class-wp-rest-widget-types-controller.php | Retrieves a single widget type from the collection. |
| [WP\_REST\_Widget\_Types\_Controller::get\_item\_permissions\_check()](../classes/wp_rest_widget_types_controller/get_item_permissions_check) wp-includes/rest-api/endpoints/class-wp-rest-widget-types-controller.php | Checks if a given request has access to read a widget type. |
| [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. |
| [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. |
| [get\_block\_templates()](get_block_templates) wp-includes/block-template-utils.php | Retrieves a list of unified template objects based on a query. |
| [get\_block\_template()](get_block_template) wp-includes/block-template-utils.php | Retrieves a single unified template object using its id. |
| [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\_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\_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. |
| [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::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\_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::prepare\_item\_for\_response()](../classes/wp_rest_application_passwords_controller/prepare_item_for_response) wp-includes/rest-api/endpoints/class-wp-rest-application-passwords-controller.php | Prepares the application password for the REST response. |
| [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\_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\_items()](../classes/wp_rest_application_passwords_controller/get_items) wp-includes/rest-api/endpoints/class-wp-rest-application-passwords-controller.php | Retrieves a collection of 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::get\_item()](../classes/wp_rest_application_passwords_controller/get_item) wp-includes/rest-api/endpoints/class-wp-rest-application-passwords-controller.php | Retrieves one application password from the collection. |
| [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::create\_item()](../classes/wp_rest_application_passwords_controller/create_item) wp-includes/rest-api/endpoints/class-wp-rest-application-passwords-controller.php | Creates an application password. |
| [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::update\_item()](../classes/wp_rest_application_passwords_controller/update_item) wp-includes/rest-api/endpoints/class-wp-rest-application-passwords-controller.php | Updates an application password. |
| [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\_items()](../classes/wp_rest_application_passwords_controller/delete_items) wp-includes/rest-api/endpoints/class-wp-rest-application-passwords-controller.php | Deletes 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\_REST\_Application\_Passwords\_Controller::delete\_item()](../classes/wp_rest_application_passwords_controller/delete_item) wp-includes/rest-api/endpoints/class-wp-rest-application-passwords-controller.php | Deletes an application password for a user. |
| [WP\_REST\_Posts\_Controller::check\_status()](../classes/wp_rest_posts_controller/check_status) wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php | Checks whether the status is valid for the given post. |
| [WP\_Image\_Editor\_Imagick::pdf\_load\_source()](../classes/wp_image_editor_imagick/pdf_load_source) wp-includes/class-wp-image-editor-imagick.php | Load the image produced by Ghostscript. |
| [wp\_authenticate\_application\_password()](wp_authenticate_application_password) wp-includes/user.php | Authenticates the user using an application password. |
| [rest\_find\_any\_matching\_schema()](rest_find_any_matching_schema) wp-includes/rest-api.php | Finds the matching schema among the “anyOf” schemas. |
| [rest\_find\_one\_matching\_schema()](rest_find_one_matching_schema) wp-includes/rest-api.php | Finds the matching schema among the “oneOf” schemas. |
| [rest\_application\_password\_check\_errors()](rest_application_password_check_errors) wp-includes/rest-api.php | Checks for errors when using application password-based authentication. |
| [WP\_REST\_Block\_Directory\_Controller::get\_items()](../classes/wp_rest_block_directory_controller/get_items) wp-includes/rest-api/endpoints/class-wp-rest-block-directory-controller.php | Search and retrieve blocks metadata |
| [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::get\_items()](../classes/wp_rest_plugins_controller/get_items) wp-includes/rest-api/endpoints/class-wp-rest-plugins-controller.php | Retrieves a collection of plugins. |
| [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::get\_item()](../classes/wp_rest_plugins_controller/get_item) wp-includes/rest-api/endpoints/class-wp-rest-plugins-controller.php | Retrieves one plugin from the site. |
| [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::update\_item()](../classes/wp_rest_plugins_controller/update_item) wp-includes/rest-api/endpoints/class-wp-rest-plugins-controller.php | Updates one 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\_Block\_Types\_Controller::get\_item()](../classes/wp_rest_block_types_controller/get_item) wp-includes/rest-api/endpoints/class-wp-rest-block-types-controller.php | Retrieves a specific block type. |
| [WP\_REST\_Block\_Types\_Controller::get\_item\_permissions\_check()](../classes/wp_rest_block_types_controller/get_item_permissions_check) wp-includes/rest-api/endpoints/class-wp-rest-block-types-controller.php | Checks if a given request has access to read a block type. |
| [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. |
| [rest\_filter\_response\_by\_context()](rest_filter_response_by_context) wp-includes/rest-api.php | Filters the response to remove any fields not available in the given context. |
| [WP\_Sitemaps\_Taxonomies::get\_url\_list()](../classes/wp_sitemaps_taxonomies/get_url_list) wp-includes/sitemaps/providers/class-wp-sitemaps-taxonomies.php | Gets a URL list for a taxonomy sitemap. |
| [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. |
| [Plugin\_Upgrader::active\_before()](../classes/plugin_upgrader/active_before) wp-admin/includes/class-plugin-upgrader.php | Turns on maintenance mode before attempting to background update an active plugin. |
| [Plugin\_Upgrader::active\_after()](../classes/plugin_upgrader/active_after) wp-admin/includes/class-plugin-upgrader.php | Turns off maintenance mode after upgrading an active plugin. |
| [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\_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\_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\_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. |
| [WP\_Image\_Editor::maybe\_exif\_rotate()](../classes/wp_image_editor/maybe_exif_rotate) wp-includes/class-wp-image-editor.php | Check if a JPEG image has EXIF Orientation tag and rotate it if needed. |
| [WP\_Site\_Health::has\_late\_cron()](../classes/wp_site_health/has_late_cron) wp-admin/includes/class-wp-site-health.php | Checks if any scheduled tasks are late. |
| [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\_make\_subsizes()](_wp_make_subsizes) wp-admin/includes/image.php | Low-level function to create image sub-sizes. |
| [WP\_Recovery\_Mode::handle\_cookie()](../classes/wp_recovery_mode/handle_cookie) wp-includes/class-wp-recovery-mode.php | Handles checking for the recovery mode cookie and validating it. |
| [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\_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\_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\_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\_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::has\_missed\_cron()](../classes/wp_site_health/has_missed_cron) wp-admin/includes/class-wp-site-health.php | Checks if any scheduled tasks have been missed. |
| [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\_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\_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\_die\_process\_input()](_wp_die_process_input) wp-includes/functions.php | Processes arguments passed to [wp\_die()](wp_die) consistently for its handlers. |
| [wp\_check\_php\_version()](wp_check_php_version) wp-admin/includes/misc.php | Checks if the user needs to update PHP. |
| [\_wp\_get\_allowed\_postdata()](_wp_get_allowed_postdata) wp-admin/includes/post.php | Returns only allowed post data fields. |
| [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\_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::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\_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\_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()](../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::get\_items()](../classes/wp_rest_autosaves_controller/get_items) wp-includes/rest-api/endpoints/class-wp-rest-autosaves-controller.php | Gets a collection of autosaves using wp\_get\_post\_autosave. |
| [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\_Block\_Type::prepare\_attributes\_for\_render()](../classes/wp_block_type/prepare_attributes_for_render) wp-includes/class-wp-block-type.php | Validates attributes against the current block schema, populating defaulted and missing values. |
| [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\_create\_user\_request()](wp_create_user_request) wp-includes/user.php | Creates and logs a user request to perform a specific action. |
| [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\_Requests\_Table::process\_bulk\_action()](../classes/wp_privacy_requests_table/process_bulk_action) wp-admin/includes/class-wp-privacy-requests-table.php | Process bulk actions. |
| [\_wp\_privacy\_resend\_request()](_wp_privacy_resend_request) wp-admin/includes/privacy-tools.php | Resend an existing request and return the result. |
| [\_wp\_personal\_data\_handle\_actions()](_wp_personal_data_handle_actions) wp-admin/includes/privacy-tools.php | Handle list table actions. |
| [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\_unschedule\_hook()](wp_unschedule_hook) wp-includes/cron.php | Unschedules all events attached to the hook. |
| [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\_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. |
| [get\_term\_parents\_list()](get_term_parents_list) wp-includes/category-template.php | Retrieves term parents with separator. |
| [WP\_Widget\_Media::update()](../classes/wp_widget_media/update) wp-includes/widgets/class-wp-widget-media.php | Sanitizes the widget form values as they are saved. |
| [wp\_ajax\_get\_community\_events()](wp_ajax_get_community_events) wp-admin/includes/ajax-actions.php | Handles Ajax requests for community events |
| [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. |
| [rest\_parse\_request\_arg()](rest_parse_request_arg) wp-includes/rest-api.php | Parse a request argument based on details registered to the route. |
| [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::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::changeset\_data()](../classes/wp_customize_manager/changeset_data) wp-includes/class-wp-customize-manager.php | Gets changeset data. |
| [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\_Meta\_Fields::prepare\_value()](../classes/wp_rest_meta_fields/prepare_value) wp-includes/rest-api/fields/class-wp-rest-meta-fields.php | Prepares a meta value for output. |
| [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::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\_item()](../classes/wp_rest_users_controller/get_item) wp-includes/rest-api/endpoints/class-wp-rest-users-controller.php | Retrieves a single 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\_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::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()](../classes/wp_rest_revisions_controller/get_item) wp-includes/rest-api/endpoints/class-wp-rest-revisions-controller.php | Retrieves one revision from the collection. |
| [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::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::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::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\_Settings\_Controller::prepare\_value()](../classes/wp_rest_settings_controller/prepare_value) wp-includes/rest-api/endpoints/class-wp-rest-settings-controller.php | Prepares a value for output based off a schema array. |
| [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::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::get\_item()](../classes/wp_rest_terms_controller/get_item) wp-includes/rest-api/endpoints/class-wp-rest-terms-controller.php | Gets a single term from a taxonomy. |
| [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::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::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::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\_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::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::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\_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::get\_item()](../classes/wp_rest_posts_controller/get_item) wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php | Retrieves a single post. |
| [WP\_REST\_Controller::update\_additional\_fields\_for\_object()](../classes/wp_rest_controller/update_additional_fields_for_object) wp-includes/rest-api/endpoints/class-wp-rest-controller.php | Updates the values of additional fields added to a data object. |
| [WP\_REST\_Comments\_Controller::check\_comment\_author\_email()](../classes/wp_rest_comments_controller/check_comment_author_email) wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php | Checks a comment author email for validity. |
| [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::get\_item()](../classes/wp_rest_comments_controller/get_item) wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php | Retrieves 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\_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\_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\_Manager::validate\_setting\_values()](../classes/wp_customize_manager/validate_setting_values) wp-includes/class-wp-customize-manager.php | Validates setting values. |
| [WP\_Customize\_Manager::prepare\_setting\_validity\_for\_js()](../classes/wp_customize_manager/prepare_setting_validity_for_js) wp-includes/class-wp-customize-manager.php | Prepares setting validity for exporting to the client (JS). |
| [WP\_Customize\_Setting::validate()](../classes/wp_customize_setting/validate) wp-includes/class-wp-customize-setting.php | Validates an input. |
| [WP\_Ajax\_Upgrader\_Skin::error()](../classes/wp_ajax_upgrader_skin/error) wp-admin/includes/class-wp-ajax-upgrader-skin.php | Stores an error message about the upgrade. |
| [WP\_Ajax\_Upgrader\_Skin::feedback()](../classes/wp_ajax_upgrader_skin/feedback) wp-admin/includes/class-wp-ajax-upgrader-skin.php | Stores a message about the upgrade. |
| [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. |
| [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\_authenticate\_email\_password()](wp_authenticate_email_password) wp-includes/user.php | Authenticates a user using the email and password. |
| [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\_Network::get\_instance()](../classes/wp_network/get_instance) wp-includes/class-wp-network.php | Retrieves a network from the database by its ID. |
| [rest\_ensure\_response()](rest_ensure_response) wp-includes/rest-api.php | Ensures a REST response is a response object (for consistency). |
| [wp\_remote\_retrieve\_cookies()](wp_remote_retrieve_cookies) wp-includes/http.php | Retrieve only the cookies from the raw response. |
| [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\_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::serve\_request()](../classes/wp_rest_server/serve_request) wp-includes/rest-api/class-wp-rest-server.php | Handles serving a REST API request. |
| [get\_password\_reset\_key()](get_password_reset_key) wp-includes/user.php | Creates, stores, then returns a password reset key for user. |
| [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\_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::value\_as\_wp\_post\_nav\_menu\_item()](../classes/wp_customize_nav_menu_item_setting/value_as_wp_post_nav_menu_item) wp-includes/customize/class-wp-customize-nav-menu-item-setting.php | Get the value emulated into a [WP\_Post](../classes/wp_post) and set up as a nav\_menu\_item. |
| [WP\_Customize\_Nav\_Menu\_Item\_Setting::update()](../classes/wp_customize_nav_menu_item_setting/update) wp-includes/customize/class-wp-customize-nav-menu-item-setting.php | Creates/updates the nav\_menu\_item post for this setting. |
| [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\_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\_Links\_List\_Table::column\_categories()](../classes/wp_links_list_table/column_categories) wp-admin/includes/class-wp-links-list-table.php | Handles the link categories column output. |
| [wp\_ajax\_crop\_image()](wp_ajax_crop_image) wp-admin/includes/ajax-actions.php | Ajax handler for cropping an image. |
| [wpdb::get\_col\_length()](../classes/wpdb/get_col_length) wp-includes/class-wpdb.php | Retrieves the maximum string length allowed in a given column. |
| [wpdb::process\_field\_lengths()](../classes/wpdb/process_field_lengths) wp-includes/class-wpdb.php | For string fields, records the maximum string length that field can safely save. |
| [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. |
| [wpdb::get\_col\_charset()](../classes/wpdb/get_col_charset) wp-includes/class-wpdb.php | Retrieves the character set for the given column. |
| [wpdb::strip\_invalid\_text\_from\_query()](../classes/wpdb/strip_invalid_text_from_query) wp-includes/class-wpdb.php | Strips any invalid characters from the query. |
| [wpdb::process\_field\_charsets()](../classes/wpdb/process_field_charsets) wp-includes/class-wpdb.php | Adds field charsets to field/value/format arrays generated by [wpdb::process\_field\_formats()](../classes/wpdb/process_field_formats). |
| [get\_avatar\_data()](get_avatar_data) wp-includes/link-template.php | Retrieves default data about the avatar. |
| [wp\_ajax\_update\_plugin()](wp_ajax_update_plugin) wp-admin/includes/ajax-actions.php | Ajax handler for updating a plugin. |
| [WP\_Tax\_Query::get\_sql\_for\_clause()](../classes/wp_tax_query/get_sql_for_clause) wp-includes/class-wp-tax-query.php | Generates SQL JOIN and WHERE clauses for a “first-order” query clause. |
| [wp\_can\_install\_language\_pack()](wp_can_install_language_pack) wp-admin/includes/translation-install.php | Check if WordPress has access to the filesystem without asking for credentials. |
| [translations\_api()](translations_api) wp-admin/includes/translation-install.php | Retrieve translations from WordPress Translation API. |
| [wp\_get\_available\_translations()](wp_get_available_translations) wp-admin/includes/translation-install.php | Get available translations from the WordPress.org API. |
| [wp\_download\_language\_pack()](wp_download_language_pack) wp-admin/includes/translation-install.php | Download a language pack. |
| [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. |
| [validate\_another\_blog\_signup()](validate_another_blog_signup) wp-signup.php | Validates a new site sign-up for an existing user. |
| [signup\_user()](signup_user) wp-signup.php | Shows a form for a visitor to sign up for a new user account. |
| [signup\_blog()](signup_blog) wp-signup.php | Shows a form for a user or visitor to sign up for a new site. |
| [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. |
| [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::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. |
| [Core\_Upgrader::upgrade()](../classes/core_upgrader/upgrade) wp-admin/includes/class-core-upgrader.php | Upgrade WordPress core. |
| [Theme\_Upgrader::current\_before()](../classes/theme_upgrader/current_before) wp-admin/includes/class-theme-upgrader.php | Turn on maintenance mode before attempting to upgrade the active theme. |
| [Theme\_Upgrader::current\_after()](../classes/theme_upgrader/current_after) wp-admin/includes/class-theme-upgrader.php | Turn off maintenance mode after upgrading the active theme. |
| [Theme\_Upgrader::delete\_old\_theme()](../classes/theme_upgrader/delete_old_theme) wp-admin/includes/class-theme-upgrader.php | Delete the old theme during an upgrade. |
| [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::bulk\_upgrade()](../classes/plugin_upgrader/bulk_upgrade) wp-admin/includes/class-plugin-upgrader.php | Bulk upgrade several plugins at once. |
| [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. |
| [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. |
| [Plugin\_Upgrader::delete\_old\_plugin()](../classes/plugin_upgrader/delete_old_plugin) wp-admin/includes/class-plugin-upgrader.php | Deletes the old plugin during an upgrade. |
| [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. |
| [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. |
| [WP\_Upgrader::fs\_connect()](../classes/wp_upgrader/fs_connect) wp-admin/includes/class-wp-upgrader.php | Connect to the filesystem. |
| [WP\_Upgrader::download\_package()](../classes/wp_upgrader/download_package) wp-admin/includes/class-wp-upgrader.php | Download a package. |
| [WP\_Upgrader::unpack\_package()](../classes/wp_upgrader/unpack_package) wp-admin/includes/class-wp-upgrader.php | Unpack a compressed package file. |
| [WP\_Upgrader::install\_package()](../classes/wp_upgrader/install_package) wp-admin/includes/class-wp-upgrader.php | Install a package. |
| [WP\_Upgrader::run()](../classes/wp_upgrader/run) wp-admin/includes/class-wp-upgrader.php | Run an upgrade/installation. |
| [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. |
| [delete\_theme()](delete_theme) wp-admin/includes/theme.php | Removes a theme. |
| [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. |
| [install\_themes\_feature\_list()](install_themes_feature_list) wp-admin/includes/theme-install.php | Retrieves the list of WordPress theme features (aka theme tags). |
| [install\_theme\_information()](install_theme_information) wp-admin/includes/theme-install.php | Displays theme information in dialog box form. |
| [Automatic\_Upgrader\_Skin::feedback()](../classes/automatic_upgrader_skin/feedback) wp-admin/includes/class-automatic-upgrader-skin.php | Stores a message about the upgrade. |
| [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\_Upgrader\_Skin::after()](../classes/bulk_upgrader_skin/after) wp-admin/includes/class-bulk-upgrader-skin.php | |
| [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::error()](../classes/bulk_upgrader_skin/error) wp-admin/includes/class-bulk-upgrader-skin.php | |
| [WP\_Upgrader\_Skin::decrement\_update\_count()](../classes/wp_upgrader_skin/decrement_update_count) wp-admin/includes/class-wp-upgrader-skin.php | Output JavaScript that calls function to decrement the update counts. |
| [WP\_Upgrader\_Skin::error()](../classes/wp_upgrader_skin/error) wp-admin/includes/class-wp-upgrader-skin.php | |
| [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']`. |
| [wp\_save\_image()](wp_save_image) wp-admin/includes/image-edit.php | Saves image to post, along with enqueued changes in `$_REQUEST['history']`. |
| [wp\_stream\_image()](wp_stream_image) wp-admin/includes/image-edit.php | Streams image in [WP\_Image\_Editor](../classes/wp_image_editor) to browser. |
| [heartbeat\_autosave()](heartbeat_autosave) wp-admin/includes/misc.php | Performs autosave with heartbeat. |
| [show\_message()](show_message) wp-admin/includes/misc.php | Displays the given administration message. |
| [populate\_network()](populate_network) wp-admin/includes/schema.php | Populate network settings. |
| [wp\_insert\_category()](wp_insert_category) wp-admin/includes/taxonomy.php | Updates an existing Category or creates a new Category. |
| [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\_Theme\_Install\_List\_Table::prepare\_items()](../classes/wp_theme_install_list_table/prepare_items) wp-admin/includes/class-wp-theme-install-list-table.php | |
| [get\_core\_checksums()](get_core_checksums) wp-admin/includes/update.php | Gets and caches the checksums for the given version of WordPress. |
| [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\_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\_dashboard()](install_dashboard) wp-admin/includes/plugin-install.php | Displays the Featured tab of Add Plugins screen. |
| [plugins\_api()](plugins_api) wp-admin/includes/plugin-install.php | Retrieves plugin installer pages from the WordPress.org Plugins API. |
| [install\_plugin\_information()](install_plugin_information) wp-admin/includes/plugin-install.php | Displays plugin information in dialog box form. |
| [wp\_crop\_image()](wp_crop_image) wp-admin/includes/image.php | Crops an image to a given size. |
| [wp\_dashboard\_rss\_control()](wp_dashboard_rss_control) wp-admin/includes/dashboard.php | The RSS dashboard widget control. |
| [wp\_dashboard\_plugins\_output()](wp_dashboard_plugins_output) wp-admin/includes/deprecated.php | Display plugins text for the WordPress news widget. |
| [wp\_check\_mysql\_version()](wp_check_mysql_version) wp-admin/includes/upgrade.php | Checks the version of the installed MySQL binary. |
| [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. |
| [validate\_active\_plugins()](validate_active_plugins) wp-admin/includes/plugin.php | Validates active plugins. |
| [activate\_plugin()](activate_plugin) wp-admin/includes/plugin.php | Attempts activation of plugin in a “sandbox” and redirects on success. |
| [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 | |
| [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\_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. |
| [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\_create\_post\_autosave()](wp_create_post_autosave) wp-admin/includes/post.php | Creates autosave data for the specified post from `$_POST` data. |
| [post\_preview()](post_preview) wp-admin/includes/post.php | Saves a draft or manually autosaves for the purpose of showing a post preview. |
| [wp\_write\_post()](wp_write_post) wp-admin/includes/post.php | Creates a new post from the “Write Post” form using `$_POST` information. |
| [write\_post()](write_post) wp-admin/includes/post.php | Calls [wp\_write\_post()](wp_write_post) and handles the errors. |
| [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\_query\_themes()](wp_ajax_query_themes) wp-admin/includes/ajax-actions.php | Ajax handler for getting themes from [themes\_api()](themes_api) . |
| [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\_tax()](wp_ajax_inline_save_tax) wp-admin/includes/ajax-actions.php | Ajax handler for quick edit saving for a term. |
| [\_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\_delete\_tag()](wp_ajax_delete_tag) wp-admin/includes/ajax-actions.php | Ajax handler for deleting a tag. |
| [wp\_ajax\_delete\_link()](wp_ajax_delete_link) wp-admin/includes/ajax-actions.php | Ajax handler for deleting a link. |
| [wp\_ajax\_dim\_comment()](wp_ajax_dim_comment) wp-admin/includes/ajax-actions.php | Ajax handler to dim a comment. |
| [wp\_ajax\_add\_link\_category()](wp_ajax_add_link_category) wp-admin/includes/ajax-actions.php | Ajax handler for adding a link category. |
| [wp\_ajax\_add\_tag()](wp_ajax_add_tag) wp-admin/includes/ajax-actions.php | Ajax handler to add a tag. |
| [wp\_ajax\_get\_tagcloud()](wp_ajax_get_tagcloud) wp-admin/includes/ajax-actions.php | Ajax handler for getting a tagcloud. |
| [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. |
| [update\_core()](update_core) wp-admin/includes/update-core.php | Upgrades the core of WordPress. |
| [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\_update\_menu\_items()](wp_nav_menu_update_menu_items) wp-admin/includes/nav-menu.php | Saves nav menu items |
| [\_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\_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. |
| [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. |
| [download\_url()](download_url) wp-admin/includes/file.php | Downloads a URL to a local temporary file using the WordPress HTTP API. |
| [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. |
| [copy\_dir()](copy_dir) wp-admin/includes/file.php | Copies a directory from one location to another via the WordPress Filesystem Abstraction. |
| [WP\_Filesystem()](wp_filesystem) wp-admin/includes/file.php | Initializes and connects the WordPress Filesystem Abstraction classes. |
| [register\_importer()](register_importer) wp-admin/includes/import.php | Registers importer for WordPress. |
| [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. |
| [wp\_credits()](wp_credits) wp-admin/includes/credits.php | Retrieve the contributor credits. |
| [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. |
| [do\_core\_upgrade()](do_core_upgrade) wp-admin/update-core.php | Upgrade WordPress core display. |
| [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\_Customize\_Manager::post\_value()](../classes/wp_customize_manager/post_value) wp-includes/class-wp-customize-manager.php | Returns the sanitized value for a given setting from the current customized state. |
| [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. |
| [spawn\_cron()](spawn_cron) wp-includes/cron.php | Sends a request to run cron through HTTP request that doesn’t halt page loading. |
| [wp\_schedule\_single\_event()](wp_schedule_single_event) wp-includes/cron.php | Schedules an event to run only once. |
| [get\_the\_term\_list()](get_the_term_list) wp-includes/category-template.php | Retrieves a post’s terms as a list with specified format. |
| [the\_terms()](the_terms) wp-includes/category-template.php | Displays the terms for a post in a list. |
| [has\_term()](has_term) wp-includes/category-template.php | Checks if the current post has any of given terms. |
| [wp\_tag\_cloud()](wp_tag_cloud) wp-includes/category-template.php | Displays a tag cloud. |
| [the\_tags()](the_tags) wp-includes/category-template.php | Displays the tags for a post. |
| [term\_description()](term_description) wp-includes/category-template.php | Retrieves term description. |
| [get\_the\_terms()](get_the_terms) wp-includes/category-template.php | Retrieves the terms of the taxonomy that are attached to the post. |
| [get\_category\_link()](get_category_link) wp-includes/category-template.php | Retrieves category link URL. |
| [get\_the\_category()](get_the_category) wp-includes/category-template.php | Retrieves post categories. |
| [get\_the\_category\_by\_ID()](get_the_category_by_id) wp-includes/category-template.php | Retrieves category name based on category ID. |
| [switch\_theme()](switch_theme) wp-includes/theme.php | Switches the theme. |
| [sanitize\_option()](sanitize_option) wp-includes/formatting.php | Sanitizes various option values based on the nature of the option. |
| [get\_avatar()](get_avatar) wp-includes/pluggable.php | Retrieves the avatar `<img>` tag for a user, email address, MD5 hash, comment, or post. |
| [wp\_new\_user\_notification()](wp_new_user_notification) wp-includes/pluggable.php | Emails login credentials to a newly-registered user. |
| [wp\_authenticate()](wp_authenticate) wp-includes/pluggable.php | Authenticates a user, confirming the login credentials are valid. |
| [image\_resize()](image_resize) wp-includes/deprecated.php | Scale down an image to fit a particular size and save a new copy of the image. |
| [user\_pass\_ok()](user_pass_ok) wp-includes/deprecated.php | Check that the user login name and password is correct. |
| [get\_category\_children()](get_category_children) wp-includes/deprecated.php | Retrieve category children list separated before and after the term IDs. |
| [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). |
| [WP\_Query::get\_queried\_object()](../classes/wp_query/get_queried_object) wp-includes/class-wp-query.php | Retrieves the currently queried object. |
| [get\_cat\_name()](get_cat_name) wp-includes/category.php | Retrieves the name of a category from its ID. |
| [\_make\_cat\_compat()](_make_cat_compat) wp-includes/category.php | Updates category structure to old pre-2.3 from new taxonomy structure. |
| [WP\_Image\_Editor\_Imagick::resize()](../classes/wp_image_editor_imagick/resize) wp-includes/class-wp-image-editor-imagick.php | Resizes current image. |
| [WP\_Image\_Editor\_Imagick::multi\_resize()](../classes/wp_image_editor_imagick/multi_resize) wp-includes/class-wp-image-editor-imagick.php | Create multiple smaller images from a single source. |
| [WP\_Image\_Editor\_Imagick::crop()](../classes/wp_image_editor_imagick/crop) wp-includes/class-wp-image-editor-imagick.php | Crops Image. |
| [WP\_Image\_Editor\_Imagick::rotate()](../classes/wp_image_editor_imagick/rotate) wp-includes/class-wp-image-editor-imagick.php | Rotates current image counter-clockwise by $angle. |
| [WP\_Image\_Editor\_Imagick::save()](../classes/wp_image_editor_imagick/save) wp-includes/class-wp-image-editor-imagick.php | Saves current image to file. |
| [WP\_Image\_Editor\_Imagick::\_save()](../classes/wp_image_editor_imagick/_save) wp-includes/class-wp-image-editor-imagick.php | |
| [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. |
| [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\_Image\_Editor\_Imagick::set\_quality()](../classes/wp_image_editor_imagick/set_quality) wp-includes/class-wp-image-editor-imagick.php | Sets Image Compression quality on a 1-100% scale. |
| [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\_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. |
| [url\_is\_accessable\_via\_ssl()](url_is_accessable_via_ssl) wp-includes/deprecated.php | Determines if the URL can be accessed over SSL. |
| [wp\_send\_json\_error()](wp_send_json_error) wp-includes/functions.php | Sends a JSON response back to an Ajax request, indicating failure. |
| [wp\_remote\_fopen()](wp_remote_fopen) wp-includes/functions.php | HTTP request for URI to retrieve content. |
| [wp\_get\_http()](wp_get_http) wp-includes/deprecated.php | Perform a HTTP HEAD or GET request. |
| [wp\_get\_http\_headers()](wp_get_http_headers) wp-includes/functions.php | Retrieves HTTP Headers from URL. |
| [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\_rss\_output()](wp_widget_rss_output) wp-includes/widgets.php | Display the RSS entries in a list. |
| [wp\_widget\_rss\_process()](wp_widget_rss_process) wp-includes/widgets.php | Process RSS feed widget data and optionally retrieve feed items. |
| [WP\_SimplePie\_File::\_\_construct()](../classes/wp_simplepie_file/__construct) wp-includes/class-wp-simplepie-file.php | Constructor. |
| [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. |
| [wp\_get\_term\_taxonomy\_parent\_id()](wp_get_term_taxonomy_parent_id) wp-includes/taxonomy.php | Returns the term’s parent’s term ID. |
| [get\_object\_term\_cache()](get_object_term_cache) wp-includes/taxonomy.php | Retrieves the cached term objects for the given object ID. |
| [\_get\_term\_children()](_get_term_children) wp-includes/taxonomy.php | Gets the subset of $terms that are descendants of $term\_id. |
| [get\_term\_link()](get_term_link) wp-includes/taxonomy.php | Generates a permalink for a taxonomy term archive. |
| [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\_ancestors()](get_ancestors) wp-includes/taxonomy.php | Gets an array of ancestor IDs for a given object. |
| [wp\_unique\_term\_slug()](wp_unique_term_slug) wp-includes/taxonomy.php | Makes term slug unique, if it isn’t already. |
| [wp\_update\_term()](wp_update_term) wp-includes/taxonomy.php | Updates term based on arguments provided. |
| [wp\_set\_object\_terms()](wp_set_object_terms) wp-includes/taxonomy.php | Creates term and taxonomy relationships. |
| [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. |
| [wp\_delete\_term()](wp_delete_term) wp-includes/taxonomy.php | Removes a term from the database. |
| [get\_term\_by()](get_term_by) wp-includes/taxonomy.php | Gets all term data from database by term field and data. |
| [get\_term\_field()](get_term_field) wp-includes/taxonomy.php | Gets sanitized term field. |
| [get\_term\_to\_edit()](get_term_to_edit) wp-includes/taxonomy.php | Sanitizes term for editing. |
| [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. |
| [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\_term\_feed\_link()](get_term_feed_link) wp-includes/link-template.php | Retrieves the feed link for a term. |
| [get\_edit\_term\_link()](get_edit_term_link) wp-includes/link-template.php | Retrieves the URL for editing a given term. |
| [get\_permalink()](get_permalink) wp-includes/link-template.php | Retrieves the full permalink for the current post or post ID. |
| [WP\_Ajax\_Response::add()](../classes/wp_ajax_response/add) wp-includes/class-wp-ajax-response.php | Appends data to an XML response based on given arguments. |
| [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\_remote\_retrieve\_headers()](wp_remote_retrieve_headers) wp-includes/http.php | Retrieve only the headers from the raw response. |
| [wp\_remote\_retrieve\_header()](wp_remote_retrieve_header) wp-includes/http.php | Retrieve a single header by name 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\_response\_message()](wp_remote_retrieve_response_message) wp-includes/http.php | Retrieve only the response message from the raw response. |
| [wp\_remote\_retrieve\_body()](wp_remote_retrieve_body) wp-includes/http.php | Retrieve only the body from the raw response. |
| [WP\_oEmbed::fetch()](../classes/wp_oembed/fetch) wp-includes/class-wp-oembed.php | Connects to a oEmbed provider and returns the result. |
| [wp\_admin\_bar\_edit\_menu()](wp_admin_bar_edit_menu) wp-includes/admin-bar.php | Provides an edit link for posts and terms. |
| [wp\_update\_user()](wp_update_user) wp-includes/user.php | Updates a user in the database. |
| [register\_new\_user()](register_new_user) wp-includes/user.php | Handles registering a new user. |
| [wp\_signon()](wp_signon) wp-includes/user.php | Authenticates and logs a user in with ‘remember’ capability. |
| [wp\_authenticate\_username\_password()](wp_authenticate_username_password) wp-includes/user.php | Authenticates a user, confirming the username and password are valid. |
| [wp\_login()](wp_login) wp-includes/pluggable-deprecated.php | Checks a users login information and logs them in if it checks out. This function is deprecated. |
| [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::multi\_resize()](../classes/wp_image_editor_gd/multi_resize) wp-includes/class-wp-image-editor-gd.php | Create multiple smaller images from a single source. |
| [WP\_Image\_Editor\_GD::save()](../classes/wp_image_editor_gd/save) wp-includes/class-wp-image-editor-gd.php | Saves current in-memory image to file. |
| [wp\_nav\_menu()](wp_nav_menu) wp-includes/nav-menu-template.php | Displays a navigation menu. |
| [get\_body\_class()](get_body_class) wp-includes/post-template.php | Retrieves an array of the class names for the body element. |
| [get\_post\_class()](get_post_class) wp-includes/post-template.php | Retrieves an array of the class names for the post container element. |
| [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. |
| [image\_make\_intermediate\_size()](image_make_intermediate_size) wp-includes/media.php | Resizes an image to make a thumbnail or intermediate size. |
| [wp\_get\_post\_parent\_id()](wp_get_post_parent_id) wp-includes/post.php | Returns the ID of the post’s parent. |
| [wp\_update\_post()](wp_update_post) wp-includes/post.php | Updates a post with new post data. |
| [redirect\_canonical()](redirect_canonical) wp-includes/canonical.php | Redirects incoming links to the proper URL based on the site url. |
| [\_wp\_put\_post\_revision()](_wp_put_post_revision) wp-includes/revision.php | Inserts post data into the posts table as a post revision. |
| [wp\_restore\_post\_revision()](wp_restore_post_revision) wp-includes/revision.php | Restores a post to the specified revision. |
| [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}/. |
| [add\_new\_user\_to\_blog()](add_new_user_to_blog) wp-includes/ms-functions.php | Adds a newly created user to the appropriate blog |
| [insert\_blog()](insert_blog) wp-includes/ms-deprecated.php | Store basic site info in the blogs table. |
| [wpmu\_activate\_signup()](wpmu_activate_signup) wp-includes/ms-functions.php | Activates a signup. |
| [wpmu\_create\_user()](wpmu_create_user) wp-includes/ms-functions.php | Creates a user. |
| [wpmu\_create\_blog()](wpmu_create_blog) wp-includes/ms-functions.php | Creates a site. |
| [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. |
| [WP\_HTTP\_IXR\_Client::query()](../classes/wp_http_ixr_client/query) wp-includes/class-wp-http-ixr-client.php | |
| [get\_bookmark\_field()](get_bookmark_field) wp-includes/bookmark.php | Retrieves single bookmark data item or field. |
| [get\_post\_format\_link()](get_post_format_link) wp-includes/post-formats.php | Returns a link to a post format index. |
| [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. |
| [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. |
| [is\_nav\_menu\_item()](is_nav_menu_item) wp-includes/nav-menu.php | Determines whether the given ID is a nav menu item. |
| [wp\_delete\_nav\_menu()](wp_delete_nav_menu) wp-includes/nav-menu.php | Deletes a navigation menu. |
| [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. |
| [wp\_get\_nav\_menu\_object()](wp_get_nav_menu_object) wp-includes/nav-menu.php | Returns a navigation menu object. |
| [is\_nav\_menu()](is_nav_menu) wp-includes/nav-menu.php | Determines whether the given ID is a navigation menu. |
| [\_fetch\_remote\_file()](_fetch_remote_file) wp-includes/rss.php | Retrieve URL headers and content using WP HTTP Request API. |
| [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\_editPost()](../classes/wp_xmlrpc_server/mw_editpost) wp-includes/class-wp-xmlrpc-server.php | Edit a post. |
| [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::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\_newCategory()](../classes/wp_xmlrpc_server/wp_newcategory) wp-includes/class-wp-xmlrpc-server.php | Create new category. |
| [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\_editProfile()](../classes/wp_xmlrpc_server/wp_editprofile) wp-includes/class-wp-xmlrpc-server.php | Edit user’s profile. |
| [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::login()](../classes/wp_xmlrpc_server/login) wp-includes/class-wp-xmlrpc-server.php | Log user in. |
| [WP\_Customize\_Widgets::wp\_ajax\_update\_widget()](../classes/wp_customize_widgets/wp_ajax_update_widget) wp-includes/class-wp-customize-widgets.php | Updates widget settings asynchronously. |
| [trackback()](trackback) wp-includes/comment.php | Sends a Trackback. |
| [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. |
| [discover\_pingback\_server\_uri()](discover_pingback_server_uri) wp-includes/comment.php | Finds a pingback server URI based on the given URL. |
| [register\_meta()](register_meta) wp-includes/meta.php | Registers a meta key. |
| [\_WP\_Editors::editor\_settings()](../classes/_wp_editors/editor_settings) wp-includes/class-wp-editor.php | |
| Version | Description |
| --- | --- |
| [2.1.0](https://developer.wordpress.org/reference/since/2.1.0/) | Introduced. |
| programming_docs |
wordpress wp_print_admin_notice_templates() wp\_print\_admin\_notice\_templates()
=====================================
Prints the JavaScript templates for update admin notices.
File: `wp-admin/includes/update.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/update.php/)
```
function wp_print_admin_notice_templates() {
?>
<script id="tmpl-wp-updates-admin-notice" type="text/html">
<div <# if ( data.id ) { #>id="{{ data.id }}"<# } #> class="notice {{ data.className }}"><p>{{{ data.message }}}</p></div>
</script>
<script id="tmpl-wp-bulk-updates-admin-notice" type="text/html">
<div id="{{ data.id }}" class="{{ data.className }} notice <# if ( data.errors ) { #>notice-error<# } else { #>notice-success<# } #>">
<p>
<# if ( data.successes ) { #>
<# if ( 1 === data.successes ) { #>
<# if ( 'plugin' === data.type ) { #>
<?php
/* translators: %s: Number of plugins. */
printf( __( '%s plugin successfully updated.' ), '{{ data.successes }}' );
?>
<# } else { #>
<?php
/* translators: %s: Number of themes. */
printf( __( '%s theme successfully updated.' ), '{{ data.successes }}' );
?>
<# } #>
<# } else { #>
<# if ( 'plugin' === data.type ) { #>
<?php
/* translators: %s: Number of plugins. */
printf( __( '%s plugins successfully updated.' ), '{{ data.successes }}' );
?>
<# } else { #>
<?php
/* translators: %s: Number of themes. */
printf( __( '%s themes successfully updated.' ), '{{ data.successes }}' );
?>
<# } #>
<# } #>
<# } #>
<# if ( data.errors ) { #>
<button class="button-link bulk-action-errors-collapsed" aria-expanded="false">
<# if ( 1 === data.errors ) { #>
<?php
/* translators: %s: Number of failed updates. */
printf( __( '%s update failed.' ), '{{ data.errors }}' );
?>
<# } else { #>
<?php
/* translators: %s: Number of failed updates. */
printf( __( '%s updates failed.' ), '{{ data.errors }}' );
?>
<# } #>
<span class="screen-reader-text"><?php _e( 'Show more details' ); ?></span>
<span class="toggle-indicator" aria-hidden="true"></span>
</button>
<# } #>
</p>
<# if ( data.errors ) { #>
<ul class="bulk-action-errors hidden">
<# _.each( data.errorMessages, function( errorMessage ) { #>
<li>{{ errorMessage }}</li>
<# } ); #>
</ul>
<# } #>
</div>
</script>
<?php
}
```
| Uses | Description |
| --- | --- |
| [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. |
| [\_e()](_e) wp-includes/l10n.php | Displays translated text. |
| Version | Description |
| --- | --- |
| [4.6.0](https://developer.wordpress.org/reference/since/4.6.0/) | Introduced. |
wordpress get_the_excerpt( int|WP_Post $post = null ): string get\_the\_excerpt( int|WP\_Post $post = null ): string
======================================================
Retrieves the post excerpt.
`$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 excerpt.
File: `wp-includes/post-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/post-template.php/)
```
function get_the_excerpt( $post = null ) {
if ( is_bool( $post ) ) {
_deprecated_argument( __FUNCTION__, '2.3.0' );
}
$post = get_post( $post );
if ( empty( $post ) ) {
return '';
}
if ( post_password_required( $post ) ) {
return __( 'There is no excerpt because this is a protected post.' );
}
/**
* Filters the retrieved post excerpt.
*
* @since 1.2.0
* @since 4.5.0 Introduced the `$post` parameter.
*
* @param string $post_excerpt The post excerpt.
* @param WP_Post $post Post object.
*/
return apply_filters( 'get_the_excerpt', $post->post_excerpt, $post );
}
```
[apply\_filters( 'get\_the\_excerpt', string $post\_excerpt, WP\_Post $post )](../hooks/get_the_excerpt)
Filters the retrieved post excerpt.
| Uses | Description |
| --- | --- |
| [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. |
| [\_\_()](__) 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. |
| [get\_post()](get_post) wp-includes/post.php | Retrieves post data given a post ID or post object. |
| Used By | Description |
| --- | --- |
| [the\_excerpt\_embed()](the_excerpt_embed) wp-includes/embed.php | Displays the post excerpt for the embed template. |
| [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. |
| [the\_excerpt\_rss()](the_excerpt_rss) wp-includes/feed.php | Displays the post excerpt for the feed. |
| [the\_excerpt()](the_excerpt) wp-includes/post-template.php | Displays the post excerpt. |
| Version | Description |
| --- | --- |
| [4.5.0](https://developer.wordpress.org/reference/since/4.5.0/) | Introduced the `$post` parameter. |
| [0.71](https://developer.wordpress.org/reference/since/0.71/) | Introduced. |
wordpress is_object_in_term( int $object_id, string $taxonomy, int|string|int[]|string[] $terms = null ): bool|WP_Error is\_object\_in\_term( int $object\_id, string $taxonomy, int|string|int[]|string[] $terms = null ): bool|WP\_Error
==================================================================================================================
Determines if the given object is associated with any of the given terms.
The given terms are checked against the object’s terms’ term\_ids, names and slugs.
Terms given as integers will only be checked against the object’s terms’ term\_ids.
If no terms are given, determines if object is associated with any terms in the given taxonomy.
`$object_id` int Required ID of the object (post ID, link ID, ...). `$taxonomy` string Required Single taxonomy name. `$terms` int|string|int[]|string[] Optional Term ID, name, slug, or array of such to check against. Default: `null`
bool|[WP\_Error](../classes/wp_error) [WP\_Error](../classes/wp_error) on input error.
File: `wp-includes/taxonomy.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/taxonomy.php/)
```
function is_object_in_term( $object_id, $taxonomy, $terms = null ) {
$object_id = (int) $object_id;
if ( ! $object_id ) {
return new WP_Error( 'invalid_object', __( 'Invalid object ID.' ) );
}
$object_terms = get_object_term_cache( $object_id, $taxonomy );
if ( false === $object_terms ) {
$object_terms = wp_get_object_terms( $object_id, $taxonomy, array( 'update_term_meta_cache' => false ) );
if ( is_wp_error( $object_terms ) ) {
return $object_terms;
}
wp_cache_set( $object_id, wp_list_pluck( $object_terms, 'term_id' ), "{$taxonomy}_relationships" );
}
if ( is_wp_error( $object_terms ) ) {
return $object_terms;
}
if ( empty( $object_terms ) ) {
return false;
}
if ( empty( $terms ) ) {
return ( ! empty( $object_terms ) );
}
$terms = (array) $terms;
$ints = array_filter( $terms, 'is_int' );
if ( $ints ) {
$strs = array_diff( $terms, $ints );
} else {
$strs =& $terms;
}
foreach ( $object_terms as $object_term ) {
// If term is an int, check against term_ids only.
if ( $ints && in_array( $object_term->term_id, $ints, true ) ) {
return true;
}
if ( $strs ) {
// Only check numeric strings against term_id, to avoid false matches due to type juggling.
$numeric_strs = array_map( 'intval', array_filter( $strs, 'is_numeric' ) );
if ( in_array( $object_term->term_id, $numeric_strs, true ) ) {
return true;
}
if ( in_array( $object_term->name, $strs, true ) ) {
return true;
}
if ( in_array( $object_term->slug, $strs, true ) ) {
return true;
}
}
}
return false;
}
```
| Uses | Description |
| --- | --- |
| [wp\_cache\_set()](wp_cache_set) wp-includes/cache.php | Saves the data to the cache. |
| [wp\_list\_pluck()](wp_list_pluck) wp-includes/functions.php | Plucks a certain field out of each object or array in an array. |
| [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. |
| [\_\_()](__) 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 |
| --- | --- |
| [has\_term()](has_term) wp-includes/category-template.php | Checks if the current post has any of given terms. |
| [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.7.0](https://developer.wordpress.org/reference/since/2.7.0/) | Introduced. |
wordpress wp_typography_get_css_variable_inline_style( array $attributes, string $feature, string $css_property ): string wp\_typography\_get\_css\_variable\_inline\_style( array $attributes, string $feature, string $css\_property ): string
======================================================================================================================
This function has been deprecated. Use [wp\_style\_engine\_get\_styles()](wp_style_engine_get_styles) 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 [wp\_style\_engine\_get\_styles()](wp_style_engine_get_styles) instead.
Generates an inline style for a typography feature e.g. text decoration, text transform, and font style.
* [wp\_style\_engine\_get\_styles()](wp_style_engine_get_styles)
`$attributes` array Required Block's attributes. `$feature` string Required Key for the feature within the typography styles. `$css_property` string Required Slug for the CSS property the inline style sets. string CSS inline style.
File: `wp-includes/deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/deprecated.php/)
```
function wp_typography_get_css_variable_inline_style( $attributes, $feature, $css_property ) {
_deprecated_function( __FUNCTION__, '6.1.0', 'wp_style_engine_get_styles()' );
// Retrieve current attribute value or skip if not found.
$style_value = _wp_array_get( $attributes, array( 'style', 'typography', $feature ), false );
if ( ! $style_value ) {
return;
}
// If we don't have a preset CSS variable, we'll assume it's a regular CSS value.
if ( strpos( $style_value, "var:preset|{$css_property}|" ) === false ) {
return sprintf( '%s:%s;', $css_property, $style_value );
}
/*
* We have a preset CSS variable as the style.
* Get the style value from the string and return CSS style.
*/
$index_to_splice = strrpos( $style_value, '|' ) + 1;
$slug = substr( $style_value, $index_to_splice );
// Return the actual CSS inline style e.g. `text-decoration:var(--wp--preset--text-decoration--underline);`.
return sprintf( '%s:var(--wp--preset--%s--%s);', $css_property, $css_property, $slug );
}
```
| Uses | Description |
| --- | --- |
| [\_wp\_array\_get()](_wp_array_get) wp-includes/functions.php | Accesses an array in depth based on a path of keys. |
| [\_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/) | Use [wp\_style\_engine\_get\_styles()](wp_style_engine_get_styles) introduced in 6.1.0. |
| [5.8.0](https://developer.wordpress.org/reference/since/5.8.0/) | Introduced. |
wordpress _preview_theme_template_filter(): string \_preview\_theme\_template\_filter(): 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.
Private function to modify the current template when previewing a theme
string
File: `wp-includes/deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/deprecated.php/)
```
function _preview_theme_template_filter() {
_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.9.0](https://developer.wordpress.org/reference/since/2.9.0/) | Introduced. |
wordpress is_nav_menu( int|string|WP_Term $menu ): bool is\_nav\_menu( int|string|WP\_Term $menu ): bool
================================================
Determines whether the given ID is a navigation menu.
Returns true if it is; false otherwise.
`$menu` int|string|[WP\_Term](../classes/wp_term) Required Menu ID, slug, name, or object of menu to check. bool Whether the menu exists.
File: `wp-includes/nav-menu.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/nav-menu.php/)
```
function is_nav_menu( $menu ) {
if ( ! $menu ) {
return false;
}
$menu_obj = wp_get_nav_menu_object( $menu );
if (
$menu_obj &&
! is_wp_error( $menu_obj ) &&
! empty( $menu_obj->taxonomy ) &&
'nav_menu' === $menu_obj->taxonomy
) {
return true;
}
return false;
}
```
| Uses | Description |
| --- | --- |
| [wp\_get\_nav\_menu\_object()](wp_get_nav_menu_object) wp-includes/nav-menu.php | Returns a navigation menu object. |
| [is\_wp\_error()](is_wp_error) wp-includes/load.php | Checks whether the given variable is a WordPress Error. |
| Used By | Description |
| --- | --- |
| [wp\_save\_nav\_menu\_items()](wp_save_nav_menu_items) wp-admin/includes/nav-menu.php | Save posted nav menu item data. |
| [wp\_get\_nav\_menu\_to\_edit()](wp_get_nav_menu_to_edit) wp-admin/includes/nav-menu.php | Returns the menu formatted to edit. |
| Version | Description |
| --- | --- |
| [3.0.0](https://developer.wordpress.org/reference/since/3.0.0/) | Introduced. |
wordpress wp_skip_paused_plugins( string[] $plugins ): string[] wp\_skip\_paused\_plugins( string[] $plugins ): string[]
========================================================
Filters a given list of plugins, removing any paused plugins from it.
`$plugins` string[] Required Array of absolute plugin main file paths. string[] Filtered array of plugins, without any paused plugins.
File: `wp-includes/load.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/load.php/)
```
function wp_skip_paused_plugins( array $plugins ) {
$paused_plugins = wp_paused_plugins()->get_all();
if ( empty( $paused_plugins ) ) {
return $plugins;
}
foreach ( $plugins as $index => $plugin ) {
list( $plugin ) = explode( '/', plugin_basename( $plugin ) );
if ( array_key_exists( $plugin, $paused_plugins ) ) {
unset( $plugins[ $index ] );
// Store list of paused plugins for displaying an admin notice.
$GLOBALS['_paused_plugins'][ $plugin ] = $paused_plugins[ $plugin ];
}
}
return $plugins;
}
```
| Uses | Description |
| --- | --- |
| [wp\_paused\_plugins()](wp_paused_plugins) wp-includes/error-protection.php | Get the instance for storing paused plugins. |
| [plugin\_basename()](plugin_basename) wp-includes/plugin.php | Gets the basename of a plugin. |
| Used By | Description |
| --- | --- |
| [wp\_get\_active\_and\_valid\_plugins()](wp_get_active_and_valid_plugins) wp-includes/load.php | Retrieve an array of active and valid plugin files. |
| Version | Description |
| --- | --- |
| [5.2.0](https://developer.wordpress.org/reference/since/5.2.0/) | Introduced. |
wordpress verify_file_md5( string $filename, string $expected_md5 ): bool|WP_Error verify\_file\_md5( string $filename, string $expected\_md5 ): bool|WP\_Error
============================================================================
Calculates and compares the MD5 of a file to its expected value.
`$filename` string Required The filename to check the MD5 of. `$expected_md5` string Required The expected MD5 of the file, either a base64-encoded raw md5, or a hex-encoded md5. bool|[WP\_Error](../classes/wp_error) True on success, false when the MD5 format is unknown/unexpected, [WP\_Error](../classes/wp_error) on failure.
File: `wp-admin/includes/file.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/file.php/)
```
function verify_file_md5( $filename, $expected_md5 ) {
if ( 32 === strlen( $expected_md5 ) ) {
$expected_raw_md5 = pack( 'H*', $expected_md5 );
} elseif ( 24 === strlen( $expected_md5 ) ) {
$expected_raw_md5 = base64_decode( $expected_md5 );
} else {
return false; // Unknown format.
}
$file_md5 = md5_file( $filename, true );
if ( $file_md5 === $expected_raw_md5 ) {
return true;
}
return new WP_Error(
'md5_mismatch',
sprintf(
/* translators: 1: File checksum, 2: Expected checksum value. */
__( 'The checksum of the file (%1$s) does not match the expected checksum value (%2$s).' ),
bin2hex( $file_md5 ),
bin2hex( $expected_raw_md5 )
)
);
}
```
| 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 |
| --- | --- |
| [download\_url()](download_url) wp-admin/includes/file.php | Downloads a URL to a local temporary file using the WordPress HTTP API. |
| Version | Description |
| --- | --- |
| [3.7.0](https://developer.wordpress.org/reference/since/3.7.0/) | Introduced. |
wordpress get_file_description( string $file ): string get\_file\_description( string $file ): string
==============================================
Gets the description for standard WordPress theme files.
`$file` string Required Filesystem path or filename. string Description of file from $wp\_file\_descriptions or basename of $file if description doesn't exist.
Appends 'Page Template' to basename of $file if the file is a page template.
File: `wp-admin/includes/file.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/file.php/)
```
function get_file_description( $file ) {
global $wp_file_descriptions, $allowed_files;
$dirname = pathinfo( $file, PATHINFO_DIRNAME );
$file_path = $allowed_files[ $file ];
if ( isset( $wp_file_descriptions[ basename( $file ) ] ) && '.' === $dirname ) {
return $wp_file_descriptions[ basename( $file ) ];
} elseif ( file_exists( $file_path ) && is_file( $file_path ) ) {
$template_data = implode( '', file( $file_path ) );
if ( preg_match( '|Template Name:(.*)$|mi', $template_data, $name ) ) {
/* translators: %s: Template name. */
return sprintf( __( '%s Page Template' ), _cleanup_header_comment( $name[1] ) );
}
}
return trim( basename( $file ) );
}
```
| 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. |
| [\_\_()](__) wp-includes/l10n.php | Retrieves the translation of $text. |
| 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 |
| --- | --- |
| [1.5.0](https://developer.wordpress.org/reference/since/1.5.0/) | Introduced. |
| programming_docs |
wordpress wp_metadata_lazyloader(): WP_Metadata_Lazyloader wp\_metadata\_lazyloader(): WP\_Metadata\_Lazyloader
====================================================
Retrieves the queue for lazy-loading metadata.
[WP\_Metadata\_Lazyloader](../classes/wp_metadata_lazyloader) Metadata lazyloader queue.
File: `wp-includes/meta.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/meta.php/)
```
function wp_metadata_lazyloader() {
static $wp_metadata_lazyloader;
if ( null === $wp_metadata_lazyloader ) {
$wp_metadata_lazyloader = new WP_Metadata_Lazyloader();
}
return $wp_metadata_lazyloader;
}
```
| Uses | Description |
| --- | --- |
| [WP\_Metadata\_Lazyloader::\_\_construct()](../classes/wp_metadata_lazyloader/__construct) wp-includes/class-wp-metadata-lazyloader.php | Constructor. |
| Used By | Description |
| --- | --- |
| [wp\_queue\_comments\_for\_comment\_meta\_lazyload()](wp_queue_comments_for_comment_meta_lazyload) wp-includes/comment.php | Queues comments for metadata lazy-loading. |
| [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. |
| Version | Description |
| --- | --- |
| [4.5.0](https://developer.wordpress.org/reference/since/4.5.0/) | Introduced. |
wordpress get_default_comment_status( string $post_type = 'post', string $comment_type = 'comment' ): string get\_default\_comment\_status( string $post\_type = 'post', string $comment\_type = 'comment' ): string
=======================================================================================================
Gets the default comment status for a post type.
`$post_type` string Optional Post type. Default `'post'`. Default: `'post'`
`$comment_type` string Optional Comment type. Default `'comment'`. Default: `'comment'`
string Expected return value is `'open'` or `'closed'`.
File: `wp-includes/comment.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/comment.php/)
```
function get_default_comment_status( $post_type = 'post', $comment_type = 'comment' ) {
switch ( $comment_type ) {
case 'pingback':
case 'trackback':
$supports = 'trackbacks';
$option = 'ping';
break;
default:
$supports = 'comments';
$option = 'comment';
break;
}
// Set the status.
if ( 'page' === $post_type ) {
$status = 'closed';
} elseif ( post_type_supports( $post_type, $supports ) ) {
$status = get_option( "default_{$option}_status" );
} else {
$status = 'closed';
}
/**
* Filters the default comment status for the given post type.
*
* @since 4.3.0
*
* @param string $status Default status for the given post type,
* either 'open' or 'closed'.
* @param string $post_type Post type. Default is `post`.
* @param string $comment_type Type of comment. Default is `comment`.
*/
return apply_filters( 'get_default_comment_status', $status, $post_type, $comment_type );
}
```
[apply\_filters( 'get\_default\_comment\_status', string $status, string $post\_type, string $comment\_type )](../hooks/get_default_comment_status)
Filters the default comment status for the given post type.
| Uses | Description |
| --- | --- |
| [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\_option()](get_option) wp-includes/option.php | Retrieves an option value based on an option name. |
| Used By | Description |
| --- | --- |
| [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\_insert\_post()](wp_insert_post) wp-includes/post.php | Inserts or update a post. |
| [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. |
| Version | Description |
| --- | --- |
| [4.3.0](https://developer.wordpress.org/reference/since/4.3.0/) | Introduced. |
wordpress get_editor_stylesheets(): string[] get\_editor\_stylesheets(): string[]
====================================
Retrieves any registered editor stylesheet URLs.
string[] If registered, a list of editor stylesheet URLs.
File: `wp-includes/theme.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/theme.php/)
```
function get_editor_stylesheets() {
$stylesheets = array();
// Load editor_style.css if the active theme supports it.
if ( ! empty( $GLOBALS['editor_styles'] ) && is_array( $GLOBALS['editor_styles'] ) ) {
$editor_styles = $GLOBALS['editor_styles'];
$editor_styles = array_unique( array_filter( $editor_styles ) );
$style_uri = get_stylesheet_directory_uri();
$style_dir = get_stylesheet_directory();
// Support externally referenced styles (like, say, fonts).
foreach ( $editor_styles as $key => $file ) {
if ( preg_match( '~^(https?:)?//~', $file ) ) {
$stylesheets[] = sanitize_url( $file );
unset( $editor_styles[ $key ] );
}
}
// Look in a parent theme first, that way child theme CSS overrides.
if ( is_child_theme() ) {
$template_uri = get_template_directory_uri();
$template_dir = get_template_directory();
foreach ( $editor_styles as $key => $file ) {
if ( $file && file_exists( "$template_dir/$file" ) ) {
$stylesheets[] = "$template_uri/$file";
}
}
}
foreach ( $editor_styles as $file ) {
if ( $file && file_exists( "$style_dir/$file" ) ) {
$stylesheets[] = "$style_uri/$file";
}
}
}
/**
* Filters the array of URLs of stylesheets applied to the editor.
*
* @since 4.3.0
*
* @param string[] $stylesheets Array of URLs of stylesheets to be applied to the editor.
*/
return apply_filters( 'editor_stylesheets', $stylesheets );
}
```
[apply\_filters( 'editor\_stylesheets', string[] $stylesheets )](../hooks/editor_stylesheets)
Filters the array of URLs of stylesheets applied to the editor.
| Uses | Description |
| --- | --- |
| [get\_stylesheet\_directory\_uri()](get_stylesheet_directory_uri) wp-includes/theme.php | Retrieves stylesheet directory URI for the active theme. |
| [get\_stylesheet\_directory()](get_stylesheet_directory) wp-includes/theme.php | Retrieves stylesheet directory path for the active theme. |
| [get\_template\_directory\_uri()](get_template_directory_uri) wp-includes/theme.php | Retrieves template directory URI for the active theme. |
| [get\_template\_directory()](get_template_directory) wp-includes/theme.php | Retrieves template directory path for the active theme. |
| [is\_child\_theme()](is_child_theme) wp-includes/theme.php | Whether a child theme is in use. |
| [sanitize\_url()](sanitize_url) wp-includes/formatting.php | Sanitizes a URL for database or redirect usage. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| Used By | Description |
| --- | --- |
| [\_WP\_Editors::editor\_settings()](../classes/_wp_editors/editor_settings) wp-includes/class-wp-editor.php | |
| Version | Description |
| --- | --- |
| [4.0.0](https://developer.wordpress.org/reference/since/4.0.0/) | Introduced. |
wordpress get_the_generator( string $type = '' ): string|void get\_the\_generator( string $type = '' ): string|void
=====================================================
Creates the generator XML or Comment for RSS, ATOM, etc.
Returns the correct generator type for the requested output format. Allows for a plugin to filter generators on an individual basis using the [‘get\_the\_generator\_$type’](../hooks/get_the_generator_type) filter.
`$type` string Optional The type of generator to return - (`html|xhtml|atom|rss2|rdf|comment|export`). Default: `''`
string|void The HTML content for the generator.
File: `wp-includes/general-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/general-template.php/)
```
function get_the_generator( $type = '' ) {
if ( empty( $type ) ) {
$current_filter = current_filter();
if ( empty( $current_filter ) ) {
return;
}
switch ( $current_filter ) {
case 'rss2_head':
case 'commentsrss2_head':
$type = 'rss2';
break;
case 'rss_head':
case 'opml_head':
$type = 'comment';
break;
case 'rdf_header':
$type = 'rdf';
break;
case 'atom_head':
case 'comments_atom_head':
case 'app_head':
$type = 'atom';
break;
}
}
switch ( $type ) {
case 'html':
$gen = '<meta name="generator" content="WordPress ' . esc_attr( get_bloginfo( 'version' ) ) . '">';
break;
case 'xhtml':
$gen = '<meta name="generator" content="WordPress ' . esc_attr( get_bloginfo( 'version' ) ) . '" />';
break;
case 'atom':
$gen = '<generator uri="https://wordpress.org/" version="' . esc_attr( get_bloginfo_rss( 'version' ) ) . '">WordPress</generator>';
break;
case 'rss2':
$gen = '<generator>' . sanitize_url( 'https://wordpress.org/?v=' . get_bloginfo_rss( 'version' ) ) . '</generator>';
break;
case 'rdf':
$gen = '<admin:generatorAgent rdf:resource="' . sanitize_url( 'https://wordpress.org/?v=' . get_bloginfo_rss( 'version' ) ) . '" />';
break;
case 'comment':
$gen = '<!-- generator="WordPress/' . esc_attr( get_bloginfo( 'version' ) ) . '" -->';
break;
case 'export':
$gen = '<!-- generator="WordPress/' . esc_attr( get_bloginfo_rss( 'version' ) ) . '" created="' . gmdate( 'Y-m-d H:i' ) . '" -->';
break;
}
/**
* Filters the HTML for the retrieved generator type.
*
* The dynamic portion of the hook name, `$type`, refers to the generator type.
*
* Possible hook names include:
*
* - `get_the_generator_atom`
* - `get_the_generator_comment`
* - `get_the_generator_export`
* - `get_the_generator_html`
* - `get_the_generator_rdf`
* - `get_the_generator_rss2`
* - `get_the_generator_xhtml`
*
* @since 2.5.0
*
* @param string $gen The HTML markup output to wp_head().
* @param string $type The type of generator. Accepts 'html', 'xhtml', 'atom',
* 'rss2', 'rdf', 'comment', 'export'.
*/
return apply_filters( "get_the_generator_{$type}", $gen, $type );
}
```
[apply\_filters( "get\_the\_generator\_{$type}", string $gen, string $type )](../hooks/get_the_generator_type)
Filters the HTML for the retrieved generator type.
| Uses | Description |
| --- | --- |
| [sanitize\_url()](sanitize_url) wp-includes/formatting.php | Sanitizes a URL for database or redirect usage. |
| [current\_filter()](current_filter) wp-includes/plugin.php | Retrieves the name of the current filter hook. |
| [get\_bloginfo\_rss()](get_bloginfo_rss) wp-includes/feed.php | Retrieves RSS container for the bloginfo function. |
| [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. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| Used By | Description |
| --- | --- |
| [the\_generator()](the_generator) wp-includes/general-template.php | Displays the generator XML or Comment for RSS, ATOM, etc. |
| Version | Description |
| --- | --- |
| [2.5.0](https://developer.wordpress.org/reference/since/2.5.0/) | Introduced. |
wordpress get_taxonomy_template(): string get\_taxonomy\_template(): string
=================================
Retrieves path of custom taxonomy term template in current or parent template.
The hierarchy for this template looks like:
1. taxonomy-{taxonomy\_slug}-{term\_slug}.php
2. taxonomy-{taxonomy\_slug}.php
3. taxonomy.php
An example of this is:
1. taxonomy-location-texas.php
2. taxonomy-location.php
3. taxonomy.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 ‘taxonomy’.
* [get\_query\_template()](get_query_template)
string Full path to custom taxonomy term template file.
File: `wp-includes/template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/template.php/)
```
function get_taxonomy_template() {
$term = get_queried_object();
$templates = array();
if ( ! empty( $term->slug ) ) {
$taxonomy = $term->taxonomy;
$slug_decoded = urldecode( $term->slug );
if ( $slug_decoded !== $term->slug ) {
$templates[] = "taxonomy-$taxonomy-{$slug_decoded}.php";
}
$templates[] = "taxonomy-$taxonomy-{$term->slug}.php";
$templates[] = "taxonomy-$taxonomy.php";
}
$templates[] = 'taxonomy.php';
return get_query_template( 'taxonomy', $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 |
| --- | --- |
| [4.7.0](https://developer.wordpress.org/reference/since/4.7.0/) | The decoded form of `taxonomy-{taxonomy_slug}-{term_slug}.php` was added to the top of the template hierarchy when the term slug contains multibyte characters. |
| [2.5.0](https://developer.wordpress.org/reference/since/2.5.0/) | Introduced. |
wordpress wp_is_authorize_application_password_request_valid( array $request, WP_User $user ): true|WP_Error wp\_is\_authorize\_application\_password\_request\_valid( array $request, WP\_User $user ): true|WP\_Error
==========================================================================================================
Checks if the Authorize Application Password request is valid.
`$request` array Required The array of request data. All arguments are optional and may be empty.
* `app_name`stringThe suggested name of the application.
* `app_id`stringA UUID provided by the application to uniquely identify it.
* `success_url`stringThe URL the user will be redirected to after approving the application.
* `reject_url`stringThe URL the user will be redirected to after rejecting the application.
`$user` [WP\_User](../classes/wp_user) Required The user authorizing the application. true|[WP\_Error](../classes/wp_error) True if the request is valid, a [WP\_Error](../classes/wp_error) object contains errors if not.
File: `wp-admin/includes/user.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/user.php/)
```
function wp_is_authorize_application_password_request_valid( $request, $user ) {
$error = new WP_Error();
if ( ! empty( $request['success_url'] ) ) {
$scheme = wp_parse_url( $request['success_url'], PHP_URL_SCHEME );
if ( 'http' === $scheme ) {
$error->add(
'invalid_redirect_scheme',
__( 'The success URL must be served over a secure connection.' )
);
}
}
if ( ! empty( $request['reject_url'] ) ) {
$scheme = wp_parse_url( $request['reject_url'], PHP_URL_SCHEME );
if ( 'http' === $scheme ) {
$error->add(
'invalid_redirect_scheme',
__( 'The rejection URL must be served over a secure connection.' )
);
}
}
if ( ! empty( $request['app_id'] ) && ! wp_is_uuid( $request['app_id'] ) ) {
$error->add(
'invalid_app_id',
__( 'The application ID must be a UUID.' )
);
}
/**
* Fires before application password errors are returned.
*
* @since 5.6.0
*
* @param WP_Error $error The error object.
* @param array $request The array of request data.
* @param WP_User $user The user authorizing the application.
*/
do_action( 'wp_authorize_application_password_request_errors', $error, $request, $user );
if ( $error->has_errors() ) {
return $error;
}
return true;
}
```
[do\_action( 'wp\_authorize\_application\_password\_request\_errors', WP\_Error $error, array $request, WP\_User $user )](../hooks/wp_authorize_application_password_request_errors)
Fires before application password errors are returned.
| Uses | Description |
| --- | --- |
| [wp\_is\_uuid()](wp_is_uuid) wp-includes/functions.php | Validates that a UUID is valid. |
| [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. |
| [\_\_()](__) 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. |
| [WP\_Error::\_\_construct()](../classes/wp_error/__construct) wp-includes/class-wp-error.php | Initializes the error. |
| Version | Description |
| --- | --- |
| [5.6.0](https://developer.wordpress.org/reference/since/5.6.0/) | Introduced. |
wordpress the_author_posts() the\_author\_posts()
====================
Displays the number of posts by the author of the current post.
File: `wp-includes/author-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/author-template.php/)
```
function the_author_posts() {
echo get_the_author_posts();
}
```
| Uses | Description |
| --- | --- |
| [get\_the\_author\_posts()](get_the_author_posts) wp-includes/author-template.php | Retrieves the number of posts by the author of the current post. |
| Version | Description |
| --- | --- |
| [0.71](https://developer.wordpress.org/reference/since/0.71/) | Introduced. |
wordpress get_the_author_icq(): string get\_the\_author\_icq(): string
===============================
This function has been deprecated. Use [get\_the\_author\_meta()](get_the_author_meta) instead.
Retrieve the ICQ number of the author of the current post.
* [get\_the\_author\_meta()](get_the_author_meta)
string The author's ICQ number.
File: `wp-includes/deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/deprecated.php/)
```
function get_the_author_icq() {
_deprecated_function( __FUNCTION__, '2.8.0', 'get_the_author_meta(\'icq\')' );
return get_the_author_meta('icq');
}
```
| 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 get_main_site_id( int $network_id = null ): int get\_main\_site\_id( int $network\_id = null ): int
===================================================
Gets the main site ID.
`$network_id` int Optional The ID of the network for which to get the main site.
Defaults to the current network. Default: `null`
int The ID of the main site.
File: `wp-includes/functions.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/functions.php/)
```
function get_main_site_id( $network_id = null ) {
if ( ! is_multisite() ) {
return get_current_blog_id();
}
$network = get_network( $network_id );
if ( ! $network ) {
return 0;
}
return $network->site_id;
}
```
| Uses | Description |
| --- | --- |
| [get\_network()](get_network) wp-includes/ms-network.php | Retrieves network data given a network ID or network object. |
| [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. |
| Used By | Description |
| --- | --- |
| [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. |
| [is\_main\_site()](is_main_site) wp-includes/functions.php | Determines whether a site is the main site of the current network. |
| Version | Description |
| --- | --- |
| [4.9.0](https://developer.wordpress.org/reference/since/4.9.0/) | Introduced. |
| programming_docs |
wordpress wp_revisions_to_keep( WP_Post $post ): int wp\_revisions\_to\_keep( WP\_Post $post ): int
==============================================
Determines how many revisions to retain for a given post.
By default, an infinite number of revisions are kept.
The constant WP\_POST\_REVISIONS can be set in wp-config to specify the limit of revisions to keep.
`$post` [WP\_Post](../classes/wp_post) Required The post object. int The number of revisions to keep.
File: `wp-includes/revision.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/revision.php/)
```
function wp_revisions_to_keep( $post ) {
$num = WP_POST_REVISIONS;
if ( true === $num ) {
$num = -1;
} else {
$num = (int) $num;
}
if ( ! post_type_supports( $post->post_type, 'revisions' ) ) {
$num = 0;
}
/**
* Filters the number of revisions to save for the given post.
*
* Overrides the value of WP_POST_REVISIONS.
*
* @since 3.6.0
*
* @param int $num Number of revisions to store.
* @param WP_Post $post Post object.
*/
$num = apply_filters( 'wp_revisions_to_keep', $num, $post );
/**
* Filters the number of revisions to save for the given post by its post type.
*
* Overrides both the value of WP_POST_REVISIONS and the {@see 'wp_revisions_to_keep'} filter.
*
* The dynamic portion of the hook name, `$post->post_type`, refers to
* the post type slug.
*
* Possible hook names include:
*
* - `wp_post_revisions_to_keep`
* - `wp_page_revisions_to_keep`
*
* @since 5.8.0
*
* @param int $num Number of revisions to store.
* @param WP_Post $post Post object.
*/
$num = apply_filters( "wp_{$post->post_type}_revisions_to_keep", $num, $post );
return (int) $num;
}
```
[apply\_filters( 'wp\_revisions\_to\_keep', int $num, WP\_Post $post )](../hooks/wp_revisions_to_keep)
Filters the number of revisions to save for the given post.
[apply\_filters( "wp\_{$post->post\_type}\_revisions\_to\_keep", int $num, WP\_Post $post )](../hooks/wp_post-post_type_revisions_to_keep)
Filters the number of revisions to save for the given post by its post type.
| Uses | Description |
| --- | --- |
| [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. |
| Used By | Description |
| --- | --- |
| [wp\_revisions\_enabled()](wp_revisions_enabled) wp-includes/revision.php | Determines whether revisions are enabled for a given post. |
| [wp\_save\_post\_revision()](wp_save_post_revision) wp-includes/revision.php | Creates a revision for the current version of a post. |
| Version | Description |
| --- | --- |
| [3.6.0](https://developer.wordpress.org/reference/since/3.6.0/) | Introduced. |
wordpress get_theme_support( string $feature, mixed $args ): mixed get\_theme\_support( string $feature, mixed $args ): mixed
==========================================================
Gets the theme support arguments passed when registering that support.
Example usage:
```
get_theme_support( 'custom-logo' );
get_theme_support( 'custom-header', 'width' );
```
`$feature` string Required The feature to check. 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. mixed The array of extra arguments or the value for the registered feature.
File: `wp-includes/theme.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/theme.php/)
```
function get_theme_support( $feature, ...$args ) {
global $_wp_theme_features;
if ( ! isset( $_wp_theme_features[ $feature ] ) ) {
return false;
}
if ( ! $args ) {
return $_wp_theme_features[ $feature ];
}
switch ( $feature ) {
case 'custom-logo':
case 'custom-header':
case 'custom-background':
if ( isset( $_wp_theme_features[ $feature ][0][ $args[0] ] ) ) {
return $_wp_theme_features[ $feature ][0][ $args[0] ];
}
return false;
default:
return $_wp_theme_features[ $feature ];
}
}
```
| Used By | Description |
| --- | --- |
| [\_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. |
| [get\_default\_block\_editor\_settings()](get_default_block_editor_settings) wp-includes/block-editor.php | Returns the default block editor settings. |
| [wp\_use\_widgets\_block\_editor()](wp_use_widgets_block_editor) wp-includes/widgets.php | Whether or not to use the block editor to manage widgets. Defaults to true unless a theme has removed support for widgets-block-editor or a plugin has filtered the return value of this function. |
| [get\_media\_states()](get_media_states) wp-admin/includes/template.php | Retrieves an array of media states from an attachment. |
| [\_register\_core\_block\_patterns\_and\_categories()](_register_core_block_patterns_and_categories) wp-includes/block-patterns.php | Registers the core block patterns and categories. |
| [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. |
| [get\_theme\_starter\_content()](get_theme_starter_content) wp-includes/theme.php | Expands a theme’s starter content configuration using core-provided data. |
| [is\_header\_video\_active()](is_header_video_active) wp-includes/theme.php | Checks whether the custom header video is eligible to show on the current page. |
| [\_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. |
| [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\_Background\_Image\_Control::enqueue()](../classes/wp_customize_background_image_control/enqueue) wp-includes/customize/class-wp-customize-background-image-control.php | Enqueue control related scripts/styles. |
| [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::get\_default\_header\_images()](../classes/custom_image_header/get_default_header_images) wp-admin/includes/class-custom-image-header.php | Gets the details of default header images if defined. |
| [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::reset\_header\_image()](../classes/custom_image_header/reset_header_image) wp-admin/includes/class-custom-image-header.php | Reset a header image to the default image for the theme. |
| [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\_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. |
| [get\_background\_color()](get_background_color) wp-includes/theme.php | Retrieves value for custom background color. |
| [\_custom\_background\_cb()](_custom_background_cb) wp-includes/theme.php | Default custom background callback. |
| [add\_theme\_support()](add_theme_support) wp-includes/theme.php | Registers theme support for a given feature. |
| [\_custom\_header\_background\_just\_in\_time()](_custom_header_background_just_in_time) wp-includes/theme.php | Registers the internal custom header and background routines. |
| [\_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. |
| [get\_header\_textcolor()](get_header_textcolor) wp-includes/theme.php | Retrieves the custom header text color in 3- or 6-digit hexadecimal form. |
| [display\_header\_text()](display_header_text) wp-includes/theme.php | Whether to display the header text. |
| [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. |
| [get\_custom\_header()](get_custom_header) wp-includes/theme.php | Gets the header image data. |
| [get\_background\_image()](get_background_image) wp-includes/theme.php | Retrieves background image for custom background. |
| [WP\_Admin\_Bar::initialize()](../classes/wp_admin_bar/initialize) wp-includes/class-wp-admin-bar.php | Initializes the admin bar. |
| [WP\_Customize\_Header\_Image\_Setting::update()](../classes/wp_customize_header_image_setting/update) wp-includes/customize/class-wp-customize-header-image-setting.php | |
| [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::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\_Customize\_Header\_Image\_Control::enqueue()](../classes/wp_customize_header_image_control/enqueue) 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 | |
| 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.1.0](https://developer.wordpress.org/reference/since/3.1.0/) | Introduced. |
wordpress wp_register_sidebar_widget( int|string $id, string $name, callable $output_callback, array $options = array(), mixed $params ) wp\_register\_sidebar\_widget( int|string $id, string $name, callable $output\_callback, array $options = array(), mixed $params )
==================================================================================================================================
Register an instance of a widget.
The default widget option is ‘classname’ that can be overridden.
The function can also be used to un-register widgets when `$output_callback` parameter is an empty string.
`$id` int|string Required Widget ID. `$name` string Required Widget display title. `$output_callback` callable Required Run when widget is called. `$options` array Optional An array of supplementary widget options for the instance.
* `classname`stringClass name for the widget's HTML container. Default is a shortened version of the output callback name.
* `description`stringWidget description for display in the widget administration panel and/or theme.
* `show_instance_in_rest`boolWhether to show the widget's instance settings in the REST API.
Only available for [WP\_Widget](../classes/wp_widget) based widgets.
Default: `array()`
`$params` mixed Optional additional parameters to pass to the callback function when it's called. File: `wp-includes/widgets.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/widgets.php/)
```
function wp_register_sidebar_widget( $id, $name, $output_callback, $options = array(), ...$params ) {
global $wp_registered_widgets, $wp_registered_widget_controls, $wp_registered_widget_updates, $_wp_deprecated_widgets_callbacks;
$id = strtolower( $id );
if ( empty( $output_callback ) ) {
unset( $wp_registered_widgets[ $id ] );
return;
}
$id_base = _get_widget_id_base( $id );
if ( in_array( $output_callback, $_wp_deprecated_widgets_callbacks, true ) && ! is_callable( $output_callback ) ) {
unset( $wp_registered_widget_controls[ $id ] );
unset( $wp_registered_widget_updates[ $id_base ] );
return;
}
$defaults = array( 'classname' => $output_callback );
$options = wp_parse_args( $options, $defaults );
$widget = array(
'name' => $name,
'id' => $id,
'callback' => $output_callback,
'params' => $params,
);
$widget = array_merge( $widget, $options );
if ( is_callable( $output_callback ) && ( ! isset( $wp_registered_widgets[ $id ] ) || did_action( 'widgets_init' ) ) ) {
/**
* Fires once for each registered widget.
*
* @since 3.0.0
*
* @param array $widget An array of default widget arguments.
*/
do_action( 'wp_register_sidebar_widget', $widget );
$wp_registered_widgets[ $id ] = $widget;
}
}
```
[do\_action( 'wp\_register\_sidebar\_widget', array $widget )](../hooks/wp_register_sidebar_widget)
Fires once for each registered widget.
| Uses | Description |
| --- | --- |
| [did\_action()](did_action) wp-includes/plugin.php | Retrieves the number of times an action has been fired during the current request. |
| [\_get\_widget\_id\_base()](_get_widget_id_base) wp-includes/widgets.php | Retrieves the widget ID base value. |
| [wp\_parse\_args()](wp_parse_args) wp-includes/functions.php | Merges user defined arguments into defaults array. |
| [do\_action()](do_action) wp-includes/plugin.php | Calls the callback functions that have been added to an action hook. |
| Used By | Description |
| --- | --- |
| [register\_sidebar\_widget()](register_sidebar_widget) wp-includes/deprecated.php | Register widget for sidebar with backward compatibility. |
| [WP\_Widget::\_register\_one()](../classes/wp_widget/_register_one) wp-includes/class-wp-widget.php | Registers an instance of the widget class. |
| [wp\_unregister\_sidebar\_widget()](wp_unregister_sidebar_widget) wp-includes/widgets.php | Remove widget from sidebar. |
| Version | Description |
| --- | --- |
| [5.8.0](https://developer.wordpress.org/reference/since/5.8.0/) | Added show\_instance\_in\_rest option. |
| [5.3.0](https://developer.wordpress.org/reference/since/5.3.0/) | Formalized the existing and already documented `...$params` parameter by adding it to the function signature. |
| [2.2.0](https://developer.wordpress.org/reference/since/2.2.0/) | Introduced. |
wordpress add_link(): int|WP_Error add\_link(): int|WP\_Error
==========================
Add a link to using values provided in $\_POST.
int|[WP\_Error](../classes/wp_error) Value 0 or [WP\_Error](../classes/wp_error) on failure. The link ID on success.
File: `wp-admin/includes/bookmark.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/bookmark.php/)
```
function add_link() {
return edit_link();
}
```
| Uses | Description |
| --- | --- |
| [edit\_link()](edit_link) wp-admin/includes/bookmark.php | Updates or inserts a link using values provided in $\_POST. |
| Version | Description |
| --- | --- |
| [2.0.0](https://developer.wordpress.org/reference/since/2.0.0/) | Introduced. |
wordpress wp_user_personal_data_exporter( string $email_address ): array wp\_user\_personal\_data\_exporter( string $email\_address ): array
===================================================================
Finds and exports personal data associated with an email address from the user and user\_meta table.
`$email_address` string Required The user's email address. array An array of personal data.
File: `wp-includes/user.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/user.php/)
```
function wp_user_personal_data_exporter( $email_address ) {
$email_address = trim( $email_address );
$data_to_export = array();
$user = get_user_by( 'email', $email_address );
if ( ! $user ) {
return array(
'data' => array(),
'done' => true,
);
}
$user_meta = get_user_meta( $user->ID );
$user_props_to_export = array(
'ID' => __( 'User ID' ),
'user_login' => __( 'User Login Name' ),
'user_nicename' => __( 'User Nice Name' ),
'user_email' => __( 'User Email' ),
'user_url' => __( 'User URL' ),
'user_registered' => __( 'User Registration Date' ),
'display_name' => __( 'User Display Name' ),
'nickname' => __( 'User Nickname' ),
'first_name' => __( 'User First Name' ),
'last_name' => __( 'User Last Name' ),
'description' => __( 'User Description' ),
);
$user_data_to_export = array();
foreach ( $user_props_to_export as $key => $name ) {
$value = '';
switch ( $key ) {
case 'ID':
case 'user_login':
case 'user_nicename':
case 'user_email':
case 'user_url':
case 'user_registered':
case 'display_name':
$value = $user->data->$key;
break;
case 'nickname':
case 'first_name':
case 'last_name':
case 'description':
$value = $user_meta[ $key ][0];
break;
}
if ( ! empty( $value ) ) {
$user_data_to_export[] = array(
'name' => $name,
'value' => $value,
);
}
}
// Get the list of reserved names.
$reserved_names = array_values( $user_props_to_export );
/**
* Filters the user's profile data for the privacy exporter.
*
* @since 5.4.0
*
* @param array $additional_user_profile_data {
* An array of name-value pairs of additional user data items. Default empty array.
*
* @type string $name The user-facing name of an item name-value pair,e.g. 'IP Address'.
* @type string $value The user-facing value of an item data pair, e.g. '50.60.70.0'.
* }
* @param WP_User $user The user whose data is being exported.
* @param string[] $reserved_names An array of reserved names. Any item in `$additional_user_data`
* that uses one of these for its `name` will not be included in the export.
*/
$_extra_data = apply_filters( 'wp_privacy_additional_user_profile_data', array(), $user, $reserved_names );
if ( is_array( $_extra_data ) && ! empty( $_extra_data ) ) {
// Remove items that use reserved names.
$extra_data = array_filter(
$_extra_data,
static function( $item ) use ( $reserved_names ) {
return ! in_array( $item['name'], $reserved_names, true );
}
);
if ( count( $extra_data ) !== count( $_extra_data ) ) {
_doing_it_wrong(
__FUNCTION__,
sprintf(
/* translators: %s: wp_privacy_additional_user_profile_data */
__( 'Filter %s returned items with reserved names.' ),
'<code>wp_privacy_additional_user_profile_data</code>'
),
'5.4.0'
);
}
if ( ! empty( $extra_data ) ) {
$user_data_to_export = array_merge( $user_data_to_export, $extra_data );
}
}
$data_to_export[] = array(
'group_id' => 'user',
'group_label' => __( 'User' ),
'group_description' => __( 'User’s profile data.' ),
'item_id' => "user-{$user->ID}",
'data' => $user_data_to_export,
);
if ( isset( $user_meta['community-events-location'] ) ) {
$location = maybe_unserialize( $user_meta['community-events-location'][0] );
$location_props_to_export = array(
'description' => __( 'City' ),
'country' => __( 'Country' ),
'latitude' => __( 'Latitude' ),
'longitude' => __( 'Longitude' ),
'ip' => __( 'IP' ),
);
$location_data_to_export = array();
foreach ( $location_props_to_export as $key => $name ) {
if ( ! empty( $location[ $key ] ) ) {
$location_data_to_export[] = array(
'name' => $name,
'value' => $location[ $key ],
);
}
}
$data_to_export[] = array(
'group_id' => 'community-events-location',
'group_label' => __( 'Community Events Location' ),
'group_description' => __( 'User’s location data used for the Community Events in the WordPress Events and News dashboard widget.' ),
'item_id' => "community-events-location-{$user->ID}",
'data' => $location_data_to_export,
);
}
if ( isset( $user_meta['session_tokens'] ) ) {
$session_tokens = maybe_unserialize( $user_meta['session_tokens'][0] );
$session_tokens_props_to_export = array(
'expiration' => __( 'Expiration' ),
'ip' => __( 'IP' ),
'ua' => __( 'User Agent' ),
'login' => __( 'Last Login' ),
);
foreach ( $session_tokens as $token_key => $session_token ) {
$session_tokens_data_to_export = array();
foreach ( $session_tokens_props_to_export as $key => $name ) {
if ( ! empty( $session_token[ $key ] ) ) {
$value = $session_token[ $key ];
if ( in_array( $key, array( 'expiration', 'login' ), true ) ) {
$value = date_i18n( 'F d, Y H:i A', $value );
}
$session_tokens_data_to_export[] = array(
'name' => $name,
'value' => $value,
);
}
}
$data_to_export[] = array(
'group_id' => 'session-tokens',
'group_label' => __( 'Session Tokens' ),
'group_description' => __( 'User’s Session Tokens data.' ),
'item_id' => "session-tokens-{$user->ID}-{$token_key}",
'data' => $session_tokens_data_to_export,
);
}
}
return array(
'data' => $data_to_export,
'done' => true,
);
}
```
[apply\_filters( 'wp\_privacy\_additional\_user\_profile\_data', array $additional\_user\_profile\_data, WP\_User $user, string[] $reserved\_names )](../hooks/wp_privacy_additional_user_profile_data)
Filters the user’s profile data for the privacy exporter.
| Uses | Description |
| --- | --- |
| [get\_user\_by()](get_user_by) wp-includes/pluggable.php | Retrieves user info by a given field. |
| [maybe\_unserialize()](maybe_unserialize) wp-includes/functions.php | Unserializes data only if it was serialized. |
| [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. |
| [get\_user\_meta()](get_user_meta) wp-includes/user.php | Retrieves user meta field for a user. |
| [\_\_()](__) 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. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| Version | Description |
| --- | --- |
| [5.4.0](https://developer.wordpress.org/reference/since/5.4.0/) | Added 'Session Tokens' group to the export data. |
| [4.9.6](https://developer.wordpress.org/reference/since/4.9.6/) | Introduced. |
| programming_docs |
wordpress xmlrpc_removepostdata( string $content ): string xmlrpc\_removepostdata( string $content ): string
=================================================
XMLRPC XML content without title and category elements.
`$content` string Required XML-RPC XML Request content. string XMLRPC XML Request content without title and category elements.
File: `wp-includes/functions.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/functions.php/)
```
function xmlrpc_removepostdata( $content ) {
$content = preg_replace( '/<title>(.+?)<\/title>/si', '', $content );
$content = preg_replace( '/<category>(.+?)<\/category>/si', '', $content );
$content = trim( $content );
return $content;
}
```
| 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 wp_unique_filename( string $dir, string $filename, callable $unique_filename_callback = null ): string wp\_unique\_filename( string $dir, string $filename, callable $unique\_filename\_callback = null ): string
==========================================================================================================
Gets a filename that is sanitized and unique for the given directory.
If the filename is not unique, then a number will be added to the filename before the extension, and will continue adding numbers until the filename is unique.
The callback function allows the caller to use their own method to create unique file names. If defined, the callback should take three arguments:
* directory, base filename, and extension – and return a unique filename.
`$dir` string Required Directory. `$filename` string Required File name. `$unique_filename_callback` callable Optional Callback. Default: `null`
string New filename, if given wasn't unique.
File: `wp-includes/functions.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/functions.php/)
```
function wp_unique_filename( $dir, $filename, $unique_filename_callback = null ) {
// Sanitize the file name before we begin processing.
$filename = sanitize_file_name( $filename );
$ext2 = null;
// Initialize vars used in the wp_unique_filename filter.
$number = '';
$alt_filenames = array();
// Separate the filename into a name and extension.
$ext = pathinfo( $filename, PATHINFO_EXTENSION );
$name = pathinfo( $filename, PATHINFO_BASENAME );
if ( $ext ) {
$ext = '.' . $ext;
}
// Edge case: if file is named '.ext', treat as an empty name.
if ( $name === $ext ) {
$name = '';
}
/*
* Increment the file number until we have a unique file to save in $dir.
* Use callback if supplied.
*/
if ( $unique_filename_callback && is_callable( $unique_filename_callback ) ) {
$filename = call_user_func( $unique_filename_callback, $dir, $name, $ext );
} else {
$fname = pathinfo( $filename, PATHINFO_FILENAME );
// Always append a number to file names that can potentially match image sub-size file names.
if ( $fname && preg_match( '/-(?:\d+x\d+|scaled|rotated)$/', $fname ) ) {
$number = 1;
// At this point the file name may not be unique. This is tested below and the $number is incremented.
$filename = str_replace( "{$fname}{$ext}", "{$fname}-{$number}{$ext}", $filename );
}
/*
* Get the mime type. Uploaded files were already checked with wp_check_filetype_and_ext()
* in _wp_handle_upload(). Using wp_check_filetype() would be sufficient here.
*/
$file_type = wp_check_filetype( $filename );
$mime_type = $file_type['type'];
$is_image = ( ! empty( $mime_type ) && 0 === strpos( $mime_type, 'image/' ) );
$upload_dir = wp_get_upload_dir();
$lc_filename = null;
$lc_ext = strtolower( $ext );
$_dir = trailingslashit( $dir );
/*
* If the extension is uppercase add an alternate file name with lowercase extension.
* Both need to be tested for uniqueness as the extension will be changed to lowercase
* for better compatibility with different filesystems. Fixes an inconsistency in WP < 2.9
* where uppercase extensions were allowed but image sub-sizes were created with
* lowercase extensions.
*/
if ( $ext && $lc_ext !== $ext ) {
$lc_filename = preg_replace( '|' . preg_quote( $ext ) . '$|', $lc_ext, $filename );
}
/*
* Increment the number added to the file name if there are any files in $dir
* whose names match one of the possible name variations.
*/
while ( file_exists( $_dir . $filename ) || ( $lc_filename && file_exists( $_dir . $lc_filename ) ) ) {
$new_number = (int) $number + 1;
if ( $lc_filename ) {
$lc_filename = str_replace(
array( "-{$number}{$lc_ext}", "{$number}{$lc_ext}" ),
"-{$new_number}{$lc_ext}",
$lc_filename
);
}
if ( '' === "{$number}{$ext}" ) {
$filename = "{$filename}-{$new_number}";
} else {
$filename = str_replace(
array( "-{$number}{$ext}", "{$number}{$ext}" ),
"-{$new_number}{$ext}",
$filename
);
}
$number = $new_number;
}
// Change the extension to lowercase if needed.
if ( $lc_filename ) {
$filename = $lc_filename;
}
/*
* Prevent collisions with existing file names that contain dimension-like strings
* (whether they are subsizes or originals uploaded prior to #42437).
*/
$files = array();
$count = 10000;
// The (resized) image files would have name and extension, and will be in the uploads dir.
if ( $name && $ext && @is_dir( $dir ) && false !== strpos( $dir, $upload_dir['basedir'] ) ) {
/**
* Filters the file list used for calculating a unique filename for a newly added file.
*
* Returning an array from the filter will effectively short-circuit retrieval
* from the filesystem and return the passed value instead.
*
* @since 5.5.0
*
* @param array|null $files The list of files to use for filename comparisons.
* Default null (to retrieve the list from the filesystem).
* @param string $dir The directory for the new file.
* @param string $filename The proposed filename for the new file.
*/
$files = apply_filters( 'pre_wp_unique_filename_file_list', null, $dir, $filename );
if ( null === $files ) {
// List of all files and directories contained in $dir.
$files = @scandir( $dir );
}
if ( ! empty( $files ) ) {
// Remove "dot" dirs.
$files = array_diff( $files, array( '.', '..' ) );
}
if ( ! empty( $files ) ) {
$count = count( $files );
/*
* Ensure this never goes into infinite loop as it uses pathinfo() and regex in the check,
* but string replacement for the changes.
*/
$i = 0;
while ( $i <= $count && _wp_check_existing_file_names( $filename, $files ) ) {
$new_number = (int) $number + 1;
// If $ext is uppercase it was replaced with the lowercase version after the previous loop.
$filename = str_replace(
array( "-{$number}{$lc_ext}", "{$number}{$lc_ext}" ),
"-{$new_number}{$lc_ext}",
$filename
);
$number = $new_number;
$i++;
}
}
}
/*
* Check if an image will be converted after uploading or some existing image sub-size file names may conflict
* when regenerated. If yes, ensure the new file name will be unique and will produce unique sub-sizes.
*/
if ( $is_image ) {
/** This filter is documented in wp-includes/class-wp-image-editor.php */
$output_formats = apply_filters( 'image_editor_output_format', array(), $_dir . $filename, $mime_type );
$alt_types = array();
if ( ! empty( $output_formats[ $mime_type ] ) ) {
// The image will be converted to this format/mime type.
$alt_mime_type = $output_formats[ $mime_type ];
// Other types of images whose names may conflict if their sub-sizes are regenerated.
$alt_types = array_keys( array_intersect( $output_formats, array( $mime_type, $alt_mime_type ) ) );
$alt_types[] = $alt_mime_type;
} elseif ( ! empty( $output_formats ) ) {
$alt_types = array_keys( array_intersect( $output_formats, array( $mime_type ) ) );
}
// Remove duplicates and the original mime type. It will be added later if needed.
$alt_types = array_unique( array_diff( $alt_types, array( $mime_type ) ) );
foreach ( $alt_types as $alt_type ) {
$alt_ext = wp_get_default_extension_for_mime_type( $alt_type );
if ( ! $alt_ext ) {
continue;
}
$alt_ext = ".{$alt_ext}";
$alt_filename = preg_replace( '|' . preg_quote( $lc_ext ) . '$|', $alt_ext, $filename );
$alt_filenames[ $alt_ext ] = $alt_filename;
}
if ( ! empty( $alt_filenames ) ) {
/*
* Add the original filename. It needs to be checked again
* together with the alternate filenames when $number is incremented.
*/
$alt_filenames[ $lc_ext ] = $filename;
// Ensure no infinite loop.
$i = 0;
while ( $i <= $count && _wp_check_alternate_file_names( $alt_filenames, $_dir, $files ) ) {
$new_number = (int) $number + 1;
foreach ( $alt_filenames as $alt_ext => $alt_filename ) {
$alt_filenames[ $alt_ext ] = str_replace(
array( "-{$number}{$alt_ext}", "{$number}{$alt_ext}" ),
"-{$new_number}{$alt_ext}",
$alt_filename
);
}
/*
* Also update the $number in (the output) $filename.
* If the extension was uppercase it was already replaced with the lowercase version.
*/
$filename = str_replace(
array( "-{$number}{$lc_ext}", "{$number}{$lc_ext}" ),
"-{$new_number}{$lc_ext}",
$filename
);
$number = $new_number;
$i++;
}
}
}
}
/**
* Filters the result when generating a unique file name.
*
* @since 4.5.0
* @since 5.8.1 The `$alt_filenames` and `$number` parameters were added.
*
* @param string $filename Unique file name.
* @param string $ext File extension. Example: ".png".
* @param string $dir Directory path.
* @param callable|null $unique_filename_callback Callback function that generates the unique file name.
* @param string[] $alt_filenames Array of alternate file names that were checked for collisions.
* @param int|string $number The highest number that was used to make the file name unique
* or an empty string if unused.
*/
return apply_filters( 'wp_unique_filename', $filename, $ext, $dir, $unique_filename_callback, $alt_filenames, $number );
}
```
[apply\_filters( 'image\_editor\_output\_format', string[] $output\_format, string $filename, string $mime\_type )](../hooks/image_editor_output_format)
Filters the image editor output format mapping.
[apply\_filters( 'pre\_wp\_unique\_filename\_file\_list', array|null $files, string $dir, string $filename )](../hooks/pre_wp_unique_filename_file_list)
Filters the file list used for calculating a unique filename for a newly added file.
[apply\_filters( 'wp\_unique\_filename', string $filename, string $ext, string $dir, callable|null $unique\_filename\_callback, string[] $alt\_filenames, int|string $number )](../hooks/wp_unique_filename)
Filters the result when generating a unique file name.
| Uses | Description |
| --- | --- |
| [wp\_get\_default\_extension\_for\_mime\_type()](wp_get_default_extension_for_mime_type) wp-includes/functions.php | Returns first matched extension for the mime-type, as mapped from [wp\_get\_mime\_types()](wp_get_mime_types) . |
| [\_wp\_check\_alternate\_file\_names()](_wp_check_alternate_file_names) wp-includes/functions.php | Helper function to test if each of an array of file names could conflict with existing files. |
| [\_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. |
| [wp\_get\_upload\_dir()](wp_get_upload_dir) wp-includes/functions.php | Retrieves uploads directory information. |
| [sanitize\_file\_name()](sanitize_file_name) wp-includes/formatting.php | Sanitizes a filename, replacing whitespace with dashes. |
| [wp\_check\_filetype()](wp_check_filetype) wp-includes/functions.php | Retrieves the file type from the file name. |
| [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. |
| [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\_handle\_upload()](_wp_handle_upload) wp-admin/includes/file.php | Handles PHP uploads in WordPress. |
| [\_copy\_image\_file()](_copy_image_file) wp-admin/includes/image.php | Copies an existing image file. |
| [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\_crop\_image()](wp_crop_image) wp-admin/includes/image.php | Crops an image to a given size. |
| [wp\_tempnam()](wp_tempnam) wp-admin/includes/file.php | Returns a filename of a temporary unique file. |
| [wp\_upload\_bits()](wp_upload_bits) wp-includes/functions.php | Creates a file in the upload folder with given content. |
| Version | Description |
| --- | --- |
| [2.5.0](https://developer.wordpress.org/reference/since/2.5.0/) | Introduced. |
wordpress wp_reschedule_event( int $timestamp, string $recurrence, string $hook, array $args = array(), bool $wp_error = false ): bool|WP_Error wp\_reschedule\_event( int $timestamp, string $recurrence, string $hook, array $args = array(), bool $wp\_error = false ): bool|WP\_Error
=========================================================================================================================================
Reschedules a recurring event.
Mainly for internal use, this takes the UTC timestamp of a previously run recurring event and reschedules it for its next run.
To change upcoming scheduled events, use [wp\_schedule\_event()](wp_schedule_event) to change the recurrence frequency.
`$timestamp` int Required Unix timestamp (UTC) for when the event was scheduled. `$recurrence` string Required How often the event should subsequently recur.
See [wp\_get\_schedules()](wp_get_schedules) for accepted values. `$hook` string Required Action hook to execute when the event is run. `$args` array Optional Array containing arguments to pass to the hook's callback function. Each value in the array is passed to the callback as an individual parameter.
The array keys are ignored. 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 rescheduled. False or [WP\_Error](../classes/wp_error) on failure.
File: `wp-includes/cron.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/cron.php/)
```
function wp_reschedule_event( $timestamp, $recurrence, $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;
}
$schedules = wp_get_schedules();
$interval = 0;
// First we try to get the interval from the schedule.
if ( isset( $schedules[ $recurrence ] ) ) {
$interval = $schedules[ $recurrence ]['interval'];
}
// Now we try to get it from the saved interval in case the schedule disappears.
if ( 0 === $interval ) {
$scheduled_event = wp_get_scheduled_event( $hook, $args, $timestamp );
if ( $scheduled_event && isset( $scheduled_event->interval ) ) {
$interval = $scheduled_event->interval;
}
}
$event = (object) array(
'hook' => $hook,
'timestamp' => $timestamp,
'schedule' => $recurrence,
'args' => $args,
'interval' => $interval,
);
/**
* Filter to preflight or hijack rescheduling of a recurring event.
*
* Returning a non-null value will short-circuit the normal rescheduling
* process, causing the function to return the filtered value instead.
*
* For plugins replacing wp-cron, return true if the event was successfully
* rescheduled, 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 adding the event.
* @param stdClass $event {
* An object containing an event's data.
*
* @type string $hook Action hook to execute when the event is run.
* @type int $timestamp Unix timestamp (UTC) for when to next run the event.
* @type string $schedule How often the event should subsequently recur.
* @type array $args Array containing each separate argument to pass to the hook's callback function.
* @type int $interval The interval time in seconds for the schedule.
* }
* @param bool $wp_error Whether to return a WP_Error on failure.
*/
$pre = apply_filters( 'pre_reschedule_event', null, $event, $wp_error );
if ( null !== $pre ) {
if ( $wp_error && false === $pre ) {
return new WP_Error(
'pre_reschedule_event_false',
__( 'A plugin prevented the event from being rescheduled.' )
);
}
if ( ! $wp_error && is_wp_error( $pre ) ) {
return false;
}
return $pre;
}
// Now we assume something is wrong and fail to schedule.
if ( 0 == $interval ) {
if ( $wp_error ) {
return new WP_Error(
'invalid_schedule',
__( 'Event schedule does not exist.' )
);
}
return false;
}
$now = time();
if ( $timestamp >= $now ) {
$timestamp = $now + $interval;
} else {
$timestamp = $now + ( $interval - ( ( $now - $timestamp ) % $interval ) );
}
return wp_schedule_event( $timestamp, $recurrence, $hook, $args, $wp_error );
}
```
[apply\_filters( 'pre\_reschedule\_event', null|bool|WP\_Error $pre, stdClass $event, bool $wp\_error )](../hooks/pre_reschedule_event)
Filter to preflight or hijack rescheduling of a recurring event.
| Uses | Description |
| --- | --- |
| [wp\_get\_scheduled\_event()](wp_get_scheduled_event) wp-includes/cron.php | Retrieve a scheduled event. |
| [wp\_get\_schedules()](wp_get_schedules) wp-includes/cron.php | Retrieve supported event recurrence schedules. |
| [wp\_schedule\_event()](wp_schedule_event) wp-includes/cron.php | Schedules a recurring event. |
| [\_\_()](__) 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. |
| 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\_reschedule\_event'](../hooks/pre_reschedule_event) filter added to short-circuit the function. |
| [2.1.0](https://developer.wordpress.org/reference/since/2.1.0/) | Introduced. |
| programming_docs |
wordpress add_ping( int|WP_Post $post, string|array $uri ): int|false add\_ping( int|WP\_Post $post, string|array $uri ): int|false
=============================================================
Adds a URL to those already pinged.
`$post` int|[WP\_Post](../classes/wp_post) Required Post ID or post object. `$uri` string|array Required Ping URI or array of URIs. int|false How many rows were updated.
File: `wp-includes/post.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/post.php/)
```
function add_ping( $post, $uri ) {
global $wpdb;
$post = get_post( $post );
if ( ! $post ) {
return false;
}
$pung = trim( $post->pinged );
$pung = preg_split( '/\s/', $pung );
if ( is_array( $uri ) ) {
$pung = array_merge( $pung, $uri );
} else {
$pung[] = $uri;
}
$new = implode( "\n", $pung );
/**
* Filters the new ping URL to add for the given post.
*
* @since 2.0.0
*
* @param string $new New ping URL to add.
*/
$new = apply_filters( 'add_ping', $new );
$return = $wpdb->update( $wpdb->posts, array( 'pinged' => $new ), array( 'ID' => $post->ID ) );
clean_post_cache( $post->ID );
return $return;
}
```
[apply\_filters( 'add\_ping', string $new )](../hooks/add_ping)
Filters the new ping URL to add for the given post.
| Uses | Description |
| --- | --- |
| [clean\_post\_cache()](clean_post_cache) wp-includes/post.php | Will clean the post in the cache. |
| [wpdb::update()](../classes/wpdb/update) wp-includes/class-wpdb.php | Updates a row in the table. |
| [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 |
| --- | --- |
| [pingback()](pingback) wp-includes/comment.php | Pings back the links found in a post. |
| Version | Description |
| --- | --- |
| [4.7.0](https://developer.wordpress.org/reference/since/4.7.0/) | `$uri` can be an array of URIs. |
| [1.5.0](https://developer.wordpress.org/reference/since/1.5.0/) | Introduced. |
wordpress is_page_template( string|string[] $template = '' ): bool is\_page\_template( string|string[] $template = '' ): bool
==========================================================
Determines whether the current post uses a page template.
This template tag allows you to determine if you are in a page template.
You can optionally provide a template filename or array of template filenames and then the check will be specific to that template.
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.
`$template` string|string[] Optional The specific template filename or array of templates to match. Default: `''`
bool True on success, false on failure.
If the page template is located in a subdirectory of the theme (since WP 3.4), prepend the folder name and a slash to the template filename, e.g.:
```
is_page_template( 'templates/about.php' );
```
Due to certain global variables being overwritten during The Loop `is_page_template()` will not work. In order to use it after The Loop you must call [wp\_reset\_query()](wp_reset_query) after The Loop.
Since the page template slug is stored inside the post\_meta for any post that has been assigned to a page template, it is possible to directly query the post\_meta to see whether any given page has been assigned a page template. This is the method that [is\_page\_template()](is_page_template) uses internally.
The function [get\_page\_template\_slug( $post\_id )](get_page_template_slug "Function Reference/get page template slug") will return the slug of the currently assigned page template (or an empty string if no template has been assigned – or false if the $post\_id does not correspond to an actual page). You can easily use this anywhere (in The Loop, or outside) to determine whether any page has been assigned a page template.
```
// in the loop:
if ( get_page_template_slug( get_the_ID() ) ){
// Yep, this page has a page template
}
// anywhere:
if ( get_page_template_slug( $some_post_ID ) ){
// Uh-huh.
}
```
File: `wp-includes/post-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/post-template.php/)
```
function is_page_template( $template = '' ) {
if ( ! is_singular() ) {
return false;
}
$page_template = get_page_template_slug( get_queried_object_id() );
if ( empty( $template ) ) {
return (bool) $page_template;
}
if ( $template == $page_template ) {
return true;
}
if ( is_array( $template ) ) {
if ( ( in_array( 'default', $template, true ) && ! $page_template )
|| in_array( $page_template, $template, true )
) {
return true;
}
}
return ( 'default' === $template && ! $page_template );
}
```
| 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\_queried\_object\_id()](get_queried_object_id) wp-includes/query.php | Retrieves the ID of the currently queried object. |
| [get\_page\_template\_slug()](get_page_template_slug) wp-includes/post-template.php | Gets the specific template filename for a given post. |
| Used By | Description |
| --- | --- |
| [get\_body\_class()](get_body_class) wp-includes/post-template.php | Retrieves an array of the class names for the body element. |
| Version | Description |
| --- | --- |
| [4.7.0](https://developer.wordpress.org/reference/since/4.7.0/) | Now works with any post type, not just pages. |
| [4.2.0](https://developer.wordpress.org/reference/since/4.2.0/) | The `$template` parameter was changed to also accept an array of page templates. |
| [2.5.0](https://developer.wordpress.org/reference/since/2.5.0/) | Introduced. |
wordpress _wp_customize_publish_changeset( string $new_status, string $old_status, WP_Post $changeset_post ) \_wp\_customize\_publish\_changeset( string $new\_status, string $old\_status, WP\_Post $changeset\_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.
Publishes a snapshot’s changes.
`$new_status` string Required New post status. `$old_status` string Required Old post status. `$changeset_post` [WP\_Post](../classes/wp_post) Required Changeset post object. File: `wp-includes/theme.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/theme.php/)
```
function _wp_customize_publish_changeset( $new_status, $old_status, $changeset_post ) {
global $wp_customize, $wpdb;
$is_publishing_changeset = (
'customize_changeset' === $changeset_post->post_type
&&
'publish' === $new_status
&&
'publish' !== $old_status
);
if ( ! $is_publishing_changeset ) {
return;
}
if ( empty( $wp_customize ) ) {
require_once ABSPATH . WPINC . '/class-wp-customize-manager.php';
$wp_customize = new WP_Customize_Manager(
array(
'changeset_uuid' => $changeset_post->post_name,
'settings_previewed' => false,
)
);
}
if ( ! did_action( 'customize_register' ) ) {
/*
* When running from CLI or Cron, the customize_register action will need
* to be triggered in order for core, themes, and plugins to register their
* settings. Normally core will add_action( 'customize_register' ) at
* priority 10 to register the core settings, and if any themes/plugins
* also add_action( 'customize_register' ) at the same priority, they
* will have a $wp_customize with those settings registered since they
* call add_action() afterward, normally. However, when manually doing
* the customize_register action after the setup_theme, then the order
* will be reversed for two actions added at priority 10, resulting in
* the core settings no longer being available as expected to themes/plugins.
* So the following manually calls the method that registers the core
* settings up front before doing the action.
*/
remove_action( 'customize_register', array( $wp_customize, 'register_controls' ) );
$wp_customize->register_controls();
/** This filter is documented in /wp-includes/class-wp-customize-manager.php */
do_action( 'customize_register', $wp_customize );
}
$wp_customize->_publish_changeset_values( $changeset_post->ID );
/*
* Trash the changeset post if revisions are not enabled. Unpublished
* changesets by default get garbage collected due to the auto-draft status.
* When a changeset post is published, however, it would no longer get cleaned
* out. This is a problem when the changeset posts are never displayed anywhere,
* since they would just be endlessly piling up. So here we use the revisions
* feature to indicate whether or not a published changeset should get trashed
* and thus garbage collected.
*/
if ( ! wp_revisions_enabled( $changeset_post ) ) {
$wp_customize->trash_changeset_post( $changeset_post->ID );
}
}
```
[do\_action( 'customize\_register', WP\_Customize\_Manager $manager )](../hooks/customize_register)
Fires once WordPress has loaded, allowing scripts and styles to be initialized.
| Uses | Description |
| --- | --- |
| [WP\_Customize\_Manager::\_\_construct()](../classes/wp_customize_manager/__construct) wp-includes/class-wp-customize-manager.php | Constructor. |
| [remove\_action()](remove_action) wp-includes/plugin.php | Removes a callback function from an action hook. |
| [did\_action()](did_action) wp-includes/plugin.php | Retrieves the number of times an action has been fired during the current request. |
| [wp\_revisions\_enabled()](wp_revisions_enabled) wp-includes/revision.php | Determines whether revisions are enabled for a given post. |
| [do\_action()](do_action) wp-includes/plugin.php | Calls the callback functions that have been added to an action hook. |
| Version | Description |
| --- | --- |
| [4.7.0](https://developer.wordpress.org/reference/since/4.7.0/) | Introduced. |
wordpress get_comments_link( int|WP_Post $post ): string get\_comments\_link( int|WP\_Post $post ): string
=================================================
Retrieves the link to the current post comments.
`$post` int|[WP\_Post](../classes/wp_post) Optional Post ID or [WP\_Post](../classes/wp_post) object. Default is global $post. string The link to the comments.
File: `wp-includes/comment-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/comment-template.php/)
```
function get_comments_link( $post = 0 ) {
$hash = get_comments_number( $post ) ? '#comments' : '#respond';
$comments_link = get_permalink( $post ) . $hash;
/**
* Filters the returned post comments permalink.
*
* @since 3.6.0
*
* @param string $comments_link Post comments permalink with '#comments' appended.
* @param int|WP_Post $post Post ID or WP_Post object.
*/
return apply_filters( 'get_comments_link', $comments_link, $post );
}
```
[apply\_filters( 'get\_comments\_link', string $comments\_link, int|WP\_Post $post )](../hooks/get_comments_link)
Filters the returned post comments permalink.
| Uses | Description |
| --- | --- |
| [get\_comments\_number()](get_comments_number) wp-includes/comment-template.php | Retrieves the amount of comments a post has. |
| [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. |
| Used By | Description |
| --- | --- |
| [comments\_link\_feed()](comments_link_feed) wp-includes/feed.php | Outputs the link to the comments for the current post in an XML safe way. |
| [comments\_link()](comments_link) wp-includes/comment-template.php | Displays the link to the current post comments. |
| Version | Description |
| --- | --- |
| [1.5.0](https://developer.wordpress.org/reference/since/1.5.0/) | Introduced. |
wordpress get_comment_author_url( int|WP_Comment $comment_ID ): string get\_comment\_author\_url( int|WP\_Comment $comment\_ID ): string
=================================================================
Retrieves 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 get the author's URL.
Default current comment. string Comment author URL, if provided, an empty string otherwise.
File: `wp-includes/comment-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/comment-template.php/)
```
function get_comment_author_url( $comment_ID = 0 ) {
$comment = get_comment( $comment_ID );
$url = '';
$id = 0;
if ( ! empty( $comment ) ) {
$author_url = ( 'http://' === $comment->comment_author_url ) ? '' : $comment->comment_author_url;
$url = esc_url( $author_url, array( 'http', 'https' ) );
$id = $comment->comment_ID;
}
/**
* Filters the comment author's URL.
*
* @since 1.5.0
* @since 4.1.0 The `$comment_ID` and `$comment` parameters were added.
*
* @param string $url The comment author's URL, or an empty string.
* @param string|int $comment_ID The comment ID as a numeric string, or 0 if not found.
* @param WP_Comment|null $comment The comment object, or null if not found.
*/
return apply_filters( 'get_comment_author_url', $url, $id, $comment );
}
```
[apply\_filters( 'get\_comment\_author\_url', string $url, string|int $comment\_ID, WP\_Comment|null $comment )](../hooks/get_comment_author_url)
Filters the comment author’s URL.
| 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. |
| [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 | |
| [comment\_author\_url()](comment_author_url) wp-includes/comment-template.php | Displays the URL of the author of the current comment, not linked. |
| [get\_comment\_author\_url\_link()](get_comment_author_url_link) wp-includes/comment-template.php | Retrieves the HTML link of the URL of the author of the current comment. |
| [get\_comment\_author\_link()](get_comment_author_link) wp-includes/comment-template.php | Retrieves the HTML link to the URL of the author 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 _wp_credits_build_object_link( string $data ) \_wp\_credits\_build\_object\_link( string $data )
==================================================
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.
Retrieve the link to an external library used in WordPress.
`$data` string Required External library data (passed by reference). File: `wp-admin/includes/credits.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/credits.php/)
```
function _wp_credits_build_object_link( &$data ) {
$data = '<a href="' . esc_url( $data[1] ) . '">' . esc_html( $data[0] ) . '</a>';
}
```
| Uses | Description |
| --- | --- |
| [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. |
| Version | Description |
| --- | --- |
| [3.2.0](https://developer.wordpress.org/reference/since/3.2.0/) | Introduced. |
wordpress single_month_title( string $prefix = '', bool $display = true ): string|false|void single\_month\_title( string $prefix = '', bool $display = true ): string|false|void
====================================================================================
Displays or retrieves page title for post archive based on date.
Useful for when the template only needs to display the month and year, if either are available. The prefix does not automatically place a space between the prefix, so if there should be a space, the parameter value will need to have it at the end.
`$prefix` string Optional What to display before the title. Default: `''`
`$display` bool Optional Whether to display or retrieve title. Default: `true`
string|false|void False if there's no valid title for the month. Title when retrieving.
* This tag only works when the `m` or archive month argument has been passed by WordPress to the current page (this occurs when viewing a monthly archive page).
* This tag works only on date archive pages, not on category templates or others.
* It does not support placing the separator after the title, but by leaving the prefix parameter empty, you can set the title separator manually.
File: `wp-includes/general-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/general-template.php/)
```
function single_month_title( $prefix = '', $display = true ) {
global $wp_locale;
$m = get_query_var( 'm' );
$year = get_query_var( 'year' );
$monthnum = get_query_var( 'monthnum' );
if ( ! empty( $monthnum ) && ! empty( $year ) ) {
$my_year = $year;
$my_month = $wp_locale->get_month( $monthnum );
} elseif ( ! empty( $m ) ) {
$my_year = substr( $m, 0, 4 );
$my_month = $wp_locale->get_month( substr( $m, 4, 2 ) );
}
if ( empty( $my_month ) ) {
return false;
}
$result = $prefix . $my_month . $prefix . $my_year;
if ( ! $display ) {
return $result;
}
echo $result;
}
```
| 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. |
| [WP\_Locale::get\_month()](../classes/wp_locale/get_month) wp-includes/class-wp-locale.php | Retrieves the full translated month by month number. |
| Version | Description |
| --- | --- |
| [0.71](https://developer.wordpress.org/reference/since/0.71/) | Introduced. |
wordpress print_embed_sharing_dialog() print\_embed\_sharing\_dialog()
===============================
Prints the necessary markup for the embed sharing dialog.
File: `wp-includes/embed.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/embed.php/)
```
function print_embed_sharing_dialog() {
if ( is_404() ) {
return;
}
$unique_suffix = get_the_ID() . '-' . wp_rand();
$share_tab_wordpress_id = 'wp-embed-share-tab-wordpress-' . $unique_suffix;
$share_tab_html_id = 'wp-embed-share-tab-html-' . $unique_suffix;
$description_wordpress_id = 'wp-embed-share-description-wordpress-' . $unique_suffix;
$description_html_id = 'wp-embed-share-description-html-' . $unique_suffix;
?>
<div class="wp-embed-share-dialog hidden" role="dialog" aria-label="<?php esc_attr_e( 'Sharing options' ); ?>">
<div class="wp-embed-share-dialog-content">
<div class="wp-embed-share-dialog-text">
<ul class="wp-embed-share-tabs" role="tablist">
<li class="wp-embed-share-tab-button wp-embed-share-tab-button-wordpress" role="presentation">
<button type="button" role="tab" aria-controls="<?php echo $share_tab_wordpress_id; ?>" aria-selected="true" tabindex="0"><?php esc_html_e( 'WordPress Embed' ); ?></button>
</li>
<li class="wp-embed-share-tab-button wp-embed-share-tab-button-html" role="presentation">
<button type="button" role="tab" aria-controls="<?php echo $share_tab_html_id; ?>" aria-selected="false" tabindex="-1"><?php esc_html_e( 'HTML Embed' ); ?></button>
</li>
</ul>
<div id="<?php echo $share_tab_wordpress_id; ?>" class="wp-embed-share-tab" role="tabpanel" aria-hidden="false">
<input type="text" value="<?php the_permalink(); ?>" class="wp-embed-share-input" aria-label="<?php esc_attr_e( 'URL' ); ?>" aria-describedby="<?php echo $description_wordpress_id; ?>" tabindex="0" readonly/>
<p class="wp-embed-share-description" id="<?php echo $description_wordpress_id; ?>">
<?php _e( 'Copy and paste this URL into your WordPress site to embed' ); ?>
</p>
</div>
<div id="<?php echo $share_tab_html_id; ?>" class="wp-embed-share-tab" role="tabpanel" aria-hidden="true">
<textarea class="wp-embed-share-input" aria-label="<?php esc_attr_e( 'HTML' ); ?>" aria-describedby="<?php echo $description_html_id; ?>" tabindex="0" readonly><?php echo esc_textarea( get_post_embed_html( 600, 400 ) ); ?></textarea>
<p class="wp-embed-share-description" id="<?php echo $description_html_id; ?>">
<?php _e( 'Copy and paste this code into your site to embed' ); ?>
</p>
</div>
</div>
<button type="button" class="wp-embed-share-dialog-close" aria-label="<?php esc_attr_e( 'Close sharing dialog' ); ?>">
<span class="dashicons dashicons-no"></span>
</button>
</div>
</div>
<?php
}
```
| Uses | Description |
| --- | --- |
| [get\_post\_embed\_html()](get_post_embed_html) wp-includes/embed.php | Retrieves the embed code for a specific post. |
| [esc\_attr\_e()](esc_attr_e) wp-includes/l10n.php | Displays translated text that has been escaped for safe use in an attribute. |
| [esc\_html\_e()](esc_html_e) wp-includes/l10n.php | Displays translated text that has been escaped for safe use in HTML output. |
| [esc\_textarea()](esc_textarea) wp-includes/formatting.php | Escaping for textarea values. |
| [wp\_rand()](wp_rand) wp-includes/pluggable.php | Generates a random non-negative number. |
| [is\_404()](is_404) wp-includes/query.php | Determines whether the query has resulted in a 404 (returns no results). |
| [the\_permalink()](the_permalink) wp-includes/link-template.php | Displays the permalink for the current post. |
| [get\_the\_ID()](get_the_id) wp-includes/post-template.php | Retrieves the ID of the current item in the WordPress Loop. |
| [\_e()](_e) wp-includes/l10n.php | Displays translated text. |
| Version | Description |
| --- | --- |
| [4.4.0](https://developer.wordpress.org/reference/since/4.4.0/) | Introduced. |
| programming_docs |
wordpress wp_cache_set_multiple( array $data, string $group = '', int $expire ): bool[] wp\_cache\_set\_multiple( array $data, string $group = '', int $expire ): bool[]
================================================================================
Sets multiple values to the cache in one call.
* [WP\_Object\_Cache::set\_multiple()](../classes/wp_object_cache/set_multiple)
`$data` array Required Array of keys and values to be set. `$group` string Optional Where the cache contents are grouped. Default: `''`
`$expire` int Optional When to expire the cache contents, in seconds.
Default 0 (no expiration). bool[] Array of return values, grouped by key. Each value is either true on success, or 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_multiple( array $data, $group = '', $expire = 0 ) {
global $wp_object_cache;
return $wp_object_cache->set_multiple( $data, $group, $expire );
}
```
| Uses | Description |
| --- | --- |
| [WP\_Object\_Cache::set\_multiple()](../classes/wp_object_cache/set_multiple) wp-includes/class-wp-object-cache.php | Sets multiple values to the cache in one call. |
| Used By | Description |
| --- | --- |
| [WP\_Comment\_Query::fill\_descendants()](../classes/wp_comment_query/fill_descendants) wp-includes/class-wp-comment-query.php | Fetch descendants for located comments. |
| [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. |
| Version | Description |
| --- | --- |
| [6.0.0](https://developer.wordpress.org/reference/since/6.0.0/) | Introduced. |
wordpress wp_filter_oembed_iframe_title_attribute( string $result, object $data, string $url ): string wp\_filter\_oembed\_iframe\_title\_attribute( string $result, object $data, string $url ): string
=================================================================================================
Filters the given oEmbed HTML to make sure iframes have a title attribute.
`$result` string Required The oEmbed HTML result. `$data` object Required A data object result from an oEmbed provider. `$url` string Required The URL of the content to be embedded. string The filtered oEmbed result.
File: `wp-includes/embed.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/embed.php/)
```
function wp_filter_oembed_iframe_title_attribute( $result, $data, $url ) {
if ( false === $result || ! in_array( $data->type, array( 'rich', 'video' ), true ) ) {
return $result;
}
$title = ! empty( $data->title ) ? $data->title : '';
$pattern = '`<iframe([^>]*)>`i';
if ( preg_match( $pattern, $result, $matches ) ) {
$attrs = wp_kses_hair( $matches[1], wp_allowed_protocols() );
foreach ( $attrs as $attr => $item ) {
$lower_attr = strtolower( $attr );
if ( $lower_attr === $attr ) {
continue;
}
if ( ! isset( $attrs[ $lower_attr ] ) ) {
$attrs[ $lower_attr ] = $item;
unset( $attrs[ $attr ] );
}
}
}
if ( ! empty( $attrs['title']['value'] ) ) {
$title = $attrs['title']['value'];
}
/**
* Filters the title attribute of the given oEmbed HTML iframe.
*
* @since 5.2.0
*
* @param string $title The title attribute.
* @param string $result The oEmbed HTML result.
* @param object $data A data object result from an oEmbed provider.
* @param string $url The URL of the content to be embedded.
*/
$title = apply_filters( 'oembed_iframe_title_attribute', $title, $result, $data, $url );
if ( '' === $title ) {
return $result;
}
if ( isset( $attrs['title'] ) ) {
unset( $attrs['title'] );
$attr_string = implode( ' ', wp_list_pluck( $attrs, 'whole' ) );
$result = str_replace( $matches[0], '<iframe ' . trim( $attr_string ) . '>', $result );
}
return str_ireplace( '<iframe ', sprintf( '<iframe title="%s" ', esc_attr( $title ) ), $result );
}
```
[apply\_filters( 'oembed\_iframe\_title\_attribute', string $title, string $result, object $data, string $url )](../hooks/oembed_iframe_title_attribute)
Filters the title attribute of the given oEmbed HTML iframe.
| Uses | Description |
| --- | --- |
| [wp\_allowed\_protocols()](wp_allowed_protocols) wp-includes/functions.php | Retrieves a list of protocols to allow in HTML attributes. |
| [wp\_kses\_hair()](wp_kses_hair) wp-includes/kses.php | Builds an attribute list from string containing attributes. |
| [wp\_list\_pluck()](wp_list_pluck) wp-includes/functions.php | Plucks a certain field out of each object or array in an array. |
| [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.2.0](https://developer.wordpress.org/reference/since/5.2.0/) | Introduced. |
wordpress is_serialized_string( string $data ): bool is\_serialized\_string( string $data ): bool
============================================
Checks whether serialized data is of string type.
`$data` string Required Serialized data. bool False if not a serialized string, true if it is.
File: `wp-includes/functions.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/functions.php/)
```
function is_serialized_string( $data ) {
// if it isn't a string, it isn't a serialized string.
if ( ! is_string( $data ) ) {
return false;
}
$data = trim( $data );
if ( strlen( $data ) < 4 ) {
return false;
} elseif ( ':' !== $data[1] ) {
return false;
} elseif ( ';' !== substr( $data, -1 ) ) {
return false;
} elseif ( 's' !== $data[0] ) {
return false;
} elseif ( '"' !== substr( $data, -2, 1 ) ) {
return false;
} else {
return true;
}
}
```
| Used By | Description |
| --- | --- |
| [\_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. |
| Version | Description |
| --- | --- |
| [2.0.5](https://developer.wordpress.org/reference/since/2.0.5/) | Introduced. |
wordpress get_template_hierarchy( string $slug, boolean $is_custom = false, string $template_prefix = '' ): string[] get\_template\_hierarchy( string $slug, boolean $is\_custom = false, string $template\_prefix = '' ): string[]
==============================================================================================================
Gets the template hierarchy for the given template slug to be created.
Note: Always add `index` as the last fallback template.
`$slug` string Required The template slug to be created. `$is_custom` boolean Optional Indicates if a template is custom or part of the template hierarchy. Default: `false`
`$template_prefix` string Optional The template prefix for the created template.
Used to extract the main template type, e.g.
in `taxonomy-books` the `taxonomy` is extracted.
Default: `''`
string[] The template hierarchy.
File: `wp-includes/block-template-utils.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/block-template-utils.php/)
```
function get_template_hierarchy( $slug, $is_custom = false, $template_prefix = '' ) {
if ( 'index' === $slug ) {
return array( 'index' );
}
if ( $is_custom ) {
return array( 'page', 'singular', 'index' );
}
if ( 'front-page' === $slug ) {
return array( 'front-page', 'home', 'index' );
}
$template_hierarchy = array( $slug );
// Most default templates don't have `$template_prefix` assigned.
if ( $template_prefix ) {
list( $type ) = explode( '-', $template_prefix );
// These checks are needed because the `$slug` above is always added.
if ( ! in_array( $template_prefix, array( $slug, $type ), true ) ) {
$template_hierarchy[] = $template_prefix;
}
if ( $slug !== $type ) {
$template_hierarchy[] = $type;
}
}
// Handle `archive` template.
if (
str_starts_with( $slug, 'author' ) ||
str_starts_with( $slug, 'taxonomy' ) ||
str_starts_with( $slug, 'category' ) ||
str_starts_with( $slug, 'tag' ) ||
'date' === $slug
) {
$template_hierarchy[] = 'archive';
}
// Handle `single` template.
if ( 'attachment' === $slug ) {
$template_hierarchy[] = 'single';
}
// Handle `singular` template.
if (
str_starts_with( $slug, 'single' ) ||
str_starts_with( $slug, 'page' ) ||
'attachment' === $slug
) {
$template_hierarchy[] = 'singular';
}
$template_hierarchy[] = 'index';
return $template_hierarchy;
};
```
| Used By | Description |
| --- | --- |
| [WP\_REST\_Templates\_Controller::get\_template\_fallback()](../classes/wp_rest_templates_controller/get_template_fallback) wp-includes/rest-api/endpoints/class-wp-rest-templates-controller.php | Returns the fallback template for the given slug. |
| Version | Description |
| --- | --- |
| [6.1.0](https://developer.wordpress.org/reference/since/6.1.0/) | Introduced. |
wordpress wp_get_media_creation_timestamp( array $metadata ): int|false wp\_get\_media\_creation\_timestamp( array $metadata ): int|false
=================================================================
Parses creation date from media metadata.
The getID3 library doesn’t have a standard method for getting creation dates, so the location of this data can vary based on the MIME type.
`$metadata` array Required The metadata returned by getID3::analyze(). int|false A UNIX timestamp for the media's creation date if available or a boolean FALSE if a timestamp could not be determined.
File: `wp-admin/includes/media.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/media.php/)
```
function wp_get_media_creation_timestamp( $metadata ) {
$creation_date = false;
if ( empty( $metadata['fileformat'] ) ) {
return $creation_date;
}
switch ( $metadata['fileformat'] ) {
case 'asf':
if ( isset( $metadata['asf']['file_properties_object']['creation_date_unix'] ) ) {
$creation_date = (int) $metadata['asf']['file_properties_object']['creation_date_unix'];
}
break;
case 'matroska':
case 'webm':
if ( isset( $metadata['matroska']['comments']['creation_time'][0] ) ) {
$creation_date = strtotime( $metadata['matroska']['comments']['creation_time'][0] );
} elseif ( isset( $metadata['matroska']['info'][0]['DateUTC_unix'] ) ) {
$creation_date = (int) $metadata['matroska']['info'][0]['DateUTC_unix'];
}
break;
case 'quicktime':
case 'mp4':
if ( isset( $metadata['quicktime']['moov']['subatoms'][0]['creation_time_unix'] ) ) {
$creation_date = (int) $metadata['quicktime']['moov']['subatoms'][0]['creation_time_unix'];
}
break;
}
return $creation_date;
}
```
| 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 |
| --- | --- |
| [4.9.0](https://developer.wordpress.org/reference/since/4.9.0/) | Introduced. |
wordpress _wp_preview_terms_filter( array $terms, int $post_id, string $taxonomy ): array \_wp\_preview\_terms\_filter( array $terms, int $post\_id, string $taxonomy ): 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 terms lookup to set the post format.
`$terms` array Required `$post_id` int Required `$taxonomy` string Required array
File: `wp-includes/revision.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/revision.php/)
```
function _wp_preview_terms_filter( $terms, $post_id, $taxonomy ) {
$post = get_post();
if ( ! $post ) {
return $terms;
}
if ( empty( $_REQUEST['post_format'] ) || $post->ID != $post_id
|| 'post_format' !== $taxonomy || 'revision' === $post->post_type
) {
return $terms;
}
if ( 'standard' === $_REQUEST['post_format'] ) {
$terms = array();
} else {
$term = get_term_by( 'slug', 'post-format-' . sanitize_key( $_REQUEST['post_format'] ), 'post_format' );
if ( $term ) {
$terms = array( $term ); // Can only have one post format.
}
}
return $terms;
}
```
| Uses | Description |
| --- | --- |
| [get\_term\_by()](get_term_by) wp-includes/taxonomy.php | Gets all term data from database by term field and data. |
| [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. |
| Version | Description |
| --- | --- |
| [3.6.0](https://developer.wordpress.org/reference/since/3.6.0/) | Introduced. |
wordpress get_the_content_feed( string $feed_type = null ): string get\_the\_content\_feed( string $feed\_type = null ): string
============================================================
Retrieves the post content for feeds.
* [get\_the\_content()](get_the_content)
`$feed_type` string Optional The type of feed. rss2 | atom | rss | rdf Default: `null`
string The filtered content.
File: `wp-includes/feed.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/feed.php/)
```
function get_the_content_feed( $feed_type = null ) {
if ( ! $feed_type ) {
$feed_type = get_default_feed();
}
/** This filter is documented in wp-includes/post-template.php */
$content = apply_filters( 'the_content', get_the_content() );
$content = str_replace( ']]>', ']]>', $content );
/**
* Filters the post content for use in feeds.
*
* @since 2.9.0
*
* @param string $content The current post content.
* @param string $feed_type Type of feed. Possible values include 'rss2', 'atom'.
* Default 'rss2'.
*/
return apply_filters( 'the_content_feed', $content, $feed_type );
}
```
[apply\_filters( 'the\_content', string $content )](../hooks/the_content)
Filters the post content.
[apply\_filters( 'the\_content\_feed', string $content, string $feed\_type )](../hooks/the_content_feed)
Filters the post content for use in feeds.
| Uses | Description |
| --- | --- |
| [get\_the\_content()](get_the_content) wp-includes/post-template.php | Retrieves the post content. |
| [get\_default\_feed()](get_default_feed) wp-includes/feed.php | Retrieves the default feed. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| Used By | Description |
| --- | --- |
| [the\_content\_feed()](the_content_feed) wp-includes/feed.php | Displays the post content for feeds. |
| Version | Description |
| --- | --- |
| [2.9.0](https://developer.wordpress.org/reference/since/2.9.0/) | Introduced. |
wordpress wp_admin_bar_shortlink_menu( WP_Admin_Bar $wp_admin_bar ) wp\_admin\_bar\_shortlink\_menu( WP\_Admin\_Bar $wp\_admin\_bar )
=================================================================
Provides a shortlink.
`$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_shortlink_menu( $wp_admin_bar ) {
$short = wp_get_shortlink( 0, 'query' );
$id = 'get-shortlink';
if ( empty( $short ) ) {
return;
}
$html = '<input class="shortlink-input" type="text" readonly="readonly" value="' . esc_attr( $short ) . '" aria-label="' . __( 'Shortlink' ) . '" />';
$wp_admin_bar->add_node(
array(
'id' => $id,
'title' => __( 'Shortlink' ),
'href' => $short,
'meta' => array( 'html' => $html ),
)
);
}
```
| Uses | Description |
| --- | --- |
| [wp\_get\_shortlink()](wp_get_shortlink) wp-includes/link-template.php | Returns a shortlink for a post, page, attachment, or site. |
| [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-includes/l10n.php | Retrieves the translation of $text. |
| [esc\_attr()](esc_attr) wp-includes/formatting.php | Escaping for HTML attributes. |
| Version | Description |
| --- | --- |
| [3.1.0](https://developer.wordpress.org/reference/since/3.1.0/) | Introduced. |
wordpress wp_is_auto_update_forced_for_item( string $type, bool|null $update, object $item ): bool wp\_is\_auto\_update\_forced\_for\_item( string $type, bool|null $update, object $item ): bool
==============================================================================================
Checks whether auto-updates are forced for an item.
`$type` string Required The type of update being checked: `'theme'` or `'plugin'`. `$update` bool|null Required Whether to update. The value of null is internally used to detect whether nothing has hooked into this filter. `$item` object Required The update offer. bool True if auto-updates are forced for `$item`, false otherwise.
File: `wp-admin/includes/update.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/update.php/)
```
function wp_is_auto_update_forced_for_item( $type, $update, $item ) {
/** This filter is documented in wp-admin/includes/class-wp-automatic-updater.php */
return apply_filters( "auto_update_{$type}", $update, $item );
}
```
[apply\_filters( "auto\_update\_{$type}", bool|null $update, object $item )](../hooks/auto_update_type)
Filters whether to automatically update core, a plugin, a theme, or a language.
| 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\_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\_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\_prepare\_themes\_for\_js()](wp_prepare_themes_for_js) wp-admin/includes/theme.php | Prepares themes for JavaScript. |
| [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 | |
| Version | Description |
| --- | --- |
| [5.6.0](https://developer.wordpress.org/reference/since/5.6.0/) | Introduced. |
wordpress number_format_i18n( float $number, int $decimals ): string number\_format\_i18n( float $number, int $decimals ): string
============================================================
Converts float number to format based on the locale.
`$number` float Required The number to convert based on locale. `$decimals` int Optional Precision of the number of decimal places. Default 0. string Converted number in string format.
**i18n** is an abbreviation for internationalization.
File: `wp-includes/functions.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/functions.php/)
```
function number_format_i18n( $number, $decimals = 0 ) {
global $wp_locale;
if ( isset( $wp_locale ) ) {
$formatted = number_format( $number, absint( $decimals ), $wp_locale->number_format['decimal_point'], $wp_locale->number_format['thousands_sep'] );
} else {
$formatted = number_format( $number, absint( $decimals ) );
}
/**
* Filters the number formatted based on the locale.
*
* @since 2.8.0
* @since 4.9.0 The `$number` and `$decimals` parameters were added.
*
* @param string $formatted Converted number in string format.
* @param float $number The number to convert based on locale.
* @param int $decimals Precision of the number of decimal places.
*/
return apply_filters( 'number_format_i18n', $formatted, $number, $decimals );
}
```
[apply\_filters( 'number\_format\_i18n', string $formatted, float $number, int $decimals )](../hooks/number_format_i18n)
Filters the number formatted based on the locale.
| Uses | Description |
| --- | --- |
| [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 |
| --- | --- |
| [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. |
| [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\_string\_value\_from\_schema()](rest_validate_string_value_from_schema) wp-includes/rest-api.php | Validates a string value based on a schema. |
| [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\_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\_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\_Widget\_Media::display\_media\_state()](../classes/wp_widget_media/display_media_state) wp-includes/widgets/class-wp-widget-media.php | Filters the default media display states for items in the Media 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. |
| [print\_embed\_comments\_button()](print_embed_comments_button) wp-includes/embed.php | Prints the necessary markup for the embed comments button. |
| [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\_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\_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\_MS\_Users\_List\_Table::get\_views()](../classes/wp_ms_users_list_table/get_views) 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\_Plugins\_List\_Table::get\_views()](../classes/wp_plugins_list_table/get_views) wp-admin/includes/class-wp-plugins-list-table.php | |
| [WP\_User\_Search::do\_paging()](../classes/wp_user_search/do_paging) wp-admin/includes/deprecated.php | Handles paging for the user search query. |
| [WP\_List\_Table::ajax\_response()](../classes/wp_list_table/ajax_response) wp-admin/includes/class-wp-list-table.php | Handles an incoming ajax request (called from admin-ajax.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\_MS\_Themes\_List\_Table::get\_views()](../classes/wp_ms_themes_list_table/get_views) wp-admin/includes/class-wp-ms-themes-list-table.php | |
| [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\_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\_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\_star\_rating()](wp_star_rating) wp-admin/includes/template.php | Outputs a HTML element with a star rating for a given rating. |
| [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. |
| [media\_upload\_library\_form()](media_upload_library_form) wp-admin/includes/media.php | Outputs the legacy media upload form for the media library. |
| [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\_ajax\_query\_themes()](wp_ajax_query_themes) wp-admin/includes/ajax-actions.php | Ajax handler for getting themes from [themes\_api()](themes_api) . |
| [\_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. |
| [post\_submit\_meta\_box()](post_submit_meta_box) wp-admin/includes/meta-boxes.php | Displays post submit form fields. |
| [WP\_Comments\_List\_Table::get\_views()](../classes/wp_comments_list_table/get_views) wp-admin/includes/class-wp-comments-list-table.php | |
| [WP\_Terms\_List\_Table::column\_posts()](../classes/wp_terms_list_table/column_posts) wp-admin/includes/class-wp-terms-list-table.php | |
| [WP\_Terms\_List\_Table::column\_links()](../classes/wp_terms_list_table/column_links) wp-admin/includes/class-wp-terms-list-table.php | |
| [WP\_Posts\_List\_Table::get\_views()](../classes/wp_posts_list_table/get_views) wp-admin/includes/class-wp-posts-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. |
| [Walker\_CategoryDropdown::start\_el()](../classes/walker_categorydropdown/start_el) wp-includes/class-walker-category-dropdown.php | Starts the element output. |
| [Walker\_Category::start\_el()](../classes/walker_category/start_el) wp-includes/class-walker-category.php | Starts the element output. |
| [wp\_generate\_tag\_cloud()](wp_generate_tag_cloud) wp-includes/category-template.php | Generates a tag cloud (heatmap) from provided data. |
| [wp\_notify\_moderator()](wp_notify_moderator) wp-includes/pluggable.php | Notifies the moderator of the site about a new comment that is awaiting approval. |
| [paginate\_links()](paginate_links) wp-includes/general-template.php | Retrieves paginated links for archive post pages. |
| [timer\_stop()](timer_stop) wp-includes/load.php | Retrieve or display the time from the page start to when function is called. |
| [size\_format()](size_format) wp-includes/functions.php | Converts a number of bytes to the largest unit the bytes will fit into. |
| [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\_admin\_bar\_updates\_menu()](wp_admin_bar_updates_menu) wp-includes/admin-bar.php | Provides an update link if theme/plugin/core updates are available. |
| [wpmu\_validate\_blog\_signup()](wpmu_validate_blog_signup) wp-includes/ms-functions.php | Processes new site registrations. |
| [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::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 |
| --- | --- |
| [2.3.0](https://developer.wordpress.org/reference/since/2.3.0/) | Introduced. |
| programming_docs |
wordpress file_is_displayable_image( string $path ): bool file\_is\_displayable\_image( string $path ): bool
==================================================
Validates that file is suitable for displaying within a web page.
`$path` string Required File path to test. bool True if suitable, false if not suitable.
File: `wp-admin/includes/image.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/image.php/)
```
function file_is_displayable_image( $path ) {
$displayable_image_types = array( IMAGETYPE_GIF, IMAGETYPE_JPEG, IMAGETYPE_PNG, IMAGETYPE_BMP, IMAGETYPE_ICO, IMAGETYPE_WEBP );
$info = wp_getimagesize( $path );
if ( empty( $info ) ) {
$result = false;
} elseif ( ! in_array( $info[2], $displayable_image_types, true ) ) {
$result = false;
} else {
$result = true;
}
/**
* Filters whether the current image is displayable in the browser.
*
* @since 2.5.0
*
* @param bool $result Whether the image can be displayed. Default true.
* @param string $path Path to the image.
*/
return apply_filters( 'file_is_displayable_image', $result, $path );
}
```
[apply\_filters( 'file\_is\_displayable\_image', bool $result, string $path )](../hooks/file_is_displayable_image)
Filters whether the current image is displayable in the browser.
| Uses | Description |
| --- | --- |
| [wp\_getimagesize()](wp_getimagesize) wp-includes/media.php | Allows PHP’s getimagesize() to be debuggable when necessary. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| Used By | Description |
| --- | --- |
| [wp\_generate\_attachment\_metadata()](wp_generate_attachment_metadata) wp-admin/includes/image.php | Generates attachment meta data and create image sub-sizes for images. |
| Version | Description |
| --- | --- |
| [2.5.0](https://developer.wordpress.org/reference/since/2.5.0/) | Introduced. |
wordpress rest_find_any_matching_schema( mixed $value, array $args, string $param ): array|WP_Error rest\_find\_any\_matching\_schema( mixed $value, array $args, string $param ): array|WP\_Error
==============================================================================================
Finds the matching schema among the “anyOf” schemas.
`$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. array|[WP\_Error](../classes/wp_error) The matching schema or [WP\_Error](../classes/wp_error) instance if all schemas do not match.
File: `wp-includes/rest-api.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/rest-api.php/)
```
function rest_find_any_matching_schema( $value, $args, $param ) {
$errors = array();
foreach ( $args['anyOf'] as $index => $schema ) {
if ( ! isset( $schema['type'] ) && isset( $args['type'] ) ) {
$schema['type'] = $args['type'];
}
$is_valid = rest_validate_value_from_schema( $value, $schema, $param );
if ( ! is_wp_error( $is_valid ) ) {
return $schema;
}
$errors[] = array(
'error_object' => $is_valid,
'schema' => $schema,
'index' => $index,
);
}
return rest_get_combining_operation_error( $value, $param, $errors );
}
```
| Uses | Description |
| --- | --- |
| [rest\_get\_combining\_operation\_error()](rest_get_combining_operation_error) wp-includes/rest-api.php | Gets the error of combining operation. |
| [rest\_validate\_value\_from\_schema()](rest_validate_value_from_schema) wp-includes/rest-api.php | Validate a value based on a schema. |
| [is\_wp\_error()](is_wp_error) wp-includes/load.php | Checks whether the given variable is a WordPress Error. |
| Used By | Description |
| --- | --- |
| [rest\_filter\_response\_by\_context()](rest_filter_response_by_context) wp-includes/rest-api.php | Filters the response to remove any fields not available in the given context. |
| [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. |
| Version | Description |
| --- | --- |
| [5.6.0](https://developer.wordpress.org/reference/since/5.6.0/) | Introduced. |
wordpress use_block_editor_for_post( int|WP_Post $post ): bool use\_block\_editor\_for\_post( int|WP\_Post $post ): bool
=========================================================
Returns whether the post can be edited in the block editor.
`$post` int|[WP\_Post](../classes/wp_post) Required Post ID or [WP\_Post](../classes/wp_post) object. bool Whether the post can be edited in 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( $post ) {
$post = get_post( $post );
if ( ! $post ) {
return false;
}
// We're in the meta box loader, so don't use the block editor.
if ( is_admin() && isset( $_GET['meta-box-loader'] ) ) {
check_admin_referer( 'meta-box-loader', 'meta-box-loader-nonce' );
return false;
}
$use_block_editor = use_block_editor_for_post_type( $post->post_type );
/**
* 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 can be edited or not.
* @param WP_Post $post The post being checked.
*/
return apply_filters( 'use_block_editor_for_post', $use_block_editor, $post );
}
```
[apply\_filters( 'use\_block\_editor\_for\_post', bool $use\_block\_editor, WP\_Post $post )](../hooks/use_block_editor_for_post)
Filters whether a post is able to be edited in the block editor.
| Uses | 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. |
| [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. |
| [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. |
| [get\_post()](get_post) wp-includes/post.php | Retrieves post data given a post ID or post object. |
| Used By | Description |
| --- | --- |
| [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_post_type_archive_link( string $post_type ): string|false get\_post\_type\_archive\_link( string $post\_type ): string|false
==================================================================
Retrieves the permalink for a post type archive.
`$post_type` string Required Post type. string|false The post type archive permalink. False if the post type does not exist or does not have an archive.
File: `wp-includes/link-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/link-template.php/)
```
function get_post_type_archive_link( $post_type ) {
global $wp_rewrite;
$post_type_obj = get_post_type_object( $post_type );
if ( ! $post_type_obj ) {
return false;
}
if ( 'post' === $post_type ) {
$show_on_front = get_option( 'show_on_front' );
$page_for_posts = get_option( 'page_for_posts' );
if ( 'page' === $show_on_front && $page_for_posts ) {
$link = get_permalink( $page_for_posts );
} else {
$link = get_home_url();
}
/** This filter is documented in wp-includes/link-template.php */
return apply_filters( 'post_type_archive_link', $link, $post_type );
}
if ( ! $post_type_obj->has_archive ) {
return false;
}
if ( get_option( 'permalink_structure' ) && is_array( $post_type_obj->rewrite ) ) {
$struct = ( true === $post_type_obj->has_archive ) ? $post_type_obj->rewrite['slug'] : $post_type_obj->has_archive;
if ( $post_type_obj->rewrite['with_front'] ) {
$struct = $wp_rewrite->front . $struct;
} else {
$struct = $wp_rewrite->root . $struct;
}
$link = home_url( user_trailingslashit( $struct, 'post_type_archive' ) );
} else {
$link = home_url( '?post_type=' . $post_type );
}
/**
* Filters the post type archive permalink.
*
* @since 3.1.0
*
* @param string $link The post type archive permalink.
* @param string $post_type Post type name.
*/
return apply_filters( 'post_type_archive_link', $link, $post_type );
}
```
[apply\_filters( 'post\_type\_archive\_link', string $link, string $post\_type )](../hooks/post_type_archive_link)
Filters the post type archive permalink.
| 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. |
| [user\_trailingslashit()](user_trailingslashit) wp-includes/link-template.php | Retrieves a trailing-slashed string if the site is set for adding trailing slashes. |
| [home\_url()](home_url) wp-includes/link-template.php | Retrieves the URL for the current site where the front end is accessible. |
| [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\_type\_object()](get_post_type_object) wp-includes/post.php | Retrieves a post type object by name. |
| Used By | Description |
| --- | --- |
| [WP\_Customize\_Nav\_Menu\_Item\_Setting::value\_as\_wp\_post\_nav\_menu\_item()](../classes/wp_customize_nav_menu_item_setting/value_as_wp_post_nav_menu_item) wp-includes/customize/class-wp-customize-nav-menu-item-setting.php | Get the value emulated into a [WP\_Post](../classes/wp_post) and set up as a nav\_menu\_item. |
| [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\_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\_list\_categories()](wp_list_categories) wp-includes/category-template.php | Displays or retrieves the HTML list of categories. |
| [get\_post\_type\_archive\_feed\_link()](get_post_type_archive_feed_link) wp-includes/link-template.php | Retrieves the permalink for a post type archive feed. |
| [wp\_admin\_bar\_edit\_menu()](wp_admin_bar_edit_menu) wp-includes/admin-bar.php | Provides an edit link for posts and terms. |
| [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. |
| Version | Description |
| --- | --- |
| [4.5.0](https://developer.wordpress.org/reference/since/4.5.0/) | Support for posts was added. |
| [3.1.0](https://developer.wordpress.org/reference/since/3.1.0/) | Introduced. |
wordpress wp_attachment_is( string $type, int|WP_Post $post = null ): bool wp\_attachment\_is( string $type, int|WP\_Post $post = null ): bool
===================================================================
Verifies an attachment is of a given type.
`$type` string Required Attachment type. Accepts `'image'`, `'audio'`, or `'video'`. `$post` int|[WP\_Post](../classes/wp_post) Optional Attachment ID or object. Default is global $post. Default: `null`
bool True if one of the accepted types, false otherwise.
File: `wp-includes/post.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/post.php/)
```
function wp_attachment_is( $type, $post = null ) {
$post = get_post( $post );
if ( ! $post ) {
return false;
}
$file = get_attached_file( $post->ID );
if ( ! $file ) {
return false;
}
if ( 0 === strpos( $post->post_mime_type, $type . '/' ) ) {
return true;
}
$check = wp_check_filetype( $file );
if ( empty( $check['ext'] ) ) {
return false;
}
$ext = $check['ext'];
if ( 'import' !== $post->post_mime_type ) {
return $type === $ext;
}
switch ( $type ) {
case 'image':
$image_exts = array( 'jpg', 'jpeg', 'jpe', 'gif', 'png', 'webp' );
return in_array( $ext, $image_exts, true );
case 'audio':
return in_array( $ext, wp_get_audio_extensions(), true );
case 'video':
return in_array( $ext, wp_get_video_extensions(), true );
default:
return $type === $ext;
}
}
```
| Uses | Description |
| --- | --- |
| [wp\_check\_filetype()](wp_check_filetype) wp-includes/functions.php | Retrieves the file type from the file name. |
| [wp\_get\_video\_extensions()](wp_get_video_extensions) wp-includes/media.php | Returns a filtered list of supported video formats. |
| [wp\_get\_audio\_extensions()](wp_get_audio_extensions) wp-includes/media.php | Returns a filtered list of supported audio formats. |
| [get\_attached\_file()](get_attached_file) wp-includes/post.php | Retrieves attached file path based on attachment ID. |
| [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\_Widget\_Media::is\_attachment\_with\_mime\_type()](../classes/wp_widget_media/is_attachment_with_mime_type) wp-includes/widgets/class-wp-widget-media.php | Determine if the supplied attachment is for a valid attachment post with the specified MIME type. |
| [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. |
| [wp\_generate\_attachment\_metadata()](wp_generate_attachment_metadata) wp-admin/includes/image.php | Generates attachment meta data and create image sub-sizes for images. |
| [edit\_form\_image\_editor()](edit_form_image_editor) wp-admin/includes/media.php | Displays the image and editor in the post editor |
| [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. |
| [prepend\_attachment()](prepend_attachment) wp-includes/post-template.php | Wraps attachment in paragraph tag before content. |
| [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\_attachment\_is\_image()](wp_attachment_is_image) wp-includes/post.php | Determines whether an attachment is an image. |
| [wp\_insert\_post()](wp_insert_post) wp-includes/post.php | Inserts or update a post. |
| Version | Description |
| --- | --- |
| [4.2.0](https://developer.wordpress.org/reference/since/4.2.0/) | Introduced. |
wordpress _wp_auto_add_pages_to_menu( string $new_status, string $old_status, WP_Post $post ) \_wp\_auto\_add\_pages\_to\_menu( 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.
Automatically add newly published page objects to menus with that as an option.
`$new_status` string Required The new status of the post object. `$old_status` string Required The old status of the post object. `$post` [WP\_Post](../classes/wp_post) Required The post object being transitioned from one status to another. File: `wp-includes/nav-menu.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/nav-menu.php/)
```
function _wp_auto_add_pages_to_menu( $new_status, $old_status, $post ) {
if ( 'publish' !== $new_status || 'publish' === $old_status || 'page' !== $post->post_type ) {
return;
}
if ( ! empty( $post->post_parent ) ) {
return;
}
$auto_add = get_option( 'nav_menu_options' );
if ( empty( $auto_add ) || ! is_array( $auto_add ) || ! isset( $auto_add['auto_add'] ) ) {
return;
}
$auto_add = $auto_add['auto_add'];
if ( empty( $auto_add ) || ! is_array( $auto_add ) ) {
return;
}
$args = array(
'menu-item-object-id' => $post->ID,
'menu-item-object' => $post->post_type,
'menu-item-type' => 'post_type',
'menu-item-status' => 'publish',
);
foreach ( $auto_add as $menu_id ) {
$items = wp_get_nav_menu_items( $menu_id, array( 'post_status' => 'publish,draft' ) );
if ( ! is_array( $items ) ) {
continue;
}
foreach ( $items as $item ) {
if ( $post->ID == $item->object_id ) {
continue 2;
}
}
wp_update_nav_menu_item( $menu_id, 0, $args );
}
}
```
| Uses | Description |
| --- | --- |
| [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\_get\_nav\_menu\_items()](wp_get_nav_menu_items) wp-includes/nav-menu.php | Retrieves all menu items of a navigation menu. |
| [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_ajax_health_check_background_updates() wp\_ajax\_health\_check\_background\_updates()
==============================================
This function has been deprecated. Use [WP\_REST\_Site\_Health\_Controller::test\_background\_updates()](../classes/wp_rest_site_health_controller/test_background_updates) instead.
Ajax handler for site health checks on background updates.
* [WP\_REST\_Site\_Health\_Controller::test\_background\_updates()](../classes/wp_rest_site_health_controller/test_background_updates)
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_health_check_background_updates() {
_doing_it_wrong(
'wp_ajax_health_check_background_updates',
sprintf(
// translators: 1: The Site Health action that is no longer used by core. 2: The new function that replaces it.
__( 'The Site Health check for %1$s has been replaced with %2$s.' ),
'wp_ajax_health_check_background_updates',
'WP_REST_Site_Health_Controller::test_background_updates'
),
'5.6.0'
);
check_ajax_referer( 'health-check-site-status' );
if ( ! current_user_can( 'view_site_health_checks' ) ) {
wp_send_json_error();
}
if ( ! class_exists( 'WP_Site_Health' ) ) {
require_once ABSPATH . 'wp-admin/includes/class-wp-site-health.php';
}
$site_health = WP_Site_Health::get_instance();
wp_send_json_success( $site_health->get_test_background_updates() );
}
```
| 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. |
| [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. |
| [\_doing\_it\_wrong()](_doing_it_wrong) wp-includes/functions.php | Marks something as being incorrectly called. |
| [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. |
| Version | Description |
| --- | --- |
| [5.6.0](https://developer.wordpress.org/reference/since/5.6.0/) | Use [WP\_REST\_Site\_Health\_Controller::test\_background\_updates()](../classes/wp_rest_site_health_controller/test_background_updates) |
| [5.2.0](https://developer.wordpress.org/reference/since/5.2.0/) | Introduced. |
| programming_docs |
wordpress _make_web_ftp_clickable_cb( array $matches ): string \_make\_web\_ftp\_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 URL 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 URL address.
File: `wp-includes/formatting.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/formatting.php/)
```
function _make_web_ftp_clickable_cb( $matches ) {
$ret = '';
$dest = $matches[2];
$dest = 'http://' . $dest;
// Removed trailing [.,;:)] from URL.
$last_char = substr( $dest, -1 );
if ( in_array( $last_char, array( '.', ',', ';', ':', ')' ), true ) === true ) {
$ret = $last_char;
$dest = substr( $dest, 0, strlen( $dest ) - 1 );
}
$dest = esc_url( $dest );
if ( empty( $dest ) ) {
return $matches[0];
}
if ( 'comment_text' === current_filter() ) {
$rel = 'nofollow ugc';
} else {
$rel = 'nofollow';
}
/** This filter is documented in wp-includes/formatting.php */
$rel = apply_filters( 'make_clickable_rel', $rel, $dest );
$rel = esc_attr( $rel );
return $matches[1] . "<a href=\"$dest\" rel=\"$rel\">$dest</a>$ret";
}
```
[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 get_rest_url( int|null $blog_id = null, string $path = '/', string $scheme = 'rest' ): string get\_rest\_url( int|null $blog\_id = null, string $path = '/', string $scheme = 'rest' ): string
================================================================================================
Retrieves the URL to a REST endpoint on a site.
Note: The returned URL is NOT escaped.
`$blog_id` int|null Optional Blog ID. Default of null returns URL for current blog. Default: `null`
`$path` string Optional REST route. Default `'/'`. 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 get_rest_url( $blog_id = null, $path = '/', $scheme = 'rest' ) {
if ( empty( $path ) ) {
$path = '/';
}
$path = '/' . ltrim( $path, '/' );
if ( is_multisite() && get_blog_option( $blog_id, 'permalink_structure' ) || get_option( 'permalink_structure' ) ) {
global $wp_rewrite;
if ( $wp_rewrite->using_index_permalinks() ) {
$url = get_home_url( $blog_id, $wp_rewrite->index . '/' . rest_get_url_prefix(), $scheme );
} else {
$url = get_home_url( $blog_id, rest_get_url_prefix(), $scheme );
}
$url .= $path;
} else {
$url = trailingslashit( get_home_url( $blog_id, '', $scheme ) );
// nginx only allows HTTP/1.0 methods when redirecting from / to /index.php.
// To work around this, we manually add index.php to the URL, avoiding the redirect.
if ( 'index.php' !== substr( $url, 9 ) ) {
$url .= 'index.php';
}
$url = add_query_arg( 'rest_route', $path, $url );
}
if ( is_ssl() && isset( $_SERVER['SERVER_NAME'] ) ) {
// If the current host is the same as the REST URL host, force the REST URL scheme to HTTPS.
if ( parse_url( get_home_url( $blog_id ), PHP_URL_HOST ) === $_SERVER['SERVER_NAME'] ) {
$url = set_url_scheme( $url, 'https' );
}
}
if ( is_admin() && force_ssl_admin() ) {
/*
* In this situation the home URL may be http:, and `is_ssl()` may be false,
* but the admin is served over https: (one way or another), so REST API usage
* will be blocked by browsers unless it is also served over HTTPS.
*/
$url = set_url_scheme( $url, 'https' );
}
/**
* Filters the REST URL.
*
* Use this filter to adjust the url returned by the get_rest_url() function.
*
* @since 4.4.0
*
* @param string $url REST URL.
* @param string $path REST route.
* @param int|null $blog_id Blog ID.
* @param string $scheme Sanitization scheme.
*/
return apply_filters( 'rest_url', $url, $path, $blog_id, $scheme );
}
```
[apply\_filters( 'rest\_url', string $url, string $path, int|null $blog\_id, string $scheme )](../hooks/rest_url)
Filters the REST URL.
| Uses | Description |
| --- | --- |
| [rest\_get\_url\_prefix()](rest_get_url_prefix) wp-includes/rest-api.php | Retrieves the URL prefix for any API resource. |
| [is\_ssl()](is_ssl) wp-includes/load.php | Determines if SSL is used. |
| [force\_ssl\_admin()](force_ssl_admin) wp-includes/functions.php | Determines whether to force SSL used for the Administration Screens. |
| [set\_url\_scheme()](set_url_scheme) wp-includes/link-template.php | Sets the scheme for a URL. |
| [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\_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. |
| [get\_blog\_option()](get_blog_option) wp-includes/ms-blogs.php | Retrieve option value for a given blog id based on name of option. |
| [trailingslashit()](trailingslashit) wp-includes/formatting.php | Appends a trailing slash. |
| [is\_multisite()](is_multisite) wp-includes/load.php | If Multisite is enabled. |
| [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. |
| [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\_local\_html\_output()](wp_is_local_html_output) wp-includes/https-detection.php | Checks whether a given HTML string is likely an output from this WordPress 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. |
| [rest\_output\_rsd()](rest_output_rsd) wp-includes/rest-api.php | Adds the REST API URL to the WP RSD endpoint. |
| [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. |
| [rest\_url()](rest_url) wp-includes/rest-api.php | Retrieves the URL to a REST endpoint. |
| [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\_default\_scripts()](wp_default_scripts) wp-includes/script-loader.php | Registers all WordPress scripts. |
| Version | Description |
| --- | --- |
| [4.4.0](https://developer.wordpress.org/reference/since/4.4.0/) | Introduced. |
wordpress clean_comment_cache( int|array $ids ) clean\_comment\_cache( int|array $ids )
=======================================
Removes a comment from the object cache.
`$ids` int|array Required Comment ID or an array of comment IDs to remove from cache. File: `wp-includes/comment.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/comment.php/)
```
function clean_comment_cache( $ids ) {
$comment_ids = (array) $ids;
wp_cache_delete_multiple( $comment_ids, 'comment' );
foreach ( $comment_ids as $id ) {
/**
* Fires immediately after a comment has been removed from the object cache.
*
* @since 4.5.0
*
* @param int $id Comment ID.
*/
do_action( 'clean_comment_cache', $id );
}
wp_cache_set( 'last_changed', microtime(), 'comment' );
}
```
[do\_action( 'clean\_comment\_cache', int $id )](../hooks/clean_comment_cache)
Fires immediately after a comment has been removed from the object cache.
| Uses | Description |
| --- | --- |
| [wp\_cache\_delete\_multiple()](wp_cache_delete_multiple) wp-includes/cache.php | Deletes multiple values from the cache in one call. |
| [wp\_cache\_set()](wp_cache_set) wp-includes/cache.php | Saves the data to the cache. |
| [do\_action()](do_action) wp-includes/plugin.php | Calls the callback functions that have been added to an action hook. |
| Used By | Description |
| --- | --- |
| [\_wp\_batch\_update\_comment\_type()](_wp_batch_update_comment_type) wp-includes/comment.php | Updates the comment type for a batch of 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\_untrash\_post\_comments()](wp_untrash_post_comments) wp-includes/post.php | Restores comments for a post from the Trash. |
| [wp\_trash\_post\_comments()](wp_trash_post_comments) wp-includes/post.php | Moves comments for a post to the Trash. |
| [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. |
| [wp\_insert\_comment()](wp_insert_comment) wp-includes/comment.php | Inserts a comment into the database. |
| [wp\_delete\_comment()](wp_delete_comment) wp-includes/comment.php | Trashes or deletes a comment. |
| Version | Description |
| --- | --- |
| [2.3.0](https://developer.wordpress.org/reference/since/2.3.0/) | Introduced. |
wordpress load_textdomain( string $domain, string $mofile, string $locale = null ): bool load\_textdomain( string $domain, string $mofile, string $locale = null ): bool
===============================================================================
Loads a .mo file into the text domain $domain.
If the text domain already exists, the translations will be merged. If both sets have the same string, the translation from the original value will be taken.
On success, the .mo file will be placed in the $l10n global by $domain and will be a MO object.
`$domain` string Required Text domain. Unique identifier for retrieving translated strings. `$mofile` string Required Path to the .mo file. `$locale` string Optional Locale. Default is the current locale. Default: `null`
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 load_textdomain( $domain, $mofile, $locale = null ) {
/** @var WP_Textdomain_Registry $wp_textdomain_registry */
global $l10n, $l10n_unloaded, $wp_textdomain_registry;
$l10n_unloaded = (array) $l10n_unloaded;
/**
* Filters whether to override the .mo file loading.
*
* @since 2.9.0
*
* @param bool $override Whether to override the .mo file loading. Default false.
* @param string $domain Text domain. Unique identifier for retrieving translated strings.
* @param string $mofile Path to the MO file.
*/
$plugin_override = apply_filters( 'override_load_textdomain', false, $domain, $mofile );
if ( true === (bool) $plugin_override ) {
unset( $l10n_unloaded[ $domain ] );
return true;
}
/**
* Fires before the MO translation file is loaded.
*
* @since 2.9.0
*
* @param string $domain Text domain. Unique identifier for retrieving translated strings.
* @param string $mofile Path to the .mo file.
*/
do_action( 'load_textdomain', $domain, $mofile );
/**
* Filters MO file path for loading translations for a specific text domain.
*
* @since 2.9.0
*
* @param string $mofile Path to the MO file.
* @param string $domain Text domain. Unique identifier for retrieving translated strings.
*/
$mofile = apply_filters( 'load_textdomain_mofile', $mofile, $domain );
if ( ! is_readable( $mofile ) ) {
return false;
}
if ( ! $locale ) {
$locale = determine_locale();
}
$mo = new MO();
if ( ! $mo->import_from_file( $mofile ) ) {
$wp_textdomain_registry->set( $domain, $locale, false );
return false;
}
if ( isset( $l10n[ $domain ] ) ) {
$mo->merge_with( $l10n[ $domain ] );
}
unset( $l10n_unloaded[ $domain ] );
$l10n[ $domain ] = &$mo;
$wp_textdomain_registry->set( $domain, $locale, dirname( $mofile ) );
return true;
}
```
[do\_action( 'load\_textdomain', string $domain, string $mofile )](../hooks/load_textdomain)
Fires before the MO translation file is loaded.
[apply\_filters( 'load\_textdomain\_mofile', string $mofile, string $domain )](../hooks/load_textdomain_mofile)
Filters MO file path for loading translations for a specific text domain.
[apply\_filters( 'override\_load\_textdomain', bool $override, string $domain, string $mofile )](../hooks/override_load_textdomain)
Filters whether to override the .mo file loading.
| Uses | Description |
| --- | --- |
| [WP\_Textdomain\_Registry::set()](../classes/wp_textdomain_registry/set) wp-includes/class-wp-textdomain-registry.php | Sets the language directory path for a specific domain and locale. |
| [determine\_locale()](determine_locale) wp-includes/l10n.php | Determines the current locale desired for the request. |
| [MO::import\_from\_file()](../classes/mo/import_from_file) wp-includes/pomo/mo.php | Fills up with the entries from MO file $filename |
| [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 |
| --- | --- |
| [WP\_REST\_Site\_Health\_Controller::load\_admin\_textdomain()](../classes/wp_rest_site_health_controller/load_admin_textdomain) wp-includes/rest-api/endpoints/class-wp-rest-site-health-controller.php | Loads the admin textdomain for Site Health tests. |
| [\_load\_textdomain\_just\_in\_time()](_load_textdomain_just_in_time) wp-includes/l10n.php | Loads plugin and theme text domains just-in-time. |
| [load\_default\_textdomain()](load_default_textdomain) wp-includes/l10n.php | Loads default translated strings based on locale. |
| [load\_plugin\_textdomain()](load_plugin_textdomain) wp-includes/l10n.php | Loads a plugin’s translated strings. |
| [load\_muplugin\_textdomain()](load_muplugin_textdomain) wp-includes/l10n.php | Loads the translated strings for a plugin residing in the mu-plugins directory. |
| [load\_theme\_textdomain()](load_theme_textdomain) wp-includes/l10n.php | Loads the theme’s translated strings. |
| [wp\_load\_translations\_early()](wp_load_translations_early) wp-includes/load.php | Attempt an early load of translations. |
| [wp\_timezone\_choice()](wp_timezone_choice) wp-includes/functions.php | Gives a nicely-formatted list of timezone strings. |
| Version | Description |
| --- | --- |
| [6.1.0](https://developer.wordpress.org/reference/since/6.1.0/) | Added the `$locale` parameter. |
| [1.5.0](https://developer.wordpress.org/reference/since/1.5.0/) | Introduced. |
wordpress wp_register_plugin_realpath( string $file ): bool wp\_register\_plugin\_realpath( string $file ): bool
====================================================
Register a plugin’s real path.
This is used in [plugin\_basename()](plugin_basename) to resolve symlinked paths.
* [wp\_normalize\_path()](wp_normalize_path)
`$file` string Required Known path to the file. bool Whether the path was able to be registered.
File: `wp-includes/plugin.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/plugin.php/)
```
function wp_register_plugin_realpath( $file ) {
global $wp_plugin_paths;
// Normalize, but store as static to avoid recalculation of a constant value.
static $wp_plugin_path = null, $wpmu_plugin_path = null;
if ( ! isset( $wp_plugin_path ) ) {
$wp_plugin_path = wp_normalize_path( WP_PLUGIN_DIR );
$wpmu_plugin_path = wp_normalize_path( WPMU_PLUGIN_DIR );
}
$plugin_path = wp_normalize_path( dirname( $file ) );
$plugin_realpath = wp_normalize_path( dirname( realpath( $file ) ) );
if ( $plugin_path === $wp_plugin_path || $plugin_path === $wpmu_plugin_path ) {
return false;
}
if ( $plugin_path !== $plugin_realpath ) {
$wp_plugin_paths[ $plugin_path ] = $plugin_realpath;
}
return true;
}
```
| Uses | Description |
| --- | --- |
| [wp\_normalize\_path()](wp_normalize_path) wp-includes/functions.php | Normalizes a filesystem path. |
| Used By | Description |
| --- | --- |
| [uninstall\_plugin()](uninstall_plugin) wp-admin/includes/plugin.php | Uninstalls a single plugin. |
| [plugin\_sandbox\_scrape()](plugin_sandbox_scrape) wp-admin/includes/plugin.php | Loads a given plugin attempt to generate errors. |
| Version | Description |
| --- | --- |
| [3.9.0](https://developer.wordpress.org/reference/since/3.9.0/) | Introduced. |
wordpress get_tags( string|array $args = '' ): WP_Term[]|int|WP_Error get\_tags( string|array $args = '' ): WP\_Term[]|int|WP\_Error
==============================================================
Retrieves all post tags.
`$args` string|array Optional Arguments to retrieve tags. See [get\_terms()](get_terms) for additional options.
* `taxonomy`stringTaxonomy to retrieve terms for. Default `'post_tag'`.
More Arguments from get\_terms( ... $args ) 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: `''`
[WP\_Term](../classes/wp_term)[]|int|[WP\_Error](../classes/wp_error) Array of `'post_tag'` term objects, a count thereof, or [WP\_Error](../classes/wp_error) if any of the taxonomies do not exist.
File: `wp-includes/category.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/category.php/)
```
function get_tags( $args = '' ) {
$defaults = array( 'taxonomy' => 'post_tag' );
$args = wp_parse_args( $args, $defaults );
$tags = get_terms( $args );
if ( empty( $tags ) ) {
$tags = array();
} else {
/**
* Filters the array of term objects returned for the 'post_tag' taxonomy.
*
* @since 2.3.0
*
* @param WP_Term[]|int|WP_Error $tags Array of 'post_tag' term objects, a count thereof,
* or WP_Error if any of the taxonomies do not exist.
* @param array $args An array of arguments. @see get_terms()
*/
$tags = apply_filters( 'get_tags', $tags, $args );
}
return $tags;
}
```
[apply\_filters( 'get\_tags', WP\_Term[]|int|WP\_Error $tags, array $args )](../hooks/get_tags)
Filters the array of term objects returned for the ‘post\_tag’ taxonomy.
| Uses | Description |
| --- | --- |
| [get\_terms()](get_terms) wp-includes/taxonomy.php | Retrieves the terms in a given taxonomy or list of taxonomies. |
| [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 |
| --- | --- |
| [export\_wp()](export_wp) wp-admin/includes/export.php | Generates the WXR export file for download. |
| [wp\_xmlrpc\_server::wp\_getTags()](../classes/wp_xmlrpc_server/wp_gettags) wp-includes/class-wp-xmlrpc-server.php | Get list of all tags |
| Version | Description |
| --- | --- |
| [2.3.0](https://developer.wordpress.org/reference/since/2.3.0/) | Introduced. |
| programming_docs |
wordpress wp_custom_css_cb() wp\_custom\_css\_cb()
=====================
Renders the Custom CSS style element.
File: `wp-includes/theme.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/theme.php/)
```
function wp_custom_css_cb() {
$styles = wp_get_custom_css();
if ( $styles || is_customize_preview() ) :
$type_attr = current_theme_supports( 'html5', 'style' ) ? '' : ' type="text/css"';
?>
<style<?php echo $type_attr; ?> id="wp-custom-css">
<?php
// Note that esc_html() cannot be used because `div > span` is not interpreted properly.
echo strip_tags( $styles );
?>
</style>
<?php
endif;
}
```
| Uses | Description |
| --- | --- |
| [wp\_get\_custom\_css()](wp_get_custom_css) wp-includes/theme.php | Fetches the saved Custom CSS content for rendering. |
| [is\_customize\_preview()](is_customize_preview) wp-includes/theme.php | Whether the site is being previewed in the Customizer. |
| [current\_theme\_supports()](current_theme_supports) wp-includes/theme.php | Checks a theme’s support for a given feature. |
| Version | Description |
| --- | --- |
| [4.7.0](https://developer.wordpress.org/reference/since/4.7.0/) | Introduced. |
wordpress wp_basename( string $path, string $suffix = '' ): string wp\_basename( string $path, string $suffix = '' ): string
=========================================================
i18n-friendly version of basename().
`$path` string Required A path. `$suffix` string Optional If the filename ends in suffix this will also be cut off. Default: `''`
string
File: `wp-includes/formatting.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/formatting.php/)
```
function wp_basename( $path, $suffix = '' ) {
return urldecode( basename( str_replace( array( '%2F', '%5C' ), '/', urlencode( $path ) ), $suffix ) );
}
```
| 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\_src\_get\_dimensions()](wp_image_src_get_dimensions) wp-includes/media.php | Determines an image’s width and height dimensions based on the source file. |
| [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\_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. |
| [verify\_file\_signature()](verify_file_signature) wp-admin/includes/file.php | Verifies the contents of a file against its ED25519 signature. |
| [wp\_delete\_attachment\_files()](wp_delete_attachment_files) wp-includes/post.php | Deletes all files that belong to the given attachment. |
| [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\_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\_REST\_Attachments\_Controller::prepare\_item\_for\_response()](../classes/wp_rest_attachments_controller/prepare_item_for_response) wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php | Prepares a single attachment output for response. |
| [WP\_Customize\_Manager::get\_return\_url()](../classes/wp_customize_manager/get_return_url) wp-includes/class-wp-customize-manager.php | Gets URL to link the user to when closing the Customizer. |
| [wp\_image\_add\_srcset\_and\_sizes()](wp_image_add_srcset_and_sizes) wp-includes/media.php | Adds ‘srcset’ and ‘sizes’ attributes to an existing ‘img’ element. |
| [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\_Site\_Icon::create\_attachment\_object()](../classes/wp_site_icon/create_attachment_object) wp-admin/includes/class-wp-site-icon.php | Creates an attachment ‘object’. |
| [wp\_ajax\_crop\_image()](wp_ajax_crop_image) wp-admin/includes/ajax-actions.php | Ajax handler for cropping an image. |
| [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\_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\_image\_editor()](wp_image_editor) wp-admin/includes/image-edit.php | Loads the WP image-editing interface. |
| [\_copy\_image\_file()](_copy_image_file) wp-admin/includes/image.php | Copies an existing image file. |
| [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\_crop\_image()](wp_crop_image) wp-admin/includes/image.php | Crops an image to a given size. |
| [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. |
| [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. |
| [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\_ajax\_send\_link\_to\_editor()](wp_ajax_send_link_to_editor) wp-admin/includes/ajax-actions.php | Ajax handler for sending a link to the editor. |
| [wp\_import\_handle\_upload()](wp_import_handle_upload) wp-admin/includes/import.php | Handles importer uploading and adds attachment. |
| [Custom\_Image\_Header::create\_attachment\_object()](../classes/custom_image_header/create_attachment_object) wp-admin/includes/class-custom-image-header.php | Create an attachment ‘object’. |
| [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\_Background::handle\_upload()](../classes/custom_background/handle_upload) wp-admin/includes/class-custom-background.php | Handles an Image upload for the background image. |
| [get\_theme\_data()](get_theme_data) wp-includes/deprecated.php | Retrieve theme data from parsed theme file. |
| [get\_attachment\_icon\_src()](get_attachment_icon_src) wp-includes/deprecated.php | Retrieve icon URL and Path. |
| [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\_Query::parse\_tax\_query()](../classes/wp_query/parse_tax_query) wp-includes/class-wp-query.php | Parses various taxonomy related query vars. |
| [WP\_Image\_Editor\_Imagick::\_save()](../classes/wp_image_editor_imagick/_save) wp-includes/class-wp-image-editor-imagick.php | |
| [wp\_upload\_bits()](wp_upload_bits) wp-includes/functions.php | Creates a file in the upload folder with given content. |
| [wp\_upload\_dir()](wp_upload_dir) wp-includes/functions.php | Returns an array containing the current upload directory’s path and URL. |
| [WP\_Image\_Editor::get\_output\_format()](../classes/wp_image_editor/get_output_format) wp-includes/class-wp-image-editor.php | Returns preferred mime-type and extension based on provided file’s extension and mime, or current file’s extension and mime. |
| [WP\_Image\_Editor::generate\_filename()](../classes/wp_image_editor/generate_filename) wp-includes/class-wp-image-editor.php | Builds an output filename based on current file, and adding proper suffix |
| [WP\_Image\_Editor\_GD::\_save()](../classes/wp_image_editor_gd/_save) wp-includes/class-wp-image-editor-gd.php | |
| [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. |
| [get\_attachment\_taxonomies()](get_attachment_taxonomies) wp-includes/media.php | Retrieves taxonomies attached to given the attachment. |
| [wp\_get\_attachment\_image\_src()](wp_get_attachment_image_src) wp-includes/media.php | Retrieves an image to represent an attachment. |
| [image\_downsize()](image_downsize) wp-includes/media.php | Scales an image to fit a particular size (such as ‘thumb’ or ‘medium’). |
| [wp\_mime\_type\_icon()](wp_mime_type_icon) wp-includes/post.php | Retrieves the icon for a MIME type or attachment. |
| [wp\_get\_attachment\_url()](wp_get_attachment_url) wp-includes/post.php | Retrieves the URL for an attachment. |
| [wp\_get\_attachment\_thumb\_file()](wp_get_attachment_thumb_file) wp-includes/deprecated.php | Retrieves thumbnail for an attachment. |
| Version | Description |
| --- | --- |
| [3.1.0](https://developer.wordpress.org/reference/since/3.1.0/) | Introduced. |
wordpress populate_roles_210() populate\_roles\_210()
======================
Create and modify WordPress roles for WordPress 2.1.
File: `wp-admin/includes/schema.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/schema.php/)
```
function populate_roles_210() {
$roles = array( 'administrator', 'editor' );
foreach ( $roles as $role ) {
$role = get_role( $role );
if ( empty( $role ) ) {
continue;
}
$role->add_cap( 'edit_others_pages' );
$role->add_cap( 'edit_published_pages' );
$role->add_cap( 'publish_pages' );
$role->add_cap( 'delete_pages' );
$role->add_cap( 'delete_others_pages' );
$role->add_cap( 'delete_published_pages' );
$role->add_cap( 'delete_posts' );
$role->add_cap( 'delete_others_posts' );
$role->add_cap( 'delete_published_posts' );
$role->add_cap( 'delete_private_posts' );
$role->add_cap( 'edit_private_posts' );
$role->add_cap( 'read_private_posts' );
$role->add_cap( 'delete_private_pages' );
$role->add_cap( 'edit_private_pages' );
$role->add_cap( 'read_private_pages' );
}
$role = get_role( 'administrator' );
if ( ! empty( $role ) ) {
$role->add_cap( 'delete_users' );
$role->add_cap( 'create_users' );
}
$role = get_role( 'author' );
if ( ! empty( $role ) ) {
$role->add_cap( 'delete_posts' );
$role->add_cap( 'delete_published_posts' );
}
$role = get_role( 'contributor' );
if ( ! empty( $role ) ) {
$role->add_cap( 'delete_posts' );
}
}
```
| 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.1.0](https://developer.wordpress.org/reference/since/2.1.0/) | Introduced. |
wordpress unregister_post_type( string $post_type ): true|WP_Error unregister\_post\_type( string $post\_type ): true|WP\_Error
============================================================
Unregisters a post type.
Cannot be used to unregister built-in post types.
`$post_type` string Required Post type to unregister. true|[WP\_Error](../classes/wp_error) True on success, [WP\_Error](../classes/wp_error) on failure or if the post type doesn't exist.
File: `wp-includes/post.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/post.php/)
```
function unregister_post_type( $post_type ) {
global $wp_post_types;
if ( ! post_type_exists( $post_type ) ) {
return new WP_Error( 'invalid_post_type', __( 'Invalid post type.' ) );
}
$post_type_object = get_post_type_object( $post_type );
// Do not allow unregistering internal post types.
if ( $post_type_object->_builtin ) {
return new WP_Error( 'invalid_post_type', __( 'Unregistering a built-in post type is not allowed' ) );
}
$post_type_object->remove_supports();
$post_type_object->remove_rewrite_rules();
$post_type_object->unregister_meta_boxes();
$post_type_object->remove_hooks();
$post_type_object->unregister_taxonomies();
unset( $wp_post_types[ $post_type ] );
/**
* Fires after a post type was unregistered.
*
* @since 4.5.0
*
* @param string $post_type Post type key.
*/
do_action( 'unregistered_post_type', $post_type );
return true;
}
```
[do\_action( 'unregistered\_post\_type', string $post\_type )](../hooks/unregistered_post_type)
Fires after a post type was unregistered.
| Uses | Description |
| --- | --- |
| [post\_type\_exists()](post_type_exists) wp-includes/post.php | Determines whether a post type is registered. |
| [\_\_()](__) 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. |
| [get\_post\_type\_object()](get_post_type_object) wp-includes/post.php | Retrieves a post type object by name. |
| [WP\_Error::\_\_construct()](../classes/wp_error/__construct) wp-includes/class-wp-error.php | Initializes the error. |
| Version | Description |
| --- | --- |
| [4.5.0](https://developer.wordpress.org/reference/since/4.5.0/) | Introduced. |
wordpress attachment_submit_meta_box( WP_Post $post ) attachment\_submit\_meta\_box( WP\_Post $post )
===============================================
Displays attachment submit form fields.
`$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_submit_meta_box( $post ) {
?>
<div class="submitbox" id="submitpost">
<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' ); ?>
</div>
<div id="misc-publishing-actions">
<div class="misc-pub-section curtime misc-pub-curtime">
<span id="timestamp">
<?php
$uploaded_on = sprintf(
/* translators: Publish box date string. 1: Date, 2: Time. See https://www.php.net/manual/datetime.format.php */
__( '%1$s at %2$s' ),
/* translators: Publish box date format, see https://www.php.net/manual/datetime.format.php */
date_i18n( _x( 'M j, Y', 'publish box date format' ), strtotime( $post->post_date ) ),
/* translators: Publish box time format, see https://www.php.net/manual/datetime.format.php */
date_i18n( _x( 'H:i', 'publish box time format' ), strtotime( $post->post_date ) )
);
/* translators: Attachment information. %s: Date the attachment was uploaded. */
printf( __( 'Uploaded on: %s' ), '<b>' . $uploaded_on . '</b>' );
?>
</span>
</div><!-- .misc-pub-section -->
<?php
/**
* Fires after the 'Uploaded on' section of the Save meta box
* in the attachment editing screen.
*
* @since 3.5.0
* @since 4.9.0 Added the `$post` parameter.
*
* @param WP_Post $post WP_Post object for the current attachment.
*/
do_action( 'attachment_submitbox_misc_actions', $post );
?>
</div><!-- #misc-publishing-actions -->
<div class="clear"></div>
</div><!-- #minor-publishing -->
<div id="major-publishing-actions">
<div id="delete-action">
<?php
if ( current_user_can( 'delete_post', $post->ID ) ) {
if ( EMPTY_TRASH_DAYS && MEDIA_TRASH ) {
echo "<a class='submitdelete deletion' href='" . get_delete_post_link( $post->ID ) . "'>" . __( 'Move to Trash' ) . '</a>';
} else {
$delete_ays = ! MEDIA_TRASH ? " onclick='return showNotice.warn();'" : '';
echo "<a class='submitdelete deletion'$delete_ays href='" . get_delete_post_link( $post->ID, null, true ) . "'>" . __( 'Delete permanently' ) . '</a>';
}
}
?>
</div>
<div id="publishing-action">
<span class="spinner"></span>
<input name="original_publish" type="hidden" id="original_publish" value="<?php esc_attr_e( 'Update' ); ?>" />
<input name="save" type="submit" class="button button-primary button-large" id="publish" value="<?php esc_attr_e( 'Update' ); ?>" />
</div>
<div class="clear"></div>
</div><!-- #major-publishing-actions -->
</div>
<?php
}
```
[do\_action( 'attachment\_submitbox\_misc\_actions', WP\_Post $post )](../hooks/attachment_submitbox_misc_actions)
Fires after the ‘Uploaded on’ section of the Save meta box in the attachment 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. |
| [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. |
| [get\_delete\_post\_link()](get_delete_post_link) wp-includes/link-template.php | Retrieves the delete posts link for 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. |
| [\_x()](_x) wp-includes/l10n.php | Retrieves translated string with gettext context. |
| [do\_action()](do_action) wp-includes/plugin.php | Calls the callback functions that have been added to an action hook. |
| Version | Description |
| --- | --- |
| [3.5.0](https://developer.wordpress.org/reference/since/3.5.0/) | Introduced. |
wordpress rest_authorization_required_code(): int rest\_authorization\_required\_code(): int
==========================================
Returns a contextual HTTP error code for authorization failure.
int 401 if the user is not logged in, 403 if the user is logged in.
File: `wp-includes/rest-api.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/rest-api.php/)
```
function rest_authorization_required_code() {
return is_user_logged_in() ? 403 : 401;
}
```
| Uses | Description |
| --- | --- |
| [is\_user\_logged\_in()](is_user_logged_in) wp-includes/pluggable.php | Determines whether the current visitor is a logged in user. |
| Used By | Description |
| --- | --- |
| [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\_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\_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\_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\_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\_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\_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\_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\_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\_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\_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\_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\_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\_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\_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\_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\_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\_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\_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\_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\_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::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::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::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::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::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\_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\_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\_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\_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\_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\_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::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::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::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::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::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\_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\_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\_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::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::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::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::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::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::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\_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\_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::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\_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::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::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::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. |
| Version | Description |
| --- | --- |
| [4.7.0](https://developer.wordpress.org/reference/since/4.7.0/) | Introduced. |
| programming_docs |
wordpress do_signup_header() do\_signup\_header()
====================
Prints signup\_header via wp\_head.
File: `wp-signup.php`. [View all references](https://developer.wordpress.org/reference/files/wp-signup.php/)
```
function do_signup_header() {
/**
* Fires within the head section of the site sign-up screen.
*
* @since 3.0.0
*/
do_action( 'signup_header' );
}
```
[do\_action( 'signup\_header' )](../hooks/signup_header)
Fires within the head section of the site sign-up screen.
| Uses | Description |
| --- | --- |
| [do\_action()](do_action) wp-includes/plugin.php | Calls the callback functions that have been added to an action hook. |
| Version | Description |
| --- | --- |
| [MU (3.0.0)](https://developer.wordpress.org/reference/since/mu.3.0.0/) | Introduced. |
wordpress _get_cron_array(): array[] \_get\_cron\_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.
Retrieve cron info array option.
array[] Array of cron events.
File: `wp-includes/cron.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/cron.php/)
```
function _get_cron_array() {
$cron = get_option( 'cron' );
if ( ! is_array( $cron ) ) {
return array();
}
if ( ! isset( $cron['version'] ) ) {
$cron = _upgrade_cron_array( $cron );
}
unset( $cron['version'] );
return $cron;
}
```
| Uses | Description |
| --- | --- |
| [\_upgrade\_cron\_array()](_upgrade_cron_array) wp-includes/cron.php | Upgrade a cron info array. |
| [get\_option()](get_option) wp-includes/option.php | Retrieves an option value based on an option name. |
| Used By | Description |
| --- | --- |
| [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\_get\_ready\_cron\_jobs()](wp_get_ready_cron_jobs) wp-includes/cron.php | Retrieve cron jobs ready to be run. |
| [wp\_get\_scheduled\_event()](wp_get_scheduled_event) wp-includes/cron.php | Retrieve a scheduled event. |
| [wp\_unschedule\_hook()](wp_unschedule_hook) wp-includes/cron.php | Unschedules all events attached to the hook. |
| [WP\_Media\_List\_Table::prepare\_items()](../classes/wp_media_list_table/prepare_items) wp-admin/includes/class-wp-media-list-table.php | |
| [wp\_schedule\_event()](wp_schedule_event) wp-includes/cron.php | Schedules 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. |
| [wp\_schedule\_single\_event()](wp_schedule_single_event) wp-includes/cron.php | Schedules an event to run only once. |
| Version | Description |
| --- | --- |
| [6.1.0](https://developer.wordpress.org/reference/since/6.1.0/) | Return type modified to consistently return an array. |
| [2.1.0](https://developer.wordpress.org/reference/since/2.1.0/) | Introduced. |
wordpress next_widget_id_number( string $id_base ): int next\_widget\_id\_number( string $id\_base ): int
=================================================
`$id_base` string Required int
File: `wp-admin/includes/widgets.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/widgets.php/)
```
function next_widget_id_number( $id_base ) {
global $wp_registered_widgets;
$number = 1;
foreach ( $wp_registered_widgets as $widget_id => $widget ) {
if ( preg_match( '/' . preg_quote( $id_base, '/' ) . '-([0-9]+)$/', $widget_id, $matches ) ) {
$number = max( $number, $matches[1] );
}
}
$number++;
return $number;
}
```
| Used By | Description |
| --- | --- |
| [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\_list\_widgets()](wp_list_widgets) wp-admin/includes/widgets.php | Display list of the available widgets. |
| [WP\_Customize\_Widgets::get\_available\_widgets()](../classes/wp_customize_widgets/get_available_widgets) wp-includes/class-wp-customize-widgets.php | Builds up an index of all available widgets for use in Backbone models. |
wordpress wp_widget_rss_process( array $widget_rss, bool $check_feed = true ): array wp\_widget\_rss\_process( array $widget\_rss, bool $check\_feed = true ): array
===============================================================================
Process RSS feed widget data and optionally retrieve feed items.
The feed widget can not have more than 20 items or it will reset back to the default, which is 10.
The resulting array has the feed title, feed url, feed link (from channel), feed items, error (if any), and whether to show summary, author, and date.
All respectively in the order of the array elements.
`$widget_rss` array Required RSS widget feed data. Expects unescaped data. `$check_feed` bool Optional Whether to check feed for errors. Default: `true`
array
File: `wp-includes/widgets.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/widgets.php/)
```
function wp_widget_rss_process( $widget_rss, $check_feed = true ) {
$items = (int) $widget_rss['items'];
if ( $items < 1 || 20 < $items ) {
$items = 10;
}
$url = sanitize_url( strip_tags( $widget_rss['url'] ) );
$title = isset( $widget_rss['title'] ) ? trim( strip_tags( $widget_rss['title'] ) ) : '';
$show_summary = isset( $widget_rss['show_summary'] ) ? (int) $widget_rss['show_summary'] : 0;
$show_author = isset( $widget_rss['show_author'] ) ? (int) $widget_rss['show_author'] : 0;
$show_date = isset( $widget_rss['show_date'] ) ? (int) $widget_rss['show_date'] : 0;
$error = false;
$link = '';
if ( $check_feed ) {
$rss = fetch_feed( $url );
if ( is_wp_error( $rss ) ) {
$error = $rss->get_error_message();
} else {
$link = esc_url( strip_tags( $rss->get_permalink() ) );
while ( stristr( $link, 'http' ) !== $link ) {
$link = substr( $link, 1 );
}
$rss->__destruct();
unset( $rss );
}
}
return compact( 'title', 'url', 'link', 'items', 'error', 'show_summary', 'show_author', 'show_date' );
}
```
| Uses | Description |
| --- | --- |
| [fetch\_feed()](fetch_feed) wp-includes/feed.php | Builds SimplePie object based on RSS or Atom feed from URL. |
| [sanitize\_url()](sanitize_url) wp-includes/formatting.php | Sanitizes a URL for database or redirect usage. |
| [esc\_url()](esc_url) wp-includes/formatting.php | Checks and cleans a URL. |
| [is\_wp\_error()](is_wp_error) wp-includes/load.php | Checks whether the given variable is a WordPress Error. |
| Used By | Description |
| --- | --- |
| [wp\_dashboard\_rss\_control()](wp_dashboard_rss_control) wp-admin/includes/dashboard.php | The RSS dashboard widget control. |
| [WP\_Widget\_RSS::update()](../classes/wp_widget_rss/update) wp-includes/widgets/class-wp-widget-rss.php | Handles updating settings for the current RSS widget instance. |
| Version | Description |
| --- | --- |
| [2.5.0](https://developer.wordpress.org/reference/since/2.5.0/) | Introduced. |
wordpress validate_blog_signup(): bool validate\_blog\_signup(): bool
==============================
Validates new site signup.
bool True if the site sign-up was validated, false on error.
File: `wp-signup.php`. [View all references](https://developer.wordpress.org/reference/files/wp-signup.php/)
```
function validate_blog_signup() {
// Re-validate user info.
$user_result = wpmu_validate_user_signup( $_POST['user_name'], $_POST['user_email'] );
$user_name = $user_result['user_name'];
$user_email = $user_result['user_email'];
$user_errors = $user_result['errors'];
if ( $user_errors->has_errors() ) {
signup_user( $user_name, $user_email, $user_errors );
return false;
}
$result = wpmu_validate_blog_signup( $_POST['blogname'], $_POST['blog_title'] );
$domain = $result['domain'];
$path = $result['path'];
$blogname = $result['blogname'];
$blog_title = $result['blog_title'];
$errors = $result['errors'];
if ( $errors->has_errors() ) {
signup_blog( $user_name, $user_email, $blogname, $blog_title, $errors );
return false;
}
$public = (int) $_POST['blog_public'];
$signup_meta = array(
'lang_id' => 1,
'public' => $public,
);
// Handle the language setting for the new site.
if ( ! empty( $_POST['WPLANG'] ) ) {
$languages = signup_get_available_languages();
if ( in_array( $_POST['WPLANG'], $languages, true ) ) {
$language = wp_unslash( sanitize_text_field( $_POST['WPLANG'] ) );
if ( $language ) {
$signup_meta['WPLANG'] = $language;
}
}
}
/** This filter is documented in wp-signup.php */
$meta = apply_filters( 'add_signup_meta', $signup_meta );
wpmu_signup_blog( $domain, $path, $blog_title, $user_name, $user_email, $meta );
confirm_blog_signup( $domain, $path, $blog_title, $user_name, $user_email, $meta );
return true;
}
```
[apply\_filters( 'add\_signup\_meta', array $meta )](../hooks/add_signup_meta)
Filters the new default site meta variables.
| Uses | Description |
| --- | --- |
| [signup\_get\_available\_languages()](signup_get_available_languages) wp-signup.php | Retrieves languages available during the site/user sign-up process. |
| [signup\_user()](signup_user) wp-signup.php | Shows a form for a visitor to sign up for a new user account. |
| [signup\_blog()](signup_blog) wp-signup.php | Shows a form for a user or visitor to sign up for a new site. |
| [confirm\_blog\_signup()](confirm_blog_signup) wp-signup.php | Shows a message confirming that the new site has been registered and is awaiting activation. |
| [sanitize\_text\_field()](sanitize_text_field) wp-includes/formatting.php | Sanitizes a string from user input or from the database. |
| [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()](wpmu_signup_blog) wp-includes/ms-functions.php | Records site signup information for future activation. |
| [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. |
| Version | Description |
| --- | --- |
| [MU (3.0.0)](https://developer.wordpress.org/reference/since/mu.3.0.0/) | Introduced. |
wordpress _thickbox_path_admin_subfolder() \_thickbox\_path\_admin\_subfolder()
====================================
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.
Thickbox image paths for Network Admin.
File: `wp-admin/includes/ms.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/ms.php/)
```
function _thickbox_path_admin_subfolder() {
?>
<script type="text/javascript">
var tb_pathToImage = "<?php echo esc_js( includes_url( 'js/thickbox/loadingAnimation.gif', 'relative' ) ); ?>";
</script>
<?php
}
```
| Uses | Description |
| --- | --- |
| [esc\_js()](esc_js) wp-includes/formatting.php | Escapes single quotes, `"`, , `&`, and fixes line endings. |
| [includes\_url()](includes_url) wp-includes/link-template.php | Retrieves the URL to the includes directory. |
| Version | Description |
| --- | --- |
| [3.1.0](https://developer.wordpress.org/reference/since/3.1.0/) | Introduced. |
wordpress ms_upload_constants() ms\_upload\_constants()
=======================
Defines Multisite upload constants.
Exists for backward compatibility with legacy file-serving through wp-includes/ms-files.php (wp-content/blogs.php in MU).
File: `wp-includes/ms-default-constants.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/ms-default-constants.php/)
```
function ms_upload_constants() {
// This filter is attached in ms-default-filters.php but that file is not included during SHORTINIT.
add_filter( 'default_site_option_ms_files_rewriting', '__return_true' );
if ( ! get_site_option( 'ms_files_rewriting' ) ) {
return;
}
// Base uploads dir relative to ABSPATH.
if ( ! defined( 'UPLOADBLOGSDIR' ) ) {
define( 'UPLOADBLOGSDIR', 'wp-content/blogs.dir' );
}
// Note, the main site in a post-MU network uses wp-content/uploads.
// This is handled in wp_upload_dir() by ignoring UPLOADS for this case.
if ( ! defined( 'UPLOADS' ) ) {
$site_id = get_current_blog_id();
define( 'UPLOADS', UPLOADBLOGSDIR . '/' . $site_id . '/files/' );
// Uploads dir relative to ABSPATH.
if ( 'wp-content/blogs.dir' === UPLOADBLOGSDIR && ! defined( 'BLOGUPLOADDIR' ) ) {
define( 'BLOGUPLOADDIR', WP_CONTENT_DIR . '/blogs.dir/' . $site_id . '/files/' );
}
}
}
```
| Uses | Description |
| --- | --- |
| [get\_current\_blog\_id()](get_current_blog_id) wp-includes/load.php | Retrieve the current site ID. |
| [add\_filter()](add_filter) wp-includes/plugin.php | Adds a callback function 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 |
| --- | --- |
| [3.0.0](https://developer.wordpress.org/reference/since/3.0.0/) | Introduced. |
wordpress stripos( $haystack, $needle ) stripos( $haystack, $needle )
=============================
File: `wp-includes/class-pop3.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/class-pop3.php/)
```
function stripos($haystack, $needle){
return strpos($haystack, stristr( $haystack, $needle ));
}
```
| Used By | Description |
| --- | --- |
| [is\_login()](is_login) wp-includes/load.php | Determines whether the current request is for the login screen. |
| [POP3::is\_ok()](../classes/pop3/is_ok) wp-includes/class-pop3.php | |
| [WP\_REST\_Post\_Format\_Search\_Handler::search\_items()](../classes/wp_rest_post_format_search_handler/search_items) wp-includes/rest-api/search/class-wp-rest-post-format-search-handler.php | Searches the object type content for a given search request. |
| [wp\_opcache\_invalidate()](wp_opcache_invalidate) wp-admin/includes/file.php | Attempts to clear the opcode cache for an individual PHP file. |
| [wp\_targeted\_link\_rel()](wp_targeted_link_rel) wp-includes/formatting.php | Adds `rel="noopener"` to all HTML A elements that have a target. |
| [wp\_register\_tinymce\_scripts()](wp_register_tinymce_scripts) wp-includes/script-loader.php | Registers TinyMCE scripts. |
| [wp\_map\_sidebars\_widgets()](wp_map_sidebars_widgets) wp-includes/widgets.php | Compares a list of sidebars with their widgets against an allowed list. |
| [wp\_map\_nav\_menu\_locations()](wp_map_nav_menu_locations) wp-includes/nav-menu.php | Maps nav menu locations according to assignments in previously active theme. |
| [Requests::request()](../classes/requests/request) wp-includes/class-requests.php | Main interface for HTTP requests |
| [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\_add\_inline\_script()](wp_add_inline_script) wp-includes/functions.wp-scripts.php | Adds extra code to a registered script. |
| [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\_Plugins\_List\_Table::\_search\_callback()](../classes/wp_plugins_list_table/_search_callback) wp-admin/includes/class-wp-plugins-list-table.php | |
| [WP\_Filesystem\_FTPext::parselisting()](../classes/wp_filesystem_ftpext/parselisting) wp-admin/includes/class-wp-filesystem-ftpext.php | |
| [WP\_MS\_Themes\_List\_Table::\_search\_callback()](../classes/wp_ms_themes_list_table/_search_callback) wp-admin/includes/class-wp-ms-themes-list-table.php | |
| [WP\_Filesystem\_Base::find\_folder()](../classes/wp_filesystem_base/find_folder) wp-admin/includes/class-wp-filesystem-base.php | Locates a folder on the remote filesystem. |
| [WP\_Themes\_List\_Table::search\_theme()](../classes/wp_themes_list_table/search_theme) wp-admin/includes/class-wp-themes-list-table.php | |
| [media\_buttons()](media_buttons) wp-admin/includes/media.php | Adds the media button to the editor. |
| [wp\_ajax\_wp\_compression\_test()](wp_ajax_wp_compression_test) wp-admin/includes/ajax-actions.php | Ajax handler for compression testing. |
| [esc\_url()](esc_url) wp-includes/formatting.php | Checks and cleans a URL. |
| [wp\_mail()](wp_mail) wp-includes/pluggable.php | Sends an email, similar to PHP’s mail function. |
| [WP\_Http\_Encoding::should\_decode()](../classes/wp_http_encoding/should_decode) wp-includes/class-wp-http-encoding.php | Whether the content be decoded based on the headers. |
| [WP\_Http\_Cookie::test()](../classes/wp_http_cookie/test) wp-includes/class-wp-http-cookie.php | Confirms that it’s OK to send this cookie to the URL checked against. |
| [add\_query\_arg()](add_query_arg) wp-includes/functions.php | Retrieves a modified URL query string. |
| [wp\_add\_inline\_style()](wp_add_inline_style) wp-includes/functions.wp-styles.php | Add extra CSS styles to a registered stylesheet. |
| [WP\_oEmbed::discover()](../classes/wp_oembed/discover) wp-includes/class-wp-oembed.php | Attempts to discover link tags at the given URL for an oEmbed provider. |
| [trackback\_rdf()](trackback_rdf) wp-includes/comment-template.php | Generates and displays the RDF for the trackback information of current post. |
| [\_WP\_Editors::editor()](../classes/_wp_editors/editor) wp-includes/class-wp-editor.php | Outputs the HTML for a single instance of the editor. |
wordpress update_metadata( string $meta_type, int $object_id, string $meta_key, mixed $meta_value, mixed $prev_value = '' ): int|bool update\_metadata( string $meta\_type, int $object\_id, string $meta\_key, mixed $meta\_value, mixed $prev\_value = '' ): int|bool
=================================================================================================================================
Updates metadata for the specified object. If no value already exists for the specified object ID and metadata key, the metadata will be added.
`$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. `$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 The new meta field ID if a field with the given key didn't exist and was therefore added, 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.
File: `wp-includes/meta.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/meta.php/)
```
function update_metadata( $meta_type, $object_id, $meta_key, $meta_value, $prev_value = '' ) {
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' );
$id_column = ( 'user' === $meta_type ) ? 'umeta_id' : 'meta_id';
// expected_slashed ($meta_key)
$raw_meta_key = $meta_key;
$meta_key = wp_unslash( $meta_key );
$passed_value = $meta_value;
$meta_value = wp_unslash( $meta_value );
$meta_value = sanitize_meta( $meta_key, $meta_value, $meta_type, $meta_subtype );
/**
* Short-circuits updating 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:
*
* - `update_post_metadata`
* - `update_comment_metadata`
* - `update_term_metadata`
* - `update_user_metadata`
*
* @since 3.1.0
*
* @param null|bool $check Whether to allow updating 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 mixed $prev_value Optional. Previous value to check before updating.
* If specified, only update existing metadata entries with
* this value. Otherwise, update all entries.
*/
$check = apply_filters( "update_{$meta_type}_metadata", null, $object_id, $meta_key, $meta_value, $prev_value );
if ( null !== $check ) {
return (bool) $check;
}
// Compare existing value to new value if no prev value given and the key exists only once.
if ( empty( $prev_value ) ) {
$old_value = get_metadata_raw( $meta_type, $object_id, $meta_key );
if ( is_countable( $old_value ) && count( $old_value ) === 1 ) {
if ( $old_value[0] === $meta_value ) {
return false;
}
}
}
$meta_ids = $wpdb->get_col( $wpdb->prepare( "SELECT $id_column FROM $table WHERE meta_key = %s AND $column = %d", $meta_key, $object_id ) );
if ( empty( $meta_ids ) ) {
return add_metadata( $meta_type, $object_id, $raw_meta_key, $passed_value );
}
$_meta_value = $meta_value;
$meta_value = maybe_serialize( $meta_value );
$data = compact( 'meta_value' );
$where = array(
$column => $object_id,
'meta_key' => $meta_key,
);
if ( ! empty( $prev_value ) ) {
$prev_value = maybe_serialize( $prev_value );
$where['meta_value'] = $prev_value;
}
foreach ( $meta_ids as $meta_id ) {
/**
* Fires immediately before updating 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).
*
* Possible hook names include:
*
* - `update_post_meta`
* - `update_comment_meta`
* - `update_term_meta`
* - `update_user_meta`
*
* @since 2.9.0
*
* @param int $meta_id ID of the metadata entry to 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( "update_{$meta_type}_meta", $meta_id, $object_id, $meta_key, $_meta_value );
if ( 'post' === $meta_type ) {
/**
* Fires immediately before updating a post's metadata.
*
* @since 2.9.0
*
* @param int $meta_id ID of metadata entry to update.
* @param int $object_id Post ID.
* @param string $meta_key Metadata key.
* @param mixed $meta_value Metadata value. This will be a PHP-serialized string representation of the value
* if the value is an array, an object, or itself a PHP-serialized string.
*/
do_action( 'update_postmeta', $meta_id, $object_id, $meta_key, $meta_value );
}
}
$result = $wpdb->update( $table, $data, $where );
if ( ! $result ) {
return false;
}
wp_cache_delete( $object_id, $meta_type . '_meta' );
foreach ( $meta_ids as $meta_id ) {
/**
* Fires immediately after updating 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).
*
* Possible hook names include:
*
* - `updated_post_meta`
* - `updated_comment_meta`
* - `updated_term_meta`
* - `updated_user_meta`
*
* @since 2.9.0
*
* @param int $meta_id ID of updated metadata entry.
* @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( "updated_{$meta_type}_meta", $meta_id, $object_id, $meta_key, $_meta_value );
if ( 'post' === $meta_type ) {
/**
* Fires immediately after updating a post's metadata.
*
* @since 2.9.0
*
* @param int $meta_id ID of updated metadata entry.
* @param int $object_id Post ID.
* @param string $meta_key Metadata key.
* @param mixed $meta_value Metadata value. This will be a PHP-serialized string representation of the value
* if the value is an array, an object, or itself a PHP-serialized string.
*/
do_action( 'updated_postmeta', $meta_id, $object_id, $meta_key, $meta_value );
}
}
return true;
}
```
[do\_action( 'updated\_postmeta', int $meta\_id, int $object\_id, string $meta\_key, mixed $meta\_value )](../hooks/updated_postmeta)
Fires immediately after updating a post’s metadata.
[do\_action( "updated\_{$meta\_type}\_meta", int $meta\_id, int $object\_id, string $meta\_key, mixed $\_meta\_value )](../hooks/updated_meta_type_meta)
Fires immediately after updating metadata of a specific type.
[do\_action( 'update\_postmeta', int $meta\_id, int $object\_id, string $meta\_key, mixed $meta\_value )](../hooks/update_postmeta)
Fires immediately before updating a post’s metadata.
[do\_action( "update\_{$meta\_type}\_meta", int $meta\_id, int $object\_id, string $meta\_key, mixed $\_meta\_value )](../hooks/update_meta_type_meta)
Fires immediately before updating metadata of a specific type.
[apply\_filters( "update\_{$meta\_type}\_metadata", null|bool $check, int $object\_id, string $meta\_key, mixed $meta\_value, mixed $prev\_value )](../hooks/update_meta_type_metadata)
Short-circuits updating metadata of a specific type.
| Uses | Description |
| --- | --- |
| [get\_metadata\_raw()](get_metadata_raw) wp-includes/meta.php | Retrieves raw metadata value for the specified object. |
| [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::get\_col()](../classes/wpdb/get_col) wp-includes/class-wpdb.php | Retrieves one column from the database. |
| [wpdb::update()](../classes/wpdb/update) wp-includes/class-wpdb.php | Updates a row in 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. |
| [add\_metadata()](add_metadata) wp-includes/meta.php | Adds metadata for the specified object. |
| [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::prepare()](../classes/wpdb/prepare) wp-includes/class-wpdb.php | Prepares a SQL query for safe execution. |
| Used By | Description |
| --- | --- |
| [update\_site\_meta()](update_site_meta) wp-includes/ms-site.php | Updates metadata for a site. |
| [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. |
| [update\_term\_meta()](update_term_meta) wp-includes/taxonomy.php | Updates term metadata. |
| [update\_user\_meta()](update_user_meta) wp-includes/user.php | Updates user meta field based on user ID. |
| [update\_post\_meta()](update_post_meta) wp-includes/post.php | Updates a post meta field based on the given post ID. |
| [update\_comment\_meta()](update_comment_meta) wp-includes/comment.php | Updates comment meta field based on comment ID. |
| Version | Description |
| --- | --- |
| [2.9.0](https://developer.wordpress.org/reference/since/2.9.0/) | Introduced. |
| programming_docs |
wordpress get_post_to_edit( int $id ): WP_Post get\_post\_to\_edit( int $id ): WP\_Post
========================================
This function has been deprecated. Use [get\_post()](get_post) instead.
Gets an existing post and format it for editing.
* [get\_post()](get_post)
`$id` int Required [WP\_Post](../classes/wp_post)
File: `wp-admin/includes/deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/deprecated.php/)
```
function get_post_to_edit( $id ) {
_deprecated_function( __FUNCTION__, '3.5.0', 'get_post()' );
return get_post( $id, OBJECT, 'edit' );
}
```
| Uses | Description |
| --- | --- |
| [\_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 |
| --- | --- |
| [3.5.0](https://developer.wordpress.org/reference/since/3.5.0/) | Use [get\_post()](get_post) |
| [2.0.0](https://developer.wordpress.org/reference/since/2.0.0/) | Introduced. |
wordpress get_link( int $bookmark_id, string $output = OBJECT, string $filter = 'raw' ): object|array get\_link( int $bookmark\_id, string $output = OBJECT, string $filter = 'raw' ): object|array
=============================================================================================
This function has been deprecated. Use [get\_bookmark()](get_bookmark) instead.
Retrieves bookmark data based on ID.
* [get\_bookmark()](get_bookmark)
`$bookmark_id` int Required ID of link `$output` string Optional Type of output. Accepts OBJECT, ARRAY\_N, or ARRAY\_A.
Default: `OBJECT`
`$filter` string Optional How to filter the link for output. Accepts `'raw'`, `'edit'`, `'attribute'`, `'js'`, `'db'`, or `'display'`. Default `'raw'`. Default: `'raw'`
object|array Bookmark object or array, depending on the type specified by `$output`.
File: `wp-includes/deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/deprecated.php/)
```
function get_link( $bookmark_id, $output = OBJECT, $filter = 'raw' ) {
_deprecated_function( __FUNCTION__, '2.1.0', 'get_bookmark()' );
return get_bookmark($bookmark_id, $output, $filter);
}
```
| Uses | Description |
| --- | --- |
| [get\_bookmark()](get_bookmark) wp-includes/bookmark.php | Retrieves bookmark data. |
| [\_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\_bookmark()](get_bookmark) |
| [2.0.0](https://developer.wordpress.org/reference/since/2.0.0/) | Introduced. |
wordpress revoke_super_admin( int $user_id ): bool revoke\_super\_admin( int $user\_id ): bool
===========================================
Revokes Super Admin privileges.
`$user_id` int Required ID of the user Super Admin privileges to be revoked from. bool True on success, false on failure. This can fail when the user's email is the network admin email or when the `$super_admins` global is defined.
File: `wp-includes/capabilities.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/capabilities.php/)
```
function revoke_super_admin( $user_id ) {
// If global super_admins override is defined, there is nothing to do here.
if ( isset( $GLOBALS['super_admins'] ) || ! is_multisite() ) {
return false;
}
/**
* Fires before the user's Super Admin privileges are revoked.
*
* @since 3.0.0
*
* @param int $user_id ID of the user Super Admin privileges are being revoked from.
*/
do_action( 'revoke_super_admin', $user_id );
// Directly fetch site_admins instead of using get_super_admins().
$super_admins = get_site_option( 'site_admins', array( 'admin' ) );
$user = get_userdata( $user_id );
if ( $user && 0 !== strcasecmp( $user->user_email, get_site_option( 'admin_email' ) ) ) {
$key = array_search( $user->user_login, $super_admins, true );
if ( false !== $key ) {
unset( $super_admins[ $key ] );
update_site_option( 'site_admins', $super_admins );
/**
* Fires after the user's Super Admin privileges are revoked.
*
* @since 3.0.0
*
* @param int $user_id ID of the user Super Admin privileges were revoked from.
*/
do_action( 'revoked_super_admin', $user_id );
return true;
}
}
return false;
}
```
[do\_action( 'revoked\_super\_admin', int $user\_id )](../hooks/revoked_super_admin)
Fires after the user’s Super Admin privileges are revoked.
[do\_action( 'revoke\_super\_admin', int $user\_id )](../hooks/revoke_super_admin)
Fires before the user’s Super Admin privileges are revoked.
| 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\_userdata()](get_userdata) wp-includes/pluggable.php | Retrieves user info by user ID. |
| [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. |
| Version | Description |
| --- | --- |
| [3.0.0](https://developer.wordpress.org/reference/since/3.0.0/) | Introduced. |
wordpress is_taxonomy( string $taxonomy ): bool is\_taxonomy( string $taxonomy ): bool
======================================
This function has been deprecated. Use [taxonomy\_exists()](taxonomy_exists) instead.
Checks that the taxonomy name exists.
* [taxonomy\_exists()](taxonomy_exists)
`$taxonomy` string Required Name of taxonomy object bool Whether the taxonomy exists.
File: `wp-includes/deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/deprecated.php/)
```
function is_taxonomy( $taxonomy ) {
_deprecated_function( __FUNCTION__, '3.0.0', 'taxonomy_exists()' );
return taxonomy_exists( $taxonomy );
}
```
| Uses | Description |
| --- | --- |
| [taxonomy\_exists()](taxonomy_exists) wp-includes/taxonomy.php | Determines whether the taxonomy name exists. |
| [\_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 [taxonomy\_exists()](taxonomy_exists) |
| [2.3.0](https://developer.wordpress.org/reference/since/2.3.0/) | Introduced. |
wordpress wp_templating_constants() wp\_templating\_constants()
===========================
Defines templating-related WordPress constants.
File: `wp-includes/default-constants.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/default-constants.php/)
```
function wp_templating_constants() {
/**
* Filesystem path to the current active template directory.
*
* @since 1.5.0
*/
define( 'TEMPLATEPATH', get_template_directory() );
/**
* Filesystem path to the current active template stylesheet directory.
*
* @since 2.1.0
*/
define( 'STYLESHEETPATH', get_stylesheet_directory() );
/**
* Slug of the default theme for this installation.
* Used as the default theme when installing new sites.
* It will be used as the fallback if the active theme doesn't exist.
*
* @since 3.0.0
*
* @see WP_Theme::get_core_default_theme()
*/
if ( ! defined( 'WP_DEFAULT_THEME' ) ) {
define( 'WP_DEFAULT_THEME', 'twentytwentythree' );
}
}
```
| Uses | Description |
| --- | --- |
| [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. |
| Version | Description |
| --- | --- |
| [3.0.0](https://developer.wordpress.org/reference/since/3.0.0/) | Introduced. |
wordpress wp_unregister_widget_control( int|string $id ) wp\_unregister\_widget\_control( int|string $id )
=================================================
Remove control callback for widget.
`$id` int|string Required Widget ID. File: `wp-includes/widgets.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/widgets.php/)
```
function wp_unregister_widget_control( $id ) {
wp_register_widget_control( $id, '', '' );
}
```
| Uses | Description |
| --- | --- |
| [wp\_register\_widget\_control()](wp_register_widget_control) wp-includes/widgets.php | Registers widget control callback for customizing options. |
| Used By | Description |
| --- | --- |
| [unregister\_widget\_control()](unregister_widget_control) wp-includes/deprecated.php | Alias of [wp\_unregister\_widget\_control()](wp_unregister_widget_control) . |
| [wp\_unregister\_sidebar\_widget()](wp_unregister_sidebar_widget) wp-includes/widgets.php | Remove widget from sidebar. |
| Version | Description |
| --- | --- |
| [2.2.0](https://developer.wordpress.org/reference/since/2.2.0/) | Introduced. |
wordpress enqueue_block_styles_assets() enqueue\_block\_styles\_assets()
================================
Function responsible for enqueuing the styles required for block styles functionality on the editor and on the frontend.
File: `wp-includes/script-loader.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/script-loader.php/)
```
function enqueue_block_styles_assets() {
global $wp_styles;
$block_styles = WP_Block_Styles_Registry::get_instance()->get_all_registered();
foreach ( $block_styles as $block_name => $styles ) {
foreach ( $styles as $style_properties ) {
if ( isset( $style_properties['style_handle'] ) ) {
// If the site loads separate styles per-block, enqueue the stylesheet on render.
if ( wp_should_load_separate_core_block_assets() ) {
add_filter(
'render_block',
function( $html, $block ) use ( $block_name, $style_properties ) {
if ( $block['blockName'] === $block_name ) {
wp_enqueue_style( $style_properties['style_handle'] );
}
return $html;
},
10,
2
);
} else {
wp_enqueue_style( $style_properties['style_handle'] );
}
}
if ( isset( $style_properties['inline_style'] ) ) {
// Default to "wp-block-library".
$handle = 'wp-block-library';
// If the site loads separate styles per-block, check if the block has a stylesheet registered.
if ( wp_should_load_separate_core_block_assets() ) {
$block_stylesheet_handle = generate_block_asset_handle( $block_name, 'style' );
if ( isset( $wp_styles->registered[ $block_stylesheet_handle ] ) ) {
$handle = $block_stylesheet_handle;
}
}
// Add inline styles to the calculated handle.
wp_add_inline_style( $handle, $style_properties['inline_style'] );
}
}
}
}
```
| Uses | Description |
| --- | --- |
| [wp\_should\_load\_separate\_core\_block\_assets()](wp_should_load_separate_core_block_assets) wp-includes/script-loader.php | Checks whether separate styles should be loaded for core blocks on-render. |
| [generate\_block\_asset\_handle()](generate_block_asset_handle) wp-includes/blocks.php | Generates the name for an asset based on the name of the block and the field name provided. |
| [WP\_Block\_Styles\_Registry::get\_instance()](../classes/wp_block_styles_registry/get_instance) wp-includes/class-wp-block-styles-registry.php | Utility method to retrieve the main instance of the class. |
| [wp\_enqueue\_style()](wp_enqueue_style) wp-includes/functions.wp-styles.php | Enqueue 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. |
| [add\_filter()](add_filter) wp-includes/plugin.php | Adds a callback function to a filter hook. |
| Version | Description |
| --- | --- |
| [5.3.0](https://developer.wordpress.org/reference/since/5.3.0/) | Introduced. |
wordpress set_user_setting( string $name, string $value ): bool|null set\_user\_setting( string $name, string $value ): bool|null
============================================================
Adds or updates user interface setting.
Both `$name` and `$value` can contain only ASCII letters, numbers, hyphens, and underscores.
This function has to be used before any output has started as it calls `setcookie()`.
`$name` string Required The name of the setting. `$value` string Required The value for the setting. bool|null True if set successfully, false otherwise.
Null if the current user is not a member of the site.
File: `wp-includes/option.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/option.php/)
```
function set_user_setting( $name, $value ) {
if ( headers_sent() ) {
return false;
}
$all_user_settings = get_all_user_settings();
$all_user_settings[ $name ] = $value;
return wp_set_all_user_settings( $all_user_settings );
}
```
| Uses | Description |
| --- | --- |
| [get\_all\_user\_settings()](get_all_user_settings) wp-includes/option.php | Retrieves all user interface settings. |
| [wp\_set\_all\_user\_settings()](wp_set_all_user_settings) wp-includes/option.php | Private. Sets all user interface settings. |
| Used By | Description |
| --- | --- |
| [WP\_MS\_Users\_List\_Table::prepare\_items()](../classes/wp_ms_users_list_table/prepare_items) wp-admin/includes/class-wp-ms-users-list-table.php | |
| [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. |
| [WP\_Comments\_List\_Table::prepare\_items()](../classes/wp_comments_list_table/prepare_items) wp-admin/includes/class-wp-comments-list-table.php | |
| [WP\_Posts\_List\_Table::prepare\_items()](../classes/wp_posts_list_table/prepare_items) wp-admin/includes/class-wp-posts-list-table.php | |
| Version | Description |
| --- | --- |
| [2.8.0](https://developer.wordpress.org/reference/since/2.8.0/) | Introduced. |
wordpress is_user_logged_in(): bool is\_user\_logged\_in(): bool
============================
Determines whether the current visitor is a logged in user.
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 True if user is logged in, false if not logged in.
File: `wp-includes/pluggable.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/pluggable.php/)
```
function is_user_logged_in() {
$user = wp_get_current_user();
return $user->exists();
}
```
| Uses | Description |
| --- | --- |
| [wp\_get\_current\_user()](wp_get_current_user) wp-includes/pluggable.php | Retrieves the current user 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. |
| [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. |
| [get\_the\_block\_template\_html()](get_the_block_template_html) wp-includes/block-template.php | Returns the markup for the current template. |
| [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\_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. |
| [WP\_Site\_Health::check\_wp\_version\_check\_exists()](../classes/wp_site_health/check_wp_version_check_exists) wp-admin/includes/class-wp-site-health.php | Tests whether `wp_version_check` is blocked. |
| [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::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\_enqueue\_code\_editor()](wp_enqueue_code_editor) wp-includes/general-template.php | Enqueues assets needed by the code editor for the given settings. |
| [rest\_authorization\_required\_code()](rest_authorization_required_code) wp-includes/rest-api.php | Returns a contextual HTTP error code for authorization failure. |
| [WP\_Customize\_Manager::changeset\_data()](../classes/wp_customize_manager/changeset_data) wp-includes/class-wp-customize-manager.php | Gets changeset data. |
| [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\_check\_comment\_flood()](wp_check_comment_flood) wp-includes/comment.php | Checks whether comment flooding is occurring. |
| [rest\_send\_cors\_headers()](rest_send_cors_headers) wp-includes/rest-api.php | Sends Cross-Origin Resource Sharing headers with API requests. |
| [rest\_cookie\_check\_errors()](rest_cookie_check_errors) wp-includes/rest-api.php | Checks for errors when using cookie-based authentication. |
| [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\_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. |
| [retrieve\_password()](retrieve_password) wp-includes/user.php | Handles sending a password retrieval email to a user. |
| [validate\_another\_blog\_signup()](validate_another_blog_signup) wp-signup.php | Validates a new site sign-up for an existing user. |
| [show\_blog\_form()](show_blog_form) wp-signup.php | Generates and displays the Sign-up and Create Site forms. |
| [validate\_blog\_form()](validate_blog_form) wp-signup.php | Validates the new site sign-up. |
| [\_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. |
| [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::setup\_theme()](../classes/wp_customize_manager/setup_theme) wp-includes/class-wp-customize-manager.php | Starts preview and customize theme. |
| [wp\_heartbeat\_settings()](wp_heartbeat_settings) wp-includes/general-template.php | Default settings for heartbeat. |
| [user\_can\_richedit()](user_can_richedit) wp-includes/general-template.php | Determines whether the user can access the visual editor. |
| [wp\_loginout()](wp_loginout) wp-includes/general-template.php | Displays the Log In/Out link. |
| [wp\_register()](wp_register) wp-includes/general-template.php | Displays the Registration or Admin link. |
| [WP::send\_headers()](../classes/wp/send_headers) wp-includes/class-wp.php | Sends additional HTTP headers for caching, content type, etc. |
| [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\_Query::parse\_search()](../classes/wp_query/parse_search) wp-includes/class-wp-query.php | Generates SQL for the WHERE clause based on passed search terms. |
| [wp\_auth\_check()](wp_auth_check) wp-includes/functions.php | Checks whether a user is still logged in, for the heartbeat. |
| [wp\_auth\_check\_load()](wp_auth_check_load) wp-includes/functions.php | Loads the auth check for monitoring whether the user is still logged in. |
| [get\_adjacent\_post()](get_adjacent_post) wp-includes/link-template.php | Retrieves the adjacent post. |
| [WP\_Admin\_Bar::\_render()](../classes/wp_admin_bar/_render) wp-includes/class-wp-admin-bar.php | |
| [WP\_Admin\_Bar::initialize()](../classes/wp_admin_bar/initialize) wp-includes/class-wp-admin-bar.php | Initializes the admin bar. |
| [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. |
| [is\_admin\_bar\_showing()](is_admin_bar_showing) wp-includes/admin-bar.php | Determines whether the admin bar should be showing. |
| [get\_body\_class()](get_body_class) wp-includes/post-template.php | Retrieves an array of the class names for the body element. |
| [get\_posts\_by\_author\_sql()](get_posts_by_author_sql) wp-includes/post.php | Retrieves the post SQL based on capability, author, and type. |
| [\_count\_posts\_cache\_key()](_count_posts_cache_key) wp-includes/post.php | Returns the cache key for [wp\_count\_posts()](wp_count_posts) based on the passed arguments. |
| [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. |
| [get\_post\_reply\_link()](get_post_reply_link) wp-includes/comment-template.php | Retrieves HTML content for reply to post link. |
| [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. |
| [comments\_template()](comments_template) wp-includes/comment-template.php | Loads the comment template specified in $file. |
| [get\_comment\_reply\_link()](get_comment_reply_link) wp-includes/comment-template.php | Retrieves HTML content for reply to comment link. |
| [WP\_Customize\_Widgets::wp\_ajax\_update\_widget()](../classes/wp_customize_widgets/wp_ajax_update_widget) wp-includes/class-wp-customize-widgets.php | Updates widget settings asynchronously. |
| [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 |
| --- | --- |
| [2.0.0](https://developer.wordpress.org/reference/since/2.0.0/) | Introduced. |
| programming_docs |
wordpress maybe_add_existing_user_to_blog() maybe\_add\_existing\_user\_to\_blog()
======================================
Adds a new user to a blog by visiting /newbloguser/{key}/.
This will only work when the user’s details are saved as an option keyed as ‘new\_user\_{key}’, where ‘{key}’ is a hash generated for the user to be added, as when a user is invited through the regular WP Add User interface.
File: `wp-includes/ms-functions.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/ms-functions.php/)
```
function maybe_add_existing_user_to_blog() {
if ( false === strpos( $_SERVER['REQUEST_URI'], '/newbloguser/' ) ) {
return;
}
$parts = explode( '/', $_SERVER['REQUEST_URI'] );
$key = array_pop( $parts );
if ( '' === $key ) {
$key = array_pop( $parts );
}
$details = get_option( 'new_user_' . $key );
if ( ! empty( $details ) ) {
delete_option( 'new_user_' . $key );
}
if ( empty( $details ) || is_wp_error( add_existing_user_to_blog( $details ) ) ) {
wp_die(
sprintf(
/* translators: %s: Home URL. */
__( 'An error occurred adding you to this site. Go to the <a href="%s">homepage</a>.' ),
home_url()
)
);
}
wp_die(
sprintf(
/* translators: 1: Home URL, 2: Admin URL. */
__( 'You have been added to this site. Please visit the <a href="%1$s">homepage</a> or <a href="%2$s">log in</a> using your username and password.' ),
home_url(),
admin_url()
),
__( 'WordPress › Success' ),
array( 'response' => 200 )
);
}
```
| Uses | Description |
| --- | --- |
| [add\_existing\_user\_to\_blog()](add_existing_user_to_blog) wp-includes/ms-functions.php | Adds a user to a blog based on details from [maybe\_add\_existing\_user\_to\_blog()](maybe_add_existing_user_to_blog) . |
| [delete\_option()](delete_option) wp-includes/option.php | Removes option by name. Prevents removal of protected WordPress options. |
| [\_\_()](__) 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. |
| [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\_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. |
| Version | Description |
| --- | --- |
| [MU (3.0.0)](https://developer.wordpress.org/reference/since/mu.3.0.0/) | Introduced. |
wordpress update_core( string $from, string $to ): string|WP_Error update\_core( string $from, string $to ): string|WP\_Error
==========================================================
Upgrades the core of WordPress.
This will create a .maintenance file at the base of the WordPress directory to ensure that people can not access the web site, when the files are being copied to their locations.
The files in the `$_old_files` list will be removed and the new files copied from the zip file after the database is upgraded.
The files in the `$_new_bundled_files` list will be added to the installation if the version is greater than or equal to the old version being upgraded.
The steps for the upgrader for after the new release is downloaded and unzipped is:
1. Test unzipped location for select files to ensure that unzipped worked.
2. Create the .maintenance file in current WordPress base.
3. Copy new WordPress directory over old WordPress files.
4. Upgrade WordPress to new version.
4.1. Copy all files/folders other than wp-content 4.2. Copy any language files to WP\_LANG\_DIR (which may differ from WP\_CONTENT\_DIR 4.3. Copy any new bundled themes/plugins to their respective locations
5. Delete new WordPress directory path.
6. Delete .maintenance file.
7. Remove old files.
8. Delete ‘update\_core’ option.
There are several areas of failure. For instance if PHP times out before step 6, then you will not be able to access any portion of your site. Also, since the upgrade will not continue where it left off, you will not be able to automatically remove old files and remove the ‘update\_core’ option. This isn’t that bad.
If the copy of the new WordPress over the old fails, then the worse is that the new WordPress directory will remain.
If it is assumed that every file will be copied over, including plugins and themes, then if you edit the default theme, you should rename it, so that your changes remain.
`$from` string Required New release unzipped path. `$to` string Required Path to old WordPress installation. string|[WP\_Error](../classes/wp_error) New WordPress version on success, [WP\_Error](../classes/wp_error) on failure.
File: `wp-admin/includes/update-core.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/update-core.php/)
```
function update_core( $from, $to ) {
global $wp_filesystem, $_old_files, $_new_bundled_files, $wpdb;
set_time_limit( 300 );
/**
* Filters feedback messages displayed during the core update process.
*
* The filter is first evaluated after the zip file for the latest version
* has been downloaded and unzipped. It is evaluated five more times during
* the process:
*
* 1. Before WordPress begins the core upgrade process.
* 2. Before Maintenance Mode is enabled.
* 3. Before WordPress begins copying over the necessary files.
* 4. Before Maintenance Mode is disabled.
* 5. Before the database is upgraded.
*
* @since 2.5.0
*
* @param string $feedback The core update feedback messages.
*/
apply_filters( 'update_feedback', __( 'Verifying the unpacked files…' ) );
// Sanity check the unzipped distribution.
$distro = '';
$roots = array( '/wordpress/', '/wordpress-mu/' );
foreach ( $roots as $root ) {
if ( $wp_filesystem->exists( $from . $root . 'readme.html' )
&& $wp_filesystem->exists( $from . $root . 'wp-includes/version.php' )
) {
$distro = $root;
break;
}
}
if ( ! $distro ) {
$wp_filesystem->delete( $from, true );
return new WP_Error( 'insane_distro', __( 'The update could not be unpacked' ) );
}
/*
* Import $wp_version, $required_php_version, and $required_mysql_version from the new version.
* DO NOT globalize any variables imported from `version-current.php` in this function.
*
* BC Note: $wp_filesystem->wp_content_dir() returned unslashed pre-2.8.
*/
$versions_file = trailingslashit( $wp_filesystem->wp_content_dir() ) . 'upgrade/version-current.php';
if ( ! $wp_filesystem->copy( $from . $distro . 'wp-includes/version.php', $versions_file ) ) {
$wp_filesystem->delete( $from, true );
return new WP_Error(
'copy_failed_for_version_file',
__( 'The update cannot be installed because some files could not be copied. This is usually due to inconsistent file permissions.' ),
'wp-includes/version.php'
);
}
$wp_filesystem->chmod( $versions_file, FS_CHMOD_FILE );
/*
* `wp_opcache_invalidate()` only exists in WordPress 5.5 or later,
* so don't run it when upgrading from older versions.
*/
if ( function_exists( 'wp_opcache_invalidate' ) ) {
wp_opcache_invalidate( $versions_file );
}
require WP_CONTENT_DIR . '/upgrade/version-current.php';
$wp_filesystem->delete( $versions_file );
$php_version = PHP_VERSION;
$mysql_version = $wpdb->db_version();
$old_wp_version = $GLOBALS['wp_version']; // The version of WordPress we're updating from.
$development_build = ( false !== strpos( $old_wp_version . $wp_version, '-' ) ); // A dash in the version indicates a development release.
$php_compat = version_compare( $php_version, $required_php_version, '>=' );
if ( file_exists( WP_CONTENT_DIR . '/db.php' ) && empty( $wpdb->is_mysql ) ) {
$mysql_compat = true;
} else {
$mysql_compat = version_compare( $mysql_version, $required_mysql_version, '>=' );
}
if ( ! $mysql_compat || ! $php_compat ) {
$wp_filesystem->delete( $from, true );
}
$php_update_message = '';
if ( function_exists( 'wp_get_update_php_url' ) ) {
$php_update_message = '</p><p>' . sprintf(
/* translators: %s: URL to Update PHP page. */
__( '<a href="%s">Learn more about updating PHP</a>.' ),
esc_url( wp_get_update_php_url() )
);
if ( function_exists( 'wp_get_update_php_annotation' ) ) {
$annotation = wp_get_update_php_annotation();
if ( $annotation ) {
$php_update_message .= '</p><p><em>' . $annotation . '</em>';
}
}
}
if ( ! $mysql_compat && ! $php_compat ) {
return new WP_Error(
'php_mysql_not_compatible',
sprintf(
/* translators: 1: WordPress version number, 2: Minimum required PHP version number, 3: Minimum required MySQL version number, 4: Current PHP version number, 5: Current MySQL version number. */
__( 'The update cannot be installed because WordPress %1$s requires PHP version %2$s or higher and MySQL version %3$s or higher. You are running PHP version %4$s and MySQL version %5$s.' ),
$wp_version,
$required_php_version,
$required_mysql_version,
$php_version,
$mysql_version
) . $php_update_message
);
} elseif ( ! $php_compat ) {
return new WP_Error(
'php_not_compatible',
sprintf(
/* translators: 1: WordPress version number, 2: Minimum required PHP version number, 3: Current PHP version number. */
__( 'The update cannot be installed because WordPress %1$s requires PHP version %2$s or higher. You are running version %3$s.' ),
$wp_version,
$required_php_version,
$php_version
) . $php_update_message
);
} elseif ( ! $mysql_compat ) {
return new WP_Error(
'mysql_not_compatible',
sprintf(
/* translators: 1: WordPress version number, 2: Minimum required MySQL version number, 3: Current MySQL version number. */
__( 'The update cannot be installed because WordPress %1$s requires MySQL version %2$s or higher. You are running version %3$s.' ),
$wp_version,
$required_mysql_version,
$mysql_version
)
);
}
// Add a warning when the JSON PHP extension is missing.
if ( ! extension_loaded( 'json' ) ) {
return new WP_Error(
'php_not_compatible_json',
sprintf(
/* translators: 1: WordPress version number, 2: The PHP extension name needed. */
__( 'The update cannot be installed because WordPress %1$s requires the %2$s PHP extension.' ),
$wp_version,
'JSON'
)
);
}
/** This filter is documented in wp-admin/includes/update-core.php */
apply_filters( 'update_feedback', __( 'Preparing to install the latest version…' ) );
// Don't copy wp-content, we'll deal with that below.
// We also copy version.php last so failed updates report their old version.
$skip = array( 'wp-content', 'wp-includes/version.php' );
$check_is_writable = array();
// Check to see which files don't really need updating - only available for 3.7 and higher.
if ( function_exists( 'get_core_checksums' ) ) {
// Find the local version of the working directory.
$working_dir_local = WP_CONTENT_DIR . '/upgrade/' . basename( $from ) . $distro;
$checksums = get_core_checksums( $wp_version, isset( $wp_local_package ) ? $wp_local_package : 'en_US' );
if ( is_array( $checksums ) && isset( $checksums[ $wp_version ] ) ) {
$checksums = $checksums[ $wp_version ]; // Compat code for 3.7-beta2.
}
if ( is_array( $checksums ) ) {
foreach ( $checksums as $file => $checksum ) {
if ( 'wp-content' === substr( $file, 0, 10 ) ) {
continue;
}
if ( ! file_exists( ABSPATH . $file ) ) {
continue;
}
if ( ! file_exists( $working_dir_local . $file ) ) {
continue;
}
if ( '.' === dirname( $file )
&& in_array( pathinfo( $file, PATHINFO_EXTENSION ), array( 'html', 'txt' ), true )
) {
continue;
}
if ( md5_file( ABSPATH . $file ) === $checksum ) {
$skip[] = $file;
} else {
$check_is_writable[ $file ] = ABSPATH . $file;
}
}
}
}
// If we're using the direct method, we can predict write failures that are due to permissions.
if ( $check_is_writable && 'direct' === $wp_filesystem->method ) {
$files_writable = array_filter( $check_is_writable, array( $wp_filesystem, 'is_writable' ) );
if ( $files_writable !== $check_is_writable ) {
$files_not_writable = array_diff_key( $check_is_writable, $files_writable );
foreach ( $files_not_writable as $relative_file_not_writable => $file_not_writable ) {
// If the writable check failed, chmod file to 0644 and try again, same as copy_dir().
$wp_filesystem->chmod( $file_not_writable, FS_CHMOD_FILE );
if ( $wp_filesystem->is_writable( $file_not_writable ) ) {
unset( $files_not_writable[ $relative_file_not_writable ] );
}
}
// Store package-relative paths (the key) of non-writable files in the WP_Error object.
$error_data = version_compare( $old_wp_version, '3.7-beta2', '>' ) ? array_keys( $files_not_writable ) : '';
if ( $files_not_writable ) {
return new WP_Error(
'files_not_writable',
__( 'The update cannot be installed because your site is unable to copy some files. This is usually due to inconsistent file permissions.' ),
implode( ', ', $error_data )
);
}
}
}
/** This filter is documented in wp-admin/includes/update-core.php */
apply_filters( 'update_feedback', __( 'Enabling Maintenance mode…' ) );
// Create maintenance file to signal that we are upgrading.
$maintenance_string = '<?php $upgrading = ' . time() . '; ?>';
$maintenance_file = $to . '.maintenance';
$wp_filesystem->delete( $maintenance_file );
$wp_filesystem->put_contents( $maintenance_file, $maintenance_string, FS_CHMOD_FILE );
/** This filter is documented in wp-admin/includes/update-core.php */
apply_filters( 'update_feedback', __( 'Copying the required files…' ) );
// Copy new versions of WP files into place.
$result = copy_dir( $from . $distro, $to, $skip );
if ( is_wp_error( $result ) ) {
$result = new WP_Error(
$result->get_error_code(),
$result->get_error_message(),
substr( $result->get_error_data(), strlen( $to ) )
);
}
// Since we know the core files have copied over, we can now copy the version file.
if ( ! is_wp_error( $result ) ) {
if ( ! $wp_filesystem->copy( $from . $distro . 'wp-includes/version.php', $to . 'wp-includes/version.php', true /* overwrite */ ) ) {
$wp_filesystem->delete( $from, true );
$result = new WP_Error(
'copy_failed_for_version_file',
__( 'The update cannot be installed because your site is unable to copy some files. This is usually due to inconsistent file permissions.' ),
'wp-includes/version.php'
);
}
$wp_filesystem->chmod( $to . 'wp-includes/version.php', FS_CHMOD_FILE );
/*
* `wp_opcache_invalidate()` only exists in WordPress 5.5 or later,
* so don't run it when upgrading from older versions.
*/
if ( function_exists( 'wp_opcache_invalidate' ) ) {
wp_opcache_invalidate( $to . 'wp-includes/version.php' );
}
}
// Check to make sure everything copied correctly, ignoring the contents of wp-content.
$skip = array( 'wp-content' );
$failed = array();
if ( isset( $checksums ) && is_array( $checksums ) ) {
foreach ( $checksums as $file => $checksum ) {
if ( 'wp-content' === substr( $file, 0, 10 ) ) {
continue;
}
if ( ! file_exists( $working_dir_local . $file ) ) {
continue;
}
if ( '.' === dirname( $file )
&& in_array( pathinfo( $file, PATHINFO_EXTENSION ), array( 'html', 'txt' ), true )
) {
$skip[] = $file;
continue;
}
if ( file_exists( ABSPATH . $file ) && md5_file( ABSPATH . $file ) === $checksum ) {
$skip[] = $file;
} else {
$failed[] = $file;
}
}
}
// Some files didn't copy properly.
if ( ! empty( $failed ) ) {
$total_size = 0;
foreach ( $failed as $file ) {
if ( file_exists( $working_dir_local . $file ) ) {
$total_size += filesize( $working_dir_local . $file );
}
}
// If we don't have enough free space, it isn't worth trying again.
// Unlikely to be hit due to the check in unzip_file().
$available_space = function_exists( 'disk_free_space' ) ? @disk_free_space( ABSPATH ) : false;
if ( $available_space && $total_size >= $available_space ) {
$result = new WP_Error( 'disk_full', __( 'There is not enough free disk space to complete the update.' ) );
} else {
$result = copy_dir( $from . $distro, $to, $skip );
if ( is_wp_error( $result ) ) {
$result = new WP_Error(
$result->get_error_code() . '_retry',
$result->get_error_message(),
substr( $result->get_error_data(), strlen( $to ) )
);
}
}
}
// Custom content directory needs updating now.
// Copy languages.
if ( ! is_wp_error( $result ) && $wp_filesystem->is_dir( $from . $distro . 'wp-content/languages' ) ) {
if ( WP_LANG_DIR !== ABSPATH . WPINC . '/languages' || @is_dir( WP_LANG_DIR ) ) {
$lang_dir = WP_LANG_DIR;
} else {
$lang_dir = WP_CONTENT_DIR . '/languages';
}
// Check if the language directory exists first.
if ( ! @is_dir( $lang_dir ) && 0 === strpos( $lang_dir, ABSPATH ) ) {
// If it's within the ABSPATH we can handle it here, otherwise they're out of luck.
$wp_filesystem->mkdir( $to . str_replace( ABSPATH, '', $lang_dir ), FS_CHMOD_DIR );
clearstatcache(); // For FTP, need to clear the stat cache.
}
if ( @is_dir( $lang_dir ) ) {
$wp_lang_dir = $wp_filesystem->find_folder( $lang_dir );
if ( $wp_lang_dir ) {
$result = copy_dir( $from . $distro . 'wp-content/languages/', $wp_lang_dir );
if ( is_wp_error( $result ) ) {
$result = new WP_Error(
$result->get_error_code() . '_languages',
$result->get_error_message(),
substr( $result->get_error_data(), strlen( $wp_lang_dir ) )
);
}
}
}
}
/** This filter is documented in wp-admin/includes/update-core.php */
apply_filters( 'update_feedback', __( 'Disabling Maintenance mode…' ) );
// Remove maintenance file, we're done with potential site-breaking changes.
$wp_filesystem->delete( $maintenance_file );
// 3.5 -> 3.5+ - an empty twentytwelve directory was created upon upgrade to 3.5 for some users,
// preventing installation of Twenty Twelve.
if ( '3.5' === $old_wp_version ) {
if ( is_dir( WP_CONTENT_DIR . '/themes/twentytwelve' )
&& ! file_exists( WP_CONTENT_DIR . '/themes/twentytwelve/style.css' )
) {
$wp_filesystem->delete( $wp_filesystem->wp_themes_dir() . 'twentytwelve/' );
}
}
/*
* Copy new bundled plugins & themes.
* This gives us the ability to install new plugins & themes bundled with
* future versions of WordPress whilst avoiding the re-install upon upgrade issue.
* $development_build controls us overwriting bundled themes and plugins when a non-stable release is being updated.
*/
if ( ! is_wp_error( $result )
&& ( ! defined( 'CORE_UPGRADE_SKIP_NEW_BUNDLED' ) || ! CORE_UPGRADE_SKIP_NEW_BUNDLED )
) {
foreach ( (array) $_new_bundled_files as $file => $introduced_version ) {
// If a $development_build or if $introduced version is greater than what the site was previously running.
if ( $development_build || version_compare( $introduced_version, $old_wp_version, '>' ) ) {
$directory = ( '/' === $file[ strlen( $file ) - 1 ] );
list( $type, $filename ) = explode( '/', $file, 2 );
// Check to see if the bundled items exist before attempting to copy them.
if ( ! $wp_filesystem->exists( $from . $distro . 'wp-content/' . $file ) ) {
continue;
}
if ( 'plugins' === $type ) {
$dest = $wp_filesystem->wp_plugins_dir();
} elseif ( 'themes' === $type ) {
// Back-compat, ::wp_themes_dir() did not return trailingslash'd pre-3.2.
$dest = trailingslashit( $wp_filesystem->wp_themes_dir() );
} else {
continue;
}
if ( ! $directory ) {
if ( ! $development_build && $wp_filesystem->exists( $dest . $filename ) ) {
continue;
}
if ( ! $wp_filesystem->copy( $from . $distro . 'wp-content/' . $file, $dest . $filename, FS_CHMOD_FILE ) ) {
$result = new WP_Error( "copy_failed_for_new_bundled_$type", __( 'Could not copy file.' ), $dest . $filename );
}
} else {
if ( ! $development_build && $wp_filesystem->is_dir( $dest . $filename ) ) {
continue;
}
$wp_filesystem->mkdir( $dest . $filename, FS_CHMOD_DIR );
$_result = copy_dir( $from . $distro . 'wp-content/' . $file, $dest . $filename );
// If a error occurs partway through this final step, keep the error flowing through, but keep process going.
if ( is_wp_error( $_result ) ) {
if ( ! is_wp_error( $result ) ) {
$result = new WP_Error;
}
$result->add(
$_result->get_error_code() . "_$type",
$_result->get_error_message(),
substr( $_result->get_error_data(), strlen( $dest ) )
);
}
}
}
} // End foreach.
}
// Handle $result error from the above blocks.
if ( is_wp_error( $result ) ) {
$wp_filesystem->delete( $from, true );
return $result;
}
// Remove old files.
foreach ( $_old_files as $old_file ) {
$old_file = $to . $old_file;
if ( ! $wp_filesystem->exists( $old_file ) ) {
continue;
}
// If the file isn't deleted, try writing an empty string to the file instead.
if ( ! $wp_filesystem->delete( $old_file, true ) && $wp_filesystem->is_file( $old_file ) ) {
$wp_filesystem->put_contents( $old_file, '' );
}
}
// Remove any Genericons example.html's from the filesystem.
_upgrade_422_remove_genericons();
// Deactivate the REST API plugin if its version is 2.0 Beta 4 or lower.
_upgrade_440_force_deactivate_incompatible_plugins();
// Deactivate the Gutenberg plugin if its version is 11.8 or lower.
_upgrade_590_force_deactivate_incompatible_plugins();
// Upgrade DB with separate request.
/** This filter is documented in wp-admin/includes/update-core.php */
apply_filters( 'update_feedback', __( 'Upgrading database…' ) );
$db_upgrade_url = admin_url( 'upgrade.php?step=upgrade_db' );
wp_remote_post( $db_upgrade_url, array( 'timeout' => 60 ) );
// Clear the cache to prevent an update_option() from saving a stale db_version to the cache.
wp_cache_flush();
// Not all cache back ends listen to 'flush'.
wp_cache_delete( 'alloptions', 'options' );
// Remove working directory.
$wp_filesystem->delete( $from, true );
// Force refresh of update information.
if ( function_exists( 'delete_site_transient' ) ) {
delete_site_transient( 'update_core' );
} else {
delete_option( 'update_core' );
}
/**
* Fires after WordPress core has been successfully updated.
*
* @since 3.3.0
*
* @param string $wp_version The current WordPress version.
*/
do_action( '_core_updated_successfully', $wp_version );
// Clear the option that blocks auto-updates after failures, now that we've been successful.
if ( function_exists( 'delete_site_option' ) ) {
delete_site_option( 'auto_core_update_failed' );
}
return $wp_version;
}
```
[apply\_filters( 'update\_feedback', string $feedback )](../hooks/update_feedback)
Filters feedback messages displayed during the core update process.
[do\_action( '\_core\_updated\_successfully', string $wp\_version )](../hooks/_core_updated_successfully)
Fires after WordPress core has been successfully updated.
| Uses | Description |
| --- | --- |
| [wp\_opcache\_invalidate()](wp_opcache_invalidate) wp-admin/includes/file.php | Attempts to clear the opcode cache for an individual PHP file. |
| [delete\_site\_transient()](delete_site_transient) wp-includes/option.php | Deletes a site transient. |
| [wp\_get\_update\_php\_url()](wp_get_update_php_url) wp-includes/functions.php | Gets the URL to learn more about updating the PHP version the site is running on. |
| [\_upgrade\_422\_remove\_genericons()](_upgrade_422_remove_genericons) wp-admin/includes/update-core.php | Cleans up Genericons example files. |
| [get\_core\_checksums()](get_core_checksums) wp-admin/includes/update.php | Gets and caches the checksums for the given version of WordPress. |
| [copy\_dir()](copy_dir) wp-admin/includes/file.php | Copies a directory from one location to another via the WordPress Filesystem Abstraction. |
| [wp\_cache\_flush()](wp_cache_flush) wp-includes/cache.php | Removes all cache items. |
| [wp\_cache\_delete()](wp_cache_delete) wp-includes/cache.php | Removes the cache contents matching key and group. |
| [wpdb::db\_version()](../classes/wpdb/db_version) wp-includes/class-wpdb.php | Retrieves the database server version. |
| [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. |
| [delete\_option()](delete_option) wp-includes/option.php | Removes option by name. Prevents removal of protected WordPress options. |
| [wp\_remote\_post()](wp_remote_post) wp-includes/http.php | Performs an HTTP request using the POST method and returns its response. |
| [delete\_site\_option()](delete_site_option) wp-includes/option.php | Removes a option by name for the current network. |
| [is\_wp\_error()](is_wp_error) wp-includes/load.php | Checks whether the given variable is a WordPress Error. |
| [trailingslashit()](trailingslashit) wp-includes/formatting.php | Appends a trailing slash. |
| [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. |
| [admin\_url()](admin_url) wp-includes/link-template.php | Retrieves the URL to the admin area for the current site. |
| [esc\_url()](esc_url) wp-includes/formatting.php | Checks and cleans a URL. |
| [\_\_()](__) 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 |
| --- | --- |
| [Core\_Upgrader::upgrade()](../classes/core_upgrader/upgrade) wp-admin/includes/class-core-upgrader.php | Upgrade WordPress core. |
| Version | Description |
| --- | --- |
| [2.7.0](https://developer.wordpress.org/reference/since/2.7.0/) | Introduced. |
| programming_docs |
wordpress remove_permastruct( string $name ) remove\_permastruct( string $name )
===================================
Removes a permalink structure.
Can only be used to remove permastructs that were added using [add\_permastruct()](add_permastruct) .
Built-in permastructs cannot be removed.
* [WP\_Rewrite::remove\_permastruct()](../classes/wp_rewrite/remove_permastruct)
`$name` string Required Name for permalink structure. File: `wp-includes/rewrite.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/rewrite.php/)
```
function remove_permastruct( $name ) {
global $wp_rewrite;
$wp_rewrite->remove_permastruct( $name );
}
```
| Uses | Description |
| --- | --- |
| [WP\_Rewrite::remove\_permastruct()](../classes/wp_rewrite/remove_permastruct) wp-includes/class-wp-rewrite.php | Removes a permalink structure. |
| Used By | Description |
| --- | --- |
| [WP\_Taxonomy::remove\_rewrite\_rules()](../classes/wp_taxonomy/remove_rewrite_rules) wp-includes/class-wp-taxonomy.php | Removes any rewrite rules, permastructs, and rules for the taxonomy. |
| [WP\_Post\_Type::remove\_rewrite\_rules()](../classes/wp_post_type/remove_rewrite_rules) wp-includes/class-wp-post-type.php | Removes any rewrite rules, permastructs, and rules for the post type. |
| Version | Description |
| --- | --- |
| [4.5.0](https://developer.wordpress.org/reference/since/4.5.0/) | Introduced. |
wordpress the_taxonomies( array $args = array() ) the\_taxonomies( array $args = array() )
========================================
Displays the taxonomies of a post with available options.
This function can be used within the loop to display the taxonomies for a post without specifying the Post ID. You can also use it outside the Loop to display the taxonomies for a specific post.
`$args` array Optional Arguments about which post to use and how to format the output. Shares all of the arguments supported by [get\_the\_taxonomies()](get_the_taxonomies) , in addition to the following.
* `post`int|[WP\_Post](../classes/wp_post)Post ID or object to get taxonomies of. Default current post.
* `before`stringDisplays before the taxonomies. Default empty string.
* `sep`stringSeparates each taxonomy. Default is a space.
* `after`stringDisplays after the taxonomies. Default empty string.
More Arguments from get\_the\_taxonomies( ... $args ) 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()`
File: `wp-includes/taxonomy.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/taxonomy.php/)
```
function the_taxonomies( $args = array() ) {
$defaults = array(
'post' => 0,
'before' => '',
'sep' => ' ',
'after' => '',
);
$parsed_args = wp_parse_args( $args, $defaults );
echo $parsed_args['before'] . implode( $parsed_args['sep'], get_the_taxonomies( $parsed_args['post'], $parsed_args ) ) . $parsed_args['after'];
}
```
| Uses | Description |
| --- | --- |
| [get\_the\_taxonomies()](get_the_taxonomies) wp-includes/taxonomy.php | Retrieves all taxonomies associated with a post. |
| [wp\_parse\_args()](wp_parse_args) wp-includes/functions.php | Merges user defined arguments into defaults array. |
| Version | Description |
| --- | --- |
| [2.5.0](https://developer.wordpress.org/reference/since/2.5.0/) | Introduced. |
wordpress wp_revoke_user( int $id ) wp\_revoke\_user( int $id )
===========================
Remove all capabilities from user.
`$id` int Required User ID. File: `wp-admin/includes/user.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/user.php/)
```
function wp_revoke_user( $id ) {
$id = (int) $id;
$user = new WP_User( $id );
$user->remove_all_caps();
}
```
| Uses | Description |
| --- | --- |
| [WP\_User::\_\_construct()](../classes/wp_user/__construct) wp-includes/class-wp-user.php | Constructor. |
| Version | Description |
| --- | --- |
| [2.1.0](https://developer.wordpress.org/reference/since/2.1.0/) | Introduced. |
wordpress get_shortcode_atts_regex(): string get\_shortcode\_atts\_regex(): string
=====================================
Retrieves the shortcode attributes regex.
string The shortcode attribute regular expression.
File: `wp-includes/shortcodes.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/shortcodes.php/)
```
function get_shortcode_atts_regex() {
return '/([\w-]+)\s*=\s*"([^"]*)"(?:\s|$)|([\w-]+)\s*=\s*\'([^\']*)\'(?:\s|$)|([\w-]+)\s*=\s*([^\s\'"]+)(?:\s|$)|"([^"]*)"(?:\s|$)|\'([^\']*)\'(?:\s|$)|(\S+)(?:\s|$)/';
}
```
| Used By | Description |
| --- | --- |
| [shortcode\_parse\_atts()](shortcode_parse_atts) wp-includes/shortcodes.php | Retrieves all attributes from the shortcodes tag. |
| Version | Description |
| --- | --- |
| [4.4.0](https://developer.wordpress.org/reference/since/4.4.0/) | Introduced. |
wordpress _oembed_rest_pre_serve_request( bool $served, WP_HTTP_Response $result, WP_REST_Request $request, WP_REST_Server $server ): true \_oembed\_rest\_pre\_serve\_request( bool $served, WP\_HTTP\_Response $result, WP\_REST\_Request $request, WP\_REST\_Server $server ): true
===========================================================================================================================================
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.
Hooks into the REST API output to print XML instead of JSON.
This is only done for the oEmbed API endpoint, which supports both formats.
`$served` bool Required Whether the request has already been served. `$result` [WP\_HTTP\_Response](../classes/wp_http_response) Required Result to send to the client. Usually a `WP_REST_Response`. `$request` [WP\_REST\_Request](../classes/wp_rest_request) Required Request used to generate the response. `$server` [WP\_REST\_Server](../classes/wp_rest_server) Required Server instance. true
File: `wp-includes/embed.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/embed.php/)
```
function _oembed_rest_pre_serve_request( $served, $result, $request, $server ) {
$params = $request->get_params();
if ( '/oembed/1.0/embed' !== $request->get_route() || 'GET' !== $request->get_method() ) {
return $served;
}
if ( ! isset( $params['format'] ) || 'xml' !== $params['format'] ) {
return $served;
}
// Embed links inside the request.
$data = $server->response_to_data( $result, false );
if ( ! class_exists( 'SimpleXMLElement' ) ) {
status_header( 501 );
die( get_status_header_desc( 501 ) );
}
$result = _oembed_create_xml( $data );
// Bail if there's no XML.
if ( ! $result ) {
status_header( 501 );
return get_status_header_desc( 501 );
}
if ( ! headers_sent() ) {
$server->send_header( 'Content-Type', 'text/xml; charset=' . get_option( 'blog_charset' ) );
}
echo $result;
return true;
}
```
| Uses | Description |
| --- | --- |
| [\_oembed\_create\_xml()](_oembed_create_xml) wp-includes/embed.php | Creates an XML string from a given array. |
| [status\_header()](status_header) wp-includes/functions.php | Sets HTTP status header. |
| [get\_status\_header\_desc()](get_status_header_desc) wp-includes/functions.php | Retrieves the description for the HTTP status. |
| [get\_option()](get_option) wp-includes/option.php | Retrieves an option value based on an option name. |
| Version | Description |
| --- | --- |
| [4.4.0](https://developer.wordpress.org/reference/since/4.4.0/) | Introduced. |
wordpress get_lastpostdate( string $timezone = 'server', string $post_type = 'any' ): string get\_lastpostdate( string $timezone = 'server', string $post\_type = 'any' ): string
====================================================================================
Retrieves the most recent time that a post on the site was published.
The server timezone is the default and is the difference between GMT and server time. The ‘blog’ value is the date when the last post was posted.
The ‘gmt’ is when the last post was posted in GMT formatted date.
`$timezone` string Optional The timezone for the timestamp. Accepts `'server'`, `'blog'`, or `'gmt'`.
`'server'` uses the server's internal timezone.
`'blog'` uses the `post_date` field, which proxies to the timezone set for the site.
`'gmt'` uses the `post_date_gmt` field.
Default `'server'`. Default: `'server'`
`$post_type` string Optional The post type to check. Default `'any'`. Default: `'any'`
string The date of the last post, or false on failure.
File: `wp-includes/post.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/post.php/)
```
function get_lastpostdate( $timezone = 'server', $post_type = 'any' ) {
$lastpostdate = _get_last_post_time( $timezone, 'date', $post_type );
/**
* Filters the most recent time that a post on the site was published.
*
* @since 2.3.0
* @since 5.5.0 Added the `$post_type` parameter.
*
* @param string|false $lastpostdate The most recent time that a post was published,
* in 'Y-m-d H:i:s' format. False on failure.
* @param string $timezone Location to use for getting the post published date.
* See get_lastpostdate() for accepted `$timezone` values.
* @param string $post_type The post type to check.
*/
return apply_filters( 'get_lastpostdate', $lastpostdate, $timezone, $post_type );
}
```
[apply\_filters( 'get\_lastpostdate', string|false $lastpostdate, string $timezone, string $post\_type )](../hooks/get_lastpostdate)
Filters the most recent time that a post on the site was published.
| Uses | Description |
| --- | --- |
| [\_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. |
| [apply\_filters()](apply_filters) wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| Used By | Description |
| --- | --- |
| [get\_lastpostmodified()](get_lastpostmodified) wp-includes/post.php | Gets the most recent time that a post on the site was modified. |
| Version | Description |
| --- | --- |
| [4.4.0](https://developer.wordpress.org/reference/since/4.4.0/) | The `$post_type` argument was added. |
| [0.71](https://developer.wordpress.org/reference/since/0.71/) | Introduced. |
wordpress mu_options( $options ) mu\_options( $options )
=======================
This function has been deprecated.
WPMU options.
File: `wp-admin/includes/ms-deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/ms-deprecated.php/)
```
function mu_options( $options ) {
_deprecated_function( __FUNCTION__, '3.0.0' );
return $options;
}
```
| 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.0.0](https://developer.wordpress.org/reference/since/3.0.0/) | Introduced. |
wordpress wp_doing_cron(): bool wp\_doing\_cron(): bool
=======================
Determines whether the current request is a WordPress cron request.
bool True if it's a WordPress cron request, false otherwise.
File: `wp-includes/load.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/load.php/)
```
function wp_doing_cron() {
/**
* Filters whether the current request is a WordPress cron request.
*
* @since 4.8.0
*
* @param bool $wp_doing_cron Whether the current request is a WordPress cron request.
*/
return apply_filters( 'wp_doing_cron', defined( 'DOING_CRON' ) && DOING_CRON );
}
```
[apply\_filters( 'wp\_doing\_cron', bool $wp\_doing\_cron )](../hooks/wp_doing_cron)
Filters whether the current request is a WordPress cron 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 |
| --- | --- |
| [Plugin\_Upgrader::active\_before()](../classes/plugin_upgrader/active_before) wp-admin/includes/class-plugin-upgrader.php | Turns on maintenance mode before attempting to background update an active plugin. |
| [Plugin\_Upgrader::active\_after()](../classes/plugin_upgrader/active_after) wp-admin/includes/class-plugin-upgrader.php | Turns off maintenance mode after upgrading an active plugin. |
| [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. |
| [get\_core\_checksums()](get_core_checksums) wp-admin/includes/update.php | Gets and caches the checksums for the given version of WordPress. |
| [\_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. |
| [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. |
| Version | Description |
| --- | --- |
| [4.8.0](https://developer.wordpress.org/reference/since/4.8.0/) | Introduced. |
wordpress get_the_author_url(): string get\_the\_author\_url(): string
===============================
This function has been deprecated. Use [get\_the\_author\_meta()](get_the_author_meta) instead.
Retrieve the URL to the home page of the author of the current post.
* [get\_the\_author\_meta()](get_the_author_meta)
string The URL to the author's page.
File: `wp-includes/deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/deprecated.php/)
```
function get_the_author_url() {
_deprecated_function( __FUNCTION__, '2.8.0', 'get_the_author_meta(\'url\')' );
return get_the_author_meta('url');
}
```
| 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 get_attachment_link( int|object $post = null, bool $leavename = false ): string get\_attachment\_link( int|object $post = null, bool $leavename = false ): string
=================================================================================
Retrieves the permalink for an attachment.
This can be used in the WordPress Loop or outside of it.
`$post` int|object Optional Post ID or object. Default uses the global `$post`. Default: `null`
`$leavename` bool Optional Whether to keep the page name. Default: `false`
string The attachment permalink.
Under a [“pretty” permalink structure](https://wordpress.org/support/article/using-permalinks/ "Using Permalinks"), the function returns something like http://wp.example.net/path\_to\_post/post\_name/attachment\_name.
Under [the default permalink structure](https://wordpress.org/support/article/using-permalinks/ "Using Permalinks") — or if WordPress can’t construct a pretty URI — the function returns something like http://wp.example.net/?attachment\_id=n, where n is the attachment ID number.
You can change the output of this function through the [attachment\_link](../hooks/attachment_link "Plugin API/Filter Reference") filter.
If you want a direct link to the attached file (instead of the attachment page), you can use the function [wp\_get\_attachment\_url](wp_get_attachment_url "Function Reference/wp get attachment url")(id) instead.
**Note**: that get\_attachment\_link actually returns an URI, whereas [wp\_get\_attachment\_link()](wp_get_attachment_link) returns an HTML hyperlink.
File: `wp-includes/link-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/link-template.php/)
```
function get_attachment_link( $post = null, $leavename = false ) {
global $wp_rewrite;
$link = false;
$post = get_post( $post );
$force_plain_link = wp_force_plain_post_permalink( $post );
$parent_id = $post->post_parent;
$parent = $parent_id ? get_post( $parent_id ) : false;
$parent_valid = true; // Default for no parent.
if (
$parent_id &&
(
$post->post_parent === $post->ID ||
! $parent ||
! is_post_type_viewable( get_post_type( $parent ) )
)
) {
// Post is either its own parent or parent post unavailable.
$parent_valid = false;
}
if ( $force_plain_link || ! $parent_valid ) {
$link = false;
} elseif ( $wp_rewrite->using_permalinks() && $parent ) {
if ( 'page' === $parent->post_type ) {
$parentlink = _get_page_link( $post->post_parent ); // Ignores page_on_front.
} else {
$parentlink = get_permalink( $post->post_parent );
}
if ( is_numeric( $post->post_name ) || false !== strpos( get_option( 'permalink_structure' ), '%category%' ) ) {
$name = 'attachment/' . $post->post_name; // <permalink>/<int>/ is paged so we use the explicit attachment marker.
} else {
$name = $post->post_name;
}
if ( strpos( $parentlink, '?' ) === false ) {
$link = user_trailingslashit( trailingslashit( $parentlink ) . '%postname%' );
}
if ( ! $leavename ) {
$link = str_replace( '%postname%', $name, $link );
}
} elseif ( $wp_rewrite->using_permalinks() && ! $leavename ) {
$link = home_url( user_trailingslashit( $post->post_name ) );
}
if ( ! $link ) {
$link = home_url( '/?attachment_id=' . $post->ID );
}
/**
* Filters the permalink for an attachment.
*
* @since 2.0.0
* @since 5.6.0 Providing an empty string will now disable
* the view attachment page link on the media modal.
*
* @param string $link The attachment's permalink.
* @param int $post_id Attachment ID.
*/
return apply_filters( 'attachment_link', $link, $post->ID );
}
```
[apply\_filters( 'attachment\_link', string $link, int $post\_id )](../hooks/attachment_link)
Filters the permalink for an attachment.
| 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. |
| [is\_post\_type\_viewable()](is_post_type_viewable) wp-includes/post.php | Determines whether a post type is considered “viewable”. |
| [\_get\_page\_link()](_get_page_link) wp-includes/link-template.php | Retrieves the page permalink. |
| [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\_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. |
| [trailingslashit()](trailingslashit) wp-includes/formatting.php | Appends a trailing slash. |
| [home\_url()](home_url) wp-includes/link-template.php | Retrieves the URL for the current site where the front end is accessible. |
| [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. |
| 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. |
| [image\_media\_send\_to\_editor()](image_media_send_to_editor) wp-admin/includes/media.php | Retrieves the media element HTML to send to the editor. |
| [media\_upload\_form\_handler()](media_upload_form_handler) wp-admin/includes/media.php | Handles form submissions for the legacy media uploader. |
| [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. |
| [\_fix\_attachment\_links()](_fix_attachment_links) wp-admin/includes/post.php | Replaces hrefs of attachment anchors with up-to-date permalinks. |
| [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. |
| [get\_the\_attachment\_link()](get_the_attachment_link) wp-includes/deprecated.php | Retrieve HTML content of attachment image with link. |
| [get\_permalink()](get_permalink) wp-includes/link-template.php | Retrieves the full permalink for the current post or post ID. |
| [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\_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. |
| [redirect\_canonical()](redirect_canonical) wp-includes/canonical.php | Redirects incoming links to the proper URL based on the site url. |
| Version | Description |
| --- | --- |
| [2.0.0](https://developer.wordpress.org/reference/since/2.0.0/) | Introduced. |
| programming_docs |
wordpress get_networks( string|array $args = array() ): array|int get\_networks( string|array $args = array() ): array|int
========================================================
Retrieves a list of networks.
`$args` string|array Optional Array or string of arguments. See [WP\_Network\_Query::parse\_query()](../classes/wp_network_query/parse_query) for information on accepted arguments. More Arguments from WP\_Network\_Query::parse\_query( ... $query ) Array or query string of network query parameters.
* `network__in`int[]Array of network IDs to include.
* `network__not_in`int[]Array of network IDs to exclude.
* `count`boolWhether to return a network count (true) or array of network objects.
Default false.
* `fields`stringNetwork fields to return. Accepts `'ids'` (returns an array of network IDs) or empty (returns an array of complete network objects).
* `number`intMaximum number of networks to retrieve. Default empty (no limit).
* `offset`intNumber of networks to offset the query. Used to build LIMIT clause.
Default 0.
* `no_found_rows`boolWhether to disable the `SQL_CALC_FOUND_ROWS` query. Default true.
* `orderby`string|arrayNetwork status or array of statuses. Accepts `'id'`, `'domain'`, `'path'`, `'domain_length'`, `'path_length'` and `'network__in'`. Also accepts false, an empty array, or `'none'` to disable `ORDER BY` clause. Default `'id'`.
* `order`stringHow to order retrieved networks. Accepts `'ASC'`, `'DESC'`. Default `'ASC'`.
* `domain`stringLimit results to those affiliated with a given domain.
* `domain__in`string[]Array of domains to include affiliated networks for.
* `domain__not_in`string[]Array of domains to exclude affiliated networks for.
* `path`stringLimit results to those affiliated with a given path.
* `path__in`string[]Array of paths to include affiliated networks for.
* `path__not_in`string[]Array of paths to exclude affiliated networks for.
* `search`stringSearch term(s) to retrieve matching networks for.
* `update_network_cache`boolWhether to prime the cache for found networks. Default true.
Default: `array()`
array|int List of [WP\_Network](../classes/wp_network) objects, a list of network IDs when `'fields'` is set to `'ids'`, or the number of networks when `'count'` is passed as a query var.
File: `wp-includes/ms-network.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/ms-network.php/)
```
function get_networks( $args = array() ) {
$query = new WP_Network_Query();
return $query->query( $args );
}
```
| Uses | Description |
| --- | --- |
| [WP\_Network\_Query::\_\_construct()](../classes/wp_network_query/__construct) wp-includes/class-wp-network-query.php | Constructor. |
| Used By | Description |
| --- | --- |
| [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\_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. |
| [get\_main\_network\_id()](get_main_network_id) wp-includes/functions.php | Gets the main network ID. |
| [get\_admin\_users\_for\_domain()](get_admin_users_for_domain) wp-includes/ms-deprecated.php | Get the admin for a domain/path combination. |
| Version | Description |
| --- | --- |
| [4.6.0](https://developer.wordpress.org/reference/since/4.6.0/) | Introduced. |
wordpress add_submenu_page( string $parent_slug, string $page_title, string $menu_title, string $capability, string $menu_slug, callable $callback = '', int|float $position = null ): string|false add\_submenu\_page( string $parent\_slug, string $page\_title, string $menu\_title, string $capability, string $menu\_slug, callable $callback = '', int|float $position = null ): string|false
===============================================================================================================================================================================================
Adds a submenu page.
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.
`$parent_slug` string Required The slug name for the parent menu (or the file name of a standard WordPress admin page). `$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 and only include lowercase alphanumeric, dashes, and underscores characters to be compatible with [sanitize\_key()](sanitize_key) . `$callback` callable Optional The function to be called to output the content for this page. Default: `''`
`$position` int|float 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.
* **NOTE:**If you’re running into the “You do not have sufficient permissions to access this page.” message in a [wp\_die()](wp_die) screen, then you’ve hooked too early. The hook you should use is [`admin_menu`](../hooks/admin_menu).
* For `$menu_slug` please don’t use `__FILE__` it makes for an ugly URL, and is a minor security nuisance.
* Within the rendering function `$function` you may want to access parameters you used in [`add_submenu_page()`](add_submenu_page), such as the `$page_title`. Typically, these will work:
+ $parent\_slug: [`get_admin_page_parent()`](get_admin_page_parent)
+ $page\_title: [`get_admin_page_title()`](get_admin_page_title), or simply `global $title`
+ $menu\_slug: `global $plugin_page`.
* This function should normally be hooked in with one of the the [admin\_menu](../hooks/admin_menu) actions depending on the menu where the sub menu is to appear:
| | |
| --- | --- |
| [admin\_menu](../hooks/admin_menu "Plugin API/Action Reference/admin menu") | The normal, or site, administration menu |
| [user\_admin\_menu](../hooks/user_admin_menu "Plugin API/Action Reference/user admin menu") | The user administration menu |
| [network\_admin\_menu](../hooks/network_admin_menu "Plugin API/Action Reference/network admin menu") | The [network](https://codex.wordpress.org/Glossary#Network "Glossary") administration menu |
File: `wp-admin/includes/plugin.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/plugin.php/)
```
function add_submenu_page( $parent_slug, $page_title, $menu_title, $capability, $menu_slug, $callback = '', $position = null ) {
global $submenu, $menu, $_wp_real_parent_file, $_wp_submenu_nopriv,
$_registered_pages, $_parent_pages;
$menu_slug = plugin_basename( $menu_slug );
$parent_slug = plugin_basename( $parent_slug );
if ( isset( $_wp_real_parent_file[ $parent_slug ] ) ) {
$parent_slug = $_wp_real_parent_file[ $parent_slug ];
}
if ( ! current_user_can( $capability ) ) {
$_wp_submenu_nopriv[ $parent_slug ][ $menu_slug ] = true;
return false;
}
/*
* If the parent doesn't already have a submenu, add a link to the parent
* as the first item in the submenu. If the submenu file is the same as the
* parent file someone is trying to link back to the parent manually. In
* this case, don't automatically add a link back to avoid duplication.
*/
if ( ! isset( $submenu[ $parent_slug ] ) && $menu_slug !== $parent_slug ) {
foreach ( (array) $menu as $parent_menu ) {
if ( $parent_menu[2] === $parent_slug && current_user_can( $parent_menu[1] ) ) {
$submenu[ $parent_slug ][] = array_slice( $parent_menu, 0, 4 );
}
}
}
$new_sub_menu = array( $menu_title, $capability, $menu_slug, $page_title );
if ( null !== $position && ! is_numeric( $position ) ) {
_doing_it_wrong(
__FUNCTION__,
sprintf(
/* translators: %s: add_submenu_page() */
__( 'The seventh parameter passed to %s should be numeric representing menu position.' ),
'<code>add_submenu_page()</code>'
),
'5.3.0'
);
$position = null;
}
if (
null === $position ||
( ! isset( $submenu[ $parent_slug ] ) || $position >= count( $submenu[ $parent_slug ] ) )
) {
$submenu[ $parent_slug ][] = $new_sub_menu;
} else {
// Test for a negative position.
$position = max( $position, 0 );
if ( 0 === $position ) {
// For negative or `0` positions, prepend the submenu.
array_unshift( $submenu[ $parent_slug ], $new_sub_menu );
} else {
$position = absint( $position );
// Grab all of the items before the insertion point.
$before_items = array_slice( $submenu[ $parent_slug ], 0, $position, true );
// Grab all of the items after the insertion point.
$after_items = array_slice( $submenu[ $parent_slug ], $position, null, true );
// Add the new item.
$before_items[] = $new_sub_menu;
// Merge the items.
$submenu[ $parent_slug ] = array_merge( $before_items, $after_items );
}
}
// Sort the parent array.
ksort( $submenu[ $parent_slug ] );
$hookname = get_plugin_page_hookname( $menu_slug, $parent_slug );
if ( ! empty( $callback ) && ! empty( $hookname ) ) {
add_action( $hookname, $callback );
}
$_registered_pages[ $hookname ] = true;
/*
* Backward-compatibility for plugins using add_management_page().
* See wp-admin/admin.php for redirect from edit.php to tools.php.
*/
if ( 'tools.php' === $parent_slug ) {
$_registered_pages[ get_plugin_page_hookname( $menu_slug, 'edit.php' ) ] = true;
}
// No parent as top level.
$_parent_pages[ $menu_slug ] = $parent_slug;
return $hookname;
}
```
| Uses | Description |
| --- | --- |
| [get\_plugin\_page\_hookname()](get_plugin_page_hookname) wp-admin/includes/plugin.php | Gets the hook name for the administrative page of a plugin. |
| [plugin\_basename()](plugin_basename) wp-includes/plugin.php | Gets the basename of a plugin. |
| [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. |
| [\_doing\_it\_wrong()](_doing_it_wrong) wp-includes/functions.php | Marks something as being incorrectly called. |
| [absint()](absint) wp-includes/functions.php | Converts a value to non-negative integer. |
| [add\_action()](add_action) wp-includes/plugin.php | Adds a callback function to an action hook. |
| Used By | Description |
| --- | --- |
| [\_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. |
| [add\_management\_page()](add_management_page) wp-admin/includes/plugin.php | Adds a submenu page to the Tools main menu. |
| [add\_options\_page()](add_options_page) wp-admin/includes/plugin.php | Adds a submenu page to the Settings main menu. |
| [add\_theme\_page()](add_theme_page) wp-admin/includes/plugin.php | Adds a submenu page to the Appearance main menu. |
| [add\_plugins\_page()](add_plugins_page) wp-admin/includes/plugin.php | Adds a submenu page to the Plugins main menu. |
| [add\_users\_page()](add_users_page) wp-admin/includes/plugin.php | Adds a submenu page to the Users/Profile main menu. |
| [add\_dashboard\_page()](add_dashboard_page) wp-admin/includes/plugin.php | Adds a submenu page to the Dashboard main menu. |
| [add\_posts\_page()](add_posts_page) wp-admin/includes/plugin.php | Adds a submenu page to the Posts main menu. |
| [add\_media\_page()](add_media_page) wp-admin/includes/plugin.php | Adds a submenu page to the Media main menu. |
| [add\_links\_page()](add_links_page) wp-admin/includes/plugin.php | Adds a submenu page to the Links main menu. |
| [add\_pages\_page()](add_pages_page) wp-admin/includes/plugin.php | Adds a submenu page to the Pages main menu. |
| [add\_comments\_page()](add_comments_page) wp-admin/includes/plugin.php | Adds a submenu page to the Comments main menu. |
| [\_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. |
| [\_add\_post\_type\_submenus()](_add_post_type_submenus) wp-includes/post.php | Adds submenus for post types. |
| Version | Description |
| --- | --- |
| [5.3.0](https://developer.wordpress.org/reference/since/5.3.0/) | Added the `$position` parameter. |
| [1.5.0](https://developer.wordpress.org/reference/since/1.5.0/) | Introduced. |
wordpress is_post_type_archive( string|string[] $post_types = '' ): bool is\_post\_type\_archive( string|string[] $post\_types = '' ): bool
==================================================================
Determines whether the query is for an existing post type archive page.
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_types` string|string[] Optional Post type or array of posts types to check against. Default: `''`
bool Whether the query is for an existing post type archive page.
File: `wp-includes/query.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/query.php/)
```
function is_post_type_archive( $post_types = '' ) {
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_post_type_archive( $post_types );
}
```
| Uses | Description |
| --- | --- |
| [WP\_Query::is\_post\_type\_archive()](../classes/wp_query/is_post_type_archive) wp-includes/class-wp-query.php | Is the query for an existing post type 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 |
| --- | --- |
| [wp\_get\_document\_title()](wp_get_document_title) wp-includes/general-template.php | Returns document title for the current page. |
| [get\_the\_archive\_description()](get_the_archive_description) wp-includes/general-template.php | Retrieves the description for an author, post type, or term archive. |
| [get\_the\_archive\_title()](get_the_archive_title) wp-includes/general-template.php | Retrieves the archive title based on the queried object. |
| [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. |
| [post\_type\_archive\_title()](post_type_archive_title) wp-includes/general-template.php | Displays or retrieves title for a post type 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\_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. |
| [get\_body\_class()](get_body_class) wp-includes/post-template.php | Retrieves an array of the class names for the body element. |
| Version | Description |
| --- | --- |
| [3.1.0](https://developer.wordpress.org/reference/since/3.1.0/) | Introduced. |
wordpress comment_exists( string $comment_author, string $comment_date, string $timezone = 'blog' ): string|null comment\_exists( string $comment\_author, string $comment\_date, string $timezone = 'blog' ): string|null
=========================================================================================================
Determines if a comment exists based on author and date.
For best performance, use `$timezone = 'gmt'`, which queries a field that is properly indexed. The default value for `$timezone` is ‘blog’ for legacy reasons.
`$comment_author` string Required Author of the comment. `$comment_date` string Required Date of the comment. `$timezone` string Optional Timezone. Accepts `'blog'` or `'gmt'`. Default `'blog'`. Default: `'blog'`
string|null Comment post ID on success.
File: `wp-admin/includes/comment.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/comment.php/)
```
function comment_exists( $comment_author, $comment_date, $timezone = 'blog' ) {
global $wpdb;
$date_field = 'comment_date';
if ( 'gmt' === $timezone ) {
$date_field = 'comment_date_gmt';
}
return $wpdb->get_var(
$wpdb->prepare(
"SELECT comment_post_ID FROM $wpdb->comments
WHERE comment_author = %s AND $date_field = %s",
stripslashes( $comment_author ),
stripslashes( $comment_date )
)
);
}
```
| Uses | Description |
| --- | --- |
| [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/) | Added the `$timezone` parameter. |
| [2.0.0](https://developer.wordpress.org/reference/since/2.0.0/) | Introduced. |
wordpress wp_replace_in_html_tags( string $haystack, array $replace_pairs ): string wp\_replace\_in\_html\_tags( string $haystack, array $replace\_pairs ): string
==============================================================================
Replaces characters or phrases within HTML elements only.
`$haystack` string Required The text which has to be formatted. `$replace_pairs` array Required In the form array(`'from'` => `'to'`, ...). string The formatted text.
File: `wp-includes/formatting.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/formatting.php/)
```
function wp_replace_in_html_tags( $haystack, $replace_pairs ) {
// Find all elements.
$textarr = wp_html_split( $haystack );
$changed = false;
// Optimize when searching for one item.
if ( 1 === count( $replace_pairs ) ) {
// Extract $needle and $replace.
foreach ( $replace_pairs as $needle => $replace ) {
}
// Loop through delimiters (elements) only.
for ( $i = 1, $c = count( $textarr ); $i < $c; $i += 2 ) {
if ( false !== strpos( $textarr[ $i ], $needle ) ) {
$textarr[ $i ] = str_replace( $needle, $replace, $textarr[ $i ] );
$changed = true;
}
}
} else {
// Extract all $needles.
$needles = array_keys( $replace_pairs );
// Loop through delimiters (elements) only.
for ( $i = 1, $c = count( $textarr ); $i < $c; $i += 2 ) {
foreach ( $needles as $needle ) {
if ( false !== strpos( $textarr[ $i ], $needle ) ) {
$textarr[ $i ] = strtr( $textarr[ $i ], $replace_pairs );
$changed = true;
// After one strtr() break out of the foreach loop and look at next element.
break;
}
}
}
}
if ( $changed ) {
$haystack = implode( $textarr );
}
return $haystack;
}
```
| Uses | Description |
| --- | --- |
| [wp\_html\_split()](wp_html_split) wp-includes/formatting.php | Separates HTML elements and comments from the text. |
| Used By | Description |
| --- | --- |
| [wpautop()](wpautop) wp-includes/formatting.php | Replaces double line breaks with paragraph elements. |
| [WP\_Embed::autoembed()](../classes/wp_embed/autoembed) wp-includes/class-wp-embed.php | Passes any unlinked URLs that are on their own line to [WP\_Embed::shortcode()](../classes/wp_embed/shortcode) for potential embedding. |
| Version | Description |
| --- | --- |
| [4.2.3](https://developer.wordpress.org/reference/since/4.2.3/) | Introduced. |
| programming_docs |
wordpress wp_is_local_html_output( string $html ): bool|null wp\_is\_local\_html\_output( string $html ): bool|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.
Checks whether a given HTML string is likely an output from this WordPress site.
This function attempts to check for various common WordPress patterns whether they are included in the HTML string.
Since any of these actions may be disabled through third-party code, this function may also return null to indicate that it was not possible to determine ownership.
`$html` string Required Full HTML output string, e.g. from a HTTP response. bool|null True/false for whether HTML was generated by this site, null if unable to determine.
File: `wp-includes/https-detection.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/https-detection.php/)
```
function wp_is_local_html_output( $html ) {
// 1. Check if HTML includes the site's Really Simple Discovery link.
if ( has_action( 'wp_head', 'rsd_link' ) ) {
$pattern = preg_replace( '#^https?:(?=//)#', '', esc_url( site_url( 'xmlrpc.php?rsd', 'rpc' ) ) ); // See rsd_link().
return false !== strpos( $html, $pattern );
}
// 2. Check if HTML includes the site's Windows Live Writer manifest link.
if ( has_action( 'wp_head', 'wlwmanifest_link' ) ) {
// Try both HTTPS and HTTP since the URL depends on context.
$pattern = preg_replace( '#^https?:(?=//)#', '', includes_url( 'wlwmanifest.xml' ) ); // See wlwmanifest_link().
return false !== strpos( $html, $pattern );
}
// 3. Check if HTML includes the site's REST API link.
if ( has_action( 'wp_head', 'rest_output_link_wp_head' ) ) {
// Try both HTTPS and HTTP since the URL depends on context.
$pattern = preg_replace( '#^https?:(?=//)#', '', esc_url( get_rest_url() ) ); // See rest_output_link_wp_head().
return false !== strpos( $html, $pattern );
}
// Otherwise the result cannot be determined.
return null;
}
```
| Uses | Description |
| --- | --- |
| [get\_rest\_url()](get_rest_url) wp-includes/rest-api.php | Retrieves the URL to a REST endpoint on a site. |
| [includes\_url()](includes_url) wp-includes/link-template.php | Retrieves the URL to the includes directory. |
| [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. |
| [has\_action()](has_action) wp-includes/plugin.php | Checks if any action has been registered for a hook. |
| [esc\_url()](esc_url) wp-includes/formatting.php | Checks and cleans a URL. |
| 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. |
| Version | Description |
| --- | --- |
| [5.7.0](https://developer.wordpress.org/reference/since/5.7.0/) | Introduced. |
wordpress dbDelta( string[]|string $queries = '', bool $execute = true ): array dbDelta( string[]|string $queries = '', bool $execute = true ): array
=====================================================================
Modifies the database based on specified SQL statements.
Useful for creating new tables and updating existing tables to a new structure.
`$queries` string[]|string Optional The query to run. Can be multiple queries in an array, or a string of queries separated by semicolons. Default: `''`
`$execute` bool Optional Whether or not to execute the query right away.
Default: `true`
array Strings containing the results of the various update queries.
File: `wp-admin/includes/upgrade.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/upgrade.php/)
```
function dbDelta( $queries = '', $execute = true ) { // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.FunctionNameInvalid
global $wpdb;
if ( in_array( $queries, array( '', 'all', 'blog', 'global', 'ms_global' ), true ) ) {
$queries = wp_get_db_schema( $queries );
}
// Separate individual queries into an array.
if ( ! is_array( $queries ) ) {
$queries = explode( ';', $queries );
$queries = array_filter( $queries );
}
/**
* Filters the dbDelta SQL queries.
*
* @since 3.3.0
*
* @param string[] $queries An array of dbDelta SQL queries.
*/
$queries = apply_filters( 'dbdelta_queries', $queries );
$cqueries = array(); // Creation queries.
$iqueries = array(); // Insertion queries.
$for_update = array();
// Create a tablename index for an array ($cqueries) of queries.
foreach ( $queries as $qry ) {
if ( preg_match( '|CREATE TABLE ([^ ]*)|', $qry, $matches ) ) {
$cqueries[ trim( $matches[1], '`' ) ] = $qry;
$for_update[ $matches[1] ] = 'Created table ' . $matches[1];
} elseif ( preg_match( '|CREATE DATABASE ([^ ]*)|', $qry, $matches ) ) {
array_unshift( $cqueries, $qry );
} elseif ( preg_match( '|INSERT INTO ([^ ]*)|', $qry, $matches ) ) {
$iqueries[] = $qry;
} elseif ( preg_match( '|UPDATE ([^ ]*)|', $qry, $matches ) ) {
$iqueries[] = $qry;
} else {
// Unrecognized query type.
}
}
/**
* Filters the dbDelta SQL queries for creating tables and/or databases.
*
* Queries filterable via this hook contain "CREATE TABLE" or "CREATE DATABASE".
*
* @since 3.3.0
*
* @param string[] $cqueries An array of dbDelta create SQL queries.
*/
$cqueries = apply_filters( 'dbdelta_create_queries', $cqueries );
/**
* Filters the dbDelta SQL queries for inserting or updating.
*
* Queries filterable via this hook contain "INSERT INTO" or "UPDATE".
*
* @since 3.3.0
*
* @param string[] $iqueries An array of dbDelta insert or update SQL queries.
*/
$iqueries = apply_filters( 'dbdelta_insert_queries', $iqueries );
$text_fields = array( 'tinytext', 'text', 'mediumtext', 'longtext' );
$blob_fields = array( 'tinyblob', 'blob', 'mediumblob', 'longblob' );
$int_fields = array( 'tinyint', 'smallint', 'mediumint', 'int', 'integer', 'bigint' );
$global_tables = $wpdb->tables( 'global' );
$db_version = $wpdb->db_version();
$db_server_info = $wpdb->db_server_info();
foreach ( $cqueries as $table => $qry ) {
// Upgrade global tables only for the main site. Don't upgrade at all if conditions are not optimal.
if ( in_array( $table, $global_tables, true ) && ! wp_should_upgrade_global_tables() ) {
unset( $cqueries[ $table ], $for_update[ $table ] );
continue;
}
// Fetch the table column structure from the database.
$suppress = $wpdb->suppress_errors();
$tablefields = $wpdb->get_results( "DESCRIBE {$table};" );
$wpdb->suppress_errors( $suppress );
if ( ! $tablefields ) {
continue;
}
// Clear the field and index arrays.
$cfields = array();
$indices = array();
$indices_without_subparts = array();
// Get all of the field names in the query from between the parentheses.
preg_match( '|\((.*)\)|ms', $qry, $match2 );
$qryline = trim( $match2[1] );
// Separate field lines into an array.
$flds = explode( "\n", $qryline );
// For every field line specified in the query.
foreach ( $flds as $fld ) {
$fld = trim( $fld, " \t\n\r\0\x0B," ); // Default trim characters, plus ','.
// Extract the field name.
preg_match( '|^([^ ]*)|', $fld, $fvals );
$fieldname = trim( $fvals[1], '`' );
$fieldname_lowercased = strtolower( $fieldname );
// Verify the found field name.
$validfield = true;
switch ( $fieldname_lowercased ) {
case '':
case 'primary':
case 'index':
case 'fulltext':
case 'unique':
case 'key':
case 'spatial':
$validfield = false;
/*
* Normalize the index definition.
*
* This is done so the definition can be compared against the result of a
* `SHOW INDEX FROM $table_name` query which returns the current table
* index information.
*/
// Extract type, name and columns from the definition.
// phpcs:disable Squiz.Strings.ConcatenationSpacing.PaddingFound -- don't remove regex indentation
preg_match(
'/^'
. '(?P<index_type>' // 1) Type of the index.
. 'PRIMARY\s+KEY|(?:UNIQUE|FULLTEXT|SPATIAL)\s+(?:KEY|INDEX)|KEY|INDEX'
. ')'
. '\s+' // Followed by at least one white space character.
. '(?:' // Name of the index. Optional if type is PRIMARY KEY.
. '`?' // Name can be escaped with a backtick.
. '(?P<index_name>' // 2) Name of the index.
. '(?:[0-9a-zA-Z$_-]|[\xC2-\xDF][\x80-\xBF])+'
. ')'
. '`?' // Name can be escaped with a backtick.
. '\s+' // Followed by at least one white space character.
. ')*'
. '\(' // Opening bracket for the columns.
. '(?P<index_columns>'
. '.+?' // 3) Column names, index prefixes, and orders.
. ')'
. '\)' // Closing bracket for the columns.
. '$/im',
$fld,
$index_matches
);
// phpcs:enable
// Uppercase the index type and normalize space characters.
$index_type = strtoupper( preg_replace( '/\s+/', ' ', trim( $index_matches['index_type'] ) ) );
// 'INDEX' is a synonym for 'KEY', standardize on 'KEY'.
$index_type = str_replace( 'INDEX', 'KEY', $index_type );
// Escape the index name with backticks. An index for a primary key has no name.
$index_name = ( 'PRIMARY KEY' === $index_type ) ? '' : '`' . strtolower( $index_matches['index_name'] ) . '`';
// Parse the columns. Multiple columns are separated by a comma.
$index_columns = array_map( 'trim', explode( ',', $index_matches['index_columns'] ) );
$index_columns_without_subparts = $index_columns;
// Normalize columns.
foreach ( $index_columns as $id => &$index_column ) {
// Extract column name and number of indexed characters (sub_part).
// phpcs:disable Squiz.Strings.ConcatenationSpacing.PaddingFound -- don't remove regex indentation
preg_match(
'/'
. '`?' // Name can be escaped with a backtick.
. '(?P<column_name>' // 1) Name of the column.
. '(?:[0-9a-zA-Z$_-]|[\xC2-\xDF][\x80-\xBF])+'
. ')'
. '`?' // Name can be escaped with a backtick.
. '(?:' // Optional sub part.
. '\s*' // Optional white space character between name and opening bracket.
. '\(' // Opening bracket for the sub part.
. '\s*' // Optional white space character after opening bracket.
. '(?P<sub_part>'
. '\d+' // 2) Number of indexed characters.
. ')'
. '\s*' // Optional white space character before closing bracket.
. '\)' // Closing bracket for the sub part.
. ')?'
. '/',
$index_column,
$index_column_matches
);
// phpcs:enable
// Escape the column name with backticks.
$index_column = '`' . $index_column_matches['column_name'] . '`';
// We don't need to add the subpart to $index_columns_without_subparts
$index_columns_without_subparts[ $id ] = $index_column;
// Append the optional sup part with the number of indexed characters.
if ( isset( $index_column_matches['sub_part'] ) ) {
$index_column .= '(' . $index_column_matches['sub_part'] . ')';
}
}
// Build the normalized index definition and add it to the list of indices.
$indices[] = "{$index_type} {$index_name} (" . implode( ',', $index_columns ) . ')';
$indices_without_subparts[] = "{$index_type} {$index_name} (" . implode( ',', $index_columns_without_subparts ) . ')';
// Destroy no longer needed variables.
unset( $index_column, $index_column_matches, $index_matches, $index_type, $index_name, $index_columns, $index_columns_without_subparts );
break;
}
// If it's a valid field, add it to the field array.
if ( $validfield ) {
$cfields[ $fieldname_lowercased ] = $fld;
}
}
// For every field in the table.
foreach ( $tablefields as $tablefield ) {
$tablefield_field_lowercased = strtolower( $tablefield->Field );
$tablefield_type_lowercased = strtolower( $tablefield->Type );
$tablefield_type_without_parentheses = preg_replace(
'/'
. '(.+)' // Field type, e.g. `int`.
. '\(\d*\)' // Display width.
. '(.*)' // Optional attributes, e.g. `unsigned`.
. '/',
'$1$2',
$tablefield_type_lowercased
);
// Get the type without attributes, e.g. `int`.
$tablefield_type_base = strtok( $tablefield_type_without_parentheses, ' ' );
// If the table field exists in the field array...
if ( array_key_exists( $tablefield_field_lowercased, $cfields ) ) {
// Get the field type from the query.
preg_match( '|`?' . $tablefield->Field . '`? ([^ ]*( unsigned)?)|i', $cfields[ $tablefield_field_lowercased ], $matches );
$fieldtype = $matches[1];
$fieldtype_lowercased = strtolower( $fieldtype );
$fieldtype_without_parentheses = preg_replace(
'/'
. '(.+)' // Field type, e.g. `int`.
. '\(\d*\)' // Display width.
. '(.*)' // Optional attributes, e.g. `unsigned`.
. '/',
'$1$2',
$fieldtype_lowercased
);
// Get the type without attributes, e.g. `int`.
$fieldtype_base = strtok( $fieldtype_without_parentheses, ' ' );
// Is actual field type different from the field type in query?
if ( $tablefield->Type != $fieldtype ) {
$do_change = true;
if ( in_array( $fieldtype_lowercased, $text_fields, true ) && in_array( $tablefield_type_lowercased, $text_fields, true ) ) {
if ( array_search( $fieldtype_lowercased, $text_fields, true ) < array_search( $tablefield_type_lowercased, $text_fields, true ) ) {
$do_change = false;
}
}
if ( in_array( $fieldtype_lowercased, $blob_fields, true ) && in_array( $tablefield_type_lowercased, $blob_fields, true ) ) {
if ( array_search( $fieldtype_lowercased, $blob_fields, true ) < array_search( $tablefield_type_lowercased, $blob_fields, true ) ) {
$do_change = false;
}
}
if ( in_array( $fieldtype_base, $int_fields, true ) && in_array( $tablefield_type_base, $int_fields, true )
&& $fieldtype_without_parentheses === $tablefield_type_without_parentheses
) {
/*
* MySQL 8.0.17 or later does not support display width for integer data types,
* so if display width is the only difference, it can be safely ignored.
* Note: This is specific to MySQL and does not affect MariaDB.
*/
if ( version_compare( $db_version, '8.0.17', '>=' )
&& ! str_contains( $db_server_info, 'MariaDB' )
) {
$do_change = false;
}
}
if ( $do_change ) {
// Add a query to change the column type.
$cqueries[] = "ALTER TABLE {$table} CHANGE COLUMN `{$tablefield->Field}` " . $cfields[ $tablefield_field_lowercased ];
$for_update[ $table . '.' . $tablefield->Field ] = "Changed type of {$table}.{$tablefield->Field} from {$tablefield->Type} to {$fieldtype}";
}
}
// Get the default value from the array.
if ( preg_match( "| DEFAULT '(.*?)'|i", $cfields[ $tablefield_field_lowercased ], $matches ) ) {
$default_value = $matches[1];
if ( $tablefield->Default != $default_value ) {
// Add a query to change the column's default value
$cqueries[] = "ALTER TABLE {$table} ALTER COLUMN `{$tablefield->Field}` SET DEFAULT '{$default_value}'";
$for_update[ $table . '.' . $tablefield->Field ] = "Changed default value of {$table}.{$tablefield->Field} from {$tablefield->Default} to {$default_value}";
}
}
// Remove the field from the array (so it's not added).
unset( $cfields[ $tablefield_field_lowercased ] );
} else {
// This field exists in the table, but not in the creation queries?
}
}
// For every remaining field specified for the table.
foreach ( $cfields as $fieldname => $fielddef ) {
// Push a query line into $cqueries that adds the field to that table.
$cqueries[] = "ALTER TABLE {$table} ADD COLUMN $fielddef";
$for_update[ $table . '.' . $fieldname ] = 'Added column ' . $table . '.' . $fieldname;
}
// Index stuff goes here. Fetch the table index structure from the database.
$tableindices = $wpdb->get_results( "SHOW INDEX FROM {$table};" );
if ( $tableindices ) {
// Clear the index array.
$index_ary = array();
// For every index in the table.
foreach ( $tableindices as $tableindex ) {
$keyname = strtolower( $tableindex->Key_name );
// Add the index to the index data array.
$index_ary[ $keyname ]['columns'][] = array(
'fieldname' => $tableindex->Column_name,
'subpart' => $tableindex->Sub_part,
);
$index_ary[ $keyname ]['unique'] = ( 0 == $tableindex->Non_unique ) ? true : false;
$index_ary[ $keyname ]['index_type'] = $tableindex->Index_type;
}
// For each actual index in the index array.
foreach ( $index_ary as $index_name => $index_data ) {
// Build a create string to compare to the query.
$index_string = '';
if ( 'primary' === $index_name ) {
$index_string .= 'PRIMARY ';
} elseif ( $index_data['unique'] ) {
$index_string .= 'UNIQUE ';
}
if ( 'FULLTEXT' === strtoupper( $index_data['index_type'] ) ) {
$index_string .= 'FULLTEXT ';
}
if ( 'SPATIAL' === strtoupper( $index_data['index_type'] ) ) {
$index_string .= 'SPATIAL ';
}
$index_string .= 'KEY ';
if ( 'primary' !== $index_name ) {
$index_string .= '`' . $index_name . '`';
}
$index_columns = '';
// For each column in the index.
foreach ( $index_data['columns'] as $column_data ) {
if ( '' !== $index_columns ) {
$index_columns .= ',';
}
// Add the field to the column list string.
$index_columns .= '`' . $column_data['fieldname'] . '`';
}
// Add the column list to the index create string.
$index_string .= " ($index_columns)";
// Check if the index definition exists, ignoring subparts.
$aindex = array_search( $index_string, $indices_without_subparts, true );
if ( false !== $aindex ) {
// If the index already exists (even with different subparts), we don't need to create it.
unset( $indices_without_subparts[ $aindex ] );
unset( $indices[ $aindex ] );
}
}
}
// For every remaining index specified for the table.
foreach ( (array) $indices as $index ) {
// Push a query line into $cqueries that adds the index to that table.
$cqueries[] = "ALTER TABLE {$table} ADD $index";
$for_update[] = 'Added index ' . $table . ' ' . $index;
}
// Remove the original table creation query from processing.
unset( $cqueries[ $table ], $for_update[ $table ] );
}
$allqueries = array_merge( $cqueries, $iqueries );
if ( $execute ) {
foreach ( $allqueries as $query ) {
$wpdb->query( $query );
}
}
return $for_update;
}
```
[apply\_filters( 'dbdelta\_create\_queries', string[] $cqueries )](../hooks/dbdelta_create_queries)
Filters the dbDelta SQL queries for creating tables and/or databases.
[apply\_filters( 'dbdelta\_insert\_queries', string[] $iqueries )](../hooks/dbdelta_insert_queries)
Filters the dbDelta SQL queries for inserting or updating.
[apply\_filters( 'dbdelta\_queries', string[] $queries )](../hooks/dbdelta_queries)
Filters the dbDelta SQL queries.
| Uses | Description |
| --- | --- |
| [wpdb::db\_server\_info()](../classes/wpdb/db_server_info) wp-includes/class-wpdb.php | Retrieves full database server information. |
| [wp\_should\_upgrade\_global\_tables()](wp_should_upgrade_global_tables) wp-admin/includes/upgrade.php | Determine if global tables should be upgraded. |
| [wp\_get\_db\_schema()](wp_get_db_schema) wp-admin/includes/schema.php | Retrieve the SQL for creating database tables. |
| [wpdb::db\_version()](../classes/wpdb/db_version) wp-includes/class-wpdb.php | Retrieves the database server version. |
| [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. |
| [wpdb::suppress\_errors()](../classes/wpdb/suppress_errors) wp-includes/class-wpdb.php | Enables or disables suppressing of database errors. |
| [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). |
| Used By | Description |
| --- | --- |
| [install\_network()](install_network) wp-admin/includes/schema.php | Install Network. |
| [make\_db\_current()](make_db_current) wp-admin/includes/upgrade.php | Updates the database tables to a new schema. |
| [make\_db\_current\_silent()](make_db_current_silent) wp-admin/includes/upgrade.php | Updates the database tables to a new schema, but without displaying results. |
| Version | Description |
| --- | --- |
| [6.1.0](https://developer.wordpress.org/reference/since/6.1.0/) | Ignores display width for integer data types on MySQL 8.0.17 or later, to match MySQL behavior. Note: This does not affect MariaDB. |
| [1.5.0](https://developer.wordpress.org/reference/since/1.5.0/) | Introduced. |
| programming_docs |
wordpress get_theme_file_path( string $file = '' ): string get\_theme\_file\_path( string $file = '' ): string
===================================================
Retrieves the path of a file in the theme.
Searches in the stylesheet directory before the template directory so themes which inherit from a parent theme can just override one file.
`$file` string Optional File to search for in the stylesheet directory. Default: `''`
string The path of the file.
File: `wp-includes/link-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/link-template.php/)
```
function get_theme_file_path( $file = '' ) {
$file = ltrim( $file, '/' );
if ( empty( $file ) ) {
$path = get_stylesheet_directory();
} elseif ( file_exists( get_stylesheet_directory() . '/' . $file ) ) {
$path = get_stylesheet_directory() . '/' . $file;
} else {
$path = get_template_directory() . '/' . $file;
}
/**
* Filters the path to a file in the theme.
*
* @since 4.7.0
*
* @param string $path The file path.
* @param string $file The requested file to search for.
*/
return apply_filters( 'theme_file_path', $path, $file );
}
```
[apply\_filters( 'theme\_file\_path', string $path, string $file )](../hooks/theme_file_path)
Filters the path to a file in the theme.
| Uses | Description |
| --- | --- |
| [get\_stylesheet\_directory()](get_stylesheet_directory) wp-includes/theme.php | Retrieves stylesheet directory path for the active theme. |
| [get\_template\_directory()](get_template_directory) wp-includes/theme.php | Retrieves template directory path 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\_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. |
| [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. |
| Version | Description |
| --- | --- |
| [4.7.0](https://developer.wordpress.org/reference/since/4.7.0/) | Introduced. |
wordpress wp_comment_reply( int $position = 1, bool $checkbox = false, string $mode = 'single', bool $table_row = true ) wp\_comment\_reply( int $position = 1, bool $checkbox = false, string $mode = 'single', bool $table\_row = true )
=================================================================================================================
Outputs the in-line comment reply-to form in the Comments list table.
`$position` int Optional Default: `1`
`$checkbox` bool Optional Default: `false`
`$mode` string Optional Default: `'single'`
`$table_row` bool Optional Default: `true`
File: `wp-admin/includes/template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/template.php/)
```
function wp_comment_reply( $position = 1, $checkbox = false, $mode = 'single', $table_row = true ) {
global $wp_list_table;
/**
* Filters the in-line comment reply-to form output in the Comments
* list table.
*
* Returning a non-empty value here will short-circuit display
* of the in-line comment-reply form in the Comments list table,
* echoing the returned value instead.
*
* @since 2.7.0
*
* @see wp_comment_reply()
*
* @param string $content The reply-to form content.
* @param array $args An array of default args.
*/
$content = apply_filters(
'wp_comment_reply',
'',
array(
'position' => $position,
'checkbox' => $checkbox,
'mode' => $mode,
)
);
if ( ! empty( $content ) ) {
echo $content;
return;
}
if ( ! $wp_list_table ) {
if ( 'single' === $mode ) {
$wp_list_table = _get_list_table( 'WP_Post_Comments_List_Table' );
} else {
$wp_list_table = _get_list_table( 'WP_Comments_List_Table' );
}
}
?>
<form method="get">
<?php if ( $table_row ) : ?>
<table style="display:none;"><tbody id="com-reply"><tr id="replyrow" class="inline-edit-row" style="display:none;"><td colspan="<?php echo $wp_list_table->get_column_count(); ?>" class="colspanchange">
<?php else : ?>
<div id="com-reply" style="display:none;"><div id="replyrow" style="display:none;">
<?php endif; ?>
<fieldset class="comment-reply">
<legend>
<span class="hidden" id="editlegend"><?php _e( 'Edit Comment' ); ?></span>
<span class="hidden" id="replyhead"><?php _e( 'Reply to Comment' ); ?></span>
<span class="hidden" id="addhead"><?php _e( 'Add new Comment' ); ?></span>
</legend>
<div id="replycontainer">
<label for="replycontent" class="screen-reader-text"><?php _e( 'Comment' ); ?></label>
<?php
$quicktags_settings = array( 'buttons' => 'strong,em,link,block,del,ins,img,ul,ol,li,code,close' );
wp_editor(
'',
'replycontent',
array(
'media_buttons' => false,
'tinymce' => false,
'quicktags' => $quicktags_settings,
)
);
?>
</div>
<div id="edithead" style="display:none;">
<div class="inside">
<label for="author-name"><?php _e( 'Name' ); ?></label>
<input type="text" name="newcomment_author" size="50" value="" id="author-name" />
</div>
<div class="inside">
<label for="author-email"><?php _e( 'Email' ); ?></label>
<input type="text" name="newcomment_author_email" size="50" value="" id="author-email" />
</div>
<div class="inside">
<label for="author-url"><?php _e( 'URL' ); ?></label>
<input type="text" id="author-url" name="newcomment_author_url" class="code" size="103" value="" />
</div>
</div>
<div id="replysubmit" class="submit">
<p class="reply-submit-buttons">
<button type="button" class="save button button-primary">
<span id="addbtn" style="display: none;"><?php _e( 'Add Comment' ); ?></span>
<span id="savebtn" style="display: none;"><?php _e( 'Update Comment' ); ?></span>
<span id="replybtn" style="display: none;"><?php _e( 'Submit Reply' ); ?></span>
</button>
<button type="button" class="cancel button"><?php _e( 'Cancel' ); ?></button>
<span class="waiting spinner"></span>
</p>
<div class="notice notice-error notice-alt inline hidden">
<p class="error"></p>
</div>
</div>
<input type="hidden" name="action" id="action" value="" />
<input type="hidden" name="comment_ID" id="comment_ID" value="" />
<input type="hidden" name="comment_post_ID" id="comment_post_ID" value="" />
<input type="hidden" name="status" id="status" value="" />
<input type="hidden" name="position" id="position" value="<?php echo $position; ?>" />
<input type="hidden" name="checkbox" id="checkbox" value="<?php echo $checkbox ? 1 : 0; ?>" />
<input type="hidden" name="mode" id="mode" value="<?php echo esc_attr( $mode ); ?>" />
<?php
wp_nonce_field( 'replyto-comment', '_ajax_nonce-replyto-comment', false );
if ( current_user_can( 'unfiltered_html' ) ) {
wp_nonce_field( 'unfiltered-html-comment', '_wp_unfiltered_html_comment', false );
}
?>
</fieldset>
<?php if ( $table_row ) : ?>
</td></tr></tbody></table>
<?php else : ?>
</div></div>
<?php endif; ?>
</form>
<?php
}
```
[apply\_filters( 'wp\_comment\_reply', string $content, array $args )](../hooks/wp_comment_reply)
Filters the in-line comment reply-to form output in the Comments list table.
| Uses | Description |
| --- | --- |
| [WP\_List\_Table::get\_column\_count()](../classes/wp_list_table/get_column_count) wp-admin/includes/class-wp-list-table.php | Returns the number of visible columns. |
| [\_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. |
| [wp\_editor()](wp_editor) wp-includes/general-template.php | Renders an editor. |
| [wp\_nonce\_field()](wp_nonce_field) wp-includes/functions.php | Retrieves or display nonce hidden field for forms. |
| [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. |
| [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\_dashboard\_recent\_comments()](wp_dashboard_recent_comments) wp-admin/includes/dashboard.php | Show Comments section. |
| Version | Description |
| --- | --- |
| [2.7.0](https://developer.wordpress.org/reference/since/2.7.0/) | Introduced. |
wordpress get_oembed_response_data_for_url( string $url, array $args ): object|false get\_oembed\_response\_data\_for\_url( string $url, array $args ): object|false
===============================================================================
Retrieves the oEmbed response data for a given URL.
`$url` string Required The URL that should be inspected for discovery `<link>` tags. `$args` array Required oEmbed remote get arguments. object|false oEmbed response data if the URL does belong to the current site. False otherwise.
File: `wp-includes/embed.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/embed.php/)
```
function get_oembed_response_data_for_url( $url, $args ) {
$switched_blog = false;
if ( is_multisite() ) {
$url_parts = wp_parse_args(
wp_parse_url( $url ),
array(
'host' => '',
'path' => '/',
)
);
$qv = array(
'domain' => $url_parts['host'],
'path' => '/',
'update_site_meta_cache' => false,
);
// In case of subdirectory configs, set the path.
if ( ! is_subdomain_install() ) {
$path = explode( '/', ltrim( $url_parts['path'], '/' ) );
$path = reset( $path );
if ( $path ) {
$qv['path'] = get_network()->path . $path . '/';
}
}
$sites = get_sites( $qv );
$site = reset( $sites );
// Do not allow embeds for deleted/archived/spam sites.
if ( ! empty( $site->deleted ) || ! empty( $site->spam ) || ! empty( $site->archived ) ) {
return false;
}
if ( $site && get_current_blog_id() !== (int) $site->blog_id ) {
switch_to_blog( $site->blog_id );
$switched_blog = true;
}
}
$post_id = url_to_postid( $url );
/** This filter is documented in wp-includes/class-wp-oembed-controller.php */
$post_id = apply_filters( 'oembed_request_post_id', $post_id, $url );
if ( ! $post_id ) {
if ( $switched_blog ) {
restore_current_blog();
}
return false;
}
$width = isset( $args['width'] ) ? $args['width'] : 0;
$data = get_oembed_response_data( $post_id, $width );
if ( $switched_blog ) {
restore_current_blog();
}
return $data ? (object) $data : false;
}
```
[apply\_filters( 'oembed\_request\_post\_id', int $post\_id, string $url )](../hooks/oembed_request_post_id)
Filters the determined post ID.
| 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. |
| [get\_oembed\_response\_data()](get_oembed_response_data) wp-includes/embed.php | Retrieves the oEmbed response data for a given post. |
| [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. |
| [url\_to\_postid()](url_to_postid) wp-includes/rewrite.php | Examines a URL and try to determine the post ID it represents. |
| [is\_subdomain\_install()](is_subdomain_install) wp-includes/ms-load.php | Whether a subdomain configuration is enabled. |
| [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. |
| [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\_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. |
| Version | Description |
| --- | --- |
| [5.0.0](https://developer.wordpress.org/reference/since/5.0.0/) | Introduced. |
wordpress display_header( string $body_classes = '' ) display\_header( string $body\_classes = '' )
=============================================
Display installation header.
`$body_classes` string Optional Default: `''`
File: `wp-admin/install.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/install.php/)
```
function display_header( $body_classes = '' ) {
header( 'Content-Type: text/html; charset=utf-8' );
if ( is_rtl() ) {
$body_classes .= 'rtl';
}
if ( $body_classes ) {
$body_classes = ' ' . $body_classes;
}
?>
<!DOCTYPE html>
<html <?php language_attributes(); ?>>
<head>
<meta name="viewport" content="width=device-width" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="robots" content="noindex,nofollow" />
<title><?php _e( 'WordPress › Installation' ); ?></title>
<?php wp_admin_css( 'install', true ); ?>
</head>
<body class="wp-core-ui<?php echo $body_classes; ?>">
<p id="logo"><?php _e( 'WordPress' ); ?></p>
<?php
} // End display_header().
```
| Uses | Description |
| --- | --- |
| [wp\_admin\_css()](wp_admin_css) wp-includes/general-template.php | Enqueues or directly prints a stylesheet link to the specified CSS file. |
| [language\_attributes()](language_attributes) wp-includes/general-template.php | Displays the language attributes for the ‘html’ tag. |
| [is\_rtl()](is_rtl) wp-includes/l10n.php | Determines whether the current locale is right-to-left (RTL). |
| [\_e()](_e) wp-includes/l10n.php | Displays translated text. |
| Version | Description |
| --- | --- |
| [2.5.0](https://developer.wordpress.org/reference/since/2.5.0/) | Introduced. |
wordpress get_post_type_capabilities( object $args ): object get\_post\_type\_capabilities( object $args ): object
=====================================================
Builds an object with all post type capabilities out of a post type object
Post type capabilities use the ‘capability\_type’ argument as a base, if the capability is not set in the ‘capabilities’ argument array or if the ‘capabilities’ argument is not supplied.
The capability\_type argument can optionally be registered as an array, with the first value being singular and the second plural, e.g. array(‘story, ‘stories’) Otherwise, an ‘s’ will be added to the value for the plural form. After registration, capability\_type will always be a string of the singular value.
By default, eight keys are accepted as part of the capabilities array:
* edit\_post, read\_post, and delete\_post are meta capabilities, which are then generally mapped to corresponding primitive capabilities depending on the context, which would be the post being edited/read/deleted and the user or role being checked. Thus these capabilities would generally not be granted directly to users or roles.
* edit\_posts – Controls whether objects of this post type can be edited.
* edit\_others\_posts – Controls whether objects of this type owned by other users can be edited. If the post type does not support an author, then this will behave like edit\_posts.
* delete\_posts – Controls whether objects of this post type can be deleted.
* publish\_posts – Controls publishing objects of this post type.
* read\_private\_posts – Controls whether private objects can be read.
These five primitive capabilities are checked in core in various locations.
There are also six 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.
* read – Controls whether objects of this post type can be read.
* delete\_private\_posts – Controls whether private objects can be deleted.
* delete\_published\_posts – Controls whether published objects can be deleted.
* delete\_others\_posts – Controls whether objects owned by other users can be can be deleted. If the post type does not support an author, then this will behave like delete\_posts.
* edit\_private\_posts – Controls whether private objects can be edited.
* edit\_published\_posts – Controls whether published objects can be edited.
These additional capabilities are only used in [map\_meta\_cap()](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).
* [register\_post\_type()](register_post_type)
* [map\_meta\_cap()](map_meta_cap)
`$args` object Required Post type registration arguments. object Object with all the capabilities as member variables.
Parameter $args is the desired capability type (e.g. ‘post’). Set [‘capability\_type’] to an array to allow for alternative plurals when using this argument as a base to construct the capabilities, e.g. array(‘story’, ‘stories’). Set [‘map\_meta\_cap’] to true to obtain those capabilities as well.
File: `wp-includes/post.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/post.php/)
```
function get_post_type_capabilities( $args ) {
if ( ! is_array( $args->capability_type ) ) {
$args->capability_type = array( $args->capability_type, $args->capability_type . 's' );
}
// Singular base for meta capabilities, plural base for primitive capabilities.
list( $singular_base, $plural_base ) = $args->capability_type;
$default_capabilities = array(
// Meta capabilities.
'edit_post' => 'edit_' . $singular_base,
'read_post' => 'read_' . $singular_base,
'delete_post' => 'delete_' . $singular_base,
// Primitive capabilities used outside of map_meta_cap():
'edit_posts' => 'edit_' . $plural_base,
'edit_others_posts' => 'edit_others_' . $plural_base,
'delete_posts' => 'delete_' . $plural_base,
'publish_posts' => 'publish_' . $plural_base,
'read_private_posts' => 'read_private_' . $plural_base,
);
// Primitive capabilities used within map_meta_cap():
if ( $args->map_meta_cap ) {
$default_capabilities_for_mapping = array(
'read' => 'read',
'delete_private_posts' => 'delete_private_' . $plural_base,
'delete_published_posts' => 'delete_published_' . $plural_base,
'delete_others_posts' => 'delete_others_' . $plural_base,
'edit_private_posts' => 'edit_private_' . $plural_base,
'edit_published_posts' => 'edit_published_' . $plural_base,
);
$default_capabilities = array_merge( $default_capabilities, $default_capabilities_for_mapping );
}
$capabilities = array_merge( $default_capabilities, $args->capabilities );
// Post creation capability simply maps to edit_posts by default:
if ( ! isset( $capabilities['create_posts'] ) ) {
$capabilities['create_posts'] = $capabilities['edit_posts'];
}
// Remember meta capabilities for future reference.
if ( $args->map_meta_cap ) {
_post_type_meta_capabilities( $capabilities );
}
return (object) $capabilities;
}
```
| Uses | Description |
| --- | --- |
| [\_post\_type\_meta\_capabilities()](_post_type_meta_capabilities) wp-includes/post.php | Stores or returns a list of post type meta caps for [map\_meta\_cap()](map_meta_cap) . |
| 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.4.0](https://developer.wordpress.org/reference/since/5.4.0/) | `'delete_posts'` is included in default capabilities. |
| [3.0.0](https://developer.wordpress.org/reference/since/3.0.0/) | Introduced. |
| programming_docs |
wordpress wp_oembed_remove_provider( string $format ): bool wp\_oembed\_remove\_provider( string $format ): bool
====================================================
Removes an oEmbed provider.
* [WP\_oEmbed](../classes/wp_oembed)
`$format` string Required The URL format for the oEmbed provider to remove. bool Was the provider removed successfully?
File: `wp-includes/embed.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/embed.php/)
```
function wp_oembed_remove_provider( $format ) {
if ( did_action( 'plugins_loaded' ) ) {
$oembed = _wp_oembed_get_object();
if ( isset( $oembed->providers[ $format ] ) ) {
unset( $oembed->providers[ $format ] );
return true;
}
} else {
WP_oEmbed::_remove_provider_early( $format );
}
return false;
}
```
| Uses | Description |
| --- | --- |
| [WP\_oEmbed::\_remove\_provider\_early()](../classes/wp_oembed/_remove_provider_early) wp-includes/class-wp-oembed.php | Removes 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 |
| --- | --- |
| [3.5.0](https://developer.wordpress.org/reference/since/3.5.0/) | Introduced. |
wordpress wp_page_reload_on_back_button_js() wp\_page\_reload\_on\_back\_button\_js()
========================================
Outputs JS that reloads the page if the user navigated to it with the Back or Forward button.
Used on the Edit Post and Add New Post screens. Needed to ensure the page is not loaded from browser cache, so the post title and editor content are the last saved versions. Ideally this script should run first in the head.
File: `wp-admin/includes/misc.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/misc.php/)
```
function wp_page_reload_on_back_button_js() {
?>
<script>
if ( typeof performance !== 'undefined' && performance.navigation && performance.navigation.type === 2 ) {
document.location.reload( true );
}
</script>
<?php
}
```
| Version | Description |
| --- | --- |
| [4.6.0](https://developer.wordpress.org/reference/since/4.6.0/) | Introduced. |
wordpress translate_smiley( array $matches ): string translate\_smiley( array $matches ): string
===========================================
Converts one smiley code to the icon graphic file equivalent.
Callback handler for [convert\_smilies()](convert_smilies) .
Looks up one smiley code in the $wpsmiliestrans global array and returns an `<img>` string for that smiley.
`$matches` array Required Single match. Smiley code to convert to image. string Image string for smiley.
File: `wp-includes/formatting.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/formatting.php/)
```
function translate_smiley( $matches ) {
global $wpsmiliestrans;
if ( count( $matches ) == 0 ) {
return '';
}
$smiley = trim( reset( $matches ) );
$img = $wpsmiliestrans[ $smiley ];
$matches = array();
$ext = preg_match( '/\.([^.]+)$/', $img, $matches ) ? strtolower( $matches[1] ) : false;
$image_exts = array( 'jpg', 'jpeg', 'jpe', 'gif', 'png', 'webp' );
// Don't convert smilies that aren't images - they're probably emoji.
if ( ! in_array( $ext, $image_exts, true ) ) {
return $img;
}
/**
* Filters the Smiley image URL before it's used in the image element.
*
* @since 2.9.0
*
* @param string $smiley_url URL for the smiley image.
* @param string $img Filename for the smiley image.
* @param string $site_url Site URL, as returned by site_url().
*/
$src_url = apply_filters( 'smilies_src', includes_url( "images/smilies/$img" ), $img, site_url() );
return sprintf( '<img src="%s" alt="%s" class="wp-smiley" style="height: 1em; max-height: 1em;" />', esc_url( $src_url ), esc_attr( $smiley ) );
}
```
[apply\_filters( 'smilies\_src', string $smiley\_url, string $img, string $site\_url )](../hooks/smilies_src)
Filters the Smiley image URL before it’s used in the image element.
| Uses | Description |
| --- | --- |
| [includes\_url()](includes_url) wp-includes/link-template.php | Retrieves the URL to the includes directory. |
| [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. |
| [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.8.0](https://developer.wordpress.org/reference/since/2.8.0/) | Introduced. |
wordpress get_comment_author_IP( int|WP_Comment $comment_ID ): string get\_comment\_author\_IP( int|WP\_Comment $comment\_ID ): string
================================================================
Retrieves the IP address 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 IP address.
Default current comment. string Comment author's IP address, or an empty string if it's not available.
File: `wp-includes/comment-template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/comment-template.php/)
```
function get_comment_author_IP( $comment_ID = 0 ) { // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.FunctionNameInvalid
$comment = get_comment( $comment_ID );
/**
* Filters the comment author's returned IP address.
*
* @since 1.5.0
* @since 4.1.0 The `$comment_ID` and `$comment` parameters were added.
*
* @param string $comment_author_ip The comment author's IP address, or an empty string if it's not available.
* @param string $comment_ID The comment ID as a numeric string.
* @param WP_Comment $comment The comment object.
*/
return apply_filters( 'get_comment_author_IP', $comment->comment_author_IP, $comment->comment_ID, $comment ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.NotLowercase
}
```
[apply\_filters( 'get\_comment\_author\_IP', string $comment\_author\_ip, string $comment\_ID, WP\_Comment $comment )](../hooks/get_comment_author_ip)
Filters the comment author’s returned IP 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 |
| --- | --- |
| [WP\_Comments\_List\_Table::column\_author()](../classes/wp_comments_list_table/column_author) wp-admin/includes/class-wp-comments-list-table.php | |
| [comment\_author\_IP()](comment_author_ip) wp-includes/comment-template.php | Displays the IP address of the author 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 wp_text_diff( string $left_string, string $right_string, string|array $args = null ): string wp\_text\_diff( string $left\_string, string $right\_string, string|array $args = null ): string
================================================================================================
Displays a human readable HTML representation of the difference between two strings.
The Diff is available for getting the changes between versions. The output is HTML, so the primary use is for displaying the changes. If the two strings are equivalent, then an empty string will be returned.
* [wp\_parse\_args()](wp_parse_args) : Used to change defaults to user defined settings.
`$left_string` string Required "old" (left) version of string. `$right_string` string Required "new" (right) version of string. `$args` string|array Optional Associative array of options to pass to [WP\_Text\_Diff\_Renderer\_Table](../classes/wp_text_diff_renderer_table)().
* `title`stringTitles the diff in a manner compatible with the output. Default empty.
* `title_left`stringChange the HTML to the left of the title.
Default empty.
* `title_right`stringChange the HTML to the right of the title.
Default empty.
* `show_split_view`boolTrue for split view (two columns), false for un-split view (single column). Default true.
Default: `null`
string Empty string if strings are equivalent or HTML with differences.
File: `wp-includes/pluggable.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/pluggable.php/)
```
function wp_text_diff( $left_string, $right_string, $args = null ) {
$defaults = array(
'title' => '',
'title_left' => '',
'title_right' => '',
'show_split_view' => true,
);
$args = wp_parse_args( $args, $defaults );
if ( ! class_exists( 'WP_Text_Diff_Renderer_Table', false ) ) {
require ABSPATH . WPINC . '/wp-diff.php';
}
$left_string = normalize_whitespace( $left_string );
$right_string = normalize_whitespace( $right_string );
$left_lines = explode( "\n", $left_string );
$right_lines = explode( "\n", $right_string );
$text_diff = new Text_Diff( $left_lines, $right_lines );
$renderer = new WP_Text_Diff_Renderer_Table( $args );
$diff = $renderer->render( $text_diff );
if ( ! $diff ) {
return '';
}
$is_split_view = ! empty( $args['show_split_view'] );
$is_split_view_class = $is_split_view ? ' is-split-view' : '';
$r = "<table class='diff$is_split_view_class'>\n";
if ( $args['title'] ) {
$r .= "<caption class='diff-title'>$args[title]</caption>\n";
}
if ( $args['title_left'] || $args['title_right'] ) {
$r .= '<thead>';
}
if ( $args['title_left'] || $args['title_right'] ) {
$th_or_td_left = empty( $args['title_left'] ) ? 'td' : 'th';
$th_or_td_right = empty( $args['title_right'] ) ? 'td' : 'th';
$r .= "<tr class='diff-sub-title'>\n";
$r .= "\t<$th_or_td_left>$args[title_left]</$th_or_td_left>\n";
if ( $is_split_view ) {
$r .= "\t<$th_or_td_right>$args[title_right]</$th_or_td_right>\n";
}
$r .= "</tr>\n";
}
if ( $args['title_left'] || $args['title_right'] ) {
$r .= "</thead>\n";
}
$r .= "<tbody>\n$diff\n</tbody>\n";
$r .= '</table>';
return $r;
}
```
| Uses | Description |
| --- | --- |
| [normalize\_whitespace()](normalize_whitespace) wp-includes/formatting.php | Normalizes EOL characters and strips duplicate whitespace. |
| [WP\_Text\_Diff\_Renderer\_Table::\_\_construct()](../classes/wp_text_diff_renderer_table/__construct) wp-includes/class-wp-text-diff-renderer-table.php | Constructor – Call parent constructor with params array. |
| [wp\_parse\_args()](wp_parse_args) wp-includes/functions.php | Merges user defined arguments into defaults array. |
| Used By | Description |
| --- | --- |
| [wp\_get\_revision\_ui\_diff()](wp_get_revision_ui_diff) wp-admin/includes/revision.php | Get the revision UI diff. |
| Version | Description |
| --- | --- |
| [2.6.0](https://developer.wordpress.org/reference/since/2.6.0/) | Introduced. |
wordpress wp_specialchars( string $text, string $quote_style = ENT_NOQUOTES, false|string $charset = false, false $double_encode = false ): string wp\_specialchars( string $text, string $quote\_style = ENT\_NOQUOTES, false|string $charset = false, false $double\_encode = false ): string
============================================================================================================================================
This function has been deprecated. Use [esc\_html()](esc_html) instead.
Legacy escaping for HTML blocks.
* [esc\_html()](esc_html)
`$text` string Required Text to escape. `$quote_style` string Optional Unused. Default: `ENT_NOQUOTES`
`$charset` false|string Optional Unused. Default: `false`
`$double_encode` false Optional Whether to double encode. Unused. Default: `false`
string Escaped `$text`.
File: `wp-includes/deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/deprecated.php/)
```
function wp_specialchars( $text, $quote_style = ENT_NOQUOTES, $charset = false, $double_encode = false ) {
_deprecated_function( __FUNCTION__, '2.8.0', 'esc_html()' );
if ( func_num_args() > 1 ) { // Maintain back-compat for people passing additional arguments.
return _wp_specialchars( $text, $quote_style, $charset, $double_encode );
} else {
return esc_html( $text );
}
}
```
| Uses | Description |
| --- | --- |
| [\_wp\_specialchars()](_wp_specialchars) wp-includes/formatting.php | Converts a number of special characters into their HTML entities. |
| [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. |
| Version | Description |
| --- | --- |
| [2.8.0](https://developer.wordpress.org/reference/since/2.8.0/) | Introduced. |
wordpress _update_post_term_count( int[] $terms, WP_Taxonomy $taxonomy ) \_update\_post\_term\_count( int[] $terms, WP\_Taxonomy $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.
Updates term count based on object types of the current taxonomy.
Private function for the default callback for post\_tag and category taxonomies.
`$terms` int[] Required List of term taxonomy IDs. `$taxonomy` [WP\_Taxonomy](../classes/wp_taxonomy) Required Current taxonomy object of terms. File: `wp-includes/taxonomy.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/taxonomy.php/)
```
function _update_post_term_count( $terms, $taxonomy ) {
global $wpdb;
$object_types = (array) $taxonomy->object_type;
foreach ( $object_types as &$object_type ) {
list( $object_type ) = explode( ':', $object_type );
}
$object_types = array_unique( $object_types );
$check_attachments = array_search( 'attachment', $object_types, true );
if ( false !== $check_attachments ) {
unset( $object_types[ $check_attachments ] );
$check_attachments = true;
}
if ( $object_types ) {
$object_types = esc_sql( array_filter( $object_types, 'post_type_exists' ) );
}
$post_statuses = array( 'publish' );
/**
* Filters the post statuses for updating the term count.
*
* @since 5.7.0
*
* @param string[] $post_statuses List of post statuses to include in the count. Default is 'publish'.
* @param WP_Taxonomy $taxonomy Current taxonomy object.
*/
$post_statuses = esc_sql( apply_filters( 'update_post_term_count_statuses', $post_statuses, $taxonomy ) );
foreach ( (array) $terms as $term ) {
$count = 0;
// Attachments can be 'inherit' status, we need to base count off the parent's status if so.
if ( $check_attachments ) {
// phpcs:ignore WordPress.DB.PreparedSQLPlaceholders.QuotedDynamicPlaceholderGeneration
$count += (int) $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM $wpdb->term_relationships, $wpdb->posts p1 WHERE p1.ID = $wpdb->term_relationships.object_id AND ( post_status IN ('" . implode( "', '", $post_statuses ) . "') OR ( post_status = 'inherit' AND post_parent > 0 AND ( SELECT post_status FROM $wpdb->posts WHERE ID = p1.post_parent ) IN ('" . implode( "', '", $post_statuses ) . "') ) ) AND post_type = 'attachment' AND term_taxonomy_id = %d", $term ) );
}
if ( $object_types ) {
// phpcs:ignore WordPress.DB.PreparedSQLPlaceholders.QuotedDynamicPlaceholderGeneration
$count += (int) $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM $wpdb->term_relationships, $wpdb->posts WHERE $wpdb->posts.ID = $wpdb->term_relationships.object_id AND post_status IN ('" . implode( "', '", $post_statuses ) . "') AND post_type IN ('" . implode( "', '", $object_types ) . "') AND term_taxonomy_id = %d", $term ) );
}
/** This action is documented in wp-includes/taxonomy.php */
do_action( 'edit_term_taxonomy', $term, $taxonomy->name );
$wpdb->update( $wpdb->term_taxonomy, compact( 'count' ), array( 'term_taxonomy_id' => $term ) );
/** This action is documented in wp-includes/taxonomy.php */
do_action( 'edited_term_taxonomy', $term, $taxonomy->name );
}
}
```
[do\_action( 'edited\_term\_taxonomy', int $tt\_id, string $taxonomy, array $args )](../hooks/edited_term_taxonomy)
Fires immediately after a term-taxonomy relationship is updated.
[do\_action( 'edit\_term\_taxonomy', int $tt\_id, string $taxonomy, array $args )](../hooks/edit_term_taxonomy)
Fires immediate before a term-taxonomy relationship is updated.
[apply\_filters( 'update\_post\_term\_count\_statuses', string[] $post\_statuses, WP\_Taxonomy $taxonomy )](../hooks/update_post_term_count_statuses)
Filters the post statuses for updating the term count.
| Uses | Description |
| --- | --- |
| [esc\_sql()](esc_sql) wp-includes/formatting.php | Escapes data for use in a MySQL query. |
| [wpdb::update()](../classes/wpdb/update) wp-includes/class-wpdb.php | Updates a row in the table. |
| [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 |
| --- | --- |
| [wp\_update\_term\_count\_now()](wp_update_term_count_now) wp-includes/taxonomy.php | Performs term count update immediately. |
| Version | Description |
| --- | --- |
| [2.3.0](https://developer.wordpress.org/reference/since/2.3.0/) | Introduced. |
wordpress wp_get_post_revisions( int|WP_Post $post, array|null $args = null ): WP_Post[]|int[] wp\_get\_post\_revisions( int|WP\_Post $post, array|null $args = null ): WP\_Post[]|int[]
=========================================================================================
Returns all revisions of specified post.
* [get\_children()](get_children)
`$post` int|[WP\_Post](../classes/wp_post) Optional Post ID or [WP\_Post](../classes/wp_post) object. Default is global `$post`. `$args` array|null Optional Arguments for retrieving post revisions. Default: `null`
[WP\_Post](../classes/wp_post)[]|int[] Array of revision objects or IDs, or an empty array if none.
See the parameters section of the [WP\_Query](../classes/wp_query) documentation for a list of parameters that the parameter `$args` accepts.
File: `wp-includes/revision.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/revision.php/)
```
function wp_get_post_revisions( $post = 0, $args = null ) {
$post = get_post( $post );
if ( ! $post || empty( $post->ID ) ) {
return array();
}
$defaults = array(
'order' => 'DESC',
'orderby' => 'date ID',
'check_enabled' => true,
);
$args = wp_parse_args( $args, $defaults );
if ( $args['check_enabled'] && ! wp_revisions_enabled( $post ) ) {
return array();
}
$args = array_merge(
$args,
array(
'post_parent' => $post->ID,
'post_type' => 'revision',
'post_status' => 'inherit',
)
);
$revisions = get_children( $args );
if ( ! $revisions ) {
return array();
}
return $revisions;
}
```
| Uses | Description |
| --- | --- |
| [get\_children()](get_children) wp-includes/post.php | Retrieves all children of the post parent ID. |
| [wp\_revisions\_enabled()](wp_revisions_enabled) wp-includes/revision.php | Determines whether revisions are enabled for a given post. |
| [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 |
| --- | --- |
| [WP\_REST\_Autosaves\_Controller::get\_items()](../classes/wp_rest_autosaves_controller/get_items) wp-includes/rest-api/endpoints/class-wp-rest-autosaves-controller.php | Gets a collection of autosaves using wp\_get\_post\_autosave. |
| [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. |
| [edit\_post()](edit_post) wp-admin/includes/post.php | Updates an existing post with values provided in `$_POST`. |
| [wp\_ajax\_get\_revision\_diffs()](wp_ajax_get_revision_diffs) wp-admin/includes/ajax-actions.php | Ajax handler for getting revision diffs. |
| [wp\_prepare\_revisions\_for\_js()](wp_prepare_revisions_for_js) wp-admin/includes/revision.php | Prepare revisions for JavaScript. |
| [wp\_list\_post\_revisions()](wp_list_post_revisions) wp-includes/post-template.php | Displays a list of a post’s revisions. |
| [wp\_save\_post\_revision()](wp_save_post_revision) wp-includes/revision.php | Creates a revision for the current version of a post. |
| [wp\_xmlrpc\_server::wp\_getRevisions()](../classes/wp_xmlrpc_server/wp_getrevisions) wp-includes/class-wp-xmlrpc-server.php | Retrieve revisions for a specific post. |
| Version | Description |
| --- | --- |
| [2.6.0](https://developer.wordpress.org/reference/since/2.6.0/) | Introduced. |
| programming_docs |
wordpress _wp_privacy_requests_screen_options() \_wp\_privacy\_requests\_screen\_options()
==========================================
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.
Was used to add options for the privacy requests screens before they were separate files.
File: `wp-admin/includes/deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/deprecated.php/)
```
function _wp_privacy_requests_screen_options() {
_deprecated_function( __FUNCTION__, '5.3.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 |
| --- | --- |
| [5.3.0](https://developer.wordpress.org/reference/since/5.3.0/) | This function has been deprecated. |
| [4.9.8](https://developer.wordpress.org/reference/since/4.9.8/) | Introduced. |
wordpress wp_suspend_cache_addition( bool $suspend = null ): bool wp\_suspend\_cache\_addition( bool $suspend = null ): bool
==========================================================
Temporarily suspends cache additions.
Stops more data being added to the cache, but still allows cache retrieval.
This is useful for actions, such as imports, when a lot of data would otherwise be almost uselessly added to the cache.
Suspension lasts for a single page load at most. Remember to call this function again if you wish to re-enable cache adds earlier.
`$suspend` bool Optional Suspends additions if true, re-enables them if false. Default: `null`
bool The current suspend setting
File: `wp-includes/functions.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/functions.php/)
```
function wp_suspend_cache_addition( $suspend = null ) {
static $_suspend = false;
if ( is_bool( $suspend ) ) {
$_suspend = $suspend;
}
return $_suspend;
}
```
| Used By | Description |
| --- | --- |
| [WP\_Object\_Cache::add()](../classes/wp_object_cache/add) wp-includes/class-wp-object-cache.php | Adds data to the cache if it doesn’t already exist. |
| [WP\_Widget::display\_callback()](../classes/wp_widget/display_callback) wp-includes/class-wp-widget.php | Generates the actual widget content (Do NOT override). |
| [WP\_Widget::update\_callback()](../classes/wp_widget/update_callback) wp-includes/class-wp-widget.php | Handles changed settings (Do NOT override). |
| Version | Description |
| --- | --- |
| [3.3.0](https://developer.wordpress.org/reference/since/3.3.0/) | Introduced. |
wordpress wp_get_split_term( int $old_term_id, string $taxonomy ): int|false wp\_get\_split\_term( int $old\_term\_id, string $taxonomy ): int|false
=======================================================================
Gets the new term ID corresponding to a previously split term.
`$old_term_id` int Required Term ID. This is the old, pre-split term ID. `$taxonomy` string Required Taxonomy that the term belongs to. int|false If a previously split term is found corresponding to the old term\_id and taxonomy, the new term\_id will be returned. If no previously split term is found matching the parameters, returns false.
File: `wp-includes/taxonomy.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/taxonomy.php/)
```
function wp_get_split_term( $old_term_id, $taxonomy ) {
$split_terms = wp_get_split_terms( $old_term_id );
$term_id = false;
if ( isset( $split_terms[ $taxonomy ] ) ) {
$term_id = (int) $split_terms[ $taxonomy ];
}
return $term_id;
}
```
| Uses | Description |
| --- | --- |
| [wp\_get\_split\_terms()](wp_get_split_terms) wp-includes/taxonomy.php | Gets data about terms that previously shared a single term\_id, but have since been split. |
| Version | Description |
| --- | --- |
| [4.2.0](https://developer.wordpress.org/reference/since/4.2.0/) | Introduced. |
wordpress get_term_children( int $term_id, string $taxonomy ): array|WP_Error get\_term\_children( int $term\_id, string $taxonomy ): array|WP\_Error
=======================================================================
Merges all term children into a single array of their IDs.
This recursive function will merge all of the children of $term into the same array of term IDs. Only useful for taxonomies which are hierarchical.
Will return an empty array if $term does not exist in $taxonomy.
`$term_id` int Required ID of term to get children. `$taxonomy` string Required Taxonomy name. array|[WP\_Error](../classes/wp_error) List of term IDs. [WP\_Error](../classes/wp_error) returned if `$taxonomy` does not exist.
File: `wp-includes/taxonomy.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/taxonomy.php/)
```
function get_term_children( $term_id, $taxonomy ) {
if ( ! taxonomy_exists( $taxonomy ) ) {
return new WP_Error( 'invalid_taxonomy', __( 'Invalid taxonomy.' ) );
}
$term_id = (int) $term_id;
$terms = _get_term_hierarchy( $taxonomy );
if ( ! isset( $terms[ $term_id ] ) ) {
return array();
}
$children = $terms[ $term_id ];
foreach ( (array) $terms[ $term_id ] as $child ) {
if ( $term_id === $child ) {
continue;
}
if ( isset( $terms[ $child ] ) ) {
$children = array_merge( $children, get_term_children( $child, $taxonomy ) );
}
}
return $children;
}
```
| Uses | Description |
| --- | --- |
| [get\_term\_children()](get_term_children) wp-includes/taxonomy.php | Merges all term children into a single array of their IDs. |
| [\_get\_term\_hierarchy()](_get_term_hierarchy) wp-includes/taxonomy.php | Retrieves children of taxonomy as term IDs. |
| [taxonomy\_exists()](taxonomy_exists) wp-includes/taxonomy.php | Determines whether the taxonomy name exists. |
| [\_\_()](__) 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\_Term\_Query::get\_terms()](../classes/wp_term_query/get_terms) wp-includes/class-wp-term-query.php | Retrieves the query results. |
| [WP\_Tax\_Query::clean\_query()](../classes/wp_tax_query/clean_query) wp-includes/class-wp-tax-query.php | Validates a single query. |
| [get\_term\_children()](get_term_children) wp-includes/taxonomy.php | Merges all term children into a single array of their IDs. |
| Version | Description |
| --- | --- |
| [2.3.0](https://developer.wordpress.org/reference/since/2.3.0/) | Introduced. |
wordpress wp_defer_term_counting( bool $defer = null ): bool wp\_defer\_term\_counting( bool $defer = null ): bool
=====================================================
Enables or disables term counting.
`$defer` bool Optional Enable if true, disable if false. Default: `null`
bool Whether term counting is enabled or disabled.
File: `wp-includes/taxonomy.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/taxonomy.php/)
```
function wp_defer_term_counting( $defer = null ) {
static $_defer = false;
if ( is_bool( $defer ) ) {
$_defer = $defer;
// Flush any deferred counts.
if ( ! $defer ) {
wp_update_term_count( null, null, true );
}
}
return $_defer;
}
```
| Uses | Description |
| --- | --- |
| [wp\_update\_term\_count()](wp_update_term_count) wp-includes/taxonomy.php | Updates the amount of terms in taxonomy. |
| Used By | Description |
| --- | --- |
| [wp\_nav\_menu\_update\_menu\_items()](wp_nav_menu_update_menu_items) wp-admin/includes/nav-menu.php | Saves nav menu items |
| [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_count_attachments( string|string[] $mime_type = '' ): stdClass wp\_count\_attachments( string|string[] $mime\_type = '' ): stdClass
====================================================================
Counts number of attachments for the mime type(s).
If you set the optional mime\_type parameter, then an array will still be returned, but will only have the item you are looking for. It does not give you the number of attachments that are children of a post. You can get that by counting the number of children that post has.
`$mime_type` string|string[] Optional Array or comma-separated list of MIME patterns. Default: `''`
stdClass An object containing the attachment counts by mime type.
File: `wp-includes/post.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/post.php/)
```
function wp_count_attachments( $mime_type = '' ) {
global $wpdb;
$cache_key = sprintf(
'attachments%s',
! empty( $mime_type ) ? ':' . str_replace( '/', '_', implode( '-', (array) $mime_type ) ) : ''
);
$counts = wp_cache_get( $cache_key, 'counts' );
if ( false == $counts ) {
$and = wp_post_mime_type_where( $mime_type );
$count = $wpdb->get_results( "SELECT post_mime_type, COUNT( * ) AS num_posts FROM $wpdb->posts WHERE post_type = 'attachment' AND post_status != 'trash' $and GROUP BY post_mime_type", ARRAY_A );
$counts = array();
foreach ( (array) $count as $row ) {
$counts[ $row['post_mime_type'] ] = $row['num_posts'];
}
$counts['trash'] = $wpdb->get_var( "SELECT COUNT( * ) FROM $wpdb->posts WHERE post_type = 'attachment' AND post_status = 'trash' $and" );
wp_cache_set( $cache_key, (object) $counts, 'counts' );
}
/**
* Modifies returned attachment counts by mime type.
*
* @since 3.7.0
*
* @param stdClass $counts An object containing the attachment counts by
* mime type.
* @param string|string[] $mime_type Array or comma-separated list of MIME patterns.
*/
return apply_filters( 'wp_count_attachments', (object) $counts, $mime_type );
}
```
[apply\_filters( 'wp\_count\_attachments', stdClass $counts, string|string[] $mime\_type )](../hooks/wp_count_attachments)
Modifies returned attachment counts by mime type.
| Uses | Description |
| --- | --- |
| [wp\_cache\_set()](wp_cache_set) wp-includes/cache.php | Saves the data to the cache. |
| [wp\_post\_mime\_type\_where()](wp_post_mime_type_where) wp-includes/post.php | Converts MIME types into SQL. |
| [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. |
| [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 |
| --- | --- |
| [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_new_comment_notify_moderator( int $comment_ID ): bool wp\_new\_comment\_notify\_moderator( int $comment\_ID ): bool
=============================================================
Sends a comment moderation notification to the comment moderator.
`$comment_ID` int Required ID of the comment. 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_moderator( $comment_ID ) {
$comment = get_comment( $comment_ID );
// Only send notifications for pending comments.
$maybe_notify = ( '0' == $comment->comment_approved );
/** This filter is documented in wp-includes/comment.php */
$maybe_notify = apply_filters( 'notify_moderator', $maybe_notify, $comment_ID );
if ( ! $maybe_notify ) {
return false;
}
return wp_notify_moderator( $comment_ID );
}
```
[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 |
| --- | --- |
| [wp\_notify\_moderator()](wp_notify_moderator) wp-includes/pluggable.php | Notifies the moderator of the site about a new comment that is awaiting approval. |
| [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/) | Introduced. |
wordpress get_page_by_title( string $page_title, string $output = OBJECT, string|array $post_type = 'page' ): WP_Post|array|null get\_page\_by\_title( string $page\_title, string $output = OBJECT, string|array $post\_type = 'page' ): WP\_Post|array|null
============================================================================================================================
Retrieves a page given its title.
If more than one post uses the same title, the post with the smallest ID will be returned.
Be careful: in case of more than one post having the same title, it will check the oldest publication date, not the smallest ID.
Because this function uses the MySQL ‘=’ comparison, $page\_title will usually be matched as case-insensitive with default collation.
`$page_title` string Required Page title. `$output` string Optional The required return type. One of OBJECT, ARRAY\_A, or ARRAY\_N, which correspond to a [WP\_Post](../classes/wp_post) object, an associative array, or a numeric array, respectively. Default: `OBJECT`
`$post_type` string|array Optional Post type or array of post types. Default `'page'`. Default: `'page'`
[WP\_Post](../classes/wp_post)|array|null [WP\_Post](../classes/wp_post) (or array) on success, or null on failure.
File: `wp-includes/post.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/post.php/)
```
function get_page_by_title( $page_title, $output = OBJECT, $post_type = 'page' ) {
$args = array(
'title' => $page_title,
'post_type' => $post_type,
'post_status' => get_post_stati(),
'posts_per_page' => 1,
'update_post_term_cache' => false,
'update_post_meta_cache' => false,
'no_found_rows' => true,
'orderby' => 'post_date ID',
'order' => 'ASC',
);
$query = new WP_Query( $args );
$pages = $query->posts;
if ( empty( $pages ) ) {
return null;
}
return get_post( $pages[0], $output );
}
```
| Uses | Description |
| --- | --- |
| [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. |
| Version | Description |
| --- | --- |
| [3.0.0](https://developer.wordpress.org/reference/since/3.0.0/) | The `$post_type` parameter was added. |
| [2.1.0](https://developer.wordpress.org/reference/since/2.1.0/) | Introduced. |
wordpress get_attachment_icon_src( int $id, bool $fullsize = false ): array get\_attachment\_icon\_src( int $id, bool $fullsize = false ): array
====================================================================
This function has been deprecated. Use [wp\_get\_attachment\_image\_src()](wp_get_attachment_image_src) instead.
Retrieve icon URL and Path.
* [wp\_get\_attachment\_image\_src()](wp_get_attachment_image_src)
`$id` int Optional Post ID. `$fullsize` bool Optional Whether to have full image. Default: `false`
array Icon URL and full path to file, respectively.
File: `wp-includes/deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/deprecated.php/)
```
function get_attachment_icon_src( $id = 0, $fullsize = false ) {
_deprecated_function( __FUNCTION__, '2.5.0', 'wp_get_attachment_image_src()' );
$id = (int) $id;
if ( !$post = get_post($id) )
return false;
$file = get_attached_file( $post->ID );
if ( !$fullsize && $src = wp_get_attachment_thumb_url( $post->ID ) ) {
// We have a thumbnail desired, specified and existing.
$src_file = wp_basename($src);
} elseif ( wp_attachment_is_image( $post->ID ) ) {
// We have an image without a thumbnail.
$src = wp_get_attachment_url( $post->ID );
$src_file = & $file;
} elseif ( $src = wp_mime_type_icon( $post->ID ) ) {
// No thumb, no image. We'll look for a mime-related icon instead.
/** This filter is documented in wp-includes/post.php */
$icon_dir = apply_filters( 'icon_dir', get_template_directory() . '/images' );
$src_file = $icon_dir . '/' . wp_basename($src);
}
if ( !isset($src) || !$src )
return false;
return array($src, $src_file);
}
```
[apply\_filters( 'icon\_dir', string $path )](../hooks/icon_dir)
Filters the icon directory path.
| Uses | Description |
| --- | --- |
| [get\_template\_directory()](get_template_directory) wp-includes/theme.php | Retrieves template directory path for the active theme. |
| [wp\_attachment\_is\_image()](wp_attachment_is_image) wp-includes/post.php | Determines whether an attachment is an image. |
| [wp\_mime\_type\_icon()](wp_mime_type_icon) wp-includes/post.php | Retrieves the icon for a MIME type or attachment. |
| [wp\_get\_attachment\_thumb\_url()](wp_get_attachment_thumb_url) wp-includes/post.php | Retrieves URL for an attachment thumbnail. |
| [wp\_get\_attachment\_url()](wp_get_attachment_url) wp-includes/post.php | Retrieves the URL for an attachment. |
| [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(). |
| [\_deprecated\_function()](_deprecated_function) wp-includes/functions.php | Marks a function 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. |
| [get\_post()](get_post) wp-includes/post.php | Retrieves post data given a post ID or post object. |
| Used By | Description |
| --- | --- |
| [get\_attachment\_icon()](get_attachment_icon) wp-includes/deprecated.php | Retrieve HTML content of icon attachment image element. |
| Version | Description |
| --- | --- |
| [2.5.0](https://developer.wordpress.org/reference/since/2.5.0/) | Use [wp\_get\_attachment\_image\_src()](wp_get_attachment_image_src) |
| [2.1.0](https://developer.wordpress.org/reference/since/2.1.0/) | Introduced. |
wordpress redirect_canonical( string $requested_url = null, bool $do_redirect = true ): string|void redirect\_canonical( string $requested\_url = null, bool $do\_redirect = true ): string|void
============================================================================================
Redirects incoming links to the proper URL based on the site url.
Search engines consider www.somedomain.com and somedomain.com to be two different URLs when they both go to the same location. This SEO enhancement prevents penalty for duplicate content by redirecting all incoming links to one or the other.
Prevents redirection for feeds, trackbacks, searches, and admin URLs. Does not redirect on non-pretty-permalink-supporting IIS 7+, page/post previews, WP admin, Trackbacks, robots.txt, favicon.ico, searches, or on POST requests.
Will also attempt to find the correct link when a user enters a URL that does not exist based on exact WordPress query. Will instead try to parse the URL or query in an attempt to figure the correct page to go to.
`$requested_url` string Optional The URL that was requested, used to figure if redirect is needed. Default: `null`
`$do_redirect` bool Optional Redirect to the new URL. Default: `true`
string|void The string of the URL, if redirect needed.
File: `wp-includes/canonical.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/canonical.php/)
```
function redirect_canonical( $requested_url = null, $do_redirect = true ) {
global $wp_rewrite, $is_IIS, $wp_query, $wpdb, $wp;
if ( isset( $_SERVER['REQUEST_METHOD'] ) && ! in_array( strtoupper( $_SERVER['REQUEST_METHOD'] ), array( 'GET', 'HEAD' ), true ) ) {
return;
}
// If we're not in wp-admin and the post has been published and preview nonce
// is non-existent or invalid then no need for preview in query.
if ( is_preview() && get_query_var( 'p' ) && 'publish' === get_post_status( get_query_var( 'p' ) ) ) {
if ( ! isset( $_GET['preview_id'] )
|| ! isset( $_GET['preview_nonce'] )
|| ! wp_verify_nonce( $_GET['preview_nonce'], 'post_preview_' . (int) $_GET['preview_id'] )
) {
$wp_query->is_preview = false;
}
}
if ( is_admin() || is_search() || is_preview() || is_trackback() || is_favicon()
|| ( $is_IIS && ! iis7_supports_permalinks() )
) {
return;
}
if ( ! $requested_url && isset( $_SERVER['HTTP_HOST'] ) ) {
// Build the URL in the address bar.
$requested_url = is_ssl() ? 'https://' : 'http://';
$requested_url .= $_SERVER['HTTP_HOST'];
$requested_url .= $_SERVER['REQUEST_URI'];
}
$original = parse_url( $requested_url );
if ( false === $original ) {
return;
}
$redirect = $original;
$redirect_url = false;
$redirect_obj = false;
// Notice fixing.
if ( ! isset( $redirect['path'] ) ) {
$redirect['path'] = '';
}
if ( ! isset( $redirect['query'] ) ) {
$redirect['query'] = '';
}
/*
* If the original URL ended with non-breaking spaces, they were almost
* certainly inserted by accident. Let's remove them, so the reader doesn't
* see a 404 error with no obvious cause.
*/
$redirect['path'] = preg_replace( '|(%C2%A0)+$|i', '', $redirect['path'] );
// It's not a preview, so remove it from URL.
if ( get_query_var( 'preview' ) ) {
$redirect['query'] = remove_query_arg( 'preview', $redirect['query'] );
}
$post_id = get_query_var( 'p' );
if ( is_feed() && $post_id ) {
$redirect_url = get_post_comments_feed_link( $post_id, get_query_var( 'feed' ) );
$redirect_obj = get_post( $post_id );
if ( $redirect_url ) {
$redirect['query'] = _remove_qs_args_if_not_in_url(
$redirect['query'],
array( 'p', 'page_id', 'attachment_id', 'pagename', 'name', 'post_type', 'feed' ),
$redirect_url
);
$redirect['path'] = parse_url( $redirect_url, PHP_URL_PATH );
}
}
if ( is_singular() && $wp_query->post_count < 1 && $post_id ) {
$vars = $wpdb->get_results( $wpdb->prepare( "SELECT post_type, post_parent FROM $wpdb->posts WHERE ID = %d", $post_id ) );
if ( ! empty( $vars[0] ) ) {
$vars = $vars[0];
if ( 'revision' === $vars->post_type && $vars->post_parent > 0 ) {
$post_id = $vars->post_parent;
}
$redirect_url = get_permalink( $post_id );
$redirect_obj = get_post( $post_id );
if ( $redirect_url ) {
$redirect['query'] = _remove_qs_args_if_not_in_url(
$redirect['query'],
array( 'p', 'page_id', 'attachment_id', 'pagename', 'name', 'post_type' ),
$redirect_url
);
}
}
}
// These tests give us a WP-generated permalink.
if ( is_404() ) {
// Redirect ?page_id, ?p=, ?attachment_id= to their respective URLs.
$post_id = max( get_query_var( 'p' ), get_query_var( 'page_id' ), get_query_var( 'attachment_id' ) );
$redirect_post = $post_id ? get_post( $post_id ) : false;
if ( $redirect_post ) {
$post_type_obj = get_post_type_object( $redirect_post->post_type );
if ( $post_type_obj && $post_type_obj->public && 'auto-draft' !== $redirect_post->post_status ) {
$redirect_url = get_permalink( $redirect_post );
$redirect_obj = get_post( $redirect_post );
$redirect['query'] = _remove_qs_args_if_not_in_url(
$redirect['query'],
array( 'p', 'page_id', 'attachment_id', 'pagename', 'name', 'post_type' ),
$redirect_url
);
}
}
$year = get_query_var( 'year' );
$month = get_query_var( 'monthnum' );
$day = get_query_var( 'day' );
if ( $year && $month && $day ) {
$date = sprintf( '%04d-%02d-%02d', $year, $month, $day );
if ( ! wp_checkdate( $month, $day, $year, $date ) ) {
$redirect_url = get_month_link( $year, $month );
$redirect['query'] = _remove_qs_args_if_not_in_url(
$redirect['query'],
array( 'year', 'monthnum', 'day' ),
$redirect_url
);
}
} elseif ( $year && $month && $month > 12 ) {
$redirect_url = get_year_link( $year );
$redirect['query'] = _remove_qs_args_if_not_in_url(
$redirect['query'],
array( 'year', 'monthnum' ),
$redirect_url
);
}
// Strip off non-existing <!--nextpage--> links from single posts or pages.
if ( get_query_var( 'page' ) ) {
$post_id = 0;
if ( $wp_query->queried_object instanceof WP_Post ) {
$post_id = $wp_query->queried_object->ID;
} elseif ( $wp_query->post ) {
$post_id = $wp_query->post->ID;
}
if ( $post_id ) {
$redirect_url = get_permalink( $post_id );
$redirect_obj = get_post( $post_id );
$redirect['path'] = rtrim( $redirect['path'], (int) get_query_var( 'page' ) . '/' );
$redirect['query'] = remove_query_arg( 'page', $redirect['query'] );
}
}
if ( ! $redirect_url ) {
$redirect_url = redirect_guess_404_permalink();
if ( $redirect_url ) {
$redirect['query'] = _remove_qs_args_if_not_in_url(
$redirect['query'],
array( 'page', 'feed', 'p', 'page_id', 'attachment_id', 'pagename', 'name', 'post_type' ),
$redirect_url
);
}
}
} elseif ( is_object( $wp_rewrite ) && $wp_rewrite->using_permalinks() ) {
// Rewriting of old ?p=X, ?m=2004, ?m=200401, ?m=20040101.
if ( is_attachment()
&& ! array_diff( array_keys( $wp->query_vars ), array( 'attachment', 'attachment_id' ) )
&& ! $redirect_url
) {
if ( ! empty( $_GET['attachment_id'] ) ) {
$redirect_url = get_attachment_link( get_query_var( 'attachment_id' ) );
$redirect_obj = get_post( get_query_var( 'attachment_id' ) );
if ( $redirect_url ) {
$redirect['query'] = remove_query_arg( 'attachment_id', $redirect['query'] );
}
} else {
$redirect_url = get_attachment_link();
$redirect_obj = get_post();
}
} elseif ( is_single() && ! empty( $_GET['p'] ) && ! $redirect_url ) {
$redirect_url = get_permalink( get_query_var( 'p' ) );
$redirect_obj = get_post( get_query_var( 'p' ) );
if ( $redirect_url ) {
$redirect['query'] = remove_query_arg( array( 'p', 'post_type' ), $redirect['query'] );
}
} elseif ( is_single() && ! empty( $_GET['name'] ) && ! $redirect_url ) {
$redirect_url = get_permalink( $wp_query->get_queried_object_id() );
$redirect_obj = get_post( $wp_query->get_queried_object_id() );
if ( $redirect_url ) {
$redirect['query'] = remove_query_arg( 'name', $redirect['query'] );
}
} elseif ( is_page() && ! empty( $_GET['page_id'] ) && ! $redirect_url ) {
$redirect_url = get_permalink( get_query_var( 'page_id' ) );
$redirect_obj = get_post( get_query_var( 'page_id' ) );
if ( $redirect_url ) {
$redirect['query'] = remove_query_arg( 'page_id', $redirect['query'] );
}
} elseif ( is_page() && ! is_feed() && ! $redirect_url
&& 'page' === get_option( 'show_on_front' ) && get_queried_object_id() === (int) get_option( 'page_on_front' )
) {
$redirect_url = home_url( '/' );
} elseif ( is_home() && ! empty( $_GET['page_id'] ) && ! $redirect_url
&& 'page' === get_option( 'show_on_front' ) && get_query_var( 'page_id' ) === (int) get_option( 'page_for_posts' )
) {
$redirect_url = get_permalink( get_option( 'page_for_posts' ) );
$redirect_obj = get_post( get_option( 'page_for_posts' ) );
if ( $redirect_url ) {
$redirect['query'] = remove_query_arg( 'page_id', $redirect['query'] );
}
} elseif ( ! empty( $_GET['m'] ) && ( is_year() || is_month() || is_day() ) ) {
$m = get_query_var( 'm' );
switch ( strlen( $m ) ) {
case 4: // Yearly.
$redirect_url = get_year_link( $m );
break;
case 6: // Monthly.
$redirect_url = get_month_link( substr( $m, 0, 4 ), substr( $m, 4, 2 ) );
break;
case 8: // Daily.
$redirect_url = get_day_link( substr( $m, 0, 4 ), substr( $m, 4, 2 ), substr( $m, 6, 2 ) );
break;
}
if ( $redirect_url ) {
$redirect['query'] = remove_query_arg( 'm', $redirect['query'] );
}
// Now moving on to non ?m=X year/month/day links.
} elseif ( is_date() ) {
$year = get_query_var( 'year' );
$month = get_query_var( 'monthnum' );
$day = get_query_var( 'day' );
if ( is_day() && $year && $month && ! empty( $_GET['day'] ) ) {
$redirect_url = get_day_link( $year, $month, $day );
if ( $redirect_url ) {
$redirect['query'] = remove_query_arg( array( 'year', 'monthnum', 'day' ), $redirect['query'] );
}
} elseif ( is_month() && $year && ! empty( $_GET['monthnum'] ) ) {
$redirect_url = get_month_link( $year, $month );
if ( $redirect_url ) {
$redirect['query'] = remove_query_arg( array( 'year', 'monthnum' ), $redirect['query'] );
}
} elseif ( is_year() && ! empty( $_GET['year'] ) ) {
$redirect_url = get_year_link( $year );
if ( $redirect_url ) {
$redirect['query'] = remove_query_arg( 'year', $redirect['query'] );
}
}
} elseif ( is_author() && ! empty( $_GET['author'] ) && preg_match( '|^[0-9]+$|', $_GET['author'] ) ) {
$author = get_userdata( get_query_var( 'author' ) );
if ( false !== $author
&& $wpdb->get_var( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE $wpdb->posts.post_author = %d AND $wpdb->posts.post_status = 'publish' LIMIT 1", $author->ID ) )
) {
$redirect_url = get_author_posts_url( $author->ID, $author->user_nicename );
$redirect_obj = $author;
if ( $redirect_url ) {
$redirect['query'] = remove_query_arg( 'author', $redirect['query'] );
}
}
} elseif ( is_category() || is_tag() || is_tax() ) { // Terms (tags/categories).
$term_count = 0;
foreach ( $wp_query->tax_query->queried_terms as $tax_query ) {
$term_count += count( $tax_query['terms'] );
}
$obj = $wp_query->get_queried_object();
if ( $term_count <= 1 && ! empty( $obj->term_id ) ) {
$tax_url = get_term_link( (int) $obj->term_id, $obj->taxonomy );
if ( $tax_url && ! is_wp_error( $tax_url ) ) {
if ( ! empty( $redirect['query'] ) ) {
// Strip taxonomy query vars off the URL.
$qv_remove = array( 'term', 'taxonomy' );
if ( is_category() ) {
$qv_remove[] = 'category_name';
$qv_remove[] = 'cat';
} elseif ( is_tag() ) {
$qv_remove[] = 'tag';
$qv_remove[] = 'tag_id';
} else {
// Custom taxonomies will have a custom query var, remove those too.
$tax_obj = get_taxonomy( $obj->taxonomy );
if ( false !== $tax_obj->query_var ) {
$qv_remove[] = $tax_obj->query_var;
}
}
$rewrite_vars = array_diff( array_keys( $wp_query->query ), array_keys( $_GET ) );
// Check to see if all the query vars are coming from the rewrite, none are set via $_GET.
if ( ! array_diff( $rewrite_vars, array_keys( $_GET ) ) ) {
// Remove all of the per-tax query vars.
$redirect['query'] = remove_query_arg( $qv_remove, $redirect['query'] );
// Create the destination URL for this taxonomy.
$tax_url = parse_url( $tax_url );
if ( ! empty( $tax_url['query'] ) ) {
// Taxonomy accessible via ?taxonomy=...&term=... or any custom query var.
parse_str( $tax_url['query'], $query_vars );
$redirect['query'] = add_query_arg( $query_vars, $redirect['query'] );
} else {
// Taxonomy is accessible via a "pretty URL".
$redirect['path'] = $tax_url['path'];
}
} else {
// Some query vars are set via $_GET. Unset those from $_GET that exist via the rewrite.
foreach ( $qv_remove as $_qv ) {
if ( isset( $rewrite_vars[ $_qv ] ) ) {
$redirect['query'] = remove_query_arg( $_qv, $redirect['query'] );
}
}
}
}
}
}
} elseif ( is_single() && strpos( $wp_rewrite->permalink_structure, '%category%' ) !== false ) {
$category_name = get_query_var( 'category_name' );
if ( $category_name ) {
$category = get_category_by_path( $category_name );
if ( ! $category || is_wp_error( $category )
|| ! has_term( $category->term_id, 'category', $wp_query->get_queried_object_id() )
) {
$redirect_url = get_permalink( $wp_query->get_queried_object_id() );
$redirect_obj = get_post( $wp_query->get_queried_object_id() );
}
}
}
// Post paging.
if ( is_singular() && get_query_var( 'page' ) ) {
$page = get_query_var( 'page' );
if ( ! $redirect_url ) {
$redirect_url = get_permalink( get_queried_object_id() );
$redirect_obj = get_post( get_queried_object_id() );
}
if ( $page > 1 ) {
$redirect_url = trailingslashit( $redirect_url );
if ( is_front_page() ) {
$redirect_url .= user_trailingslashit( "$wp_rewrite->pagination_base/$page", 'paged' );
} else {
$redirect_url .= user_trailingslashit( $page, 'single_paged' );
}
}
$redirect['query'] = remove_query_arg( 'page', $redirect['query'] );
}
if ( get_query_var( 'sitemap' ) ) {
$redirect_url = get_sitemap_url( get_query_var( 'sitemap' ), get_query_var( 'sitemap-subtype' ), get_query_var( 'paged' ) );
$redirect['query'] = remove_query_arg( array( 'sitemap', 'sitemap-subtype', 'paged' ), $redirect['query'] );
} elseif ( get_query_var( 'paged' ) || is_feed() || get_query_var( 'cpage' ) ) {
// Paging and feeds.
$paged = get_query_var( 'paged' );
$feed = get_query_var( 'feed' );
$cpage = get_query_var( 'cpage' );
while ( preg_match( "#/$wp_rewrite->pagination_base/?[0-9]+?(/+)?$#", $redirect['path'] )
|| preg_match( '#/(comments/?)?(feed|rss2?|rdf|atom)(/+)?$#', $redirect['path'] )
|| preg_match( "#/{$wp_rewrite->comments_pagination_base}-[0-9]+(/+)?$#", $redirect['path'] )
) {
// Strip off any existing paging.
$redirect['path'] = preg_replace( "#/$wp_rewrite->pagination_base/?[0-9]+?(/+)?$#", '/', $redirect['path'] );
// Strip off feed endings.
$redirect['path'] = preg_replace( '#/(comments/?)?(feed|rss2?|rdf|atom)(/+|$)#', '/', $redirect['path'] );
// Strip off any existing comment paging.
$redirect['path'] = preg_replace( "#/{$wp_rewrite->comments_pagination_base}-[0-9]+?(/+)?$#", '/', $redirect['path'] );
}
$addl_path = '';
$default_feed = get_default_feed();
if ( is_feed() && in_array( $feed, $wp_rewrite->feeds, true ) ) {
$addl_path = ! empty( $addl_path ) ? trailingslashit( $addl_path ) : '';
if ( ! is_singular() && get_query_var( 'withcomments' ) ) {
$addl_path .= 'comments/';
}
if ( ( 'rss' === $default_feed && 'feed' === $feed ) || 'rss' === $feed ) {
$format = ( 'rss2' === $default_feed ) ? '' : 'rss2';
} else {
$format = ( $default_feed === $feed || 'feed' === $feed ) ? '' : $feed;
}
$addl_path .= user_trailingslashit( 'feed/' . $format, 'feed' );
$redirect['query'] = remove_query_arg( 'feed', $redirect['query'] );
} elseif ( is_feed() && 'old' === $feed ) {
$old_feed_files = array(
'wp-atom.php' => 'atom',
'wp-commentsrss2.php' => 'comments_rss2',
'wp-feed.php' => $default_feed,
'wp-rdf.php' => 'rdf',
'wp-rss.php' => 'rss2',
'wp-rss2.php' => 'rss2',
);
if ( isset( $old_feed_files[ basename( $redirect['path'] ) ] ) ) {
$redirect_url = get_feed_link( $old_feed_files[ basename( $redirect['path'] ) ] );
wp_redirect( $redirect_url, 301 );
die();
}
}
if ( $paged > 0 ) {
$redirect['query'] = remove_query_arg( 'paged', $redirect['query'] );
if ( ! is_feed() ) {
if ( ! is_single() ) {
$addl_path = ! empty( $addl_path ) ? trailingslashit( $addl_path ) : '';
if ( $paged > 1 ) {
$addl_path .= user_trailingslashit( "$wp_rewrite->pagination_base/$paged", 'paged' );
}
}
} elseif ( $paged > 1 ) {
$redirect['query'] = add_query_arg( 'paged', $paged, $redirect['query'] );
}
}
$default_comments_page = get_option( 'default_comments_page' );
if ( get_option( 'page_comments' )
&& ( 'newest' === $default_comments_page && $cpage > 0
|| 'newest' !== $default_comments_page && $cpage > 1 )
) {
$addl_path = ( ! empty( $addl_path ) ? trailingslashit( $addl_path ) : '' );
$addl_path .= user_trailingslashit( $wp_rewrite->comments_pagination_base . '-' . $cpage, 'commentpaged' );
$redirect['query'] = remove_query_arg( 'cpage', $redirect['query'] );
}
// Strip off trailing /index.php/.
$redirect['path'] = preg_replace( '|/' . preg_quote( $wp_rewrite->index, '|' ) . '/?$|', '/', $redirect['path'] );
$redirect['path'] = user_trailingslashit( $redirect['path'] );
if ( ! empty( $addl_path )
&& $wp_rewrite->using_index_permalinks()
&& strpos( $redirect['path'], '/' . $wp_rewrite->index . '/' ) === false
) {
$redirect['path'] = trailingslashit( $redirect['path'] ) . $wp_rewrite->index . '/';
}
if ( ! empty( $addl_path ) ) {
$redirect['path'] = trailingslashit( $redirect['path'] ) . $addl_path;
}
$redirect_url = $redirect['scheme'] . '://' . $redirect['host'] . $redirect['path'];
}
if ( 'wp-register.php' === basename( $redirect['path'] ) ) {
if ( is_multisite() ) {
/** This filter is documented in wp-login.php */
$redirect_url = apply_filters( 'wp_signup_location', network_site_url( 'wp-signup.php' ) );
} else {
$redirect_url = wp_registration_url();
}
wp_redirect( $redirect_url, 301 );
die();
}
}
$redirect['query'] = preg_replace( '#^\??&*?#', '', $redirect['query'] );
// Tack on any additional query vars.
if ( $redirect_url && ! empty( $redirect['query'] ) ) {
parse_str( $redirect['query'], $_parsed_query );
$redirect = parse_url( $redirect_url );
if ( ! empty( $_parsed_query['name'] ) && ! empty( $redirect['query'] ) ) {
parse_str( $redirect['query'], $_parsed_redirect_query );
if ( empty( $_parsed_redirect_query['name'] ) ) {
unset( $_parsed_query['name'] );
}
}
$_parsed_query = array_combine(
rawurlencode_deep( array_keys( $_parsed_query ) ),
rawurlencode_deep( array_values( $_parsed_query ) )
);
$redirect_url = add_query_arg( $_parsed_query, $redirect_url );
}
if ( $redirect_url ) {
$redirect = parse_url( $redirect_url );
}
// www.example.com vs. example.com
$user_home = parse_url( home_url() );
if ( ! empty( $user_home['host'] ) ) {
$redirect['host'] = $user_home['host'];
}
if ( empty( $user_home['path'] ) ) {
$user_home['path'] = '/';
}
// Handle ports.
if ( ! empty( $user_home['port'] ) ) {
$redirect['port'] = $user_home['port'];
} else {
unset( $redirect['port'] );
}
// Trailing /index.php.
$redirect['path'] = preg_replace( '|/' . preg_quote( $wp_rewrite->index, '|' ) . '/*?$|', '/', $redirect['path'] );
$punctuation_pattern = implode(
'|',
array_map(
'preg_quote',
array(
' ',
'%20', // Space.
'!',
'%21', // Exclamation mark.
'"',
'%22', // Double quote.
"'",
'%27', // Single quote.
'(',
'%28', // Opening bracket.
')',
'%29', // Closing bracket.
',',
'%2C', // Comma.
'.',
'%2E', // Period.
';',
'%3B', // Semicolon.
'{',
'%7B', // Opening curly bracket.
'}',
'%7D', // Closing curly bracket.
'%E2%80%9C', // Opening curly quote.
'%E2%80%9D', // Closing curly quote.
)
)
);
// Remove trailing spaces and end punctuation from the path.
$redirect['path'] = preg_replace( "#($punctuation_pattern)+$#", '', $redirect['path'] );
if ( ! empty( $redirect['query'] ) ) {
// Remove trailing spaces and end punctuation from certain terminating query string args.
$redirect['query'] = preg_replace( "#((^|&)(p|page_id|cat|tag)=[^&]*?)($punctuation_pattern)+$#", '$1', $redirect['query'] );
// Clean up empty query strings.
$redirect['query'] = trim( preg_replace( '#(^|&)(p|page_id|cat|tag)=?(&|$)#', '&', $redirect['query'] ), '&' );
// Redirect obsolete feeds.
$redirect['query'] = preg_replace( '#(^|&)feed=rss(&|$)#', '$1feed=rss2$2', $redirect['query'] );
// Remove redundant leading ampersands.
$redirect['query'] = preg_replace( '#^\??&*?#', '', $redirect['query'] );
}
// Strip /index.php/ when we're not using PATHINFO permalinks.
if ( ! $wp_rewrite->using_index_permalinks() ) {
$redirect['path'] = str_replace( '/' . $wp_rewrite->index . '/', '/', $redirect['path'] );
}
// Trailing slashes.
if ( is_object( $wp_rewrite ) && $wp_rewrite->using_permalinks()
&& ! is_404() && ( ! is_front_page() || is_front_page() && get_query_var( 'paged' ) > 1 )
) {
$user_ts_type = '';
if ( get_query_var( 'paged' ) > 0 ) {
$user_ts_type = 'paged';
} else {
foreach ( array( 'single', 'category', 'page', 'day', 'month', 'year', 'home' ) as $type ) {
$func = 'is_' . $type;
if ( call_user_func( $func ) ) {
$user_ts_type = $type;
break;
}
}
}
$redirect['path'] = user_trailingslashit( $redirect['path'], $user_ts_type );
} elseif ( is_front_page() ) {
$redirect['path'] = trailingslashit( $redirect['path'] );
}
// Remove trailing slash for robots.txt or sitemap requests.
if ( is_robots()
|| ! empty( get_query_var( 'sitemap' ) ) || ! empty( get_query_var( 'sitemap-stylesheet' ) )
) {
$redirect['path'] = untrailingslashit( $redirect['path'] );
}
// Strip multiple slashes out of the URL.
if ( strpos( $redirect['path'], '//' ) > -1 ) {
$redirect['path'] = preg_replace( '|/+|', '/', $redirect['path'] );
}
// Always trailing slash the Front Page URL.
if ( trailingslashit( $redirect['path'] ) === trailingslashit( $user_home['path'] ) ) {
$redirect['path'] = trailingslashit( $redirect['path'] );
}
$original_host_low = strtolower( $original['host'] );
$redirect_host_low = strtolower( $redirect['host'] );
// Ignore differences in host capitalization, as this can lead to infinite redirects.
// Only redirect no-www <=> yes-www.
if ( $original_host_low === $redirect_host_low
|| ( 'www.' . $original_host_low !== $redirect_host_low
&& 'www.' . $redirect_host_low !== $original_host_low )
) {
$redirect['host'] = $original['host'];
}
$compare_original = array( $original['host'], $original['path'] );
if ( ! empty( $original['port'] ) ) {
$compare_original[] = $original['port'];
}
if ( ! empty( $original['query'] ) ) {
$compare_original[] = $original['query'];
}
$compare_redirect = array( $redirect['host'], $redirect['path'] );
if ( ! empty( $redirect['port'] ) ) {
$compare_redirect[] = $redirect['port'];
}
if ( ! empty( $redirect['query'] ) ) {
$compare_redirect[] = $redirect['query'];
}
if ( $compare_original !== $compare_redirect ) {
$redirect_url = $redirect['scheme'] . '://' . $redirect['host'];
if ( ! empty( $redirect['port'] ) ) {
$redirect_url .= ':' . $redirect['port'];
}
$redirect_url .= $redirect['path'];
if ( ! empty( $redirect['query'] ) ) {
$redirect_url .= '?' . $redirect['query'];
}
}
if ( ! $redirect_url || $redirect_url === $requested_url ) {
return;
}
// Hex encoded octets are case-insensitive.
if ( false !== strpos( $requested_url, '%' ) ) {
if ( ! function_exists( 'lowercase_octets' ) ) {
/**
* Converts the first hex-encoded octet match to lowercase.
*
* @since 3.1.0
* @ignore
*
* @param array $matches Hex-encoded octet matches for the requested URL.
* @return string Lowercased version of the first match.
*/
function lowercase_octets( $matches ) {
return strtolower( $matches[0] );
}
}
$requested_url = preg_replace_callback( '|%[a-fA-F0-9][a-fA-F0-9]|', 'lowercase_octets', $requested_url );
}
if ( $redirect_obj instanceof WP_Post ) {
$post_status_obj = get_post_status_object( get_post_status( $redirect_obj ) );
/*
* Unset the redirect object and URL if they are not readable by the user.
* This condition is a little confusing as the condition needs to pass if
* the post is not readable by the user. That's why there are ! (not) conditions
* throughout.
*/
if (
// Private post statuses only redirect if the user can read them.
! (
$post_status_obj->private &&
current_user_can( 'read_post', $redirect_obj->ID )
) &&
// For other posts, only redirect if publicly viewable.
! is_post_publicly_viewable( $redirect_obj )
) {
$redirect_obj = false;
$redirect_url = false;
}
}
/**
* Filters the canonical redirect URL.
*
* Returning false to this filter will cancel the redirect.
*
* @since 2.3.0
*
* @param string $redirect_url The redirect URL.
* @param string $requested_url The requested URL.
*/
$redirect_url = apply_filters( 'redirect_canonical', $redirect_url, $requested_url );
// Yes, again -- in case the filter aborted the request.
if ( ! $redirect_url || strip_fragment_from_url( $redirect_url ) === strip_fragment_from_url( $requested_url ) ) {
return;
}
if ( $do_redirect ) {
// Protect against chained redirects.
if ( ! redirect_canonical( $redirect_url, false ) ) {
wp_redirect( $redirect_url, 301 );
exit;
} else {
// Debug.
// die("1: $redirect_url<br />2: " . redirect_canonical( $redirect_url, false ) );
return;
}
} else {
return $redirect_url;
}
}
```
[apply\_filters( 'redirect\_canonical', string $redirect\_url, string $requested\_url )](../hooks/redirect_canonical)
Filters the canonical redirect URL.
[apply\_filters( 'wp\_signup\_location', string $sign\_up\_url )](../hooks/wp_signup_location)
Filters the Multisite sign up URL.
| Uses | Description |
| --- | --- |
| [is\_post\_publicly\_viewable()](is_post_publicly_viewable) wp-includes/post.php | Determines whether a post is publicly viewable. |
| [get\_month\_link()](get_month_link) wp-includes/link-template.php | Retrieves the permalink for the month archives with year. |
| [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. |
| [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\_queried\_object\_id()](get_queried_object_id) wp-includes/query.php | Retrieves the ID of the currently queried object. |
| [get\_sitemap\_url()](get_sitemap_url) wp-includes/sitemaps.php | Retrieves the full URL for a sitemap. |
| [wp\_checkdate()](wp_checkdate) wp-includes/functions.php | Tests if the supplied date is valid for the Gregorian calendar. |
| [is\_ssl()](is_ssl) wp-includes/load.php | Determines if SSL is used. |
| [iis7\_supports\_permalinks()](iis7_supports_permalinks) wp-includes/functions.php | Checks if IIS 7+ supports pretty permalinks. |
| [remove\_query\_arg()](remove_query_arg) wp-includes/functions.php | Removes an item or items from a query string. |
| [get\_term\_link()](get_term_link) wp-includes/taxonomy.php | Generates a permalink for a taxonomy term archive. |
| [network\_site\_url()](network_site_url) wp-includes/link-template.php | Retrieves the site URL for the current network. |
| [get\_post\_comments\_feed\_link()](get_post_comments_feed_link) wp-includes/link-template.php | Retrieves the permalink for the post comments feed. |
| [get\_day\_link()](get_day_link) wp-includes/link-template.php | Retrieves the permalink for the day archives with year and month. |
| [is\_category()](is_category) wp-includes/query.php | Determines whether the query is for an existing category archive page. |
| [get\_feed\_link()](get_feed_link) wp-includes/link-template.php | Retrieves the permalink for the feed type. |
| [get\_year\_link()](get_year_link) wp-includes/link-template.php | Retrieves the permalink for the year archives. |
| [get\_attachment\_link()](get_attachment_link) wp-includes/link-template.php | Retrieves the permalink for an attachment. |
| [user\_trailingslashit()](user_trailingslashit) wp-includes/link-template.php | Retrieves a trailing-slashed string if the site is set for adding trailing slashes. |
| [get\_default\_feed()](get_default_feed) wp-includes/feed.php | Retrieves the default feed. |
| [get\_post\_status()](get_post_status) wp-includes/post.php | Retrieves the post status based on the post ID. |
| [get\_post\_status\_object()](get_post_status_object) wp-includes/post.php | Retrieves a post status object by name. |
| [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. |
| [\_remove\_qs\_args\_if\_not\_in\_url()](_remove_qs_args_if_not_in_url) wp-includes/canonical.php | Removes arguments from a query string if they are not present in a URL DO NOT use this in plugin code. |
| [redirect\_guess\_404\_permalink()](redirect_guess_404_permalink) wp-includes/canonical.php | Attempts to guess the correct URL for a 404 request based on query vars. |
| [WP\_Rewrite::using\_permalinks()](../classes/wp_rewrite/using_permalinks) wp-includes/class-wp-rewrite.php | Determines whether permalinks are being used. |
| [redirect\_canonical()](redirect_canonical) wp-includes/canonical.php | Redirects incoming links to the proper URL based on the site url. |
| [get\_author\_posts\_url()](get_author_posts_url) wp-includes/author-template.php | Retrieves the URL to the author page for the user with the ID provided. |
| [is\_tag()](is_tag) wp-includes/query.php | Determines whether the query is for an existing tag archive page. |
| [get\_category\_by\_path()](get_category_by_path) wp-includes/category.php | Retrieves a category based on URL containing the category slug. |
| [is\_author()](is_author) wp-includes/query.php | Determines whether the query is for an existing author archive page. |
| [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\_favicon()](is_favicon) wp-includes/query.php | Is the query for the favicon.ico file? |
| [strip\_fragment\_from\_url()](strip_fragment_from_url) wp-includes/canonical.php | Strips the #fragment from a URL, if one is present. |
| [has\_term()](has_term) wp-includes/category-template.php | Checks if the current post has any of given terms. |
| [rawurlencode\_deep()](rawurlencode_deep) wp-includes/formatting.php | Navigates through an array, object, or scalar, and raw-encodes the values to be used in a URL. |
| [untrailingslashit()](untrailingslashit) wp-includes/formatting.php | Removes trailing forward slashes and backslashes if they exist. |
| [wp\_verify\_nonce()](wp_verify_nonce) wp-includes/pluggable.php | Verifies that a correct security nonce was used with time limit. |
| [wp\_redirect()](wp_redirect) wp-includes/pluggable.php | Redirects to another page. |
| [wp\_registration\_url()](wp_registration_url) wp-includes/general-template.php | Returns the URL that allows the user to register on the site. |
| [WP\_Query::get\_queried\_object\_id()](../classes/wp_query/get_queried_object_id) wp-includes/class-wp-query.php | Retrieves the ID of the currently queried object. |
| [is\_date()](is_date) wp-includes/query.php | Determines whether the query is for an existing date archive. |
| [is\_preview()](is_preview) wp-includes/query.php | Determines whether the query is for a post or page preview. |
| [is\_search()](is_search) wp-includes/query.php | Determines whether the query is for a search. |
| [is\_trackback()](is_trackback) wp-includes/query.php | Determines whether the query is for a trackback endpoint call. |
| [WP\_Query::get\_queried\_object()](../classes/wp_query/get_queried_object) wp-includes/class-wp-query.php | Retrieves the currently queried object. |
| [is\_attachment()](is_attachment) wp-includes/query.php | Determines whether the query is for an existing attachment page. |
| [is\_404()](is_404) wp-includes/query.php | Determines whether the query has resulted in a 404 (returns no results). |
| [is\_single()](is_single) wp-includes/query.php | Determines whether the query is for an existing single post. |
| [is\_year()](is_year) wp-includes/query.php | Determines whether the query is for an existing year archive. |
| [is\_robots()](is_robots) wp-includes/query.php | Is the query for the robots.txt file? |
| [is\_feed()](is_feed) wp-includes/query.php | Determines whether the query is for a feed. |
| [is\_home()](is_home) wp-includes/query.php | Determines whether the query is for the blog homepage. |
| [is\_day()](is_day) wp-includes/query.php | Determines whether the query is for an existing day archive. |
| [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. |
| [get\_taxonomy()](get_taxonomy) wp-includes/taxonomy.php | Retrieves the taxonomy object of $taxonomy. |
| [wpdb::prepare()](../classes/wpdb/prepare) wp-includes/class-wpdb.php | Prepares a SQL query for safe execution. |
| [wpdb::get\_var()](../classes/wpdb/get_var) wp-includes/class-wpdb.php | Retrieves one variable from the database. |
| [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). |
| [current\_user\_can()](current_user_can) wp-includes/capabilities.php | Returns whether the current user has the specified capability. |
| [trailingslashit()](trailingslashit) wp-includes/formatting.php | Appends a trailing slash. |
| [is\_admin()](is_admin) wp-includes/load.php | Determines whether the current request is for an administrative interface page. |
| [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. |
| [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. |
| [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. |
| [get\_userdata()](get_userdata) wp-includes/pluggable.php | Retrieves user info by user ID. |
| [get\_permalink()](get_permalink) wp-includes/link-template.php | Retrieves the full permalink for the current post or post ID. |
| [add\_query\_arg()](add_query_arg) wp-includes/functions.php | Retrieves a modified URL query string. |
| [is\_wp\_error()](is_wp_error) wp-includes/load.php | Checks whether the given variable is a WordPress Error. |
| 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 get_metadata( string $meta_type, int $object_id, string $meta_key = '', bool $single = false ): mixed get\_metadata( string $meta\_type, int $object\_id, string $meta\_key = '', bool $single = false ): mixed
=========================================================================================================
Retrieves the value of a metadata field for the specified object type and ID.
If the meta field exists, a single value is returned if `$single` is true, or an array of values if it’s false.
If the meta field does not exist, the result depends on [get\_metadata\_default()](get_metadata_default) .
By default, an empty string is returned if `$single` is true, or an empty array if it’s false.
* [get\_metadata\_raw()](get_metadata_raw)
* [get\_metadata\_default()](get_metadata_default)
`$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 Optional Metadata key. If not specified, retrieve all metadata for the specified object. Default: `''`
`$single` bool Optional If true, return only the first value of the specified `$meta_key`.
This parameter has no effect if `$meta_key` is not specified. Default: `false`
mixed An array of values if `$single` is false.
The value of the meta field if `$single` is true.
False for an invalid `$object_id` (non-numeric, zero, or negative value), or if `$meta_type` is not specified.
An empty string if a valid but non-existing object ID is passed.
File: `wp-includes/meta.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/meta.php/)
```
function get_metadata( $meta_type, $object_id, $meta_key = '', $single = false ) {
$value = get_metadata_raw( $meta_type, $object_id, $meta_key, $single );
if ( ! is_null( $value ) ) {
return $value;
}
return get_metadata_default( $meta_type, $object_id, $meta_key, $single );
}
```
| Uses | Description |
| --- | --- |
| [get\_metadata\_default()](get_metadata_default) wp-includes/meta.php | Retrieves default metadata value for the specified meta key and object. |
| [get\_metadata\_raw()](get_metadata_raw) wp-includes/meta.php | Retrieves raw metadata value for the specified object. |
| Used By | Description |
| --- | --- |
| [get\_site\_meta()](get_site_meta) wp-includes/ms-site.php | Retrieves metadata for 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. |
| [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::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\_Meta\_Fields::get\_value()](../classes/wp_rest_meta_fields/get_value) wp-includes/rest-api/fields/class-wp-rest-meta-fields.php | Retrieves the meta field value. |
| [get\_registered\_metadata()](get_registered_metadata) wp-includes/meta.php | Retrieves registered metadata for a specified object. |
| [get\_term\_meta()](get_term_meta) wp-includes/taxonomy.php | Retrieves metadata for a term. |
| [get\_user\_meta()](get_user_meta) wp-includes/user.php | Retrieves user meta field for a user. |
| [get\_post\_meta()](get_post_meta) wp-includes/post.php | Retrieves a post meta field for the given post ID. |
| [get\_comment\_meta()](get_comment_meta) wp-includes/comment.php | Retrieves comment meta field for a comment. |
| Version | Description |
| --- | --- |
| [2.9.0](https://developer.wordpress.org/reference/since/2.9.0/) | Introduced. |
wordpress build_query( array $data ): string build\_query( array $data ): string
===================================
Builds URL query based on an associative and, or indexed array.
This is a convenient function for easily building url queries. It sets the separator to ‘&’ and uses [\_http\_build\_query()](_http_build_query) function.
* [\_http\_build\_query()](_http_build_query) : Used to build the query
`$data` array Required URL-encode key/value pairs. string URL-encoded string.
File: `wp-includes/functions.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/functions.php/)
```
function build_query( $data ) {
return _http_build_query( $data, null, '&', '', false );
}
```
| Uses | Description |
| --- | --- |
| [\_http\_build\_query()](_http_build_query) wp-includes/functions.php | From php.net (modified by Mark Jaquith to behave like the native PHP5 function). |
| Used By | Description |
| --- | --- |
| [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 |
| [add\_query\_arg()](add_query_arg) wp-includes/functions.php | Retrieves a modified URL query string. |
| Version | Description |
| --- | --- |
| [2.3.0](https://developer.wordpress.org/reference/since/2.3.0/) | Introduced. |
wordpress wp_print_community_events_markup() wp\_print\_community\_events\_markup()
======================================
Prints the markup for the Community Events section of 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_print_community_events_markup() {
?>
<div class="community-events-errors notice notice-error inline hide-if-js">
<p class="hide-if-js">
<?php _e( 'This widget requires JavaScript.' ); ?>
</p>
<p class="community-events-error-occurred" aria-hidden="true">
<?php _e( 'An error occurred. Please try again.' ); ?>
</p>
<p class="community-events-could-not-locate" aria-hidden="true"></p>
</div>
<div class="community-events-loading hide-if-no-js">
<?php _e( 'Loading…' ); ?>
</div>
<?php
/*
* Hide the main element when the page first loads, because the content
* won't be ready until wp.communityEvents.renderEventsTemplate() has run.
*/
?>
<div id="community-events" class="community-events" aria-hidden="true">
<div class="activity-block">
<p>
<span id="community-events-location-message"></span>
<button class="button-link community-events-toggle-location" aria-expanded="false">
<span class="dashicons dashicons-location" aria-hidden="true"></span>
<span class="community-events-location-edit"><?php _e( 'Select location' ); ?></span>
</button>
</p>
<form class="community-events-form" aria-hidden="true" action="<?php echo esc_url( admin_url( 'admin-ajax.php' ) ); ?>" method="post">
<label for="community-events-location">
<?php _e( 'City:' ); ?>
</label>
<?php
/* translators: Replace with a city related to your locale.
* Test that it matches the expected location and has upcoming
* events before including it. If no cities related to your
* locale have events, then use a city related to your locale
* that would be recognizable to most users. Use only the city
* name itself, without any region or country. Use the endonym
* (native locale name) instead of the English name if possible.
*/
?>
<input id="community-events-location" class="regular-text" type="text" name="community-events-location" placeholder="<?php esc_attr_e( 'Cincinnati' ); ?>" />
<?php submit_button( __( 'Submit' ), 'secondary', 'community-events-submit', false ); ?>
<button class="community-events-cancel button-link" type="button" aria-expanded="false">
<?php _e( 'Cancel' ); ?>
</button>
<span class="spinner"></span>
</form>
</div>
<ul class="community-events-results activity-block last"></ul>
</div>
<?php
}
```
| 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. |
| [\_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. |
| [admin\_url()](admin_url) wp-includes/link-template.php | Retrieves the URL to the admin area for the current site. |
| Used By | Description |
| --- | --- |
| [wp\_dashboard\_events\_news()](wp_dashboard_events_news) wp-admin/includes/dashboard.php | Renders the Events and News dashboard widget. |
| Version | Description |
| --- | --- |
| [4.8.0](https://developer.wordpress.org/reference/since/4.8.0/) | Introduced. |
wordpress wp_get_post_autosave( int $post_id, int $user_id ): WP_Post|false wp\_get\_post\_autosave( int $post\_id, int $user\_id ): WP\_Post|false
=======================================================================
Retrieves the autosaved data of the specified post.
Returns a post object with the information that was autosaved for the specified post.
If the optional $user\_id is passed, returns the autosave for that user, otherwise returns the latest autosave.
`$post_id` int Required The post ID. `$user_id` int Optional The post author ID. [WP\_Post](../classes/wp_post)|false The autosaved data or false on failure or when no autosave exists.
File: `wp-includes/revision.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/revision.php/)
```
function wp_get_post_autosave( $post_id, $user_id = 0 ) {
global $wpdb;
$autosave_name = $post_id . '-autosave-v1';
$user_id_query = ( 0 !== $user_id ) ? "AND post_author = $user_id" : null;
// Construct the autosave query.
$autosave_query = "
SELECT *
FROM $wpdb->posts
WHERE post_parent = %d
AND post_type = 'revision'
AND post_status = 'inherit'
AND post_name = %s " . $user_id_query . '
ORDER BY post_date DESC
LIMIT 1';
$autosave = $wpdb->get_results(
$wpdb->prepare(
$autosave_query,
$post_id,
$autosave_name
)
);
if ( ! $autosave ) {
return false;
}
return get_post( $autosave[0] );
}
```
| Uses | Description |
| --- | --- |
| [get\_post()](get_post) wp-includes/post.php | Retrieves post data given a post ID or post object. |
| [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\_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::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\_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::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::changeset\_data()](../classes/wp_customize_manager/changeset_data) wp-includes/class-wp-customize-manager.php | Gets changeset data. |
| [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\_create\_post\_autosave()](wp_create_post_autosave) wp-admin/includes/post.php | Creates autosave data for the specified post from `$_POST` data. |
| [\_set\_preview()](_set_preview) wp-includes/revision.php | Sets up the post object for preview based on the post autosave. |
| Version | Description |
| --- | --- |
| [2.6.0](https://developer.wordpress.org/reference/since/2.6.0/) | Introduced. |
wordpress get_media_states( WP_Post $post ): string[] get\_media\_states( WP\_Post $post ): string[]
==============================================
Retrieves an array of media states from an attachment.
`$post` [WP\_Post](../classes/wp_post) Required The attachment to retrieve states for. string[] Array of media state labels keyed by their state.
File: `wp-admin/includes/template.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/template.php/)
```
function get_media_states( $post ) {
static $header_images;
$media_states = array();
$stylesheet = get_option( 'stylesheet' );
if ( current_theme_supports( 'custom-header' ) ) {
$meta_header = get_post_meta( $post->ID, '_wp_attachment_is_custom_header', true );
if ( is_random_header_image() ) {
if ( ! isset( $header_images ) ) {
$header_images = wp_list_pluck( get_uploaded_header_images(), 'attachment_id' );
}
if ( $meta_header === $stylesheet && in_array( $post->ID, $header_images, true ) ) {
$media_states[] = __( 'Header Image' );
}
} else {
$header_image = get_header_image();
// Display "Header Image" if the image was ever used as a header image.
if ( ! empty( $meta_header ) && $meta_header === $stylesheet && wp_get_attachment_url( $post->ID ) !== $header_image ) {
$media_states[] = __( 'Header Image' );
}
// Display "Current Header Image" if the image is currently the header image.
if ( $header_image && wp_get_attachment_url( $post->ID ) === $header_image ) {
$media_states[] = __( 'Current Header Image' );
}
}
if ( get_theme_support( 'custom-header', 'video' ) && has_header_video() ) {
$mods = get_theme_mods();
if ( isset( $mods['header_video'] ) && $post->ID === $mods['header_video'] ) {
$media_states[] = __( 'Current Header Video' );
}
}
}
if ( current_theme_supports( 'custom-background' ) ) {
$meta_background = get_post_meta( $post->ID, '_wp_attachment_is_custom_background', true );
if ( ! empty( $meta_background ) && $meta_background === $stylesheet ) {
$media_states[] = __( 'Background Image' );
$background_image = get_background_image();
if ( $background_image && wp_get_attachment_url( $post->ID ) === $background_image ) {
$media_states[] = __( 'Current Background Image' );
}
}
}
if ( (int) get_option( 'site_icon' ) === $post->ID ) {
$media_states[] = __( 'Site Icon' );
}
if ( (int) get_theme_mod( 'custom_logo' ) === $post->ID ) {
$media_states[] = __( 'Logo' );
}
/**
* Filters the default media display states for items in the Media list table.
*
* @since 3.2.0
* @since 4.8.0 Added the `$post` parameter.
*
* @param string[] $media_states An array of media states. Default 'Header Image',
* 'Background Image', 'Site Icon', 'Logo'.
* @param WP_Post $post The current attachment object.
*/
return apply_filters( 'display_media_states', $media_states, $post );
}
```
[apply\_filters( 'display\_media\_states', string[] $media\_states, WP\_Post $post )](../hooks/display_media_states)
Filters the default media display states for items in the Media list table.
| Uses | Description |
| --- | --- |
| [has\_header\_video()](has_header_video) wp-includes/theme.php | Checks whether a header video is set or not. |
| [get\_theme\_support()](get_theme_support) wp-includes/theme.php | Gets the theme support arguments passed when registering that support. |
| [is\_random\_header\_image()](is_random_header_image) wp-includes/theme.php | Checks if random header image is in use. |
| [get\_uploaded\_header\_images()](get_uploaded_header_images) wp-includes/theme.php | Gets the header images uploaded for the active theme. |
| [get\_header\_image()](get_header_image) wp-includes/theme.php | Retrieves header image for custom header. |
| [get\_background\_image()](get_background_image) wp-includes/theme.php | Retrieves background image for custom background. |
| [get\_theme\_mods()](get_theme_mods) wp-includes/theme.php | Retrieves all theme modifications. |
| [get\_theme\_mod()](get_theme_mod) wp-includes/theme.php | Retrieves theme modification value for the active theme. |
| [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\_attachment\_url()](wp_get_attachment_url) wp-includes/post.php | Retrieves the URL for an attachment. |
| [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. |
| [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\_meta()](get_post_meta) wp-includes/post.php | Retrieves a post meta field for the given post ID. |
| Used By | Description |
| --- | --- |
| [\_media\_states()](_media_states) wp-admin/includes/template.php | Outputs the attachment media states as HTML. |
| [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.6.0](https://developer.wordpress.org/reference/since/5.6.0/) | Introduced. |
wordpress generate_block_asset_handle( string $block_name, string $field_name, int $index ): string generate\_block\_asset\_handle( string $block\_name, string $field\_name, int $index ): string
==============================================================================================
Generates the name for an asset based on the name of the block and the field name provided.
`$block_name` string Required Name of the block. `$field_name` string Required Name of the metadata field. `$index` int Optional Index of the asset when multiple items passed.
Default 0. string Generated asset name for the block's field.
File: `wp-includes/blocks.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/blocks.php/)
```
function generate_block_asset_handle( $block_name, $field_name, $index = 0 ) {
if ( 0 === strpos( $block_name, 'core/' ) ) {
$asset_handle = str_replace( 'core/', 'wp-block-', $block_name );
if ( 0 === strpos( $field_name, 'editor' ) ) {
$asset_handle .= '-editor';
}
if ( 0 === strpos( $field_name, 'view' ) ) {
$asset_handle .= '-view';
}
if ( $index > 0 ) {
$asset_handle .= '-' . ( $index + 1 );
}
return $asset_handle;
}
$field_mappings = array(
'editorScript' => 'editor-script',
'script' => 'script',
'viewScript' => 'view-script',
'editorStyle' => 'editor-style',
'style' => 'style',
);
$asset_handle = str_replace( '/', '-', $block_name ) .
'-' . $field_mappings[ $field_name ];
if ( $index > 0 ) {
$asset_handle .= '-' . ( $index + 1 );
}
return $asset_handle;
}
```
| 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. |
| [enqueue\_block\_styles\_assets()](enqueue_block_styles_assets) wp-includes/script-loader.php | Function responsible for enqueuing the styles required for block styles functionality on the editor and on the frontend. |
| Version | Description |
| --- | --- |
| [6.1.0](https://developer.wordpress.org/reference/since/6.1.0/) | Added `$index` parameter. |
| [5.5.0](https://developer.wordpress.org/reference/since/5.5.0/) | Introduced. |
| programming_docs |
wordpress wp_attachment_is_image( int|WP_Post $post = null ): bool wp\_attachment\_is\_image( int|WP\_Post $post = null ): bool
============================================================
Determines whether an attachment is an image.
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 Attachment ID or object. Default is global $post. Default: `null`
bool Whether the attachment is an image.
File: `wp-includes/post.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/post.php/)
```
function wp_attachment_is_image( $post = null ) {
return wp_attachment_is( 'image', $post );
}
```
| Uses | Description |
| --- | --- |
| [wp\_attachment\_is()](wp_attachment_is) wp-includes/post.php | Verifies an attachment is of a given type. |
| Used By | Description |
| --- | --- |
| [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. |
| [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\_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\_REST\_Attachments\_Controller::prepare\_item\_for\_response()](../classes/wp_rest_attachments_controller/prepare_item_for_response) wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php | Prepares a single attachment output for response. |
| [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. |
| [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. |
| [get\_attachment\_icon\_src()](get_attachment_icon_src) wp-includes/deprecated.php | Retrieve icon URL and Path. |
| [image\_downsize()](image_downsize) wp-includes/media.php | Scales an image to fit a particular size (such as ‘thumb’ or ‘medium’). |
| Version | Description |
| --- | --- |
| [4.2.0](https://developer.wordpress.org/reference/since/4.2.0/) | Modified into wrapper for [wp\_attachment\_is()](wp_attachment_is) and allowed [WP\_Post](../classes/wp_post) object to be passed. |
| [2.1.0](https://developer.wordpress.org/reference/since/2.1.0/) | Introduced. |
wordpress wp_delete_site( int $site_id ): WP_Site|WP_Error wp\_delete\_site( int $site\_id ): WP\_Site|WP\_Error
=====================================================
Deletes a site from the database.
`$site_id` int Required ID of the site that should be deleted. [WP\_Site](../classes/wp_site)|[WP\_Error](../classes/wp_error) The deleted site object 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_delete_site( $site_id ) {
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.' ) );
}
$errors = new WP_Error();
/**
* Fires before a site should be deleted from the database.
*
* Plugins should amend the `$errors` object via its `WP_Error::add()` method. If any errors
* are present, the site will not be deleted.
*
* @since 5.1.0
*
* @param WP_Error $errors Error object to add validation errors to.
* @param WP_Site $old_site The site object to be deleted.
*/
do_action( 'wp_validate_site_deletion', $errors, $old_site );
if ( ! empty( $errors->errors ) ) {
return $errors;
}
/**
* Fires before a site is deleted.
*
* @since MU (3.0.0)
* @deprecated 5.1.0
*
* @param int $site_id The site ID.
* @param bool $drop True if site's table should be dropped. Default false.
*/
do_action_deprecated( 'delete_blog', array( $old_site->id, true ), '5.1.0' );
/**
* Fires when a site's uninitialization routine should be executed.
*
* @since 5.1.0
*
* @param WP_Site $old_site Deleted site object.
*/
do_action( 'wp_uninitialize_site', $old_site );
if ( is_site_meta_supported() ) {
$blog_meta_ids = $wpdb->get_col( $wpdb->prepare( "SELECT meta_id FROM $wpdb->blogmeta WHERE blog_id = %d ", $old_site->id ) );
foreach ( $blog_meta_ids as $mid ) {
delete_metadata_by_mid( 'blog', $mid );
}
}
if ( false === $wpdb->delete( $wpdb->blogs, array( 'blog_id' => $old_site->id ) ) ) {
return new WP_Error( 'db_delete_error', __( 'Could not delete site from the database.' ), $wpdb->last_error );
}
clean_blog_cache( $old_site );
/**
* Fires once a site has been deleted from the database.
*
* @since 5.1.0
*
* @param WP_Site $old_site Deleted site object.
*/
do_action( 'wp_delete_site', $old_site );
/**
* Fires after the site is deleted from the network.
*
* @since 4.8.0
* @deprecated 5.1.0
*
* @param int $site_id The site ID.
* @param bool $drop True if site's tables should be dropped. Default false.
*/
do_action_deprecated( 'deleted_blog', array( $old_site->id, true ), '5.1.0' );
return $old_site;
}
```
[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.
[do\_action( 'wp\_delete\_site', WP\_Site $old\_site )](../hooks/wp_delete_site)
Fires once a site has been deleted from the database.
[do\_action( 'wp\_uninitialize\_site', WP\_Site $old\_site )](../hooks/wp_uninitialize_site)
Fires when a site’s uninitialization routine should be executed.
[do\_action( 'wp\_validate\_site\_deletion', WP\_Error $errors, WP\_Site $old\_site )](../hooks/wp_validate_site_deletion)
Fires before a site should be deleted from the database.
| Uses | Description |
| --- | --- |
| [is\_site\_meta\_supported()](is_site_meta_supported) wp-includes/functions.php | Determines whether site meta is enabled. |
| [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. |
| [clean\_blog\_cache()](clean_blog_cache) wp-includes/ms-site.php | Clean the blog cache |
| [wpdb::get\_col()](../classes/wpdb/get_col) wp-includes/class-wpdb.php | Retrieves one column from the database. |
| [wpdb::delete()](../classes/wpdb/delete) wp-includes/class-wpdb.php | Deletes a row in the table. |
| [delete\_metadata\_by\_mid()](delete_metadata_by_mid) wp-includes/meta.php | Deletes metadata by meta ID. |
| [\_\_()](__) 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. |
| [wpdb::prepare()](../classes/wpdb/prepare) wp-includes/class-wpdb.php | Prepares a SQL query for safe execution. |
| [WP\_Error::\_\_construct()](../classes/wp_error/__construct) wp-includes/class-wp-error.php | Initializes the error. |
| Used By | Description |
| --- | --- |
| [wpmu\_delete\_blog()](wpmu_delete_blog) wp-admin/includes/ms.php | Delete a site. |
| Version | Description |
| --- | --- |
| [5.1.0](https://developer.wordpress.org/reference/since/5.1.0/) | Introduced. |
wordpress wp_privacy_send_personal_data_export_email( int $request_id ): true|WP_Error wp\_privacy\_send\_personal\_data\_export\_email( int $request\_id ): true|WP\_Error
====================================================================================
Send an email to the user with a link to the personal data export file
`$request_id` int Required The request ID for this personal data export. true|[WP\_Error](../classes/wp_error) True on success or `WP_Error` on failure.
File: `wp-admin/includes/privacy-tools.php`. [View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/privacy-tools.php/)
```
function wp_privacy_send_personal_data_export_email( $request_id ) {
// Get the request.
$request = wp_get_user_request( $request_id );
if ( ! $request || 'export_personal_data' !== $request->action_name ) {
return new WP_Error( 'invalid_request', __( 'Invalid request ID when sending personal data export email.' ) );
}
// Localize message content for user; fallback to site default for visitors.
if ( ! empty( $request->user_id ) ) {
$locale = get_user_locale( $request->user_id );
} else {
$locale = get_locale();
}
$switched_locale = switch_to_locale( $locale );
/** This filter is documented in wp-includes/functions.php */
$expiration = apply_filters( 'wp_privacy_export_expiration', 3 * DAY_IN_SECONDS );
$expiration_date = date_i18n( get_option( 'date_format' ), time() + $expiration );
$exports_url = wp_privacy_exports_url();
$export_file_name = get_post_meta( $request_id, '_export_file_name', true );
$export_file_url = $exports_url . $export_file_name;
$site_name = wp_specialchars_decode( get_option( 'blogname' ), ENT_QUOTES );
$site_url = home_url();
/**
* Filters the recipient of the personal data export email notification.
* Should be used with great caution to avoid sending the data export link to wrong emails.
*
* @since 5.3.0
*
* @param string $request_email The email address of the notification recipient.
* @param WP_User_Request $request The request that is initiating the notification.
*/
$request_email = apply_filters( 'wp_privacy_personal_data_email_to', $request->email, $request );
$email_data = array(
'request' => $request,
'expiration' => $expiration,
'expiration_date' => $expiration_date,
'message_recipient' => $request_email,
'export_file_url' => $export_file_url,
'sitename' => $site_name,
'siteurl' => $site_url,
);
/* translators: Personal data export notification email subject. %s: Site title. */
$subject = sprintf( __( '[%s] Personal Data Export' ), $site_name );
/**
* Filters the subject of the email sent when an export request is completed.
*
* @since 5.3.0
*
* @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 int $expiration The time in seconds until the export file expires.
* @type string $expiration_date The localized date and time when the export file expires.
* @type string $message_recipient The address that the email will be sent to. Defaults
* to the value of `$request->email`, but can be changed
* by the `wp_privacy_personal_data_email_to` filter.
* @type string $export_file_url The export file URL.
* @type string $sitename The site name sending the mail.
* @type string $siteurl The site URL sending the mail.
* }
*/
$subject = apply_filters( 'wp_privacy_personal_data_email_subject', $subject, $site_name, $email_data );
/* translators: Do not translate EXPIRATION, LINK, SITENAME, SITEURL: those are placeholders. */
$email_text = __(
'Howdy,
Your request for an export of personal data has been completed. You may
download your personal data by clicking on the link below. For privacy
and security, we will automatically delete the file on ###EXPIRATION###,
so please download it before then.
###LINK###
Regards,
All at ###SITENAME###
###SITEURL###'
);
/**
* Filters the text of the email sent with a personal data export file.
*
* The following strings have a special meaning and will get replaced dynamically:
* ###EXPIRATION### The date when the URL will be automatically deleted.
* ###LINK### URL of the personal data export file for the user.
* ###SITENAME### The name of the site.
* ###SITEURL### The URL to the site.
*
* @since 4.9.6
* @since 5.3.0 Introduced the `$email_data` array.
*
* @param string $email_text Text in the email.
* @param int $request_id The request ID for this personal data export.
* @param array $email_data {
* Data relating to the account action email.
*
* @type WP_User_Request $request User request object.
* @type int $expiration The time in seconds until the export file expires.
* @type string $expiration_date The localized date and time when the export file expires.
* @type string $message_recipient The address that the email will be sent to. Defaults
* to the value of `$request->email`, but can be changed
* by the `wp_privacy_personal_data_email_to` filter.
* @type string $export_file_url The export file URL.
* @type string $sitename The site name sending the mail.
* @type string $siteurl The site URL sending the mail.
*/
$content = apply_filters( 'wp_privacy_personal_data_email_content', $email_text, $request_id, $email_data );
$content = str_replace( '###EXPIRATION###', $expiration_date, $content );
$content = str_replace( '###LINK###', sanitize_url( $export_file_url ), $content );
$content = str_replace( '###EMAIL###', $request_email, $content );
$content = str_replace( '###SITENAME###', $site_name, $content );
$content = str_replace( '###SITEURL###', sanitize_url( $site_url ), $content );
$headers = '';
/**
* Filters the headers of the email sent with a personal data export file.
*
* @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 int $expiration The time in seconds until the export file expires.
* @type string $expiration_date The localized date and time when the export file expires.
* @type string $message_recipient The address that the email will be sent to. Defaults
* to the value of `$request->email`, but can be changed
* by the `wp_privacy_personal_data_email_to` filter.
* @type string $export_file_url The export file URL.
* @type string $sitename The site name sending the mail.
* @type string $siteurl The site URL sending the mail.
* }
*/
$headers = apply_filters( 'wp_privacy_personal_data_email_headers', $headers, $subject, $content, $request_id, $email_data );
$mail_success = wp_mail( $request_email, $subject, $content, $headers );
if ( $switched_locale ) {
restore_previous_locale();
}
if ( ! $mail_success ) {
return new WP_Error( 'privacy_email_error', __( 'Unable to send personal data export email.' ) );
}
return true;
}
```
[apply\_filters( 'wp\_privacy\_export\_expiration', int $expiration )](../hooks/wp_privacy_export_expiration)
Filters the lifetime, in seconds, of a personal data export file.
[apply\_filters( 'wp\_privacy\_personal\_data\_email\_content', string $email\_text, int $request\_id, array $email\_data )](../hooks/wp_privacy_personal_data_email_content)
Filters the text of the email sent with a personal data export file.
[apply\_filters( 'wp\_privacy\_personal\_data\_email\_headers', string|array $headers, string $subject, string $content, int $request\_id, array $email\_data )](../hooks/wp_privacy_personal_data_email_headers)
Filters the headers of the email sent with a personal data export file.
[apply\_filters( 'wp\_privacy\_personal\_data\_email\_subject', string $subject, string $sitename, array $email\_data )](../hooks/wp_privacy_personal_data_email_subject)
Filters the subject of the email sent when an export request is completed.
[apply\_filters( 'wp\_privacy\_personal\_data\_email\_to', string $request\_email, WP\_User\_Request $request )](../hooks/wp_privacy_personal_data_email_to)
Filters the recipient of the personal data export email 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\_privacy\_exports\_url()](wp_privacy_exports_url) wp-includes/functions.php | Returns the URL of the directory used to store personal data export files. |
| [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\_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. |
| [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. |
| [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. |
| [\_\_()](__) 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\_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. |
| [WP\_Error::\_\_construct()](../classes/wp_error/__construct) wp-includes/class-wp-error.php | Initializes the error. |
| Used By | Description |
| --- | --- |
| [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. |
| Version | Description |
| --- | --- |
| [4.9.6](https://developer.wordpress.org/reference/since/4.9.6/) | Introduced. |
| programming_docs |
wordpress _get_term_children( int $term_id, array $terms, string $taxonomy, array $ancestors = array() ): array|WP_Error \_get\_term\_children( int $term\_id, array $terms, string $taxonomy, array $ancestors = array() ): array|WP\_Error
===================================================================================================================
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 subset of $terms that are descendants of $term\_id.
If `$terms` is an array of objects, then [\_get\_term\_children()](_get_term_children) returns an array of objects.
If `$terms` is an array of IDs, then [\_get\_term\_children()](_get_term_children) returns an array of IDs.
`$term_id` int Required The ancestor term: all returned terms should be descendants of `$term_id`. `$terms` array Required The set of terms - either an array of term objects or term IDs - from which those that are descendants of $term\_id will be chosen. `$taxonomy` string Required The taxonomy which determines the hierarchy of the terms. `$ancestors` array Optional Term ancestors that have already been identified. Passed by reference, to keep track of found terms when recursing the hierarchy. The array of located ancestors is used to prevent infinite recursion loops. For performance, `term_ids` are used as array keys, with 1 as value. Default: `array()`
array|[WP\_Error](../classes/wp_error) The subset of $terms that are descendants of $term\_id.
File: `wp-includes/taxonomy.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/taxonomy.php/)
```
function _get_term_children( $term_id, $terms, $taxonomy, &$ancestors = array() ) {
$empty_array = array();
if ( empty( $terms ) ) {
return $empty_array;
}
$term_id = (int) $term_id;
$term_list = array();
$has_children = _get_term_hierarchy( $taxonomy );
if ( $term_id && ! isset( $has_children[ $term_id ] ) ) {
return $empty_array;
}
// Include the term itself in the ancestors array, so we can properly detect when a loop has occurred.
if ( empty( $ancestors ) ) {
$ancestors[ $term_id ] = 1;
}
foreach ( (array) $terms as $term ) {
$use_id = false;
if ( ! is_object( $term ) ) {
$term = get_term( $term, $taxonomy );
if ( is_wp_error( $term ) ) {
return $term;
}
$use_id = true;
}
// Don't recurse if we've already identified the term as a child - this indicates a loop.
if ( isset( $ancestors[ $term->term_id ] ) ) {
continue;
}
if ( (int) $term->parent === $term_id ) {
if ( $use_id ) {
$term_list[] = $term->term_id;
} else {
$term_list[] = $term;
}
if ( ! isset( $has_children[ $term->term_id ] ) ) {
continue;
}
$ancestors[ $term->term_id ] = 1;
$children = _get_term_children( $term->term_id, $terms, $taxonomy, $ancestors );
if ( $children ) {
$term_list = array_merge( $term_list, $children );
}
}
}
return $term_list;
}
```
| Uses | Description |
| --- | --- |
| [\_get\_term\_hierarchy()](_get_term_hierarchy) wp-includes/taxonomy.php | Retrieves children of taxonomy as term IDs. |
| [\_get\_term\_children()](_get_term_children) wp-includes/taxonomy.php | Gets the subset of $terms that are descendants of $term\_id. |
| [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\_Term\_Query::get\_terms()](../classes/wp_term_query/get_terms) wp-includes/class-wp-term-query.php | Retrieves the query results. |
| [\_get\_term\_children()](_get_term_children) wp-includes/taxonomy.php | Gets the subset of $terms that are descendants of $term\_id. |
| Version | Description |
| --- | --- |
| [2.3.0](https://developer.wordpress.org/reference/since/2.3.0/) | Introduced. |
wordpress get_linksbyname( string $cat_name = "noname", string $before = '', string $after = '<br />', string $between = " ", bool $show_images = true, string $orderby = 'id', bool $show_description = true, bool $show_rating = false, int $limit = -1, int $show_updated ) get\_linksbyname( string $cat\_name = "noname", string $before = '', string $after = '<br />', string $between = " ", bool $show\_images = true, string $orderby = 'id', bool $show\_description = true, bool $show\_rating = false, int $limit = -1, int $show\_updated )
==========================================================================================================================================================================================================================================================================
This function has been deprecated. Use [get\_bookmarks()](get_bookmarks) instead.
Gets the links associated with category $cat\_name.
* [get\_bookmarks()](get_bookmarks)
`$cat_name` string Optional The category name to use. If no match is found, uses all.
Default `'noname'`. Default: `"noname"`
`$before` string Optional The HTML to output before the link. Default: `''`
`$after` string Optional The HTML to output after the link. Default `<br />`. Default: `'<br />'`
`$between` string Optional The HTML to output between the link/image and its description.
Not used if no image or $show\_images is true. Default ' '. Default: `" "`
`$show_images` bool Optional Whether to show images (if defined). Default: `true`
`$orderby` string Optional The order to output the links. E.g. `'id'`, `'name'`, `'url'`, `'description'`, `'rating'`, or `'owner'`. Default `'id'`.
If you start the name with an underscore, the order will be reversed.
Specifying `'rand'` as the order will return links in a random order. Default: `'id'`
`$show_description` bool Optional Whether to show the description if show\_images=false/not defined.
Default: `true`
`$show_rating` bool Optional Show rating stars/chars. Default: `false`
`$limit` int Optional Limit to X entries. If not specified, all entries are shown.
Default: `-1`
`$show_updated` int Optional Whether to show last updated timestamp. Default 0. File: `wp-includes/deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/deprecated.php/)
```
function get_linksbyname($cat_name = "noname", $before = '', $after = '<br />', $between = " ", $show_images = true, $orderby = 'id',
$show_description = true, $show_rating = false,
$limit = -1, $show_updated = 0) {
_deprecated_function( __FUNCTION__, '2.1.0', 'get_bookmarks()' );
$cat_id = -1;
$cat = get_term_by('name', $cat_name, 'link_category');
if ( $cat )
$cat_id = $cat->term_id;
get_links($cat_id, $before, $after, $between, $show_images, $orderby, $show_description, $show_rating, $limit, $show_updated);
}
```
| Uses | Description |
| --- | --- |
| [get\_links()](get_links) wp-includes/deprecated.php | Gets the links associated with category by ID. |
| [get\_term\_by()](get_term_by) wp-includes/taxonomy.php | Gets all term data from database by term field and data. |
| [\_deprecated\_function()](_deprecated_function) wp-includes/functions.php | Marks a function as deprecated and inform when it has been used. |
| Used By | Description |
| --- | --- |
| [get\_linksbyname\_withrating()](get_linksbyname_withrating) wp-includes/deprecated.php | Gets the links associated with category ‘cat\_name’ and display rating stars/chars. |
| Version | Description |
| --- | --- |
| [2.1.0](https://developer.wordpress.org/reference/since/2.1.0/) | Use [get\_bookmarks()](get_bookmarks) |
| [0.71](https://developer.wordpress.org/reference/since/0.71/) | Introduced. |
wordpress wp_is_file_mod_allowed( string $context ): bool wp\_is\_file\_mod\_allowed( string $context ): bool
===================================================
Determines whether file modifications are allowed.
`$context` string Required The usage context. bool True if file modification is allowed, false otherwise.
File: `wp-includes/load.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/load.php/)
```
function wp_is_file_mod_allowed( $context ) {
/**
* Filters whether file modifications are allowed.
*
* @since 4.8.0
*
* @param bool $file_mod_allowed Whether file modifications are allowed.
* @param string $context The usage context.
*/
return apply_filters( 'file_mod_allowed', ! defined( 'DISALLOW_FILE_MODS' ) || ! DISALLOW_FILE_MODS, $context );
}
```
[apply\_filters( 'file\_mod\_allowed', bool $file\_mod\_allowed, string $context )](../hooks/file_mod_allowed)
Filters whether file modifications are allowed.
| 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\_can\_install\_language\_pack()](wp_can_install_language_pack) wp-admin/includes/translation-install.php | Check if WordPress has access to the filesystem without asking for credentials. |
| [wp\_download\_language\_pack()](wp_download_language_pack) wp-admin/includes/translation-install.php | Download a language pack. |
| [WP\_Automatic\_Updater::is\_disabled()](../classes/wp_automatic_updater/is_disabled) wp-admin/includes/class-wp-automatic-updater.php | Determines whether the entire automatic updater is disabled. |
| [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. |
| Version | Description |
| --- | --- |
| [4.8.0](https://developer.wordpress.org/reference/since/4.8.0/) | Introduced. |
wordpress sanitize_hex_color( string $color ): string|void sanitize\_hex\_color( string $color ): string|void
==================================================
Sanitizes a hex color.
Returns either ”, a 3 or 6 digit hex color (with #), or nothing.
For sanitizing values without a #, see [sanitize\_hex\_color\_no\_hash()](sanitize_hex_color_no_hash) .
`$color` string Required string|void
File: `wp-includes/formatting.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/formatting.php/)
```
function sanitize_hex_color( $color ) {
if ( '' === $color ) {
return '';
}
// 3 or 6 hex digits, or the empty string.
if ( preg_match( '|^#([A-Fa-f0-9]{3}){1,2}$|', $color ) ) {
return $color;
}
}
```
| Used By | Description |
| --- | --- |
| [rest\_sanitize\_value\_from\_schema()](rest_sanitize_value_from_schema) wp-includes/rest-api.php | Sanitize a value based on a schema. |
| [sanitize\_hex\_color\_no\_hash()](sanitize_hex_color_no_hash) wp-includes/formatting.php | Sanitizes a hex color without a hash. Use [sanitize\_hex\_color()](sanitize_hex_color) when possible. |
| Version | Description |
| --- | --- |
| [3.4.0](https://developer.wordpress.org/reference/since/3.4.0/) | Introduced. |
wordpress _update_posts_count_on_transition_post_status( string $new_status, string $old_status, WP_Post $post = null ) \_update\_posts\_count\_on\_transition\_post\_status( string $new\_status, string $old\_status, WP\_Post $post = null )
=======================================================================================================================
Handler for updating the current site’s posts count when a post status changes.
`$new_status` string Required The status the post is changing to. `$old_status` string Required The status the post is changing from. `$post` [WP\_Post](../classes/wp_post) Optional Post object Default: `null`
File: `wp-includes/ms-blogs.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/ms-blogs.php/)
```
function _update_posts_count_on_transition_post_status( $new_status, $old_status, $post = null ) {
if ( $new_status === $old_status ) {
return;
}
if ( 'post' !== get_post_type( $post ) ) {
return;
}
if ( 'publish' !== $new_status && 'publish' !== $old_status ) {
return;
}
update_posts_count();
}
```
| Uses | Description |
| --- | --- |
| [get\_post\_type()](get_post_type) wp-includes/post.php | Retrieves the post type of the current post or of a given post. |
| [update\_posts\_count()](update_posts_count) wp-includes/ms-functions.php | Updates a blog’s post count. |
| Version | Description |
| --- | --- |
| [4.9.0](https://developer.wordpress.org/reference/since/4.9.0/) | Added the `$post` parameter. |
| [4.0.0](https://developer.wordpress.org/reference/since/4.0.0/) | Introduced. |
wordpress wp_cache_add_global_groups( string|string[] $groups ) wp\_cache\_add\_global\_groups( string|string[] $groups )
=========================================================
Adds a group or set of groups to the list of global groups.
* [WP\_Object\_Cache::add\_global\_groups()](../classes/wp_object_cache/add_global_groups)
`$groups` string|string[] Required A group or an array of groups to add. File: `wp-includes/cache.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/cache.php/)
```
function wp_cache_add_global_groups( $groups ) {
global $wp_object_cache;
$wp_object_cache->add_global_groups( $groups );
}
```
| Uses | Description |
| --- | --- |
| [WP\_Object\_Cache::add\_global\_groups()](../classes/wp_object_cache/add_global_groups) wp-includes/class-wp-object-cache.php | Sets the list of global cache groups. |
| Used By | Description |
| --- | --- |
| [WP\_Theme::\_\_construct()](../classes/wp_theme/__construct) wp-includes/class-wp-theme.php | Constructor for [WP\_Theme](../classes/wp_theme). |
| [wp\_start\_object\_cache()](wp_start_object_cache) wp-includes/load.php | Start the WordPress object cache. |
| [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) . |
| Version | Description |
| --- | --- |
| [2.6.0](https://developer.wordpress.org/reference/since/2.6.0/) | Introduced. |
wordpress user_can_edit_post_date( int $user_id, int $post_id, int $blog_id = 1 ): bool user\_can\_edit\_post\_date( 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 delete 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 returns true if $user\_id can edit $post\_id's date
File: `wp-includes/deprecated.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/deprecated.php/)
```
function user_can_edit_post_date($user_id, $post_id, $blog_id = 1) {
_deprecated_function( __FUNCTION__, '2.0.0', 'current_user_can()' );
$author_data = get_userdata($user_id);
return (($author_data->user_level > 4) && user_can_edit_post($user_id, $post_id, $blog_id));
}
```
| Uses | Description |
| --- | --- |
| [user\_can\_edit\_post()](user_can_edit_post) wp-includes/deprecated.php | Whether user can edit a post. |
| [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. |
| 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 query_posts( array|string $query ): WP_Post[]|int[] query\_posts( array|string $query ): WP\_Post[]|int[]
=====================================================
Sets up The Loop with query parameters.
Note: This function will completely override the main query and isn’t intended for use by plugins or themes. Its overly-simplistic approach to modifying the main query can be problematic and should be avoided wherever possible. In most cases, there are better, more performant options for modifying the main query such as via the [‘pre\_get\_posts’](../hooks/pre_get_posts) action within [WP\_Query](../classes/wp_query).
This must not be used within the WordPress Loop.
`$query` array|string Required Array or string of [WP\_Query](../classes/wp_query) arguments. [WP\_Post](../classes/wp_post)[]|int[] Array of post objects or post IDs.
Credit: Andrey Savchenko (rarst.net) / CC-By-SA.
[query\_posts()](query_posts) is a way to alter the main query that WordPress uses to display posts. It does this by putting the main query to one side, and replacing it with a new query. To clean up after a call to query\_posts, make a call to [wp\_reset\_query()](wp_reset_query) , and the original main query will be restored.
It should be noted that using this to replace the main query on a page can increase page loading times, in worst case scenarios more than doubling the amount of work needed or more. While easy to use, the function is also prone to confusion and problems later on. See the note further below on caveats for details.
For general post queries, use [WP\_Query](../classes/wp_query) or [get\_posts()](get_posts) .
It is ***strongly*** recommended that you use the [‘pre\_get\_posts’](../hooks/pre_get_posts) action instead, and alter the main query by checking [is\_main\_query()](is_main_query) .
For example, on the homepage, you would normally see the latest 10 posts. If you want to show only 5 posts (and don’t care about pagination), you can use [query\_posts()](query_posts) like so:
```
query_posts( 'posts_per_page=5' );
```
Here is similar code using the [‘pre\_get\_posts’](../hooks/pre_get_posts) action in functions.php :
```
function wpdocs_five_posts_on_homepage( $query ) {
if ( $query->is_home() && $query->is_main_query() ) {
$query->set( 'posts_per_page', 5 );
}
}
add_action( 'pre_get_posts', 'wpdocs_five_posts_on_homepage' );
```
```
// The Query
query_posts( $args );
// The Loop
while ( have_posts() ) : the_post();
echo '
<li>';
the_title();
echo '</li>
';
endwhile;
// Reset Query
wp_reset_query();
```
Place a call to [query\_posts()](query_posts) in one of your [Template](https://codex.wordpress.org/Templates) files before [The Loop](https://codex.wordpress.org/The%20Loop) begins. The [WP\_Query](../classes/wp_query) object will generate a new SQL query using your parameters. When you do this, WordPress ignores the other parameters it receives via the URL (such as page number or category).
If you want to preserve the original query parameter information that was used to generate the current query, and then add or over-ride some parameters, you can use the **$query\_string** global variable in the call to [query\_posts()](query_posts) .
For example, to set the display order of the posts without affecting the rest of the query string, you could place the following before [The Loop](https://codex.wordpress.org/The%20Loop):
```
global $query_string;
query_posts( $query_string . '&order=ASC' );
```
When using [query\_posts()](query_posts) in this way, the quoted portion of the parameter *must* begin with an ampersand (&).
Or alternatively, you can merge the original query array into your parameter array:
```
global $wp_query;
$args = array_merge( $wp_query->query_vars, array( 'post_type' => 'product' ) );
query_posts( $args );
```
You may have noticed from some of the examples above that you combine parameters with an ampersand (&), like so:
```
query_posts( 'cat=3&year=2004' );
```
Posts for category 13, for the current month on the main page:
```
if ( is_home() ) {
query_posts( $query_string . '&cat=13&monthnum=' . date( 'n', current_time( 'timestamp' ) ) );
}
```
At 2.3 this combination will return posts belong to both Category 1 AND 3, showing just two (2) posts, in descending order by the title:
```
query_posts( array( 'category__and' => array(1,3), 'posts_per_page' => 2, 'orderby' => 'title', 'order' => 'DESC' ) );
```
The following returns all posts that belong to category 1 and are tagged “apples”.
```
query_posts( 'cat=1&tag=apples' );
```
You can search for several tags using “+”. In this case, all posts belong to category 1 and tagged as “apples” and “oranges” are returned.
```
query_posts( 'cat=1&tag=apples+oranges' );
```
[query\_posts()](query_posts) is only one way amongst many to query the database and generate a list of posts. Before deciding to use [query\_posts()](query_posts) , be sure to understand the drawbacks.
[query\_posts()](query_posts) is meant for altering the main loop. It does so by replacing the query used to generate the main loop content. Once you use [query\_posts()](query_posts) , your post-related global variables and template tags will be altered. Conditional tags that are called after you call [query\_posts()](query_posts) will also be altered – this may or may not be the intended result.
To create secondary listings (for example, a list of related posts at the bottom of the page, or a list of links in a sidebar widget), try making a new instance of [WP\_Query](../classes/wp_query) or use [get\_posts()](get_posts) .
If you must use [query\_posts()](query_posts) , make sure you call [wp\_reset\_query()](wp_reset_query) after you’re done.
Pagination won’t work correctly, unless you set the ‘paged’ query var appropriately: [adding the paged parameter](https://codex.wordpress.org/Pagination#Adding_the_.22paged.22_parameter_to_a_query)
If you use query\_posts within a template page, WordPress will have already executed the database query and retrieved the records by the time it gets to your template page (that’s how it knew which template page to serve up!). So when you over-ride the default query with [query\_posts()](query_posts) , you’re essentially throwing away the default query and its results and re-executing another query against the database.
This is not necessarily a problem, especially if you’re dealing with a smaller blog-based site. Developers of large sites with big databases and heavy visitor traffic may wish to consider alternatives, such as modifying the default request directly (before it’s called). The [‘request’](../hooks/request) filter can be used to achieve exactly this.
The [‘parse\_query’](../hooks/parse_query) and the [‘pre\_get\_posts’](../hooks/pre_get_posts) filters are also available to modify the internal `$query` object that is used to generate the SQL to query the database.
* For more in-depth discussion of how WordPress generates and handles its queries, review these articles: [Query Overview](https://codex.wordpress.org/Query_Overview "Query Overview") and [Custom Queries](https://codex.wordpress.org/Custom_Queries "Custom Queries")
* Customize the Default Query properly using ‘pre\_get\_posts’ – [Bill Erickson – Customize the WordPress Query](http://www.billerickson.net/customize-the-wordpress-query/#example-category) or [John James Jacoby – Querying Posts Without query\_posts](http://developer.wordpress.com/2012/05/14/querying-posts-without-query_posts/)
* You don’t know Query [– Slides from WordCamp Netherlands 2012 by Andrew Nacin](http://www.slideshare.net/andrewnacin/you-dont-know-query-wordcamp-netherlands-2012)
File: `wp-includes/query.php`. [View all references](https://developer.wordpress.org/reference/files/wp-includes/query.php/)
```
function query_posts( $query ) {
$GLOBALS['wp_query'] = new WP_Query();
return $GLOBALS['wp_query']->query( $query );
}
```
| Uses | Description |
| --- | --- |
| [WP\_Query::\_\_construct()](../classes/wp_query/__construct) wp-includes/class-wp-query.php | Constructor. |
| Version | Description |
| --- | --- |
| [1.5.0](https://developer.wordpress.org/reference/since/1.5.0/) | 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.